flow-mindmap 0.1.1-beta.0 → 0.1.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- import { defineComponent as st, openBlock as w, createElementBlock as k, Fragment as R, createElementVNode as g, createStaticVNode as pe, createCommentVNode as D, ref as A, reactive as Ue, onMounted as ut, onBeforeUnmount as dt, computed as U, withModifiers as $, normalizeStyle as oe, createVNode as P, toDisplayString as ve, watch as Dt, nextTick as j, unref as S, renderList as Pt, normalizeClass as be, withDirectives as zn, withKeys as qe, vModelText as En, createBlock as Nn } from "vue";
2
- const In = ["width", "height", "stroke-width"], Wn = {
1
+ import { defineComponent as dt, openBlock as M, createElementBlock as C, Fragment as P, createElementVNode as y, createStaticVNode as Ne, createCommentVNode as O, ref as D, reactive as Ge, onMounted as ut, onBeforeUnmount as ct, computed as Q, withModifiers as R, normalizeStyle as ve, createVNode as F, toDisplayString as be, watch as Ye, nextTick as Z, unref as z, renderList as Ot, normalizeClass as Ie, withDirectives as Wn, withKeys as Ke, vModelText as $n, createBlock as Bn } from "vue";
2
+ const Rn = ["width", "height", "stroke-width"], An = {
3
3
  key: 4,
4
4
  points: "6 9 12 15 18 9"
5
- }, $n = {
5
+ }, Ln = {
6
6
  key: 5,
7
7
  points: "9 6 15 12 9 18"
8
- }, O = /* @__PURE__ */ st({
8
+ }, V = /* @__PURE__ */ dt({
9
9
  __name: "Icon",
10
10
  props: {
11
11
  name: {},
@@ -13,7 +13,7 @@ const In = ["width", "height", "stroke-width"], Wn = {
13
13
  stroke: {}
14
14
  },
15
15
  setup(n) {
16
- return (d, i) => (w(), k("svg", {
16
+ return (s, o) => (M(), C("svg", {
17
17
  width: n.size ?? 16,
18
18
  height: n.size ?? 16,
19
19
  viewBox: "0 0 24 24",
@@ -24,189 +24,192 @@ const In = ["width", "height", "stroke-width"], Wn = {
24
24
  "stroke-linejoin": "round",
25
25
  "aria-hidden": "true"
26
26
  }, [
27
- n.name === "add" ? (w(), k(R, { key: 0 }, [
28
- i[0] || (i[0] = g("circle", {
27
+ n.name === "add" ? (M(), C(P, { key: 0 }, [
28
+ o[0] || (o[0] = y("circle", {
29
29
  cx: "12",
30
30
  cy: "12",
31
31
  r: "9"
32
32
  }, null, -1)),
33
- i[1] || (i[1] = g("line", {
33
+ o[1] || (o[1] = y("line", {
34
34
  x1: "12",
35
35
  y1: "8",
36
36
  x2: "12",
37
37
  y2: "16"
38
38
  }, null, -1)),
39
- i[2] || (i[2] = g("line", {
39
+ o[2] || (o[2] = y("line", {
40
40
  x1: "8",
41
41
  y1: "12",
42
42
  x2: "16",
43
43
  y2: "12"
44
44
  }, null, -1))
45
- ], 64)) : n.name === "minus" ? (w(), k(R, { key: 1 }, [
46
- i[3] || (i[3] = g("circle", {
45
+ ], 64)) : n.name === "minus" ? (M(), C(P, { key: 1 }, [
46
+ o[3] || (o[3] = y("circle", {
47
47
  cx: "12",
48
48
  cy: "12",
49
49
  r: "9"
50
50
  }, null, -1)),
51
- i[4] || (i[4] = g("line", {
51
+ o[4] || (o[4] = y("line", {
52
52
  x1: "8",
53
53
  y1: "12",
54
54
  x2: "16",
55
55
  y2: "12"
56
56
  }, null, -1))
57
- ], 64)) : n.name === "delete" ? (w(), k(R, { key: 2 }, [
58
- i[5] || (i[5] = pe('<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>', 5))
59
- ], 64)) : n.name === "edit" ? (w(), k(R, { key: 3 }, [
60
- i[6] || (i[6] = g("path", { d: "M4 20 l4 -1 11 -11 -3 -3 -11 11 z" }, null, -1)),
61
- i[7] || (i[7] = g("line", {
57
+ ], 64)) : n.name === "delete" ? (M(), C(P, { key: 2 }, [
58
+ o[5] || (o[5] = Ne('<polyline points="4 7 20 7"></polyline><path d="M9 7 V5 a1 1 0 0 1 1 -1 h4 a1 1 0 0 1 1 1 V7"></path><path d="M6 7 l1 12 a1 1 0 0 0 1 1 h8 a1 1 0 0 0 1 -1 l1 -12"></path><line x1="10" y1="11" x2="10" y2="18"></line><line x1="14" y1="11" x2="14" y2="18"></line>', 5))
59
+ ], 64)) : n.name === "edit" ? (M(), C(P, { key: 3 }, [
60
+ o[6] || (o[6] = y("path", { d: "M4 20 l4 -1 11 -11 -3 -3 -11 11 z" }, null, -1)),
61
+ o[7] || (o[7] = y("line", {
62
62
  x1: "14",
63
63
  y1: "6",
64
64
  x2: "18",
65
65
  y2: "10"
66
66
  }, null, -1))
67
- ], 64)) : n.name === "collapse" ? (w(), k("polyline", Wn)) : n.name === "expand" ? (w(), k("polyline", $n)) : n.name === "zoom-in" ? (w(), k(R, { key: 6 }, [
68
- i[8] || (i[8] = g("circle", {
67
+ ], 64)) : n.name === "collapse" ? (M(), C("polyline", An)) : n.name === "expand" ? (M(), C("polyline", Ln)) : n.name === "zoom-in" ? (M(), C(P, { key: 6 }, [
68
+ o[8] || (o[8] = y("circle", {
69
69
  cx: "11",
70
70
  cy: "11",
71
71
  r: "7"
72
72
  }, null, -1)),
73
- i[9] || (i[9] = g("line", {
73
+ o[9] || (o[9] = y("line", {
74
74
  x1: "11",
75
75
  y1: "8",
76
76
  x2: "11",
77
77
  y2: "14"
78
78
  }, null, -1)),
79
- i[10] || (i[10] = g("line", {
79
+ o[10] || (o[10] = y("line", {
80
80
  x1: "8",
81
81
  y1: "11",
82
82
  x2: "14",
83
83
  y2: "11"
84
84
  }, null, -1)),
85
- i[11] || (i[11] = g("line", {
85
+ o[11] || (o[11] = y("line", {
86
86
  x1: "16",
87
87
  y1: "16",
88
88
  x2: "21",
89
89
  y2: "21"
90
90
  }, null, -1))
91
- ], 64)) : n.name === "zoom-out" ? (w(), k(R, { key: 7 }, [
92
- i[12] || (i[12] = g("circle", {
91
+ ], 64)) : n.name === "zoom-out" ? (M(), C(P, { key: 7 }, [
92
+ o[12] || (o[12] = y("circle", {
93
93
  cx: "11",
94
94
  cy: "11",
95
95
  r: "7"
96
96
  }, null, -1)),
97
- i[13] || (i[13] = g("line", {
97
+ o[13] || (o[13] = y("line", {
98
98
  x1: "8",
99
99
  y1: "11",
100
100
  x2: "14",
101
101
  y2: "11"
102
102
  }, null, -1)),
103
- i[14] || (i[14] = g("line", {
103
+ o[14] || (o[14] = y("line", {
104
104
  x1: "16",
105
105
  y1: "16",
106
106
  x2: "21",
107
107
  y2: "21"
108
108
  }, null, -1))
109
- ], 64)) : n.name === "reset" ? (w(), k(R, { key: 8 }, [
110
- i[15] || (i[15] = g("circle", {
109
+ ], 64)) : n.name === "reset" ? (M(), C(P, { key: 8 }, [
110
+ o[15] || (o[15] = y("circle", {
111
111
  cx: "12",
112
112
  cy: "12",
113
113
  r: "9"
114
114
  }, null, -1)),
115
- i[16] || (i[16] = g("circle", {
115
+ o[16] || (o[16] = y("circle", {
116
116
  cx: "12",
117
117
  cy: "12",
118
118
  r: "4"
119
119
  }, null, -1)),
120
- i[17] || (i[17] = g("circle", {
120
+ o[17] || (o[17] = y("circle", {
121
121
  cx: "12",
122
122
  cy: "12",
123
123
  r: "0.8",
124
124
  fill: "currentColor"
125
125
  }, null, -1))
126
- ], 64)) : n.name === "logo" ? (w(), k(R, { key: 9 }, [
127
- i[18] || (i[18] = pe('<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>', 9))
128
- ], 64)) : n.name === "import" ? (w(), k(R, { key: 10 }, [
129
- i[19] || (i[19] = g("path", { d: "M12 4 V15" }, null, -1)),
130
- i[20] || (i[20] = g("polyline", { points: "7 10 12 15 17 10" }, null, -1)),
131
- i[21] || (i[21] = g("path", { d: "M4 19 H20" }, null, -1))
132
- ], 64)) : n.name === "export" ? (w(), k(R, { key: 11 }, [
133
- i[22] || (i[22] = g("path", { d: "M12 15 V4" }, null, -1)),
134
- i[23] || (i[23] = g("polyline", { points: "7 9 12 4 17 9" }, null, -1)),
135
- i[24] || (i[24] = g("path", { d: "M4 19 H20" }, null, -1))
136
- ], 64)) : n.name === "balance" ? (w(), k(R, { key: 12 }, [
137
- i[25] || (i[25] = pe('<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>', 9))
138
- ], 64)) : n.name === "mindmap" ? (w(), k(R, { key: 13 }, [
139
- i[26] || (i[26] = pe('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>', 5))
140
- ], 64)) : n.name === "tree" ? (w(), k(R, { key: 14 }, [
141
- i[27] || (i[27] = pe('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>', 7))
142
- ], 64)) : n.name === "org" ? (w(), k(R, { key: 15 }, [
143
- i[28] || (i[28] = pe('<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>', 9))
144
- ], 64)) : n.name === "image" ? (w(), k(R, { key: 16 }, [
145
- i[29] || (i[29] = g("rect", {
126
+ ], 64)) : n.name === "logo" ? (M(), C(P, { key: 9 }, [
127
+ o[18] || (o[18] = Ne('<circle cx="12" cy="12" r="2.2"></circle><circle cx="4" cy="5" r="1.6"></circle><circle cx="20" cy="5" r="1.6"></circle><circle cx="4" cy="19" r="1.6"></circle><circle cx="20" cy="19" r="1.6"></circle><line x1="10.5" y1="10.8" x2="5.2" y2="6.4"></line><line x1="13.5" y1="10.8" x2="18.8" y2="6.4"></line><line x1="10.5" y1="13.2" x2="5.2" y2="17.6"></line><line x1="13.5" y1="13.2" x2="18.8" y2="17.6"></line>', 9))
128
+ ], 64)) : n.name === "import" ? (M(), C(P, { key: 10 }, [
129
+ o[19] || (o[19] = y("path", { d: "M12 4 V15" }, null, -1)),
130
+ o[20] || (o[20] = y("polyline", { points: "7 10 12 15 17 10" }, null, -1)),
131
+ o[21] || (o[21] = y("path", { d: "M4 19 H20" }, null, -1))
132
+ ], 64)) : n.name === "export" ? (M(), C(P, { key: 11 }, [
133
+ o[22] || (o[22] = y("path", { d: "M12 15 V4" }, null, -1)),
134
+ o[23] || (o[23] = y("polyline", { points: "7 9 12 4 17 9" }, null, -1)),
135
+ o[24] || (o[24] = y("path", { d: "M4 19 H20" }, null, -1))
136
+ ], 64)) : n.name === "balance" ? (M(), C(P, { key: 12 }, [
137
+ o[25] || (o[25] = Ne('<line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line><polyline points="9 4 5 6 9 8"></polyline><polyline points="15 4 19 6 15 8"></polyline><polyline points="9 10 5 12 9 14"></polyline><polyline points="15 10 19 12 15 14"></polyline><polyline points="9 16 5 18 9 20"></polyline><polyline points="15 16 19 18 15 20"></polyline>', 9))
138
+ ], 64)) : n.name === "mindmap" ? (M(), C(P, { key: 13 }, [
139
+ o[26] || (o[26] = Ne('<circle cx="12" cy="12" r="2.2" fill="currentColor" stroke="none"></circle><line x1="13" y1="11" x2="19" y2="6"></line><line x1="13" y1="13" x2="19" y2="18"></line><line x1="11" y1="11" x2="5" y2="6"></line><line x1="11" y1="13" x2="5" y2="18"></line>', 5))
140
+ ], 64)) : n.name === "tree" ? (M(), C(P, { key: 14 }, [
141
+ o[27] || (o[27] = Ne('<circle cx="6" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="6" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="18" r="2" fill="currentColor" stroke="none"></circle><line x1="8" y1="12" x2="16" y2="6"></line><line x1="8" y1="12" x2="16" y2="12"></line><line x1="8" y1="12" x2="16" y2="18"></line>', 7))
142
+ ], 64)) : n.name === "org" ? (M(), C(P, { key: 15 }, [
143
+ o[28] || (o[28] = Ne('<circle cx="12" cy="5" r="2" fill="currentColor" stroke="none"></circle><circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="12" cy="19" r="2" fill="currentColor" stroke="none"></circle><circle cx="18" cy="19" r="2" fill="currentColor" stroke="none"></circle><line x1="12" y1="7" x2="12" y2="13"></line><line x1="6" y1="13" x2="18" y2="13"></line><line x1="6" y1="13" x2="6" y2="17"></line><line x1="12" y1="13" x2="12" y2="17"></line><line x1="18" y1="13" x2="18" y2="17"></line>', 9))
144
+ ], 64)) : n.name === "image" ? (M(), C(P, { key: 16 }, [
145
+ o[29] || (o[29] = y("rect", {
146
146
  x: "3",
147
147
  y: "5",
148
148
  width: "18",
149
149
  height: "14",
150
150
  rx: "2"
151
151
  }, null, -1)),
152
- i[30] || (i[30] = g("circle", {
152
+ o[30] || (o[30] = y("circle", {
153
153
  cx: "9",
154
154
  cy: "11",
155
155
  r: "1.6"
156
156
  }, null, -1)),
157
- i[31] || (i[31] = g("polyline", { points: "3 17 9 12 13 15 16 13 21 17" }, null, -1))
158
- ], 64)) : n.name === "x" ? (w(), k(R, { key: 17 }, [
159
- i[32] || (i[32] = g("line", {
157
+ o[31] || (o[31] = y("polyline", { points: "3 17 9 12 13 15 16 13 21 17" }, null, -1))
158
+ ], 64)) : n.name === "x" ? (M(), C(P, { key: 17 }, [
159
+ o[32] || (o[32] = y("line", {
160
160
  x1: "6",
161
161
  y1: "6",
162
162
  x2: "18",
163
163
  y2: "18"
164
164
  }, null, -1)),
165
- i[33] || (i[33] = g("line", {
165
+ o[33] || (o[33] = y("line", {
166
166
  x1: "18",
167
167
  y1: "6",
168
168
  x2: "6",
169
169
  y2: "18"
170
170
  }, null, -1))
171
- ], 64)) : n.name === "link" ? (w(), k(R, { key: 18 }, [
172
- i[34] || (i[34] = g("path", { d: "M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1" }, null, -1)),
173
- i[35] || (i[35] = g("path", { d: "M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1" }, null, -1))
174
- ], 64)) : n.name === "note" ? (w(), k(R, { key: 19 }, [
175
- i[36] || (i[36] = g("path", { d: "M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z" }, null, -1)),
176
- i[37] || (i[37] = g("line", {
171
+ ], 64)) : n.name === "link" ? (M(), C(P, { key: 18 }, [
172
+ o[34] || (o[34] = y("path", { d: "M10 13 a4 4 0 0 0 5.66 0 l3 -3 a4 4 0 1 0 -5.66 -5.66 l-1 1" }, null, -1)),
173
+ o[35] || (o[35] = y("path", { d: "M14 11 a4 4 0 0 0 -5.66 0 l-3 3 a4 4 0 1 0 5.66 5.66 l1 -1" }, null, -1))
174
+ ], 64)) : n.name === "note" ? (M(), C(P, { key: 19 }, [
175
+ o[36] || (o[36] = y("path", { d: "M6 4 h9 l3 3 v13 a1 1 0 0 1 -1 1 h-11 a1 1 0 0 1 -1 -1 v-15 a1 1 0 0 1 1 -1 z" }, null, -1)),
176
+ o[37] || (o[37] = y("line", {
177
177
  x1: "8",
178
178
  y1: "10",
179
179
  x2: "16",
180
180
  y2: "10"
181
181
  }, null, -1)),
182
- i[38] || (i[38] = g("line", {
182
+ o[38] || (o[38] = y("line", {
183
183
  x1: "8",
184
184
  y1: "13",
185
185
  x2: "16",
186
186
  y2: "13"
187
187
  }, null, -1)),
188
- i[39] || (i[39] = g("line", {
188
+ o[39] || (o[39] = y("line", {
189
189
  x1: "8",
190
190
  y1: "16",
191
191
  x2: "13",
192
192
  y2: "16"
193
193
  }, null, -1))
194
- ], 64)) : D("", !0)
195
- ], 8, In));
194
+ ], 64)) : O("", !0)
195
+ ], 8, Rn));
196
196
  }
197
- }), Bn = "data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e", Rn = "data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e", Je = [18, 15, 13, 12], An = [700, 600, 500, 400], Ln = [52, 40, 32, 28], Ot = [120, 80, 60, 44], Hn = [0.8, 0.8, 0.8, 0.8], Dn = Je.length - 1;
198
- function Pn(n) {
199
- return Math.round(Je[je(n)] * Hn[je(n)]);
197
+ }), Hn = "data:image/svg+xml,%3csvg%20t='1780822312364'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='7459'%20width='200'%20height='200'%3e%3cpath%20d='M329.16%20292.571h658.286V512H329.16zM329.16%200h658.286v219.429H329.16z'%20fill='%239AA1A2'%20p-id='7460'%3e%3c/path%3e%3cpath%20d='M44.927%20146.286a46.519%2046.519%200%200%201%2038.107-73.143h319.269v73.143H109.73V791.99l-48.713%205.705-24.43-651.41h8.339z'%20fill='%239AA1A2'%20p-id='7461'%3e%3c/path%3e%3cpath%20d='M363.83%20877.714H179.51c-78.775%200-142.921-66.12-142.921-147.31V112.787c0-21.943%2017.188-39.643%2038.473-39.643%2021.211%200%2033.5%2017.774%2033.5%2039.643v617.619c0%2037.522%2028.013%2076.58%2064.438%2076.58h190.903c21.211%200%2038.766%2013.97%2038.766%2035.84%200%2021.943-17.555%2034.89-38.766%2034.89z'%20fill='%239AA1A2'%20p-id='7462'%3e%3c/path%3e%3cpath%20d='M432.95%20438.857H179.51c-78.775%200-81.043-18.578-81.043-62.903l10.094-90.624c0%2020.48%2013.458%2080.677%2049.884%2080.677h210.139c21.211%200%20120.613%204.023%20120.613%2016.018%200%2011.922-35.036%2056.832-56.32%2056.832zM640.017%20749.714V640a54.857%2054.857%200%200%201%20109.714%200v109.714h109.715a54.857%2054.857%200%200%201%200%20109.715H749.73v109.714a54.857%2054.857%200%200%201-109.714%200V859.429H530.303a54.857%2054.857%200%200%201%200-109.715h109.714z'%20fill='%239AA1A2'%20p-id='7463'%3e%3c/path%3e%3c/svg%3e", Dn = "data:image/svg+xml,%3csvg%20t='1780822464335'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='8457'%20width='200'%20height='200'%3e%3cpath%20d='M512%20804.571h512V1024H512V804.571zM0%200h658.286v219.429H0V0z'%20fill='%239AA1A2'%20p-id='8458'%3e%3c/path%3e%3cpath%20d='M619.813%20950.857h-184.32c-78.775%200-142.922-66.121-142.922-147.31V185.93c0-21.943%2017.189-39.643%2038.474-39.643%2021.211%200%2033.353%2017.773%2033.353%2039.643v617.618c0%2037.523%2034.743%2073.728%2071.095%2073.728h184.32c21.211%200%2038.473%2012.069%2038.473%2033.939%200%2021.943-17.189%2039.643-38.473%2039.643z'%20fill='%239AA1A2'%20p-id='8459'%3e%3c/path%3e%3cpath%20d='M676.571%20457.143V347.429a54.857%2054.857%200%200%201%20109.715%200v109.714H896a54.857%2054.857%200%200%201%200%20109.714H786.286v109.714a54.857%2054.857%200%200%201-109.715%200V566.857H566.857a54.857%2054.857%200%200%201%200-109.714h109.714z'%20fill='%239AA1A2'%20p-id='8460'%3e%3c/path%3e%3c/svg%3e", Yt = [18, 15, 13, 12], Pn = [700, 600, 500, 400], Tn = [52, 40, 32, 28], On = [120, 80, 60, 44], Fn = [0.8, 0.8, 0.8, 0.8], Vn = Yt.length - 1;
198
+ function Xn(n, s) {
199
+ return Math.round(ft(n, s) * Fn[Ze(n)]);
200
200
  }
201
- function je(n) {
202
- return Math.min(Dn, Math.max(0, n));
201
+ function Ze(n) {
202
+ return Math.min(Vn, Math.max(0, n));
203
203
  }
204
- function On(n) {
205
- return Je[je(n)];
204
+ function ft(n, s = 14) {
205
+ return Math.round(Yt[Ze(n)] * s / 14 * 10) / 10;
206
206
  }
207
- const Ye = 60, Me = 14, J = 24;
207
+ function qn(n, s = 14) {
208
+ return Math.round(Tn[Ze(n)] * s / 14);
209
+ }
210
+ const Ue = 60, $e = 14, te = 24;
208
211
  let at = null;
209
- function Tn() {
212
+ function Yn() {
210
213
  if (at) return at;
211
214
  const n = typeof document < "u" ? document.createElement("canvas").getContext("2d") : null;
212
215
  return n ? (at = n, n) : {
@@ -214,187 +217,187 @@ function Tn() {
214
217
  measureText: () => ({ width: 0 })
215
218
  };
216
219
  }
217
- const Tt = /* @__PURE__ */ new Map();
218
- function Fn(n, d, i) {
219
- const l = `${i}|${d}|${n}`, a = Tt.get(l);
220
+ const Ft = /* @__PURE__ */ new Map();
221
+ function Kn(n, s, o) {
222
+ const i = `${o}|${s}|${n}`, a = Ft.get(i);
220
223
  if (a !== void 0) return a;
221
- const s = Tn();
222
- s.font = `${i} ${d}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;
223
- const f = s.measureText(n).width;
224
- return Tt.set(l, f), f;
224
+ const d = Yn();
225
+ d.font = `${o} ${s}px "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif`;
226
+ const c = d.measureText(n).width;
227
+ return Ft.set(i, c), c;
225
228
  }
226
- const Vn = 24, Xn = 400, qn = 8, Ft = 16, Yn = 4;
227
- function Un(n, d, i) {
228
- return Math.min(i, Math.max(d, n));
229
+ const Un = 24, Gn = 400, jn = 8, Vt = 16, Jn = 4, Zn = 200;
230
+ function Qn(n, s, o) {
231
+ return Math.min(o, Math.max(s, n));
229
232
  }
230
- function Kn(n, d) {
231
- const i = je(d), l = Fn(n.text || "", Je[i], An[i]), a = Pn(d), s = Math.ceil(l + a * 2), f = Ln[i];
232
- let x = 0;
233
- if (n.link && (x += Ft), n.note && (x += Ft), x > 0) {
234
- const I = (n.link ? 1 : 0) + (n.note ? 1 : 0);
235
- x += Yn * I;
233
+ function _n(n, s, o) {
234
+ const i = Ze(s), a = ft(s, o), d = Math.min(Kn(n.text || "", a, Pn[i]), Zn), c = Xn(s, o), x = Math.ceil(d + c * 2), m = qn(s, o);
235
+ let h = 0;
236
+ if (n.link && (h += Vt), n.note && (h += Vt), h > 0) {
237
+ const U = (n.link ? 1 : 0) + (n.note ? 1 : 0);
238
+ h += Jn * U;
236
239
  }
237
- const m = s + x;
240
+ const u = x + h, p = Math.round(On[i] * o / 14);
238
241
  if (!n.image)
239
- return { w: Math.max(Ot[i], m), h: f };
240
- const y = Un(n.image.width, Vn, Xn), u = Math.max(Ot[i], m, Math.ceil(y + a * 2)), b = Math.ceil(n.image.height + qn + f);
241
- return { w: u, h: b };
242
+ return { w: Math.max(p, u), h: m };
243
+ const S = Qn(n.image.width, Un, Gn), b = Math.max(p, u, Math.ceil(S + c * 2)), A = Math.ceil(n.image.height + jn + m);
244
+ return { w: b, h: A };
242
245
  }
243
- function Gn(n, d = {}) {
244
- const i = d.mode ?? "mindmap", l = d.preservePositions === !0, a = qt(n, 0, null, 1, "right");
245
- return Jn(a), jn(a, i, l), a.x = 0, a.y = 0, Zn(a, l);
246
+ function ei(n, s = {}) {
247
+ const o = s.mode ?? "mindmap", i = s.preservePositions === !0, a = s.baseFontSize ?? 14, d = Ut(n, 0, null, 1, "right", a);
248
+ return ni(d), ti(d, o, i), d.x = 0, d.y = 0, ii(d, i);
246
249
  }
247
- function jn(n, d, i = !1) {
248
- if (d === "mindmap") {
249
- const l = n.children;
250
- if (l.length !== 0) if (l.length === 1)
251
- l[0]._dir = "right", l[0].side = 1, l[0]._dirRight = 1;
250
+ function ti(n, s, o = !1) {
251
+ if (s === "mindmap") {
252
+ const i = n.children;
253
+ if (i.length !== 0) if (i.length === 1)
254
+ i[0]._dir = "right", i[0].side = 1, i[0]._dirRight = 1;
252
255
  else {
253
- const x = l.reduce((b, I) => b + I._subtreeH, 0);
254
- let m = 1, y = Math.abs(l[0]._subtreeH - (x - l[0]._subtreeH)), u = 0;
255
- for (let b = 0; b < l.length - 1; b++) {
256
- u += l[b]._subtreeH;
257
- const I = Math.abs(u - (x - u));
258
- I < y && (y = I, m = b + 1);
256
+ const x = i.reduce((p, S) => p + S._subtreeH, 0);
257
+ let m = 1, h = Math.abs(i[0]._subtreeH - (x - i[0]._subtreeH)), u = 0;
258
+ for (let p = 0; p < i.length - 1; p++) {
259
+ u += i[p]._subtreeH;
260
+ const S = Math.abs(u - (x - u));
261
+ S < h && (h = S, m = p + 1);
259
262
  }
260
- for (let b = 0; b < m; b++)
261
- l[b]._dir = "right", l[b].side = 1, l[b]._dirRight = 1;
262
- for (let b = m; b < l.length; b++)
263
- l[b]._dir = "left", l[b].side = -1, l[b]._dirRight = -1;
264
- }
265
- const a = n.children.filter((x) => x.side === 1), s = n.children.filter((x) => x.side === -1), f = (x, m) => {
266
- const y = m === "right" ? 1 : -1;
267
- x._dir = m, x.side = y, x._dirRight = y;
268
- for (const u of x.children) f(u, m);
263
+ for (let p = 0; p < m; p++)
264
+ i[p]._dir = "right", i[p].side = 1, i[p]._dirRight = 1;
265
+ for (let p = m; p < i.length; p++)
266
+ i[p]._dir = "left", i[p].side = -1, i[p]._dirRight = -1;
267
+ }
268
+ const a = n.children.filter((x) => x.side === 1), d = n.children.filter((x) => x.side === -1), c = (x, m) => {
269
+ const h = m === "right" ? 1 : -1;
270
+ x._dir = m, x.side = h, x._dirRight = h;
271
+ for (const u of x.children) c(u, m);
269
272
  };
270
- for (const x of a) f(x, "right");
271
- for (const x of s) f(x, "left");
273
+ for (const x of a) c(x, "right");
274
+ for (const x of d) c(x, "left");
272
275
  if (a.length > 0) {
273
276
  const x = { ...n, children: a };
274
- Ke(x, "right", Ye, !0, i);
277
+ je(x, "right", Ue, !0, o);
275
278
  }
276
- if (s.length > 0) {
277
- const x = { ...n, children: s };
278
- Ke(x, "left", Ye, !0, i);
279
+ if (d.length > 0) {
280
+ const x = { ...n, children: d };
281
+ je(x, "left", Ue, !0, o);
279
282
  }
280
- } else if (d === "tree") {
281
- const l = (a) => {
283
+ } else if (s === "tree") {
284
+ const i = (a) => {
282
285
  a.side = 1, a._dir = "right";
283
- for (const s of a.children) l(s);
286
+ for (const d of a.children) i(d);
284
287
  };
285
288
  for (const a of n.children) a._dir = "right";
286
- Ke(n, "right", Ye, !0, i), l(n);
289
+ je(n, "right", Ue, !0, o), i(n);
287
290
  } else {
288
- for (const l of n.children) l._dir = "down";
289
- Xt(n, Ye, i);
291
+ for (const i of n.children) i._dir = "down";
292
+ Kt(n, Ue, o);
290
293
  }
291
294
  }
292
- function Ke(n, d, i, l, a = !1) {
295
+ function je(n, s, o, i, a = !1) {
293
296
  if (n.children.length === 0) return;
294
- const s = n.children.reduce(
295
- (y, u, b) => y + u._subtreeH + (b > 0 ? Me : 0),
297
+ const d = n.children.reduce(
298
+ (h, u, p) => h + u._subtreeH + (p > 0 ? $e : 0),
296
299
  0
297
- ), f = d === "right" ? 1 : -1, x = l ? f : 1;
298
- let m = n.y - x * s / 2;
299
- n.children.forEach((y) => {
300
- a || (y.x = n.x + f * (n.width / 2 + i + y.width / 2), y.y = m + x * y._subtreeH / 2), y._dir = d, m += x * (y._subtreeH + Me), Ke(y, d, i, !1, a);
300
+ ), c = s === "right" ? 1 : -1, x = i ? c : 1;
301
+ let m = n.y - x * d / 2;
302
+ n.children.forEach((h) => {
303
+ a || (h.x = n.x + c * (n.width / 2 + o + h.width / 2), h.y = m + x * h._subtreeH / 2), h._dir = s, m += x * (h._subtreeH + $e), je(h, s, o, !1, a);
301
304
  });
302
305
  }
303
- function Xt(n, d, i = !1) {
306
+ function Kt(n, s, o = !1) {
304
307
  if (n.children.length === 0) return;
305
- const l = n.children.reduce(
306
- (s, f, x) => s + f._subtreeW + (x > 0 ? Me * 2 : 0),
308
+ const i = n.children.reduce(
309
+ (d, c, x) => d + c._subtreeW + (x > 0 ? $e * 2 : 0),
307
310
  0
308
311
  );
309
- let a = n.x - l / 2;
310
- n.children.forEach((s) => {
311
- i || (s.x = a + s._subtreeW / 2, s.y = n.y + n.height / 2 + d + s.height / 2), s._dir = "down", a += s._subtreeW + Me * 2, Xt(s, d, i);
312
+ let a = n.x - i / 2;
313
+ n.children.forEach((d) => {
314
+ o || (d.x = a + d._subtreeW / 2, d.y = n.y + n.height / 2 + s + d.height / 2), d._dir = "down", a += d._subtreeW + $e * 2, Kt(d, s, o);
312
315
  });
313
316
  }
314
- function qt(n, d, i, l, a) {
315
- const s = Kn(n, d), f = {
317
+ function Ut(n, s, o, i, a, d) {
318
+ const c = _n(n, s, d), x = {
316
319
  id: n.id,
317
320
  text: n.text,
318
- depth: d,
321
+ depth: s,
319
322
  // Honor a user-set position from the data tree (drag commit).
320
323
  // The next applyDoLayout pass will overwrite these unless
321
324
  // preservePositions is true.
322
325
  x: n._x ?? 0,
323
326
  y: n._y ?? 0,
324
- width: s.w,
325
- height: s.h,
326
- fontSize: On(d),
327
- isRoot: d === 0,
327
+ width: c.w,
328
+ height: c.h,
329
+ fontSize: ft(s, d),
330
+ isRoot: s === 0,
328
331
  collapsed: n.collapsed,
329
- side: l,
332
+ side: i,
330
333
  _dir: a,
331
- _dirRight: l,
332
- _subtreeH: s.h,
333
- _subtreeW: s.w,
334
+ _dirRight: i,
335
+ _subtreeH: c.h,
336
+ _subtreeW: c.w,
334
337
  image: n.image ? { ...n.image } : void 0,
335
338
  link: n.link ? { url: n.link.url } : void 0,
336
339
  note: n.note ? { text: n.note.text } : void 0,
337
340
  children: [],
338
- parent: i
341
+ parent: o
339
342
  };
340
- if (n.collapsed) return f;
341
- const x = n.children.length, m = Math.ceil(x / 2);
342
- return f.children = n.children.map((y, u) => {
343
- const b = d === 0 ? u < m ? 1 : -1 : l;
344
- return qt(y, d + 1, f, b, a);
345
- }), f;
343
+ if (n.collapsed) return x;
344
+ const m = n.children.length, h = Math.ceil(m / 2);
345
+ return x.children = n.children.map((u, p) => {
346
+ const S = s === 0 ? p < h ? 1 : -1 : i;
347
+ return Ut(u, s + 1, x, S, a, d);
348
+ }), x;
346
349
  }
347
- function Jn(n) {
348
- const d = [n];
349
- for (let i = 0; i < d.length; i++) {
350
- const l = d[i];
351
- for (const a of l.children) d.push(a);
350
+ function ni(n) {
351
+ const s = [n];
352
+ for (let o = 0; o < s.length; o++) {
353
+ const i = s[o];
354
+ for (const a of i.children) s.push(a);
352
355
  }
353
- for (let i = d.length - 1; i >= 0; i--) {
354
- const l = d[i];
355
- if (l.collapsed || l.children.length === 0) {
356
- l._subtreeH = l.height, l._subtreeW = l.width;
356
+ for (let o = s.length - 1; o >= 0; o--) {
357
+ const i = s[o];
358
+ if (i.collapsed || i.children.length === 0) {
359
+ i._subtreeH = i.height, i._subtreeW = i.width;
357
360
  continue;
358
361
  }
359
- let a = 0, s = 0;
360
- for (const f of l.children)
361
- a += f._subtreeH, s += f._subtreeW;
362
- l.children.length > 1 && (a += Me * (l.children.length - 1), s += Me * 2 * (l.children.length - 1)), l._subtreeH = Math.max(l.height, a), l._subtreeW = Math.max(l.width, s);
362
+ let a = 0, d = 0;
363
+ for (const c of i.children)
364
+ a += c._subtreeH, d += c._subtreeW;
365
+ i.children.length > 1 && (a += $e * (i.children.length - 1), d += $e * 2 * (i.children.length - 1)), i._subtreeH = Math.max(i.height, a), i._subtreeW = Math.max(i.width, d);
363
366
  }
364
367
  }
365
- function Zn(n, d = !1) {
366
- const i = [n];
367
- let l = 1 / 0, a = -1 / 0, s = 1 / 0, f = -1 / 0;
368
- for (; i.length; ) {
369
- const y = i.pop(), u = y.width / 2, b = y.height / 2;
370
- y.x - u < l && (l = y.x - u), y.x + u > a && (a = y.x + u), y.y - b < s && (s = y.y - b), y.y + b > f && (f = y.y + b), i.push(...y.children);
368
+ function ii(n, s = !1) {
369
+ const o = [n];
370
+ let i = 1 / 0, a = -1 / 0, d = 1 / 0, c = -1 / 0;
371
+ for (; o.length; ) {
372
+ const h = o.pop(), u = h.width / 2, p = h.height / 2;
373
+ h.x - u < i && (i = h.x - u), h.x + u > a && (a = h.x + u), h.y - p < d && (d = h.y - p), h.y + p > c && (c = h.y + p), o.push(...h.children);
371
374
  }
372
- if (d)
375
+ if (s)
373
376
  return {
374
377
  root: n,
375
- width: a - l + J * 2,
376
- height: f - s + J * 2,
377
- vbX: l - J,
378
- vbY: s - J,
379
- vbW: a - l + J * 2,
380
- vbH: f - s + J * 2
378
+ width: a - i + te * 2,
379
+ height: c - d + te * 2,
380
+ vbX: i - te,
381
+ vbY: d - te,
382
+ vbW: a - i + te * 2,
383
+ vbH: c - d + te * 2
381
384
  };
382
- const x = J - s, m = [n];
385
+ const x = te - d, m = [n];
383
386
  for (; m.length; ) {
384
- const y = m.pop();
385
- y.y += x, m.push(...y.children);
387
+ const h = m.pop();
388
+ h.y += x, m.push(...h.children);
386
389
  }
387
- return s += x, f += x, {
390
+ return d += x, c += x, {
388
391
  root: n,
389
- width: a - l + J * 2,
390
- height: f + J,
391
- vbX: l - J,
392
+ width: a - i + te * 2,
393
+ height: c + te,
394
+ vbX: i - te,
392
395
  vbY: 0,
393
- vbW: a - l + J * 2,
394
- vbH: f + J
396
+ vbW: a - i + te * 2,
397
+ vbH: c + te
395
398
  };
396
399
  }
397
- const Le = [
400
+ const Pe = [
398
401
  {
399
402
  id: "default",
400
403
  name: "默认",
@@ -466,261 +469,344 @@ const Le = [
466
469
  ]
467
470
  }
468
471
  ];
469
- function Qn(n, d = []) {
470
- return [...Le, ...d].find((l) => l.id === n) ?? Le[0];
472
+ function oi(n, s = []) {
473
+ return [...Pe, ...s].find((i) => i.id === n) ?? Pe[0];
471
474
  }
472
- function Ze() {
475
+ function we() {
473
476
  return "n_" + Math.random().toString(36).slice(2, 10) + Date.now().toString(36).slice(-4);
474
477
  }
475
- function ke(n) {
478
+ function he(n) {
476
479
  return JSON.parse(JSON.stringify(n));
477
480
  }
478
- function W(n, d) {
479
- if (n.id === d) return n;
480
- for (const i of n.children) {
481
- const l = W(i, d);
482
- if (l) return l;
481
+ function B(n, s) {
482
+ if (n.id === s) return n;
483
+ for (const o of n.children) {
484
+ const i = B(o, s);
485
+ if (i) return i;
483
486
  }
484
487
  return null;
485
488
  }
486
- function te(n, d, i = null) {
487
- if (n.id === d) return i;
488
- for (const l of n.children) {
489
- const a = te(l, d, n);
489
+ function ae(n, s, o = null) {
490
+ if (n.id === s) return o;
491
+ for (const i of n.children) {
492
+ const a = ae(i, s, n);
490
493
  if (a !== null) return a;
491
494
  }
492
495
  return null;
493
496
  }
494
- function Yt(n, d) {
495
- const i = n.children.findIndex((l) => l.id === d);
496
- if (i >= 0)
497
- return n.children.splice(i, 1), !0;
498
- for (const l of n.children)
499
- if (Yt(l, d)) return !0;
497
+ function Gt(n, s) {
498
+ const o = n.children.findIndex((i) => i.id === s);
499
+ if (o >= 0)
500
+ return n.children.splice(o, 1), !0;
501
+ for (const i of n.children)
502
+ if (Gt(i, s)) return !0;
500
503
  return !1;
501
504
  }
502
- function _n(n, d, i) {
503
- const l = W(n, d);
504
- return !l || l.text === i ? !1 : (l.text = i, !0);
505
+ function li(n, s, o) {
506
+ const i = B(n, s);
507
+ return !i || i.text === o ? !1 : (i.text = o, !0);
505
508
  }
506
- function ei(n, d, i, l) {
507
- if (!te(n, d) || d === i || W(W(n, d), i)) return !1;
508
- const a = te(n, d), s = a.children.findIndex((y) => y.id === d);
509
- if (s < 0) return !1;
510
- const [f] = a.children.splice(s, 1);
511
- if (l === "child") {
512
- const y = W(n, i);
513
- return y ? (y.children.push(f), !0) : (a.children.splice(s, 0, f), !1);
509
+ function ri(n, s, o, i) {
510
+ if (!ae(n, s) || s === o || B(B(n, s), o)) return !1;
511
+ const a = ae(n, s), d = a.children.findIndex((h) => h.id === s);
512
+ if (d < 0) return !1;
513
+ const [c] = a.children.splice(d, 1);
514
+ if (i === "child") {
515
+ const h = B(n, o);
516
+ return h ? (h.children.push(c), !0) : (a.children.splice(d, 0, c), !1);
514
517
  }
515
- const x = te(n, i);
518
+ const x = ae(n, o);
516
519
  if (!x)
517
- return a.children.splice(s, 0, f), !1;
518
- let m = x.children.findIndex((y) => y.id === i);
519
- return m < 0 ? (a.children.splice(s, 0, f), !1) : (l === "after" && (m += 1), x.children.splice(m, 0, f), !0);
520
+ return a.children.splice(d, 0, c), !1;
521
+ let m = x.children.findIndex((h) => h.id === o);
522
+ return m < 0 ? (a.children.splice(d, 0, c), !1) : (i === "after" && (m += 1), x.children.splice(m, 0, c), !0);
520
523
  }
521
- function Ut(n) {
522
- const d = /^新节点(?:\s+(\d+))?$/;
523
- let i = 0, l = !1;
524
+ function jt(n) {
525
+ const s = /^新节点(?:\s+(\d+))?$/;
526
+ let o = 0, i = !1;
524
527
  for (const a of n.children) {
525
- const s = a.text.match(d);
526
- if (s)
527
- if (s[1]) {
528
- const f = parseInt(s[1], 10);
529
- f > i && (i = f);
528
+ const d = a.text.match(s);
529
+ if (d)
530
+ if (d[1]) {
531
+ const c = parseInt(d[1], 10);
532
+ c > o && (o = c);
530
533
  } else
531
- l = !0;
534
+ i = !0;
532
535
  }
533
- return i === 0 && !l ? Ge : i > 0 ? `新节点 ${i + 1}` : "新节点 2";
536
+ return o === 0 && !i ? Je : o > 0 ? `新节点 ${o + 1}` : "新节点 2";
534
537
  }
535
- function ti(n, d, i) {
536
- const l = W(n, d);
537
- if (!l) return null;
538
- const a = { id: Ze(), text: i ?? Ut(l), children: [] };
539
- return l.children.push(a), a;
538
+ function ai(n, s, o) {
539
+ const i = B(n, s);
540
+ if (!i) return null;
541
+ const a = { id: we(), text: o ?? jt(i), children: [] };
542
+ return i.children.push(a), a;
540
543
  }
541
- function ni(n, d, i) {
542
- const l = te(n, d);
543
- if (!l) return null;
544
- const a = l.children.findIndex((f) => f.id === d);
544
+ function ui(n, s, o) {
545
+ const i = ae(n, s);
546
+ if (!i) return null;
547
+ const a = i.children.findIndex((c) => c.id === s);
545
548
  if (a < 0) return null;
546
- const s = { id: Ze(), text: i ?? Ut(l), children: [] };
547
- return l.children.splice(a + 1, 0, s), s;
549
+ const d = { id: we(), text: o ?? jt(i), children: [] };
550
+ return i.children.splice(a + 1, 0, d), d;
548
551
  }
549
- function ii(n, d, i) {
550
- const l = te(n, d);
551
- if (!l) return null;
552
- const a = l.children.findIndex((f) => f.id === d);
552
+ function si(n, s, o) {
553
+ const i = ae(n, s);
554
+ if (!i) return null;
555
+ const a = i.children.findIndex((c) => c.id === s);
553
556
  if (a < 0) return null;
554
- const s = { id: Ze(), text: i, children: [] };
555
- return l.children.splice(a, 0, s), s;
557
+ const d = { id: we(), text: o, children: [] };
558
+ return i.children.splice(a, 0, d), d;
556
559
  }
557
- function li(n, d) {
558
- const i = te(n, d);
559
- if (!i) return null;
560
- const l = i.children.findIndex((f) => f.id === d);
561
- if (l < 0) return null;
562
- const a = i.children[l], s = ke(a);
563
- return Kt(s), i.children.splice(l + 1, 0, s), s;
560
+ function di(n, s) {
561
+ const o = ae(n, s);
562
+ if (!o) return null;
563
+ const i = o.children.findIndex((c) => c.id === s);
564
+ if (i < 0) return null;
565
+ const a = o.children[i], d = he(a);
566
+ return Jt(d), o.children.splice(i + 1, 0, d), d;
567
+ }
568
+ function Jt(n) {
569
+ n.id = we();
570
+ for (const s of n.children) Jt(s);
571
+ }
572
+ const Je = "新节点";
573
+ function Xt(n, s = "导入的导图") {
574
+ const o = n.split(/\r?\n/), i = { id: we(), text: s, children: [] }, a = [i], d = [-1 / 0], c = [], x = /^(#{1,6})\s+(.+?)\s*#*\s*$/, m = /^!\[([^\]]*)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, h = /^\[([^\]]+)\]\((\S+?)(?:\s+"[^"]*")?\)\s*$/, u = /^(`{3,}|~{3,})\s*(\S+)?\s*$/;
575
+ let p = !1, S = [], b = null;
576
+ function A(w) {
577
+ S.push(w);
578
+ }
579
+ function U() {
580
+ if (b && S.length > 0) {
581
+ for (; S.length > 0 && S[0].trim() === ""; ) S.shift();
582
+ for (; S.length > 0 && S[S.length - 1].trim() === ""; ) S.pop();
583
+ const w = S.join(`
584
+ `);
585
+ w && (b.note = { text: w });
586
+ }
587
+ p = !1, S = [];
588
+ }
589
+ for (const w of o) {
590
+ if (p) {
591
+ const Y = w.match(u);
592
+ if (Y && Y[1][0] === "`") {
593
+ U();
594
+ continue;
595
+ }
596
+ A(w);
597
+ continue;
598
+ }
599
+ const G = w.match(x);
600
+ if (G) {
601
+ const Y = G[1].length, re = G[2].trim();
602
+ c.push({ level: Y, text: re, body: "" }), b = c[c.length - 1];
603
+ continue;
604
+ }
605
+ const q = w.match(u);
606
+ if (q && q[2] === "note") {
607
+ p = !0, S = [];
608
+ continue;
609
+ }
610
+ const T = w.match(m);
611
+ if (T && b) {
612
+ const Y = T[2], re = 160, me = 120;
613
+ b.image = { src: Y, naturalW: re, naturalH: me, width: re, height: me };
614
+ continue;
615
+ }
616
+ const le = w.match(h);
617
+ if (le && b) {
618
+ b.link = { url: le[2] }, b.text = le[1];
619
+ continue;
620
+ }
621
+ w.trim().length > 0 && b && (b.body = b.body ? b.body + " " + w.trim() : w.trim());
622
+ }
623
+ p && U();
624
+ function ce(w) {
625
+ for (; a.length > 1; ) {
626
+ const le = a.length - 1, Y = d[le];
627
+ if (Y !== void 0 && Y < w.level) break;
628
+ a.pop(), d.pop();
629
+ }
630
+ const G = a[a.length - 1], q = w.text, T = { id: we(), text: q, children: [] };
631
+ w.image && (T.image = { ...w.image }), w.link && (T.link = { url: w.link.url }), w.note && (T.note = { text: w.note.text }), w.body && ue(w, c, c.indexOf(w)) && T.children.push({ id: we(), text: w.body, children: [] }), G.children.push(T), a.push(T), d.push(w.level);
632
+ }
633
+ function ue(w, G, q) {
634
+ for (let T = q + 1; T < G.length; T++) {
635
+ if (G[T].level <= w.level) return !0;
636
+ if (G[T].level > w.level) return !1;
637
+ }
638
+ return !0;
639
+ }
640
+ for (const w of c) ce(w);
641
+ if (c.length > 0 && c[0].level === 1) {
642
+ const w = i.children[0];
643
+ w && (i.text = w.text, i.id = w.id, w.image && (i.image = { ...w.image }), w.link && (i.link = { url: w.link.url }), w.note && (i.note = { text: w.note.text }), i.children = w.children);
644
+ }
645
+ return i;
564
646
  }
565
- function Kt(n) {
566
- n.id = Ze();
567
- for (const d of n.children) Kt(d);
647
+ function st(n, s = 1) {
648
+ let o = "#".repeat(s) + " " + (n.text || "") + `
649
+ `;
650
+ n.link && (o += `[${n.text || "link"}](${n.link.url})
651
+ `), n.image && (o += `![image](${n.image.src})
652
+ `), n.note && (o += "```note\n" + n.note.text + "\n```\n");
653
+ for (const i of n.children) o += st(i, s + 1);
654
+ return o;
568
655
  }
569
- const Ge = "新节点";
570
- function oi(n) {
571
- const d = n.minScale ?? 0.2, i = n.maxScale ?? 3, l = n.step ?? 1.2, a = A(1), s = A(0), f = A(0), x = A(!1), m = Ue({
656
+ function ci(n) {
657
+ const s = n.minScale ?? 0.2, o = n.maxScale ?? 3, i = n.step ?? 1.2, a = D(1), d = D(0), c = D(0), x = D(!1), m = Ge({
572
658
  x: 0,
573
659
  y: 0,
574
660
  ox: 0,
575
661
  oy: 0
576
- }), y = A(!1), u = Ue({ x: 0, y: 0 }), b = Ue({ x: 0, y: 0, width: 0, height: 0 }), I = A(0);
577
- let C = null;
578
- function H(E) {
579
- C = E;
662
+ }), h = D(!1), u = Ge({ x: 0, y: 0 }), p = Ge({ x: 0, y: 0, width: 0, height: 0 }), S = D(0);
663
+ let b = null;
664
+ function A(I) {
665
+ b = I;
580
666
  }
581
- function _(E) {
582
- E.preventDefault();
583
- const V = n.getContainer();
584
- if (!V) return;
585
- const q = -E.deltaY * 1e-3, K = Math.min(i, Math.max(d, a.value * (1 + q))), Z = V.getBoundingClientRect(), Q = E.clientX - Z.left, he = E.clientY - Z.top, Ie = (Q - s.value) / a.value, re = (he - f.value) / a.value;
586
- a.value = K, s.value = Q - Ie * K, f.value = he - re * K;
667
+ function U(I) {
668
+ I.preventDefault();
669
+ const W = n.getContainer();
670
+ if (!W) return;
671
+ const j = -I.deltaY * 1e-3, _ = Math.min(o, Math.max(s, a.value * (1 + j))), ne = W.getBoundingClientRect(), ie = I.clientX - ne.left, ke = I.clientY - ne.top, Be = (ie - d.value) / a.value, Me = (ke - c.value) / a.value;
672
+ a.value = _, d.value = ie - Be * _, c.value = ke - Me * _;
587
673
  }
588
- function ie() {
589
- a.value = Math.min(i, a.value * l);
674
+ function ce() {
675
+ a.value = Math.min(o, a.value * i);
590
676
  }
591
- function He() {
592
- a.value = Math.max(d, a.value / l);
677
+ function ue() {
678
+ a.value = Math.max(s, a.value / i);
593
679
  }
594
- function le(E) {
595
- var q;
596
- E.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, m.x = E.clientX, m.y = E.clientY, m.ox = s.value, m.oy = f.value, window.addEventListener("mousemove", Ce), window.addEventListener("mouseup", De), (q = E.preventDefault) == null || q.call(E));
680
+ function w(I) {
681
+ var j;
682
+ I.target.closest(".zm-node, .zm-toolbar, button, input, textarea") || (x.value = !0, m.x = I.clientX, m.y = I.clientY, m.ox = d.value, m.oy = c.value, window.addEventListener("mousemove", G), window.addEventListener("mouseup", q), (j = I.preventDefault) == null || j.call(I));
597
683
  }
598
- function Ce(E) {
599
- x.value && (s.value = m.ox + (E.clientX - m.x), f.value = m.oy + (E.clientY - m.y));
684
+ function G(I) {
685
+ x.value && (d.value = m.ox + (I.clientX - m.x), c.value = m.oy + (I.clientY - m.y));
600
686
  }
601
- function De() {
602
- x.value = !1, window.removeEventListener("mousemove", Ce), window.removeEventListener("mouseup", De);
687
+ function q() {
688
+ x.value = !1, window.removeEventListener("mousemove", G), window.removeEventListener("mouseup", q);
603
689
  }
604
- function Se(E, V) {
605
- y.value = !0, u.x = E, u.y = V, b.x = E, b.y = V, b.width = 0, b.height = 0, I.value++, window.addEventListener("mousemove", Ne), window.addEventListener("mouseup", Ee);
690
+ function T(I, W) {
691
+ h.value = !0, u.x = I, u.y = W, p.x = I, p.y = W, p.width = 0, p.height = 0, S.value++, window.addEventListener("mousemove", re), window.addEventListener("mouseup", Y);
606
692
  }
607
- function ze(E, V) {
608
- if (!y.value) return;
609
- const q = Math.min(u.x, E), K = Math.min(u.y, V), Z = Math.max(u.x, E), Q = Math.max(u.y, V);
610
- b.x = q, b.y = K, b.width = Z - q, b.height = Q - K, I.value++;
693
+ function le(I, W) {
694
+ if (!h.value) return;
695
+ const j = Math.min(u.x, I), _ = Math.min(u.y, W), ne = Math.max(u.x, I), ie = Math.max(u.y, W);
696
+ p.x = j, p.y = _, p.width = ne - j, p.height = ie - _, S.value++;
611
697
  }
612
- function Ee() {
613
- y.value = !1, window.removeEventListener("mousemove", Ne), window.removeEventListener("mouseup", Ee), C && C();
698
+ function Y() {
699
+ h.value = !1, window.removeEventListener("mousemove", re), window.removeEventListener("mouseup", Y), b && b();
614
700
  }
615
- function Ne(E) {
616
- if (!y.value) return;
617
- const V = n.getContainer();
618
- if (!V) return;
619
- const q = V.getBoundingClientRect(), K = (E.clientX - q.left - s.value) / a.value, Z = (E.clientY - q.top - f.value) / a.value;
620
- ze(K, Z);
701
+ function re(I) {
702
+ if (!h.value) return;
703
+ const W = n.getContainer();
704
+ if (!W) return;
705
+ const j = W.getBoundingClientRect(), _ = (I.clientX - j.left - d.value) / a.value, ne = (I.clientY - j.top - c.value) / a.value;
706
+ le(_, ne);
621
707
  }
622
- function F(E, V, q, K = 60) {
623
- const Z = n.getContainer();
624
- if (!Z) return;
625
- const Q = Z.getBoundingClientRect(), he = (Q.width - K * 2) / E, Ie = (Q.height - K * 2) / V, re = Math.min(1, Math.max(0.3, Math.min(he, Ie)));
626
- a.value = re, s.value = Q.width / 2, f.value = Q.height / 2 - q * re;
708
+ function me(I, W, j, _ = 60) {
709
+ const ne = n.getContainer();
710
+ if (!ne) return;
711
+ const ie = ne.getBoundingClientRect(), ke = (ie.width - _ * 2) / I, Be = (ie.height - _ * 2) / W, Me = Math.min(1, Math.max(0.3, Math.min(ke, Be)));
712
+ a.value = Me, d.value = ie.width / 2, c.value = ie.height / 2 - j * Me;
627
713
  }
628
714
  return {
629
715
  scale: a,
630
- offsetX: s,
631
- offsetY: f,
716
+ offsetX: d,
717
+ offsetY: c,
632
718
  isPanning: x,
633
- onWheel: _,
634
- zoomIn: ie,
635
- zoomOut: He,
636
- startPan: le,
637
- startMarquee: Se,
638
- updateMarquee: ze,
639
- isMarquee: y,
640
- marquee: b,
641
- marqueeVersion: I,
642
- setOnMarqueeEnd: H,
643
- resetView: F
719
+ onWheel: U,
720
+ zoomIn: ce,
721
+ zoomOut: ue,
722
+ startPan: w,
723
+ startMarquee: T,
724
+ updateMarquee: le,
725
+ isMarquee: h,
726
+ marquee: p,
727
+ marqueeVersion: S,
728
+ setOnMarqueeEnd: A,
729
+ resetView: me
644
730
  };
645
731
  }
646
- const ri = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
647
- function Vt(n) {
648
- return ri ? n.metaKey : n.ctrlKey;
732
+ const fi = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform);
733
+ function qt(n) {
734
+ return fi ? n.metaKey : n.ctrlKey;
649
735
  }
650
- function ai(n) {
651
- function d() {
652
- const l = n.getSelectedId();
653
- return l || (n.defaultTargetId ? n.defaultTargetId() : n.getRootId());
736
+ function vi(n) {
737
+ function s() {
738
+ const i = n.getSelectedId();
739
+ return i || (n.defaultTargetId ? n.defaultTargetId() : n.getRootId());
654
740
  }
655
- function i(l) {
656
- const a = l.target;
741
+ function o(i) {
742
+ const a = i.target;
657
743
  if (a && (a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.isContentEditable) || n.isReadonly() || n.isEditing()) return;
658
- const s = n.getSelectedId(), f = d();
659
- if (f) {
660
- if (Vt(l) && !l.shiftKey) {
661
- if (l.key === "d" || l.key === "D") {
662
- s && s !== n.getRootId() && (l.preventDefault(), n.onDuplicate(s));
744
+ const d = n.getSelectedId(), c = s();
745
+ if (c) {
746
+ if (qt(i) && !i.shiftKey) {
747
+ if (i.key === "d" || i.key === "D") {
748
+ d && d !== n.getRootId() && (i.preventDefault(), n.onDuplicate(d));
663
749
  return;
664
750
  }
665
- if (l.key === "z" || l.key === "Z") {
666
- l.preventDefault(), n.onUndo();
751
+ if (i.key === "z" || i.key === "Z") {
752
+ i.preventDefault(), n.onUndo();
667
753
  return;
668
754
  }
669
- if (l.key === "y" || l.key === "Y") {
670
- l.preventDefault(), n.onRedo();
755
+ if (i.key === "y" || i.key === "Y") {
756
+ i.preventDefault(), n.onRedo();
671
757
  return;
672
758
  }
673
- if (l.key === "Home") {
674
- l.preventDefault(), n.onSelectRoot();
759
+ if (i.key === "Home") {
760
+ i.preventDefault(), n.onSelectRoot();
675
761
  return;
676
762
  }
677
763
  }
678
- if (Vt(l) && l.shiftKey && (l.key === "Z" || l.key === "z")) {
679
- l.preventDefault(), n.onRedo();
764
+ if (qt(i) && i.shiftKey && (i.key === "Z" || i.key === "z")) {
765
+ i.preventDefault(), n.onRedo();
680
766
  return;
681
767
  }
682
- l.key === "Tab" ? (l.preventDefault(), n.onAddChild(f)) : l.key === "Enter" ? (l.preventDefault(), l.shiftKey ? s && s !== n.getRootId() && n.onAddSiblingBefore(s) : n.onAddSibling(f)) : (l.key === "Delete" || l.key === "Backspace") && s && s !== n.getRootId() ? (l.preventDefault(), n.onRemove(s)) : l.key === "F2" && s ? (l.preventDefault(), n.onStartEdit(s)) : l.key === "Escape" ? (l.preventDefault(), n.onClearSelection()) : l.key === "ArrowDown" ? (l.preventDefault(), n.onNavigate(0, 1)) : l.key === "ArrowUp" ? (l.preventDefault(), n.onNavigate(0, -1)) : l.key === "ArrowRight" ? (l.preventDefault(), n.onNavigate(1, 0)) : l.key === "ArrowLeft" && (l.preventDefault(), n.onNavigate(-1, 0));
768
+ i.key === "Tab" ? (i.preventDefault(), n.onAddChild(c)) : i.key === "Enter" ? (i.preventDefault(), i.shiftKey ? d && d !== n.getRootId() && n.onAddSiblingBefore(d) : n.onAddSibling(c)) : (i.key === "Delete" || i.key === "Backspace") && d && d !== n.getRootId() ? (i.preventDefault(), n.onRemove(d)) : i.key === "F2" && d ? (i.preventDefault(), n.onStartEdit(d)) : i.key === "Escape" ? (i.preventDefault(), n.onClearSelection()) : i.key === "ArrowDown" ? (i.preventDefault(), n.onNavigate(0, 1)) : i.key === "ArrowUp" ? (i.preventDefault(), n.onNavigate(0, -1)) : i.key === "ArrowRight" ? (i.preventDefault(), n.onNavigate(1, 0)) : i.key === "ArrowLeft" && (i.preventDefault(), n.onNavigate(-1, 0));
683
769
  }
684
770
  }
685
771
  ut(() => {
686
- window.addEventListener("keydown", i);
687
- }), dt(() => {
688
- window.removeEventListener("keydown", i);
772
+ window.addEventListener("keydown", o);
773
+ }), ct(() => {
774
+ window.removeEventListener("keydown", o);
689
775
  });
690
776
  }
691
- function ui(n = 100) {
692
- const d = A([]);
693
- let i = -1;
694
- function l() {
695
- return i > 0;
777
+ function hi(n = 100) {
778
+ const s = D([]);
779
+ let o = -1;
780
+ function i() {
781
+ return o > 0;
696
782
  }
697
783
  function a() {
698
- return i < d.value.length - 1;
784
+ return o < s.value.length - 1;
699
785
  }
700
- function s(y) {
701
- const u = JSON.stringify(y);
702
- for (i < d.value.length - 1 && (d.value = d.value.slice(0, i + 1)), d.value.push(u), i = d.value.length - 1; d.value.length > n; )
703
- d.value.shift(), i--;
786
+ function d(h) {
787
+ const u = JSON.stringify(h);
788
+ for (o < s.value.length - 1 && (s.value = s.value.slice(0, o + 1)), s.value.push(u), o = s.value.length - 1; s.value.length > n; )
789
+ s.value.shift(), o--;
704
790
  }
705
- function f() {
706
- return l() ? (i--, JSON.parse(d.value[i])) : null;
791
+ function c() {
792
+ return i() ? (o--, JSON.parse(s.value[o])) : null;
707
793
  }
708
794
  function x() {
709
- return a() ? (i++, JSON.parse(d.value[i])) : null;
795
+ return a() ? (o++, JSON.parse(s.value[o])) : null;
710
796
  }
711
797
  function m() {
712
- d.value = [], i = -1;
798
+ s.value = [], o = -1;
713
799
  }
714
800
  return {
715
- canUndo: l,
801
+ canUndo: i,
716
802
  canRedo: a,
717
- record: s,
718
- undo: f,
803
+ record: d,
804
+ undo: c,
719
805
  redo: x,
720
806
  reset: m
721
807
  };
722
808
  }
723
- const si = ["disabled"], di = ["disabled"], ci = ["disabled"], fi = ["disabled"], vi = ["disabled"], hi = ["disabled"], mi = /* @__PURE__ */ st({
809
+ const mi = ["disabled"], gi = ["disabled"], yi = ["disabled"], xi = ["disabled"], pi = ["disabled"], bi = ["disabled"], wi = /* @__PURE__ */ dt({
724
810
  __name: "NodeContextMenu",
725
811
  props: {
726
812
  x: {},
@@ -732,300 +818,324 @@ const si = ["disabled"], di = ["disabled"], ci = ["disabled"], fi = ["disabled"]
732
818
  readonly: { type: Boolean, default: !1 }
733
819
  },
734
820
  emits: ["pickImage", "setLink", "removeLink", "editNote", "removeNote", "removeImage", "close"],
735
- setup(n, { emit: d }) {
736
- const i = n, l = d, a = U(() => {
737
- let I = i.x + 2, C = i.y + 2;
738
- if (i.container) {
739
- const H = i.container.getBoundingClientRect(), _ = 180, ie = s.value ? f.value ? 184 : 160 : 136;
740
- I + _ > H.right && (I = Math.max(H.left + 4, i.x - _ - 2)), C + ie > H.bottom && (C = Math.max(H.top + 4, i.y - ie - 2)), I < H.left + 2 && (I = H.left + 2), C < H.top + 2 && (C = H.top + 2);
821
+ setup(n, { emit: s }) {
822
+ const o = n, i = s, a = Q(() => {
823
+ let S = o.x + 2, b = o.y + 2;
824
+ if (o.container) {
825
+ const A = o.container.getBoundingClientRect(), U = 180, ce = d.value ? c.value ? 184 : 160 : 136;
826
+ S + U > A.right && (S = Math.max(A.left + 4, o.x - U - 2)), b + ce > A.bottom && (b = Math.max(A.top + 4, o.y - ce - 2)), S < A.left + 2 && (S = A.left + 2), b < A.top + 2 && (b = A.top + 2);
741
827
  }
742
- return { left: I, top: C };
743
- }), s = U(() => i.hasImage), f = U(() => i.hasLink), x = U(() => i.hasNote);
744
- function m(I) {
745
- const C = I.target;
746
- C && C.closest(".zm-node-menu") || l("close");
828
+ return { left: S, top: b };
829
+ }), d = Q(() => o.hasImage), c = Q(() => o.hasLink), x = Q(() => o.hasNote);
830
+ function m(S) {
831
+ const b = S.target;
832
+ b && b.closest(".zm-node-menu") || i("close");
747
833
  }
748
- function y(I) {
749
- I.key === "Escape" && l("close");
834
+ function h(S) {
835
+ S.key === "Escape" && i("close");
750
836
  }
751
837
  function u() {
752
- l("close");
838
+ i("close");
753
839
  }
754
- window.addEventListener("mousedown", m, !0), window.addEventListener("keydown", y, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0), dt(() => {
755
- window.removeEventListener("mousedown", m, !0), window.removeEventListener("keydown", y, !0), window.removeEventListener("wheel", u, !0), window.removeEventListener("scroll", u, !0);
840
+ window.addEventListener("mousedown", m, !0), window.addEventListener("keydown", h, !0), window.addEventListener("wheel", u, !0), window.addEventListener("scroll", u, !0), ct(() => {
841
+ window.removeEventListener("mousedown", m, !0), window.removeEventListener("keydown", h, !0), window.removeEventListener("wheel", u, !0), window.removeEventListener("scroll", u, !0);
756
842
  });
757
- function b(I) {
758
- i.readonly || (I(), l("close"));
843
+ function p(S) {
844
+ o.readonly || (S(), i("close"));
759
845
  }
760
- return (I, C) => (w(), k("div", {
846
+ return (S, b) => (M(), C("div", {
761
847
  class: "zm-node-menu",
762
- style: oe({ left: a.value.left + "px", top: a.value.top + "px" }),
763
- onContextmenu: C[6] || (C[6] = $(() => {
848
+ style: ve({ left: a.value.left + "px", top: a.value.top + "px" }),
849
+ onContextmenu: b[6] || (b[6] = R(() => {
764
850
  }, ["prevent"]))
765
851
  }, [
766
- g("button", {
852
+ y("button", {
767
853
  class: "zm-node-menu-item",
768
854
  disabled: n.readonly,
769
- onClick: C[0] || (C[0] = $((H) => b(() => l("pickImage")), ["stop"]))
855
+ onClick: b[0] || (b[0] = R((A) => p(() => i("pickImage")), ["stop"]))
770
856
  }, [
771
- P(O, {
857
+ F(V, {
772
858
  name: "image",
773
859
  size: 13
774
860
  }),
775
- g("span", null, ve(s.value ? "替换图片" : "添加图片"), 1)
776
- ], 8, si),
777
- s.value ? (w(), k("button", {
861
+ y("span", null, be(d.value ? "替换图片" : "添加图片"), 1)
862
+ ], 8, mi),
863
+ d.value ? (M(), C("button", {
778
864
  key: 0,
779
865
  class: "zm-node-menu-item",
780
866
  disabled: n.readonly,
781
- onClick: C[1] || (C[1] = $((H) => b(() => l("removeImage")), ["stop"]))
867
+ onClick: b[1] || (b[1] = R((A) => p(() => i("removeImage")), ["stop"]))
782
868
  }, [
783
- P(O, {
869
+ F(V, {
784
870
  name: "x",
785
871
  size: 13
786
872
  }),
787
- C[7] || (C[7] = g("span", null, "移除图片", -1))
788
- ], 8, di)) : D("", !0),
789
- g("button", {
873
+ b[7] || (b[7] = y("span", null, "移除图片", -1))
874
+ ], 8, gi)) : O("", !0),
875
+ y("button", {
790
876
  class: "zm-node-menu-item",
791
877
  disabled: n.readonly,
792
- onClick: C[2] || (C[2] = $((H) => b(() => l("setLink")), ["stop"]))
878
+ onClick: b[2] || (b[2] = R((A) => p(() => i("setLink")), ["stop"]))
793
879
  }, [
794
- P(O, {
880
+ F(V, {
795
881
  name: "link",
796
882
  size: 13
797
883
  }),
798
- g("span", null, ve(f.value ? "编辑链接" : "添加链接"), 1)
799
- ], 8, ci),
800
- f.value ? (w(), k("button", {
884
+ y("span", null, be(c.value ? "编辑链接" : "添加链接"), 1)
885
+ ], 8, yi),
886
+ c.value ? (M(), C("button", {
801
887
  key: 1,
802
888
  class: "zm-node-menu-item",
803
889
  disabled: n.readonly,
804
- onClick: C[3] || (C[3] = $((H) => b(() => l("removeLink")), ["stop"]))
890
+ onClick: b[3] || (b[3] = R((A) => p(() => i("removeLink")), ["stop"]))
805
891
  }, [
806
- P(O, {
892
+ F(V, {
807
893
  name: "x",
808
894
  size: 13
809
895
  }),
810
- C[8] || (C[8] = g("span", null, "移除链接", -1))
811
- ], 8, fi)) : D("", !0),
812
- g("button", {
896
+ b[8] || (b[8] = y("span", null, "移除链接", -1))
897
+ ], 8, xi)) : O("", !0),
898
+ y("button", {
813
899
  class: "zm-node-menu-item",
814
900
  disabled: n.readonly,
815
- onClick: C[4] || (C[4] = $((H) => b(() => l("editNote")), ["stop"]))
901
+ onClick: b[4] || (b[4] = R((A) => p(() => i("editNote")), ["stop"]))
816
902
  }, [
817
- P(O, {
903
+ F(V, {
818
904
  name: "note",
819
905
  size: 13
820
906
  }),
821
- g("span", null, ve(x.value ? "编辑笔记" : "添加笔记"), 1)
822
- ], 8, vi),
823
- x.value ? (w(), k("button", {
907
+ y("span", null, be(x.value ? "编辑笔记" : "添加笔记"), 1)
908
+ ], 8, pi),
909
+ x.value ? (M(), C("button", {
824
910
  key: 2,
825
911
  class: "zm-node-menu-item",
826
912
  disabled: n.readonly,
827
- onClick: C[5] || (C[5] = $((H) => b(() => l("removeNote")), ["stop"]))
913
+ onClick: b[5] || (b[5] = R((A) => p(() => i("removeNote")), ["stop"]))
828
914
  }, [
829
- P(O, {
915
+ F(V, {
830
916
  name: "x",
831
917
  size: 13
832
918
  }),
833
- C[9] || (C[9] = g("span", null, "移除笔记", -1))
834
- ], 8, hi)) : D("", !0)
919
+ b[9] || (b[9] = y("span", null, "移除笔记", -1))
920
+ ], 8, bi)) : O("", !0)
835
921
  ], 36));
836
922
  }
837
- }), yi = ["viewBox", "width", "height"], gi = { class: "zm-edges" }, xi = ["d", "fill"], pi = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], bi = ["src", "width", "height", "alt"], wi = {
923
+ }), ki = ["viewBox", "width", "height"], Mi = { class: "zm-edges" }, Ci = ["d", "fill"], Si = ["data-node-id", "onClick", "onDblclick", "onContextmenu", "onMouseenter", "onMouseleave"], Ei = ["src", "width", "height", "alt"], zi = {
838
924
  key: 1,
839
925
  class: "zm-text"
840
- }, ki = { class: "zm-text-label" }, Mi = ["href", "title"], Ci = ["title", "onClick"], Si = ["title"], zi = ["title", "onClick"], Ei = ["onClick"], Ni = ["onMousedown"], Ii = ["onClick"], Wi = {
926
+ }, Ni = { class: "zm-text-label" }, Ii = ["href", "title"], Wi = ["title", "onClick"], $i = ["title"], Bi = ["title", "onClick"], Ri = ["onClick"], Ai = ["onMousedown"], Li = ["onClick"], Hi = {
841
927
  key: 0,
842
928
  class: "zm-toolbar"
843
- }, $i = ["src"], Bi = ["src"], Ri = { class: "zm-tb-tip" }, we = 24, Ae = 400, fe = 160, Ai = /* @__PURE__ */ st({
929
+ }, Di = ["src"], Pi = ["src"], Ti = { class: "zm-tb-tip" }, We = 24, De = 400, pe = 160, Oi = /* @__PURE__ */ dt({
844
930
  __name: "MindMap",
845
931
  props: {
846
932
  data: {},
847
933
  readonly: { type: Boolean, default: !1 },
848
934
  theme: {},
849
- previewMode: { type: Boolean, default: !1 }
935
+ previewMode: { type: Boolean, default: !1 },
936
+ markdown: {},
937
+ lineColors: {}
850
938
  },
851
- emits: ["change", "select", "edit-note"],
852
- setup(n, { expose: d, emit: i }) {
853
- const l = n, a = i, s = A(null), f = A(null), x = A(""), m = A(null), y = A(/* @__PURE__ */ new Set()), u = A(ke(l.data)), b = U(() => p.showOrderBadge === !0), I = A(/* @__PURE__ */ new Map()), C = I.value;
854
- function H(e, t) {
939
+ emits: ["change", "select", "edit-note", "markdownChange"],
940
+ setup(n, { expose: s, emit: o }) {
941
+ const i = n, a = o, d = D(null), c = D(null), x = D(""), m = D(null), h = D(/* @__PURE__ */ new Set()), u = D(he(i.data)), p = D(i.markdown !== void 0);
942
+ let S = !1;
943
+ Ye(
944
+ () => i.markdown,
945
+ (e) => {
946
+ if (e === void 0) {
947
+ p.value = !1;
948
+ return;
949
+ }
950
+ p.value = !0;
951
+ const t = Xt(e || "");
952
+ S = !0, u.value = he(t), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), Z(() => {
953
+ S = !1, se();
954
+ });
955
+ }
956
+ ), Ye(
957
+ u,
958
+ () => {
959
+ p.value && !S && a("markdownChange", st(u.value));
960
+ },
961
+ { deep: !0 }
962
+ );
963
+ const b = Q(() => k.showOrderBadge === !0), A = D(/* @__PURE__ */ new Map()), U = A.value;
964
+ function ce(e, t) {
855
965
  const r = {};
856
- t.bg && (r.bg = t.bg), t.textColor && (r.textColor = t.textColor), t.borderColor && (r.borderColor = t.borderColor), t.fontWeight && (r.fontWeight = t.fontWeight), Object.keys(r).length === 0 ? C.delete(e) : C.set(e, r), I.value = new Map(C);
966
+ t.bg && (r.bg = t.bg), t.textColor && (r.textColor = t.textColor), t.borderColor && (r.borderColor = t.borderColor), t.fontWeight && (r.fontWeight = t.fontWeight), Object.keys(r).length === 0 ? U.delete(e) : U.set(e, r), A.value = new Map(U);
857
967
  }
858
- function _(e) {
859
- return C.get(e) ?? {};
968
+ function ue(e) {
969
+ return U.get(e) ?? {};
860
970
  }
861
- function ie(e, t) {
862
- const r = W(u.value, e);
971
+ function w(e, t) {
972
+ const r = B(u.value, e);
863
973
  r && (r.image = {
864
974
  src: t.src,
865
975
  naturalW: t.naturalW,
866
976
  naturalH: t.naturalH,
867
- width: le(t.width, we, Ae),
868
- height: le(t.height, we, Ae)
869
- }, X(), L(), a("change", u.value));
977
+ width: q(t.width, We, De),
978
+ height: q(t.height, We, De)
979
+ }, K(), H(), a("change", u.value));
870
980
  }
871
- function He(e) {
872
- const t = W(u.value, e);
873
- !t || !t.image || (delete t.image, X(), L(), a("change", u.value));
981
+ function G(e) {
982
+ const t = B(u.value, e);
983
+ !t || !t.image || (delete t.image, K(), H(), a("change", u.value));
874
984
  }
875
- function le(e, t, r) {
985
+ function q(e, t, r) {
876
986
  return Math.min(r, Math.max(t, e));
877
987
  }
878
- function Ce(e, t) {
988
+ function T(e, t) {
879
989
  const r = new FileReader();
880
990
  r.onload = () => {
881
991
  if (typeof r.result != "string") return;
882
- const c = r.result, v = new window.Image();
883
- v.onload = () => {
884
- const o = v.naturalWidth || fe, h = v.naturalHeight || fe, N = le(o, we, fe), T = le(Math.round(h * N / o), we, Ae);
885
- t({ src: c, naturalW: o, naturalH: h, width: N, height: T });
886
- }, v.onerror = () => {
887
- t({ src: c, naturalW: fe, naturalH: fe, width: fe, height: fe });
888
- }, v.src = c;
992
+ const v = r.result, f = new window.Image();
993
+ f.onload = () => {
994
+ const l = f.naturalWidth || pe, g = f.naturalHeight || pe, $ = q(l, We, pe), X = q(Math.round(g * $ / l), We, De);
995
+ t({ src: v, naturalW: l, naturalH: g, width: $, height: X });
996
+ }, f.onerror = () => {
997
+ t({ src: v, naturalW: pe, naturalH: pe, width: pe, height: pe });
998
+ }, f.src = v;
889
999
  }, r.readAsDataURL(e);
890
1000
  }
891
- function De(e) {
1001
+ function le(e) {
892
1002
  const t = document.createElement("input");
893
1003
  t.type = "file", t.accept = "image/*", t.style.display = "none", t.onchange = () => {
894
- var c;
895
- const r = (c = t.files) == null ? void 0 : c[0];
896
- r && (Ce(r, (v) => ie(e, v)), document.body.removeChild(t));
1004
+ var v;
1005
+ const r = (v = t.files) == null ? void 0 : v[0];
1006
+ r && (T(r, (f) => w(e, f)), document.body.removeChild(t));
897
1007
  }, document.body.appendChild(t), t.click();
898
1008
  }
899
- function Se(e, t) {
900
- const r = t.trim(), c = W(u.value, e);
901
- c && (r ? c.link = { url: r } : delete c.link, X(), L(), a("change", u.value));
1009
+ function Y(e, t) {
1010
+ const r = t.trim(), v = B(u.value, e);
1011
+ v && (r ? v.link = { url: r } : delete v.link, K(), H(), a("change", u.value));
902
1012
  }
903
- function ze(e) {
904
- Se(e, "");
1013
+ function re(e) {
1014
+ Y(e, "");
905
1015
  }
906
- function Ee(e, t) {
907
- const r = W(u.value, e);
908
- r && (t ? r.note = { text: t } : delete r.note, X(), L(), a("change", u.value));
1016
+ function me(e, t) {
1017
+ const r = B(u.value, e);
1018
+ r && (t ? r.note = { text: t } : delete r.note, K(), H(), a("change", u.value));
909
1019
  }
910
- function Ne(e) {
911
- Ee(e, "");
1020
+ function I(e) {
1021
+ me(e, "");
912
1022
  }
913
- const F = A(null);
914
- function E(e, t) {
915
- l.readonly || (e.preventDefault(), e.stopPropagation(), m.value = t.id, a("select", W(u.value, t.id)), F.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
1023
+ const W = D(null);
1024
+ function j(e, t) {
1025
+ i.readonly || (e.preventDefault(), e.stopPropagation(), m.value = t.id, a("select", B(u.value, t.id)), W.value = { nodeId: t.id, x: e.clientX, y: e.clientY });
916
1026
  }
917
- function V() {
918
- F.value = null;
1027
+ function _() {
1028
+ W.value = null;
919
1029
  }
920
- function q() {
1030
+ function ne() {
921
1031
  var t;
922
- const e = (t = F.value) == null ? void 0 : t.nodeId;
923
- e && De(e);
1032
+ const e = (t = W.value) == null ? void 0 : t.nodeId;
1033
+ e && le(e);
924
1034
  }
925
- function K() {
926
- var c, v, o;
927
- const e = (c = F.value) == null ? void 0 : c.nodeId;
1035
+ function ie() {
1036
+ var v, f, l;
1037
+ const e = (v = W.value) == null ? void 0 : v.nodeId;
928
1038
  if (!e) return;
929
- const t = ((o = (v = W(u.value, e)) == null ? void 0 : v.link) == null ? void 0 : o.url) ?? "", r = window.prompt("输入链接 URL(留空取消)", t);
930
- r !== null && Se(e, r);
1039
+ const t = ((l = (f = B(u.value, e)) == null ? void 0 : f.link) == null ? void 0 : l.url) ?? "", r = window.prompt("输入链接 URL(留空取消)", t);
1040
+ r !== null && Y(e, r);
931
1041
  }
932
- function Z() {
1042
+ function ke() {
933
1043
  var t;
934
- const e = (t = F.value) == null ? void 0 : t.nodeId;
935
- e && ze(e);
1044
+ const e = (t = W.value) == null ? void 0 : t.nodeId;
1045
+ e && re(e);
936
1046
  }
937
- function Q() {
1047
+ function Be() {
938
1048
  var t;
939
- const e = (t = F.value) == null ? void 0 : t.nodeId;
940
- e && re(e);
1049
+ const e = (t = W.value) == null ? void 0 : t.nodeId;
1050
+ e && vt(e);
941
1051
  }
942
- function he() {
1052
+ function Me() {
943
1053
  var t;
944
- const e = (t = F.value) == null ? void 0 : t.nodeId;
945
- e && Ne(e);
1054
+ const e = (t = W.value) == null ? void 0 : t.nodeId;
1055
+ e && I(e);
946
1056
  }
947
- function Ie() {
1057
+ function Zt() {
948
1058
  var t;
949
- const e = (t = F.value) == null ? void 0 : t.nodeId;
950
- e && He(e);
1059
+ const e = (t = W.value) == null ? void 0 : t.nodeId;
1060
+ e && G(e);
951
1061
  }
952
- function re(e) {
953
- l.readonly || a("edit-note", e);
1062
+ function vt(e) {
1063
+ i.readonly || a("edit-note", e);
954
1064
  }
955
- function Gt(e, t = 60) {
1065
+ function Qt(e, t = 60) {
956
1066
  const r = e.replace(/\s+/g, " ").trim();
957
1067
  return r.length <= t ? r || "点击编辑笔记" : r.slice(0, t) + "…";
958
1068
  }
959
- function ct(e) {
960
- var v;
961
- if (l.readonly || f.value) return;
1069
+ function ht(e) {
1070
+ var f;
1071
+ if (i.readonly || c.value) return;
962
1072
  const t = e.target;
963
1073
  if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable))
964
1074
  return;
965
1075
  const r = m.value;
966
1076
  if (!r) return;
967
- const c = (v = e.clipboardData) == null ? void 0 : v.items;
968
- if (c)
969
- for (let o = 0; o < c.length; o++) {
970
- const h = c[o];
971
- if (h.kind === "file" && h.type.startsWith("image/")) {
972
- const N = h.getAsFile();
973
- if (!N) continue;
1077
+ const v = (f = e.clipboardData) == null ? void 0 : f.items;
1078
+ if (v)
1079
+ for (let l = 0; l < v.length; l++) {
1080
+ const g = v[l];
1081
+ if (g.kind === "file" && g.type.startsWith("image/")) {
1082
+ const $ = g.getAsFile();
1083
+ if (!$) continue;
974
1084
  e.preventDefault();
975
- const T = W(u.value, r);
976
- if (T != null && T.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
1085
+ const X = B(u.value, r);
1086
+ if (X != null && X.image && !window.confirm("该节点已有图片,要用剪贴板里的图片替换吗?"))
977
1087
  return;
978
- Ce(N, (Y) => ie(r, Y));
1088
+ T($, (J) => w(r, J));
979
1089
  return;
980
1090
  }
981
1091
  }
982
1092
  }
983
1093
  ut(() => {
984
- window.addEventListener("paste", ct);
985
- }), dt(() => {
986
- window.removeEventListener("paste", ct);
1094
+ window.addEventListener("paste", ht);
1095
+ }), ct(() => {
1096
+ window.removeEventListener("paste", ht);
987
1097
  });
988
- const We = A(null), jt = U(() => {
1098
+ const Re = D(null), _t = Q(() => {
989
1099
  var e;
990
- return ((e = We.value) == null ? void 0 : e.nodeId) ?? null;
1100
+ return ((e = Re.value) == null ? void 0 : e.nodeId) ?? null;
991
1101
  });
992
- function Jt(e, t) {
1102
+ function en(e, t) {
993
1103
  if (!t.image) return;
994
1104
  e.preventDefault(), e.stopPropagation();
995
- const r = t.image.naturalW || t.image.width, c = t.image.naturalH || t.image.height, v = c > 0 ? c / r : 1;
996
- We.value = {
1105
+ const r = t.image.naturalW || t.image.width, v = t.image.naturalH || t.image.height, f = v > 0 ? v / r : 1;
1106
+ Re.value = {
997
1107
  nodeId: t.id,
998
1108
  startX: e.clientX,
999
1109
  startY: e.clientY,
1000
1110
  startW: t.image.width,
1001
1111
  startH: t.image.height,
1002
1112
  naturalW: r,
1003
- naturalH: c,
1004
- ratio: v,
1113
+ naturalH: v,
1114
+ ratio: f,
1005
1115
  pendingW: t.image.width,
1006
1116
  pendingH: t.image.height
1007
- }, window.addEventListener("mousemove", ft), window.addEventListener("mouseup", vt);
1117
+ }, window.addEventListener("mousemove", mt), window.addEventListener("mouseup", gt);
1008
1118
  }
1009
- function ft(e) {
1010
- var T, Y;
1011
- const t = We.value;
1119
+ function mt(e) {
1120
+ var X, J;
1121
+ const t = Re.value;
1012
1122
  if (!t) return;
1013
- const r = M.scale.value || 1, c = e.clientX - t.startX, v = le(t.startW + c / r, we, Ae), o = le(v * t.ratio, we, Ae);
1014
- t.pendingW = v, t.pendingH = o;
1015
- const h = (T = s.value) == null ? void 0 : T.querySelector(
1123
+ const r = E.scale.value || 1, v = e.clientX - t.startX, f = q(t.startW + v / r, We, De), l = q(f * t.ratio, We, De);
1124
+ t.pendingW = f, t.pendingH = l;
1125
+ const g = (X = d.value) == null ? void 0 : X.querySelector(
1016
1126
  `[data-node-id="${t.nodeId}"] .zm-node-img`
1017
1127
  );
1018
- h && (h.style.width = `${v}px`, h.style.height = `${o}px`);
1019
- const N = (Y = s.value) == null ? void 0 : Y.querySelector(
1128
+ g && (g.style.width = `${f}px`, g.style.height = `${l}px`);
1129
+ const $ = (J = d.value) == null ? void 0 : J.querySelector(
1020
1130
  `[data-node-id="${t.nodeId}"]`
1021
1131
  );
1022
- N && (N.style.minWidth = `${Math.max(80, Math.ceil(v + 28))}px`, N.style.height = `${Math.ceil(o + 8 + 30)}px`);
1132
+ $ && ($.style.minWidth = `${Math.max(80, Math.ceil(f + 28))}px`, $.style.height = `${Math.ceil(l + 8 + 30)}px`);
1023
1133
  }
1024
- function vt() {
1025
- const e = We.value;
1026
- if (window.removeEventListener("mousemove", ft), window.removeEventListener("mouseup", vt), We.value = null, !e) return;
1027
- const t = W(u.value, e.nodeId);
1028
- !t || !t.image || (ie(e.nodeId, {
1134
+ function gt() {
1135
+ const e = Re.value;
1136
+ if (window.removeEventListener("mousemove", mt), window.removeEventListener("mouseup", gt), Re.value = null, !e) return;
1137
+ const t = B(u.value, e.nodeId);
1138
+ !t || !t.image || (w(e.nodeId, {
1029
1139
  src: t.image.src,
1030
1140
  naturalW: t.image.naturalW,
1031
1141
  naturalH: t.image.naturalH,
@@ -1033,36 +1143,36 @@ const si = ["disabled"], di = ["disabled"], ci = ["disabled"], fi = ["disabled"]
1033
1143
  height: e.pendingH
1034
1144
  }), m.value = e.nodeId, a("select", t), _e = !0);
1035
1145
  }
1036
- const Qe = A(null);
1146
+ const Qe = D(null);
1037
1147
  let _e = !1;
1038
- function Zt(e) {
1148
+ function tn(e) {
1039
1149
  Qe.value = e;
1040
1150
  }
1041
- function Qt(e) {
1151
+ function nn(e) {
1042
1152
  Qe.value === e && (Qe.value = null);
1043
1153
  }
1044
- const ht = A(0), et = A(!1), ae = ui(100);
1045
- function X() {
1046
- ae.record({ data: u.value });
1154
+ const yt = D(0), et = D(!1), fe = hi(100);
1155
+ function K() {
1156
+ fe.record({ data: u.value });
1047
1157
  }
1048
- function L() {
1049
- y.value = new Set(y.value), ht.value++;
1158
+ function H() {
1159
+ h.value = new Set(h.value), yt.value++;
1050
1160
  }
1051
- const ee = U(() => {
1052
- var e, t, r, c, v, o, h, N, T, Y;
1161
+ const oe = Q(() => {
1162
+ var e, t, r, v, f, l, g, $, X, J;
1053
1163
  return {
1054
- rootBg: ((e = l.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
1055
- rootText: ((t = l.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
1056
- branchBg: ((r = l.theme) == null ? void 0 : r.branchBg) ?? "#ffffff",
1057
- branchText: ((c = l.theme) == null ? void 0 : c.branchText) ?? "#1f2937",
1058
- lineColor: ((v = l.theme) == null ? void 0 : v.lineColor) ?? "#94a3b8",
1059
- bgColor: ((o = l.theme) == null ? void 0 : o.bgColor) ?? "#f8fafc",
1060
- fontSize: ((h = l.theme) == null ? void 0 : h.fontSize) ?? 14,
1061
- lineWidthStart: ((N = l.theme) == null ? void 0 : N.lineWidthStart) ?? 2.2,
1062
- lineWidthEnd: ((T = l.theme) == null ? void 0 : T.lineWidthEnd) ?? 0.8,
1063
- rainbowBranch: ((Y = l.theme) == null ? void 0 : Y.rainbowBranch) ?? !1
1164
+ rootBg: ((e = i.theme) == null ? void 0 : e.rootBg) ?? "#1f2937",
1165
+ rootText: ((t = i.theme) == null ? void 0 : t.rootText) ?? "#ffffff",
1166
+ branchBg: ((r = i.theme) == null ? void 0 : r.branchBg) ?? "#ffffff",
1167
+ branchText: ((v = i.theme) == null ? void 0 : v.branchText) ?? "#1f2937",
1168
+ lineColor: ((f = i.theme) == null ? void 0 : f.lineColor) ?? "#94a3b8",
1169
+ bgColor: ((l = i.theme) == null ? void 0 : l.bgColor) ?? "#f8fafc",
1170
+ fontSize: ((g = i.theme) == null ? void 0 : g.fontSize) ?? 14,
1171
+ lineWidthStart: (($ = i.theme) == null ? void 0 : $.lineWidthStart) ?? 2.2,
1172
+ lineWidthEnd: ((X = i.theme) == null ? void 0 : X.lineWidthEnd) ?? 0.8,
1173
+ rainbowBranch: ((J = i.theme) == null ? void 0 : J.rainbowBranch) ?? !1
1064
1174
  };
1065
- }), p = Ue({
1175
+ }), k = Ge({
1066
1176
  autoBalanceOnChange: !0,
1067
1177
  lineWidthStart: 12,
1068
1178
  lineWidthEnd: 3.6,
@@ -1074,393 +1184,406 @@ const si = ["disabled"], di = ["disabled"], ci = ["disabled"], fi = ["disabled"]
1074
1184
  taperedEdge: !0,
1075
1185
  showOrderBadge: !1
1076
1186
  });
1077
- function mt(e) {
1078
- return p.taperedEdge ? _t(e) : gt(e);
1187
+ function xt(e) {
1188
+ return k.taperedEdge ? on(e) : bt(e);
1079
1189
  }
1080
- function yt(e) {
1081
- return p.taperedEdge ? p.lineWidthEnd : gt(e);
1190
+ function pt(e) {
1191
+ return k.taperedEdge ? k.lineWidthEnd : bt(e);
1082
1192
  }
1083
- function _t(e) {
1084
- return e <= 0 ? p.lineWidthStart : e === 1 ? Math.max(1.5, p.lineWidthStart * 0.67) : e === 2 ? Math.max(0.8, p.lineWidthStart * 0.42) : p.lineWidthEnd;
1193
+ function on(e) {
1194
+ return e <= 0 ? k.lineWidthStart : e === 1 ? Math.max(1.5, k.lineWidthStart * 0.67) : e === 2 ? Math.max(0.8, k.lineWidthStart * 0.42) : k.lineWidthEnd;
1085
1195
  }
1086
- function gt(e) {
1087
- if (e <= 0) return p.lineWidthStart;
1088
- if (e >= 3) return p.lineWidthEnd;
1196
+ function bt(e) {
1197
+ if (e <= 0) return k.lineWidthStart;
1198
+ if (e >= 3) return k.lineWidthEnd;
1089
1199
  const t = e / 3;
1090
- return p.lineWidthStart + (p.lineWidthEnd - p.lineWidthStart) * t;
1091
- }
1092
- function en(e, t, r, c) {
1093
- const v = 1 - e, o = v * v * v * t.x + 3 * v * v * e * r.x1 + 3 * v * e * e * r.x2 + e * e * e * c.x, h = v * v * v * t.y + 3 * v * v * e * r.y1 + 3 * v * e * e * r.y2 + e * e * e * c.y;
1094
- return { x: o, y: h };
1095
- }
1096
- function tn(e, t, r, c, v = 32, o = "curve", h = "right") {
1097
- if (o === "curve") {
1098
- let ce;
1099
- if (h === "right" || h === "left") {
1100
- const B = Math.abs(t.x - e.x) * 0.45, ne = h === "right" ? 1 : -1;
1101
- ce = { x1: e.x + ne * B, y1: e.y, x2: t.x - ne * B, y2: t.y };
1200
+ return k.lineWidthStart + (k.lineWidthEnd - k.lineWidthStart) * t;
1201
+ }
1202
+ function ln(e, t, r, v) {
1203
+ const f = 1 - e, l = f * f * f * t.x + 3 * f * f * e * r.x1 + 3 * f * e * e * r.x2 + e * e * e * v.x, g = f * f * f * t.y + 3 * f * f * e * r.y1 + 3 * f * e * e * r.y2 + e * e * e * v.y;
1204
+ return { x: l, y: g };
1205
+ }
1206
+ function rn(e, t, r, v, f = 32, l = "curve", g = "right") {
1207
+ if (l === "curve") {
1208
+ let xe;
1209
+ if (g === "right" || g === "left") {
1210
+ const L = Math.abs(t.x - e.x) * 0.45, de = g === "right" ? 1 : -1;
1211
+ xe = { x1: e.x + de * L, y1: e.y, x2: t.x - de * L, y2: t.y };
1102
1212
  } else {
1103
- const B = Math.abs(t.y - e.y) * 0.45;
1104
- ce = { x1: e.x, y1: e.y + B, x2: t.x, y2: t.y - B };
1213
+ const L = Math.abs(t.y - e.y) * 0.45;
1214
+ xe = { x1: e.x, y1: e.y + L, x2: t.x, y2: t.y - L };
1105
1215
  }
1106
- const Sn = (z) => {
1107
- const B = 1 - z, ne = -3 * B * B * e.x + 3 * (B * B - 2 * B * z) * ce.x1 + 3 * (2 * B * z - z * z) * ce.x2 + 3 * z * z * t.x, xe = -3 * B * B * e.y + 3 * (B * B - 2 * B * z) * ce.y1 + 3 * (2 * B * z - z * z) * ce.y2 + 3 * z * z * t.y;
1108
- return { dx: ne, dy: xe };
1109
- }, Re = [], rt = [];
1110
- for (let z = 0; z <= v; z++) {
1111
- const B = z / v, ne = z === 0 ? e : z === v ? t : en(B, e, ce, t), xe = Sn(B);
1112
- let Ve = Math.hypot(xe.dx, xe.dy);
1113
- Ve < 1e-6 && (Ve = 1);
1114
- const Lt = -xe.dy / Ve, Ht = xe.dx / Ve, Xe = (r + (c - r) * B) / 2;
1115
- Re.push({ x: ne.x + Lt * Xe, y: ne.y + Ht * Xe }), rt.push({ x: ne.x - Lt * Xe, y: ne.y - Ht * Xe });
1216
+ const In = (N) => {
1217
+ const L = 1 - N, de = -3 * L * L * e.x + 3 * (L * L - 2 * L * N) * xe.x1 + 3 * (2 * L * N - N * N) * xe.x2 + 3 * N * N * t.x, ze = -3 * L * L * e.y + 3 * (L * L - 2 * L * N) * xe.y1 + 3 * (2 * L * N - N * N) * xe.y2 + 3 * N * N * t.y;
1218
+ return { dx: de, dy: ze };
1219
+ }, He = [], rt = [];
1220
+ for (let N = 0; N <= f; N++) {
1221
+ const L = N / f, de = N === 0 ? e : N === f ? t : ln(L, e, xe, t), ze = In(L);
1222
+ let Xe = Math.hypot(ze.dx, ze.dy);
1223
+ Xe < 1e-6 && (Xe = 1);
1224
+ const Pt = -ze.dy / Xe, Tt = ze.dx / Xe, qe = (r + (v - r) * L) / 2;
1225
+ He.push({ x: de.x + Pt * qe, y: de.y + Tt * qe }), rt.push({ x: de.x - Pt * qe, y: de.y - Tt * qe });
1116
1226
  }
1117
- let Fe = `M ${Re[0].x.toFixed(2)} ${Re[0].y.toFixed(2)}`;
1118
- for (let z = 1; z <= v; z++) Fe += ` L ${Re[z].x.toFixed(2)} ${Re[z].y.toFixed(2)}`;
1119
- for (let z = v; z >= 0; z--) Fe += ` L ${rt[z].x.toFixed(2)} ${rt[z].y.toFixed(2)}`;
1120
- return Fe += " Z", Fe;
1227
+ let Ve = `M ${He[0].x.toFixed(2)} ${He[0].y.toFixed(2)}`;
1228
+ for (let N = 1; N <= f; N++) Ve += ` L ${He[N].x.toFixed(2)} ${He[N].y.toFixed(2)}`;
1229
+ for (let N = f; N >= 0; N--) Ve += ` L ${rt[N].x.toFixed(2)} ${rt[N].y.toFixed(2)}`;
1230
+ return Ve += " Z", Ve;
1121
1231
  }
1122
- const N = t.x - e.x, T = t.y - e.y;
1123
- let Y = Math.hypot(N, T);
1124
- Y < 1e-6 && (Y = 1);
1125
- const de = -T / Y, ye = N / Y, ge = r / 2, Be = c / 2, $t = { x: e.x + de * ge, y: e.y + ye * ge }, Bt = { x: e.x - de * ge, y: e.y - ye * ge }, Rt = { x: t.x - de * Be, y: t.y - ye * Be }, At = { x: t.x + de * Be, y: t.y + ye * Be };
1126
- return `M ${$t.x.toFixed(2)} ${$t.y.toFixed(2)} L ${At.x.toFixed(2)} ${At.y.toFixed(2)} L ${Rt.x.toFixed(2)} ${Rt.y.toFixed(2)} L ${Bt.x.toFixed(2)} ${Bt.y.toFixed(2)} Z`;
1127
- }
1128
- const Pe = U(() => G.value.root.children), nn = Le[0].colors, xt = U(
1129
- () => Qn(p.branchPaletteId, p.customPalettes)
1130
- ), ue = U(() => {
1232
+ const $ = t.x - e.x, X = t.y - e.y;
1233
+ let J = Math.hypot($, X);
1234
+ J < 1e-6 && (J = 1);
1235
+ const ye = -X / J, Se = $ / J, Ee = r / 2, Le = v / 2, At = { x: e.x + ye * Ee, y: e.y + Se * Ee }, Lt = { x: e.x - ye * Ee, y: e.y - Se * Ee }, Ht = { x: t.x - ye * Le, y: t.y - Se * Le }, Dt = { x: t.x + ye * Le, y: t.y + Se * Le };
1236
+ return `M ${At.x.toFixed(2)} ${At.y.toFixed(2)} L ${Dt.x.toFixed(2)} ${Dt.y.toFixed(2)} L ${Ht.x.toFixed(2)} ${Ht.y.toFixed(2)} L ${Lt.x.toFixed(2)} ${Lt.y.toFixed(2)} Z`;
1237
+ }
1238
+ const Te = Q(() => ee.value.root.children), an = Pe[0].colors, wt = Q(
1239
+ () => oi(k.branchPaletteId, k.customPalettes)
1240
+ ), ge = Q(() => {
1131
1241
  const e = /* @__PURE__ */ new Map();
1132
- if (!p.rainbowBranch) return e;
1133
- const t = xt.value.colors.length > 0 ? xt.value.colors : nn;
1134
- for (let c = 0; c < Pe.value.length; c++) {
1135
- const v = Pe.value[c];
1136
- e.set(v.id, t[c % t.length]);
1242
+ if (!k.rainbowBranch) return e;
1243
+ const t = i.lineColors, r = t && t.length > 0 ? t : wt.value.colors.length > 0 ? wt.value.colors : an;
1244
+ for (let f = 0; f < Te.value.length; f++) {
1245
+ const l = Te.value[f];
1246
+ e.set(l.id, r[f % r.length]);
1137
1247
  }
1138
- const r = (c, v) => {
1139
- e.set(c.id, v);
1140
- for (const o of c.children) r(o, v);
1248
+ const v = (f, l) => {
1249
+ e.set(f.id, l);
1250
+ for (const g of f.children) v(g, l);
1141
1251
  };
1142
- for (let c = 0; c < Pe.value.length; c++) {
1143
- const v = Pe.value[c];
1144
- r(v, t[c % t.length]);
1252
+ for (let f = 0; f < Te.value.length; f++) {
1253
+ const l = Te.value[f];
1254
+ v(l, r[f % r.length]);
1145
1255
  }
1146
1256
  return e;
1147
1257
  });
1148
- function ln(e, t) {
1149
- return p.rainbowBranch ? ue.value.get(t.id) ?? ee.value.lineColor : ee.value.lineColor;
1258
+ function un(e, t) {
1259
+ return k.rainbowBranch ? ge.value.get(t.id) ?? oe.value.lineColor : oe.value.lineColor;
1150
1260
  }
1151
- function on(e) {
1152
- const t = _(e.id);
1261
+ function sn(e) {
1262
+ const t = ue(e.id);
1153
1263
  if (t.bg) return t.bg;
1154
- if (e.isRoot) return ee.value.rootBg;
1155
- if (p.rainbowBranch) {
1156
- const r = ue.value.get(e.id);
1157
- if (r) return sn(r, 0.18);
1264
+ if (e.isRoot) return oe.value.rootBg;
1265
+ if (k.rainbowBranch) {
1266
+ const r = ge.value.get(e.id);
1267
+ if (r) return vn(r, 0.18);
1158
1268
  }
1159
- return ee.value.branchBg;
1269
+ return oe.value.branchBg;
1160
1270
  }
1161
- function rn(e) {
1162
- const t = _(e.id);
1271
+ function dn(e) {
1272
+ const t = ue(e.id);
1163
1273
  if (t.textColor) return t.textColor;
1164
- if (e.isRoot) return ee.value.rootText;
1165
- if (p.rainbowBranch) {
1166
- const r = ue.value.get(e.id);
1167
- if (r) return pt(r, 0.55);
1274
+ if (e.isRoot) return oe.value.rootText;
1275
+ if (k.rainbowBranch) {
1276
+ const r = ge.value.get(e.id);
1277
+ if (r) return kt(r, 0.55);
1168
1278
  }
1169
- return ee.value.branchText;
1279
+ return oe.value.branchText;
1170
1280
  }
1171
- function an(e) {
1172
- const t = _(e.id);
1281
+ function cn(e) {
1282
+ const t = ue(e.id);
1173
1283
  if (t.borderColor) return t.borderColor;
1174
- if (e.isRoot) return ee.value.rootBg;
1175
- if (p.rainbowBranch) {
1176
- const r = ue.value.get(e.id);
1177
- if (r) return pt(r, 0.3);
1284
+ if (e.isRoot) return oe.value.rootBg;
1285
+ if (k.rainbowBranch) {
1286
+ const r = ge.value.get(e.id);
1287
+ if (r) return kt(r, 0.3);
1178
1288
  }
1179
- return ee.value.lineColor;
1289
+ return oe.value.lineColor;
1180
1290
  }
1181
- function un(e) {
1182
- return _(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1291
+ function fn(e) {
1292
+ return ue(e.id).fontWeight ?? (e.isRoot ? 600 : 400);
1183
1293
  }
1184
- function sn(e, t) {
1185
- const r = e.replace("#", ""), c = r.length === 6 ? r : r.split("").map((N) => N + N).join(""), v = parseInt(c.slice(0, 2), 16), o = parseInt(c.slice(2, 4), 16), h = parseInt(c.slice(4, 6), 16);
1186
- return `rgba(${v}, ${o}, ${h}, ${t})`;
1294
+ function vn(e, t) {
1295
+ const r = e.replace("#", ""), v = r.length === 6 ? r : r.split("").map(($) => $ + $).join(""), f = parseInt(v.slice(0, 2), 16), l = parseInt(v.slice(2, 4), 16), g = parseInt(v.slice(4, 6), 16);
1296
+ return `rgba(${f}, ${l}, ${g}, ${t})`;
1187
1297
  }
1188
- function pt(e, t) {
1189
- const r = e.replace("#", ""), c = r.length === 6 ? r : r.split("").map((N) => N + N).join(""), v = Math.round(parseInt(c.slice(0, 2), 16) * (1 - t)), o = Math.round(parseInt(c.slice(2, 4), 16) * (1 - t)), h = Math.round(parseInt(c.slice(4, 6), 16) * (1 - t));
1190
- return `rgb(${v}, ${o}, ${h})`;
1298
+ function kt(e, t) {
1299
+ const r = e.replace("#", ""), v = r.length === 6 ? r : r.split("").map(($) => $ + $).join(""), f = Math.round(parseInt(v.slice(0, 2), 16) * (1 - t)), l = Math.round(parseInt(v.slice(2, 4), 16) * (1 - t)), g = Math.round(parseInt(v.slice(4, 6), 16) * (1 - t));
1300
+ return `rgb(${f}, ${l}, ${g})`;
1191
1301
  }
1192
- const M = oi({ getContainer: () => s.value });
1193
- M.setOnMarqueeEnd(bn), ai({
1194
- isEditing: () => f.value !== null,
1195
- isReadonly: () => l.readonly,
1302
+ const E = ci({ getContainer: () => d.value });
1303
+ E.setOnMarqueeEnd(Cn), vi({
1304
+ isEditing: () => c.value !== null,
1305
+ isReadonly: () => i.readonly,
1196
1306
  getSelectedId: () => m.value,
1197
1307
  getRootId: () => u.value.id,
1198
1308
  // If nothing is selected, default Tab/Enter to the root so the user
1199
1309
  // can build a tree from scratch without first clicking somewhere.
1200
1310
  defaultTargetId: () => u.value.id,
1201
- onAddChild: me,
1202
- onAddSibling: Te,
1203
- onAddSiblingBefore: kt,
1204
- onRemove: Ct,
1205
- onStartEdit: $e,
1311
+ onAddChild: Ce,
1312
+ onAddSibling: Fe,
1313
+ onAddSiblingBefore: St,
1314
+ onRemove: zt,
1315
+ onStartEdit: Ae,
1206
1316
  onClearSelection: () => {
1207
1317
  m.value = null, a("select", null);
1208
1318
  },
1209
- onDuplicate: Mt,
1319
+ onDuplicate: Et,
1210
1320
  onUndo: nt,
1211
1321
  onRedo: it,
1212
- onNavigate: hn,
1322
+ onNavigate: xn,
1213
1323
  onSelectRoot: () => {
1214
1324
  m.value = u.value.id;
1215
- const e = W(u.value, u.value.id);
1325
+ const e = B(u.value, u.value.id);
1216
1326
  e && a("select", e);
1217
1327
  }
1218
1328
  });
1219
- const G = U(() => {
1220
- const e = ke(u.value);
1221
- return wt(e), Gn(e, { mode: p.layoutMode });
1222
- }), bt = A([]), tt = U(() => (ht.value, bt.value));
1223
- Dt(
1224
- G,
1329
+ const ee = Q(() => {
1330
+ const e = he(u.value);
1331
+ return Ct(e), ei(e, { mode: k.layoutMode, baseFontSize: oe.value.fontSize });
1332
+ }), Mt = D([]), tt = Q(() => (yt.value, Mt.value));
1333
+ Ye(
1334
+ ee,
1225
1335
  (e) => {
1226
- const t = [], r = (c) => {
1227
- t.push(c);
1228
- for (const v of c.children) r(v);
1336
+ const t = [], r = (v) => {
1337
+ t.push(v);
1338
+ for (const f of v.children) r(f);
1229
1339
  };
1230
- r(e.root), bt.value = t;
1340
+ r(e.root), Mt.value = t;
1231
1341
  },
1232
1342
  { immediate: !0 }
1233
1343
  );
1234
- const dn = U(() => {
1344
+ const hn = Q(() => {
1235
1345
  const e = [];
1236
1346
  for (const t of tt.value)
1237
1347
  for (const r of t.children)
1238
1348
  e.push({ from: t, to: r, key: `${t.id}->${r.id}` });
1239
1349
  return e;
1240
- }), cn = U(
1241
- () => `${G.value.vbX} ${G.value.vbY} ${G.value.vbW} ${G.value.vbH}`
1350
+ }), mn = Q(
1351
+ () => `${ee.value.vbX} ${ee.value.vbY} ${ee.value.vbW} ${ee.value.vbH}`
1242
1352
  );
1243
- function wt(e) {
1244
- if (y.value.has(e.id)) {
1353
+ function Ct(e) {
1354
+ if (h.value.has(e.id)) {
1245
1355
  e.children = [], e.collapsed = !0;
1246
1356
  return;
1247
1357
  }
1248
1358
  e.collapsed = !1;
1249
- for (const t of e.children) wt(t);
1359
+ for (const t of e.children) Ct(t);
1250
1360
  }
1251
- function $e(e) {
1252
- const t = W(u.value, e);
1253
- t && (f.value = e, x.value = t.text, j(() => {
1361
+ function Ae(e) {
1362
+ const t = B(u.value, e);
1363
+ t && (c.value = e, x.value = t.text, Z(() => {
1254
1364
  const r = document.querySelector(".zm-input");
1255
1365
  r == null || r.focus(), r == null || r.select();
1256
1366
  }));
1257
1367
  }
1258
1368
  function Oe(e = {}) {
1259
- if (!f.value) return;
1260
- const t = W(u.value, f.value);
1261
- t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", X(), a("change", u.value));
1262
- const r = f.value;
1263
- f.value = null, e.addChild ? j(() => me(r)) : e.addSibling === "after" ? j(() => Te(r)) : e.addSibling === "before" && j(() => kt(r));
1369
+ if (!c.value) return;
1370
+ const t = B(u.value, c.value);
1371
+ t && t.text !== (x.value.trim() || " ") && (t.text = x.value.trim() || " ", K(), a("change", u.value));
1372
+ const r = c.value;
1373
+ c.value = null, e.addChild ? Z(() => Ce(r)) : e.addSibling === "after" ? Z(() => Fe(r)) : e.addSibling === "before" && Z(() => St(r));
1264
1374
  }
1265
- function fn() {
1266
- f.value = null;
1375
+ function gn() {
1376
+ c.value = null;
1267
1377
  }
1268
- function vn(e) {
1378
+ function yn(e) {
1269
1379
  const t = e.metaKey || e.ctrlKey;
1270
1380
  t && (e.key === "z" || e.key === "Z") && !e.shiftKey ? (e.preventDefault(), nt()) : (t && e.shiftKey && (e.key === "z" || e.key === "Z") || t && (e.key === "y" || e.key === "Y") && !e.shiftKey) && (e.preventDefault(), it());
1271
1381
  }
1272
- function me(e) {
1273
- const t = ti(u.value, e, Ge);
1274
- t && (X(), L(), a("change", u.value), j(() => $e(t.id)));
1382
+ function Ce(e) {
1383
+ const t = ai(u.value, e, Je);
1384
+ t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1275
1385
  }
1276
- function Te(e) {
1386
+ function Fe(e) {
1277
1387
  if (e === u.value.id) {
1278
- me(e);
1388
+ Ce(e);
1279
1389
  return;
1280
1390
  }
1281
- const t = ni(u.value, e, Ge);
1282
- t && (X(), L(), a("change", u.value), j(() => $e(t.id)));
1391
+ const t = ui(u.value, e, Je);
1392
+ t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1283
1393
  }
1284
- function kt(e) {
1394
+ function St(e) {
1285
1395
  if (e === u.value.id) {
1286
- me(e);
1396
+ Ce(e);
1287
1397
  return;
1288
1398
  }
1289
- const t = ii(u.value, e, Ge);
1290
- t && (X(), L(), a("change", u.value), j(() => $e(t.id)));
1399
+ const t = si(u.value, e, Je);
1400
+ t && (K(), H(), a("change", u.value), Z(() => Ae(t.id)));
1291
1401
  }
1292
- function Mt(e) {
1402
+ function Et(e) {
1293
1403
  if (e === u.value.id) return;
1294
- const t = li(u.value, e);
1295
- t && (X(), m.value = t.id, a("change", u.value), L());
1404
+ const t = di(u.value, e);
1405
+ t && (K(), m.value = t.id, a("change", u.value), H());
1296
1406
  }
1297
1407
  function nt() {
1298
- const e = ae.undo();
1299
- e && (u.value = e.data, m.value = null, a("select", null), L(), a("change", u.value));
1408
+ const e = fe.undo();
1409
+ e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1300
1410
  }
1301
1411
  function it() {
1302
- const e = ae.redo();
1303
- e && (u.value = e.data, m.value = null, a("select", null), L(), a("change", u.value));
1412
+ const e = fe.redo();
1413
+ e && (u.value = e.data, m.value = null, a("select", null), H(), a("change", u.value));
1304
1414
  }
1305
- function hn(e, t) {
1306
- const r = m.value ?? u.value.id, c = W(u.value, r);
1307
- if (!c) return;
1308
- let v = null;
1415
+ function xn(e, t) {
1416
+ const r = m.value ?? u.value.id, v = B(u.value, r);
1417
+ if (!v) return;
1418
+ let f = null;
1309
1419
  if (t === 1) {
1310
- const o = te(u.value, c.id);
1311
- if (o) {
1312
- const h = o.children.findIndex((N) => N.id === c.id);
1313
- h >= 0 && h < o.children.length - 1 && (v = o.children[h + 1].id);
1420
+ const l = ae(u.value, v.id);
1421
+ if (l) {
1422
+ const g = l.children.findIndex(($) => $.id === v.id);
1423
+ g >= 0 && g < l.children.length - 1 && (f = l.children[g + 1].id);
1314
1424
  }
1315
1425
  } else if (t === -1) {
1316
- const o = te(u.value, c.id);
1317
- if (o) {
1318
- const h = o.children.findIndex((N) => N.id === c.id);
1319
- h > 0 && (v = o.children[h - 1].id);
1426
+ const l = ae(u.value, v.id);
1427
+ if (l) {
1428
+ const g = l.children.findIndex(($) => $.id === v.id);
1429
+ g > 0 && (f = l.children[g - 1].id);
1320
1430
  }
1321
1431
  } else if (e === 1) {
1322
- const o = te(u.value, c.id);
1323
- o && (v = o.id);
1324
- } else e === -1 && c.children.length > 0 && (v = c.children[0].id);
1325
- if (v) {
1326
- m.value = v;
1327
- const o = W(u.value, v);
1328
- o && a("select", o);
1432
+ const l = ae(u.value, v.id);
1433
+ l && (f = l.id);
1434
+ } else e === -1 && v.children.length > 0 && (f = v.children[0].id);
1435
+ if (f) {
1436
+ m.value = f;
1437
+ const l = B(u.value, f);
1438
+ l && a("select", l);
1329
1439
  }
1330
1440
  }
1331
- function Ct(e) {
1332
- e !== u.value.id && Yt(u.value, e) && (X(), m.value === e && (m.value = null), L(), a("change", u.value));
1441
+ function zt(e) {
1442
+ e !== u.value.id && Gt(u.value, e) && (K(), m.value === e && (m.value = null), H(), a("change", u.value));
1333
1443
  }
1334
- function St(e) {
1335
- y.value.has(e) ? y.value.delete(e) : y.value.add(e), L();
1444
+ function Nt(e) {
1445
+ h.value.has(e) ? h.value.delete(e) : h.value.add(e), H();
1336
1446
  }
1337
- function mn(e, t) {
1338
- _n(u.value, e, t) && (X(), L(), a("change", u.value));
1447
+ function pn(e, t) {
1448
+ li(u.value, e, t) && (K(), H(), a("change", u.value));
1339
1449
  }
1340
- function yn(e, t, r) {
1341
- return ei(u.value, e, t, r) ? (X(), L(), a("change", u.value), !0) : !1;
1450
+ function bn(e, t, r) {
1451
+ return ri(u.value, e, t, r) ? (K(), H(), a("change", u.value), !0) : !1;
1342
1452
  }
1343
- function gn(e, t) {
1453
+ function wn(e, t) {
1344
1454
  e.stopPropagation(), m.value = t.id;
1345
- const r = W(u.value, t.id);
1455
+ const r = B(u.value, t.id);
1346
1456
  a("select", r);
1347
1457
  }
1348
- function xn(e) {
1458
+ function kn(e) {
1349
1459
  const t = e.target;
1350
1460
  if (!t || t.closest(".zm-node, .zm-toolbar, button, input, textarea")) return;
1351
1461
  if (e.button === 2) {
1352
- M.startPan(e);
1462
+ E.startPan(e);
1353
1463
  return;
1354
1464
  }
1355
1465
  if (e.button !== 0) return;
1356
- const r = s.value.getBoundingClientRect(), c = (e.clientX - r.left - M.offsetX.value) / M.scale.value, v = (e.clientY - r.top - M.offsetY.value) / M.scale.value;
1357
- M.startMarquee(c, v);
1466
+ const r = d.value.getBoundingClientRect(), v = (e.clientX - r.left - E.offsetX.value) / E.scale.value, f = (e.clientY - r.top - E.offsetY.value) / E.scale.value;
1467
+ E.startMarquee(v, f);
1358
1468
  }
1359
- function pn(e) {
1469
+ function Mn(e) {
1360
1470
  if (_e) {
1361
1471
  _e = !1;
1362
1472
  return;
1363
1473
  }
1364
1474
  const t = e.target;
1365
1475
  if (!t || t.closest(".zm-node")) return;
1366
- const r = M.marquee;
1476
+ const r = E.marquee;
1367
1477
  r.width >= 4 || r.height >= 4 || m.value !== null && (m.value = null, a("select", null));
1368
1478
  }
1369
- function bn() {
1370
- const e = M.marquee;
1479
+ function Cn() {
1480
+ const e = E.marquee;
1371
1481
  if (e.width < 4 && e.height < 4)
1372
1482
  return;
1373
- const t = e.x, r = e.y, c = e.x + e.width, v = e.y + e.height, o = [];
1374
- for (const h of tt.value) {
1375
- const N = h.width / 2, T = h.height / 2, Y = h.x - N, de = h.x + N, ye = h.y - T, ge = h.y + T;
1376
- Y <= c && de >= t && ye <= v && ge >= r && o.push(h.id);
1483
+ const t = e.x, r = e.y, v = e.x + e.width, f = e.y + e.height, l = [];
1484
+ for (const g of tt.value) {
1485
+ const $ = g.width / 2, X = g.height / 2, J = g.x - $, ye = g.x + $, Se = g.y - X, Ee = g.y + X;
1486
+ J <= v && ye >= t && Se <= f && Ee >= r && l.push(g.id);
1377
1487
  }
1378
- if (o.length > 0) {
1379
- m.value = o[0];
1380
- const h = W(u.value, o[0]);
1381
- h && a("select", h);
1488
+ if (l.length > 0) {
1489
+ m.value = l[0];
1490
+ const g = B(u.value, l[0]);
1491
+ g && a("select", g);
1382
1492
  }
1383
1493
  }
1384
- function zt(e) {
1385
- return y.value.has(e);
1494
+ function It(e) {
1495
+ return h.value.has(e);
1386
1496
  }
1387
- function wn(e) {
1388
- const t = W(u.value, e.id);
1497
+ function Sn(e) {
1498
+ const t = B(u.value, e.id);
1389
1499
  return !!t && t.children.length > 0;
1390
1500
  }
1391
- function lt(e) {
1392
- const t = W(u.value, e);
1501
+ function ot(e) {
1502
+ const t = B(u.value, e);
1393
1503
  return t ? t.children.length : 0;
1394
1504
  }
1395
- function Et(e) {
1396
- if (!W(u.value, e)) return 0;
1397
- const c = [u.value];
1398
- for (; c.length; ) {
1399
- const v = c.pop(), o = v.children.findIndex((h) => h.id === e);
1400
- if (o >= 0) return o;
1401
- for (const h of v.children) c.push(h);
1505
+ function Wt(e) {
1506
+ if (!B(u.value, e)) return 0;
1507
+ const v = [u.value];
1508
+ for (; v.length; ) {
1509
+ const f = v.pop(), l = f.children.findIndex((g) => g.id === e);
1510
+ if (l >= 0) return l;
1511
+ for (const g of f.children) v.push(g);
1402
1512
  }
1403
1513
  return 0;
1404
1514
  }
1405
- function Nt(e, t, r, c) {
1406
- if (((c == null ? void 0 : c._dir) ?? e._dir) === "down")
1515
+ function $t(e, t, r, v) {
1516
+ if (((v == null ? void 0 : v._dir) ?? e._dir) === "down")
1407
1517
  return t === "out" ? { x: e.x, y: e.y + e.height / 2 } : { x: e.x, y: e.y - e.height / 2 };
1408
- let o;
1409
- return t === "in" ? o = -e.side : r !== void 0 ? o = r : o = e.side, { x: e.x + o * (e.width / 2), y: e.y };
1518
+ let l;
1519
+ return t === "in" ? l = -e.side : r !== void 0 ? l = r : l = e.side, { x: e.x + l * (e.width / 2), y: e.y };
1410
1520
  }
1411
1521
  function se() {
1412
- const e = G.value;
1413
- M.resetView(e.width, e.height, e.root.y);
1522
+ const e = ee.value;
1523
+ E.resetView(e.width, e.height, e.root.y);
1414
1524
  }
1415
- function kn() {
1416
- et.value = !0, X(), L(), j(() => se());
1525
+ function En() {
1526
+ et.value = !0, K(), H(), Z(() => se());
1417
1527
  }
1418
- function ot(e) {
1419
- p.layoutMode !== e && (p.layoutMode = e, L(), j(() => se()));
1528
+ function lt(e) {
1529
+ k.layoutMode !== e && (k.layoutMode = e, H(), Z(() => se()));
1420
1530
  }
1421
- function It() {
1531
+ function Bt() {
1422
1532
  return JSON.stringify(u.value, null, 2);
1423
1533
  }
1424
- function Wt(e) {
1534
+ function Rt(e) {
1425
1535
  try {
1426
1536
  const t = JSON.parse(e);
1427
- return !t.id || !Array.isArray(t.children) ? !1 : (ae.reset(), u.value = ke(t), m.value = null, y.value = /* @__PURE__ */ new Set(), L(), j(() => se()), a("change", u.value), !0);
1537
+ return !t.id || !Array.isArray(t.children) ? !1 : (fe.reset(), u.value = he(t), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), Z(() => se()), a("change", u.value), !0);
1428
1538
  } catch {
1429
1539
  return !1;
1430
1540
  }
1431
1541
  }
1432
- function Mn() {
1542
+ function zn() {
1433
1543
  const e = document.createElement("input");
1434
1544
  e.type = "file", e.accept = "application/json", e.onchange = () => {
1435
- var c;
1436
- const t = (c = e.files) == null ? void 0 : c[0];
1545
+ var v;
1546
+ const t = (v = e.files) == null ? void 0 : v[0];
1437
1547
  if (!t) return;
1438
1548
  const r = new FileReader();
1439
1549
  r.onload = () => {
1440
- typeof r.result == "string" && (Wt(r.result) || alert("导入失败:JSON 格式无效"));
1550
+ typeof r.result == "string" && (Rt(r.result) || alert("导入失败:JSON 格式无效"));
1441
1551
  }, r.readAsText(t);
1442
1552
  }, e.click();
1443
1553
  }
1444
- function Cn() {
1445
- const e = new Blob([It()], { type: "application/json" }), t = URL.createObjectURL(e), r = document.createElement("a");
1554
+ function Nn() {
1555
+ const e = new Blob([Bt()], { type: "application/json" }), t = URL.createObjectURL(e), r = document.createElement("a");
1446
1556
  r.href = t, r.download = `${u.value.text || "mindmap"}.json`, r.click(), URL.revokeObjectURL(t);
1447
1557
  }
1448
- return d({
1449
- addChild: (e) => me(e),
1450
- addSibling: (e) => Te(e),
1451
- removeNode: (e) => Ct(e),
1452
- duplicateNode: (e) => Mt(e),
1453
- setNodeText: (e, t) => mn(e, t),
1454
- moveNode: (e, t, r) => yn(e, t, r),
1455
- lineWidthForDepth: mt,
1456
- endWidthForDepth: yt,
1558
+ return s({
1559
+ addChild: (e) => Ce(e),
1560
+ addSibling: (e) => Fe(e),
1561
+ removeNode: (e) => zt(e),
1562
+ duplicateNode: (e) => Et(e),
1563
+ setNodeText: (e, t) => pn(e, t),
1564
+ moveNode: (e, t, r) => bn(e, t, r),
1565
+ lineWidthForDepth: xt,
1566
+ endWidthForDepth: pt,
1457
1567
  getData: () => u.value,
1458
1568
  setData: (e) => {
1459
- ae.reset(), u.value = ke(e), m.value = null, y.value = /* @__PURE__ */ new Set(), L(), X(), j(() => se());
1569
+ fe.reset(), u.value = he(e), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), K(), Z(() => se());
1460
1570
  },
1461
1571
  resetView: () => se(),
1462
- exportData: It,
1463
- importData: Wt,
1572
+ exportData: Bt,
1573
+ importData: Rt,
1574
+ /** Serialize the current data tree as markdown. Always available
1575
+ * — the same serializer is used to emit `markdownChange`. */
1576
+ getMarkdown: () => st(u.value),
1577
+ /** Replace the data tree with the result of parsing `md`. The
1578
+ * flag `emitMarkdownChange` (default true) controls whether the
1579
+ * change is also echoed via `markdownChange` (use false when
1580
+ * the host just set the same value back from the prop). */
1581
+ setMarkdown: (e, t = !0) => {
1582
+ const r = Xt(e || "");
1583
+ t && (p.value = !0), S = !t, fe.reset(), u.value = he(r), m.value = null, h.value = /* @__PURE__ */ new Set(), H(), K(), Z(() => {
1584
+ S = !1, se();
1585
+ }), a("change", u.value);
1586
+ },
1464
1587
  // Make balanced the active layout (sticky). Subsequent data changes
1465
1588
  // and additions stay in balanced mode. Pass `false` to revert to the
1466
1589
  // default compact layout.
@@ -1471,379 +1594,381 @@ const si = ["disabled"], di = ["disabled"], ci = ["disabled"], fi = ["disabled"]
1471
1594
  // Re-balance now: clear all manual drag offsets, re-run the balanced
1472
1595
  // layout, and re-center the view. This is the action tied to the
1473
1596
  // "balance" toolbar button.
1474
- balance: () => kn(),
1475
- applyNodeStyle: (e, t) => H(e, t),
1476
- getNodeStyle: (e) => _(e),
1477
- applyNodeLink: (e, t) => Se(e, t),
1478
- removeNodeLink: (e) => ze(e),
1479
- applyNodeNote: (e, t) => Ee(e, t),
1480
- removeNodeNote: (e) => Ne(e),
1597
+ balance: () => En(),
1598
+ applyNodeStyle: (e, t) => ce(e, t),
1599
+ getNodeStyle: (e) => ue(e),
1600
+ applyNodeLink: (e, t) => Y(e, t),
1601
+ removeNodeLink: (e) => re(e),
1602
+ applyNodeNote: (e, t) => me(e, t),
1603
+ removeNodeNote: (e) => I(e),
1481
1604
  undo: () => nt(),
1482
1605
  redo: () => it(),
1483
- canUndo: () => ae.canUndo(),
1484
- canRedo: () => ae.canRedo(),
1606
+ canUndo: () => fe.canUndo(),
1607
+ canRedo: () => fe.canRedo(),
1485
1608
  // Settings panel / external mutation hooks
1486
1609
  applySettings: (e) => {
1487
- e.autoBalanceOnChange !== void 0 && (p.autoBalanceOnChange = e.autoBalanceOnChange), e.lineWidthStart !== void 0 && (p.lineWidthStart = Math.max(0.5, Math.min(20, e.lineWidthStart))), e.lineWidthEnd !== void 0 && (p.lineWidthEnd = Math.max(0.3, Math.min(10, e.lineWidthEnd))), e.rainbowBranch !== void 0 && (p.rainbowBranch = e.rainbowBranch), e.branchPaletteId !== void 0 && (p.branchPaletteId = e.branchPaletteId), e.customPalettes !== void 0 && (p.customPalettes = e.customPalettes), e.lineStyle !== void 0 && (p.lineStyle = e.lineStyle), e.taperedEdge !== void 0 && (p.taperedEdge = e.taperedEdge), e.showOrderBadge !== void 0 && (p.showOrderBadge = e.showOrderBadge);
1610
+ e.autoBalanceOnChange !== void 0 && (k.autoBalanceOnChange = e.autoBalanceOnChange), e.lineWidthStart !== void 0 && (k.lineWidthStart = Math.max(0.5, Math.min(20, e.lineWidthStart))), e.lineWidthEnd !== void 0 && (k.lineWidthEnd = Math.max(0.3, Math.min(10, e.lineWidthEnd))), e.rainbowBranch !== void 0 && (k.rainbowBranch = e.rainbowBranch), e.branchPaletteId !== void 0 && (k.branchPaletteId = e.branchPaletteId), e.customPalettes !== void 0 && (k.customPalettes = e.customPalettes), e.lineStyle !== void 0 && (k.lineStyle = e.lineStyle), e.taperedEdge !== void 0 && (k.taperedEdge = e.taperedEdge), e.showOrderBadge !== void 0 && (k.showOrderBadge = e.showOrderBadge);
1488
1611
  },
1489
1612
  getSettings: () => ({
1490
- autoBalanceOnChange: p.autoBalanceOnChange,
1491
- lineWidthStart: p.lineWidthStart,
1492
- lineWidthEnd: p.lineWidthEnd,
1493
- rainbowBranch: p.rainbowBranch,
1494
- branchPaletteId: p.branchPaletteId,
1495
- customPalettes: p.customPalettes,
1496
- lineStyle: p.lineStyle,
1497
- layoutMode: p.layoutMode,
1498
- taperedEdge: p.taperedEdge,
1499
- showOrderBadge: p.showOrderBadge
1613
+ autoBalanceOnChange: k.autoBalanceOnChange,
1614
+ lineWidthStart: k.lineWidthStart,
1615
+ lineWidthEnd: k.lineWidthEnd,
1616
+ rainbowBranch: k.rainbowBranch,
1617
+ branchPaletteId: k.branchPaletteId,
1618
+ customPalettes: k.customPalettes,
1619
+ lineStyle: k.lineStyle,
1620
+ layoutMode: k.layoutMode,
1621
+ taperedEdge: k.taperedEdge,
1622
+ showOrderBadge: k.showOrderBadge
1500
1623
  }),
1501
1624
  setBranchPalette: (e) => {
1502
1625
  if (!e) return;
1503
- [...Le, ...p.customPalettes].find((r) => r.id === e) && (p.branchPaletteId = e);
1626
+ [...Pe, ...k.customPalettes].find((r) => r.id === e) && (k.branchPaletteId = e);
1504
1627
  },
1505
- getBranchPalette: () => p.branchPaletteId,
1506
- getBranchPalettes: () => [...Le, ...p.customPalettes]
1507
- }), Dt(
1508
- () => l.data,
1628
+ getBranchPalette: () => k.branchPaletteId,
1629
+ getBranchPalettes: () => [...Pe, ...k.customPalettes]
1630
+ }), Ye(
1631
+ () => i.data,
1509
1632
  (e) => {
1510
- u.value = ke(e), L();
1633
+ u.value = he(e), H();
1511
1634
  },
1512
1635
  { deep: !1 }
1513
1636
  ), ut(() => {
1514
- X(), j(() => se());
1637
+ K(), Z(() => se());
1515
1638
  }), (e, t) => {
1516
- var r, c, v;
1517
- return w(), k("div", {
1639
+ var r, v, f;
1640
+ return M(), C("div", {
1518
1641
  class: "zm-mindmap",
1519
- style: oe({ background: ee.value.bgColor, fontSize: ee.value.fontSize + "px" })
1642
+ style: ve({ background: oe.value.bgColor, fontSize: oe.value.fontSize + "px" })
1520
1643
  }, [
1521
- g("div", {
1644
+ y("div", {
1522
1645
  ref_key: "wrapperRef",
1523
- ref: s,
1646
+ ref: d,
1524
1647
  class: "zm-canvas",
1525
- onMousedown: xn,
1526
- onContextmenu: t[13] || (t[13] = $(() => {
1648
+ onMousedown: kn,
1649
+ onContextmenu: t[13] || (t[13] = R(() => {
1527
1650
  }, ["prevent"])),
1528
1651
  onWheel: t[14] || (t[14] = //@ts-ignore
1529
- (...o) => S(M).onWheel && S(M).onWheel(...o)),
1530
- onClick: pn
1652
+ (...l) => z(E).onWheel && z(E).onWheel(...l)),
1653
+ onClick: Mn
1531
1654
  }, [
1532
- g("div", {
1655
+ y("div", {
1533
1656
  class: "zm-svg-layer",
1534
- style: oe({
1535
- left: G.value.vbX * S(M).scale.value + S(M).offsetX.value + "px",
1536
- top: G.value.vbY * S(M).scale.value + S(M).offsetY.value + "px",
1537
- width: G.value.vbW * S(M).scale.value + "px",
1538
- height: G.value.vbH * S(M).scale.value + "px"
1657
+ style: ve({
1658
+ left: ee.value.vbX * z(E).scale.value + z(E).offsetX.value + "px",
1659
+ top: ee.value.vbY * z(E).scale.value + z(E).offsetY.value + "px",
1660
+ width: ee.value.vbW * z(E).scale.value + "px",
1661
+ height: ee.value.vbH * z(E).scale.value + "px"
1539
1662
  })
1540
1663
  }, [
1541
- (w(), k("svg", {
1664
+ (M(), C("svg", {
1542
1665
  class: "zm-svg",
1543
- viewBox: cn.value,
1666
+ viewBox: mn.value,
1544
1667
  preserveAspectRatio: "xMinYMin meet",
1545
- width: G.value.vbW * S(M).scale.value,
1546
- height: G.value.vbH * S(M).scale.value
1668
+ width: ee.value.vbW * z(E).scale.value,
1669
+ height: ee.value.vbH * z(E).scale.value
1547
1670
  }, [
1548
- g("g", gi, [
1549
- (w(!0), k(R, null, Pt(dn.value, (o) => (w(), k("path", {
1550
- key: o.key,
1551
- d: tn(Nt(o.from, "out", o.to.side, o.to), Nt(o.to, "in"), mt(o.from.depth), yt(o.to.depth), 32, p.lineStyle, o.to._dir),
1552
- fill: ln(o.from, o.to),
1671
+ y("g", Mi, [
1672
+ (M(!0), C(P, null, Ot(hn.value, (l) => (M(), C("path", {
1673
+ key: l.key,
1674
+ d: rn($t(l.from, "out", l.to.side, l.to), $t(l.to, "in"), xt(l.from.depth), pt(l.to.depth), 32, k.lineStyle, l.to._dir),
1675
+ fill: un(l.from, l.to),
1553
1676
  stroke: "none"
1554
- }, null, 8, xi))), 128))
1677
+ }, null, 8, Ci))), 128))
1555
1678
  ])
1556
- ], 8, yi))
1679
+ ], 8, ki))
1557
1680
  ], 4),
1558
- S(M).isMarquee.value ? (w(), k("div", {
1681
+ z(E).isMarquee.value ? (M(), C("div", {
1559
1682
  key: 0,
1560
1683
  class: "zm-marquee",
1561
- style: oe({
1562
- left: S(M).marquee.x * S(M).scale.value + S(M).offsetX.value + "px",
1563
- top: S(M).marquee.y * S(M).scale.value + S(M).offsetY.value + "px",
1564
- width: S(M).marquee.width * S(M).scale.value + "px",
1565
- height: S(M).marquee.height * S(M).scale.value + "px"
1684
+ style: ve({
1685
+ left: z(E).marquee.x * z(E).scale.value + z(E).offsetX.value + "px",
1686
+ top: z(E).marquee.y * z(E).scale.value + z(E).offsetY.value + "px",
1687
+ width: z(E).marquee.width * z(E).scale.value + "px",
1688
+ height: z(E).marquee.height * z(E).scale.value + "px"
1566
1689
  })
1567
- }, null, 4)) : D("", !0),
1568
- g("div", {
1690
+ }, null, 4)) : O("", !0),
1691
+ y("div", {
1569
1692
  class: "zm-world",
1570
- style: oe({
1571
- transform: `translate(${S(M).offsetX.value}px, ${S(M).offsetY.value}px) scale(${S(M).scale.value})`
1693
+ style: ve({
1694
+ transform: `translate(${z(E).offsetX.value}px, ${z(E).offsetY.value}px) scale(${z(E).scale.value})`
1572
1695
  })
1573
1696
  }, [
1574
- (w(!0), k(R, null, Pt(tt.value, (o) => (w(), k("div", {
1575
- key: o.id,
1576
- class: be(["zm-node", {
1577
- "is-root": o.isRoot,
1578
- "is-selected": m.value === o.id,
1579
- "is-editing": f.value === o.id,
1580
- "has-image": !!o.image,
1581
- "is-resizing": jt.value === o.id
1697
+ (M(!0), C(P, null, Ot(tt.value, (l) => (M(), C("div", {
1698
+ key: l.id,
1699
+ class: Ie(["zm-node", {
1700
+ "is-root": l.isRoot,
1701
+ "is-selected": m.value === l.id,
1702
+ "is-editing": c.value === l.id,
1703
+ "has-image": !!l.image,
1704
+ "is-resizing": _t.value === l.id
1582
1705
  }]),
1583
- "data-node-id": o.id,
1584
- style: oe({
1585
- left: o.x + "px",
1586
- top: o.y + "px",
1587
- minWidth: o.width + "px",
1588
- height: o.height + "px",
1589
- fontSize: o.fontSize + "px",
1590
- background: on(o),
1591
- color: rn(o),
1592
- borderColor: an(o),
1593
- fontWeight: un(o),
1706
+ "data-node-id": l.id,
1707
+ style: ve({
1708
+ left: l.x + "px",
1709
+ top: l.y + "px",
1710
+ minWidth: l.width + "px",
1711
+ height: l.height + "px",
1712
+ fontSize: l.fontSize + "px",
1713
+ background: sn(l),
1714
+ color: dn(l),
1715
+ borderColor: cn(l),
1716
+ fontWeight: fn(l),
1594
1717
  // Center the box on (x, y) with translate(-50%, -50%)
1595
1718
  transform: "translate(-50%, -50%)"
1596
1719
  }),
1597
- onClick: (h) => gn(h, o),
1598
- onDblclick: (h) => {
1599
- h.stopPropagation(), n.readonly || $e(o.id);
1720
+ onClick: (g) => wn(g, l),
1721
+ onDblclick: (g) => {
1722
+ g.stopPropagation(), n.readonly || Ae(l.id);
1600
1723
  },
1601
- onContextmenu: (h) => E(h, o),
1602
- onMouseenter: (h) => Zt(o.id),
1603
- onMouseleave: (h) => Qt(o.id)
1724
+ onContextmenu: (g) => j(g, l),
1725
+ onMouseenter: (g) => tn(l.id),
1726
+ onMouseleave: (g) => nn(l.id)
1604
1727
  }, [
1605
- o.image ? (w(), k("img", {
1728
+ l.image ? (M(), C("img", {
1606
1729
  key: 0,
1607
1730
  class: "zm-node-img",
1608
- src: o.image.src,
1609
- width: o.image.width,
1610
- height: o.image.height,
1611
- alt: o.text,
1731
+ src: l.image.src,
1732
+ width: l.image.width,
1733
+ height: l.image.height,
1734
+ alt: l.text,
1612
1735
  draggable: "false"
1613
- }, null, 8, bi)) : D("", !0),
1614
- f.value !== o.id ? (w(), k("span", wi, [
1615
- g("span", ki, ve(o.text), 1),
1616
- o.link && !f.value ? (w(), k("a", {
1736
+ }, null, 8, Ei)) : O("", !0),
1737
+ c.value !== l.id ? (M(), C("span", zi, [
1738
+ y("span", Ni, be(l.text), 1),
1739
+ l.link && !c.value ? (M(), C("a", {
1617
1740
  key: 0,
1618
1741
  class: "zm-node-link",
1619
- href: o.link.url,
1742
+ href: l.link.url,
1620
1743
  target: "_blank",
1621
1744
  rel: "noopener noreferrer",
1622
- title: `打开链接:${o.link.url}`,
1623
- onClick: t[0] || (t[0] = $(() => {
1745
+ title: `打开链接:${l.link.url}`,
1746
+ onClick: t[0] || (t[0] = R(() => {
1624
1747
  }, ["stop"])),
1625
- onMousedown: t[1] || (t[1] = $(() => {
1748
+ onMousedown: t[1] || (t[1] = R(() => {
1626
1749
  }, ["stop"]))
1627
1750
  }, [
1628
- P(O, {
1751
+ F(V, {
1629
1752
  name: "link",
1630
1753
  size: 11,
1631
1754
  stroke: 2
1632
1755
  })
1633
- ], 40, Mi)) : D("", !0),
1634
- o.note && !f.value ? (w(), k("button", {
1756
+ ], 40, Ii)) : O("", !0),
1757
+ l.note && !c.value ? (M(), C("button", {
1635
1758
  key: 1,
1636
1759
  class: "zm-node-note-btn",
1637
1760
  type: "button",
1638
- title: Gt(o.note.text),
1639
- onClick: $((h) => re(o.id), ["stop"]),
1640
- onMousedown: t[2] || (t[2] = $(() => {
1761
+ title: Qt(l.note.text),
1762
+ onClick: R((g) => vt(l.id), ["stop"]),
1763
+ onMousedown: t[2] || (t[2] = R(() => {
1641
1764
  }, ["stop"]))
1642
1765
  }, [
1643
- P(O, {
1766
+ F(V, {
1644
1767
  name: "note",
1645
1768
  size: 11,
1646
1769
  stroke: 2
1647
1770
  })
1648
- ], 40, Ci)) : D("", !0)
1649
- ])) : zn((w(), k("input", {
1771
+ ], 40, Wi)) : O("", !0)
1772
+ ])) : Wn((M(), C("input", {
1650
1773
  key: 2,
1651
1774
  class: "zm-input",
1652
- "onUpdate:modelValue": t[3] || (t[3] = (h) => x.value = h),
1775
+ "onUpdate:modelValue": t[3] || (t[3] = (g) => x.value = g),
1653
1776
  autofocus: "",
1654
- onBlur: t[4] || (t[4] = (h) => Oe()),
1777
+ onBlur: t[4] || (t[4] = (g) => Oe()),
1655
1778
  onKeydown: [
1656
- t[5] || (t[5] = qe($((h) => Oe({ addSibling: "after" }), ["exact"]), ["enter"])),
1657
- t[6] || (t[6] = qe($((h) => Oe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
1658
- t[7] || (t[7] = qe($((h) => Oe({ addChild: !0 }), ["prevent"]), ["tab"])),
1659
- qe(fn, ["esc"]),
1660
- vn
1779
+ t[5] || (t[5] = Ke(R((g) => Oe({ addSibling: "after" }), ["exact"]), ["enter"])),
1780
+ t[6] || (t[6] = Ke(R((g) => Oe({ addSibling: "before" }), ["shift", "prevent", "exact"]), ["enter"])),
1781
+ t[7] || (t[7] = Ke(R((g) => Oe({ addChild: !0 }), ["prevent"]), ["tab"])),
1782
+ Ke(gn, ["esc"]),
1783
+ yn
1661
1784
  ],
1662
- onMousedown: t[8] || (t[8] = $(() => {
1785
+ onMousedown: t[8] || (t[8] = R(() => {
1663
1786
  }, ["stop"])),
1664
- onClick: t[9] || (t[9] = $(() => {
1787
+ onClick: t[9] || (t[9] = R(() => {
1665
1788
  }, ["stop"]))
1666
1789
  }, null, 544)), [
1667
- [En, x.value]
1790
+ [$n, x.value]
1668
1791
  ]),
1669
- b.value ? (w(), k("span", {
1792
+ b.value ? (M(), C("span", {
1670
1793
  key: 3,
1671
1794
  class: "zm-order-badge",
1672
- title: `数据顺序:第 ${Et(o.id) + 1} 个`
1673
- }, ve(Et(o.id) + 1), 9, Si)) : D("", !0),
1674
- zt(o.id) && !o.isRoot && lt(o.id) > 0 ? (w(), k("span", {
1795
+ title: `数据顺序:第 ${Wt(l.id) + 1} 个`
1796
+ }, be(Wt(l.id) + 1), 9, $i)) : O("", !0),
1797
+ It(l.id) && !l.isRoot && ot(l.id) > 0 ? (M(), C("span", {
1675
1798
  key: 4,
1676
- class: be(["zm-collapse-badge", { "is-on-left": o.side === -1 }]),
1677
- style: oe({ background: ue.value.get(o.id) ?? "#64748b" }),
1678
- title: `展开 ${lt(o.id)} 个子节点`,
1679
- onMousedown: t[10] || (t[10] = $(() => {
1799
+ class: Ie(["zm-collapse-badge", { "is-on-left": l.side === -1 }]),
1800
+ style: ve({ background: ge.value.get(l.id) ?? "#64748b" }),
1801
+ title: `展开 ${ot(l.id)} 个子节点`,
1802
+ onMousedown: t[10] || (t[10] = R(() => {
1680
1803
  }, ["stop"])),
1681
- onClick: $((h) => St(o.id), ["stop"])
1682
- }, ve(lt(o.id)), 47, zi)) : D("", !0),
1683
- !n.readonly && !o.isRoot && wn(o) && !zt(o.id) ? (w(), k("button", {
1804
+ onClick: R((g) => Nt(l.id), ["stop"])
1805
+ }, be(ot(l.id)), 47, Bi)) : O("", !0),
1806
+ !n.readonly && !l.isRoot && Sn(l) && !It(l.id) ? (M(), C("button", {
1684
1807
  key: 5,
1685
- class: be(["zm-btn zm-collapse", { "is-on-left": o.side === -1 }]),
1686
- style: oe({ color: ue.value.get(o.id) ?? "#64748b", borderColor: ue.value.get(o.id) ?? "#64748b" }),
1808
+ class: Ie(["zm-btn zm-collapse", { "is-on-left": l.side === -1 }]),
1809
+ style: ve({ color: ge.value.get(l.id) ?? "#64748b", borderColor: ge.value.get(l.id) ?? "#64748b" }),
1687
1810
  title: "折叠",
1688
- onMousedown: t[11] || (t[11] = $(() => {
1811
+ onMousedown: t[11] || (t[11] = R(() => {
1689
1812
  }, ["stop"])),
1690
- onClick: $((h) => St(o.id), ["stop"])
1813
+ onClick: R((g) => Nt(l.id), ["stop"])
1691
1814
  }, [
1692
- P(O, {
1815
+ F(V, {
1693
1816
  name: "minus",
1694
1817
  size: 10,
1695
1818
  stroke: 2.4
1696
1819
  })
1697
- ], 46, Ei)) : D("", !0),
1698
- o.image && m.value === o.id && f.value !== o.id ? (w(), k("span", {
1820
+ ], 46, Ri)) : O("", !0),
1821
+ l.image && m.value === l.id && c.value !== l.id ? (M(), C("span", {
1699
1822
  key: 6,
1700
1823
  class: "zm-img-resize-handle",
1701
1824
  title: "拖动调整图片大小",
1702
- onMousedown: $((h) => Jt(h, o), ["stop"])
1703
- }, null, 40, Ni)) : D("", !0),
1704
- o.image && m.value === o.id && f.value !== o.id ? (w(), k("button", {
1825
+ onMousedown: R((g) => en(g, l), ["stop"])
1826
+ }, null, 40, Ai)) : O("", !0),
1827
+ l.image && m.value === l.id && c.value !== l.id ? (M(), C("button", {
1705
1828
  key: 7,
1706
1829
  class: "zm-img-remove-btn",
1707
1830
  title: "移除图片",
1708
- onMousedown: t[12] || (t[12] = $(() => {
1831
+ onMousedown: t[12] || (t[12] = R(() => {
1709
1832
  }, ["stop"])),
1710
- onClick: $((h) => He(o.id), ["stop"])
1833
+ onClick: R((g) => G(l.id), ["stop"])
1711
1834
  }, [
1712
- P(O, {
1835
+ F(V, {
1713
1836
  name: "x",
1714
1837
  size: 9,
1715
1838
  stroke: 2.2
1716
1839
  })
1717
- ], 40, Ii)) : D("", !0)
1718
- ], 46, pi))), 128))
1840
+ ], 40, Li)) : O("", !0)
1841
+ ], 46, Si))), 128))
1719
1842
  ], 4),
1720
- F.value ? (w(), Nn(mi, {
1843
+ W.value ? (M(), Bn(wi, {
1721
1844
  key: 1,
1722
- x: F.value.x,
1723
- y: F.value.y,
1724
- container: s.value,
1725
- "has-image": !!((r = S(W)(u.value, F.value.nodeId)) != null && r.image),
1726
- "has-link": !!((c = S(W)(u.value, F.value.nodeId)) != null && c.link),
1727
- "has-note": !!((v = S(W)(u.value, F.value.nodeId)) != null && v.note),
1728
- readonly: l.readonly,
1729
- onPickImage: q,
1730
- onRemoveImage: Ie,
1731
- onSetLink: K,
1732
- onRemoveLink: Z,
1733
- onEditNote: Q,
1734
- onRemoveNote: he,
1735
- onClose: V
1736
- }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : D("", !0)
1845
+ x: W.value.x,
1846
+ y: W.value.y,
1847
+ container: d.value,
1848
+ "has-image": !!((r = z(B)(u.value, W.value.nodeId)) != null && r.image),
1849
+ "has-link": !!((v = z(B)(u.value, W.value.nodeId)) != null && v.link),
1850
+ "has-note": !!((f = z(B)(u.value, W.value.nodeId)) != null && f.note),
1851
+ readonly: i.readonly,
1852
+ onPickImage: ne,
1853
+ onRemoveImage: Zt,
1854
+ onSetLink: ie,
1855
+ onRemoveLink: ke,
1856
+ onEditNote: Be,
1857
+ onRemoveNote: Me,
1858
+ onClose: _
1859
+ }, null, 8, ["x", "y", "container", "has-image", "has-link", "has-note", "readonly"])) : O("", !0)
1737
1860
  ], 544),
1738
- l.previewMode ? D("", !0) : (w(), k("div", Wi, [
1739
- g("button", {
1861
+ i.previewMode ? O("", !0) : (M(), C("div", Hi, [
1862
+ y("button", {
1740
1863
  class: "zm-tb-btn",
1741
1864
  title: "放大",
1742
1865
  onClick: t[15] || (t[15] = //@ts-ignore
1743
- (...o) => S(M).zoomIn && S(M).zoomIn(...o))
1866
+ (...l) => z(E).zoomIn && z(E).zoomIn(...l))
1744
1867
  }, [
1745
- P(O, { name: "zoom-in" })
1868
+ F(V, { name: "zoom-in" })
1746
1869
  ]),
1747
- g("button", {
1870
+ y("button", {
1748
1871
  class: "zm-tb-btn",
1749
1872
  title: "缩小",
1750
1873
  onClick: t[16] || (t[16] = //@ts-ignore
1751
- (...o) => S(M).zoomOut && S(M).zoomOut(...o))
1874
+ (...l) => z(E).zoomOut && z(E).zoomOut(...l))
1752
1875
  }, [
1753
- P(O, { name: "zoom-out" })
1876
+ F(V, { name: "zoom-out" })
1754
1877
  ]),
1755
- g("button", {
1878
+ y("button", {
1756
1879
  class: "zm-tb-btn",
1757
1880
  title: "重置视图",
1758
1881
  onClick: se
1759
1882
  }, [
1760
- P(O, { name: "reset" })
1883
+ F(V, { name: "reset" })
1761
1884
  ]),
1762
- t[22] || (t[22] = g("span", { class: "zm-tb-divider" }, null, -1)),
1763
- n.readonly ? D("", !0) : (w(), k("button", {
1885
+ t[22] || (t[22] = y("span", { class: "zm-tb-divider" }, null, -1)),
1886
+ n.readonly ? O("", !0) : (M(), C("button", {
1764
1887
  key: 0,
1765
1888
  class: "zm-tb-btn",
1766
1889
  title: "添加子节点 (Tab)",
1767
- onClick: t[17] || (t[17] = (o) => m.value && me(m.value))
1890
+ onClick: t[17] || (t[17] = (l) => m.value && Ce(m.value))
1768
1891
  }, [
1769
- g("img", {
1770
- src: S(Rn),
1892
+ y("img", {
1893
+ src: z(Dn),
1771
1894
  width: "14",
1772
1895
  height: "14",
1773
1896
  alt: "添加子节点",
1774
1897
  draggable: "false"
1775
- }, null, 8, $i)
1898
+ }, null, 8, Di)
1776
1899
  ])),
1777
- n.readonly ? D("", !0) : (w(), k("button", {
1900
+ n.readonly ? O("", !0) : (M(), C("button", {
1778
1901
  key: 1,
1779
1902
  class: "zm-tb-btn",
1780
1903
  title: "添加同级 (Enter)",
1781
- onClick: t[18] || (t[18] = (o) => m.value && Te(m.value))
1904
+ onClick: t[18] || (t[18] = (l) => m.value && Fe(m.value))
1782
1905
  }, [
1783
- g("img", {
1784
- src: S(Bn),
1906
+ y("img", {
1907
+ src: z(Hn),
1785
1908
  width: "14",
1786
1909
  height: "14",
1787
1910
  alt: "添加同级",
1788
1911
  draggable: "false"
1789
- }, null, 8, Bi)
1912
+ }, null, 8, Pi)
1790
1913
  ])),
1791
- t[23] || (t[23] = g("span", { class: "zm-tb-divider" }, null, -1)),
1792
- g("button", {
1793
- class: be(["zm-tb-btn", { active: p.layoutMode === "mindmap" }]),
1914
+ t[23] || (t[23] = y("span", { class: "zm-tb-divider" }, null, -1)),
1915
+ y("button", {
1916
+ class: Ie(["zm-tb-btn", { active: k.layoutMode === "mindmap" }]),
1794
1917
  title: "思维导图布局 (中心辐射)",
1795
- onClick: t[19] || (t[19] = (o) => ot("mindmap"))
1918
+ onClick: t[19] || (t[19] = (l) => lt("mindmap"))
1796
1919
  }, [
1797
- P(O, { name: "mindmap" })
1920
+ F(V, { name: "mindmap" })
1798
1921
  ], 2),
1799
- g("button", {
1800
- class: be(["zm-tb-btn", { active: p.layoutMode === "tree" }]),
1922
+ y("button", {
1923
+ class: Ie(["zm-tb-btn", { active: k.layoutMode === "tree" }]),
1801
1924
  title: "树形布局 (向右展开)",
1802
- onClick: t[20] || (t[20] = (o) => ot("tree"))
1925
+ onClick: t[20] || (t[20] = (l) => lt("tree"))
1803
1926
  }, [
1804
- P(O, { name: "tree" })
1927
+ F(V, { name: "tree" })
1805
1928
  ], 2),
1806
- g("button", {
1807
- class: be(["zm-tb-btn", { active: p.layoutMode === "org" }]),
1929
+ y("button", {
1930
+ class: Ie(["zm-tb-btn", { active: k.layoutMode === "org" }]),
1808
1931
  title: "组织结构布局 (向下展开)",
1809
- onClick: t[21] || (t[21] = (o) => ot("org"))
1932
+ onClick: t[21] || (t[21] = (l) => lt("org"))
1810
1933
  }, [
1811
- P(O, { name: "org" })
1934
+ F(V, { name: "org" })
1812
1935
  ], 2),
1813
- t[24] || (t[24] = g("span", { class: "zm-tb-divider" }, null, -1)),
1814
- n.readonly ? D("", !0) : (w(), k("button", {
1936
+ t[24] || (t[24] = y("span", { class: "zm-tb-divider" }, null, -1)),
1937
+ n.readonly ? O("", !0) : (M(), C("button", {
1815
1938
  key: 2,
1816
1939
  class: "zm-tb-btn",
1817
1940
  title: "导入 JSON",
1818
- onClick: Mn
1941
+ onClick: zn
1819
1942
  }, [
1820
- P(O, { name: "import" })
1943
+ F(V, { name: "import" })
1821
1944
  ])),
1822
- g("button", {
1945
+ y("button", {
1823
1946
  class: "zm-tb-btn",
1824
1947
  title: "导出 JSON",
1825
- onClick: Cn
1948
+ onClick: Nn
1826
1949
  }, [
1827
- P(O, { name: "export" })
1950
+ F(V, { name: "export" })
1828
1951
  ]),
1829
- g("span", Ri, ve(Math.round(S(M).scale.value * 100)) + "%", 1)
1952
+ y("span", Ti, be(Math.round(z(E).scale.value * 100)) + "%", 1)
1830
1953
  ]))
1831
1954
  ], 4);
1832
1955
  };
1833
1956
  }
1834
- }), Hi = {
1957
+ }), Vi = {
1835
1958
  install(n) {
1836
- n.component("FlowMindMap", Ai);
1959
+ n.component("FlowMindMap", Oi);
1837
1960
  }
1838
1961
  };
1839
1962
  export {
1840
- Ai as MindMap,
1841
- ti as addChild,
1842
- ni as addSibling,
1843
- ke as clone,
1844
- Hi as default,
1845
- W as findNode,
1846
- te as findParent,
1847
- Yt as removeNode,
1848
- Ze as uid
1963
+ Oi as MindMap,
1964
+ ai as addChild,
1965
+ ui as addSibling,
1966
+ he as clone,
1967
+ Vi as default,
1968
+ B as findNode,
1969
+ ae as findParent,
1970
+ Xt as markdownToMindMap,
1971
+ st as mindMapToMarkdown,
1972
+ Gt as removeNode,
1973
+ we as uid
1849
1974
  };