markmap-view 0.18.5 → 0.18.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,45 +1,52 @@
1
- import { Hook as ht, getId as dt, debounce as pt, addClass as ut, walkTree as R, noop as X } from "markmap-common";
2
- import { loadCSS as Ee, loadJS as ze } from "markmap-common";
3
- import { scaleOrdinal as Y, schemeCategory10 as gt, linkHorizontal as mt, zoomTransform as z, select as ft, zoom as xt, min as K, max as G, zoomIdentity as yt, minIndex as kt } from "d3";
4
- const Z = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), vt = Y(gt), q = {
1
+ import { Hook as dt, getId as pt, debounce as gt, addClass as ut, walkTree as R, noop as X } from "markmap-common";
2
+ import { loadCSS as ze, loadJS as we } from "markmap-common";
3
+ import { scaleOrdinal as Y, schemeCategory10 as mt, linkHorizontal as ft, zoomTransform as w, select as xt, zoom as yt, min as G, max as V, zoomIdentity as kt, minIndex as vt } from "d3";
4
+ const Z = typeof navigator < "u" && navigator.userAgent.includes("Macintosh"), bt = Y(mt), q = (e = 1, t = 3, i = 2) => (n) => e + t / i ** n.state.depth, J = {
5
5
  autoFit: !1,
6
- color: (e) => {
7
- var t;
8
- return vt(`${((t = e.state) == null ? void 0 : t.path) || ""}`);
9
- },
10
6
  duration: 500,
11
7
  embedGlobalCSS: !0,
12
8
  fitRatio: 0.95,
13
9
  maxInitialScale: 2,
14
- maxWidth: 0,
15
- nodeMinHeight: 16,
16
- paddingX: 8,
17
10
  scrollForPan: Z,
18
- spacingHorizontal: 80,
19
- spacingVertical: 5,
20
11
  initialExpandLevel: -1,
21
12
  zoom: !0,
22
13
  pan: !0,
23
- toggleRecursively: !1
14
+ toggleRecursively: !1,
15
+ color: (e) => {
16
+ var t;
17
+ return bt(`${((t = e.state) == null ? void 0 : t.path) || ""}`);
18
+ },
19
+ lineWidth: q(),
20
+ maxWidth: 0,
21
+ nodeMinHeight: 16,
22
+ paddingX: 8,
23
+ spacingHorizontal: 80,
24
+ spacingVertical: 5
24
25
  };
25
- function ye(e) {
26
- const t = {}, i = { ...e }, { color: n, colorFreezeLevel: o } = i;
26
+ function ke(e) {
27
+ const t = {}, i = { ...e }, { color: n, colorFreezeLevel: s, lineWidth: a } = i;
27
28
  if ((n == null ? void 0 : n.length) === 1) {
28
- const s = n[0];
29
- t.color = () => s;
29
+ const l = n[0];
30
+ t.color = () => l;
30
31
  } else if (n != null && n.length) {
31
- const s = Y(n);
32
- t.color = (c) => s(`${c.state.path}`);
32
+ const l = Y(n);
33
+ t.color = (h) => l(`${h.state.path}`);
33
34
  }
34
- if (o) {
35
- const s = t.color || q.color;
36
- t.color = (c) => (c = {
37
- ...c,
35
+ if (s) {
36
+ const l = t.color || J.color;
37
+ t.color = (h) => (h = {
38
+ ...h,
38
39
  state: {
39
- ...c.state,
40
- path: c.state.path.split(".").slice(0, o).join(".")
40
+ ...h.state,
41
+ path: h.state.path.split(".").slice(0, s).join(".")
41
42
  }
42
- }, s(c));
43
+ }, l(h));
44
+ }
45
+ if (a) {
46
+ const l = Array.isArray(a) ? a : [a, 0, 1];
47
+ t.lineWidth = q(
48
+ ...l
49
+ );
43
50
  }
44
51
  return [
45
52
  "duration",
@@ -51,15 +58,15 @@ function ye(e) {
51
58
  "paddingX",
52
59
  "spacingHorizontal",
53
60
  "spacingVertical"
54
- ].forEach((s) => {
55
- const c = i[s];
56
- typeof c == "number" && (t[s] = c);
57
- }), ["zoom", "pan"].forEach((s) => {
58
- const c = i[s];
59
- c != null && (t[s] = !!c);
61
+ ].forEach((l) => {
62
+ const h = i[l];
63
+ typeof h == "number" && (t[l] = h);
64
+ }), ["zoom", "pan"].forEach((l) => {
65
+ const h = i[l];
66
+ h != null && (t[l] = !!h);
60
67
  }), t;
61
68
  }
62
- function bt(e) {
69
+ function Et(e) {
63
70
  let t = 0;
64
71
  for (let i = 0; i < e.length; i++)
65
72
  t = (t << 5) - t + e.charCodeAt(i) | 0;
@@ -73,101 +80,101 @@ function k(e) {
73
80
  const t = e;
74
81
  return function() {
75
82
  let n = Array.from(this.childNodes);
76
- return t && (n = n.filter((o) => t(o))), n;
83
+ return t && (n = n.filter((s) => t(s))), n;
77
84
  };
78
85
  }
79
- function Et(e) {
86
+ function zt(e) {
80
87
  var t = 0, i = e.children, n = i && i.length;
81
88
  if (!n) t = 1;
82
89
  else for (; --n >= 0; ) t += i[n].value;
83
90
  e.value = t;
84
91
  }
85
- function zt() {
86
- return this.eachAfter(Et);
92
+ function wt() {
93
+ return this.eachAfter(zt);
87
94
  }
88
- function wt(e) {
89
- var t = this, i, n = [t], o, a, l;
95
+ function Ct(e) {
96
+ var t = this, i, n = [t], s, a, c;
90
97
  do
91
98
  for (i = n.reverse(), n = []; t = i.pop(); )
92
- if (e(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
93
- n.push(o[a]);
99
+ if (e(t), s = t.children, s) for (a = 0, c = s.length; a < c; ++a)
100
+ n.push(s[a]);
94
101
  while (n.length);
95
102
  return this;
96
103
  }
97
- function Ct(e) {
98
- for (var t = this, i = [t], n, o; t = i.pop(); )
99
- if (e(t), n = t.children, n) for (o = n.length - 1; o >= 0; --o)
100
- i.push(n[o]);
104
+ function St(e) {
105
+ for (var t = this, i = [t], n, s; t = i.pop(); )
106
+ if (e(t), n = t.children, n) for (s = n.length - 1; s >= 0; --s)
107
+ i.push(n[s]);
101
108
  return this;
102
109
  }
103
- function St(e) {
104
- for (var t = this, i = [t], n = [], o, a, l; t = i.pop(); )
105
- if (n.push(t), o = t.children, o) for (a = 0, l = o.length; a < l; ++a)
106
- i.push(o[a]);
110
+ function Rt(e) {
111
+ for (var t = this, i = [t], n = [], s, a, c; t = i.pop(); )
112
+ if (n.push(t), s = t.children, s) for (a = 0, c = s.length; a < c; ++a)
113
+ i.push(s[a]);
107
114
  for (; t = n.pop(); )
108
115
  e(t);
109
116
  return this;
110
117
  }
111
- function Rt(e) {
118
+ function Xt(e) {
112
119
  return this.eachAfter(function(t) {
113
- for (var i = +e(t.data) || 0, n = t.children, o = n && n.length; --o >= 0; ) i += n[o].value;
120
+ for (var i = +e(t.data) || 0, n = t.children, s = n && n.length; --s >= 0; ) i += n[s].value;
114
121
  t.value = i;
115
122
  });
116
123
  }
117
- function Xt(e) {
124
+ function jt(e) {
118
125
  return this.eachBefore(function(t) {
119
126
  t.children && t.children.sort(e);
120
127
  });
121
128
  }
122
- function jt(e) {
123
- for (var t = this, i = _t(t, e), n = [t]; t !== i; )
129
+ function _t(e) {
130
+ for (var t = this, i = Ot(t, e), n = [t]; t !== i; )
124
131
  t = t.parent, n.push(t);
125
- for (var o = n.length; e !== i; )
126
- n.splice(o, 0, e), e = e.parent;
132
+ for (var s = n.length; e !== i; )
133
+ n.splice(s, 0, e), e = e.parent;
127
134
  return n;
128
135
  }
129
- function _t(e, t) {
136
+ function Ot(e, t) {
130
137
  if (e === t) return e;
131
- var i = e.ancestors(), n = t.ancestors(), o = null;
138
+ var i = e.ancestors(), n = t.ancestors(), s = null;
132
139
  for (e = i.pop(), t = n.pop(); e === t; )
133
- o = e, e = i.pop(), t = n.pop();
134
- return o;
140
+ s = e, e = i.pop(), t = n.pop();
141
+ return s;
135
142
  }
136
143
  function Mt() {
137
144
  for (var e = this, t = [e]; e = e.parent; )
138
145
  t.push(e);
139
146
  return t;
140
147
  }
141
- function Ot() {
148
+ function At() {
142
149
  var e = [];
143
150
  return this.each(function(t) {
144
151
  e.push(t);
145
152
  }), e;
146
153
  }
147
- function At() {
154
+ function Tt() {
148
155
  var e = [];
149
156
  return this.eachBefore(function(t) {
150
157
  t.children || e.push(t);
151
158
  }), e;
152
159
  }
153
- function Tt() {
160
+ function Ht() {
154
161
  var e = this, t = [];
155
162
  return e.each(function(i) {
156
163
  i !== e && t.push({ source: i.parent, target: i });
157
164
  }), t;
158
165
  }
159
166
  function H(e, t) {
160
- var i = new j(e), n = +e.value && (i.value = e.value), o, a = [i], l, s, c, p;
161
- for (t == null && (t = Bt); o = a.pop(); )
162
- if (n && (o.value = +o.data.value), (s = t(o.data)) && (p = s.length))
163
- for (o.children = new Array(p), c = p - 1; c >= 0; --c)
164
- a.push(l = o.children[c] = new j(s[c])), l.parent = o, l.depth = o.depth + 1;
167
+ var i = new j(e), n = +e.value && (i.value = e.value), s, a = [i], c, o, l, h;
168
+ for (t == null && (t = Ft); s = a.pop(); )
169
+ if (n && (s.value = +s.data.value), (o = t(s.data)) && (h = o.length))
170
+ for (s.children = new Array(h), l = h - 1; l >= 0; --l)
171
+ a.push(c = s.children[l] = new j(o[l])), c.parent = s, c.depth = s.depth + 1;
165
172
  return i.eachBefore(Dt);
166
173
  }
167
- function Ht() {
174
+ function Bt() {
168
175
  return H(this).eachBefore(Lt);
169
176
  }
170
- function Bt(e) {
177
+ function Ft(e) {
171
178
  return e.children;
172
179
  }
173
180
  function Lt(e) {
@@ -184,64 +191,64 @@ function j(e) {
184
191
  }
185
192
  j.prototype = H.prototype = {
186
193
  constructor: j,
187
- count: zt,
188
- each: wt,
189
- eachAfter: St,
190
- eachBefore: Ct,
191
- sum: Rt,
192
- sort: Xt,
193
- path: jt,
194
+ count: wt,
195
+ each: Ct,
196
+ eachAfter: Rt,
197
+ eachBefore: St,
198
+ sum: Xt,
199
+ sort: jt,
200
+ path: _t,
194
201
  ancestors: Mt,
195
- descendants: Ot,
196
- leaves: At,
197
- links: Tt,
198
- copy: Ht
202
+ descendants: At,
203
+ leaves: Tt,
204
+ links: Ht,
205
+ copy: Bt
199
206
  };
200
- const Ft = "d3-flextree", $t = "2.1.2", Nt = "build/d3-flextree.js", It = "index", Pt = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Wt = "Flexible tree layout algorithm that allows for variable node sizes.", Kt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Gt = "https://github.com/klortho/d3-flextree", Vt = "WTFPL", Ut = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Yt = { clean: "rm -rf build demo test", "build:demo": "rollup -c --environment BUILD:demo", "build:dev": "rollup -c --environment BUILD:dev", "build:prod": "rollup -c --environment BUILD:prod", "build:test": "rollup -c --environment BUILD:test", build: "rollup -c", lint: "eslint index.js src", "test:main": "node test/bundle.js", "test:browser": "node test/browser-tests.js", test: "npm-run-all test:*", prepare: "npm-run-all clean build lint test" }, Zt = { "d3-hierarchy": "^1.1.5" }, qt = { "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0", d3: "^4.13.0", "d3-selection-multi": "^1.0.1", eslint: "^4.19.1", jsdom: "^11.6.2", "npm-run-all": "^4.1.2", rollup: "^0.55.3", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-copy": "^0.2.3", "rollup-plugin-json": "^2.3.0", "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-uglify": "^3.0.0", "uglify-es": "^3.3.9" }, Jt = {
201
- name: Ft,
202
- version: $t,
203
- main: Nt,
207
+ const $t = "d3-flextree", Nt = "2.1.2", Wt = "build/d3-flextree.js", It = "index", Pt = { name: "Chris Maloney", url: "http://chrismaloney.org" }, Kt = "Flexible tree layout algorithm that allows for variable node sizes.", Gt = ["d3", "d3-module", "layout", "tree", "hierarchy", "d3-hierarchy", "plugin", "d3-plugin", "infovis", "visualization", "2d"], Vt = "https://github.com/klortho/d3-flextree", Ut = "WTFPL", Yt = { type: "git", url: "https://github.com/klortho/d3-flextree.git" }, Zt = { clean: "rm -rf build demo test", "build:demo": "rollup -c --environment BUILD:demo", "build:dev": "rollup -c --environment BUILD:dev", "build:prod": "rollup -c --environment BUILD:prod", "build:test": "rollup -c --environment BUILD:test", build: "rollup -c", lint: "eslint index.js src", "test:main": "node test/bundle.js", "test:browser": "node test/browser-tests.js", test: "npm-run-all test:*", prepare: "npm-run-all clean build lint test" }, qt = { "d3-hierarchy": "^1.1.5" }, Jt = { "babel-plugin-external-helpers": "^6.22.0", "babel-preset-es2015-rollup": "^3.0.0", d3: "^4.13.0", "d3-selection-multi": "^1.0.1", eslint: "^4.19.1", jsdom: "^11.6.2", "npm-run-all": "^4.1.2", rollup: "^0.55.3", "rollup-plugin-babel": "^2.7.1", "rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-copy": "^0.2.3", "rollup-plugin-json": "^2.3.0", "rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-uglify": "^3.0.0", "uglify-es": "^3.3.9" }, Qt = {
208
+ name: $t,
209
+ version: Nt,
210
+ main: Wt,
204
211
  module: It,
205
212
  "jsnext:main": "index",
206
213
  author: Pt,
207
- description: Wt,
208
- keywords: Kt,
209
- homepage: Gt,
210
- license: Vt,
211
- repository: Ut,
212
- scripts: Yt,
213
- dependencies: Zt,
214
- devDependencies: qt
215
- }, { version: Qt } = Jt, te = Object.freeze({
214
+ description: Kt,
215
+ keywords: Gt,
216
+ homepage: Vt,
217
+ license: Ut,
218
+ repository: Yt,
219
+ scripts: Zt,
220
+ dependencies: qt,
221
+ devDependencies: Jt
222
+ }, { version: te } = Qt, ee = Object.freeze({
216
223
  children: (e) => e.children,
217
224
  nodeSize: (e) => e.data.size,
218
225
  spacing: 0
219
226
  });
220
- function Q(e) {
221
- const t = Object.assign({}, te, e);
222
- function i(s) {
223
- const c = t[s];
224
- return typeof c == "function" ? c : () => c;
227
+ function tt(e) {
228
+ const t = Object.assign({}, ee, e);
229
+ function i(o) {
230
+ const l = t[o];
231
+ return typeof l == "function" ? l : () => l;
225
232
  }
226
- function n(s) {
227
- const c = l(a(), s, (p) => p.children);
228
- return c.update(), c.data;
233
+ function n(o) {
234
+ const l = c(a(), o, (h) => h.children);
235
+ return l.update(), l.data;
229
236
  }
230
- function o() {
231
- const s = i("nodeSize"), c = i("spacing");
232
- return class J extends H.prototype.constructor {
233
- constructor(h) {
234
- super(h);
237
+ function s() {
238
+ const o = i("nodeSize"), l = i("spacing");
239
+ return class Q extends H.prototype.constructor {
240
+ constructor(d) {
241
+ super(d);
235
242
  }
236
243
  copy() {
237
- const h = l(this.constructor, this, (u) => u.children);
238
- return h.each((u) => u.data = u.data.data), h;
244
+ const d = c(this.constructor, this, (g) => g.children);
245
+ return d.each((g) => g.data = g.data.data), d;
239
246
  }
240
247
  get size() {
241
- return s(this);
248
+ return o(this);
242
249
  }
243
- spacing(h) {
244
- return c(this, h);
250
+ spacing(d) {
251
+ return l(this, d);
245
252
  }
246
253
  get nodes() {
247
254
  return this.descendants();
@@ -265,8 +272,8 @@ function Q(e) {
265
272
  return this.x + this.xSize / 2;
266
273
  }
267
274
  get root() {
268
- const h = this.ancestors();
269
- return h[h.length - 1];
275
+ const d = this.ancestors();
276
+ return d[d.length - 1];
270
277
  }
271
278
  get numChildren() {
272
279
  return this.hasChildren ? this.children.length : 0;
@@ -285,7 +292,7 @@ function Q(e) {
285
292
  }
286
293
  get extents() {
287
294
  return (this.children || []).reduce(
288
- (h, u) => J.maxExtents(h, u.extents),
295
+ (d, g) => Q.maxExtents(d, g.extents),
289
296
  this.nodeExtents
290
297
  );
291
298
  }
@@ -297,21 +304,21 @@ function Q(e) {
297
304
  right: this.right
298
305
  };
299
306
  }
300
- static maxExtents(h, u) {
307
+ static maxExtents(d, g) {
301
308
  return {
302
- top: Math.min(h.top, u.top),
303
- bottom: Math.max(h.bottom, u.bottom),
304
- left: Math.min(h.left, u.left),
305
- right: Math.max(h.right, u.right)
309
+ top: Math.min(d.top, g.top),
310
+ bottom: Math.max(d.bottom, g.bottom),
311
+ left: Math.min(d.left, g.left),
312
+ right: Math.max(d.right, g.right)
306
313
  };
307
314
  }
308
315
  };
309
316
  }
310
317
  function a() {
311
- const s = o(), c = i("nodeSize"), p = i("spacing");
312
- return class extends s {
313
- constructor(h) {
314
- super(h), Object.assign(this, {
318
+ const o = s(), l = i("nodeSize"), h = i("spacing");
319
+ return class extends o {
320
+ constructor(d) {
321
+ super(d), Object.assign(this, {
315
322
  x: 0,
316
323
  y: 0,
317
324
  relX: 0,
@@ -327,119 +334,119 @@ function Q(e) {
327
334
  });
328
335
  }
329
336
  get size() {
330
- return c(this.data);
337
+ return l(this.data);
331
338
  }
332
- spacing(h) {
333
- return p(this.data, h.data);
339
+ spacing(d) {
340
+ return h(this.data, d.data);
334
341
  }
335
342
  get x() {
336
343
  return this.data.x;
337
344
  }
338
- set x(h) {
339
- this.data.x = h;
345
+ set x(d) {
346
+ this.data.x = d;
340
347
  }
341
348
  get y() {
342
349
  return this.data.y;
343
350
  }
344
- set y(h) {
345
- this.data.y = h;
351
+ set y(d) {
352
+ this.data.y = d;
346
353
  }
347
354
  update() {
348
- return tt(this), et(this), this;
355
+ return et(this), rt(this), this;
349
356
  }
350
357
  };
351
358
  }
352
- function l(s, c, p) {
353
- const h = (u, g) => {
354
- const m = new s(u);
359
+ function c(o, l, h) {
360
+ const d = (g, u) => {
361
+ const m = new o(g);
355
362
  Object.assign(m, {
356
- parent: g,
357
- depth: g === null ? 0 : g.depth + 1,
363
+ parent: u,
364
+ depth: u === null ? 0 : u.depth + 1,
358
365
  height: 0,
359
366
  length: 1
360
367
  });
361
- const y = p(u) || [];
362
- return m.children = y.length === 0 ? null : y.map((f) => h(f, m)), m.children && Object.assign(m, m.children.reduce(
363
- (f, b) => ({
364
- height: Math.max(f.height, b.height + 1),
365
- length: f.length + b.length
368
+ const x = h(g) || [];
369
+ return m.children = x.length === 0 ? null : x.map((y) => d(y, m)), m.children && Object.assign(m, m.children.reduce(
370
+ (y, v) => ({
371
+ height: Math.max(y.height, v.height + 1),
372
+ length: y.length + v.length
366
373
  }),
367
374
  m
368
375
  )), m;
369
376
  };
370
- return h(c, null);
377
+ return d(l, null);
371
378
  }
372
379
  return Object.assign(n, {
373
- nodeSize(s) {
374
- return arguments.length ? (t.nodeSize = s, n) : t.nodeSize;
380
+ nodeSize(o) {
381
+ return arguments.length ? (t.nodeSize = o, n) : t.nodeSize;
375
382
  },
376
- spacing(s) {
377
- return arguments.length ? (t.spacing = s, n) : t.spacing;
383
+ spacing(o) {
384
+ return arguments.length ? (t.spacing = o, n) : t.spacing;
378
385
  },
379
- children(s) {
380
- return arguments.length ? (t.children = s, n) : t.children;
386
+ children(o) {
387
+ return arguments.length ? (t.children = o, n) : t.children;
381
388
  },
382
- hierarchy(s, c) {
383
- const p = typeof c > "u" ? t.children : c;
384
- return l(o(), s, p);
389
+ hierarchy(o, l) {
390
+ const h = typeof l > "u" ? t.children : l;
391
+ return c(s(), o, h);
385
392
  },
386
- dump(s) {
387
- const c = i("nodeSize"), p = (h) => (u) => {
388
- const g = h + " ", m = h + " ", { x: y, y: f } = u, b = c(u), v = u.children || [], w = v.length === 0 ? " " : `,${g}children: [${m}${v.map(p(m)).join(m)}${g}],${h}`;
389
- return `{ size: [${b.join(", ")}],${g}x: ${y}, y: ${f}${w}},`;
393
+ dump(o) {
394
+ const l = i("nodeSize"), h = (d) => (g) => {
395
+ const u = d + " ", m = d + " ", { x, y } = g, v = l(g), b = g.children || [], z = b.length === 0 ? " " : `,${u}children: [${m}${b.map(h(m)).join(m)}${u}],${d}`;
396
+ return `{ size: [${v.join(", ")}],${u}x: ${x}, y: ${y}${z}},`;
390
397
  };
391
- return p(`
392
- `)(s);
398
+ return h(`
399
+ `)(o);
393
400
  }
394
401
  }), n;
395
402
  }
396
- Q.version = Qt;
397
- const tt = (e, t = 0) => (e.y = t, (e.children || []).reduce((i, n) => {
398
- const [o, a] = i;
399
- tt(n, e.y + e.ySize);
400
- const l = (o === 0 ? n.lExt : n.rExt).bottom;
401
- o !== 0 && re(e, o, a);
402
- const s = he(l, o, a);
403
- return [o + 1, s];
404
- }, [0, null]), ee(e), ce(e), e), et = (e, t, i) => {
403
+ tt.version = te;
404
+ const et = (e, t = 0) => (e.y = t, (e.children || []).reduce((i, n) => {
405
+ const [s, a] = i;
406
+ et(n, e.y + e.ySize);
407
+ const c = (s === 0 ? n.lExt : n.rExt).bottom;
408
+ s !== 0 && ne(e, s, a);
409
+ const o = de(c, s, a);
410
+ return [s + 1, o];
411
+ }, [0, null]), re(e), he(e), e), rt = (e, t, i) => {
405
412
  typeof t > "u" && (t = -e.relX - e.prelim, i = 0);
406
413
  const n = t + e.relX;
407
- return e.relX = n + e.prelim - i, e.prelim = 0, e.x = i + e.relX, (e.children || []).forEach((o) => et(o, n, e.x)), e;
408
- }, ee = (e) => {
414
+ return e.relX = n + e.prelim - i, e.prelim = 0, e.x = i + e.relX, (e.children || []).forEach((s) => rt(s, n, e.x)), e;
415
+ }, re = (e) => {
409
416
  (e.children || []).reduce((t, i) => {
410
- const [n, o] = t, a = n + i.shift, l = o + a + i.change;
411
- return i.relX += l, [a, l];
417
+ const [n, s] = t, a = n + i.shift, c = s + a + i.change;
418
+ return i.relX += c, [a, c];
412
419
  }, [0, 0]);
413
- }, re = (e, t, i) => {
414
- const n = e.children[t - 1], o = e.children[t];
415
- let a = n, l = n.relX, s = o, c = o.relX, p = !0;
416
- for (; a && s; ) {
420
+ }, ne = (e, t, i) => {
421
+ const n = e.children[t - 1], s = e.children[t];
422
+ let a = n, c = n.relX, o = s, l = s.relX, h = !0;
423
+ for (; a && o; ) {
417
424
  a.bottom > i.lowY && (i = i.next);
418
- const h = l + a.prelim - (c + s.prelim) + a.xSize / 2 + s.xSize / 2 + a.spacing(s);
419
- (h > 0 || h < 0 && p) && (c += h, ne(o, h), ie(e, t, i.index, h)), p = !1;
420
- const u = a.bottom, g = s.bottom;
421
- u <= g && (a = oe(a), a && (l += a.relX)), u >= g && (s = se(s), s && (c += s.relX));
425
+ const d = c + a.prelim - (l + o.prelim) + a.xSize / 2 + o.xSize / 2 + a.spacing(o);
426
+ (d > 0 || d < 0 && h) && (l += d, ie(s, d), se(e, t, i.index, d)), h = !1;
427
+ const g = a.bottom, u = o.bottom;
428
+ g <= u && (a = ae(a), a && (c += a.relX)), g >= u && (o = oe(o), o && (l += o.relX));
422
429
  }
423
- !a && s ? ae(e, t, s, c) : a && !s && le(e, t, a, l);
424
- }, ne = (e, t) => {
430
+ !a && o ? le(e, t, o, l) : a && !o && ce(e, t, a, c);
431
+ }, ie = (e, t) => {
425
432
  e.relX += t, e.lExtRelX += t, e.rExtRelX += t;
426
- }, ie = (e, t, i, n) => {
427
- const o = e.children[t], a = t - i;
433
+ }, se = (e, t, i, n) => {
434
+ const s = e.children[t], a = t - i;
428
435
  if (a > 1) {
429
- const l = n / a;
430
- e.children[i + 1].shift += l, o.shift -= l, o.change -= n - l;
436
+ const c = n / a;
437
+ e.children[i + 1].shift += c, s.shift -= c, s.change -= n - c;
431
438
  }
432
- }, se = (e) => e.hasChildren ? e.firstChild : e.lThr, oe = (e) => e.hasChildren ? e.lastChild : e.rThr, ae = (e, t, i, n) => {
433
- const o = e.firstChild, a = o.lExt, l = e.children[t];
439
+ }, oe = (e) => e.hasChildren ? e.firstChild : e.lThr, ae = (e) => e.hasChildren ? e.lastChild : e.rThr, le = (e, t, i, n) => {
440
+ const s = e.firstChild, a = s.lExt, c = e.children[t];
434
441
  a.lThr = i;
435
- const s = n - i.relX - o.lExtRelX;
436
- a.relX += s, a.prelim -= s, o.lExt = l.lExt, o.lExtRelX = l.lExtRelX;
437
- }, le = (e, t, i, n) => {
438
- const o = e.children[t], a = o.rExt, l = e.children[t - 1];
442
+ const o = n - i.relX - s.lExtRelX;
443
+ a.relX += o, a.prelim -= o, s.lExt = c.lExt, s.lExtRelX = c.lExtRelX;
444
+ }, ce = (e, t, i, n) => {
445
+ const s = e.children[t], a = s.rExt, c = e.children[t - 1];
439
446
  a.rThr = i;
440
- const s = n - i.relX - o.rExtRelX;
441
- a.relX += s, a.prelim -= s, o.rExt = l.rExt, o.rExtRelX = l.rExtRelX;
442
- }, ce = (e) => {
447
+ const o = n - i.relX - s.rExtRelX;
448
+ a.relX += o, a.prelim -= o, s.rExt = c.rExt, s.rExtRelX = c.rExtRelX;
449
+ }, he = (e) => {
443
450
  if (e.hasChildren) {
444
451
  const t = e.firstChild, i = e.lastChild, n = (t.prelim + t.relX - t.xSize / 2 + i.relX + i.prelim + i.xSize / 2) / 2;
445
452
  Object.assign(e, {
@@ -450,7 +457,7 @@ const tt = (e, t = 0) => (e.y = t, (e.children || []).reduce((i, n) => {
450
457
  rExtRelX: i.rExtRelX
451
458
  });
452
459
  }
453
- }, he = (e, t, i) => {
460
+ }, de = (e, t, i) => {
454
461
  for (; i !== null && e >= i.lowY; )
455
462
  i = i.next;
456
463
  return {
@@ -458,38 +465,35 @@ const tt = (e, t = 0) => (e.y = t, (e.children || []).reduce((i, n) => {
458
465
  index: t,
459
466
  next: i
460
467
  };
461
- }, rt = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;--markmap-highlight-node-bg: #ff02;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block}.markmap-highlight rect{fill:var(--markmap-highlight-node-bg)}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", ke = rt, O = "g.markmap-node", de = "path.markmap-link", pe = "g.markmap-highlight", A = mt();
462
- function V(e) {
463
- return Math.max(4 - 2 * e.state.depth, 1.5);
464
- }
468
+ }, nt = ".markmap{--markmap-max-width: 9999px;--markmap-a-color: #0097e6;--markmap-a-hover-color: #00a8ff;--markmap-code-bg: #f0f0f0;--markmap-code-color: #555;--markmap-highlight-bg: #ffeaa7;--markmap-table-border: 1px solid currentColor;--markmap-font: 300 16px/20px sans-serif;--markmap-circle-open-bg: #fff;--markmap-text-color: #333;--markmap-highlight-node-bg: #ff02;font:var(--markmap-font);color:var(--markmap-text-color)}.markmap-link{fill:none}.markmap-node>circle{cursor:pointer}.markmap-foreign{display:inline-block}.markmap-foreign p{margin:0}.markmap-foreign a{color:var(--markmap-a-color)}.markmap-foreign a:hover{color:var(--markmap-a-hover-color)}.markmap-foreign code{padding:.25em;font-size:calc(1em - 2px);color:var(--markmap-code-color);background-color:var(--markmap-code-bg);border-radius:2px}.markmap-foreign pre{margin:0}.markmap-foreign pre>code{display:block}.markmap-foreign del{text-decoration:line-through}.markmap-foreign em{font-style:italic}.markmap-foreign strong{font-weight:700}.markmap-foreign mark{background:var(--markmap-highlight-bg)}.markmap-foreign table,.markmap-foreign th,.markmap-foreign td{border-collapse:collapse;border:var(--markmap-table-border)}.markmap-foreign img{display:inline-block}.markmap-foreign svg{fill:currentColor}.markmap-foreign>div{width:var(--markmap-max-width);text-align:left}.markmap-foreign>div>div{display:inline-block}.markmap-highlight rect{fill:var(--markmap-highlight-node-bg)}.markmap-dark .markmap{--markmap-code-bg: #1a1b26;--markmap-code-color: #ddd;--markmap-circle-open-bg: #444;--markmap-text-color: #eee}", ve = nt, M = "g.markmap-node", pe = "path.markmap-link", ge = "g.markmap-highlight", A = ft();
465
469
  function U(e, t) {
466
- const i = kt(e, t);
470
+ const i = vt(e, t);
467
471
  return e[i];
468
472
  }
469
473
  function T(e) {
470
474
  e.stopPropagation();
471
475
  }
472
- const ue = new ht();
473
- class nt {
476
+ const ue = new dt();
477
+ class it {
474
478
  constructor(t, i) {
475
- this.options = q, this._disposeList = [], this.handleZoom = (n) => {
476
- const { transform: o } = n;
477
- this.g.attr("transform", o);
479
+ this.options = { ...J }, this._disposeList = [], this.handleZoom = (n) => {
480
+ const { transform: s } = n;
481
+ this.g.attr("transform", s);
478
482
  }, this.handlePan = (n) => {
479
483
  n.preventDefault();
480
- const o = z(this.svg.node()), a = o.translate(
481
- -n.deltaX / o.k,
482
- -n.deltaY / o.k
484
+ const s = w(this.svg.node()), a = s.translate(
485
+ -n.deltaX / s.k,
486
+ -n.deltaY / s.k
483
487
  );
484
488
  this.svg.call(this.zoom.transform, a);
485
- }, this.handleClick = (n, o) => {
489
+ }, this.handleClick = (n, s) => {
486
490
  let a = this.options.toggleRecursively;
487
- (Z ? n.metaKey : n.ctrlKey) && (a = !a), this.toggleNode(o, a);
488
- }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : ft(t), this.styleNode = this.svg.append("style"), this.zoom = xt().filter((n) => this.options.scrollForPan && n.type === "wheel" ? n.ctrlKey && !n.button : (!n.ctrlKey || n.type === "wheel") && !n.button).on("zoom", this.handleZoom), this.setOptions(i), this.state = {
489
- id: this.options.id || this.svg.attr("id") || dt(),
491
+ (Z ? n.metaKey : n.ctrlKey) && (a = !a), this.toggleNode(s, a);
492
+ }, this.ensureView = this.ensureVisible, this.svg = t.datum ? t : xt(t), this.styleNode = this.svg.append("style"), this.zoom = yt().filter((n) => this.options.scrollForPan && n.type === "wheel" ? n.ctrlKey && !n.button : (!n.ctrlKey || n.type === "wheel") && !n.button).on("zoom", this.handleZoom), this.setOptions(i), this.state = {
493
+ id: this.options.id || this.svg.attr("id") || pt(),
490
494
  rect: { x1: 0, y1: 0, x2: 0, y2: 0 }
491
495
  }, this.g = this.svg.append("g"), this.g.append("g").attr("class", "markmap-highlight"), this._observer = new ResizeObserver(
492
- pt(() => {
496
+ gt(() => {
493
497
  this.renderData();
494
498
  }, 100)
495
499
  ), this._disposeList.push(
@@ -501,7 +505,7 @@ class nt {
501
505
  }
502
506
  getStyleContent() {
503
507
  const { style: t } = this.options, { id: i } = this.state, n = typeof t == "function" ? t(i) : "";
504
- return [this.options.embedGlobalCSS && rt, n].filter(Boolean).join(`
508
+ return [this.options.embedGlobalCSS && nt, n].filter(Boolean).join(`
505
509
  `);
506
510
  }
507
511
  updateStyle() {
@@ -513,13 +517,13 @@ class nt {
513
517
  this.styleNode.text(t);
514
518
  }
515
519
  async toggleNode(t, i = !1) {
516
- var o, a;
517
- const n = (o = t.payload) != null && o.fold ? 0 : 1;
518
- i ? R(t, (l, s) => {
519
- l.payload = {
520
- ...l.payload,
520
+ var s, a;
521
+ const n = (s = t.payload) != null && s.fold ? 0 : 1;
522
+ i ? R(t, (c, o) => {
523
+ c.payload = {
524
+ ...c.payload,
521
525
  fold: n
522
- }, s();
526
+ }, o();
523
527
  }) : t.payload = {
524
528
  ...t.payload,
525
529
  fold: (a = t.payload) != null && a.fold ? 0 : 1
@@ -527,13 +531,13 @@ class nt {
527
531
  }
528
532
  _initializeData(t) {
529
533
  let i = 0;
530
- const { color: n, initialExpandLevel: o } = this.options;
531
- let a = 0, l = 0;
532
- return R(t, (s, c, p) => {
533
- var u, g, m, y;
534
- l += 1, s.children = (u = s.children) == null ? void 0 : u.map((f) => ({ ...f })), i += 1, s.state = {
535
- ...s.state,
536
- depth: l,
534
+ const { color: n, initialExpandLevel: s } = this.options;
535
+ let a = 0, c = 0;
536
+ return R(t, (o, l, h) => {
537
+ var g, u, m, x;
538
+ c += 1, o.children = (g = o.children) == null ? void 0 : g.map((y) => ({ ...y })), i += 1, o.state = {
539
+ ...o.state,
540
+ depth: c,
537
541
  id: i,
538
542
  rect: {
539
543
  x: 0,
@@ -542,47 +546,47 @@ class nt {
542
546
  height: 0
543
547
  },
544
548
  size: [0, 0]
545
- }, s.state.key = [(g = p == null ? void 0 : p.state) == null ? void 0 : g.id, s.state.id].filter(Boolean).join(".") + bt(s.content), s.state.path = [(m = p == null ? void 0 : p.state) == null ? void 0 : m.path, s.state.id].filter(Boolean).join("."), n(s);
546
- const h = ((y = s.payload) == null ? void 0 : y.fold) === 2;
547
- h ? a += 1 : (a || o >= 0 && s.state.depth >= o) && (s.payload = { ...s.payload, fold: 1 }), c(), h && (a -= 1), l -= 1;
549
+ }, o.state.key = [(u = h == null ? void 0 : h.state) == null ? void 0 : u.id, o.state.id].filter(Boolean).join(".") + Et(o.content), o.state.path = [(m = h == null ? void 0 : h.state) == null ? void 0 : m.path, o.state.id].filter(Boolean).join("."), n(o);
550
+ const d = ((x = o.payload) == null ? void 0 : x.fold) === 2;
551
+ d ? a += 1 : (a || s >= 0 && o.state.depth >= s) && (o.payload = { ...o.payload, fold: 1 }), l(), d && (a -= 1), c -= 1;
548
552
  }), t;
549
553
  }
550
554
  _relayout() {
551
555
  if (!this.state.data) return;
552
- this.g.selectAll(k(O)).selectAll(
556
+ this.g.selectAll(k(M)).selectAll(
553
557
  k("foreignObject")
554
- ).each(function(s) {
555
- var h;
556
- const c = (h = this.firstChild) == null ? void 0 : h.firstChild, p = [c.scrollWidth, c.scrollHeight];
557
- s.state.size = p;
558
+ ).each(function(l) {
559
+ var g;
560
+ const h = (g = this.firstChild) == null ? void 0 : g.firstChild, d = [h.scrollWidth, h.scrollHeight];
561
+ l.state.size = d;
558
562
  });
559
- const { spacingHorizontal: t, paddingX: i, spacingVertical: n } = this.options, o = Q({}).children((s) => {
560
- var c;
561
- if (!((c = s.payload) != null && c.fold)) return s.children;
562
- }).nodeSize((s) => {
563
- const [c, p] = s.data.state.size;
564
- return [p, c + (c ? i * 2 : 0) + t];
565
- }).spacing((s, c) => s.parent === c.parent ? n : n * 2), a = o.hierarchy(this.state.data);
566
- o(a);
567
- const l = a.descendants();
568
- l.forEach((s) => {
569
- const c = s.data;
570
- c.state.rect = {
571
- x: s.y,
572
- y: s.x - s.xSize / 2,
573
- width: s.ySize - t,
574
- height: s.xSize
563
+ const { lineWidth: t, paddingX: i, spacingHorizontal: n, spacingVertical: s } = this.options, a = tt({}).children((l) => {
564
+ var h;
565
+ if (!((h = l.payload) != null && h.fold)) return l.children;
566
+ }).nodeSize((l) => {
567
+ const [h, d] = l.data.state.size;
568
+ return [d, h + (h ? i * 2 : 0) + n];
569
+ }).spacing((l, h) => (l.parent === h.parent ? s : s * 2) + t(l.data)), c = a.hierarchy(this.state.data);
570
+ a(c);
571
+ const o = c.descendants();
572
+ o.forEach((l) => {
573
+ const h = l.data;
574
+ h.state.rect = {
575
+ x: l.y,
576
+ y: l.x - l.xSize / 2,
577
+ width: l.ySize - n,
578
+ height: l.xSize
575
579
  };
576
580
  }), this.state.rect = {
577
- x1: K(l, (s) => s.data.state.rect.x) || 0,
578
- y1: K(l, (s) => s.data.state.rect.y) || 0,
579
- x2: G(
580
- l,
581
- (s) => s.data.state.rect.x + s.data.state.rect.width
581
+ x1: G(o, (l) => l.data.state.rect.x) || 0,
582
+ y1: G(o, (l) => l.data.state.rect.y) || 0,
583
+ x2: V(
584
+ o,
585
+ (l) => l.data.state.rect.x + l.data.state.rect.width
582
586
  ) || 0,
583
- y2: G(
584
- l,
585
- (s) => s.data.state.rect.y + s.data.state.rect.height
587
+ y2: V(
588
+ o,
589
+ (l) => l.data.state.rect.y + l.data.state.rect.height
586
590
  ) || 0
587
591
  };
588
592
  }
@@ -599,118 +603,118 @@ class nt {
599
603
  this.state.highlight = t || void 0, await this.renderData();
600
604
  }
601
605
  _getHighlightRect(t) {
602
- const i = this.svg.node(), o = 4 / z(i).k, a = {
606
+ const i = this.svg.node(), s = 4 / w(i).k, a = {
603
607
  ...t.state.rect
604
608
  };
605
- return a.x -= o, a.y -= o, a.width += 2 * o, a.height += 2 * o, a;
609
+ return a.x -= s, a.y -= s, a.width += 2 * s, a.height += 2 * s, a;
606
610
  }
607
611
  async renderData(t) {
608
- const { paddingX: i, autoFit: n, color: o, maxWidth: a } = this.options, l = this.state.data;
609
- if (!l) return;
610
- const s = {}, c = {}, p = [];
611
- R(l, (r, d, x) => {
612
+ const { paddingX: i, autoFit: n, color: s, maxWidth: a, lineWidth: c } = this.options, o = this.state.data;
613
+ if (!o) return;
614
+ const l = {}, h = {}, d = [];
615
+ R(o, (r, p, f) => {
612
616
  var E;
613
- (E = r.payload) != null && E.fold || d(), s[r.state.id] = r, x && (c[r.state.id] = x.state.id), p.push(r);
617
+ (E = r.payload) != null && E.fold || p(), l[r.state.id] = r, f && (h[r.state.id] = f.state.id), d.push(r);
614
618
  });
615
- const h = {}, u = {}, g = (r) => {
616
- !r || h[r.state.id] || R(r, (d, x) => {
617
- h[d.state.id] = r.state.id, x();
619
+ const g = {}, u = {}, m = (r) => {
620
+ !r || g[r.state.id] || R(r, (p, f) => {
621
+ g[p.state.id] = r.state.id, f();
618
622
  });
619
- }, m = (r) => u[h[r.state.id]] || l.state.rect, y = (r) => (s[h[r.state.id]] || l).state.rect;
620
- u[l.state.id] = l.state.rect, t && g(t);
621
- const { highlight: f } = this.state;
622
- let b = this.g.selectAll(k(pe)).selectAll(k("rect")).data(f ? [this._getHighlightRect(f)] : []).join("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height);
623
- const v = this.g.selectAll(k(O)).each((r) => {
623
+ }, x = (r) => u[g[r.state.id]] || o.state.rect, y = (r) => (l[g[r.state.id]] || o).state.rect;
624
+ u[o.state.id] = o.state.rect, t && m(t);
625
+ const { highlight: v } = this.state;
626
+ let b = this.g.selectAll(k(ge)).selectAll(k("rect")).data(v ? [this._getHighlightRect(v)] : []).join("rect").attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height);
627
+ const z = this.g.selectAll(k(M)).each((r) => {
624
628
  u[r.state.id] = r.state.rect;
625
- }).data(p, (r) => r.state.key), w = v.enter().append("g").attr("data-depth", (r) => r.state.depth).attr("data-path", (r) => r.state.path).each((r) => {
626
- g(s[c[r.state.id]]);
627
- }), C = v.exit().each((r) => {
628
- g(s[c[r.state.id]]);
629
- }), S = v.merge(w).attr(
629
+ }).data(d, (r) => r.state.key), B = z.enter().append("g").attr("data-depth", (r) => r.state.depth).attr("data-path", (r) => r.state.path).each((r) => {
630
+ m(l[h[r.state.id]]);
631
+ }), C = z.exit().each((r) => {
632
+ m(l[h[r.state.id]]);
633
+ }), S = z.merge(B).attr(
630
634
  "class",
631
635
  (r) => {
632
- var d;
633
- return ["markmap-node", ((d = r.payload) == null ? void 0 : d.fold) && "markmap-fold"].filter(Boolean).join(" ");
636
+ var p;
637
+ return ["markmap-node", ((p = r.payload) == null ? void 0 : p.fold) && "markmap-fold"].filter(Boolean).join(" ");
634
638
  }
635
- ), B = S.selectAll(k("line")).data(
639
+ ), F = S.selectAll(k("line")).data(
636
640
  (r) => [r],
637
641
  (r) => r.state.key
638
- ), L = B.enter().append("line").attr("stroke", (r) => o(r)).attr("stroke-width", 0), D = B.merge(L), F = S.selectAll(k("circle")).data(
642
+ ), L = F.enter().append("line").attr("stroke", (r) => s(r)).attr("stroke-width", 0), D = F.merge(L), $ = S.selectAll(k("circle")).data(
639
643
  (r) => {
640
- var d;
641
- return (d = r.children) != null && d.length ? [r] : [];
644
+ var p;
645
+ return (p = r.children) != null && p.length ? [r] : [];
642
646
  },
643
647
  (r) => r.state.key
644
- ), $ = F.enter().append("circle").attr("stroke-width", 0).attr("r", 0).on("click", (r, d) => this.handleClick(r, d)).on("mousedown", T).merge(F).attr("stroke", (r) => o(r)).attr(
648
+ ), N = $.enter().append("circle").attr("stroke-width", 0).attr("r", 0).on("click", (r, p) => this.handleClick(r, p)).on("mousedown", T).merge($).attr("stroke", (r) => s(r)).attr(
645
649
  "fill",
646
650
  (r) => {
647
- var d;
648
- return (d = r.payload) != null && d.fold && r.children ? o(r) : "var(--markmap-circle-open-bg)";
651
+ var p;
652
+ return (p = r.payload) != null && p.fold && r.children ? s(r) : "var(--markmap-circle-open-bg)";
649
653
  }
650
- ), N = this._observer, I = S.selectAll(k("foreignObject")).data(
654
+ ), W = this._observer, I = S.selectAll(k("foreignObject")).data(
651
655
  (r) => [r],
652
656
  (r) => r.state.key
653
657
  ), _ = I.enter().append("foreignObject").attr("class", "markmap-foreign").attr("x", i).attr("y", 0).style("opacity", 0).on("mousedown", T).on("dblclick", T);
654
658
  _.append("xhtml:div").append("xhtml:div").html((r) => r.content).attr("xmlns", "http://www.w3.org/1999/xhtml"), _.each(function() {
655
- var d;
656
- const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
657
- N.observe(r);
659
+ var p;
660
+ const r = (p = this.firstChild) == null ? void 0 : p.firstChild;
661
+ W.observe(r);
658
662
  });
659
663
  const P = C.selectAll(
660
664
  k("foreignObject")
661
665
  );
662
666
  P.each(function() {
663
- var d;
664
- const r = (d = this.firstChild) == null ? void 0 : d.firstChild;
665
- N.unobserve(r);
667
+ var p;
668
+ const r = (p = this.firstChild) == null ? void 0 : p.firstChild;
669
+ W.unobserve(r);
666
670
  });
667
- const W = _.merge(I), it = p.flatMap(
671
+ const K = _.merge(I), st = d.flatMap(
668
672
  (r) => {
669
- var d;
670
- return (d = r.payload) != null && d.fold ? [] : r.children.map((x) => ({ source: r, target: x }));
673
+ var p;
674
+ return (p = r.payload) != null && p.fold ? [] : r.children.map((f) => ({ source: r, target: f }));
671
675
  }
672
- ), M = this.g.selectAll(k(de)).data(it, (r) => r.target.state.key), st = M.exit(), ot = M.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (r) => r.target.state.depth).attr("data-path", (r) => r.target.state.path).attr("d", (r) => {
673
- const d = m(r.target), x = [
674
- d.x + d.width,
675
- d.y + d.height
676
+ ), O = this.g.selectAll(k(pe)).data(st, (r) => r.target.state.key), ot = O.exit(), at = O.enter().insert("path", "g").attr("class", "markmap-link").attr("data-depth", (r) => r.target.state.depth).attr("data-path", (r) => r.target.state.path).attr("d", (r) => {
677
+ const p = x(r.target), f = [
678
+ p.x + p.width,
679
+ p.y + p.height
676
680
  ];
677
- return A({ source: x, target: x });
678
- }).attr("stroke-width", 0).merge(M);
681
+ return A({ source: f, target: f });
682
+ }).attr("stroke-width", 0).merge(O);
679
683
  this.svg.style(
680
684
  "--markmap-max-width",
681
685
  a ? `${a}px` : null
682
- ), await new Promise(requestAnimationFrame), this._relayout(), b = b.data(f ? [this._getHighlightRect(f)] : []).join("rect"), this.transition(b).attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height), w.attr("transform", (r) => {
683
- const d = m(r);
684
- return `translate(${d.x + d.width - r.state.rect.width},${d.y + d.height - r.state.rect.height})`;
686
+ ), await new Promise(requestAnimationFrame), this._relayout(), b = b.data(v ? [this._getHighlightRect(v)] : []).join("rect"), this.transition(b).attr("x", (r) => r.x).attr("y", (r) => r.y).attr("width", (r) => r.width).attr("height", (r) => r.height), B.attr("transform", (r) => {
687
+ const p = x(r);
688
+ return `translate(${p.x + p.width - r.state.rect.width},${p.y + p.height - r.state.rect.height})`;
685
689
  }), this.transition(C).attr("transform", (r) => {
686
- const d = y(r), x = d.x + d.width - r.state.rect.width, E = d.y + d.height - r.state.rect.height;
687
- return `translate(${x},${E})`;
690
+ const p = y(r), f = p.x + p.width - r.state.rect.width, E = p.y + p.height - r.state.rect.height;
691
+ return `translate(${f},${E})`;
688
692
  }).remove(), this.transition(S).attr(
689
693
  "transform",
690
694
  (r) => `translate(${r.state.rect.x},${r.state.rect.y})`
691
695
  );
692
- const at = C.selectAll(
696
+ const lt = C.selectAll(
693
697
  k("line")
694
698
  );
695
- this.transition(at).attr("x1", (r) => r.state.rect.width).attr("stroke-width", 0), L.attr("x1", (r) => r.state.rect.width).attr("x2", (r) => r.state.rect.width), D.attr("y1", (r) => r.state.rect.height).attr("y2", (r) => r.state.rect.height), this.transition(D).attr("x1", -1).attr("x2", (r) => r.state.rect.width + 2).attr("stroke", (r) => o(r)).attr("stroke-width", V);
696
- const lt = C.selectAll(
699
+ this.transition(lt).attr("x1", (r) => r.state.rect.width).attr("stroke-width", 0), L.attr("x1", (r) => r.state.rect.width).attr("x2", (r) => r.state.rect.width), D.attr("y1", (r) => r.state.rect.height + c(r) / 2).attr("y2", (r) => r.state.rect.height + c(r) / 2), this.transition(D).attr("x1", -1).attr("x2", (r) => r.state.rect.width + 2).attr("stroke", (r) => s(r)).attr("stroke-width", c);
700
+ const ct = C.selectAll(
697
701
  k("circle")
698
702
  );
699
- this.transition(lt).attr("r", 0).attr("stroke-width", 0), $.attr("cx", (r) => r.state.rect.width).attr("cy", (r) => r.state.rect.height), this.transition($).attr("r", 6).attr("stroke-width", "1.5"), this.transition(P).style("opacity", 0), W.attr("width", (r) => Math.max(0, r.state.rect.width - i * 2)).attr("height", (r) => r.state.rect.height), this.transition(W).style("opacity", 1), this.transition(st).attr("d", (r) => {
700
- const d = y(r.target), x = [
701
- d.x + d.width,
702
- d.y + d.height
703
+ this.transition(ct).attr("r", 0).attr("stroke-width", 0), N.attr("cx", (r) => r.state.rect.width).attr("cy", (r) => r.state.rect.height + c(r) / 2), this.transition(N).attr("r", 6).attr("stroke-width", "1.5"), this.transition(P).style("opacity", 0), K.attr("width", (r) => Math.max(0, r.state.rect.width - i * 2)).attr("height", (r) => r.state.rect.height), this.transition(K).style("opacity", 1), this.transition(ot).attr("d", (r) => {
704
+ const p = y(r.target), f = [
705
+ p.x + p.width,
706
+ p.y + p.height + c(r.target) / 2
703
707
  ];
704
- return A({ source: x, target: x });
705
- }).attr("stroke-width", 0).remove(), this.transition(ot).attr("stroke", (r) => o(r.target)).attr("stroke-width", (r) => V(r.target)).attr("d", (r) => {
706
- const d = r.source, x = r.target, E = [
707
- d.state.rect.x + d.state.rect.width,
708
- d.state.rect.y + d.state.rect.height
709
- ], ct = [
710
- x.state.rect.x,
711
- x.state.rect.y + x.state.rect.height
708
+ return A({ source: f, target: f });
709
+ }).attr("stroke-width", 0).remove(), this.transition(at).attr("stroke", (r) => s(r.target)).attr("stroke-width", (r) => c(r.target)).attr("d", (r) => {
710
+ const p = r.source, f = r.target, E = [
711
+ p.state.rect.x + p.state.rect.width,
712
+ p.state.rect.y + p.state.rect.height + c(p) / 2
713
+ ], ht = [
714
+ f.state.rect.x,
715
+ f.state.rect.y + f.state.rect.height + c(f) / 2
712
716
  ];
713
- return A({ source: E, target: ct });
717
+ return A({ source: E, target: ht });
714
718
  }), n && this.fit();
715
719
  }
716
720
  transition(t) {
@@ -721,21 +725,21 @@ class nt {
721
725
  * Fit the content to the viewport.
722
726
  */
723
727
  async fit(t = this.options.maxInitialScale) {
724
- const i = this.svg.node(), { width: n, height: o } = i.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: l, y1: s, x2: c, y2: p } = this.state.rect, h = c - l, u = p - s, g = Math.min(
725
- n / h * a,
726
- o / u * a,
728
+ const i = this.svg.node(), { width: n, height: s } = i.getBoundingClientRect(), { fitRatio: a } = this.options, { x1: c, y1: o, x2: l, y2: h } = this.state.rect, d = l - c, g = h - o, u = Math.min(
729
+ n / d * a,
730
+ s / g * a,
727
731
  t
728
- ), m = yt.translate(
729
- (n - h * g) / 2 - l * g,
730
- (o - u * g) / 2 - s * g
731
- ).scale(g);
732
+ ), m = kt.translate(
733
+ (n - d * u) / 2 - c * u,
734
+ (s - g * u) / 2 - o * u
735
+ ).scale(u);
732
736
  return this.transition(this.svg).call(this.zoom.transform, m).end().catch(X);
733
737
  }
734
738
  findElement(t) {
735
739
  let i;
736
- return this.g.selectAll(k(O)).each(function(o) {
737
- o === t && (i = {
738
- data: o,
740
+ return this.g.selectAll(k(M)).each(function(s) {
741
+ s === t && (i = {
742
+ data: s,
739
743
  g: this
740
744
  });
741
745
  }), i;
@@ -744,52 +748,52 @@ class nt {
744
748
  * Pan the content to make the provided node visible in the viewport.
745
749
  */
746
750
  async ensureVisible(t, i) {
747
- var b;
748
- const n = (b = this.findElement(t)) == null ? void 0 : b.data;
751
+ var v;
752
+ const n = (v = this.findElement(t)) == null ? void 0 : v.data;
749
753
  if (!n) return;
750
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = z(o), [s, c] = [
754
+ const s = this.svg.node(), a = s.getBoundingClientRect(), c = w(s), [o, l] = [
751
755
  n.state.rect.x,
752
756
  n.state.rect.x + n.state.rect.width + 2
753
- ].map((v) => v * l.k + l.x), [p, h] = [
757
+ ].map((b) => b * c.k + c.x), [h, d] = [
754
758
  n.state.rect.y,
755
759
  n.state.rect.y + n.state.rect.height
756
- ].map((v) => v * l.k + l.y), u = {
760
+ ].map((b) => b * c.k + c.y), g = {
757
761
  left: 0,
758
762
  right: 0,
759
763
  top: 0,
760
764
  bottom: 0,
761
765
  ...i
762
- }, g = [u.left - s, a.width - u.right - c], m = [u.top - p, a.height - u.bottom - h], y = g[0] * g[1] > 0 ? U(g, Math.abs) / l.k : 0, f = m[0] * m[1] > 0 ? U(m, Math.abs) / l.k : 0;
763
- if (y || f) {
764
- const v = l.translate(y, f);
765
- return this.transition(this.svg).call(this.zoom.transform, v).end().catch(X);
766
+ }, u = [g.left - o, a.width - g.right - l], m = [g.top - h, a.height - g.bottom - d], x = u[0] * u[1] > 0 ? U(u, Math.abs) / c.k : 0, y = m[0] * m[1] > 0 ? U(m, Math.abs) / c.k : 0;
767
+ if (x || y) {
768
+ const b = c.translate(x, y);
769
+ return this.transition(this.svg).call(this.zoom.transform, b).end().catch(X);
766
770
  }
767
771
  }
768
772
  async centerNode(t, i) {
769
- var y;
770
- const n = (y = this.findElement(t)) == null ? void 0 : y.data;
773
+ var x;
774
+ const n = (x = this.findElement(t)) == null ? void 0 : x.data;
771
775
  if (!n) return;
772
- const o = this.svg.node(), a = o.getBoundingClientRect(), l = z(o), s = (n.state.rect.x + n.state.rect.width / 2) * l.k + l.x, c = (n.state.rect.y + n.state.rect.height / 2) * l.k + l.y, p = {
776
+ const s = this.svg.node(), a = s.getBoundingClientRect(), c = w(s), o = (n.state.rect.x + n.state.rect.width / 2) * c.k + c.x, l = (n.state.rect.y + n.state.rect.height / 2) * c.k + c.y, h = {
773
777
  left: 0,
774
778
  right: 0,
775
779
  top: 0,
776
780
  bottom: 0,
777
781
  ...i
778
- }, h = (p.left + a.width - p.right) / 2, u = (p.top + a.height - p.bottom) / 2, g = (h - s) / l.k, m = (u - c) / l.k;
779
- if (g || m) {
780
- const f = l.translate(g, m);
781
- return this.transition(this.svg).call(this.zoom.transform, f).end().catch(X);
782
+ }, d = (h.left + a.width - h.right) / 2, g = (h.top + a.height - h.bottom) / 2, u = (d - o) / c.k, m = (g - l) / c.k;
783
+ if (u || m) {
784
+ const y = c.translate(u, m);
785
+ return this.transition(this.svg).call(this.zoom.transform, y).end().catch(X);
782
786
  }
783
787
  }
784
788
  /**
785
789
  * Scale content with it pinned at the center of the viewport.
786
790
  */
787
791
  async rescale(t) {
788
- const i = this.svg.node(), { width: n, height: o } = i.getBoundingClientRect(), a = n / 2, l = o / 2, s = z(i), c = s.translate(
789
- (a - s.x) * (1 - t) / s.k,
790
- (l - s.y) * (1 - t) / s.k
792
+ const i = this.svg.node(), { width: n, height: s } = i.getBoundingClientRect(), a = n / 2, c = s / 2, o = w(i), l = o.translate(
793
+ (a - o.x) * (1 - t) / o.k,
794
+ (c - o.y) * (1 - t) / o.k
791
795
  ).scale(t);
792
- return this.transition(this.svg).call(this.zoom.transform, c).end().catch(X);
796
+ return this.transition(this.svg).call(this.zoom.transform, l).end().catch(X);
793
797
  }
794
798
  destroy() {
795
799
  this.svg.on(".zoom", null), this.svg.html(null), this._disposeList.forEach((t) => {
@@ -797,22 +801,23 @@ class nt {
797
801
  });
798
802
  }
799
803
  static create(t, i, n = null) {
800
- const o = new nt(t, i);
801
- return n && o.setData(n).then(() => {
802
- o.fit();
803
- }), o;
804
+ const s = new it(t, i);
805
+ return n && s.setData(n).then(() => {
806
+ s.fit();
807
+ }), s;
804
808
  }
805
809
  }
806
810
  export {
807
- nt as Markmap,
811
+ it as Markmap,
808
812
  k as childSelector,
809
- vt as defaultColorFn,
810
- q as defaultOptions,
811
- ye as deriveOptions,
812
- ke as globalCSS,
813
+ bt as defaultColorFn,
814
+ J as defaultOptions,
815
+ ke as deriveOptions,
816
+ ve as globalCSS,
813
817
  Z as isMacintosh,
814
- Ee as loadCSS,
815
- ze as loadJS,
818
+ q as lineWidthFactory,
819
+ ze as loadCSS,
820
+ we as loadJS,
816
821
  ue as refreshHook,
817
- bt as simpleHash
822
+ Et as simpleHash
818
823
  };