@wsxjs/wsx-press 0.0.24 → 0.0.26

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/client.js CHANGED
@@ -1,83 +1,83 @@
1
- import { autoRegister as oe, LightComponent as X, jsx as x } from "@wsxjs/wsx-core";
2
- import { c as ne } from "./index-RqS0LFTH.js";
1
+ import { autoRegister as oe, LightComponent as X, jsx as C } from "@wsxjs/wsx-core";
2
+ import { c as ne } from "./index-CHILmtM0.js";
3
3
  import "@wsxjs/wsx-marked-components";
4
4
  import { RouterUtils as ie } from "@wsxjs/wsx-router";
5
5
  import { DocumentLoadError as te } from "./index.js";
6
6
  import le from "fuse.js";
7
7
  const de = ".wsx-doc-page{display:flex;flex-direction:column;min-height:100%}.doc-page{flex:1;padding:var(--doc-page-padding-y, 1rem) var(--doc-page-padding-x, 2rem);max-width:1200px;margin:0 auto;width:100%}.doc-loading,.doc-empty{text-align:center;padding:3rem;color:var(--wsx-press-text-secondary, #666)}.doc-error{padding:2rem;background:var(--wsx-press-error-bg, #fee);border:1px solid var(--wsx-press-error-border, #fcc);border-radius:4px;color:var(--wsx-press-error-text, #c33)}.doc-error h2{margin-top:0;color:var(--wsx-press-error-title, #a00)}.doc-header{margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid var(--wsx-press-border, #ddd)}.doc-title{margin:0 0 .5rem;font-size:2rem;font-weight:600;color:var(--wsx-press-text-primary, #333)}.doc-description{margin:0;color:var(--wsx-press-text-secondary, #666);font-size:1.1rem}.doc-content{line-height:1.6}";
8
- var we;
9
- let Ce, Se;
10
- function J(t, e, r) {
11
- return (e = ke(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
8
+ var Ce;
9
+ let Se, ke;
10
+ function G(t, e, r) {
11
+ return (e = Ee(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
12
12
  }
13
- function Ue(t, e, r, n, u, C) {
14
- function g(i, c, d) {
15
- return function(o, a) {
16
- return d && d(o), i[c].call(o, a);
13
+ function Ue(t, e, r, d, o, x) {
14
+ function u(i, c, h) {
15
+ return function(a, n) {
16
+ return h && h(a), i[c].call(a, n);
17
17
  };
18
18
  }
19
19
  function w(i, c) {
20
- for (var d = 0; d < i.length; d++) i[d].call(c);
20
+ for (var h = 0; h < i.length; h++) i[h].call(c);
21
21
  return c;
22
22
  }
23
- function y(i, c, d, o) {
24
- if (typeof i != "function" && (o || i !== void 0)) throw new TypeError(c + " must " + (d || "be") + " a function" + (o ? "" : " or undefined"));
23
+ function y(i, c, h, a) {
24
+ if (typeof i != "function" && (a || i !== void 0)) throw new TypeError(c + " must " + (h || "be") + " a function" + (a ? "" : " or undefined"));
25
25
  return i;
26
26
  }
27
- function N(i, c, d, o, a, L, $, O, z, S, v, m, p) {
27
+ function H(i, c, h, a, n, L, $, O, z, S, v, m, p) {
28
28
  function k(l) {
29
29
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
30
30
  }
31
- var h, D = c[0], E = c[3], T = !O;
31
+ var f, E = c[0], D = c[3], T = !O;
32
32
  if (!T) {
33
- d || Array.isArray(D) || (D = [D]);
34
- var s = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
33
+ h || Array.isArray(E) || (E = [E]);
34
+ var s = {}, _ = [], b = n === 3 ? "get" : n === 4 || m ? "set" : "value";
35
35
  S ? (v || m ? s = { get: ue(function() {
36
- return E(this);
37
- }, o, "get"), set: function(l) {
36
+ return D(this);
37
+ }, a, "get"), set: function(l) {
38
38
  c[4](this, l);
39
- } } : s[b] = E, v || ue(s[b], o, a === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, o));
39
+ } } : s[b] = D, v || ue(s[b], a, n === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, a));
40
40
  }
41
- for (var f = i, q = D.length - 1; q >= 0; q -= d ? 2 : 1) {
42
- var H = D[q], K = d ? D[q - 1] : void 0, W = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: o, metadata: L, addInitializer: (function(l, I) {
41
+ for (var g = i, q = E.length - 1; q >= 0; q -= h ? 2 : 1) {
42
+ var U = E[q], K = h ? E[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][n], name: a, metadata: L, addInitializer: (function(l, I) {
43
43
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
44
44
  y(I, "An initializer", "be", !0), $.push(I);
45
- }).bind(null, W) };
45
+ }).bind(null, B) };
46
46
  try {
47
- if (T) (h = y(H.call(K, f, R), "class decorators", "return")) && (f = h);
47
+ if (T) (f = y(U.call(K, g, R), "class decorators", "return")) && (g = f);
48
48
  else {
49
49
  var A, F;
50
- R.static = z, R.private = S, S ? a === 2 ? A = function(l) {
50
+ R.static = z, R.private = S, S ? n === 2 ? A = function(l) {
51
51
  return k(l), s.value;
52
- } : (a < 4 && (A = g(s, "get", k)), a !== 3 && (F = g(s, "set", k))) : (A = function(l) {
53
- return l[o];
54
- }, (a < 2 || a === 4) && (F = function(l, I) {
55
- l[o] = I;
52
+ } : (n < 4 && (A = u(s, "get", k)), n !== 3 && (F = u(s, "set", k))) : (A = function(l) {
53
+ return l[a];
54
+ }, (n < 2 || n === 4) && (F = function(l, I) {
55
+ l[a] = I;
56
56
  }));
57
- var B = R.access = { has: S ? p.bind() : function(l) {
58
- return o in l;
57
+ var W = R.access = { has: S ? p.bind() : function(l) {
58
+ return a in l;
59
59
  } };
60
- if (A && (B.get = A), F && (B.set = F), f = H.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
61
- if (typeof f == "object" && f) (h = y(f.get, "accessor.get")) && (s.get = h), (h = y(f.set, "accessor.set")) && (s.set = h), (h = y(f.init, "accessor.init")) && _.push(h);
62
- else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
63
- } else y(f, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(f) : s[b] = f);
60
+ if (A && (W.get = A), F && (W.set = F), g = U.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
61
+ if (typeof g == "object" && g) (f = y(g.get, "accessor.get")) && (s.get = f), (f = y(g.set, "accessor.set")) && (s.set = f), (f = y(g.init, "accessor.init")) && _.push(f);
62
+ else if (g !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
63
+ } else y(g, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(g) : s[b] = g);
64
64
  }
65
65
  } finally {
66
- W.v = !0;
66
+ B.v = !0;
67
67
  }
68
68
  }
69
69
  return (v || m) && O.push(function(l, I) {
70
- for (var M = _.length - 1; M >= 0; M--) I = _[M].call(l, I);
70
+ for (var N = _.length - 1; N >= 0; N--) I = _[N].call(l, I);
71
71
  return I;
72
- }), v || T || (S ? m ? O.push(g(s, "get"), g(s, "set")) : O.push(a === 2 ? s[b] : g.call.bind(s[b])) : Object.defineProperty(i, o, s)), f;
72
+ }), v || T || (S ? m ? O.push(u(s, "get"), u(s, "set")) : O.push(n === 2 ? s[b] : u.call.bind(s[b])) : Object.defineProperty(i, a, s)), g;
73
73
  }
74
74
  function j(i, c) {
75
75
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
76
76
  }
77
- if (arguments.length >= 6) var U = C[Symbol.metadata || Symbol.for("Symbol.metadata")];
78
- var P = Object.create(U ?? null), Z = function(i, c, d, o) {
79
- var a, L, $ = [], O = function(b) {
80
- return Ke(b) === i;
77
+ if (arguments.length >= 6) var M = x[Symbol.metadata || Symbol.for("Symbol.metadata")];
78
+ var P = Object.create(M ?? null), Z = function(i, c, h, a) {
79
+ var n, L, $ = [], O = function(b) {
80
+ return Be(b) === i;
81
81
  }, z = /* @__PURE__ */ new Map();
82
82
  function S(b) {
83
83
  b && $.push(w.bind(null, b));
@@ -85,32 +85,32 @@ function Ue(t, e, r, n, u, C) {
85
85
  for (var v = 0; v < c.length; v++) {
86
86
  var m = c[v];
87
87
  if (Array.isArray(m)) {
88
- var p = m[1], k = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + E;
89
- if (!T && !h) {
88
+ var p = m[1], k = m[2], f = m.length > 3, E = 16 & p, D = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + D;
89
+ if (!T && !f) {
90
90
  var _ = z.get(s);
91
91
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + k);
92
92
  z.set(s, !(p > 2) || p);
93
93
  }
94
- N(E ? i : i.prototype, m, D, h ? "#" + k : ke(k), p, o, E ? L = L || [] : a = a || [], $, E, h, T, p === 1, E && h ? O : d);
94
+ H(D ? i : i.prototype, m, E, f ? "#" + k : Ee(k), p, a, D ? L = L || [] : n = n || [], $, D, f, T, p === 1, D && f ? O : h);
95
95
  }
96
96
  }
97
- return S(a), S(L), $;
98
- }(t, e, u, P);
97
+ return S(n), S(L), $;
98
+ }(t, e, o, P);
99
99
  return r.length || j(t, P), { e: Z, get c() {
100
100
  var i = [];
101
- return r.length && [j(N(t, [r], n, t.name, 5, P, i), P), w.bind(null, i, t)];
101
+ return r.length && [j(H(t, [r], d, t.name, 5, P, i), P), w.bind(null, i, t)];
102
102
  } };
103
103
  }
104
- function ke(t) {
105
- var e = He(t, "string");
104
+ function Ee(t) {
105
+ var e = Ke(t, "string");
106
106
  return typeof e == "symbol" ? e : e + "";
107
107
  }
108
- function He(t, e) {
108
+ function Ke(t, e) {
109
109
  if (typeof t != "object" || !t) return t;
110
110
  var r = t[Symbol.toPrimitive];
111
111
  if (r !== void 0) {
112
- var n = r.call(t, e);
113
- if (typeof n != "object") return n;
112
+ var d = r.call(t, e);
113
+ if (typeof d != "object") return d;
114
114
  throw new TypeError("@@toPrimitive must return a primitive value.");
115
115
  }
116
116
  return String(t);
@@ -123,64 +123,66 @@ function ue(t, e, r) {
123
123
  }
124
124
  return t;
125
125
  }
126
- function Ke(t) {
126
+ function Be(t) {
127
127
  if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
128
128
  return t;
129
129
  }
130
- const Y = ne("DocPage"), G = {
130
+ const Y = ne("DocPage"), J = {
131
131
  data: null,
132
132
  promise: null
133
133
  };
134
134
  async function De(t, e = {}, r = 1e4) {
135
- var g;
136
- const n = new AbortController(), u = setTimeout(() => n.abort(), r);
137
- let C;
135
+ var u;
136
+ const d = new AbortController(), o = setTimeout(() => d.abort(), r);
137
+ let x;
138
138
  if (e.signal) {
139
139
  const w = new AbortController();
140
140
  e.signal.aborted ? w.abort() : e.signal.addEventListener("abort", () => {
141
141
  w.abort();
142
- }), n.signal.addEventListener("abort", () => {
142
+ }), d.signal.addEventListener("abort", () => {
143
143
  w.abort();
144
- }), C = w.signal;
144
+ }), x = w.signal;
145
145
  } else
146
- C = n.signal;
146
+ x = d.signal;
147
147
  try {
148
148
  const w = await fetch(t, {
149
149
  ...e,
150
- signal: C
150
+ signal: x
151
151
  });
152
- return clearTimeout(u), w;
152
+ return clearTimeout(o), w;
153
153
  } catch (w) {
154
- if (clearTimeout(u), w instanceof Error && w.name === "AbortError") {
155
- const y = n.signal.aborted;
156
- throw ((g = e.signal) == null ? void 0 : g.aborted) ? new Error("Request was cancelled") : y ? new Error(`Request timeout after ${r}ms`) : new Error("Request was aborted");
154
+ if (clearTimeout(o), w instanceof Error && w.name === "AbortError") {
155
+ const y = d.signal.aborted;
156
+ throw ((u = e.signal) == null ? void 0 : u.aborted) ? new Error("Request was cancelled") : y ? new Error(`Request timeout after ${r}ms`) : new Error("Request was aborted");
157
157
  }
158
158
  throw w;
159
159
  }
160
160
  }
161
161
  async function We() {
162
- return G.data ? G.data : (G.promise || (G.promise = (async () => {
162
+ return J.data ? J.data : (J.promise || (J.promise = (async () => {
163
163
  try {
164
164
  const t = await De("/.wsx-press/docs-meta.json", {}, 5e3);
165
165
  if (!t.ok)
166
166
  throw new Error(`Failed to load metadata: ${t.statusText}`);
167
167
  const e = await t.json();
168
- return G.data = e, G.promise = null, e;
168
+ return J.data = e, J.promise = null, e;
169
169
  } catch (t) {
170
- throw G.promise = null, t;
170
+ throw J.promise = null, t;
171
171
  }
172
- })()), G.promise);
172
+ })()), J.promise);
173
173
  }
174
- Se = [oe({
174
+ ke = [oe({
175
175
  tagName: "wsx-doc-page"
176
176
  })];
177
- let Be;
178
- class Ye extends X {
177
+ let Ye;
178
+ class Ge extends X {
179
179
  constructor() {
180
180
  super({
181
181
  styles: de,
182
182
  styleName: "wsx-doc-page"
183
- }), J(this, "_autoStyles", de), J(this, "loadingState", void 0), J(this, "markdown", void 0), J(this, "metadata", void 0), J(this, "error", void 0), J(this, "currentLoadingPath", null), J(this, "routeChangeUnsubscribe", null), J(this, "loadingAbortController", null), J(this, "isLoading", !1), J(this, "visibilityChangeHandler", null), Y.debug("DocPage initialized");
183
+ }), G(this, "_autoStyles", de), G(this, "loadingState", void 0), G(this, "markdown", void 0), G(this, "metadata", void 0), G(this, "error", void 0), G(this, "currentLoadingPath", null), G(this, "routeChangeUnsubscribe", null), G(this, "loadingAbortController", null), G(this, "isLoading", !1), G(this, "visibilityChangeHandler", null), G(this, "onHashChange", () => {
184
+ this.scrollToHash();
185
+ }), Y.debug("DocPage initialized");
184
186
  const [e, r] = this.useState("loadingState", "idle");
185
187
  Object.defineProperty(this, "loadingState", {
186
188
  get: e,
@@ -188,17 +190,17 @@ class Ye extends X {
188
190
  enumerable: !0,
189
191
  configurable: !0
190
192
  });
191
- const [n, u] = this.useState("markdown", "");
193
+ const [d, o] = this.useState("markdown", "");
192
194
  Object.defineProperty(this, "markdown", {
193
- get: n,
194
- set: u,
195
+ get: d,
196
+ set: o,
195
197
  enumerable: !0,
196
198
  configurable: !0
197
199
  });
198
- const [C, g] = this.useState("metadata", null);
200
+ const [x, u] = this.useState("metadata", null);
199
201
  Object.defineProperty(this, "metadata", {
200
- get: C,
201
- set: g,
202
+ get: x,
203
+ set: u,
202
204
  enumerable: !0,
203
205
  configurable: !0
204
206
  });
@@ -220,11 +222,11 @@ class Ye extends X {
220
222
  requestAnimationFrame(() => {
221
223
  this.loadDocument();
222
224
  });
223
- });
225
+ }), window.addEventListener("hashchange", this.onHashChange);
224
226
  }
225
227
  onDisconnected() {
226
228
  var e;
227
- (e = super.onDisconnected) == null || e.call(this), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null), this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null), this.cancelLoading();
229
+ (e = super.onDisconnected) == null || e.call(this), this.routeChangeUnsubscribe && (this.routeChangeUnsubscribe(), this.routeChangeUnsubscribe = null), this.visibilityChangeHandler && (document.removeEventListener("visibilitychange", this.visibilityChangeHandler), this.visibilityChangeHandler = null), window.removeEventListener("hashchange", this.onHashChange), this.cancelLoading();
228
230
  }
229
231
  /**
230
232
  * 取消正在进行的加载请求
@@ -232,14 +234,14 @@ class Ye extends X {
232
234
  cancelLoading() {
233
235
  this.loadingAbortController && (this.loadingAbortController.abort(), this.loadingAbortController = null), this.isLoading = !1, this.loadingState === "loading" && (this.loadingState = "idle"), this.currentLoadingPath = null;
234
236
  }
235
- onAttributeChanged(e, r, n) {
237
+ onAttributeChanged(e, r, d) {
236
238
  e === "params" && this.loadDocument();
237
239
  }
238
240
  /**
239
241
  * 创建带超时的 fetch 请求(实例方法)
240
242
  */
241
- async fetchWithTimeout(e, r = {}, n = 1e4) {
242
- return De(e, r, n);
243
+ async fetchWithTimeout(e, r = {}, d = 1e4) {
244
+ return De(e, r, d);
243
245
  }
244
246
  /**
245
247
  * 从 RouterUtils 获取当前路由参数并加载文档
@@ -275,13 +277,13 @@ class Ye extends X {
275
277
  return;
276
278
  }
277
279
  this.currentLoadingPath = r, this.isLoading = !0, this.loadingState = "loading", this.markdown = "", this.error = null, this.metadata = null;
278
- const n = await We();
280
+ const d = await We();
279
281
  if (this.currentLoadingPath !== r || this.loadingAbortController.signal.aborted) {
280
282
  Y.debug(`Document switched after metadata, ignoring result for ${r}`), this.isLoading = !1, this.loadingState = "idle";
281
283
  return;
282
284
  }
283
- const u = n[r];
284
- if (!u) {
285
+ const o = d[r];
286
+ if (!o) {
285
287
  if (this.currentLoadingPath !== r || this.loadingAbortController.signal.aborted) {
286
288
  this.isLoading = !1, this.loadingState = "idle";
287
289
  return;
@@ -289,21 +291,21 @@ class Ye extends X {
289
291
  this.loadingState = "error", this.error = new te(`Document not found: ${r}`, "NOT_FOUND"), this.isLoading = !1;
290
292
  return;
291
293
  }
292
- this.metadata = u;
293
- const C = `/docs/${r}.md`, g = await this.fetchWithTimeout(C, {
294
+ this.metadata = o;
295
+ const x = `/docs/${r}.md`, u = await this.fetchWithTimeout(x, {
294
296
  signal: this.loadingAbortController.signal
295
297
  }, 1e4);
296
298
  if (this.currentLoadingPath !== r || this.loadingAbortController.signal.aborted) {
297
299
  Y.debug(`Document switched during fetch, ignoring result for ${r}`), this.isLoading = !1, this.loadingState = "idle";
298
300
  return;
299
301
  }
300
- if (!g.ok) {
301
- g.status === 404 ? (this.loadingState = "error", this.error = new te(`Document file not found: ${C}`, "NOT_FOUND")) : (this.loadingState = "error", this.error = new te(`Failed to load document: ${g.statusText}`, "NETWORK_ERROR", {
302
- status: g.status
302
+ if (!u.ok) {
303
+ u.status === 404 ? (this.loadingState = "error", this.error = new te(`Document file not found: ${x}`, "NOT_FOUND")) : (this.loadingState = "error", this.error = new te(`Failed to load document: ${u.statusText}`, "NETWORK_ERROR", {
304
+ status: u.status
303
305
  })), this.isLoading = !1;
304
306
  return;
305
307
  }
306
- const w = await g.text();
308
+ const w = await u.text();
307
309
  if (this.currentLoadingPath !== r || this.loadingAbortController.signal.aborted) {
308
310
  Y.debug(`Document switched after fetch, ignoring result for ${r}`), this.isLoading = !1, this.loadingState = "idle";
309
311
  return;
@@ -334,88 +336,108 @@ class Ye extends X {
334
336
  });
335
337
  }
336
338
  }
339
+ /**
340
+ * Scroll to the element matching the current hash
341
+ * 使用重试机制处理异步渲染的内容
342
+ */
343
+ scrollToHash(e = 0) {
344
+ const o = window.location.hash;
345
+ if (!o) return;
346
+ const x = decodeURIComponent(o.slice(1));
347
+ if (!x) return;
348
+ const u = document.getElementById(x);
349
+ u ? (u.scrollIntoView({
350
+ behavior: "smooth",
351
+ block: "start"
352
+ }), Y.debug(`Scrolled to anchor: ${x}`)) : e < 5 ? setTimeout(() => {
353
+ this.scrollToHash(e + 1);
354
+ }, 100) : Y.warn(`Anchor element not found after 5 retries: ${x}`);
355
+ }
356
+ updated() {
357
+ this.loadingState === "success" && requestAnimationFrame(() => this.scrollToHash());
358
+ }
337
359
  render() {
338
360
  var e, r;
339
- return this.loadingState === "loading" ? /* @__PURE__ */ x("div", { class: "doc-page" }, /* @__PURE__ */ x("div", { class: "doc-loading" }, "加载文档中...")) : this.loadingState === "error" ? /* @__PURE__ */ x("div", { class: "doc-page" }, /* @__PURE__ */ x("div", { class: "doc-error" }, /* @__PURE__ */ x("h2", null, "加载失败"), /* @__PURE__ */ x("p", null, ((e = this.error) == null ? void 0 : e.message) || "未知错误"), ((r = this.error) == null ? void 0 : r.code) === "NOT_FOUND" && /* @__PURE__ */ x("p", null, "文档不存在,请检查路径是否正确。"))) : this.loadingState === "success" && this.markdown ? /* @__PURE__ */ x("div", { class: "doc-page" }, this.metadata && /* @__PURE__ */ x("div", { class: "doc-header" }, /* @__PURE__ */ x("h1", { class: "doc-title" }, this.metadata.title), this.metadata.description && /* @__PURE__ */ x("p", { class: "doc-description" }, this.metadata.description)), /* @__PURE__ */ x("div", { class: "doc-content" }, /* @__PURE__ */ x("wsx-markdown", { markdown: this.markdown }))) : /* @__PURE__ */ x("div", { class: "doc-page" }, /* @__PURE__ */ x("div", { class: "doc-empty" }, "请选择文档"));
361
+ return this.loadingState === "loading" ? /* @__PURE__ */ C("div", { class: "doc-page" }, /* @__PURE__ */ C("div", { class: "doc-loading" }, "加载文档中...")) : this.loadingState === "error" ? /* @__PURE__ */ C("div", { class: "doc-page" }, /* @__PURE__ */ C("div", { class: "doc-error" }, /* @__PURE__ */ C("h2", null, "加载失败"), /* @__PURE__ */ C("p", null, ((e = this.error) == null ? void 0 : e.message) || "未知错误"), ((r = this.error) == null ? void 0 : r.code) === "NOT_FOUND" && /* @__PURE__ */ C("p", null, "文档不存在,请检查路径是否正确。"))) : this.loadingState === "success" && this.markdown ? /* @__PURE__ */ C("div", { class: "doc-page" }, this.metadata && /* @__PURE__ */ C("div", { class: "doc-header" }, /* @__PURE__ */ C("h1", { class: "doc-title" }, this.metadata.title), this.metadata.description && /* @__PURE__ */ C("p", { class: "doc-description" }, this.metadata.description)), /* @__PURE__ */ C("div", { class: "doc-content" }, /* @__PURE__ */ C("wsx-markdown", { markdown: this.markdown }))) : /* @__PURE__ */ C("div", { class: "doc-page" }, /* @__PURE__ */ C("div", { class: "doc-empty" }, "请选择文档"));
340
362
  }
341
363
  }
342
- we = Ye;
343
- [Be, Ce] = Ue(we, [], Se, 0, void 0, X).c;
344
- Ce();
364
+ Ce = Ge;
365
+ [Ye, Se] = Ue(Ce, [], ke, 0, void 0, X).c;
366
+ Se();
345
367
  const he = ".wsx-doc-search{position:relative;width:100%;max-width:600px}.search-input-wrapper{position:relative}.search-input{width:100%;padding:.75rem 1rem;font-size:1rem;border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;outline:none;transition:border-color .2s}.search-input:focus{border-color:var(--wsx-press-primary, #007bff);box-shadow:0 0 0 3px var(--wsx-press-primary-alpha, rgba(0, 123, 255, .1))}.search-loading{position:absolute;right:1rem;top:50%;transform:translateY(-50%);color:var(--wsx-press-text-secondary, #666);font-size:.875rem}.search-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;max-height:400px;overflow-y:auto;z-index:1000}.search-result{padding:1rem;border-bottom:1px solid var(--wsx-press-border-light, #f0f0f0);cursor:pointer;transition:background-color .2s}.search-result:last-child{border-bottom:none}.search-result:hover,.search-result.selected{background-color:var(--wsx-press-hover-bg, #f5f5f5)}.result-title{font-weight:600;color:var(--wsx-press-text-primary, #333);margin-bottom:.25rem}.result-title mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.result-category{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);margin-bottom:.5rem}.result-snippet{font-size:.875rem;color:var(--wsx-press-text-secondary, #666);line-height:1.4}.result-snippet mark{background-color:var(--wsx-press-highlight-bg, #ffeb3b);color:var(--wsx-press-highlight-text, #000);padding:0 2px;border-radius:2px}.search-no-results{position:absolute;top:100%;left:0;right:0;margin-top:.5rem;padding:1rem;background:var(--wsx-press-bg, #fff);border:1px solid var(--wsx-press-border, #ddd);border-radius:4px;box-shadow:0 4px 6px #0000001a;text-align:center;color:var(--wsx-press-text-secondary, #666);z-index:1000}";
346
- var Ee;
347
- let _e, Ie;
368
+ var _e;
369
+ let Ie, Oe;
348
370
  function Q(t, e, r) {
349
- return (e = Oe(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
371
+ return (e = Te(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
350
372
  }
351
- function Ge(t, e, r, n, u, C) {
352
- function g(i, c, d) {
353
- return function(o, a) {
354
- return d && d(o), i[c].call(o, a);
373
+ function Je(t, e, r, d, o, x) {
374
+ function u(i, c, h) {
375
+ return function(a, n) {
376
+ return h && h(a), i[c].call(a, n);
355
377
  };
356
378
  }
357
379
  function w(i, c) {
358
- for (var d = 0; d < i.length; d++) i[d].call(c);
380
+ for (var h = 0; h < i.length; h++) i[h].call(c);
359
381
  return c;
360
382
  }
361
- function y(i, c, d, o) {
362
- if (typeof i != "function" && (o || i !== void 0)) throw new TypeError(c + " must " + (d || "be") + " a function" + (o ? "" : " or undefined"));
383
+ function y(i, c, h, a) {
384
+ if (typeof i != "function" && (a || i !== void 0)) throw new TypeError(c + " must " + (h || "be") + " a function" + (a ? "" : " or undefined"));
363
385
  return i;
364
386
  }
365
- function N(i, c, d, o, a, L, $, O, z, S, v, m, p) {
387
+ function H(i, c, h, a, n, L, $, O, z, S, v, m, p) {
366
388
  function k(l) {
367
389
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
368
390
  }
369
- var h, D = c[0], E = c[3], T = !O;
391
+ var f, E = c[0], D = c[3], T = !O;
370
392
  if (!T) {
371
- d || Array.isArray(D) || (D = [D]);
372
- var s = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
393
+ h || Array.isArray(E) || (E = [E]);
394
+ var s = {}, _ = [], b = n === 3 ? "get" : n === 4 || m ? "set" : "value";
373
395
  S ? (v || m ? s = { get: fe(function() {
374
- return E(this);
375
- }, o, "get"), set: function(l) {
396
+ return D(this);
397
+ }, a, "get"), set: function(l) {
376
398
  c[4](this, l);
377
- } } : s[b] = E, v || fe(s[b], o, a === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, o));
399
+ } } : s[b] = D, v || fe(s[b], a, n === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, a));
378
400
  }
379
- for (var f = i, q = D.length - 1; q >= 0; q -= d ? 2 : 1) {
380
- var H = D[q], K = d ? D[q - 1] : void 0, W = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: o, metadata: L, addInitializer: (function(l, I) {
401
+ for (var g = i, q = E.length - 1; q >= 0; q -= h ? 2 : 1) {
402
+ var U = E[q], K = h ? E[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][n], name: a, metadata: L, addInitializer: (function(l, I) {
381
403
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
382
404
  y(I, "An initializer", "be", !0), $.push(I);
383
- }).bind(null, W) };
405
+ }).bind(null, B) };
384
406
  try {
385
- if (T) (h = y(H.call(K, f, R), "class decorators", "return")) && (f = h);
407
+ if (T) (f = y(U.call(K, g, R), "class decorators", "return")) && (g = f);
386
408
  else {
387
409
  var A, F;
388
- R.static = z, R.private = S, S ? a === 2 ? A = function(l) {
410
+ R.static = z, R.private = S, S ? n === 2 ? A = function(l) {
389
411
  return k(l), s.value;
390
- } : (a < 4 && (A = g(s, "get", k)), a !== 3 && (F = g(s, "set", k))) : (A = function(l) {
391
- return l[o];
392
- }, (a < 2 || a === 4) && (F = function(l, I) {
393
- l[o] = I;
412
+ } : (n < 4 && (A = u(s, "get", k)), n !== 3 && (F = u(s, "set", k))) : (A = function(l) {
413
+ return l[a];
414
+ }, (n < 2 || n === 4) && (F = function(l, I) {
415
+ l[a] = I;
394
416
  }));
395
- var B = R.access = { has: S ? p.bind() : function(l) {
396
- return o in l;
417
+ var W = R.access = { has: S ? p.bind() : function(l) {
418
+ return a in l;
397
419
  } };
398
- if (A && (B.get = A), F && (B.set = F), f = H.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
399
- if (typeof f == "object" && f) (h = y(f.get, "accessor.get")) && (s.get = h), (h = y(f.set, "accessor.set")) && (s.set = h), (h = y(f.init, "accessor.init")) && _.push(h);
400
- else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
401
- } else y(f, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(f) : s[b] = f);
420
+ if (A && (W.get = A), F && (W.set = F), g = U.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
421
+ if (typeof g == "object" && g) (f = y(g.get, "accessor.get")) && (s.get = f), (f = y(g.set, "accessor.set")) && (s.set = f), (f = y(g.init, "accessor.init")) && _.push(f);
422
+ else if (g !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
423
+ } else y(g, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(g) : s[b] = g);
402
424
  }
403
425
  } finally {
404
- W.v = !0;
426
+ B.v = !0;
405
427
  }
406
428
  }
407
429
  return (v || m) && O.push(function(l, I) {
408
- for (var M = _.length - 1; M >= 0; M--) I = _[M].call(l, I);
430
+ for (var N = _.length - 1; N >= 0; N--) I = _[N].call(l, I);
409
431
  return I;
410
- }), v || T || (S ? m ? O.push(g(s, "get"), g(s, "set")) : O.push(a === 2 ? s[b] : g.call.bind(s[b])) : Object.defineProperty(i, o, s)), f;
432
+ }), v || T || (S ? m ? O.push(u(s, "get"), u(s, "set")) : O.push(n === 2 ? s[b] : u.call.bind(s[b])) : Object.defineProperty(i, a, s)), g;
411
433
  }
412
434
  function j(i, c) {
413
435
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
414
436
  }
415
- if (arguments.length >= 6) var U = C[Symbol.metadata || Symbol.for("Symbol.metadata")];
416
- var P = Object.create(U ?? null), Z = function(i, c, d, o) {
417
- var a, L, $ = [], O = function(b) {
418
- return Qe(b) === i;
437
+ if (arguments.length >= 6) var M = x[Symbol.metadata || Symbol.for("Symbol.metadata")];
438
+ var P = Object.create(M ?? null), Z = function(i, c, h, a) {
439
+ var n, L, $ = [], O = function(b) {
440
+ return Xe(b) === i;
419
441
  }, z = /* @__PURE__ */ new Map();
420
442
  function S(b) {
421
443
  b && $.push(w.bind(null, b));
@@ -423,32 +445,32 @@ function Ge(t, e, r, n, u, C) {
423
445
  for (var v = 0; v < c.length; v++) {
424
446
  var m = c[v];
425
447
  if (Array.isArray(m)) {
426
- var p = m[1], k = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + E;
427
- if (!T && !h) {
448
+ var p = m[1], k = m[2], f = m.length > 3, E = 16 & p, D = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + D;
449
+ if (!T && !f) {
428
450
  var _ = z.get(s);
429
451
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + k);
430
452
  z.set(s, !(p > 2) || p);
431
453
  }
432
- N(E ? i : i.prototype, m, D, h ? "#" + k : Oe(k), p, o, E ? L = L || [] : a = a || [], $, E, h, T, p === 1, E && h ? O : d);
454
+ H(D ? i : i.prototype, m, E, f ? "#" + k : Te(k), p, a, D ? L = L || [] : n = n || [], $, D, f, T, p === 1, D && f ? O : h);
433
455
  }
434
456
  }
435
- return S(a), S(L), $;
436
- }(t, e, u, P);
457
+ return S(n), S(L), $;
458
+ }(t, e, o, P);
437
459
  return r.length || j(t, P), { e: Z, get c() {
438
460
  var i = [];
439
- return r.length && [j(N(t, [r], n, t.name, 5, P, i), P), w.bind(null, i, t)];
461
+ return r.length && [j(H(t, [r], d, t.name, 5, P, i), P), w.bind(null, i, t)];
440
462
  } };
441
463
  }
442
- function Oe(t) {
443
- var e = Je(t, "string");
464
+ function Te(t) {
465
+ var e = Qe(t, "string");
444
466
  return typeof e == "symbol" ? e : e + "";
445
467
  }
446
- function Je(t, e) {
468
+ function Qe(t, e) {
447
469
  if (typeof t != "object" || !t) return t;
448
470
  var r = t[Symbol.toPrimitive];
449
471
  if (r !== void 0) {
450
- var n = r.call(t, e);
451
- if (typeof n != "object") return n;
472
+ var d = r.call(t, e);
473
+ if (typeof d != "object") return d;
452
474
  throw new TypeError("@@toPrimitive must return a primitive value.");
453
475
  }
454
476
  return String(t);
@@ -461,7 +483,7 @@ function fe(t, e, r) {
461
483
  }
462
484
  return t;
463
485
  }
464
- function Qe(t) {
486
+ function Xe(t) {
465
487
  if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
466
488
  return t;
467
489
  }
@@ -482,18 +504,18 @@ async function ge() {
482
504
  }
483
505
  })()), V.promise);
484
506
  }
485
- Ie = [oe({
507
+ Oe = [oe({
486
508
  tagName: "wsx-doc-search"
487
509
  })];
488
- let Xe;
489
- class Ze extends X {
510
+ let Ze;
511
+ class Ve extends X {
490
512
  constructor() {
491
513
  super({
492
514
  styles: he,
493
515
  styleName: "wsx-doc-search"
494
516
  }), Q(this, "_autoStyles", he), Q(this, "query", void 0), Q(this, "results", void 0), Q(this, "isOpen", void 0), Q(this, "isLoading", void 0), Q(this, "selectedIndex", void 0), Q(this, "fuse", null), Q(this, "searchTimeout", null), Q(this, "handleInput", (j) => {
495
- const U = j.target;
496
- if (this.query = U.value, this.searchTimeout !== null && clearTimeout(this.searchTimeout), !this.query.trim()) {
517
+ const M = j.target;
518
+ if (this.query = M.value, this.searchTimeout !== null && clearTimeout(this.searchTimeout), !this.query.trim()) {
497
519
  this.results = [], this.selectedIndex = -1, this.isOpen = !1;
498
520
  return;
499
521
  }
@@ -524,33 +546,33 @@ class Ze extends X {
524
546
  enumerable: !0,
525
547
  configurable: !0
526
548
  });
527
- let n = this.reactive([]);
549
+ let d = this.reactive([]);
528
550
  Object.defineProperty(this, "results", {
529
- get: () => n,
551
+ get: () => d,
530
552
  set: (j) => {
531
- n = j !== null && typeof j < "u" && (Array.isArray(j) || typeof j == "object") ? this.reactive(j) : j, this.scheduleRerender();
553
+ d = j !== null && typeof j < "u" && (Array.isArray(j) || typeof j == "object") ? this.reactive(j) : j, this.scheduleRerender();
532
554
  },
533
555
  enumerable: !0,
534
556
  configurable: !0
535
557
  });
536
- const [u, C] = this.useState("isOpen", !1);
558
+ const [o, x] = this.useState("isOpen", !1);
537
559
  Object.defineProperty(this, "isOpen", {
538
- get: u,
539
- set: C,
560
+ get: o,
561
+ set: x,
540
562
  enumerable: !0,
541
563
  configurable: !0
542
564
  });
543
- const [g, w] = this.useState("isLoading", !1);
565
+ const [u, w] = this.useState("isLoading", !1);
544
566
  Object.defineProperty(this, "isLoading", {
545
- get: g,
567
+ get: u,
546
568
  set: w,
547
569
  enumerable: !0,
548
570
  configurable: !0
549
571
  });
550
- const [y, N] = this.useState("selectedIndex", -1);
572
+ const [y, H] = this.useState("selectedIndex", -1);
551
573
  Object.defineProperty(this, "selectedIndex", {
552
574
  get: y,
553
- set: N,
575
+ set: H,
554
576
  enumerable: !0,
555
577
  configurable: !0
556
578
  });
@@ -603,111 +625,111 @@ class Ze extends X {
603
625
  highlightTextNodes(e, r) {
604
626
  if (!r || r.length === 0)
605
627
  return [e];
606
- const n = [];
628
+ const d = [];
607
629
  for (const w of r)
608
- w.indices && n.push(...w.indices);
609
- n.sort((w, y) => w[0] - y[0]);
610
- const u = [];
611
- for (const [w, y] of n)
612
- u.length === 0 || u[u.length - 1][1] < w ? u.push([w, y + 1]) : u[u.length - 1][1] = Math.max(u[u.length - 1][1], y + 1);
613
- const C = [];
614
- let g = 0;
615
- for (const [w, y] of u) {
616
- w > g && C.push(e.substring(g, w));
617
- const N = document.createElement("mark");
618
- N.textContent = e.substring(w, y), C.push(N), g = y;
630
+ w.indices && d.push(...w.indices);
631
+ d.sort((w, y) => w[0] - y[0]);
632
+ const o = [];
633
+ for (const [w, y] of d)
634
+ o.length === 0 || o[o.length - 1][1] < w ? o.push([w, y + 1]) : o[o.length - 1][1] = Math.max(o[o.length - 1][1], y + 1);
635
+ const x = [];
636
+ let u = 0;
637
+ for (const [w, y] of o) {
638
+ w > u && x.push(e.substring(u, w));
639
+ const H = document.createElement("mark");
640
+ H.textContent = e.substring(w, y), x.push(H), u = y;
619
641
  }
620
- return g < e.length && C.push(e.substring(g)), C;
642
+ return u < e.length && x.push(e.substring(u)), x;
621
643
  }
622
644
  render() {
623
- return /* @__PURE__ */ x("div", { class: "doc-search" }, /* @__PURE__ */ x("div", { class: "search-input-wrapper" }, /* @__PURE__ */ x("input", { type: "text", class: "search-input", placeholder: "搜索文档...", value: this.query, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: () => {
645
+ return /* @__PURE__ */ C("div", { class: "doc-search" }, /* @__PURE__ */ C("div", { class: "search-input-wrapper" }, /* @__PURE__ */ C("input", { type: "text", class: "search-input", placeholder: "搜索文档...", value: this.query, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: () => {
624
646
  this.results.length > 0 && (this.isOpen = !0);
625
- }, "data-wsx-key": "DocSearch-input-text-1-1" }), this.isLoading && /* @__PURE__ */ x("div", { class: "search-loading" }, "加载中...")), this.isOpen && this.results.length > 0 && /* @__PURE__ */ x("div", { class: "search-results" }, this.results.map((e, r) => {
626
- var g, w;
627
- const n = r === this.selectedIndex, u = (g = e.matches) == null ? void 0 : g.find((y) => y.key === "title"), C = (w = e.matches) == null ? void 0 : w.find((y) => y.key === "content");
628
- return /* @__PURE__ */ x("div", { key: e.item.id, class: `search-result ${n ? "selected" : ""}`, onClick: () => this.selectResult(e), onMouseEnter: () => {
647
+ }, "data-wsx-key": "DocSearch-input-text-1-1" }), this.isLoading && /* @__PURE__ */ C("div", { class: "search-loading" }, "加载中...")), this.isOpen && this.results.length > 0 && /* @__PURE__ */ C("div", { class: "search-results" }, this.results.map((e, r) => {
648
+ var u, w;
649
+ const d = r === this.selectedIndex, o = (u = e.matches) == null ? void 0 : u.find((y) => y.key === "title"), x = (w = e.matches) == null ? void 0 : w.find((y) => y.key === "content");
650
+ return /* @__PURE__ */ C("div", { key: e.item.id, class: `search-result ${d ? "selected" : ""}`, onClick: () => this.selectResult(e), onMouseEnter: () => {
629
651
  this.selectedIndex = r;
630
- } }, /* @__PURE__ */ x("div", { class: "result-title" }, u ? this.highlightTextNodes(e.item.title, [u]) : e.item.title), /* @__PURE__ */ x("div", { class: "result-category" }, e.item.category), C && /* @__PURE__ */ x("div", { class: "result-snippet" }, this.highlightTextNodes(e.item.content.substring(0, 100), [C])));
631
- })), this.isOpen && this.query.trim() && this.results.length === 0 && !this.isLoading && /* @__PURE__ */ x("div", { class: "search-no-results" }, "未找到匹配的文档"));
652
+ } }, /* @__PURE__ */ C("div", { class: "result-title" }, o ? this.highlightTextNodes(e.item.title, [o]) : e.item.title), /* @__PURE__ */ C("div", { class: "result-category" }, e.item.category), x && /* @__PURE__ */ C("div", { class: "result-snippet" }, this.highlightTextNodes(e.item.content.substring(0, 100), [x])));
653
+ })), this.isOpen && this.query.trim() && this.results.length === 0 && !this.isLoading && /* @__PURE__ */ C("div", { class: "search-no-results" }, "未找到匹配的文档"));
632
654
  }
633
655
  }
634
- Ee = Ze;
635
- [Xe, _e] = Ge(Ee, [], Ie, 0, void 0, X).c;
636
- _e();
656
+ _e = Ve;
657
+ [Ze, Ie] = Je(_e, [], Oe, 0, void 0, X).c;
658
+ Ie();
637
659
  const me = "wsx-doc-layout{display:flex;flex-direction:row;width:100%;min-height:calc(100vh - var(--nav-height, 70px))}.doc-layout{display:flex;flex-direction:row;width:100%;max-width:1600px;margin:0 auto;gap:0}.doc-layout-sidebar{flex-shrink:0}.doc-layout-main{flex:1;min-width:0;padding:var(--doc-layout-main-padding-y, 1.5rem) var(--doc-layout-main-padding-x, 2rem);max-width:100%}.doc-layout-toc{flex-shrink:0}@media (max-width: 1280px){.doc-layout-toc{display:none}}@media (max-width: 1024px){.doc-layout-sidebar{display:none}.doc-layout-main{padding:var(--doc-layout-main-padding-y, 1.5rem)}}";
638
- var Te;
639
- let je, Le;
660
+ var je;
661
+ let Le, $e;
640
662
  function ae(t, e, r) {
641
- return (e = $e(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
663
+ return (e = Re(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
642
664
  }
643
- function Ve(t, e, r, n, u, C) {
644
- function g(i, c, d) {
645
- return function(o, a) {
646
- return d && d(o), i[c].call(o, a);
665
+ function et(t, e, r, d, o, x) {
666
+ function u(i, c, h) {
667
+ return function(a, n) {
668
+ return h && h(a), i[c].call(a, n);
647
669
  };
648
670
  }
649
671
  function w(i, c) {
650
- for (var d = 0; d < i.length; d++) i[d].call(c);
672
+ for (var h = 0; h < i.length; h++) i[h].call(c);
651
673
  return c;
652
674
  }
653
- function y(i, c, d, o) {
654
- if (typeof i != "function" && (o || i !== void 0)) throw new TypeError(c + " must " + (d || "be") + " a function" + (o ? "" : " or undefined"));
675
+ function y(i, c, h, a) {
676
+ if (typeof i != "function" && (a || i !== void 0)) throw new TypeError(c + " must " + (h || "be") + " a function" + (a ? "" : " or undefined"));
655
677
  return i;
656
678
  }
657
- function N(i, c, d, o, a, L, $, O, z, S, v, m, p) {
679
+ function H(i, c, h, a, n, L, $, O, z, S, v, m, p) {
658
680
  function k(l) {
659
681
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
660
682
  }
661
- var h, D = c[0], E = c[3], T = !O;
683
+ var f, E = c[0], D = c[3], T = !O;
662
684
  if (!T) {
663
- d || Array.isArray(D) || (D = [D]);
664
- var s = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
685
+ h || Array.isArray(E) || (E = [E]);
686
+ var s = {}, _ = [], b = n === 3 ? "get" : n === 4 || m ? "set" : "value";
665
687
  S ? (v || m ? s = { get: pe(function() {
666
- return E(this);
667
- }, o, "get"), set: function(l) {
688
+ return D(this);
689
+ }, a, "get"), set: function(l) {
668
690
  c[4](this, l);
669
- } } : s[b] = E, v || pe(s[b], o, a === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, o));
691
+ } } : s[b] = D, v || pe(s[b], a, n === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, a));
670
692
  }
671
- for (var f = i, q = D.length - 1; q >= 0; q -= d ? 2 : 1) {
672
- var H = D[q], K = d ? D[q - 1] : void 0, W = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: o, metadata: L, addInitializer: (function(l, I) {
693
+ for (var g = i, q = E.length - 1; q >= 0; q -= h ? 2 : 1) {
694
+ var U = E[q], K = h ? E[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][n], name: a, metadata: L, addInitializer: (function(l, I) {
673
695
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
674
696
  y(I, "An initializer", "be", !0), $.push(I);
675
- }).bind(null, W) };
697
+ }).bind(null, B) };
676
698
  try {
677
- if (T) (h = y(H.call(K, f, R), "class decorators", "return")) && (f = h);
699
+ if (T) (f = y(U.call(K, g, R), "class decorators", "return")) && (g = f);
678
700
  else {
679
701
  var A, F;
680
- R.static = z, R.private = S, S ? a === 2 ? A = function(l) {
702
+ R.static = z, R.private = S, S ? n === 2 ? A = function(l) {
681
703
  return k(l), s.value;
682
- } : (a < 4 && (A = g(s, "get", k)), a !== 3 && (F = g(s, "set", k))) : (A = function(l) {
683
- return l[o];
684
- }, (a < 2 || a === 4) && (F = function(l, I) {
685
- l[o] = I;
704
+ } : (n < 4 && (A = u(s, "get", k)), n !== 3 && (F = u(s, "set", k))) : (A = function(l) {
705
+ return l[a];
706
+ }, (n < 2 || n === 4) && (F = function(l, I) {
707
+ l[a] = I;
686
708
  }));
687
- var B = R.access = { has: S ? p.bind() : function(l) {
688
- return o in l;
709
+ var W = R.access = { has: S ? p.bind() : function(l) {
710
+ return a in l;
689
711
  } };
690
- if (A && (B.get = A), F && (B.set = F), f = H.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
691
- if (typeof f == "object" && f) (h = y(f.get, "accessor.get")) && (s.get = h), (h = y(f.set, "accessor.set")) && (s.set = h), (h = y(f.init, "accessor.init")) && _.push(h);
692
- else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
693
- } else y(f, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(f) : s[b] = f);
712
+ if (A && (W.get = A), F && (W.set = F), g = U.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
713
+ if (typeof g == "object" && g) (f = y(g.get, "accessor.get")) && (s.get = f), (f = y(g.set, "accessor.set")) && (s.set = f), (f = y(g.init, "accessor.init")) && _.push(f);
714
+ else if (g !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
715
+ } else y(g, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(g) : s[b] = g);
694
716
  }
695
717
  } finally {
696
- W.v = !0;
718
+ B.v = !0;
697
719
  }
698
720
  }
699
721
  return (v || m) && O.push(function(l, I) {
700
- for (var M = _.length - 1; M >= 0; M--) I = _[M].call(l, I);
722
+ for (var N = _.length - 1; N >= 0; N--) I = _[N].call(l, I);
701
723
  return I;
702
- }), v || T || (S ? m ? O.push(g(s, "get"), g(s, "set")) : O.push(a === 2 ? s[b] : g.call.bind(s[b])) : Object.defineProperty(i, o, s)), f;
724
+ }), v || T || (S ? m ? O.push(u(s, "get"), u(s, "set")) : O.push(n === 2 ? s[b] : u.call.bind(s[b])) : Object.defineProperty(i, a, s)), g;
703
725
  }
704
726
  function j(i, c) {
705
727
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
706
728
  }
707
- if (arguments.length >= 6) var U = C[Symbol.metadata || Symbol.for("Symbol.metadata")];
708
- var P = Object.create(U ?? null), Z = function(i, c, d, o) {
709
- var a, L, $ = [], O = function(b) {
710
- return tt(b) === i;
729
+ if (arguments.length >= 6) var M = x[Symbol.metadata || Symbol.for("Symbol.metadata")];
730
+ var P = Object.create(M ?? null), Z = function(i, c, h, a) {
731
+ var n, L, $ = [], O = function(b) {
732
+ return rt(b) === i;
711
733
  }, z = /* @__PURE__ */ new Map();
712
734
  function S(b) {
713
735
  b && $.push(w.bind(null, b));
@@ -715,32 +737,32 @@ function Ve(t, e, r, n, u, C) {
715
737
  for (var v = 0; v < c.length; v++) {
716
738
  var m = c[v];
717
739
  if (Array.isArray(m)) {
718
- var p = m[1], k = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + E;
719
- if (!T && !h) {
740
+ var p = m[1], k = m[2], f = m.length > 3, E = 16 & p, D = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + D;
741
+ if (!T && !f) {
720
742
  var _ = z.get(s);
721
743
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + k);
722
744
  z.set(s, !(p > 2) || p);
723
745
  }
724
- N(E ? i : i.prototype, m, D, h ? "#" + k : $e(k), p, o, E ? L = L || [] : a = a || [], $, E, h, T, p === 1, E && h ? O : d);
746
+ H(D ? i : i.prototype, m, E, f ? "#" + k : Re(k), p, a, D ? L = L || [] : n = n || [], $, D, f, T, p === 1, D && f ? O : h);
725
747
  }
726
748
  }
727
- return S(a), S(L), $;
728
- }(t, e, u, P);
749
+ return S(n), S(L), $;
750
+ }(t, e, o, P);
729
751
  return r.length || j(t, P), { e: Z, get c() {
730
752
  var i = [];
731
- return r.length && [j(N(t, [r], n, t.name, 5, P, i), P), w.bind(null, i, t)];
753
+ return r.length && [j(H(t, [r], d, t.name, 5, P, i), P), w.bind(null, i, t)];
732
754
  } };
733
755
  }
734
- function $e(t) {
735
- var e = et(t, "string");
756
+ function Re(t) {
757
+ var e = tt(t, "string");
736
758
  return typeof e == "symbol" ? e : e + "";
737
759
  }
738
- function et(t, e) {
760
+ function tt(t, e) {
739
761
  if (typeof t != "object" || !t) return t;
740
762
  var r = t[Symbol.toPrimitive];
741
763
  if (r !== void 0) {
742
- var n = r.call(t, e);
743
- if (typeof n != "object") return n;
764
+ var d = r.call(t, e);
765
+ if (typeof d != "object") return d;
744
766
  throw new TypeError("@@toPrimitive must return a primitive value.");
745
767
  }
746
768
  return String(t);
@@ -753,15 +775,15 @@ function pe(t, e, r) {
753
775
  }
754
776
  return t;
755
777
  }
756
- function tt(t) {
778
+ function rt(t) {
757
779
  if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
758
780
  return t;
759
781
  }
760
- Le = [oe({
782
+ $e = [oe({
761
783
  tagName: "wsx-doc-layout"
762
784
  })];
763
- let rt;
764
- class it extends X {
785
+ let it;
786
+ class st extends X {
765
787
  constructor() {
766
788
  super({
767
789
  styles: me,
@@ -774,10 +796,10 @@ class it extends X {
774
796
  if (this.connected) {
775
797
  const r = this.querySelector(".doc-layout-sidebar");
776
798
  r && !this.sidebarInstance && (this.sidebarInstance = document.createElement("wsx-doc-sidebar"), r.appendChild(this.sidebarInstance));
777
- const n = this.querySelector(".doc-layout-main");
778
- n && !this.docPageInstance && (this.docPageInstance = document.createElement("wsx-doc-page"), n.appendChild(this.docPageInstance));
779
- const u = this.querySelector(".doc-layout-toc");
780
- u && !this.tocInstance && (this.tocInstance = document.createElement("wsx-doc-toc"), u.appendChild(this.tocInstance));
799
+ const d = this.querySelector(".doc-layout-main");
800
+ d && !this.docPageInstance && (this.docPageInstance = document.createElement("wsx-doc-page"), d.appendChild(this.docPageInstance));
801
+ const o = this.querySelector(".doc-layout-toc");
802
+ o && !this.tocInstance && (this.tocInstance = document.createElement("wsx-doc-toc"), o.appendChild(this.tocInstance));
781
803
  }
782
804
  });
783
805
  }
@@ -786,86 +808,86 @@ class it extends X {
786
808
  (e = super.onDisconnected) == null || e.call(this), this.sidebarInstance && (this.sidebarInstance.remove(), this.sidebarInstance = null), this.docPageInstance && (this.docPageInstance.remove(), this.docPageInstance = null), this.tocInstance && (this.tocInstance.remove(), this.tocInstance = null);
787
809
  }
788
810
  render() {
789
- return /* @__PURE__ */ x("div", { class: "doc-layout" }, /* @__PURE__ */ x("aside", { class: "doc-layout-sidebar" }), /* @__PURE__ */ x("main", { class: "doc-layout-main" }), /* @__PURE__ */ x("aside", { class: "doc-layout-toc" }));
811
+ return /* @__PURE__ */ C("div", { class: "doc-layout" }, /* @__PURE__ */ C("aside", { class: "doc-layout-sidebar" }), /* @__PURE__ */ C("main", { class: "doc-layout-main" }), /* @__PURE__ */ C("aside", { class: "doc-layout-toc" }));
790
812
  }
791
813
  }
792
- Te = it;
793
- [rt, je] = Ve(Te, [], Le, 0, void 0, X).c;
794
- je();
814
+ je = st;
815
+ [it, Le] = et(je, [], $e, 0, void 0, X).c;
816
+ Le();
795
817
  const be = "wsx-doc-sidebar{display:flex;flex-direction:column;width:280px;min-width:280px;height:100%;background:var(--wsx-press-sidebar-bg, #f9fafb);border-right:1px solid var(--wsx-press-border, #e5e7eb);overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.light wsx-doc-sidebar,[data-theme=light] wsx-doc-sidebar{background:var(--wsx-press-sidebar-bg, #f9fafb);border-right-color:var(--wsx-press-border, #e5e7eb)}.dark wsx-doc-sidebar,[data-theme=dark] wsx-doc-sidebar{background:var(--wsx-press-sidebar-bg, #1f2937);border-right-color:var(--wsx-press-border, #374151)}@media (prefers-color-scheme: dark){html:not(.light):not([data-theme=light]) wsx-doc-sidebar{background:var(--wsx-press-sidebar-bg, #1f2937);border-right-color:var(--wsx-press-border, #374151)}}.doc-sidebar{display:flex;flex-direction:column;width:100%;height:100%}.doc-sidebar-loading,.doc-sidebar-empty{padding:2rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280)}.doc-sidebar-nav{padding:1.5rem 0}.doc-sidebar-category{margin-bottom:2rem}.doc-sidebar-category:last-child{margin-bottom:0}.doc-sidebar-category-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);padding:.5rem 1.5rem;margin:0 0 .5rem}.light .doc-sidebar-category-title,[data-theme=light] .doc-sidebar-category-title{color:var(--wsx-press-text-secondary, #6b7280)}.dark .doc-sidebar-category-title,[data-theme=dark] .doc-sidebar-category-title{color:var(--wsx-press-text-secondary, #9ca3af)}@media (prefers-color-scheme: dark){html:not(.light):not([data-theme=light]) .doc-sidebar-category-title{color:var(--wsx-press-text-secondary, #9ca3af)}}.doc-sidebar-list{list-style:none;margin:0;padding:0}.doc-sidebar-item{margin:0}.doc-sidebar-link{display:block;padding:.5rem 1.5rem;color:var(--wsx-press-text-primary, #111827);text-decoration:none;font-size:.875rem;line-height:1.5;transition:all .2s ease;border-left:3px solid transparent}.doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #f3f4f6);color:var(--wsx-press-text-primary, #111827)}.doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, #fef2f2);color:var(--wsx-press-sidebar-active-color, #dc2626);border-left-color:var(--wsx-press-sidebar-active-color, #dc2626);font-weight:500}.light .doc-sidebar-link,[data-theme=light] .doc-sidebar-link{color:var(--wsx-press-text-primary, #111827)}.light .doc-sidebar-link:hover,[data-theme=light] .doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #f3f4f6);color:var(--wsx-press-text-primary, #111827)}.light .doc-sidebar-link.active,[data-theme=light] .doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, #fef2f2);color:var(--wsx-press-sidebar-active-color, #dc2626);border-left-color:var(--wsx-press-sidebar-active-color, #dc2626)}.dark .doc-sidebar-link,[data-theme=dark] .doc-sidebar-link{color:var(--wsx-press-text-primary, #e5e7eb)}.dark .doc-sidebar-link:hover,[data-theme=dark] .doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #374151);color:var(--wsx-press-text-primary, #f3f4f6)}.dark .doc-sidebar-link.active,[data-theme=dark] .doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, rgba(220, 38, 38, .15));color:var(--wsx-press-sidebar-active-color, #f87171);border-left-color:var(--wsx-press-sidebar-active-color, #f87171)}@media (prefers-color-scheme: dark){html:not(.light):not([data-theme=light]) .doc-sidebar-link{color:var(--wsx-press-text-primary, #e5e7eb)}html:not(.light):not([data-theme=light]) .doc-sidebar-link:hover{background:var(--wsx-press-sidebar-hover-bg, #374151);color:var(--wsx-press-text-primary, #f3f4f6)}html:not(.light):not([data-theme=light]) .doc-sidebar-link.active{background:var(--wsx-press-sidebar-active-bg, rgba(220, 38, 38, .15));color:var(--wsx-press-sidebar-active-color, #f87171);border-left-color:var(--wsx-press-sidebar-active-color, #f87171)}}@media (max-width: 1024px){wsx-doc-sidebar{width:240px;min-width:240px}}@media (max-width: 768px){wsx-doc-sidebar{display:none}}";
796
- var Re;
797
- let Ae, Pe;
818
+ var Ae;
819
+ let Pe, ze;
798
820
  function se(t, e, r) {
799
- return (e = ze(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
821
+ return (e = qe(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
800
822
  }
801
- function st(t, e, r, n, u, C) {
802
- function g(i, c, d) {
803
- return function(o, a) {
804
- return d && d(o), i[c].call(o, a);
823
+ function ot(t, e, r, d, o, x) {
824
+ function u(i, c, h) {
825
+ return function(a, n) {
826
+ return h && h(a), i[c].call(a, n);
805
827
  };
806
828
  }
807
829
  function w(i, c) {
808
- for (var d = 0; d < i.length; d++) i[d].call(c);
830
+ for (var h = 0; h < i.length; h++) i[h].call(c);
809
831
  return c;
810
832
  }
811
- function y(i, c, d, o) {
812
- if (typeof i != "function" && (o || i !== void 0)) throw new TypeError(c + " must " + (d || "be") + " a function" + (o ? "" : " or undefined"));
833
+ function y(i, c, h, a) {
834
+ if (typeof i != "function" && (a || i !== void 0)) throw new TypeError(c + " must " + (h || "be") + " a function" + (a ? "" : " or undefined"));
813
835
  return i;
814
836
  }
815
- function N(i, c, d, o, a, L, $, O, z, S, v, m, p) {
837
+ function H(i, c, h, a, n, L, $, O, z, S, v, m, p) {
816
838
  function k(l) {
817
839
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
818
840
  }
819
- var h, D = c[0], E = c[3], T = !O;
841
+ var f, E = c[0], D = c[3], T = !O;
820
842
  if (!T) {
821
- d || Array.isArray(D) || (D = [D]);
822
- var s = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
843
+ h || Array.isArray(E) || (E = [E]);
844
+ var s = {}, _ = [], b = n === 3 ? "get" : n === 4 || m ? "set" : "value";
823
845
  S ? (v || m ? s = { get: ye(function() {
824
- return E(this);
825
- }, o, "get"), set: function(l) {
846
+ return D(this);
847
+ }, a, "get"), set: function(l) {
826
848
  c[4](this, l);
827
- } } : s[b] = E, v || ye(s[b], o, a === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, o));
849
+ } } : s[b] = D, v || ye(s[b], a, n === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, a));
828
850
  }
829
- for (var f = i, q = D.length - 1; q >= 0; q -= d ? 2 : 1) {
830
- var H = D[q], K = d ? D[q - 1] : void 0, W = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: o, metadata: L, addInitializer: (function(l, I) {
851
+ for (var g = i, q = E.length - 1; q >= 0; q -= h ? 2 : 1) {
852
+ var U = E[q], K = h ? E[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][n], name: a, metadata: L, addInitializer: (function(l, I) {
831
853
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
832
854
  y(I, "An initializer", "be", !0), $.push(I);
833
- }).bind(null, W) };
855
+ }).bind(null, B) };
834
856
  try {
835
- if (T) (h = y(H.call(K, f, R), "class decorators", "return")) && (f = h);
857
+ if (T) (f = y(U.call(K, g, R), "class decorators", "return")) && (g = f);
836
858
  else {
837
859
  var A, F;
838
- R.static = z, R.private = S, S ? a === 2 ? A = function(l) {
860
+ R.static = z, R.private = S, S ? n === 2 ? A = function(l) {
839
861
  return k(l), s.value;
840
- } : (a < 4 && (A = g(s, "get", k)), a !== 3 && (F = g(s, "set", k))) : (A = function(l) {
841
- return l[o];
842
- }, (a < 2 || a === 4) && (F = function(l, I) {
843
- l[o] = I;
862
+ } : (n < 4 && (A = u(s, "get", k)), n !== 3 && (F = u(s, "set", k))) : (A = function(l) {
863
+ return l[a];
864
+ }, (n < 2 || n === 4) && (F = function(l, I) {
865
+ l[a] = I;
844
866
  }));
845
- var B = R.access = { has: S ? p.bind() : function(l) {
846
- return o in l;
867
+ var W = R.access = { has: S ? p.bind() : function(l) {
868
+ return a in l;
847
869
  } };
848
- if (A && (B.get = A), F && (B.set = F), f = H.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
849
- if (typeof f == "object" && f) (h = y(f.get, "accessor.get")) && (s.get = h), (h = y(f.set, "accessor.set")) && (s.set = h), (h = y(f.init, "accessor.init")) && _.push(h);
850
- else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
851
- } else y(f, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(f) : s[b] = f);
870
+ if (A && (W.get = A), F && (W.set = F), g = U.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
871
+ if (typeof g == "object" && g) (f = y(g.get, "accessor.get")) && (s.get = f), (f = y(g.set, "accessor.set")) && (s.set = f), (f = y(g.init, "accessor.init")) && _.push(f);
872
+ else if (g !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
873
+ } else y(g, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(g) : s[b] = g);
852
874
  }
853
875
  } finally {
854
- W.v = !0;
876
+ B.v = !0;
855
877
  }
856
878
  }
857
879
  return (v || m) && O.push(function(l, I) {
858
- for (var M = _.length - 1; M >= 0; M--) I = _[M].call(l, I);
880
+ for (var N = _.length - 1; N >= 0; N--) I = _[N].call(l, I);
859
881
  return I;
860
- }), v || T || (S ? m ? O.push(g(s, "get"), g(s, "set")) : O.push(a === 2 ? s[b] : g.call.bind(s[b])) : Object.defineProperty(i, o, s)), f;
882
+ }), v || T || (S ? m ? O.push(u(s, "get"), u(s, "set")) : O.push(n === 2 ? s[b] : u.call.bind(s[b])) : Object.defineProperty(i, a, s)), g;
861
883
  }
862
884
  function j(i, c) {
863
885
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
864
886
  }
865
- if (arguments.length >= 6) var U = C[Symbol.metadata || Symbol.for("Symbol.metadata")];
866
- var P = Object.create(U ?? null), Z = function(i, c, d, o) {
867
- var a, L, $ = [], O = function(b) {
868
- return at(b) === i;
887
+ if (arguments.length >= 6) var M = x[Symbol.metadata || Symbol.for("Symbol.metadata")];
888
+ var P = Object.create(M ?? null), Z = function(i, c, h, a) {
889
+ var n, L, $ = [], O = function(b) {
890
+ return nt(b) === i;
869
891
  }, z = /* @__PURE__ */ new Map();
870
892
  function S(b) {
871
893
  b && $.push(w.bind(null, b));
@@ -873,32 +895,32 @@ function st(t, e, r, n, u, C) {
873
895
  for (var v = 0; v < c.length; v++) {
874
896
  var m = c[v];
875
897
  if (Array.isArray(m)) {
876
- var p = m[1], k = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + E;
877
- if (!T && !h) {
898
+ var p = m[1], k = m[2], f = m.length > 3, E = 16 & p, D = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + D;
899
+ if (!T && !f) {
878
900
  var _ = z.get(s);
879
901
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + k);
880
902
  z.set(s, !(p > 2) || p);
881
903
  }
882
- N(E ? i : i.prototype, m, D, h ? "#" + k : ze(k), p, o, E ? L = L || [] : a = a || [], $, E, h, T, p === 1, E && h ? O : d);
904
+ H(D ? i : i.prototype, m, E, f ? "#" + k : qe(k), p, a, D ? L = L || [] : n = n || [], $, D, f, T, p === 1, D && f ? O : h);
883
905
  }
884
906
  }
885
- return S(a), S(L), $;
886
- }(t, e, u, P);
907
+ return S(n), S(L), $;
908
+ }(t, e, o, P);
887
909
  return r.length || j(t, P), { e: Z, get c() {
888
910
  var i = [];
889
- return r.length && [j(N(t, [r], n, t.name, 5, P, i), P), w.bind(null, i, t)];
911
+ return r.length && [j(H(t, [r], d, t.name, 5, P, i), P), w.bind(null, i, t)];
890
912
  } };
891
913
  }
892
- function ze(t) {
893
- var e = ot(t, "string");
914
+ function qe(t) {
915
+ var e = at(t, "string");
894
916
  return typeof e == "symbol" ? e : e + "";
895
917
  }
896
- function ot(t, e) {
918
+ function at(t, e) {
897
919
  if (typeof t != "object" || !t) return t;
898
920
  var r = t[Symbol.toPrimitive];
899
921
  if (r !== void 0) {
900
- var n = r.call(t, e);
901
- if (typeof n != "object") return n;
922
+ var d = r.call(t, e);
923
+ if (typeof d != "object") return d;
902
924
  throw new TypeError("@@toPrimitive must return a primitive value.");
903
925
  }
904
926
  return String(t);
@@ -911,43 +933,43 @@ function ye(t, e, r) {
911
933
  }
912
934
  return t;
913
935
  }
914
- function at(t) {
936
+ function nt(t) {
915
937
  if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
916
938
  return t;
917
939
  }
918
- const nt = ne("DocSidebar");
919
- Pe = [oe({
940
+ const ct = ne("DocSidebar");
941
+ ze = [oe({
920
942
  tagName: "wsx-doc-sidebar"
921
943
  })];
922
- let ct;
923
- class lt extends X {
944
+ let lt;
945
+ class dt extends X {
924
946
  constructor() {
925
947
  super({
926
948
  styles: be,
927
949
  styleName: "wsx-doc-sidebar"
928
- }), se(this, "_autoStyles", be), se(this, "metadata", void 0), se(this, "currentRoute", void 0), se(this, "isLoading", void 0), se(this, "routeChangeUnsubscribe", null), se(this, "handleDocClick", (g, w) => {
929
- w.preventDefault(), ie.navigate(g);
950
+ }), se(this, "_autoStyles", be), se(this, "metadata", void 0), se(this, "currentRoute", void 0), se(this, "isLoading", void 0), se(this, "routeChangeUnsubscribe", null), se(this, "handleDocClick", (u, w) => {
951
+ w.preventDefault(), ie.navigate(u);
930
952
  });
931
953
  let e = this.reactive({});
932
954
  Object.defineProperty(this, "metadata", {
933
955
  get: () => e,
934
- set: (g) => {
935
- e = g !== null && typeof g < "u" && (Array.isArray(g) || typeof g == "object") ? this.reactive(g) : g, this.scheduleRerender();
956
+ set: (u) => {
957
+ e = u !== null && typeof u < "u" && (Array.isArray(u) || typeof u == "object") ? this.reactive(u) : u, this.scheduleRerender();
936
958
  },
937
959
  enumerable: !0,
938
960
  configurable: !0
939
961
  });
940
- const [r, n] = this.useState("currentRoute", "");
962
+ const [r, d] = this.useState("currentRoute", "");
941
963
  Object.defineProperty(this, "currentRoute", {
942
964
  get: r,
943
- set: n,
965
+ set: d,
944
966
  enumerable: !0,
945
967
  configurable: !0
946
968
  });
947
- const [u, C] = this.useState("isLoading", !0);
969
+ const [o, x] = this.useState("isLoading", !0);
948
970
  Object.defineProperty(this, "isLoading", {
949
- get: u,
950
- set: C,
971
+ get: o,
972
+ set: x,
951
973
  enumerable: !0,
952
974
  configurable: !0
953
975
  });
@@ -967,14 +989,14 @@ class lt extends X {
967
989
  */
968
990
  async loadMetadata() {
969
991
  try {
970
- if (this.isLoading = !0, G.data)
971
- this.metadata = G.data;
992
+ if (this.isLoading = !0, J.data)
993
+ this.metadata = J.data;
972
994
  else {
973
995
  const e = await fetch("/.wsx-press/docs-meta.json");
974
996
  e.ok && (this.metadata = await e.json());
975
997
  }
976
998
  } catch (e) {
977
- nt.error("Failed to load metadata", e);
999
+ ct.error("Failed to load metadata", e);
978
1000
  } finally {
979
1001
  this.isLoading = !1;
980
1002
  }
@@ -991,11 +1013,11 @@ class lt extends X {
991
1013
  */
992
1014
  organizeByCategory() {
993
1015
  const e = {};
994
- return Object.values(this.metadata).forEach((n) => {
995
- const u = n.category || "other";
996
- e[u] || (e[u] = []), e[u].push(n);
997
- }), Object.keys(e).sort().forEach((n) => {
998
- e[n].sort((u, C) => u.order !== void 0 && C.order !== void 0 ? u.order - C.order : u.order !== void 0 ? -1 : C.order !== void 0 ? 1 : u.title.localeCompare(C.title));
1016
+ return Object.values(this.metadata).forEach((d) => {
1017
+ const o = d.category || "other";
1018
+ e[o] || (e[o] = []), e[o].push(d);
1019
+ }), Object.keys(e).sort().forEach((d) => {
1020
+ e[d].sort((o, x) => o.order !== void 0 && x.order !== void 0 ? o.order - x.order : o.order !== void 0 ? -1 : x.order !== void 0 ? 1 : o.title.localeCompare(x.title));
999
1021
  }), e;
1000
1022
  }
1001
1023
  /**
@@ -1006,88 +1028,88 @@ class lt extends X {
1006
1028
  }
1007
1029
  render() {
1008
1030
  if (this.isLoading)
1009
- return /* @__PURE__ */ x("aside", { class: "doc-sidebar" }, /* @__PURE__ */ x("div", { class: "doc-sidebar-loading" }, "加载中..."));
1031
+ return /* @__PURE__ */ C("aside", { class: "doc-sidebar" }, /* @__PURE__ */ C("div", { class: "doc-sidebar-loading" }, "加载中..."));
1010
1032
  const e = this.organizeByCategory(), r = Object.keys(e);
1011
- return r.length === 0 ? /* @__PURE__ */ x("aside", { class: "doc-sidebar" }, /* @__PURE__ */ x("div", { class: "doc-sidebar-empty" }, "暂无文档")) : /* @__PURE__ */ x("aside", { class: "doc-sidebar" }, /* @__PURE__ */ x("nav", { class: "doc-sidebar-nav" }, r.map((n) => /* @__PURE__ */ x("div", { key: n, class: "doc-sidebar-category" }, /* @__PURE__ */ x("h3", { class: "doc-sidebar-category-title" }, n), /* @__PURE__ */ x("ul", { class: "doc-sidebar-list" }, e[n].map((u) => /* @__PURE__ */ x("li", { key: u.route, class: "doc-sidebar-item" }, /* @__PURE__ */ x("a", { href: u.route, class: `doc-sidebar-link ${this.isCurrentDoc(u.route) ? "active" : ""}`, onClick: (C) => this.handleDocClick(u.route, C) }, u.title))))))));
1033
+ return r.length === 0 ? /* @__PURE__ */ C("aside", { class: "doc-sidebar" }, /* @__PURE__ */ C("div", { class: "doc-sidebar-empty" }, "暂无文档")) : /* @__PURE__ */ C("aside", { class: "doc-sidebar" }, /* @__PURE__ */ C("nav", { class: "doc-sidebar-nav" }, r.map((d) => /* @__PURE__ */ C("div", { key: d, class: "doc-sidebar-category" }, /* @__PURE__ */ C("h3", { class: "doc-sidebar-category-title" }, d), /* @__PURE__ */ C("ul", { class: "doc-sidebar-list" }, e[d].map((o) => /* @__PURE__ */ C("li", { key: o.route, class: "doc-sidebar-item" }, /* @__PURE__ */ C("a", { href: o.route, class: `doc-sidebar-link ${this.isCurrentDoc(o.route) ? "active" : ""}`, onClick: (x) => this.handleDocClick(o.route, x) }, o.title))))))));
1012
1034
  }
1013
1035
  }
1014
- Re = lt;
1015
- [ct, Ae] = st(Re, [], Pe, 0, void 0, X).c;
1016
- Ae();
1036
+ Ae = dt;
1037
+ [lt, Pe] = ot(Ae, [], ze, 0, void 0, X).c;
1038
+ Pe();
1017
1039
  const ve = "wsx-doc-toc{display:flex;flex-direction:column;width:240px;min-width:240px;height:100%;overflow-y:auto;position:sticky;top:70px;max-height:calc(100vh - 70px)}.doc-toc{display:flex;flex-direction:column;width:100%;padding:1.5rem 1rem}.doc-toc-empty{padding:1rem;text-align:center;color:var(--wsx-press-text-secondary, #6b7280);font-size:.875rem}.doc-toc-title{font-size:.875rem;font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--wsx-press-text-secondary, #6b7280);margin:0 0 1rem;padding:0}.doc-toc-nav{width:100%}.doc-toc-list{list-style:none;margin:0;padding:0}.doc-toc-sublist{margin-top:.25rem;padding-left:1rem}.doc-toc-item{margin:0;line-height:1.6}.doc-toc-item-level-1{margin-bottom:.5rem}.doc-toc-item-level-2{margin-bottom:.375rem;font-size:.875rem}.doc-toc-item-level-3{margin-bottom:.25rem;font-size:.8125rem}.doc-toc-item-level-4,.doc-toc-item-level-5,.doc-toc-item-level-6{margin-bottom:.25rem;font-size:.75rem}.doc-toc-link{display:block;color:var(--wsx-press-text-secondary, #6b7280);text-decoration:none;transition:color .2s ease;border-left:2px solid transparent;padding:.25rem 0 .25rem .5rem;margin-left:-.5rem}.doc-toc-link:hover{color:var(--wsx-press-text-primary, #111827)}.doc-toc-link.active{color:var(--wsx-press-toc-active-color, #2563eb);border-left-color:var(--wsx-press-toc-active-color, #2563eb);font-weight:500}@media (max-width: 1280px){wsx-doc-toc{display:none}}";
1018
- var qe;
1019
- let Fe, Ne;
1040
+ var Fe;
1041
+ let He, Ne;
1020
1042
  function re(t, e, r) {
1021
1043
  return (e = Me(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
1022
1044
  }
1023
- function dt(t, e, r, n, u, C) {
1024
- function g(i, c, d) {
1025
- return function(o, a) {
1026
- return d && d(o), i[c].call(o, a);
1045
+ function ut(t, e, r, d, o, x) {
1046
+ function u(i, c, h) {
1047
+ return function(a, n) {
1048
+ return h && h(a), i[c].call(a, n);
1027
1049
  };
1028
1050
  }
1029
1051
  function w(i, c) {
1030
- for (var d = 0; d < i.length; d++) i[d].call(c);
1052
+ for (var h = 0; h < i.length; h++) i[h].call(c);
1031
1053
  return c;
1032
1054
  }
1033
- function y(i, c, d, o) {
1034
- if (typeof i != "function" && (o || i !== void 0)) throw new TypeError(c + " must " + (d || "be") + " a function" + (o ? "" : " or undefined"));
1055
+ function y(i, c, h, a) {
1056
+ if (typeof i != "function" && (a || i !== void 0)) throw new TypeError(c + " must " + (h || "be") + " a function" + (a ? "" : " or undefined"));
1035
1057
  return i;
1036
1058
  }
1037
- function N(i, c, d, o, a, L, $, O, z, S, v, m, p) {
1059
+ function H(i, c, h, a, n, L, $, O, z, S, v, m, p) {
1038
1060
  function k(l) {
1039
1061
  if (!p(l)) throw new TypeError("Attempted to access private element on non-instance");
1040
1062
  }
1041
- var h, D = c[0], E = c[3], T = !O;
1063
+ var f, E = c[0], D = c[3], T = !O;
1042
1064
  if (!T) {
1043
- d || Array.isArray(D) || (D = [D]);
1044
- var s = {}, _ = [], b = a === 3 ? "get" : a === 4 || m ? "set" : "value";
1065
+ h || Array.isArray(E) || (E = [E]);
1066
+ var s = {}, _ = [], b = n === 3 ? "get" : n === 4 || m ? "set" : "value";
1045
1067
  S ? (v || m ? s = { get: xe(function() {
1046
- return E(this);
1047
- }, o, "get"), set: function(l) {
1068
+ return D(this);
1069
+ }, a, "get"), set: function(l) {
1048
1070
  c[4](this, l);
1049
- } } : s[b] = E, v || xe(s[b], o, a === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, o));
1071
+ } } : s[b] = D, v || xe(s[b], a, n === 2 ? "" : b)) : v || (s = Object.getOwnPropertyDescriptor(i, a));
1050
1072
  }
1051
- for (var f = i, q = D.length - 1; q >= 0; q -= d ? 2 : 1) {
1052
- var H = D[q], K = d ? D[q - 1] : void 0, W = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][a], name: o, metadata: L, addInitializer: (function(l, I) {
1073
+ for (var g = i, q = E.length - 1; q >= 0; q -= h ? 2 : 1) {
1074
+ var U = E[q], K = h ? E[q - 1] : void 0, B = {}, R = { kind: ["field", "accessor", "method", "getter", "setter", "class"][n], name: a, metadata: L, addInitializer: (function(l, I) {
1053
1075
  if (l.v) throw Error("attempted to call addInitializer after decoration was finished");
1054
1076
  y(I, "An initializer", "be", !0), $.push(I);
1055
- }).bind(null, W) };
1077
+ }).bind(null, B) };
1056
1078
  try {
1057
- if (T) (h = y(H.call(K, f, R), "class decorators", "return")) && (f = h);
1079
+ if (T) (f = y(U.call(K, g, R), "class decorators", "return")) && (g = f);
1058
1080
  else {
1059
1081
  var A, F;
1060
- R.static = z, R.private = S, S ? a === 2 ? A = function(l) {
1082
+ R.static = z, R.private = S, S ? n === 2 ? A = function(l) {
1061
1083
  return k(l), s.value;
1062
- } : (a < 4 && (A = g(s, "get", k)), a !== 3 && (F = g(s, "set", k))) : (A = function(l) {
1063
- return l[o];
1064
- }, (a < 2 || a === 4) && (F = function(l, I) {
1065
- l[o] = I;
1084
+ } : (n < 4 && (A = u(s, "get", k)), n !== 3 && (F = u(s, "set", k))) : (A = function(l) {
1085
+ return l[a];
1086
+ }, (n < 2 || n === 4) && (F = function(l, I) {
1087
+ l[a] = I;
1066
1088
  }));
1067
- var B = R.access = { has: S ? p.bind() : function(l) {
1068
- return o in l;
1089
+ var W = R.access = { has: S ? p.bind() : function(l) {
1090
+ return a in l;
1069
1091
  } };
1070
- if (A && (B.get = A), F && (B.set = F), f = H.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
1071
- if (typeof f == "object" && f) (h = y(f.get, "accessor.get")) && (s.get = h), (h = y(f.set, "accessor.set")) && (s.set = h), (h = y(f.init, "accessor.init")) && _.push(h);
1072
- else if (f !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1073
- } else y(f, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(f) : s[b] = f);
1092
+ if (A && (W.get = A), F && (W.set = F), g = U.call(K, m ? { get: s.get, set: s.set } : s[b], R), m) {
1093
+ if (typeof g == "object" && g) (f = y(g.get, "accessor.get")) && (s.get = f), (f = y(g.set, "accessor.set")) && (s.set = f), (f = y(g.init, "accessor.init")) && _.push(f);
1094
+ else if (g !== void 0) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1095
+ } else y(g, (v ? "field" : "method") + " decorators", "return") && (v ? _.push(g) : s[b] = g);
1074
1096
  }
1075
1097
  } finally {
1076
- W.v = !0;
1098
+ B.v = !0;
1077
1099
  }
1078
1100
  }
1079
1101
  return (v || m) && O.push(function(l, I) {
1080
- for (var M = _.length - 1; M >= 0; M--) I = _[M].call(l, I);
1102
+ for (var N = _.length - 1; N >= 0; N--) I = _[N].call(l, I);
1081
1103
  return I;
1082
- }), v || T || (S ? m ? O.push(g(s, "get"), g(s, "set")) : O.push(a === 2 ? s[b] : g.call.bind(s[b])) : Object.defineProperty(i, o, s)), f;
1104
+ }), v || T || (S ? m ? O.push(u(s, "get"), u(s, "set")) : O.push(n === 2 ? s[b] : u.call.bind(s[b])) : Object.defineProperty(i, a, s)), g;
1083
1105
  }
1084
1106
  function j(i, c) {
1085
1107
  return Object.defineProperty(i, Symbol.metadata || Symbol.for("Symbol.metadata"), { configurable: !0, enumerable: !0, value: c });
1086
1108
  }
1087
- if (arguments.length >= 6) var U = C[Symbol.metadata || Symbol.for("Symbol.metadata")];
1088
- var P = Object.create(U ?? null), Z = function(i, c, d, o) {
1089
- var a, L, $ = [], O = function(b) {
1090
- return ht(b) === i;
1109
+ if (arguments.length >= 6) var M = x[Symbol.metadata || Symbol.for("Symbol.metadata")];
1110
+ var P = Object.create(M ?? null), Z = function(i, c, h, a) {
1111
+ var n, L, $ = [], O = function(b) {
1112
+ return ft(b) === i;
1091
1113
  }, z = /* @__PURE__ */ new Map();
1092
1114
  function S(b) {
1093
1115
  b && $.push(w.bind(null, b));
@@ -1095,32 +1117,32 @@ function dt(t, e, r, n, u, C) {
1095
1117
  for (var v = 0; v < c.length; v++) {
1096
1118
  var m = c[v];
1097
1119
  if (Array.isArray(m)) {
1098
- var p = m[1], k = m[2], h = m.length > 3, D = 16 & p, E = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + E;
1099
- if (!T && !h) {
1120
+ var p = m[1], k = m[2], f = m.length > 3, E = 16 & p, D = !!(8 & p), T = (p &= 7) == 0, s = k + "/" + D;
1121
+ if (!T && !f) {
1100
1122
  var _ = z.get(s);
1101
1123
  if (_ === !0 || _ === 3 && p !== 4 || _ === 4 && p !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + k);
1102
1124
  z.set(s, !(p > 2) || p);
1103
1125
  }
1104
- N(E ? i : i.prototype, m, D, h ? "#" + k : Me(k), p, o, E ? L = L || [] : a = a || [], $, E, h, T, p === 1, E && h ? O : d);
1126
+ H(D ? i : i.prototype, m, E, f ? "#" + k : Me(k), p, a, D ? L = L || [] : n = n || [], $, D, f, T, p === 1, D && f ? O : h);
1105
1127
  }
1106
1128
  }
1107
- return S(a), S(L), $;
1108
- }(t, e, u, P);
1129
+ return S(n), S(L), $;
1130
+ }(t, e, o, P);
1109
1131
  return r.length || j(t, P), { e: Z, get c() {
1110
1132
  var i = [];
1111
- return r.length && [j(N(t, [r], n, t.name, 5, P, i), P), w.bind(null, i, t)];
1133
+ return r.length && [j(H(t, [r], d, t.name, 5, P, i), P), w.bind(null, i, t)];
1112
1134
  } };
1113
1135
  }
1114
1136
  function Me(t) {
1115
- var e = ut(t, "string");
1137
+ var e = ht(t, "string");
1116
1138
  return typeof e == "symbol" ? e : e + "";
1117
1139
  }
1118
- function ut(t, e) {
1140
+ function ht(t, e) {
1119
1141
  if (typeof t != "object" || !t) return t;
1120
1142
  var r = t[Symbol.toPrimitive];
1121
1143
  if (r !== void 0) {
1122
- var n = r.call(t, e);
1123
- if (typeof n != "object") return n;
1144
+ var d = r.call(t, e);
1145
+ if (typeof d != "object") return d;
1124
1146
  throw new TypeError("@@toPrimitive must return a primitive value.");
1125
1147
  }
1126
1148
  return String(t);
@@ -1133,11 +1155,11 @@ function xe(t, e, r) {
1133
1155
  }
1134
1156
  return t;
1135
1157
  }
1136
- function ht(t) {
1158
+ function ft(t) {
1137
1159
  if (Object(t) !== t) throw TypeError("right-hand side of 'in' should be an object, got " + (t !== null ? typeof t : "null"));
1138
1160
  return t;
1139
1161
  }
1140
- const ft = ne("DocTOC"), ee = {
1162
+ const we = ne("DocTOC"), ee = {
1141
1163
  data: null,
1142
1164
  promise: null
1143
1165
  };
@@ -1163,27 +1185,27 @@ class pt extends X {
1163
1185
  super({
1164
1186
  styles: ve,
1165
1187
  styleName: "wsx-doc-toc"
1166
- }), re(this, "_autoStyles", ve), re(this, "items", void 0), re(this, "activeId", void 0), re(this, "observer", null), re(this, "headingElements", /* @__PURE__ */ new Map()), re(this, "routeChangeUnsubscribe", null), re(this, "handleTOCClick", (u, C) => {
1167
- C.preventDefault();
1168
- const g = this.headingElements.get(u);
1169
- g && (g.scrollIntoView({
1188
+ }), re(this, "_autoStyles", ve), re(this, "items", void 0), re(this, "activeId", void 0), re(this, "observer", null), re(this, "headingElements", /* @__PURE__ */ new Map()), re(this, "routeChangeUnsubscribe", null), re(this, "handleTOCClick", (o, x) => {
1189
+ x.preventDefault();
1190
+ let u = this.headingElements.get(o);
1191
+ u || (u = document.getElementById(o), u && this.headingElements.set(o, u)), u ? (u.scrollIntoView({
1170
1192
  behavior: "smooth",
1171
1193
  block: "start"
1172
- }), window.history.replaceState(null, "", `#${u}`));
1194
+ }), window.history.replaceState(null, "", `#${o}`)) : we.warn(`Heading element not found for id: ${o}`);
1173
1195
  });
1174
1196
  let e = this.reactive([]);
1175
1197
  Object.defineProperty(this, "items", {
1176
1198
  get: () => e,
1177
- set: (u) => {
1178
- e = u !== null && typeof u < "u" && (Array.isArray(u) || typeof u == "object") ? this.reactive(u) : u, this.scheduleRerender();
1199
+ set: (o) => {
1200
+ e = o !== null && typeof o < "u" && (Array.isArray(o) || typeof o == "object") ? this.reactive(o) : o, this.scheduleRerender();
1179
1201
  },
1180
1202
  enumerable: !0,
1181
1203
  configurable: !0
1182
1204
  });
1183
- const [r, n] = this.useState("activeId", "");
1205
+ const [r, d] = this.useState("activeId", "");
1184
1206
  Object.defineProperty(this, "activeId", {
1185
1207
  get: r,
1186
- set: n,
1208
+ set: d,
1187
1209
  enumerable: !0,
1188
1210
  configurable: !0
1189
1211
  });
@@ -1215,45 +1237,56 @@ class pt extends X {
1215
1237
  this.items = [];
1216
1238
  return;
1217
1239
  }
1218
- const n = await gt();
1219
- this.items = n[r] || [], requestAnimationFrame(() => {
1240
+ const d = await gt();
1241
+ this.items = d[r] || [], requestAnimationFrame(() => {
1220
1242
  this.setupHeadingIds(), this.setupScrollObserver();
1221
1243
  });
1222
1244
  } catch (e) {
1223
- ft.error("Failed to load TOC", e), this.items = [];
1245
+ we.error("Failed to load TOC", e), this.items = [];
1224
1246
  }
1225
1247
  }
1226
1248
  /**
1227
- * 为文档中的标题元素设置 ID
1249
+ * 收集文档中的标题元素(使用已有的 ID
1250
+ * 注意:不再重新设置 ID,而是使用 Heading 组件已经设置好的 ID
1228
1251
  */
1229
1252
  setupHeadingIds() {
1230
1253
  const e = document.querySelector(".doc-content");
1231
1254
  if (!e)
1232
1255
  return;
1233
- const r = e.querySelectorAll("h1, h2, h3, h4, h5, h6, wsx-marked-heading");
1234
- this.headingElements.clear(), r.forEach((n) => {
1235
- var g;
1236
- const u = ((g = n.textContent) == null ? void 0 : g.trim()) || "";
1237
- if (!u) return;
1238
- const C = this.generateId(u);
1239
- n instanceof HTMLElement && (n.id = C, this.headingElements.set(C, n));
1256
+ this.headingElements.clear(), e.querySelectorAll("wsx-marked-heading").forEach((o) => {
1257
+ const x = o.querySelector("h1, h2, h3, h4, h5, h6");
1258
+ x instanceof HTMLElement && x.id && this.headingElements.set(x.id, x);
1259
+ }), e.querySelectorAll(":scope > h1, :scope > h2, :scope > h3, :scope > h4, :scope > h5, :scope > h6").forEach((o) => {
1260
+ var x;
1261
+ if (o instanceof HTMLElement)
1262
+ if (o.id)
1263
+ this.headingElements.set(o.id, o);
1264
+ else {
1265
+ const u = ((x = o.textContent) == null ? void 0 : x.trim()) || "";
1266
+ if (u) {
1267
+ const w = this.generateId(u);
1268
+ o.id = w, this.headingElements.set(w, o);
1269
+ }
1270
+ }
1240
1271
  });
1241
1272
  }
1242
1273
  /**
1243
1274
  * 生成锚点 ID
1275
+ * 必须与服务端 toc.ts 和 marked-utils.ts 中的 generateId 保持一致
1276
+ * 保留中文等 Unicode 字符,只移除特殊符号
1244
1277
  */
1245
1278
  generateId(e) {
1246
- return e.toLowerCase().replace(/[^\w\s-]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-").trim();
1279
+ return e.toLowerCase().replace(/\s+/g, "-").replace(/[^\p{L}\p{N}-]/gu, "").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
1247
1280
  }
1248
1281
  /**
1249
1282
  * 设置滚动观察器,高亮当前可见的标题
1250
1283
  */
1251
1284
  setupScrollObserver() {
1252
1285
  "IntersectionObserver" in window && (this.observer = new IntersectionObserver((e) => {
1253
- const r = e.filter((n) => n.isIntersecting);
1254
- r.length > 0 && (r.sort((n, u) => {
1255
- const C = n.boundingClientRect.top, g = u.boundingClientRect.top;
1256
- return Math.abs(C) - Math.abs(g);
1286
+ const r = e.filter((d) => d.isIntersecting);
1287
+ r.length > 0 && (r.sort((d, o) => {
1288
+ const x = d.boundingClientRect.top, u = o.boundingClientRect.top;
1289
+ return Math.abs(x) - Math.abs(u);
1257
1290
  }), this.activeId = r[0].target.id);
1258
1291
  }, {
1259
1292
  rootMargin: "-100px 0px -80% 0px",
@@ -1267,20 +1300,20 @@ class pt extends X {
1267
1300
  * 渲染 TOC 项
1268
1301
  */
1269
1302
  renderTOCItem(e) {
1270
- const r = this.activeId === e.id, n = e.children.length > 0;
1271
- return /* @__PURE__ */ x("li", { class: `doc-toc-item doc-toc-item-level-${e.level}` }, /* @__PURE__ */ x("a", { href: `#${e.id}`, class: `doc-toc-link ${r ? "active" : ""}`, onClick: (u) => this.handleTOCClick(e.id, u) }, e.text), n && /* @__PURE__ */ x("ul", { class: "doc-toc-list doc-toc-sublist" }, e.children.map((u) => this.renderTOCItem(u))));
1303
+ const r = this.activeId === e.id, d = e.children.length > 0;
1304
+ return /* @__PURE__ */ C("li", { class: `doc-toc-item doc-toc-item-level-${e.level}` }, /* @__PURE__ */ C("a", { href: `#${e.id}`, class: `doc-toc-link ${r ? "active" : ""}`, onClick: (o) => this.handleTOCClick(e.id, o) }, e.text), d && /* @__PURE__ */ C("ul", { class: "doc-toc-list doc-toc-sublist" }, e.children.map((o) => this.renderTOCItem(o))));
1272
1305
  }
1273
1306
  render() {
1274
- return this.items.length === 0 ? /* @__PURE__ */ x("aside", { class: "doc-toc" }, /* @__PURE__ */ x("div", { class: "doc-toc-empty" }, "暂无目录")) : /* @__PURE__ */ x("aside", { class: "doc-toc" }, /* @__PURE__ */ x("h3", { class: "doc-toc-title" }, "目录"), /* @__PURE__ */ x("nav", { class: "doc-toc-nav" }, /* @__PURE__ */ x("ul", { class: "doc-toc-list" }, this.items.map((e) => this.renderTOCItem(e)))));
1307
+ return this.items.length === 0 ? /* @__PURE__ */ C("aside", { class: "doc-toc" }, /* @__PURE__ */ C("div", { class: "doc-toc-empty" }, "暂无目录")) : /* @__PURE__ */ C("aside", { class: "doc-toc" }, /* @__PURE__ */ C("h3", { class: "doc-toc-title" }, "目录"), /* @__PURE__ */ C("nav", { class: "doc-toc-nav" }, /* @__PURE__ */ C("ul", { class: "doc-toc-list" }, this.items.map((e) => this.renderTOCItem(e)))));
1275
1308
  }
1276
1309
  }
1277
- qe = pt;
1278
- [mt, Fe] = dt(qe, [], Ne, 0, void 0, X).c;
1279
- Fe();
1310
+ Fe = pt;
1311
+ [mt, He] = ut(Fe, [], Ne, 0, void 0, X).c;
1312
+ He();
1280
1313
  export {
1281
- rt as DocLayout,
1282
- Be as DocPage,
1283
- Xe as DocSearch,
1284
- ct as DocSidebar,
1314
+ it as DocLayout,
1315
+ Ye as DocPage,
1316
+ Ze as DocSearch,
1317
+ lt as DocSidebar,
1285
1318
  mt as DocTOC
1286
1319
  };