@qingwu-ui/ai-editor 1.1.7 → 1.1.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
@@ -6,60 +6,60 @@ import { Suspense as v, lazy as y, useCallback as b, useEffect as x, useLayoutEf
6
6
  import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
7
7
  import { generateText as k, streamText as A } from "ai";
8
8
  import { DOMParser as j, Fragment as M, Slice as N } from "@tiptap/pm/model";
9
- import { EditorContent as P, NodeViewWrapper as F, ReactNodeViewRenderer as I, ReactRenderer as L, useEditor as ee } from "@tiptap/react";
10
- import { BubbleMenu as te } from "@tiptap/react/menus";
11
- import { createPortal as R } from "react-dom";
12
- import { Extension as z, InputRule as ne, Node as re, markInputRule as B } from "@tiptap/core";
13
- import { NodeSelection as V, Plugin as H, PluginKey as U, TextSelection as ie } from "@tiptap/pm/state";
14
- import { Decoration as ae, DecorationSet as W } from "@tiptap/pm/view";
15
- import { Image as G } from "@tiptap/extension-image";
16
- import { Link as oe } from "@tiptap/extension-link";
17
- import { Underline as K } from "@tiptap/extension-underline";
18
- import q from "@tiptap/starter-kit";
19
- import { CharacterCount as se } from "@tiptap/extension-character-count";
20
- import { Color as J } from "@tiptap/extension-color";
21
- import { Highlight as ce } from "@tiptap/extension-highlight";
22
- import { HorizontalRule as le } from "@tiptap/extension-horizontal-rule";
23
- import { Placeholder as ue } from "@tiptap/extension-placeholder";
24
- import { Table as de } from "@tiptap/extension-table";
25
- import { TableCell as fe } from "@tiptap/extension-table-cell";
26
- import { TableHeader as pe } from "@tiptap/extension-table-header";
27
- import { TableRow as me } from "@tiptap/extension-table-row";
28
- import { TaskItem as he } from "@tiptap/extension-task-item";
29
- import { TaskList as ge } from "@tiptap/extension-task-list";
30
- import { TextStyle as _e } from "@tiptap/extension-text-style";
31
- import { Markdown as ve } from "tiptap-markdown";
32
- import { CodeBlockLowlight as ye } from "@tiptap/extension-code-block-lowlight";
33
- import be from "highlight.js/lib/languages/dockerfile";
34
- import { common as xe, createLowlight as Se } from "lowlight";
35
- import Ce from "katex";
36
- import we, { exitSuggestion as Te, findSuggestionMatch as Ee } from "@tiptap/suggestion";
9
+ import { EditorContent as ee, NodeViewWrapper as P, ReactNodeViewRenderer as F, ReactRenderer as I, useEditor as te } from "@tiptap/react";
10
+ import { BubbleMenu as ne } from "@tiptap/react/menus";
11
+ import { createPortal as L } from "react-dom";
12
+ import { Extension as R, InputRule as re, Node as ie, markInputRule as z } from "@tiptap/core";
13
+ import { NodeSelection as B, Plugin as V, PluginKey as H, TextSelection as ae } from "@tiptap/pm/state";
14
+ import { Decoration as oe, DecorationSet as U } from "@tiptap/pm/view";
15
+ import { Image as W } from "@tiptap/extension-image";
16
+ import { Link as se } from "@tiptap/extension-link";
17
+ import { Underline as ce } from "@tiptap/extension-underline";
18
+ import G from "@tiptap/starter-kit";
19
+ import { CharacterCount as K } from "@tiptap/extension-character-count";
20
+ import { Color as le } from "@tiptap/extension-color";
21
+ import { Highlight as ue } from "@tiptap/extension-highlight";
22
+ import { HorizontalRule as de } from "@tiptap/extension-horizontal-rule";
23
+ import { Placeholder as fe } from "@tiptap/extension-placeholder";
24
+ import { Table as pe } from "@tiptap/extension-table";
25
+ import { TableCell as me } from "@tiptap/extension-table-cell";
26
+ import { TableHeader as he } from "@tiptap/extension-table-header";
27
+ import { TableRow as ge } from "@tiptap/extension-table-row";
28
+ import { TaskItem as q } from "@tiptap/extension-task-item";
29
+ import { TaskList as _e } from "@tiptap/extension-task-list";
30
+ import { TextStyle as ve } from "@tiptap/extension-text-style";
31
+ import { Markdown as ye } from "tiptap-markdown";
32
+ import { CodeBlockLowlight as be } from "@tiptap/extension-code-block-lowlight";
33
+ import xe from "highlight.js/lib/languages/dockerfile";
34
+ import { common as Se, createLowlight as Ce } from "lowlight";
35
+ import we from "katex";
36
+ import Te, { exitSuggestion as Ee, findSuggestionMatch as De } from "@tiptap/suggestion";
37
37
  // ../text-layout/dist/index.mjs
38
- var De = null, Oe = null;
39
- function ke() {
40
- return Oe || (typeof document > "u" ? null : (De = document.createElement("canvas"), Oe = De.getContext("2d"), Oe));
41
- }
42
- var Ae = /* @__PURE__ */ new Map();
43
- function je(e, t) {
44
- let n = Ae.get(t);
45
- n || (n = /* @__PURE__ */ new Map(), Ae.set(t, n));
38
+ var Oe = null, ke = null;
39
+ function Ae() {
40
+ return ke || (typeof document > "u" ? null : (Oe = document.createElement("canvas"), ke = Oe.getContext("2d"), ke));
41
+ }
42
+ var je = /* @__PURE__ */ new Map();
43
+ function Me(e, t) {
44
+ let n = je.get(t);
45
+ n || (n = /* @__PURE__ */ new Map(), je.set(t, n));
46
46
  let r = n.get(e);
47
47
  if (r !== void 0) return r;
48
- let i = ke();
49
- return i ? (i.font = t, r = i.measureText(e).width) : r = Me(e, t), n.set(e, r), r;
48
+ let i = Ae();
49
+ return i ? (i.font = t, r = i.measureText(e).width) : r = Ne(e, t), n.set(e, r), r;
50
50
  }
51
- function Me(e, t) {
51
+ function Ne(e, t) {
52
52
  let n = parseFloat(t) || 16, r = 0;
53
- for (let t of e) Ne(t.codePointAt(0) ?? 0) ? r += n : r += t === " " ? n * .3 : n * .55;
53
+ for (let t of e) Pe(t.codePointAt(0) ?? 0) ? r += n : r += t === " " ? n * .3 : n * .55;
54
54
  return r;
55
55
  }
56
- function Ne(e) {
56
+ function Pe(e) {
57
57
  return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 63744 && e <= 64255 || e >= 194560 && e <= 195103 || e >= 12288 && e <= 12351 || e >= 65280 && e <= 65519 || e >= 11904 && e <= 12031 || e >= 12736 && e <= 12783 || e >= 44032 && e <= 55215;
58
58
  }
59
- function Pe(e) {
59
+ function Fe(e) {
60
60
  return e === 12289 || e === 12290 || e === 65292 || e === 65294 || e === 65306 || e === 65307 || e === 65311 || e === 65281 || e === 65289 || e === 65341 || e === 12301 || e === 12303 || e === 12299 || e === 12305;
61
61
  }
62
- function Fe(e, t) {
62
+ function Ie(e, t) {
63
63
  let n = [], r = [];
64
64
  if (typeof Intl < "u" && Intl.Segmenter) try {
65
65
  let t = new Intl.Segmenter("zh", { granularity: "grapheme" });
@@ -70,27 +70,27 @@ function Fe(e, t) {
70
70
  else r = [...e];
71
71
  for (let e of r) {
72
72
  let r = e.codePointAt(0) ?? 0, i = "latin";
73
- e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : Ne(r) && (i = Pe(r) ? "punct" : "cjk"), n.push({
73
+ e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : Pe(r) && (i = Fe(r) ? "punct" : "cjk"), n.push({
74
74
  text: e,
75
- width: je(e, t),
75
+ width: Me(e, t),
76
76
  type: i
77
77
  });
78
78
  }
79
79
  return n;
80
80
  }
81
- function Ie(e, t, n) {
81
+ function Le(e, t, n) {
82
82
  let r = 0, i = Math.min(n, e.length);
83
83
  for (let n = t; n < i; n++) r += e[n].width;
84
84
  return r;
85
85
  }
86
- function Y(e, t, n, r) {
86
+ function Re(e, t, n, r) {
87
87
  return {
88
88
  text: e.slice(t, Math.min(n, e.length)).map((e) => e.text).join(""),
89
89
  width: r
90
90
  };
91
91
  }
92
- function Le(e, t, n = "16px system-ui") {
93
- let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = Fe(e, n), c = [], l = {
92
+ function J(e, t, n = "16px system-ui") {
93
+ let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = Ie(e, n), c = [], l = {
94
94
  lineStart: 0,
95
95
  lineWidth: 0,
96
96
  lastBreakIdx: -1,
@@ -99,22 +99,22 @@ function Le(e, t, n = "16px system-ui") {
99
99
  for (let e = 0; e < s.length; e++) {
100
100
  let t = s[e];
101
101
  if (t.type === "break") {
102
- c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
102
+ c.push(Re(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
103
103
  continue;
104
104
  }
105
105
  let n = l.lineWidth + t.width;
106
106
  if (t.type === "space") {
107
- if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ie(s, l.lineStart, e + 1)) : (c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width), l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
107
+ if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(Re(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Le(s, l.lineStart, e + 1)) : (c.push(Re(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width), l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
108
108
  } else if (t.type === "cjk") {
109
- if (n > r && l.lineWidth > 0 ? (c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width, l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
109
+ if (n > r && l.lineWidth > 0 ? (c.push(Re(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width, l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
110
110
  } else if (t.type === "punct") {
111
- if (l.lineWidth === 0 && c.length > 0 ? c[c.length - 1].text.length > 0 && (l.lineWidth = t.width) : n > r ? (l.lastBreakIdx >= 0 ? (c.push(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ie(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
112
- } else if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ie(s, l.lineStart, e + 1), l.lastBreakIdx = -1) : o === "break-word" ? (c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width) : l.lineWidth = n : l.lineWidth = n, a && c.length >= a) break;
111
+ if (l.lineWidth === 0 && c.length > 0 ? c[c.length - 1].text.length > 0 && (l.lineWidth = t.width) : n > r ? (l.lastBreakIdx >= 0 ? (c.push(Re(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Le(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
112
+ } else if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(Re(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Le(s, l.lineStart, e + 1), l.lastBreakIdx = -1) : o === "break-word" ? (c.push(Re(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width) : l.lineWidth = n : l.lineWidth = n, a && c.length >= a) break;
113
113
  }
114
114
  let u = l.lineStart < s.length;
115
115
  if (u && (!a || c.length < a)) {
116
- let e = Ie(s, l.lineStart, s.length);
117
- c.push(Y(s, l.lineStart, s.length, e));
116
+ let e = Le(s, l.lineStart, s.length);
117
+ c.push(Re(s, l.lineStart, s.length, e));
118
118
  }
119
119
  return {
120
120
  lines: c,
@@ -124,38 +124,38 @@ function Le(e, t, n = "16px system-ui") {
124
124
  };
125
125
  }
126
126
  // ../toast/dist/index.mjs
127
- var Re = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, ze = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
128
- function Be() {
127
+ var ze = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, Be = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
128
+ function Ve() {
129
129
  if (typeof window > "u") return 290;
130
130
  let e = window.innerWidth;
131
131
  return e <= 480 ? Math.max(140, e - 98) : 290;
132
132
  }
133
- var Ve = {
133
+ var He = {
134
134
  info: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>",
135
135
  success: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9 12l2 2 4-4\"/></svg>",
136
136
  warning: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>",
137
137
  error: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"/><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"/></svg>"
138
- }, He = 1;
139
- function X() {
140
- return `qt${He++}${Date.now().toString(36)}`;
138
+ }, Ue = 1;
139
+ function We() {
140
+ return `qt${Ue++}${Date.now().toString(36)}`;
141
141
  }
142
- function Ue(e, t, n) {
142
+ function Y(e, t, n) {
143
143
  let r = document.createElement(e);
144
144
  return t && (r.className = t), n != null && (r.innerHTML = n), r;
145
145
  }
146
- function We(e, t) {
146
+ function Ge(e, t) {
147
147
  let n = t.split(/\*\*(.+?)\*\*/g);
148
148
  for (let t = 0; t < n.length; t++) {
149
149
  let r = n[t];
150
150
  if (r) {
151
151
  if (t % 2 == 1) {
152
- let t = Ue("em", "qt-mark");
152
+ let t = Y("em", "qt-mark");
153
153
  t.textContent = r, e.appendChild(t);
154
154
  } else e.appendChild(document.createTextNode(r));
155
155
  }
156
156
  }
157
157
  }
158
- var Ge = {
158
+ var Ke = {
159
159
  type: "info",
160
160
  position: "top-center",
161
161
  duration: 4e3,
@@ -164,19 +164,19 @@ var Ge = {
164
164
  persistMaxVisible: 3,
165
165
  maxLines: void 0,
166
166
  vibrate: !0
167
- }, Ke = [
167
+ }, qe = [
168
168
  80,
169
169
  40,
170
170
  80
171
171
  ];
172
- function qe() {
172
+ function X() {
173
173
  if (typeof navigator < "u" && "vibrate" in navigator) try {
174
- navigator.vibrate(Ke);
174
+ navigator.vibrate(qe);
175
175
  } catch {}
176
176
  }
177
177
  var Je = class {
178
178
  containers = /* @__PURE__ */ new Map();
179
- opts = { ...Ge };
179
+ opts = { ...Ke };
180
180
  toasts = /* @__PURE__ */ new Map();
181
181
  queue = [];
182
182
  _seq = 0;
@@ -185,10 +185,10 @@ var Je = class {
185
185
  }
186
186
  ensureContainer(e) {
187
187
  let t = this.containers.get(e);
188
- return t || (t = Ue("div", "qt-container"), t.setAttribute("data-qt-pos", e), t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "false"), document.body.appendChild(t), this.containers.set(e, t)), t;
188
+ return t || (t = Y("div", "qt-container"), t.setAttribute("data-qt-pos", e), t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "false"), document.body.appendChild(t), this.containers.set(e, t)), t;
189
189
  }
190
190
  show(e, t) {
191
- let n = t?.type ?? this.opts.type, r = t?.position ?? this.opts.position, i = t?.persist ?? this.opts.persist ? 0 : t?.duration ?? this.opts.duration, a = t?.dismissible ?? !0, o = t?.maxLines ?? this.opts.maxLines, s = t?.description, c = t?.action, l = X(), u = {
191
+ let n = t?.type ?? this.opts.type, r = t?.position ?? this.opts.position, i = t?.persist ?? this.opts.persist ? 0 : t?.duration ?? this.opts.duration, a = t?.dismissible ?? !0, o = t?.maxLines ?? this.opts.maxLines, s = t?.description, c = t?.action, l = We(), u = {
192
192
  id: l,
193
193
  type: n,
194
194
  dismissible: a,
@@ -271,30 +271,30 @@ var Je = class {
271
271
  this.containers.clear();
272
272
  }
273
273
  buildElement(e, t, n, r, i, a, o) {
274
- let s = Ue("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
274
+ let s = Y("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
275
275
  s.setAttribute("data-qt-id", e);
276
- let c = Ue("span", "qt-icon");
277
- c.innerHTML = Ve[n], s.appendChild(c);
278
- let l = Ue("div", "qt-body"), u = Ue("span", "qt-msg"), d = Le(t, {
279
- maxWidth: Be(),
276
+ let c = Y("span", "qt-icon");
277
+ c.innerHTML = He[n], s.appendChild(c);
278
+ let l = Y("div", "qt-body"), u = Y("span", "qt-msg"), d = J(t, {
279
+ maxWidth: Ve(),
280
280
  lineHeight: 1,
281
281
  maxLines: i
282
- }, ze);
283
- if (d.lineCount <= 1 ? We(u, t) : d.lines.forEach((e, t) => {
284
- let n = Ue("span", "qt-line"), r = e.text;
285
- t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"), We(n, r), u.appendChild(n);
282
+ }, Be);
283
+ if (d.lineCount <= 1 ? Ge(u, t) : d.lines.forEach((e, t) => {
284
+ let n = Y("span", "qt-line"), r = e.text;
285
+ t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"), Ge(n, r), u.appendChild(n);
286
286
  }), l.appendChild(u), a) {
287
- let e = Ue("div", "qt-desc");
287
+ let e = Y("div", "qt-desc");
288
288
  e.textContent = a, l.appendChild(e);
289
289
  }
290
290
  if (s.appendChild(l), o) {
291
- let t = Ue("button", "qt-action");
291
+ let t = Y("button", "qt-action");
292
292
  t.type = "button", t.textContent = o.label, t.addEventListener("click", (t) => {
293
293
  t.stopPropagation(), this.dismiss(e), o.onClick();
294
294
  }), s.appendChild(t);
295
295
  }
296
296
  if (r) {
297
- let t = Ue("button", "qt-close", "<svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><path d=\"M18 6 6 18M6 6l12 12\"/></svg>");
297
+ let t = Y("button", "qt-close", "<svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><path d=\"M18 6 6 18M6 6l12 12\"/></svg>");
298
298
  t.type = "button", t.setAttribute("aria-label", "关闭通知"), t.addEventListener("click", (t) => {
299
299
  t.stopPropagation(), this.dismiss(e);
300
300
  }), s.appendChild(t);
@@ -306,7 +306,7 @@ var Je = class {
306
306
  mount(e) {
307
307
  e.duration === 0 && this.evictPersistIfNeeded(e);
308
308
  let t = this.ensureContainer(e.position);
309
- this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate && qe(), requestAnimationFrame(() => {
309
+ this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate && X(), requestAnimationFrame(() => {
310
310
  requestAnimationFrame(() => {
311
311
  e.element.classList.add("qt-enter");
312
312
  });
@@ -328,7 +328,7 @@ var Je = class {
328
328
  let t = () => {
329
329
  e.element.remove(), this.toasts.delete(e.id), this._dequeue();
330
330
  };
331
- if (Re) t();
331
+ if (ze) t();
332
332
  else {
333
333
  let n = !1, r = () => {
334
334
  n || (n = !0, t());
@@ -830,41 +830,41 @@ var ft = 84, pt = 3e3, mt = ({ editor: e, className: t = "", onClose: n }) => {
830
830
  for (let i of n) r && e.set(i.id, r), t(i.children, i.id);
831
831
  };
832
832
  return t(A, ""), e;
833
- }, [A]), N = l.trim().length > 0, P = C(() => N ? ct(A, l.trim()) : A, [
833
+ }, [A]), N = l.trim().length > 0, ee = C(() => N ? ct(A, l.trim()) : A, [
834
834
  A,
835
835
  N,
836
836
  l
837
- ]), F = C(() => st(P, N ? /* @__PURE__ */ new Set() : s), [
838
- P,
837
+ ]), P = C(() => st(ee, N ? /* @__PURE__ */ new Set() : s), [
838
+ ee,
839
839
  s,
840
840
  N
841
- ]), I = C(() => new Set(F.map((e) => e.id)), [F]), L = C(() => {
841
+ ]), F = C(() => new Set(P.map((e) => e.id)), [P]), I = C(() => {
842
842
  let e = a;
843
- for (; e && !I.has(e);) e = M.get(e) ?? "";
843
+ for (; e && !F.has(e);) e = M.get(e) ?? "";
844
844
  return e;
845
845
  }, [
846
846
  a,
847
- I,
847
+ F,
848
848
  M
849
849
  ]);
850
850
  x(() => {
851
851
  let e = p.current;
852
- if (!e || !L) return;
852
+ if (!e || !I) return;
853
853
  let t = e.closest(".toc-scroll");
854
854
  if (!(t instanceof HTMLElement)) return;
855
- let n = e.querySelector(`[data-toc-id="${CSS.escape(L)}"]`);
855
+ let n = e.querySelector(`[data-toc-id="${CSS.escape(I)}"]`);
856
856
  if (!n) return;
857
857
  let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
858
858
  i.top < r.top + 8 ? t.scrollTop -= r.top + 8 - i.top : i.bottom > r.bottom - 8 && (t.scrollTop += i.bottom - (r.bottom - 8));
859
- }, [L]);
860
- let ee = b((e) => {
859
+ }, [I]);
860
+ let te = b((e) => {
861
861
  c((t) => {
862
862
  let n = new Set(t);
863
863
  return n.has(e) ? n.delete(e) : n.add(e), n;
864
864
  });
865
- }, []), te = b(() => {
865
+ }, []), ne = b(() => {
866
866
  c(new Set(j));
867
- }, [j]), R = b(() => {
867
+ }, [j]), L = b(() => {
868
868
  c(/* @__PURE__ */ new Set());
869
869
  }, []);
870
870
  return r.length ? /* @__PURE__ */ O("nav", {
@@ -935,7 +935,7 @@ var ft = 84, pt = 3e3, mt = ({ editor: e, className: t = "", onClose: n }) => {
935
935
  children: [/* @__PURE__ */ D("button", {
936
936
  type: "button",
937
937
  className: "toc-action-btn",
938
- onClick: te,
938
+ onClick: ne,
939
939
  title: "全部折叠",
940
940
  "aria-label": "全部折叠",
941
941
  disabled: N,
@@ -956,7 +956,7 @@ var ft = 84, pt = 3e3, mt = ({ editor: e, className: t = "", onClose: n }) => {
956
956
  }), /* @__PURE__ */ D("button", {
957
957
  type: "button",
958
958
  className: "toc-action-btn",
959
- onClick: R,
959
+ onClick: L,
960
960
  title: "全部展开",
961
961
  "aria-label": "全部展开",
962
962
  disabled: N,
@@ -1027,22 +1027,22 @@ var ft = 84, pt = 3e3, mt = ({ editor: e, className: t = "", onClose: n }) => {
1027
1027
  })
1028
1028
  ]
1029
1029
  }),
1030
- F.length === 0 ? /* @__PURE__ */ D("div", {
1030
+ P.length === 0 ? /* @__PURE__ */ D("div", {
1031
1031
  className: "toc-search__empty",
1032
1032
  children: N ? `未找到"${l.trim()}"相关标题` : "文档暂无标题"
1033
1033
  }) : /* @__PURE__ */ D("ul", {
1034
1034
  className: "toc-list",
1035
- children: F.map((e) => {
1035
+ children: P.map((e) => {
1036
1036
  let t = j.has(e.id), n = s.has(e.id);
1037
1037
  return /* @__PURE__ */ O("li", {
1038
1038
  "data-toc-id": e.id,
1039
- className: `toc-item ${L === e.id ? "is-active" : ""}`,
1039
+ className: `toc-item ${I === e.id ? "is-active" : ""}`,
1040
1040
  style: { paddingLeft: `${(e.level - 1) * 12 + 12}px` },
1041
1041
  children: [t ? /* @__PURE__ */ D("button", {
1042
1042
  type: "button",
1043
1043
  className: `toc-toggle ${n ? "is-collapsed" : "is-expanded"}`,
1044
1044
  onClick: (t) => {
1045
- t.stopPropagation(), ee(e.id);
1045
+ t.stopPropagation(), te(e.id);
1046
1046
  },
1047
1047
  title: n ? "展开子标题" : "折叠子标题",
1048
1048
  "aria-label": n ? "展开子标题" : "折叠子标题",
@@ -1235,7 +1235,7 @@ var wt = {
1235
1235
  wholeWord: !1,
1236
1236
  matches: [],
1237
1237
  currentIndex: -1
1238
- }, Tt = new U("search-highlight");
1238
+ }, Tt = new H("search-highlight");
1239
1239
  function Et(e) {
1240
1240
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1241
1241
  }
@@ -1257,9 +1257,9 @@ function Dt(e, t) {
1257
1257
  }), c;
1258
1258
  }
1259
1259
  function Ot(e, t) {
1260
- if (t.matches.length === 0) return W.empty;
1261
- let n = t.matches.map((e, n) => ae.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
1262
- return W.create(e, n);
1260
+ if (t.matches.length === 0) return U.empty;
1261
+ let n = t.matches.map((e, n) => oe.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
1262
+ return U.create(e, n);
1263
1263
  }
1264
1264
  function kt(e, t) {
1265
1265
  if (t.currentIndex < 0 || t.currentIndex >= t.matches.length) return;
@@ -1286,10 +1286,10 @@ function kt(e, t) {
1286
1286
  } catch {}
1287
1287
  });
1288
1288
  }
1289
- var At = z.create({
1289
+ var At = R.create({
1290
1290
  name: "searchHighlight",
1291
1291
  addProseMirrorPlugins() {
1292
- return [new H({
1292
+ return [new V({
1293
1293
  key: Tt,
1294
1294
  state: {
1295
1295
  init: () => wt,
@@ -1314,7 +1314,7 @@ var At = z.create({
1314
1314
  },
1315
1315
  props: { decorations(e) {
1316
1316
  let t = Tt.getState(e);
1317
- return t ? Ot(e.doc, t) : W.empty;
1317
+ return t ? Ot(e.doc, t) : U.empty;
1318
1318
  } }
1319
1319
  })];
1320
1320
  },
@@ -1807,7 +1807,7 @@ function cn(e, t) {
1807
1807
  let n = an(e, t);
1808
1808
  if (n && n.size > 0) {
1809
1809
  let t = e.state.tr;
1810
- t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(ie.create(t.doc, t.doc.content.size)), e.view.dispatch(t.scrollIntoView()), e.commands.focus();
1810
+ t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(ae.create(t.doc, t.doc.content.size)), e.view.dispatch(t.scrollIntoView()), e.commands.focus();
1811
1811
  } else e.commands.setContent(t), e.commands.focus();
1812
1812
  }
1813
1813
  function ln(e, t, n, r) {
@@ -2178,7 +2178,7 @@ function wn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
2178
2178
  o
2179
2179
  ]), x(() => {
2180
2180
  e || c(!1);
2181
- }, [e]), u || !e ? null : R(/* @__PURE__ */ D("div", {
2181
+ }, [e]), u || !e ? null : L(/* @__PURE__ */ D("div", {
2182
2182
  className: "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none",
2183
2183
  onClick: () => {
2184
2184
  s || o();
@@ -2238,14 +2238,14 @@ function Tn(e) {
2238
2238
  return /^(\.\.?\/|[a-zA-Z]:\\|file:\/\/)/.test(e) ? !0 : !(/^[a-z]+:\/\//i.test(e) || e.startsWith("/") || e.startsWith("data:") || e.startsWith("blob:"));
2239
2239
  }
2240
2240
  function En({ node: e, deleteNode: t, editor: r }) {
2241
- let [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(!1), u = w(!1), [d, f] = T(!1), p = e.attrs.src || "", m = e.attrs.alt || "", h = e.attrs.width || null, g = e.attrs.height || null, _ = w(null), v = w(null), y = w(null), S = w(null), C = w(null), E = w(!1), k = w(!1), A = w(0), [j, M] = T(p), N = r?.isEditable ?? !0, P = b(() => {
2241
+ let [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(!1), u = w(!1), [d, f] = T(!1), p = e.attrs.src || "", m = e.attrs.alt || "", h = e.attrs.width || null, g = e.attrs.height || null, _ = w(null), v = w(null), y = w(null), S = w(null), C = w(null), E = w(!1), k = w(!1), A = w(0), [j, M] = T(p), N = r?.isEditable ?? !0, ee = b(() => {
2242
2242
  o || (A.current = window.scrollY, a(!0));
2243
- }, [o]), I = b(() => {
2243
+ }, [o]), F = b(() => {
2244
2244
  a(!1), requestAnimationFrame(() => window.scrollTo(0, A.current));
2245
- }, []), L = b(() => {
2245
+ }, []), I = b(() => {
2246
2246
  let e = _.current;
2247
2247
  e && (A.current = window.scrollY, e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen && e.webkitRequestFullscreen());
2248
- }, []), ee = b(() => {
2248
+ }, []), te = b(() => {
2249
2249
  let e = v.current;
2250
2250
  e && (A.current = window.scrollY, e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen && e.webkitRequestFullscreen());
2251
2251
  }, []);
@@ -2290,13 +2290,13 @@ function En({ node: e, deleteNode: t, editor: r }) {
2290
2290
  };
2291
2291
  return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
2292
2292
  }, []);
2293
- let te = o || Tn(p);
2294
- return /* @__PURE__ */ O(F, {
2293
+ let ne = o || Tn(p);
2294
+ return /* @__PURE__ */ O(P, {
2295
2295
  as: "div",
2296
2296
  className: "image-node-view group/img",
2297
2297
  contentEditable: !1,
2298
2298
  children: [
2299
- te ? /* @__PURE__ */ O("div", {
2299
+ ne ? /* @__PURE__ */ O("div", {
2300
2300
  className: "image-placeholder",
2301
2301
  children: [
2302
2302
  N && /* @__PURE__ */ D("button", {
@@ -2351,7 +2351,7 @@ function En({ node: e, deleteNode: t, editor: r }) {
2351
2351
  alt: m,
2352
2352
  width: h || void 0,
2353
2353
  height: g || void 0,
2354
- onClick: P,
2354
+ onClick: ee,
2355
2355
  onError: () => {
2356
2356
  E.current || o || (E.current = !0, (async () => {
2357
2357
  try {
@@ -2377,7 +2377,7 @@ function En({ node: e, deleteNode: t, editor: r }) {
2377
2377
  /* @__PURE__ */ D("button", {
2378
2378
  type: "button",
2379
2379
  className: "img-ctrl-btn",
2380
- onClick: P,
2380
+ onClick: ee,
2381
2381
  title: "网页全屏",
2382
2382
  children: /* @__PURE__ */ D("svg", {
2383
2383
  width: "14",
@@ -2396,7 +2396,7 @@ function En({ node: e, deleteNode: t, editor: r }) {
2396
2396
  /* @__PURE__ */ D("button", {
2397
2397
  type: "button",
2398
2398
  className: "img-ctrl-btn",
2399
- onClick: L,
2399
+ onClick: I,
2400
2400
  title: "全屏",
2401
2401
  children: /* @__PURE__ */ D("svg", {
2402
2402
  width: "14",
@@ -2436,15 +2436,15 @@ function En({ node: e, deleteNode: t, editor: r }) {
2436
2436
  ]
2437
2437
  })]
2438
2438
  }),
2439
- i && !te && /* @__PURE__ */ O("div", {
2439
+ i && !ne && /* @__PURE__ */ O("div", {
2440
2440
  className: "image-lightbox",
2441
- onClick: I,
2441
+ onClick: F,
2442
2442
  children: [/* @__PURE__ */ O("div", {
2443
2443
  className: "image-lightbox-bar",
2444
2444
  children: [/* @__PURE__ */ D("button", {
2445
2445
  type: "button",
2446
2446
  className: "image-lightbox-bar-btn",
2447
- onClick: ee,
2447
+ onClick: te,
2448
2448
  title: "全屏",
2449
2449
  children: /* @__PURE__ */ D("svg", {
2450
2450
  width: "18",
@@ -2462,7 +2462,7 @@ function En({ node: e, deleteNode: t, editor: r }) {
2462
2462
  }), /* @__PURE__ */ D("button", {
2463
2463
  type: "button",
2464
2464
  className: "image-lightbox-bar-btn",
2465
- onClick: I,
2465
+ onClick: F,
2466
2466
  title: "关闭",
2467
2467
  children: /* @__PURE__ */ D("svg", {
2468
2468
  width: "18",
@@ -2500,12 +2500,12 @@ function En({ node: e, deleteNode: t, editor: r }) {
2500
2500
  /* @__PURE__ */ D(wn, {
2501
2501
  open: d,
2502
2502
  title: "确认删除图片",
2503
- message: te ? "该图片无法在当前环境加载,仅从编辑器中移除该图片节点,不影响存储文件。" : "此操作将同时删除对象存储中的文件,不可撤销。",
2503
+ message: ne ? "该图片无法在当前环境加载,仅从编辑器中移除该图片节点,不影响存储文件。" : "此操作将同时删除对象存储中的文件,不可撤销。",
2504
2504
  onCancel: () => {
2505
2505
  $(!1), f(!1);
2506
2506
  },
2507
2507
  onConfirm: async () => {
2508
- if (!te) try {
2508
+ if (!ne) try {
2509
2509
  await qt(p);
2510
2510
  } catch {}
2511
2511
  $(!1), await new Promise((e) => setTimeout(e, 300)), t();
@@ -2849,73 +2849,73 @@ function zn(e, t, n) {
2849
2849
  });
2850
2850
  }
2851
2851
  function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
2852
- let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() => On.has(s)), [u, d] = T(null), [f, m] = T(null), [h, g] = T(!1), [_, y] = T(null), [S, E] = T(!1), [k, A] = T(null), j = w(null), M = w(null), N = w(null), P = w(0), I = w(!1), L = w(null), ee = w(0), [te, R] = T(!1), z = w(null), [ne, re] = T(0), [B, V] = T("none"), [H, U] = T(void 0), [ie, ae] = T(!1), W = e.attrs.src || "", G = e.attrs.name || W && W.split("/").pop()?.split("?")[0] || (W ? "attachment" : p("editor.attachment.lost")), oe = e.attrs.size || 0, K = Pn(G), q = !W;
2852
+ let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() => On.has(s)), [u, d] = T(null), [f, m] = T(null), [h, g] = T(!1), [_, y] = T(null), [S, E] = T(!1), [k, A] = T(null), j = w(null), M = w(null), N = w(null), ee = w(0), F = w(!1), I = w(null), te = w(0), [ne, L] = T(!1), R = w(null), [re, ie] = T(0), [z, B] = T("none"), [V, H] = T(void 0), [ae, oe] = T(!1), U = e.attrs.src || "", W = e.attrs.name || U && U.split("/").pop()?.split("?")[0] || (U ? "attachment" : p("editor.attachment.lost")), se = e.attrs.size || 0, ce = Pn(W), G = !U;
2853
2853
  x(() => {
2854
2854
  if (!c) {
2855
- U(void 0), ae(!1);
2855
+ H(void 0), oe(!1);
2856
2856
  return;
2857
2857
  }
2858
- let e = An[K];
2858
+ let e = An[ce];
2859
2859
  if (!e) {
2860
- U(void 0), ae(!1);
2860
+ H(void 0), oe(!1);
2861
2861
  return;
2862
2862
  }
2863
2863
  let t = !0;
2864
- return U(void 0), ae(!1), jn[e]().then((e) => {
2865
- t && U(e);
2864
+ return H(void 0), oe(!1), jn[e]().then((e) => {
2865
+ t && H(e);
2866
2866
  }).catch((n) => {
2867
- console.error(`[attachment] renderer "${e}" load failed:`, n), t && ae(!0);
2867
+ console.error(`[attachment] renderer "${e}" load failed:`, n), t && oe(!0);
2868
2868
  }), () => {
2869
2869
  t = !1;
2870
2870
  };
2871
- }, [c, K]);
2872
- let se = C(() => ({
2871
+ }, [c, ce]);
2872
+ let K = C(() => ({
2873
2873
  ...kn,
2874
- renderers: H ? [H] : [],
2874
+ renderers: V ? [V] : [],
2875
2875
  rendererMode: "replace"
2876
- }), [H]), J = b((e) => {
2876
+ }), [V]), le = b((e) => {
2877
2877
  l((t) => {
2878
2878
  let n = typeof e == "function" ? e(t) : e;
2879
- return W && (n ? On.add(W) : On.delete(W)), n;
2879
+ return U && (n ? On.add(U) : On.delete(U)), n;
2880
2880
  });
2881
- }, [W]);
2881
+ }, [U]);
2882
2882
  x(() => {
2883
- l(W ? On.has(W) : !1);
2884
- }, [W]);
2885
- let ce = b(() => {
2886
- I.current = !0, J(!0), window.setTimeout(() => {
2887
- window.scrollTo(0, P.current), L.current && (L.current.scrollTop = ee.current), I.current && J(!0), I.current = !1;
2883
+ l(U ? On.has(U) : !1);
2884
+ }, [U]);
2885
+ let ue = b(() => {
2886
+ F.current = !0, le(!0), window.setTimeout(() => {
2887
+ window.scrollTo(0, ee.current), I.current && (I.current.scrollTop = te.current), F.current && le(!0), F.current = !1;
2888
2888
  }, 0);
2889
- }, [J]), le = b(async () => {
2890
- B === "web" ? (V("none"), document.body.style.overflow = "", ce()) : (B === "native" && document.fullscreenElement && await document.exitFullscreen(), P.current = window.scrollY, ee.current = L.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", V("web"));
2891
- }, [B]), ue = b(async () => {
2889
+ }, [le]), de = b(async () => {
2890
+ z === "web" ? (B("none"), document.body.style.overflow = "", ue()) : (z === "native" && document.fullscreenElement && await document.exitFullscreen(), ee.current = window.scrollY, te.current = I.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", B("web"));
2891
+ }, [z]), fe = b(async () => {
2892
2892
  let e = M.current;
2893
- e && (B === "native" ? await document.exitFullscreen() : (B === "web" && (V("none"), document.body.style.overflow = ""), P.current = window.scrollY, ee.current = L.current?.scrollTop ?? 0, await e.requestFullscreen(), V("native")));
2894
- }, [B, ce]), de = b(() => {
2895
- B === "none" && (I.current || J((e) => !e));
2896
- }, [B]);
2893
+ e && (z === "native" ? await document.exitFullscreen() : (z === "web" && (B("none"), document.body.style.overflow = ""), ee.current = window.scrollY, te.current = I.current?.scrollTop ?? 0, await e.requestFullscreen(), B("native")));
2894
+ }, [z, ue]), pe = b(() => {
2895
+ z === "none" && (F.current || le((e) => !e));
2896
+ }, [z]);
2897
2897
  x(() => {
2898
2898
  let e = () => {
2899
- document.fullscreenElement || (B === "native" && V("none"), ce());
2899
+ document.fullscreenElement || (z === "native" && B("none"), ue());
2900
2900
  }, t = (e) => {
2901
- e.key === "Escape" && B === "web" && (V("none"), document.body.style.overflow = "", ce());
2901
+ e.key === "Escape" && z === "web" && (B("none"), document.body.style.overflow = "", ue());
2902
2902
  };
2903
2903
  return document.addEventListener("fullscreenchange", e), window.addEventListener("keydown", t), () => {
2904
2904
  document.removeEventListener("fullscreenchange", e), window.removeEventListener("keydown", t);
2905
2905
  };
2906
- }, [B, ce]), x(() => {
2906
+ }, [z, ue]), x(() => {
2907
2907
  let e = (e) => {
2908
2908
  if (e.key !== "Backspace" && e.key !== "Delete" || !o || !i || yn()) return;
2909
2909
  let t = a?.view?.dom, n = e.target;
2910
2910
  if (a?.isFocused && n instanceof Node && t?.contains(n)) {
2911
2911
  if (e.preventDefault(), e.stopPropagation(), a) {
2912
2912
  let { from: e, to: t } = a.state.selection;
2913
- z.current = {
2913
+ R.current = {
2914
2914
  from: e,
2915
2915
  to: t
2916
2916
  };
2917
2917
  }
2918
- window.getSelection()?.removeAllRanges(), $(!0), R(!0);
2918
+ window.getSelection()?.removeAllRanges(), $(!0), L(!0);
2919
2919
  }
2920
2920
  };
2921
2921
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
@@ -2924,29 +2924,29 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
2924
2924
  a,
2925
2925
  o
2926
2926
  ]), x(() => {
2927
- if (!c || !In(W)) {
2927
+ if (!c || !In(U)) {
2928
2928
  d(null), y(null), N.current = null;
2929
2929
  return;
2930
2930
  }
2931
- if (N.current === W) return;
2931
+ if (N.current === U) return;
2932
2932
  let e = new AbortController(), r = !0;
2933
2933
  return g(!0), y(null), (async () => {
2934
- let i = W.includes("?X-Amz-"), a = null, o = null;
2935
- if (!a && !i && (a = await Rn(W, e.signal)), !a && !i) try {
2936
- let n = await t(W);
2934
+ let i = U.includes("?X-Amz-"), a = null, o = null;
2935
+ if (!a && !i && (a = await Rn(U, e.signal)), !a && !i) try {
2936
+ let n = await t(U);
2937
2937
  n && (a = await Rn(n, e.signal) || await zn(n, void 0, e.signal));
2938
2938
  } catch (e) {
2939
2939
  console.warn("[attachment] signPreviewUrl failed:", e);
2940
2940
  }
2941
2941
  if (!a && !i) try {
2942
- let t = await n(W);
2942
+ let t = await n(U);
2943
2943
  if (t) {
2944
2944
  let n = { "X-Requested-With": "XMLHttpRequest" };
2945
2945
  t.forEach((e, t) => {
2946
2946
  n[t] = e;
2947
2947
  });
2948
2948
  try {
2949
- a = await zn(W, n, e.signal);
2949
+ a = await zn(U, n, e.signal);
2950
2950
  } catch (e) {
2951
2951
  console.warn("[attachment] signed headers XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
2952
2952
  }
@@ -2955,63 +2955,63 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
2955
2955
  console.warn("[attachment] signPreviewUrlHeaders failed:", e);
2956
2956
  }
2957
2957
  if (!a) try {
2958
- a = await zn(W, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
2958
+ a = await zn(U, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
2959
2959
  } catch (e) {
2960
2960
  console.warn("[attachment] plain XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
2961
2961
  }
2962
2962
  if (!a) throw o || /* @__PURE__ */ Error("所有 fetch 方法均失败");
2963
2963
  if (!r) return;
2964
- d(a), N.current = W;
2964
+ d(a), N.current = U;
2965
2965
  let s = URL.createObjectURL(new Blob([a], { type: "application/octet-stream" }));
2966
2966
  m(s), g(!1);
2967
2967
  })().catch((e) => {
2968
- r && (e instanceof DOMException && e.name === "AbortError" || (N.current === W ? g(!1) : y(e instanceof Error ? e.message : "附件读取失败,请检查对象存储 CORS 和公开访问权限")));
2968
+ r && (e instanceof DOMException && e.name === "AbortError" || (N.current === U ? g(!1) : y(e instanceof Error ? e.message : "附件读取失败,请检查对象存储 CORS 和公开访问权限")));
2969
2969
  }), () => {
2970
2970
  r = !1, e.abort();
2971
2971
  };
2972
- }, [c, W]), x(() => () => {
2972
+ }, [c, U]), x(() => () => {
2973
2973
  f && URL.revokeObjectURL(f), d(null);
2974
2974
  }, []), x(() => () => {
2975
2975
  f && URL.revokeObjectURL(f), m(null), d(null), N.current = null;
2976
- }, [W]), x(() => {
2976
+ }, [U]), x(() => {
2977
2977
  if (k !== "success" && k !== "error") return;
2978
2978
  let e = window.setTimeout(() => A(null), 2400);
2979
2979
  return () => window.clearTimeout(e);
2980
2980
  }, [k]);
2981
- let fe = b(async () => {
2981
+ let me = b(async () => {
2982
2982
  E(!0), A("loading");
2983
2983
  try {
2984
2984
  if (f) {
2985
2985
  let e = document.createElement("a");
2986
- e.href = f, e.download = G, document.body.appendChild(e), e.click(), document.body.removeChild(e), A("success");
2986
+ e.href = f, e.download = W, document.body.appendChild(e), e.click(), document.body.removeChild(e), A("success");
2987
2987
  return;
2988
2988
  }
2989
- let e = W.includes("?X-Amz-"), r = null;
2989
+ let e = U.includes("?X-Amz-"), r = null;
2990
2990
  if (!e) try {
2991
- let e = await t(W);
2991
+ let e = await t(U);
2992
2992
  e && (r = await fetch(e, { headers: { "X-Requested-With": "XMLHttpRequest" } }), r.ok || (r = null));
2993
2993
  } catch {}
2994
2994
  if (!r && !e) try {
2995
- let e = await n(W);
2996
- e && (r = await fetch(W, { headers: (() => {
2995
+ let e = await n(U);
2996
+ e && (r = await fetch(U, { headers: (() => {
2997
2997
  let t = new Headers(e);
2998
2998
  return t.set("X-Requested-With", "XMLHttpRequest"), t;
2999
2999
  })() }), r.ok || (r = null));
3000
3000
  } catch {}
3001
- if (r ||= await fetch(W, { headers: { "X-Requested-With": "XMLHttpRequest" } }), !r || !r.ok) throw Error("下载失败");
3001
+ if (r ||= await fetch(U, { headers: { "X-Requested-With": "XMLHttpRequest" } }), !r || !r.ok) throw Error("下载失败");
3002
3002
  let i = await r.blob(), a = URL.createObjectURL(i), o = document.createElement("a");
3003
- o.href = a, o.download = G, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(a), A("success");
3003
+ o.href = a, o.download = W, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(a), A("success");
3004
3004
  } catch (e) {
3005
3005
  console.error("[attachment] download failed:", e), A("error");
3006
3006
  } finally {
3007
3007
  E(!1);
3008
3008
  }
3009
3009
  }, [
3010
+ U,
3010
3011
  W,
3011
- G,
3012
3012
  f
3013
3013
  ]);
3014
- return /* @__PURE__ */ O(F, {
3014
+ return /* @__PURE__ */ O(P, {
3015
3015
  ref: j,
3016
3016
  as: "div",
3017
3017
  className: `attachment-embed group/att ${i ? "is-selected" : ""}`,
@@ -3028,7 +3028,7 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3028
3028
  className: "att-info",
3029
3029
  children: [/* @__PURE__ */ D("span", {
3030
3030
  className: "att-icon",
3031
- children: q ? /* @__PURE__ */ O("svg", {
3031
+ children: G ? /* @__PURE__ */ O("svg", {
3032
3032
  width: "22",
3033
3033
  height: "22",
3034
3034
  viewBox: "0 0 24 24",
@@ -3044,15 +3044,15 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3044
3044
  /* @__PURE__ */ D("path", { d: "M12 9v4" }),
3045
3045
  /* @__PURE__ */ D("path", { d: "M12 17h.01" })
3046
3046
  ]
3047
- }) : Nn(G)
3047
+ }) : Nn(W)
3048
3048
  }), /* @__PURE__ */ O("div", {
3049
3049
  className: "att-meta",
3050
3050
  children: [/* @__PURE__ */ D("span", {
3051
3051
  className: "att-name",
3052
- children: G
3053
- }), oe > 0 && /* @__PURE__ */ D("span", {
3052
+ children: W
3053
+ }), se > 0 && /* @__PURE__ */ D("span", {
3054
3054
  className: "att-size",
3055
- children: Mn(oe)
3055
+ children: Mn(se)
3056
3056
  })]
3057
3057
  })]
3058
3058
  }), /* @__PURE__ */ O("div", {
@@ -3105,11 +3105,11 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3105
3105
  }), /* @__PURE__ */ O("div", {
3106
3106
  className: "att-actions",
3107
3107
  children: [
3108
- W && Fn(G) && /* @__PURE__ */ D("button", {
3108
+ U && Fn(W) && /* @__PURE__ */ D("button", {
3109
3109
  type: "button",
3110
3110
  className: "att-btn",
3111
3111
  onMouseDown: (e) => {
3112
- e.preventDefault(), e.stopPropagation(), de();
3112
+ e.preventDefault(), e.stopPropagation(), pe();
3113
3113
  },
3114
3114
  title: p("editor.attachment.preview"),
3115
3115
  "aria-label": p("editor.attachment.preview"),
@@ -3135,8 +3135,8 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3135
3135
  /* @__PURE__ */ D("button", {
3136
3136
  type: "button",
3137
3137
  className: "att-btn",
3138
- onClick: fe,
3139
- disabled: S || q,
3138
+ onClick: me,
3139
+ disabled: S || G,
3140
3140
  title: S ? "正在准备下载" : p("editor.attachment.download"),
3141
3141
  "aria-label": S ? "正在准备下载" : p("editor.attachment.download"),
3142
3142
  children: /* @__PURE__ */ D("svg", {
@@ -3158,7 +3158,7 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3158
3158
  type: "button",
3159
3159
  className: "att-btn att-btn--del",
3160
3160
  onClick: () => {
3161
- o && !yn() && ($(!0), R(!0));
3161
+ o && !yn() && ($(!0), L(!0));
3162
3162
  },
3163
3163
  title: p("editor.attachment.delete"),
3164
3164
  "aria-label": p("editor.attachment.delete"),
@@ -3182,7 +3182,7 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3182
3182
  })]
3183
3183
  }), c && /* @__PURE__ */ O("div", {
3184
3184
  ref: M,
3185
- className: `att-preview-wrap ${B === "web" ? "is-web-fs" : ""}`,
3185
+ className: `att-preview-wrap ${z === "web" ? "is-web-fs" : ""}`,
3186
3186
  style: {
3187
3187
  position: "relative",
3188
3188
  height: 500,
@@ -3190,7 +3190,7 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3190
3190
  background: "#fff"
3191
3191
  },
3192
3192
  children: [/* @__PURE__ */ D("div", {
3193
- ref: L,
3193
+ ref: I,
3194
3194
  className: "att-preview-scroll",
3195
3195
  style: {
3196
3196
  height: "100%",
@@ -3199,7 +3199,7 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3199
3199
  children: h && !u && !f ? /* @__PURE__ */ D("div", {
3200
3200
  className: "flex items-center justify-center h-full text-default-400 text-sm",
3201
3201
  children: p("editor.attachment.loadingPreview")
3202
- }) : (_ || ie) && !u && !f ? /* @__PURE__ */ O("div", {
3202
+ }) : (_ || ae) && !u && !f ? /* @__PURE__ */ O("div", {
3203
3203
  className: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-default-500",
3204
3204
  children: [/* @__PURE__ */ D("div", {
3205
3205
  className: "font-medium text-default-700",
@@ -3214,15 +3214,15 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3214
3214
  style: { background: "#fff" },
3215
3215
  children: p("editor.attachment.loadingPreview")
3216
3216
  }),
3217
- children: u || f || W ? H ? /* @__PURE__ */ D(Dn, {
3217
+ children: u || f || U ? V ? /* @__PURE__ */ D(Dn, {
3218
3218
  buffer: u || void 0,
3219
- url: f || W,
3220
- name: G,
3221
- filename: G,
3222
- type: K,
3223
- size: oe || u?.byteLength || 0,
3224
- options: se
3225
- }, `${W}-${ne}`) : /* @__PURE__ */ D("div", {
3219
+ url: f || U,
3220
+ name: W,
3221
+ filename: W,
3222
+ type: ce,
3223
+ size: se || u?.byteLength || 0,
3224
+ options: K
3225
+ }, `${U}-${re}`) : /* @__PURE__ */ D("div", {
3226
3226
  className: "flex h-full items-center justify-center text-sm text-default-400",
3227
3227
  children: "正在加载预览引擎..."
3228
3228
  }) : /* @__PURE__ */ D("div", {
@@ -3249,15 +3249,15 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3249
3249
  },
3250
3250
  children: [/* @__PURE__ */ D("button", {
3251
3251
  type: "button",
3252
- onClick: le,
3253
- title: B === "web" ? "退出网页全屏" : "网页全屏",
3254
- "aria-label": B === "web" ? "退出网页全屏" : "网页全屏",
3252
+ onClick: de,
3253
+ title: z === "web" ? "退出网页全屏" : "网页全屏",
3254
+ "aria-label": z === "web" ? "退出网页全屏" : "网页全屏",
3255
3255
  style: {
3256
3256
  width: 28,
3257
3257
  height: 28,
3258
3258
  borderRadius: 6,
3259
3259
  border: "none",
3260
- background: B === "web" ? "#e4e4e7" : "transparent",
3260
+ background: z === "web" ? "#e4e4e7" : "transparent",
3261
3261
  cursor: "pointer",
3262
3262
  display: "flex",
3263
3263
  alignItems: "center",
@@ -3266,10 +3266,10 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3266
3266
  transition: "background 0.12s"
3267
3267
  },
3268
3268
  onMouseEnter: (e) => {
3269
- B !== "web" && (e.currentTarget.style.background = "#f4f4f5");
3269
+ z !== "web" && (e.currentTarget.style.background = "#f4f4f5");
3270
3270
  },
3271
3271
  onMouseLeave: (e) => {
3272
- B !== "web" && (e.currentTarget.style.background = "transparent");
3272
+ z !== "web" && (e.currentTarget.style.background = "transparent");
3273
3273
  },
3274
3274
  children: /* @__PURE__ */ D("svg", {
3275
3275
  width: "14",
@@ -3287,15 +3287,15 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3287
3287
  })
3288
3288
  }), /* @__PURE__ */ D("button", {
3289
3289
  type: "button",
3290
- onClick: ue,
3291
- title: B === "native" ? "退出全屏" : "全屏",
3292
- "aria-label": B === "native" ? "退出全屏" : "全屏",
3290
+ onClick: fe,
3291
+ title: z === "native" ? "退出全屏" : "全屏",
3292
+ "aria-label": z === "native" ? "退出全屏" : "全屏",
3293
3293
  style: {
3294
3294
  width: 28,
3295
3295
  height: 28,
3296
3296
  borderRadius: 6,
3297
3297
  border: "none",
3298
- background: B === "native" ? "#e4e4e7" : "transparent",
3298
+ background: z === "native" ? "#e4e4e7" : "transparent",
3299
3299
  cursor: "pointer",
3300
3300
  display: "flex",
3301
3301
  alignItems: "center",
@@ -3304,10 +3304,10 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3304
3304
  transition: "background 0.12s"
3305
3305
  },
3306
3306
  onMouseEnter: (e) => {
3307
- B !== "native" && (e.currentTarget.style.background = "#f4f4f5");
3307
+ z !== "native" && (e.currentTarget.style.background = "#f4f4f5");
3308
3308
  },
3309
3309
  onMouseLeave: (e) => {
3310
- B !== "native" && (e.currentTarget.style.background = "transparent");
3310
+ z !== "native" && (e.currentTarget.style.background = "transparent");
3311
3311
  },
3312
3312
  children: /* @__PURE__ */ D("svg", {
3313
3313
  width: "14",
@@ -3327,23 +3327,23 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3327
3327
  })]
3328
3328
  })]
3329
3329
  }), /* @__PURE__ */ D(wn, {
3330
- open: te,
3330
+ open: ne,
3331
3331
  title: "确认删除附件",
3332
- message: q ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${G}),不可撤销。`,
3332
+ message: G ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${W}),不可撤销。`,
3333
3333
  onCancel: () => {
3334
- $(!1), R(!1);
3334
+ $(!1), L(!1);
3335
3335
  },
3336
3336
  onConfirm: async () => {
3337
3337
  try {
3338
3338
  if (a) {
3339
- let e = z.current, t = e?.from ?? a.state.selection.from, n = e?.to ?? a.state.selection.to, r = [];
3339
+ let e = R.current, t = e?.from ?? a.state.selection.from, n = e?.to ?? a.state.selection.to, r = [];
3340
3340
  a.state.doc.nodesBetween(t, n, (e) => {
3341
3341
  e.type.name === "attachmentEmbed" && e.attrs?.src && r.push(qt(e.attrs.src));
3342
3342
  }), await Promise.all(r), $(!1), await new Promise((e) => setTimeout(e, 300)), a.chain().focus().setTextSelection({
3343
3343
  from: t,
3344
3344
  to: n
3345
3345
  }).deleteSelection().run();
3346
- } else await qt(W), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3346
+ } else await qt(U), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3347
3347
  } catch {
3348
3348
  $(!1);
3349
3349
  }
@@ -3352,13 +3352,13 @@ function Bn({ node: e, deleteNode: r, selected: i, editor: a }) {
3352
3352
  });
3353
3353
  }
3354
3354
  // src/editor/embeds/attachment.ts
3355
- var Vn = re.create({
3355
+ var Vn = ie.create({
3356
3356
  name: "attachmentEmbed",
3357
3357
  group: "block",
3358
3358
  atom: !0,
3359
3359
  inline: !1,
3360
3360
  addNodeView() {
3361
- return I(Bn);
3361
+ return F(Bn);
3362
3362
  },
3363
3363
  addAttributes() {
3364
3364
  return {
@@ -3413,7 +3413,7 @@ function Hn(e, t, n) {
3413
3413
  e === t && (r = n + e.nodeSize);
3414
3414
  }), !r) return !1;
3415
3415
  let i = e.doc.nodeAt(r);
3416
- return (i?.type.name !== "paragraph" || i.content.size !== 0) && e.insert(r, e.doc.type.schema.nodes.paragraph.create()), e.setSelection(ie.create(e.doc, r + 1)), !0;
3416
+ return (i?.type.name !== "paragraph" || i.content.size !== 0) && e.insert(r, e.doc.type.schema.nodes.paragraph.create()), e.setSelection(ae.create(e.doc, r + 1)), !0;
3417
3417
  }
3418
3418
  function Un(e, t, n) {
3419
3419
  let r = e.state.tr;
@@ -3452,7 +3452,7 @@ function Wn({ node: e, deleteNode: t, editor: r }) {
3452
3452
  })(), () => {
3453
3453
  e = !0, m.current &&= (URL.revokeObjectURL(m.current), null);
3454
3454
  };
3455
- }, [i]), /* @__PURE__ */ O(F, {
3455
+ }, [i]), /* @__PURE__ */ O(P, {
3456
3456
  as: "div",
3457
3457
  className: "audio-embed group/audio",
3458
3458
  contentEditable: !1,
@@ -3551,16 +3551,16 @@ function Wn({ node: e, deleteNode: t, editor: r }) {
3551
3551
  function Gn(e) {
3552
3552
  return /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|$)/i.test(e) || /\/.*\.(mp3|wav|ogg|flac)/i.test(e);
3553
3553
  }
3554
- var Kn = re.create({
3554
+ var Kn = ie.create({
3555
3555
  name: "audioEmbed",
3556
3556
  group: "block",
3557
3557
  atom: !0,
3558
3558
  inline: !1,
3559
3559
  addNodeView() {
3560
- return I(Wn);
3560
+ return F(Wn);
3561
3561
  },
3562
3562
  addProseMirrorPlugins() {
3563
- return [new H({ props: { handlePaste(e, t) {
3563
+ return [new V({ props: { handlePaste(e, t) {
3564
3564
  let n = t.clipboardData?.getData("text/plain");
3565
3565
  if (!n) return !1;
3566
3566
  let r = n.split(/\r?\n/);
@@ -3642,7 +3642,7 @@ function Yn({ node: e, deleteNode: t, editor: n }) {
3642
3642
  e && (e.style.position === "fixed" ? A() : (e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "99999", e.style.borderRadius = "0", document.body.style.overflow = "hidden"));
3643
3643
  }, [A]), N = b(() => {
3644
3644
  k.current = window.scrollY, S.current?.requestFullscreen?.();
3645
- }, []), P = b(() => {
3645
+ }, []), ee = b(() => {
3646
3646
  let e = v.current?.closest(".video-embed--direct") || v.current;
3647
3647
  e && (k.current = window.scrollY, e.requestFullscreen?.());
3648
3648
  }, []);
@@ -3732,7 +3732,7 @@ function Yn({ node: e, deleteNode: t, editor: n }) {
3732
3732
  u && (_.current?.destroy(), _.current = null);
3733
3733
  }, [u]), a === "bilibili") {
3734
3734
  let e = Jn(r);
3735
- return /* @__PURE__ */ O(F, {
3735
+ return /* @__PURE__ */ O(P, {
3736
3736
  as: "div",
3737
3737
  className: "video-embed video-embed--bilibili group/video",
3738
3738
  contentEditable: !1,
@@ -3849,7 +3849,7 @@ function Yn({ node: e, deleteNode: t, editor: n }) {
3849
3849
  }), m]
3850
3850
  });
3851
3851
  }
3852
- return a === "xiaohongshu" ? /* @__PURE__ */ O(F, {
3852
+ return a === "xiaohongshu" ? /* @__PURE__ */ O(P, {
3853
3853
  as: "div",
3854
3854
  className: "video-embed video-embed--xiaohongshu",
3855
3855
  style: {
@@ -3894,7 +3894,7 @@ function Yn({ node: e, deleteNode: t, editor: n }) {
3894
3894
  },
3895
3895
  children: "在小红书中打开 →"
3896
3896
  })] })]
3897
- }) : /* @__PURE__ */ O(F, {
3897
+ }) : /* @__PURE__ */ O(P, {
3898
3898
  as: "div",
3899
3899
  className: "video-embed video-embed--direct group/video",
3900
3900
  style: {
@@ -3931,7 +3931,7 @@ function Yn({ node: e, deleteNode: t, editor: n }) {
3931
3931
  type: "button",
3932
3932
  className: "video-fs-btn",
3933
3933
  title: "全屏",
3934
- onClick: P,
3934
+ onClick: ee,
3935
3935
  children: /* @__PURE__ */ D("svg", {
3936
3936
  width: "12",
3937
3937
  height: "12",
@@ -4081,20 +4081,20 @@ function Qn(e) {
4081
4081
  let t = e.match(/explore\/([a-zA-Z0-9]+)/);
4082
4082
  return t ? t[1] : e;
4083
4083
  }
4084
- var $n = re.create({
4084
+ var $n = ie.create({
4085
4085
  name: "videoEmbed",
4086
4086
  group: "block",
4087
4087
  atom: !0,
4088
4088
  inline: !1,
4089
4089
  addNodeView() {
4090
- return I(Yn);
4090
+ return F(Yn);
4091
4091
  },
4092
4092
  addProseMirrorPlugins() {
4093
- return [new H({ props: {
4093
+ return [new V({ props: {
4094
4094
  handleKeyDown(e, t) {
4095
4095
  if (t.key !== " ") return !1;
4096
4096
  let n = e.state.selection;
4097
- if (n instanceof V && n.node.type.name === "videoEmbed") {
4097
+ if (n instanceof B && n.node.type.name === "videoEmbed") {
4098
4098
  t.preventDefault();
4099
4099
  let r = e.nodeDOM(n.from);
4100
4100
  if (r) {
@@ -4232,14 +4232,34 @@ var $n = re.create({
4232
4232
  }))).focus().scrollIntoView().run();
4233
4233
  } };
4234
4234
  }
4235
- }), er = null, tr = {
4235
+ });
4236
+ // src/editor/extensions/chinese-emphasis.ts
4237
+ function er(e) {
4238
+ e.__qingwuChineseEmphasis || (e.__qingwuChineseEmphasis = !0, e.inline.ruler.before("emphasis", "qingwu_chinese_emphasis", (e) => {
4239
+ if (e.__qingwuChineseEmphasis) return !1;
4240
+ e.__qingwuChineseEmphasis = !0;
4241
+ let t = e.scanDelims;
4242
+ return e.scanDelims = function(e, n) {
4243
+ let r = t.call(this, e, n);
4244
+ if (this.src[e] !== "*" || r.length !== 2) return r;
4245
+ let i = this.src[e - 1] ?? "", a = this.src[e + 2] ?? "", o = /\p{Script=Han}/u, s = /[\u3001-\u303f\uff01-\uff65]/u;
4246
+ return o.test(i) && s.test(a) && (r.can_open = !0), s.test(i) && o.test(a) && (r.can_close = !0), r;
4247
+ }, !1;
4248
+ }));
4249
+ }
4250
+ var tr = R.create({
4251
+ name: "chineseEmphasis",
4252
+ addStorage() {
4253
+ return { markdown: { parse: { setup: er } } };
4254
+ }
4255
+ }), nr = null, rr = {
4236
4256
  fontFamily: "Inter, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif",
4237
4257
  padding: 24
4238
- }, nr = .25, rr = 4, ir = .25;
4239
- async function ar(e) {
4240
- return er ||= await import("pele"), er.render(e, tr).svg;
4258
+ }, ir = .25, ar = 4, or = .25;
4259
+ async function sr(e) {
4260
+ return nr ||= await import("pele"), nr.render(e, rr).svg;
4241
4261
  }
4242
- var or = [
4262
+ var cr = [
4243
4263
  {
4244
4264
  value: "javascript",
4245
4265
  label: "JavaScript",
@@ -4400,7 +4420,7 @@ var or = [
4400
4420
  label: "Plain Text",
4401
4421
  color: "#6b7280"
4402
4422
  }
4403
- ], sr = {
4423
+ ], lr = {
4404
4424
  javascript: "js",
4405
4425
  typescript: "ts",
4406
4426
  python: "py",
@@ -4426,7 +4446,7 @@ var or = [
4426
4446
  txt: "txt",
4427
4447
  vue: "vue",
4428
4448
  react: "jsx"
4429
- }, cr = {
4449
+ }, ur = {
4430
4450
  js: "javascript",
4431
4451
  ts: "typescript",
4432
4452
  py: "python",
@@ -4442,51 +4462,51 @@ var or = [
4442
4462
  jsx: "javascript",
4443
4463
  tsx: "typescript"
4444
4464
  };
4445
- function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
4465
+ function dr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
4446
4466
  let o = n?.isEditable ?? !0, s = !o, [c, l] = T(!1), [u, d] = T(!1), [f, p] = T(!1), [h, g] = T(!1), [_, v] = T(220), [y, S] = T({
4447
4467
  top: 0,
4448
4468
  left: 0,
4449
4469
  width: 210
4450
- }), [k, A] = T(""), [j, M] = T(!1), [N, P] = T(null), [F, I] = T(null), [L, ee] = T(!1), [te, z] = T(!1), [ne, re] = T(1), [B, V] = T({
4470
+ }), [k, A] = T(""), [j, M] = T(!1), [N, ee] = T(null), [P, F] = T(null), [I, te] = T(!1), [ne, R] = T(!1), [re, ie] = T(1), [z, B] = T({
4451
4471
  x: 0,
4452
4472
  y: 0
4453
- }), [H, U] = T(!1), ie = w(null), ae = w(null), W = w(null), G = w(null), oe = w(null), K = w(null), q = w(null), se = e.attrs.language || "", J = or.find((e) => e.value === (cr[se] ?? se)), ce = se === "mermaid", le = (e) => Math.min(rr, Math.max(nr, e)), ue = (e) => re((t) => Math.round(le(t + e) * 100) / 100), de = () => {
4454
- re(1), V({
4473
+ }), [V, H] = T(!1), ae = w(null), oe = w(null), U = w(null), W = w(null), se = w(null), ce = w(null), G = w(null), K = e.attrs.language || "", le = cr.find((e) => e.value === (ur[K] ?? K)), ue = K === "mermaid", de = (e) => Math.min(ar, Math.max(ir, e)), fe = (e) => ie((t) => Math.round(de(t + e) * 100) / 100), pe = () => {
4474
+ ie(1), B({
4455
4475
  x: 0,
4456
4476
  y: 0
4457
4477
  });
4458
- }, fe = () => {
4459
- de(), z(!0);
4478
+ }, me = () => {
4479
+ pe(), R(!0);
4460
4480
  };
4461
4481
  x(() => {
4462
- N || z(!1);
4482
+ N || R(!1);
4463
4483
  }, [N]), x(() => {
4464
- if (!te) return;
4484
+ if (!ne) return;
4465
4485
  let e = document.body.style.overflow;
4466
4486
  document.body.style.overflow = "hidden";
4467
4487
  let t = (e) => {
4468
- e.key === "Escape" && z(!1);
4488
+ e.key === "Escape" && R(!1);
4469
4489
  };
4470
4490
  return window.addEventListener("keydown", t), () => {
4471
4491
  document.body.style.overflow = e, window.removeEventListener("keydown", t);
4472
4492
  };
4473
- }, [te]);
4474
- let pe = (e) => {
4475
- e.button === 0 && (e.currentTarget.setPointerCapture(e.pointerId), ie.current = {
4493
+ }, [ne]);
4494
+ let he = (e) => {
4495
+ e.button === 0 && (e.currentTarget.setPointerCapture(e.pointerId), ae.current = {
4476
4496
  x: e.clientX,
4477
4497
  y: e.clientY,
4478
- panX: B.x,
4479
- panY: B.y
4480
- }, U(!0));
4481
- }, me = (e) => {
4482
- let t = ie.current;
4483
- t && V({
4498
+ panX: z.x,
4499
+ panY: z.y
4500
+ }, H(!0));
4501
+ }, ge = (e) => {
4502
+ let t = ae.current;
4503
+ t && B({
4484
4504
  x: t.panX + e.clientX - t.x,
4485
4505
  y: t.panY + e.clientY - t.y
4486
4506
  });
4487
- }, he = () => {
4488
- ie.current = null, U(!1);
4489
- }, ge = b(() => {
4507
+ }, q = () => {
4508
+ ae.current = null, H(!1);
4509
+ }, _e = b(() => {
4490
4510
  if (!n || typeof r != "function") return null;
4491
4511
  let t = r();
4492
4512
  return typeof t == "number" ? {
@@ -4497,19 +4517,19 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4497
4517
  n,
4498
4518
  r,
4499
4519
  e.nodeSize
4500
- ]), _e = b(() => {
4501
- o && (yn() || (q.current = ge(), window.getSelection()?.removeAllRanges(), $(!0), M(!0)));
4502
- }, [ge, o]), ve = C(() => {
4520
+ ]), ve = b(() => {
4521
+ o && (yn() || (G.current = _e(), window.getSelection()?.removeAllRanges(), $(!0), M(!0)));
4522
+ }, [_e, o]), ye = C(() => {
4503
4523
  let e = k.trim().toLowerCase();
4504
- return e ? or.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : or;
4524
+ return e ? cr.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : cr;
4505
4525
  }, [k]);
4506
4526
  x(() => {
4507
- (K.current?.closest(".code-block-node-view"))?.classList.toggle("code-block-node-view--collapsed", u);
4527
+ (ce.current?.closest(".code-block-node-view"))?.classList.toggle("code-block-node-view--collapsed", u);
4508
4528
  }, [u]);
4509
- let ye = b(() => {
4510
- let e = G.current;
4529
+ let be = b(() => {
4530
+ let e = W.current;
4511
4531
  if (!e) return;
4512
- let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a = or.length * 31 + 8, o = r - 52, s = i - 52;
4532
+ let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a = cr.length * 31 + 8, o = r - 52, s = i - 52;
4513
4533
  o < 220 && s > o ? (g(!0), v(Math.max(120, Math.min(a, s))), S({
4514
4534
  top: t.top,
4515
4535
  left: n,
@@ -4522,16 +4542,16 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4522
4542
  }, []);
4523
4543
  x(() => {
4524
4544
  if (!f) return;
4525
- A(""), ye();
4526
- let e = setTimeout(() => oe.current?.focus(), 50);
4527
- return window.addEventListener("resize", ye), window.addEventListener("scroll", ye, !0), () => {
4528
- clearTimeout(e), window.removeEventListener("resize", ye), window.removeEventListener("scroll", ye, !0);
4545
+ A(""), be();
4546
+ let e = setTimeout(() => se.current?.focus(), 50);
4547
+ return window.addEventListener("resize", be), window.addEventListener("scroll", be, !0), () => {
4548
+ clearTimeout(e), window.removeEventListener("resize", be), window.removeEventListener("scroll", be, !0);
4529
4549
  };
4530
- }, [f, ye]), x(() => {
4550
+ }, [f, be]), x(() => {
4531
4551
  if (!f) return;
4532
4552
  let e = (e) => {
4533
4553
  let t = e.target;
4534
- t && (G.current?.contains(t) || W.current?.contains(t) || p(!1));
4554
+ t && (W.current?.contains(t) || U.current?.contains(t) || p(!1));
4535
4555
  };
4536
4556
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
4537
4557
  }, [f]), x(() => {
@@ -4547,7 +4567,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4547
4567
  if (n?.isFocused && r instanceof Node && t?.contains(r)) {
4548
4568
  if (e.preventDefault(), e.stopPropagation(), n) {
4549
4569
  let { from: e, to: t } = n.state.selection;
4550
- q.current = {
4570
+ G.current = {
4551
4571
  from: e,
4552
4572
  to: t
4553
4573
  };
@@ -4561,9 +4581,9 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4561
4581
  n,
4562
4582
  o
4563
4583
  ]);
4564
- let be = b((e) => {
4584
+ let xe = b((e) => {
4565
4585
  t({ language: e || null }), p(!1);
4566
- }, [t]), xe = b(() => {
4586
+ }, [t]), Se = b(() => {
4567
4587
  if (o) {
4568
4588
  if (n && r) {
4569
4589
  let e = r();
@@ -4575,7 +4595,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4575
4595
  n,
4576
4596
  r,
4577
4597
  o
4578
- ]), Se = b(() => {
4598
+ ]), Ce = b(() => {
4579
4599
  let t = e.textContent, n = (e) => {
4580
4600
  let t = document.createElement("textarea");
4581
4601
  t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
@@ -4585,34 +4605,34 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4585
4605
  document.body.removeChild(t);
4586
4606
  };
4587
4607
  navigator.clipboard?.writeText ? navigator.clipboard.writeText(t).catch(() => n(t)) : n(t), l(!0), setTimeout(() => l(!1), 1500);
4588
- }, [e.textContent]), Ce = b(() => {
4589
- let t = sr[se] || "txt", n = t ? `code.${t}` : "code.txt", r = new Blob([e.textContent], { type: "text/plain;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
4608
+ }, [e.textContent]), we = b(() => {
4609
+ let t = lr[K] || "txt", n = t ? `code.${t}` : "code.txt", r = new Blob([e.textContent], { type: "text/plain;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
4590
4610
  a.href = i, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
4591
- }, [e.textContent, se]), we = b(async () => {
4592
- if (N || L) P(null), I(null), ee(!1);
4611
+ }, [e.textContent, K]), Te = b(async () => {
4612
+ if (N || I) ee(null), F(null), te(!1);
4593
4613
  else {
4594
- ee(!0), I(null), P(null);
4614
+ te(!0), F(null), ee(null);
4595
4615
  try {
4596
4616
  let t = (e.textContent || "").trim();
4597
4617
  if (!t) {
4598
- I("代码块内容为空");
4618
+ F("代码块内容为空");
4599
4619
  return;
4600
4620
  }
4601
- let n = await ar(t), r = m(n);
4602
- P(r);
4621
+ let n = await sr(t), r = m(n);
4622
+ ee(r);
4603
4623
  } catch (e) {
4604
- I(e instanceof Error ? e.message : "图表渲染失败");
4624
+ F(e instanceof Error ? e.message : "图表渲染失败");
4605
4625
  } finally {
4606
- ee(!1);
4626
+ te(!1);
4607
4627
  }
4608
4628
  }
4609
4629
  }, [
4610
4630
  e.textContent,
4611
4631
  N,
4612
- L
4613
- ]), Te = /* @__PURE__ */ O(E, { children: [J ? J.deviconClass ? /* @__PURE__ */ D("i", {
4614
- className: `${J.deviconClass} colored cb-lang-icon`,
4615
- style: { color: J.color }
4632
+ I
4633
+ ]), Ee = /* @__PURE__ */ O(E, { children: [le ? le.deviconClass ? /* @__PURE__ */ D("i", {
4634
+ className: `${le.deviconClass} colored cb-lang-icon`,
4635
+ style: { color: le.color }
4616
4636
  }) : /* @__PURE__ */ D("span", {
4617
4637
  className: "cb-lang-icon cb-lang-icon--auto",
4618
4638
  children: "Tx"
@@ -4621,10 +4641,10 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4621
4641
  children: "?"
4622
4642
  }), /* @__PURE__ */ D("span", {
4623
4643
  className: "cb-lang-label",
4624
- children: J?.label || "自动"
4644
+ children: le?.label || "自动"
4625
4645
  })] });
4626
4646
  return /* @__PURE__ */ O("div", {
4627
- ref: K,
4647
+ ref: ce,
4628
4648
  className: "cb-react-shell group/cb",
4629
4649
  style: { display: "contents" },
4630
4650
  children: [
@@ -4635,17 +4655,17 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4635
4655
  children: [
4636
4656
  /* @__PURE__ */ D("div", {
4637
4657
  className: "cb-lang-wrap",
4638
- ref: ae,
4658
+ ref: oe,
4639
4659
  contentEditable: !1,
4640
4660
  children: s ? /* @__PURE__ */ D("span", {
4641
4661
  className: "cb-lang-trigger cb-lang-trigger--static",
4642
- children: Te
4662
+ children: Ee
4643
4663
  }) : /* @__PURE__ */ O("button", {
4644
- ref: G,
4664
+ ref: W,
4645
4665
  type: "button",
4646
4666
  className: "cb-lang-trigger",
4647
4667
  onClick: () => p(!f),
4648
- children: [Te, /* @__PURE__ */ D("svg", {
4668
+ children: [Ee, /* @__PURE__ */ D("svg", {
4649
4669
  className: `cb-lang-chevron${f ? " cb-lang-chevron--open" : ""}`,
4650
4670
  width: "10",
4651
4671
  height: "10",
@@ -4667,7 +4687,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4667
4687
  contentEditable: !1,
4668
4688
  onClick: () => d(!1),
4669
4689
  title: "展开代码块",
4670
- children: [Te, /* @__PURE__ */ D("svg", {
4690
+ children: [Ee, /* @__PURE__ */ D("svg", {
4671
4691
  className: "cb-lang-chevron",
4672
4692
  width: "12",
4673
4693
  height: "12",
@@ -4682,8 +4702,8 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4682
4702
  })
4683
4703
  })]
4684
4704
  }),
4685
- o && f && R(/* @__PURE__ */ O("div", {
4686
- ref: W,
4705
+ o && f && L(/* @__PURE__ */ O("div", {
4706
+ ref: U,
4687
4707
  className: `cb-lang-dropdown${h ? " cb-lang-dropdown--up" : ""}`,
4688
4708
  style: {
4689
4709
  position: "fixed",
@@ -4708,7 +4728,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4708
4728
  d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
4709
4729
  })
4710
4730
  }), /* @__PURE__ */ D("input", {
4711
- ref: oe,
4731
+ ref: se,
4712
4732
  className: "cb-lang-search",
4713
4733
  type: "text",
4714
4734
  placeholder: "搜索语言...",
@@ -4722,17 +4742,17 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4722
4742
  children: [
4723
4743
  /* @__PURE__ */ O("button", {
4724
4744
  type: "button",
4725
- className: `cb-lang-option${se ? "" : " cb-lang-option--active"}`,
4726
- onClick: () => be(""),
4745
+ className: `cb-lang-option${K ? "" : " cb-lang-option--active"}`,
4746
+ onClick: () => xe(""),
4727
4747
  children: [/* @__PURE__ */ D("span", {
4728
4748
  className: "cb-lang-icon cb-lang-icon--auto",
4729
4749
  children: "?"
4730
4750
  }), /* @__PURE__ */ D("span", { children: "自动检测" })]
4731
4751
  }),
4732
- ve.map((e) => /* @__PURE__ */ O("button", {
4752
+ ye.map((e) => /* @__PURE__ */ O("button", {
4733
4753
  type: "button",
4734
- className: `cb-lang-option${se === e.value ? " cb-lang-option--active" : ""}`,
4735
- onClick: () => be(e.value),
4754
+ className: `cb-lang-option${K === e.value ? " cb-lang-option--active" : ""}`,
4755
+ onClick: () => xe(e.value),
4736
4756
  children: [e.deviconClass ? /* @__PURE__ */ D("i", {
4737
4757
  className: `${e.deviconClass} colored cb-lang-icon`,
4738
4758
  style: { color: e.color }
@@ -4741,7 +4761,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4741
4761
  children: "Tx"
4742
4762
  }), /* @__PURE__ */ D("span", { children: e.label })]
4743
4763
  }, e.value)),
4744
- ve.length === 0 && /* @__PURE__ */ D("div", {
4764
+ ye.length === 0 && /* @__PURE__ */ D("div", {
4745
4765
  className: "cb-lang-empty",
4746
4766
  children: "无匹配语言"
4747
4767
  })
@@ -4777,7 +4797,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4777
4797
  /* @__PURE__ */ D("button", {
4778
4798
  type: "button",
4779
4799
  className: "cb-btn",
4780
- onClick: Se,
4800
+ onClick: Ce,
4781
4801
  contentEditable: !1,
4782
4802
  title: "复制",
4783
4803
  children: c ? /* @__PURE__ */ D("svg", {
@@ -4807,7 +4827,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4807
4827
  /* @__PURE__ */ D("button", {
4808
4828
  type: "button",
4809
4829
  className: "cb-btn",
4810
- onClick: Ce,
4830
+ onClick: we,
4811
4831
  contentEditable: !1,
4812
4832
  title: "下载",
4813
4833
  children: /* @__PURE__ */ D("svg", {
@@ -4826,7 +4846,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4826
4846
  o && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("button", {
4827
4847
  type: "button",
4828
4848
  className: "cb-btn cb-btn--ai",
4829
- onClick: xe,
4849
+ onClick: Se,
4830
4850
  contentEditable: !1,
4831
4851
  title: "写作助手",
4832
4852
  children: /* @__PURE__ */ D("svg", {
@@ -4844,7 +4864,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4844
4864
  }), /* @__PURE__ */ D("button", {
4845
4865
  type: "button",
4846
4866
  className: "cb-btn cb-btn--del",
4847
- onClick: _e,
4867
+ onClick: ve,
4848
4868
  contentEditable: !1,
4849
4869
  title: "删除代码块",
4850
4870
  children: /* @__PURE__ */ D("svg", {
@@ -4860,13 +4880,13 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4860
4880
  })
4861
4881
  })
4862
4882
  })] }),
4863
- ce && /* @__PURE__ */ D("button", {
4883
+ ue && /* @__PURE__ */ D("button", {
4864
4884
  type: "button",
4865
4885
  className: "cb-btn cb-btn--diagram",
4866
- onClick: we,
4886
+ onClick: Te,
4867
4887
  contentEditable: !1,
4868
- title: N || L ? "取消渲染" : "渲染图表",
4869
- disabled: L,
4888
+ title: N || I ? "取消渲染" : "渲染图表",
4889
+ disabled: I,
4870
4890
  children: /* @__PURE__ */ D("svg", {
4871
4891
  className: "cb-btn-icon",
4872
4892
  fill: "none",
@@ -4884,29 +4904,29 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4884
4904
  })
4885
4905
  ]
4886
4906
  }),
4887
- (N || F || L) && /* @__PURE__ */ O("div", {
4907
+ (N || P || I) && /* @__PURE__ */ O("div", {
4888
4908
  className: "cb-diagram-output",
4889
4909
  contentEditable: !1,
4890
4910
  children: [
4891
- L && /* @__PURE__ */ D("div", {
4911
+ I && /* @__PURE__ */ D("div", {
4892
4912
  className: "cb-diagram-loading",
4893
4913
  children: "渲染图表中…"
4894
4914
  }),
4895
- F && /* @__PURE__ */ O("div", {
4915
+ P && /* @__PURE__ */ O("div", {
4896
4916
  className: "cb-diagram-error",
4897
4917
  children: [/* @__PURE__ */ D("span", {
4898
4918
  className: "cb-diagram-error-icon",
4899
4919
  children: "!"
4900
- }), F]
4920
+ }), P]
4901
4921
  }),
4902
4922
  N && /* @__PURE__ */ O("div", {
4903
4923
  className: "cb-diagram-svg",
4904
4924
  role: "button",
4905
4925
  tabIndex: 0,
4906
4926
  title: "点击放大查看",
4907
- onClick: fe,
4927
+ onClick: me,
4908
4928
  onKeyDown: (e) => {
4909
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), fe());
4929
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), me());
4910
4930
  },
4911
4931
  children: [/* @__PURE__ */ D("div", {
4912
4932
  className: "cb-diagram-svg-inner",
@@ -4918,7 +4938,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4918
4938
  })
4919
4939
  ]
4920
4940
  }),
4921
- te && N && R(/* @__PURE__ */ O("div", {
4941
+ ne && N && L(/* @__PURE__ */ O("div", {
4922
4942
  className: "fixed inset-0 z-[10002] flex flex-col bg-black/75 backdrop-blur-sm select-none",
4923
4943
  role: "dialog",
4924
4944
  "aria-modal": "true",
@@ -4934,7 +4954,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4934
4954
  /* @__PURE__ */ D("button", {
4935
4955
  type: "button",
4936
4956
  className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-base text-white transition-colors hover:bg-white/20",
4937
- onClick: () => ue(-.25),
4957
+ onClick: () => fe(-.25),
4938
4958
  title: "缩小",
4939
4959
  "aria-label": "缩小",
4940
4960
  children: "−"
@@ -4942,15 +4962,15 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4942
4962
  /* @__PURE__ */ O("button", {
4943
4963
  type: "button",
4944
4964
  className: "flex h-8 min-w-14 items-center justify-center rounded-lg bg-white/10 px-2 text-xs text-white transition-colors hover:bg-white/20",
4945
- onClick: de,
4965
+ onClick: pe,
4946
4966
  title: "重置为 100%",
4947
4967
  "aria-label": "重置缩放",
4948
- children: [Math.round(ne * 100), "%"]
4968
+ children: [Math.round(re * 100), "%"]
4949
4969
  }),
4950
4970
  /* @__PURE__ */ D("button", {
4951
4971
  type: "button",
4952
4972
  className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-base text-white transition-colors hover:bg-white/20",
4953
- onClick: () => ue(ir),
4973
+ onClick: () => fe(or),
4954
4974
  title: "放大",
4955
4975
  "aria-label": "放大",
4956
4976
  children: "+"
@@ -4958,7 +4978,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4958
4978
  /* @__PURE__ */ D("button", {
4959
4979
  type: "button",
4960
4980
  className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-sm text-white transition-colors hover:bg-white/20",
4961
- onClick: de,
4981
+ onClick: pe,
4962
4982
  title: "重置",
4963
4983
  "aria-label": "重置",
4964
4984
  children: "⟲"
@@ -4967,7 +4987,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4967
4987
  /* @__PURE__ */ D("button", {
4968
4988
  type: "button",
4969
4989
  className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-lg text-white transition-colors hover:bg-white/20",
4970
- onClick: () => z(!1),
4990
+ onClick: () => R(!1),
4971
4991
  title: "关闭",
4972
4992
  "aria-label": "关闭",
4973
4993
  children: "×"
@@ -4976,14 +4996,14 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4976
4996
  })]
4977
4997
  }), /* @__PURE__ */ D("div", {
4978
4998
  className: "flex flex-1 touch-none items-center justify-center overflow-hidden",
4979
- style: { cursor: H ? "grabbing" : ne > 1 ? "grab" : "default" },
4980
- onWheel: (e) => ue(e.deltaY > 0 ? -.25 : ir),
4981
- onPointerDown: pe,
4982
- onPointerMove: me,
4983
- onPointerUp: he,
4984
- onPointerCancel: he,
4999
+ style: { cursor: V ? "grabbing" : re > 1 ? "grab" : "default" },
5000
+ onWheel: (e) => fe(e.deltaY > 0 ? -.25 : or),
5001
+ onPointerDown: he,
5002
+ onPointerMove: ge,
5003
+ onPointerUp: q,
5004
+ onPointerCancel: q,
4985
5005
  onDoubleClick: () => {
4986
- re((e) => e === 1 ? 2 : 1), V({
5006
+ ie((e) => e === 1 ? 2 : 1), B({
4987
5007
  x: 0,
4988
5008
  y: 0
4989
5009
  });
@@ -4991,8 +5011,8 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4991
5011
  children: /* @__PURE__ */ D("div", {
4992
5012
  className: "cb-diagram-zoom-content",
4993
5013
  style: {
4994
- transform: `translate(${B.x}px, ${B.y}px) scale(${ne})`,
4995
- transition: H ? "none" : "transform 120ms ease-out"
5014
+ transform: `translate(${z.x}px, ${z.y}px) scale(${re})`,
5015
+ transition: V ? "none" : "transform 120ms ease-out"
4996
5016
  },
4997
5017
  dangerouslySetInnerHTML: { __html: N }
4998
5018
  })
@@ -5013,7 +5033,7 @@ function lr({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
5013
5033
  });
5014
5034
  }
5015
5035
  // src/editor/extensions/code-block.ts
5016
- var ur = [
5036
+ var fr = [
5017
5037
  {
5018
5038
  value: "javascript",
5019
5039
  label: "JavaScript"
@@ -5114,12 +5134,12 @@ var ur = [
5114
5134
  value: "mermaid",
5115
5135
  label: "Mermaid"
5116
5136
  }
5117
- ], dr = Se(xe);
5118
- dr.register({ dockerfile: be }), dr.registerAlias("xml", ["vue", "html"]), dr.registerAlias("javascript", ["react", "jsx"]), dr.registerAlias("typescript", ["tsx"]);
5119
- function fr(e) {
5137
+ ], pr = Ce(Se);
5138
+ pr.register({ dockerfile: xe }), pr.registerAlias("xml", ["vue", "html"]), pr.registerAlias("javascript", ["react", "jsx"]), pr.registerAlias("typescript", ["tsx"]);
5139
+ function mr(e) {
5120
5140
  return e ? e.split("\n") : [""];
5121
5141
  }
5122
- function pr(e, t) {
5142
+ function hr(e, t) {
5123
5143
  if (e.childElementCount !== t) {
5124
5144
  e.replaceChildren();
5125
5145
  for (let n = 1; n <= t; n++) {
@@ -5128,14 +5148,14 @@ function pr(e, t) {
5128
5148
  }
5129
5149
  }
5130
5150
  }
5131
- function mr(e, t) {
5151
+ function gr(e, t) {
5132
5152
  e.replaceChildren();
5133
5153
  for (let n of t) {
5134
5154
  let t = document.createElement("span");
5135
5155
  t.className = "cb-mirror-line", t.textContent = n.length ? n : "\xA0", e.appendChild(t);
5136
5156
  }
5137
5157
  }
5138
- function hr(e, t, n) {
5158
+ function _r(e, t, n) {
5139
5159
  let r = getComputedStyle(e), i = parseFloat(r.paddingLeft), a = parseFloat(r.paddingRight);
5140
5160
  t.style.boxSizing = "content-box", t.style.width = `${Math.max(0, e.clientWidth - i - a)}px`, t.style.padding = r.padding;
5141
5161
  let o = getComputedStyle(n);
@@ -5182,7 +5202,7 @@ function hr(e, t, n) {
5182
5202
  r = e + 1 < C.length ? C[e + 1] - C[e] : w - T, (!Number.isFinite(r) || r < 1) && (r = c), t.style.height = `${r}px`, T += r;
5183
5203
  }
5184
5204
  }
5185
- var gr = ye.extend({
5205
+ var vr = be.extend({
5186
5206
  addNodeView() {
5187
5207
  return (e) => {
5188
5208
  let { node: t, editor: n, getPos: r } = e, i = t, a = (e) => {
@@ -5210,9 +5230,9 @@ var gr = ye.extend({
5210
5230
  f.appendChild(p);
5211
5231
  let m = document.createElement("div");
5212
5232
  m.className = "cb-code-mirror", m.contentEditable = "false", m.setAttribute("aria-hidden", "true"), u.appendChild(d), u.appendChild(f), u.appendChild(m), l.appendChild(u), s.appendChild(l);
5213
- let h = fr(t.textContent);
5214
- pr(d, h.length), mr(m, h);
5215
- let g = new L(lr, {
5233
+ let h = mr(t.textContent);
5234
+ hr(d, h.length), gr(m, h);
5235
+ let g = new I(dr, {
5216
5236
  editor: n,
5217
5237
  props: {
5218
5238
  node: t,
@@ -5225,12 +5245,12 @@ var gr = ye.extend({
5225
5245
  });
5226
5246
  c.appendChild(g.element);
5227
5247
  let _ = (e) => {
5228
- let t = fr(e.textContent);
5229
- pr(d, t.length), mr(m, t), requestAnimationFrame(() => hr(f, m, d));
5248
+ let t = mr(e.textContent);
5249
+ hr(d, t.length), gr(m, t), requestAnimationFrame(() => _r(f, m, d));
5230
5250
  };
5231
- requestAnimationFrame(() => hr(f, m, d));
5232
- let v = new ResizeObserver(() => hr(f, m, d));
5233
- return v.observe(f), document.fonts?.ready?.then(() => hr(f, m, d)), {
5251
+ requestAnimationFrame(() => _r(f, m, d));
5252
+ let v = new ResizeObserver(() => _r(f, m, d));
5253
+ return v.observe(f), document.fonts?.ready?.then(() => _r(f, m, d)), {
5234
5254
  dom: s,
5235
5255
  contentDOM: p,
5236
5256
  update(e) {
@@ -5290,9 +5310,9 @@ var gr = ye.extend({
5290
5310
  }
5291
5311
  }));
5292
5312
  }
5293
- }).configure({ lowlight: dr });
5313
+ }).configure({ lowlight: pr });
5294
5314
  // src/editor/utils/import-choice-dialog.ts
5295
- function _r(e) {
5315
+ function yr(e) {
5296
5316
  return new Promise((t) => {
5297
5317
  let n = document.createElement("div");
5298
5318
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -5321,16 +5341,16 @@ function _r(e) {
5321
5341
  });
5322
5342
  }
5323
5343
  // src/editor/utils/local-media.ts
5324
- var vr = /\.(png|jpe?g|gif|webp|bmp|svg|avif|mp4|m4v|webm|ogg|mov|avi|mkv|mp3|wav|flac|m4a|aac|opus|pdf|docx?|xlsx?|pptx?|odt|rtf|txt|md|csv|zip|rar|7z|json)(\?|#|$)/i, yr = /^(?:mailto:|tel:|javascript:|about:|data:|blob:)/i;
5325
- function br(e) {
5344
+ var br = /\.(png|jpe?g|gif|webp|bmp|svg|avif|mp4|m4v|webm|ogg|mov|avi|mkv|mp3|wav|flac|m4a|aac|opus|pdf|docx?|xlsx?|pptx?|odt|rtf|txt|md|csv|zip|rar|7z|json)(\?|#|$)/i, xr = /^(?:mailto:|tel:|javascript:|about:|data:|blob:)/i;
5345
+ function Sr(e) {
5326
5346
  if (!e) return !1;
5327
5347
  let t = e.trim();
5328
- return !(!t || /^(?:https?:)?\/\//i.test(t) || yr.test(t) || t.startsWith("#"));
5348
+ return !(!t || /^(?:https?:)?\/\//i.test(t) || xr.test(t) || t.startsWith("#"));
5329
5349
  }
5330
- function xr(e) {
5331
- return vr.test(e);
5350
+ function Cr(e) {
5351
+ return br.test(e);
5332
5352
  }
5333
- function Sr(e) {
5353
+ function wr(e) {
5334
5354
  let t = e.trim();
5335
5355
  t = t.replace(/^(?:file|app):\/\/(?:localhost)?/i, "");
5336
5356
  try {
@@ -5338,26 +5358,26 @@ function Sr(e) {
5338
5358
  } catch {}
5339
5359
  return t = t.replace(/\\/g, "/"), t = t.replace(/^\.\//, ""), t = t.replace(/^\/+/, ""), t = t.replace(/^[a-zA-Z]:\//, ""), t;
5340
5360
  }
5341
- function Cr(e) {
5342
- let t = Sr(e), n = t.split("/").filter(Boolean);
5361
+ function Tr(e) {
5362
+ let t = wr(e), n = t.split("/").filter(Boolean);
5343
5363
  return (n[n.length - 1] || t).toLowerCase();
5344
5364
  }
5345
- function wr() {
5365
+ function Er() {
5346
5366
  return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showDirectoryPicker == "function";
5347
5367
  }
5348
- async function Tr() {
5349
- if (!wr()) return null;
5368
+ async function Dr() {
5369
+ if (!Er()) return null;
5350
5370
  try {
5351
5371
  return await window.showDirectoryPicker.call(window, { mode: "read" }) ?? null;
5352
5372
  } catch {
5353
5373
  return null;
5354
5374
  }
5355
5375
  }
5356
- function Er() {
5376
+ function Or() {
5357
5377
  return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showOpenFilePicker == "function";
5358
5378
  }
5359
- async function Dr() {
5360
- if (!Er()) return null;
5379
+ async function kr() {
5380
+ if (!Or()) return null;
5361
5381
  try {
5362
5382
  let e = await window.showOpenFilePicker.call(window, { multiple: !0 });
5363
5383
  return await Promise.all(e.map((e) => e.getFile()));
@@ -5365,7 +5385,7 @@ async function Dr() {
5365
5385
  return null;
5366
5386
  }
5367
5387
  }
5368
- async function Or(e, t) {
5388
+ async function Ar(e, t) {
5369
5389
  if (t.length === 0) return { file: null };
5370
5390
  let n = e;
5371
5391
  for (let e = 0; e < t.length - 1; e++) try {
@@ -5387,7 +5407,7 @@ async function Or(e, t) {
5387
5407
  return { file: null };
5388
5408
  }
5389
5409
  }
5390
- async function kr(e, t, n = 5e3) {
5410
+ async function jr(e, t, n = 5e3) {
5391
5411
  let r = t.toLowerCase(), i = [e], a = 0, o;
5392
5412
  for (; i.length > 0 && a < n;) {
5393
5413
  let e = i.pop();
@@ -5409,54 +5429,54 @@ async function kr(e, t, n = 5e3) {
5409
5429
  readError: o
5410
5430
  };
5411
5431
  }
5412
- async function Ar(e, t) {
5413
- let n = Sr(t).split("/").filter(Boolean);
5432
+ async function Mr(e, t) {
5433
+ let n = wr(t).split("/").filter(Boolean);
5414
5434
  if (n.length === 0) return { file: null };
5415
5435
  let r;
5416
5436
  for (let t = 0; t < n.length; t++) {
5417
- let i = await Or(e, n.slice(t));
5437
+ let i = await Ar(e, n.slice(t));
5418
5438
  if (i.file) return i;
5419
5439
  i.readError && (r = i.readError);
5420
5440
  }
5421
- let i = await kr(e, n[n.length - 1]);
5441
+ let i = await jr(e, n[n.length - 1]);
5422
5442
  return i.file || i.readError ? i : {
5423
5443
  file: null,
5424
5444
  readError: r
5425
5445
  };
5426
5446
  }
5427
- var jr = {
5447
+ var Nr = {
5428
5448
  image: "image",
5429
5449
  videoEmbed: "video",
5430
5450
  audioEmbed: "audio",
5431
5451
  attachmentEmbed: "attachment"
5432
5452
  };
5433
- function Mr(e, t) {
5453
+ function Pr(e, t) {
5434
5454
  let n = /* @__PURE__ */ new Set(), r = [];
5435
5455
  return e.descendants((e) => {
5436
- let i = jr[e.type?.name];
5456
+ let i = Nr[e.type?.name];
5437
5457
  if (i) {
5438
5458
  let a = e.attrs?.src, o = `node:${a}`;
5439
- typeof a == "string" && br(a) && !n.has(o) && !t?.(a) && (n.add(o), r.push({
5459
+ typeof a == "string" && Sr(a) && !n.has(o) && !t?.(a) && (n.add(o), r.push({
5440
5460
  src: a,
5441
- normalized: Sr(a),
5442
- basename: Cr(a),
5461
+ normalized: wr(a),
5462
+ basename: Tr(a),
5443
5463
  kind: i,
5444
5464
  isLink: !1
5445
5465
  }));
5446
5466
  } else if (e.isText && e.marks) for (let i of e.marks) {
5447
5467
  if (i.type.name !== "link") continue;
5448
5468
  let e = i.attrs?.href, a = `link:${e}`;
5449
- typeof e == "string" && br(e) && xr(e) && !n.has(a) && !t?.(e) && (n.add(a), r.push({
5469
+ typeof e == "string" && Sr(e) && Cr(e) && !n.has(a) && !t?.(e) && (n.add(a), r.push({
5450
5470
  src: e,
5451
- normalized: Sr(e),
5452
- basename: Cr(e),
5471
+ normalized: wr(e),
5472
+ basename: Tr(e),
5453
5473
  kind: "attachment",
5454
5474
  isLink: !0
5455
5475
  }));
5456
5476
  }
5457
5477
  }), r;
5458
5478
  }
5459
- function Nr(e, t, n) {
5479
+ function Fr(e, t, n) {
5460
5480
  let r = t ? `${e}\n${t}` : e;
5461
5481
  if (!r) return !1;
5462
5482
  let i = [];
@@ -5464,23 +5484,23 @@ function Nr(e, t, n) {
5464
5484
  for (let e of r.matchAll(/!?\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g)) i.push(e[1]);
5465
5485
  for (let e of r.matchAll(/<(?:img|video|audio|source)[^>]*\bsrc=["']([^"']+)["']/gi)) i.push(e[1]);
5466
5486
  for (let e of r.matchAll(/<a[^>]*\bhref=["']([^"']+)["']/gi)) i.push(e[1]);
5467
- return i.some((e) => xr(e) && br(e) && !n?.(e));
5487
+ return i.some((e) => Cr(e) && Sr(e) && !n?.(e));
5468
5488
  }
5469
5489
  // src/editor/extensions/image-upload.ts
5470
- function Pr(e) {
5490
+ function Ir(e) {
5471
5491
  if (e.type.startsWith("image/")) return "image";
5472
5492
  if (e.type.startsWith("video/")) return "video";
5473
5493
  if (e.type.startsWith("audio/")) return "audio";
5474
5494
  let t = e.name.split(".").pop()?.toLowerCase() || "";
5475
5495
  return /^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(t) ? "image" : /^(mp4|m3u8|webm|ogg|mov|avi|wmv|flv|mkv|ts|m4v|3gp|f4v|rmvb)$/.test(t) ? "video" : /^(mp3|wav|flac|aac|m4a|wma|opus)$/.test(t) ? "audio" : /^(md|markdown)$/.test(t) ? "markdown" : "file";
5476
5496
  }
5477
- function Fr(e) {
5497
+ function Lr(e) {
5478
5498
  let t = e.name.split(".").pop()?.toLowerCase() || "";
5479
5499
  return t === "md" || t === "markdown";
5480
5500
  }
5481
- async function Ir(e, t, n, r) {
5501
+ async function Rr(e, t, n, r) {
5482
5502
  let i = n ?? e.state.selection.from, a = r ? mn(r) : void 0, o = r?.storage?.qingwuUI, s = await new Promise((e) => {
5483
- o?.chooseMd ? o.chooseMd(t.name, e) : _r(t.name).then(e);
5503
+ o?.chooseMd ? o.chooseMd(t.name, e) : yr(t.name).then(e);
5484
5504
  });
5485
5505
  if (s === null) return;
5486
5506
  if (s === "attach") {
@@ -5515,8 +5535,8 @@ async function Ir(e, t, n, r) {
5515
5535
  e.dispatch(e.state.tr.insert(i, t.from(u)));
5516
5536
  }
5517
5537
  }
5518
- function Lr(e, t, n) {
5519
- switch (Pr(t)) {
5538
+ function zr(e, t, n) {
5539
+ switch (Ir(t)) {
5520
5540
  case "image": return e.nodes.image?.create({
5521
5541
  src: n,
5522
5542
  alt: t.name
@@ -5542,7 +5562,7 @@ function Lr(e, t, n) {
5542
5562
  }
5543
5563
  }
5544
5564
  }
5545
- async function Rr(e, t, n) {
5565
+ async function Br(e, t, n) {
5546
5566
  let r;
5547
5567
  try {
5548
5568
  r = s();
@@ -5561,23 +5581,23 @@ async function Rr(e, t, n) {
5561
5581
  return console.error(`${t.type} upload failed:`, e), URL.revokeObjectURL(n), null;
5562
5582
  }
5563
5583
  }
5564
- async function zr(e, t, n, r) {
5584
+ async function Vr(e, t, n, r) {
5565
5585
  let i = r ? mn(r) : void 0, a = i ? hn(e.state.doc, t, i) : null;
5566
5586
  if (a) {
5567
5587
  Z(a);
5568
5588
  return;
5569
5589
  }
5570
- let o = URL.createObjectURL(t), s = Lr(e.state.schema, t, o);
5590
+ let o = URL.createObjectURL(t), s = zr(e.state.schema, t, o);
5571
5591
  if (s) {
5572
5592
  try {
5573
5593
  Un(e, s, n);
5574
5594
  } catch {
5575
5595
  return;
5576
5596
  }
5577
- await Rr(e, t, o);
5597
+ await Br(e, t, o);
5578
5598
  }
5579
5599
  }
5580
- var Br = z.create({
5600
+ var Hr = R.create({
5581
5601
  name: "imageUpload",
5582
5602
  addOptions() {
5583
5603
  return {
@@ -5587,8 +5607,8 @@ var Br = z.create({
5587
5607
  },
5588
5608
  addProseMirrorPlugins() {
5589
5609
  let e = this.editor;
5590
- return [new H({
5591
- key: new U("imageUpload"),
5610
+ return [new V({
5611
+ key: new H("imageUpload"),
5592
5612
  props: {
5593
5613
  handleDrop(t, n) {
5594
5614
  let r = n.dataTransfer?.files;
@@ -5598,23 +5618,23 @@ var Br = z.create({
5598
5618
  left: n.clientX,
5599
5619
  top: n.clientY
5600
5620
  })?.pos;
5601
- for (let n of Array.from(r)) Fr(n) ? Ir(t, n, i, e) : zr(t, n, i, e), i = void 0;
5621
+ for (let n of Array.from(r)) Lr(n) ? Rr(t, n, i, e) : Vr(t, n, i, e), i = void 0;
5602
5622
  return !0;
5603
5623
  },
5604
5624
  handlePaste(t, n) {
5605
5625
  let r = n.clipboardData?.items;
5606
5626
  if (!r) return !1;
5607
5627
  let i = n.clipboardData?.getData("text/plain") || "";
5608
- if ((n.clipboardData?.files?.length ?? 0) > 0 && Nr(i, void 0, o())) return !1;
5628
+ if ((n.clipboardData?.files?.length ?? 0) > 0 && Fr(i, void 0, o())) return !1;
5609
5629
  for (let i of Array.from(r)) {
5610
5630
  if (i.type.startsWith("image/") || i.type.startsWith("video/") || i.type.startsWith("audio/")) {
5611
5631
  n.preventDefault();
5612
5632
  let r = i.getAsFile();
5613
- return r && Pr(r) !== "file" && zr(t, r, void 0, e), !0;
5633
+ return r && Ir(r) !== "file" && Vr(t, r, void 0, e), !0;
5614
5634
  }
5615
5635
  if (i.kind === "file") {
5616
5636
  let r = i.getAsFile();
5617
- if (r && Fr(r)) return n.preventDefault(), Ir(t, r, void 0, e), !0;
5637
+ if (r && Lr(r)) return n.preventDefault(), Rr(t, r, void 0, e), !0;
5618
5638
  }
5619
5639
  }
5620
5640
  return !1;
@@ -5622,12 +5642,12 @@ var Br = z.create({
5622
5642
  }
5623
5643
  })];
5624
5644
  }
5625
- }), Vr = 100, Hr = z.create({
5645
+ }), Ur = 100, Wr = R.create({
5626
5646
  name: "imeCommitSpaceGuard",
5627
5647
  addProseMirrorPlugins() {
5628
5648
  let e = 0;
5629
- return [new H({
5630
- key: new U("imeCommitSpaceGuard"),
5649
+ return [new V({
5650
+ key: new H("imeCommitSpaceGuard"),
5631
5651
  props: { handleDOMEvents: {
5632
5652
  compositionend() {
5633
5653
  return e = performance.now(), !1;
@@ -5637,50 +5657,50 @@ var Br = z.create({
5637
5657
  },
5638
5658
  beforeinput(t, n) {
5639
5659
  let r = n;
5640
- return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > Vr ? !1 : (r.preventDefault(), !0);
5660
+ return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > Ur ? !1 : (r.preventDefault(), !0);
5641
5661
  }
5642
5662
  } }
5643
5663
  })];
5644
5664
  }
5645
- }), Ur = z.create({
5665
+ }), Gr = R.create({
5646
5666
  name: "inlineCodeEnd",
5647
5667
  addInputRules() {
5648
5668
  let e = this.editor.schema.marks.code;
5649
- return e ? [B({
5669
+ return e ? [z({
5650
5670
  find: /`([^`]+)`$/,
5651
5671
  type: e
5652
5672
  })] : [];
5653
5673
  }
5654
- }), Wr = z.create({
5674
+ }), Kr = R.create({
5655
5675
  name: "listQuoteHighlight",
5656
5676
  addProseMirrorPlugins() {
5657
- return [new H({ props: { decorations: (e) => {
5677
+ return [new V({ props: { decorations: (e) => {
5658
5678
  let { $head: t, empty: n } = e.selection;
5659
- if (!this.editor.isFocused || !n || !["paragraph", "heading"].includes(t.parent.type.name)) return W.empty;
5679
+ if (!this.editor.isFocused || !n || !["paragraph", "heading"].includes(t.parent.type.name)) return U.empty;
5660
5680
  let r = [], i = !1;
5661
5681
  for (let e = t.depth - 1; e > 0; e--) {
5662
5682
  let n = t.node(e).type.name;
5663
- if (n === "listItem" && !i && (i = !0, r.push(ae.node(t.before(), t.after(), { class: "qw-active-row" }), ae.node(t.before(e), t.after(e), { class: "qw-active-list-item" }))), n === "blockquote") {
5664
- r.push(ae.node(t.before(e), t.after(e), { class: "qw-active-quote" }));
5683
+ if (n === "listItem" && !i && (i = !0, r.push(oe.node(t.before(), t.after(), { class: "qw-active-row" }), oe.node(t.before(e), t.after(e), { class: "qw-active-list-item" }))), n === "blockquote") {
5684
+ r.push(oe.node(t.before(e), t.after(e), { class: "qw-active-quote" }));
5665
5685
  break;
5666
5686
  }
5667
5687
  }
5668
- return W.create(e.doc, r);
5688
+ return U.create(e.doc, r);
5669
5689
  } } })];
5670
5690
  }
5671
5691
  });
5672
5692
  // src/editor/extensions/math-utils.ts
5673
- function Gr(e) {
5693
+ function qr(e) {
5674
5694
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "&#10;");
5675
5695
  }
5676
- function Kr(e) {
5696
+ function Jr(e) {
5677
5697
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
5678
5698
  }
5679
- function qr(e, t) {
5699
+ function Yr(e, t) {
5680
5700
  let n = e ?? "";
5681
5701
  if (!n.trim()) return "";
5682
5702
  try {
5683
- return Ce.renderToString(n, {
5703
+ return we.renderToString(n, {
5684
5704
  displayMode: t,
5685
5705
  throwOnError: !1,
5686
5706
  strict: "ignore",
@@ -5688,12 +5708,12 @@ function qr(e, t) {
5688
5708
  output: "htmlAndMathml"
5689
5709
  });
5690
5710
  } catch {
5691
- return `<span class="math-fallback">${Kr(n)}</span>`;
5711
+ return `<span class="math-fallback">${Jr(n)}</span>`;
5692
5712
  }
5693
5713
  }
5694
5714
  // src/editor/extensions/math-view.tsx
5695
- function Jr({ node: e, updateAttributes: t, deleteNode: n, editor: r, getPos: i, selected: a }) {
5696
- let o = e.type.name === "mathBlock", s = String(e.attrs.latex ?? ""), c = r?.isEditable ?? !0, [l, u] = T(!1), [d, f] = T(s), m = w(null), h = w(!1), g = w(() => {}), _ = w(() => {}), v = C(() => qr(s, o), [s, o]), y = C(() => qr(d, o), [d, o]), b = () => {
5715
+ function Xr({ node: e, updateAttributes: t, deleteNode: n, editor: r, getPos: i, selected: a }) {
5716
+ let o = e.type.name === "mathBlock", s = String(e.attrs.latex ?? ""), c = r?.isEditable ?? !0, [l, u] = T(!1), [d, f] = T(s), m = w(null), h = w(!1), g = w(() => {}), _ = w(() => {}), v = C(() => Yr(s, o), [s, o]), y = C(() => Yr(d, o), [d, o]), b = () => {
5697
5717
  let e = d.trim();
5698
5718
  e ? (t({ latex: e }), u(!1)) : (u(!1), c && n?.());
5699
5719
  }, S = () => {
@@ -5719,10 +5739,10 @@ function Jr({ node: e, updateAttributes: t, deleteNode: n, editor: r, getPos: i,
5719
5739
  if (!r || typeof i != "function") return;
5720
5740
  let n = i();
5721
5741
  if (n === void 0) return;
5722
- let a = t.currentTarget.getBoundingClientRect(), o = t.clientX - a.left < a.width / 2 ? "before" : "after", s = o === "before" ? n : n + e.nodeSize, { state: c, view: l } = r, u = ie.near(c.doc.resolve(s), o === "before" ? -1 : 1);
5742
+ let a = t.currentTarget.getBoundingClientRect(), o = t.clientX - a.left < a.width / 2 ? "before" : "after", s = o === "before" ? n : n + e.nodeSize, { state: c, view: l } = r, u = ae.near(c.doc.resolve(s), o === "before" ? -1 : 1);
5723
5743
  l.dispatch(c.tr.setSelection(u)), l.focus();
5724
5744
  };
5725
- return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(F, {
5745
+ return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(P, {
5726
5746
  as: o ? "div" : "span",
5727
5747
  className: `math-node ${o ? "math-node--block" : "math-node--inline"}${a ? " is-selected" : ""}`,
5728
5748
  contentEditable: !1,
@@ -5740,7 +5760,7 @@ function Jr({ node: e, updateAttributes: t, deleteNode: n, editor: r, getPos: i,
5740
5760
  className: "math-placeholder",
5741
5761
  children: p("editor.math.empty")
5742
5762
  })
5743
- }), l && R(/* @__PURE__ */ D("div", {
5763
+ }), l && L(/* @__PURE__ */ D("div", {
5744
5764
  className: "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none",
5745
5765
  onClick: S,
5746
5766
  onMouseDown: (e) => e.preventDefault(),
@@ -5793,9 +5813,9 @@ function Jr({ node: e, updateAttributes: t, deleteNode: n, editor: r, getPos: i,
5793
5813
  }), document.body)] });
5794
5814
  }
5795
5815
  // src/editor/extensions/math.ts
5796
- var Yr = /(?:^|[^\\$])\$([^\s$](?:[^$\n]*[^\s$])?)\$$/, Xr = /^\$\$([\s\S]+?)\$\$$/;
5797
- function Zr(e) {
5798
- return new H({ appendTransaction(t, n, r) {
5816
+ var Zr = /(?:^|[^\\$])\$([^\s$](?:[^$\n]*[^\s$])?)\$$/, Qr = /^\$\$([\s\S]+?)\$\$$/;
5817
+ function $r(e) {
5818
+ return new V({ appendTransaction(t, n, r) {
5799
5819
  if (!e.isEditable || e.view.composing || !t.some((e) => e.docChanged)) return null;
5800
5820
  let i = r.schema.nodes.paragraph, a = r.schema.nodes.mathBlock;
5801
5821
  if (!i || !a) return null;
@@ -5820,14 +5840,14 @@ function Zr(e) {
5820
5840
  let t = a.create({ latex: e.latex });
5821
5841
  c.replaceWith(e.from, e.to, t);
5822
5842
  let n = e.from + t.nodeSize, r = c.doc.resolve(n);
5823
- r.nodeAfter && r.nodeAfter.isTextblock || c.insert(n, i.create()), c.setSelection(ie.near(c.doc.resolve(n), 1));
5843
+ r.nodeAfter && r.nodeAfter.isTextblock || c.insert(n, i.create()), c.setSelection(ae.near(c.doc.resolve(n), 1));
5824
5844
  }
5825
5845
  return c;
5826
5846
  } });
5827
5847
  }
5828
- function Qr(e) {
5829
- return new ne({
5830
- find: Yr,
5848
+ function ei(e) {
5849
+ return new re({
5850
+ find: Zr,
5831
5851
  handler: ({ state: t, range: n, match: r }) => {
5832
5852
  let i = r[1], a = r[0].indexOf("$");
5833
5853
  if (a < 0) return;
@@ -5836,18 +5856,18 @@ function Qr(e) {
5836
5856
  }
5837
5857
  });
5838
5858
  }
5839
- function $r(e) {
5840
- return new ne({
5841
- find: Xr,
5859
+ function ti(e) {
5860
+ return new re({
5861
+ find: Qr,
5842
5862
  handler: ({ state: t, range: n, match: r }) => {
5843
5863
  let i = r[1].trim();
5844
5864
  if (!i) return;
5845
5865
  let a = t.doc.resolve(n.from), o = a.depth, s = a.before(o), c = a.after(o), l = e.create({ latex: i }), u = t.tr.replaceWith(s, c, l), d = s + l.nodeSize, f = u.doc.resolve(d);
5846
- f.nodeAfter && f.nodeAfter.isTextblock || u.insert(d, t.schema.nodes.paragraph.create()), u.setSelection(ie.near(u.doc.resolve(d), 1));
5866
+ f.nodeAfter && f.nodeAfter.isTextblock || u.insert(d, t.schema.nodes.paragraph.create()), u.setSelection(ae.near(u.doc.resolve(d), 1));
5847
5867
  }
5848
5868
  });
5849
5869
  }
5850
- function ei(e, t) {
5870
+ function ni(e, t) {
5851
5871
  let n = e.src, r = e.pos;
5852
5872
  if (n.charCodeAt(r) !== 36 || n.charCodeAt(r + 1) === 36) return !1;
5853
5873
  let i = r + 1;
@@ -5862,11 +5882,11 @@ function ei(e, t) {
5862
5882
  if (!a || /^\s|\s$/.test(a)) return !1;
5863
5883
  if (!t) {
5864
5884
  let t = e.push("html_inline", "", 0);
5865
- t.content = `<span data-type="inline-math" data-latex="${Gr(a)}"></span>`;
5885
+ t.content = `<span data-type="inline-math" data-latex="${qr(a)}"></span>`;
5866
5886
  }
5867
5887
  return e.pos = i + 1, !0;
5868
5888
  }
5869
- function ti(e, t, n, r) {
5889
+ function ri(e, t, n, r) {
5870
5890
  let i = e.bMarks[t] + e.tShift[t], a = e.eMarks[t];
5871
5891
  if (i + 1 >= a || e.src.charCodeAt(i) !== 36 || e.src.charCodeAt(i + 1) !== 36) return !1;
5872
5892
  let o = e.src.slice(i, a).trim(), s = "", c = t + 1;
@@ -5889,12 +5909,12 @@ function ti(e, t, n, r) {
5889
5909
  }
5890
5910
  if (r) return !0;
5891
5911
  let l = e.push("html_block", "", 0);
5892
- return l.content = `<div data-type="block-math" data-latex="${Gr(s.trim())}"></div>\n`, e.line = c, !0;
5912
+ return l.content = `<div data-type="block-math" data-latex="${qr(s.trim())}"></div>\n`, e.line = c, !0;
5893
5913
  }
5894
- function ni(e) {
5895
- e.__qingwuMathReg || (e.__qingwuMathReg = !0, e.inline.ruler.before("backticks", "qingwu_math_inline", ei), e.block.ruler.before("fence", "qingwu_math_block", ti, { alt: ["paragraph"] }));
5914
+ function ii(e) {
5915
+ e.__qingwuMathReg || (e.__qingwuMathReg = !0, e.inline.ruler.before("backticks", "qingwu_math_inline", ni), e.block.ruler.before("fence", "qingwu_math_block", ri, { alt: ["paragraph"] }));
5896
5916
  }
5897
- function ri(e) {
5917
+ function ai(e) {
5898
5918
  return { markdown: {
5899
5919
  serialize(t, n) {
5900
5920
  let r = String(n.attrs.latex ?? "");
@@ -5906,11 +5926,11 @@ function ri(e) {
5906
5926
  }
5907
5927
  },
5908
5928
  parse: { setup(e) {
5909
- ni(e);
5929
+ ii(e);
5910
5930
  } }
5911
5931
  } };
5912
5932
  }
5913
- var ii = re.create({
5933
+ var oi = ie.create({
5914
5934
  name: "mathInline",
5915
5935
  group: "inline",
5916
5936
  inline: !0,
@@ -5938,18 +5958,18 @@ var ii = re.create({
5938
5958
  ];
5939
5959
  let r = document.createElement("span");
5940
5960
  for (let [e, t] of Object.entries(n)) r.setAttribute(e, t);
5941
- return r.innerHTML = qr(t, !1), r;
5961
+ return r.innerHTML = Yr(t, !1), r;
5942
5962
  },
5943
5963
  addNodeView() {
5944
- return I(Jr);
5964
+ return F(Xr);
5945
5965
  },
5946
5966
  addInputRules() {
5947
- return [Qr(this.type)];
5967
+ return [ei(this.type)];
5948
5968
  },
5949
5969
  addStorage() {
5950
- return ri(!1);
5970
+ return ai(!1);
5951
5971
  }
5952
- }), ai = re.create({
5972
+ }), si = ie.create({
5953
5973
  name: "mathBlock",
5954
5974
  group: "block",
5955
5975
  atom: !0,
@@ -5976,39 +5996,39 @@ var ii = re.create({
5976
5996
  ];
5977
5997
  let r = document.createElement("div");
5978
5998
  for (let [e, t] of Object.entries(n)) r.setAttribute(e, t);
5979
- return r.innerHTML = qr(t, !0), r;
5999
+ return r.innerHTML = Yr(t, !0), r;
5980
6000
  },
5981
6001
  addNodeView() {
5982
- return I(Jr);
6002
+ return F(Xr);
5983
6003
  },
5984
6004
  addInputRules() {
5985
- return [$r(this.type)];
6005
+ return [ti(this.type)];
5986
6006
  },
5987
6007
  addProseMirrorPlugins() {
5988
- return [Zr(this.editor)];
6008
+ return [$r(this.editor)];
5989
6009
  },
5990
6010
  addStorage() {
5991
- return ri(!0);
6011
+ return ai(!0);
5992
6012
  }
5993
- }), oi = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, si = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, ci = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
5994
- function li(e) {
6013
+ }), ci = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, li = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, ui = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
6014
+ function di(e) {
5995
6015
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
5996
6016
  }
5997
- function ui(e) {
6017
+ function fi(e) {
5998
6018
  let t = e.trim().replace(/\\/g, "/");
5999
6019
  return t.split("/").pop() || t;
6000
6020
  }
6001
- function di(e, t) {
6021
+ function pi(e, t) {
6002
6022
  let n = e.src.slice(e.pos), r = /^!\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !0;
6003
6023
  if (r || (r = /^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !1), !r) return !1;
6004
6024
  let a = r[1].trim(), o = r[2]?.trim();
6005
6025
  if (!t) {
6006
- let t = o || ui(a);
6026
+ let t = o || fi(a);
6007
6027
  if (i) {
6008
6028
  let n = "";
6009
- if (oi.test(a) || /^data:image\//i.test(a)) n = `<img src="${li(a)}" alt="${li(t)}">`;
6010
- else if (si.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${li(a)}"></div>`;
6011
- else if (ci.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${li(a)}"></audio>`;
6029
+ if (ci.test(a) || /^data:image\//i.test(a)) n = `<img src="${di(a)}" alt="${di(t)}">`;
6030
+ else if (li.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${di(a)}"></div>`;
6031
+ else if (ui.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${di(a)}"></audio>`;
6012
6032
  else {
6013
6033
  let n = e.push("link_open", "a", 1);
6014
6034
  n.attrs = [["href", a]];
@@ -6026,14 +6046,14 @@ function di(e, t) {
6026
6046
  }
6027
6047
  return e.pos += r[0].length, !0;
6028
6048
  }
6029
- var fi = z.create({
6049
+ var mi = R.create({
6030
6050
  name: "obsidianMarkdown",
6031
6051
  addStorage() {
6032
6052
  return { markdown: { parse: { setup(e) {
6033
- e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", di));
6053
+ e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", pi));
6034
6054
  } } } };
6035
6055
  }
6036
- }), pi = z.create({
6056
+ }), hi = R.create({
6037
6057
  name: "qingwuUI",
6038
6058
  priority: 1e3,
6039
6059
  addKeyboardShortcuts() {
@@ -6044,7 +6064,7 @@ var fi = z.create({
6044
6064
  }
6045
6065
  });
6046
6066
  // src/editor/utils/render-probe.ts
6047
- function mi(e, t) {
6067
+ function gi(e, t) {
6048
6068
  return new Promise((n) => {
6049
6069
  if (typeof Image != "function") return n(!0);
6050
6070
  let r = new Image(), i = !1, a = setTimeout(() => o(!1), t), o = (e) => {
@@ -6053,21 +6073,21 @@ function mi(e, t) {
6053
6073
  r.onload = () => o(!0), r.onerror = () => o(!1), r.src = e;
6054
6074
  });
6055
6075
  }
6056
- async function hi(e, t = 8e3) {
6057
- if (await mi(e, t)) return !0;
6076
+ async function _i(e, t = 8e3) {
6077
+ if (await gi(e, t)) return !0;
6058
6078
  try {
6059
6079
  let r = await n(e);
6060
6080
  if (!r) return !1;
6061
6081
  let i = await fetch(e, { headers: r });
6062
6082
  if (!i.ok) return !1;
6063
- let a = URL.createObjectURL(await i.blob()), o = await mi(a, t);
6083
+ let a = URL.createObjectURL(await i.blob()), o = await gi(a, t);
6064
6084
  return URL.revokeObjectURL(a), o;
6065
6085
  } catch {
6066
6086
  return !1;
6067
6087
  }
6068
6088
  }
6069
6089
  // src/editor/utils/resolve-local-media.ts
6070
- function gi() {
6090
+ function vi() {
6071
6091
  return {
6072
6092
  uploaded: 0,
6073
6093
  sessionOnly: 0,
@@ -6077,10 +6097,10 @@ function gi() {
6077
6097
  readFailed: []
6078
6098
  };
6079
6099
  }
6080
- function _i(e, t) {
6100
+ function yi(e, t) {
6081
6101
  e.uploaded += t.uploaded, e.sessionOnly += t.sessionOnly, e.limitRejected += t.limitRejected, e.renderFailed += t.renderFailed, e.missing.push(...t.missing), e.readFailed.push(...t.readFailed);
6082
6102
  }
6083
- function vi(e, t, n, r) {
6103
+ function bi(e, t, n, r) {
6084
6104
  let { state: i } = e, a = [];
6085
6105
  if (i.doc.descendants((e, n) => {
6086
6106
  e.attrs?.src === t && a.push(n);
@@ -6096,7 +6116,7 @@ function vi(e, t, n, r) {
6096
6116
  }
6097
6117
  return e.dispatch(o), !0;
6098
6118
  }
6099
- function yi(e, t, n) {
6119
+ function xi(e, t, n) {
6100
6120
  let { state: r } = e, i = r.schema.marks.link;
6101
6121
  if (!i) return !1;
6102
6122
  let a = [];
@@ -6114,7 +6134,7 @@ function yi(e, t, n) {
6114
6134
  }));
6115
6135
  return e.dispatch(o), !0;
6116
6136
  }
6117
- function bi(e) {
6137
+ function Si(e) {
6118
6138
  let t = /* @__PURE__ */ new Map();
6119
6139
  for (let n of e) {
6120
6140
  let e = t.get(n.normalized);
@@ -6122,7 +6142,7 @@ function bi(e) {
6122
6142
  }
6123
6143
  return Array.from(t.values());
6124
6144
  }
6125
- async function xi(e, t, n, r) {
6145
+ async function Ci(e, t, n, r) {
6126
6146
  if (n.length === 0) return "sessionOnly";
6127
6147
  let i = n[0], a = mn(t);
6128
6148
  if (a) {
@@ -6132,26 +6152,26 @@ async function xi(e, t, n, r) {
6132
6152
  let o = n.filter((e) => !e.isLink), c = n.filter((e) => e.isLink);
6133
6153
  if (o.length === 0) try {
6134
6154
  let t = await s().upload(r, "editor"), n = !1;
6135
- for (let r of c) yi(e, r.src, t) && (n = !0);
6155
+ for (let r of c) xi(e, r.src, t) && (n = !0);
6136
6156
  return n ? "uploaded" : "sessionOnly";
6137
6157
  } catch (e) {
6138
6158
  return console.error(`本地附件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), "sessionOnly";
6139
6159
  }
6140
6160
  let l = URL.createObjectURL(r), u = !1;
6141
- for (let t of o) vi(e, t.src, l, r.size) && (u = !0);
6161
+ for (let t of o) bi(e, t.src, l, r.size) && (u = !0);
6142
6162
  let d;
6143
6163
  try {
6144
6164
  d = await s().upload(r, "editor");
6145
6165
  } catch (e) {
6146
6166
  return console.error(`本地文件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), URL.revokeObjectURL(l), "sessionOnly";
6147
6167
  }
6148
- URL.revokeObjectURL(l), u && vi(e, l, d, r.size);
6149
- for (let t of c) yi(e, t.src, d);
6150
- return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await hi(d) ? "uploaded" : "renderFailed" : "uploaded";
6168
+ URL.revokeObjectURL(l), u && bi(e, l, d, r.size);
6169
+ for (let t of c) xi(e, t.src, d);
6170
+ return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await _i(d) ? "uploaded" : "renderFailed" : "uploaded";
6151
6171
  }
6152
- function Si(e, t) {
6172
+ function wi(e, t) {
6153
6173
  let n = [], r = [];
6154
- for (let i of bi(e)) {
6174
+ for (let i of Si(e)) {
6155
6175
  let e = i[0], a = t.get(e.basename);
6156
6176
  a ? (n.push({
6157
6177
  refs: i,
@@ -6163,30 +6183,30 @@ function Si(e, t) {
6163
6183
  unmatched: r
6164
6184
  };
6165
6185
  }
6166
- async function Ci(e, t, n, r) {
6167
- let i = gi();
6168
- for (let a of bi(n)) {
6169
- let n = a[0], { file: o, readError: s } = await Ar(r, n.src);
6186
+ async function Ti(e, t, n, r) {
6187
+ let i = vi();
6188
+ for (let a of Si(n)) {
6189
+ let n = a[0], { file: o, readError: s } = await Mr(r, n.src);
6170
6190
  if (!o) {
6171
6191
  s ? (console.warn(`本地文件「${n.basename}」在所选文件夹中找到但读取失败:`, s), i.readFailed.push(n)) : (console.warn(`本地文件「${n.basename}」未在所选文件夹「${r.name}」中找到`), i.missing.push(n));
6172
6192
  continue;
6173
6193
  }
6174
- let c = await xi(e, t, a, o);
6194
+ let c = await Ci(e, t, a, o);
6175
6195
  i[c]++;
6176
6196
  }
6177
6197
  return i;
6178
6198
  }
6179
- function wi(e) {
6199
+ function Ei(e) {
6180
6200
  let t = e.map((e) => e.basename);
6181
6201
  return t.length <= 3 ? t.join("、") : `${t.slice(0, 3).join("、")} 等 ${t.length} 个文件`;
6182
6202
  }
6183
- function Ti(e) {
6203
+ function Di(e) {
6184
6204
  let t = [];
6185
- if (e.uploaded > 0 && t.push(`${e.uploaded} 个已上传至存储`), e.sessionOnly > 0 && t.push(`${e.sessionOnly} 个仅本次会话可见(未配置存储或上传失败)`), e.limitRejected > 0 && t.push(`${e.limitRejected} 个超出大小限制`), e.renderFailed > 0 && t.push(`${e.renderFailed} 个上传成功但页面渲染失败(存储 URL 无法在浏览器访问/解码)`), e.readFailed.length > 0 && t.push(`${e.readFailed.length} 个找到但读取失败:${wi(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${wi(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
6205
+ if (e.uploaded > 0 && t.push(`${e.uploaded} 个已上传至存储`), e.sessionOnly > 0 && t.push(`${e.sessionOnly} 个仅本次会话可见(未配置存储或上传失败)`), e.limitRejected > 0 && t.push(`${e.limitRejected} 个超出大小限制`), e.renderFailed > 0 && t.push(`${e.renderFailed} 个上传成功但页面渲染失败(存储 URL 无法在浏览器访问/解码)`), e.readFailed.length > 0 && t.push(`${e.readFailed.length} 个找到但读取失败:${Ei(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${Ei(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
6186
6206
  let n = e.uploaded > 0 && e.renderFailed === 0 && e.missing.length === 0 && e.readFailed.length === 0;
6187
6207
  Z(`本地文件解析完成:${t.join(";")}`, n ? "success" : "info");
6188
6208
  }
6189
- function Ei(e) {
6209
+ function Oi(e) {
6190
6210
  return new Promise((t) => {
6191
6211
  let n = document.createElement("div");
6192
6212
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -6213,7 +6233,7 @@ function Ei(e) {
6213
6233
  u.type = "button", u.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", u.textContent = "选择文件夹…", u.addEventListener("click", () => s("pick")), o.append(l, u), r.append(i, a, o), n.appendChild(r), document.addEventListener("keydown", c), document.body.appendChild(n);
6214
6234
  });
6215
6235
  }
6216
- function Di(e) {
6236
+ function ki(e) {
6217
6237
  let t = document.createElement("div");
6218
6238
  t.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
6219
6239
  let n = document.createElement("div");
@@ -6235,7 +6255,7 @@ function Di(e) {
6235
6255
  let c = document.createElement("button");
6236
6256
  c.type = "button", c.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", c.textContent = "知道了", c.addEventListener("click", o), a.append(c), n.append(r, i, a), t.appendChild(n), document.addEventListener("keydown", s), document.body.appendChild(t);
6237
6257
  }
6238
- function Oi(e) {
6258
+ function Ai(e) {
6239
6259
  return new Promise((t) => {
6240
6260
  let n = document.createElement("div");
6241
6261
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -6261,8 +6281,8 @@ function Oi(e) {
6261
6281
  u.type = "button", u.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", u.textContent = "选择文件…", u.addEventListener("click", () => s("pick")), o.append(l, u), r.append(i, a, o), n.appendChild(r), document.addEventListener("keydown", c), document.body.appendChild(n);
6262
6282
  });
6263
6283
  }
6264
- async function ki(e, t, n) {
6265
- let r = gi(), i = bi(n), a = await Dr();
6284
+ async function ji(e, t, n) {
6285
+ let r = vi(), i = Si(n), a = await kr();
6266
6286
  if (!a) {
6267
6287
  for (let e of i) r.missing.push(e[0]);
6268
6288
  return r;
@@ -6275,13 +6295,13 @@ async function ki(e, t, n) {
6275
6295
  continue;
6276
6296
  }
6277
6297
  o.delete(i.basename);
6278
- let s = await xi(e, t, n, a);
6298
+ let s = await Ci(e, t, n, a);
6279
6299
  r[s]++;
6280
6300
  }
6281
6301
  return r;
6282
6302
  }
6283
6303
  // src/editor/extensions/relative-media.ts
6284
- var Ai = z.create({
6304
+ var Mi = R.create({
6285
6305
  name: "relativeMedia",
6286
6306
  addStorage() {
6287
6307
  return {
@@ -6291,42 +6311,42 @@ var Ai = z.create({
6291
6311
  },
6292
6312
  addProseMirrorPlugins() {
6293
6313
  let e = this.editor, t = this.storage, n = !1, r = null, i = async (n, i) => {
6294
- let a = e.view, o = gi(), { matched: s, unmatched: c } = Si(n, t.clipboardFiles);
6314
+ let a = e.view, o = vi(), { matched: s, unmatched: c } = wi(n, t.clipboardFiles);
6295
6315
  for (let { refs: t, file: n } of s) {
6296
- let r = await xi(a, e, t, n);
6316
+ let r = await Ci(a, e, t, n);
6297
6317
  o[r]++;
6298
6318
  }
6299
6319
  if (c.length > 0) {
6300
- let t = bi(c).length;
6301
- if (wr()) {
6320
+ let t = Si(c).length;
6321
+ if (Er()) {
6302
6322
  let n = i ?? null;
6303
- if (n || (await Ei(t) === "pick" ? (n = await Tr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
6304
- r = n, _i(o, await Ci(a, e, c, n));
6323
+ if (n || (await Oi(t) === "pick" ? (n = await Dr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
6324
+ r = n, yi(o, await Ti(a, e, c, n));
6305
6325
  let t = [...o.missing, ...o.readFailed];
6306
- if (t.length > 0 && Er() && await Oi(t.map((e) => e.basename)) === "pick") {
6307
- let n = await ki(a, e, t);
6308
- _i(o, n), o.missing = n.missing, o.readFailed = [];
6326
+ if (t.length > 0 && Or() && await Ai(t.map((e) => e.basename)) === "pick") {
6327
+ let n = await ji(a, e, t);
6328
+ yi(o, n), o.missing = n.missing, o.readFailed = [];
6309
6329
  }
6310
6330
  }
6311
- } else Di(t);
6331
+ } else ki(t);
6312
6332
  }
6313
- Ti(o);
6333
+ Di(o);
6314
6334
  }, a = () => {
6315
6335
  if (!e || e.isDestroyed || t.pausedUntilPaste) return;
6316
- let a = o(), s = Mr(e.state.doc, a);
6336
+ let a = o(), s = Pr(e.state.doc, a);
6317
6337
  if (s.length === 0 || n) return;
6318
6338
  n = !0;
6319
6339
  let c = new Set(s.map((e) => e.src));
6320
6340
  i(s).then(() => {
6321
6341
  if (e.isDestroyed) return;
6322
- let t = Mr(e.state.doc, a).filter((e) => !c.has(e.src));
6342
+ let t = Pr(e.state.doc, a).filter((e) => !c.has(e.src));
6323
6343
  if (t.length !== 0) return i(t, r);
6324
6344
  }).finally(() => {
6325
- n = !1, e && !e.isDestroyed && (t.pausedUntilPaste = Mr(e.state.doc, a).length > 0);
6345
+ n = !1, e && !e.isDestroyed && (t.pausedUntilPaste = Pr(e.state.doc, a).length > 0);
6326
6346
  });
6327
6347
  };
6328
- return [new H({
6329
- key: new U("relativeMedia"),
6348
+ return [new V({
6349
+ key: new H("relativeMedia"),
6330
6350
  props: { handlePaste(e, n) {
6331
6351
  let r = n.clipboardData?.files;
6332
6352
  return t.clipboardFiles = new Map(Array.from(r ?? []).map((e) => [e.name.toLowerCase(), e])), t.pausedUntilPaste = !1, !1;
@@ -6336,18 +6356,18 @@ var Ai = z.create({
6336
6356
  }
6337
6357
  })];
6338
6358
  }
6339
- }), ji = new U("slashCommand");
6340
- function Mi(e) {
6341
- return z.create({
6359
+ }), Ni = new H("slashCommand");
6360
+ function Pi(e) {
6361
+ return R.create({
6342
6362
  name: "slashCommand",
6343
6363
  addProseMirrorPlugins() {
6344
6364
  let t = {
6345
6365
  char: "/",
6346
- pluginKey: ji,
6366
+ pluginKey: Ni,
6347
6367
  findSuggestionMatch: (e) => {
6348
6368
  let { $position: t } = e;
6349
6369
  for (let e = t.depth; e >= 0; e--) if (t.node(e).type.name === "codeBlock") return null;
6350
- return t.marks().some((e) => e.type.name === "code") ? null : Ee(e);
6370
+ return t.marks().some((e) => e.type.name === "code") ? null : De(e);
6351
6371
  },
6352
6372
  allow: ({ editor: e, state: t }) => {
6353
6373
  if (!e.isEditable) return !1;
@@ -6424,7 +6444,7 @@ function Mi(e) {
6424
6444
  } else if (e.key === "Escape") {
6425
6445
  e.preventDefault();
6426
6446
  let t = a?.view;
6427
- t && Te(t, ji);
6447
+ t && Ee(t, Ni);
6428
6448
  }
6429
6449
  });
6430
6450
  }
@@ -6442,7 +6462,7 @@ function Mi(e) {
6442
6462
  if (!e || e.style.display === "none" || n.target instanceof Node && e.contains(n.target) || t) return;
6443
6463
  let r = a?.view;
6444
6464
  r && (t = !0, window.setTimeout(() => {
6445
- t = !1, e?.style.display !== "none" && Te(r, ji);
6465
+ t = !1, e?.style.display !== "none" && Ee(r, Ni);
6446
6466
  }, 0));
6447
6467
  }, document.addEventListener("mousedown", o, !0), document.addEventListener("touchstart", o, !0);
6448
6468
  }
@@ -6466,11 +6486,11 @@ function Mi(e) {
6466
6486
  };
6467
6487
  }
6468
6488
  };
6469
- return [we({
6489
+ return [Te({
6470
6490
  editor: this.editor,
6471
6491
  ...t
6472
- }), new H({
6473
- key: new U("slashCodeBlockGuard"),
6492
+ }), new V({
6493
+ key: new H("slashCodeBlockGuard"),
6474
6494
  appendTransaction: (e, t, n) => {
6475
6495
  let { $from: r } = n.selection, i = !1;
6476
6496
  for (let e = r.depth; e >= 0; e--) if (r.node(e).type.name === "codeBlock") {
@@ -6478,14 +6498,14 @@ function Mi(e) {
6478
6498
  break;
6479
6499
  }
6480
6500
  if (!i && !r.marks().some((e) => e.type.name === "code")) return null;
6481
- let a = ji.getState(n);
6482
- return a && a.active ? n.tr.setMeta(ji, { exit: !0 }) : null;
6501
+ let a = Ni.getState(n);
6502
+ return a && a.active ? n.tr.setMeta(Ni, { exit: !0 }) : null;
6483
6503
  }
6484
6504
  })];
6485
6505
  }
6486
6506
  });
6487
6507
  }
6488
- function Ni(e, t) {
6508
+ function Fi(e, t) {
6489
6509
  return [
6490
6510
  {
6491
6511
  title: e("editor.slash.heading1"),
@@ -6612,7 +6632,7 @@ function Ni(e, t) {
6612
6632
  name: r.name,
6613
6633
  size: r.size
6614
6634
  });
6615
- s && (Un(e.view, s), await Rr(e.view, r, o));
6635
+ s && (Un(e.view, s), await Br(e.view, r, o));
6616
6636
  }, n.click();
6617
6637
  }
6618
6638
  },
@@ -6642,7 +6662,7 @@ function Ni(e, t) {
6642
6662
  } catch {
6643
6663
  continue;
6644
6664
  }
6645
- await Rr(e.view, n, a);
6665
+ await Br(e.view, n, a);
6646
6666
  }
6647
6667
  }
6648
6668
  }, n.click();
@@ -6651,9 +6671,9 @@ function Ni(e, t) {
6651
6671
  ];
6652
6672
  }
6653
6673
  // src/editor/extensions/index.ts
6654
- var Pi = G.extend({
6674
+ var Ii = W.extend({
6655
6675
  addNodeView() {
6656
- return I(En);
6676
+ return F(En);
6657
6677
  },
6658
6678
  addAttributes() {
6659
6679
  return {
@@ -6676,85 +6696,86 @@ var Pi = G.extend({
6676
6696
  };
6677
6697
  }
6678
6698
  });
6679
- function Fi(e = {}) {
6699
+ function Li(e = {}) {
6680
6700
  return [
6681
- q.configure({
6701
+ G.configure({
6682
6702
  codeBlock: !1,
6683
6703
  horizontalRule: !1,
6684
6704
  underline: !1,
6685
6705
  link: !1
6686
6706
  }),
6687
- K,
6688
- oe.configure({
6707
+ ce,
6708
+ se.configure({
6689
6709
  openOnClick: !0,
6690
6710
  HTMLAttributes: {
6691
6711
  rel: "noopener noreferrer",
6692
6712
  target: "_blank"
6693
6713
  }
6694
6714
  }),
6695
- Pi.configure({
6715
+ Ii.configure({
6696
6716
  inline: !1,
6697
6717
  allowBase64: !0
6698
6718
  }),
6699
- ge,
6700
- he.configure({ nested: !0 }),
6701
- ce.configure({ multicolor: !0 }),
6702
6719
  _e,
6703
- J,
6704
- se.configure(e.maxLength ? { limit: e.maxLength } : {}),
6720
+ q.configure({ nested: !0 }),
6721
+ ue.configure({ multicolor: !0 }),
6722
+ ve,
6705
6723
  le,
6706
- Ur,
6707
- ii,
6708
- ai,
6709
- gr,
6710
- de.configure({ resizable: !0 }),
6724
+ K.configure(e.maxLength ? { limit: e.maxLength } : {}),
6725
+ de,
6726
+ Gr,
6727
+ oi,
6728
+ si,
6729
+ vr,
6730
+ pe.configure({ resizable: !0 }),
6731
+ ge,
6711
6732
  me,
6712
- fe,
6713
- pe,
6714
- ve.configure({
6733
+ he,
6734
+ ye.configure({
6715
6735
  html: !0,
6716
6736
  transformPastedText: !0,
6717
6737
  transformCopiedText: !1
6718
6738
  }),
6719
- ue.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
6720
- Mi(() => Ni((e) => p(e), {
6739
+ fe.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
6740
+ Pi(() => Fi((e) => p(e), {
6721
6741
  maxAttachmentSize: e.maxAttachmentSize,
6722
6742
  maxTotalAttachmentSize: e.maxTotalAttachmentSize
6723
6743
  })),
6724
- Br.configure({
6744
+ Hr.configure({
6725
6745
  maxAttachmentSize: e.maxAttachmentSize,
6726
6746
  maxTotalAttachmentSize: e.maxTotalAttachmentSize
6727
6747
  }),
6728
- Ai,
6729
- fi,
6748
+ Mi,
6749
+ mi,
6750
+ tr,
6730
6751
  At,
6752
+ Kr,
6731
6753
  Wr,
6732
- Hr,
6733
- pi,
6754
+ hi,
6734
6755
  $n,
6735
6756
  Kn,
6736
6757
  Vn
6737
6758
  ];
6738
6759
  }
6739
6760
  // src/editor/extensions/bubble-menu.tsx
6740
- function Ii(e) {
6761
+ function Ri(e) {
6741
6762
  let t = e.trim(), n = /^\$([^$]+?)\$$/.exec(t);
6742
6763
  if (n) return n[1].trim();
6743
6764
  let r = /^\$\$([\s\S]+?)\$\$$/.exec(t);
6744
6765
  return r ? r[1].trim() : t;
6745
6766
  }
6746
- function Li(e) {
6767
+ function zi(e) {
6747
6768
  let t = e.trim();
6748
6769
  return t ? /^\${1,2}[\s\S]*\${1,2}$/.test(t) ? !0 : /[0-9=]/.test(t) && /[+\-*/^=(){}_\\]/.test(t) : !1;
6749
6770
  }
6750
- var Ri = "https://www.bing.com/search?q={query}";
6751
- function zi(e) {
6752
- Ri = e;
6771
+ var Bi = "https://www.bing.com/search?q={query}";
6772
+ function Vi(e) {
6773
+ Bi = e;
6753
6774
  }
6754
- function Bi() {
6755
- return Ri;
6775
+ function Hi() {
6776
+ return Bi;
6756
6777
  }
6757
- function Vi(e) {
6778
+ function Ui(e) {
6758
6779
  return [
6759
6780
  {
6760
6781
  key: "bold",
@@ -6800,7 +6821,7 @@ function Vi(e) {
6800
6821
  if (!e.isEditable) return;
6801
6822
  let { from: t, to: n } = e.state.selection;
6802
6823
  if (t === n) return;
6803
- let r = Ii(e.state.doc.textBetween(t, n, "\n"));
6824
+ let r = Ri(e.state.doc.textBetween(t, n, "\n"));
6804
6825
  r && e.chain().focus().insertContentAt({
6805
6826
  from: t,
6806
6827
  to: n
@@ -6847,7 +6868,7 @@ function Vi(e) {
6847
6868
  if (e.isActive("table")) return;
6848
6869
  let { from: t, to: n } = e.state.selection, r = e.state.doc.textBetween(t, n, " ").trim();
6849
6870
  if (!r) return;
6850
- let i = Ri.replace("{query}", encodeURIComponent(r));
6871
+ let i = Bi.replace("{query}", encodeURIComponent(r));
6851
6872
  window.open(i, "_blank", "noopener,noreferrer");
6852
6873
  }
6853
6874
  },
@@ -6878,9 +6899,9 @@ function Vi(e) {
6878
6899
  }
6879
6900
  ];
6880
6901
  }
6881
- z.create({ name: "bubbleMenu" });
6902
+ R.create({ name: "bubbleMenu" });
6882
6903
  // src/editor/extensions/table-toolbar.tsx
6883
- function Hi(e) {
6904
+ function Wi(e) {
6884
6905
  let { $from: t } = e.state.selection;
6885
6906
  for (let e = t.depth; e > 0; e--) {
6886
6907
  let n = t.node(e);
@@ -6891,7 +6912,7 @@ function Hi(e) {
6891
6912
  }
6892
6913
  return null;
6893
6914
  }
6894
- function Ui(e) {
6915
+ function Gi(e) {
6895
6916
  let t = [];
6896
6917
  return e.forEach((e) => {
6897
6918
  let n = [];
@@ -6900,7 +6921,7 @@ function Ui(e) {
6900
6921
  }), t.push(n);
6901
6922
  }), t;
6902
6923
  }
6903
- function Wi(e) {
6924
+ function Ki(e) {
6904
6925
  if (e.length === 0) return "";
6905
6926
  let t = Math.max(...e.map((e) => e.length), 1), n = (e) => e.concat(Array(Math.max(0, t - e.length)).fill("")).slice(0, t), r = n(e[0]), i = e.slice(1).map(n), a = (e) => `| ${e.join(" | ")} |`;
6906
6927
  return [
@@ -6909,11 +6930,11 @@ function Wi(e) {
6909
6930
  ...i.map(a)
6910
6931
  ].join("\n");
6911
6932
  }
6912
- function Gi(e) {
6933
+ function qi(e) {
6913
6934
  let t = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e;
6914
6935
  return e.map((e) => e.map(t).join(",")).join("\n");
6915
6936
  }
6916
- function Ki(e) {
6937
+ function Ji(e) {
6917
6938
  let t = e.trim();
6918
6939
  if (!t) return null;
6919
6940
  let n = t.split(/\r?\n/);
@@ -6927,7 +6948,7 @@ function Ki(e) {
6927
6948
  }
6928
6949
  return null;
6929
6950
  }
6930
- function qi({ editor: e }) {
6951
+ function Yi({ editor: e }) {
6931
6952
  let [t, n] = T(null), [r, i] = T(!1), [a, o] = T(!1), s = w(null), c = w(null), l = e.isEditable, u = b(() => {
6932
6953
  c.current != null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
6933
6954
  c.current = null;
@@ -6943,7 +6964,7 @@ function qi({ editor: e }) {
6943
6964
  n(null);
6944
6965
  return;
6945
6966
  }
6946
- let t = Hi(e);
6967
+ let t = Wi(e);
6947
6968
  n(t ? (e) => e === t.pos ? e : t.pos : null);
6948
6969
  }, [e]);
6949
6970
  x(() => (d(), e.on("selectionUpdate", d), e.on("focus", d), window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
@@ -6968,24 +6989,24 @@ function qi({ editor: e }) {
6968
6989
  });
6969
6990
  return n.nodes.table.create(null, i);
6970
6991
  }, p = () => {
6971
- let t = Hi(e);
6992
+ let t = Wi(e);
6972
6993
  if (!t) return;
6973
- let n = Wi(Ui(t.node));
6994
+ let n = Ki(Gi(t.node));
6974
6995
  navigator.clipboard?.writeText(n), i(!0), setTimeout(() => i(!1), 1500);
6975
6996
  }, m = () => {
6976
- let t = Hi(e);
6997
+ let t = Wi(e);
6977
6998
  if (!t) return;
6978
- let n = Gi(Ui(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
6999
+ let n = qi(Gi(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
6979
7000
  a.href = i, a.download = "table.csv", document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
6980
7001
  }, h = async () => {
6981
7002
  if (l) try {
6982
7003
  let t = await navigator.clipboard?.readText();
6983
7004
  if (!t) return;
6984
- let n = Ki(t);
7005
+ let n = Ji(t);
6985
7006
  if (!n || n.length === 0) return;
6986
7007
  let r = f(n);
6987
7008
  if (!r) return;
6988
- let i = Hi(e), a = e.chain().focus();
7009
+ let i = Wi(e), a = e.chain().focus();
6989
7010
  if (i) {
6990
7011
  let t = Math.min(i.pos + i.node.nodeSize, e.state.doc.content.size);
6991
7012
  a.setTextSelection(t);
@@ -7138,7 +7159,7 @@ function qi({ editor: e }) {
7138
7159
  });
7139
7160
  }
7140
7161
  // src/editor/ai-editor.tsx
7141
- var Ji = [
7162
+ var Xi = [
7142
7163
  {
7143
7164
  color: "#fef08a",
7144
7165
  name: "黄"
@@ -7163,9 +7184,9 @@ var Ji = [
7163
7184
  color: "#ddd6fe",
7164
7185
  name: "紫"
7165
7186
  }
7166
- ], Yi = 288, Xi = 480, Zi = 320;
7167
- function Qi(e, t, n = {}) {
7168
- let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || Yi, Xi, r - 32), o = Math.max(t || Zi, 160);
7187
+ ], Zi = 288, Qi = 480, $i = 320;
7188
+ function ea(e, t, n = {}) {
7189
+ let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || Zi, Qi, r - 32), o = Math.max(t || $i, 160);
7169
7190
  if (r < 640) {
7170
7191
  let t = Math.max(8, Math.min(e.top + 10, i - 420));
7171
7192
  return {
@@ -7206,10 +7227,10 @@ function Qi(e, t, n = {}) {
7206
7227
  arrowLeft: p
7207
7228
  };
7208
7229
  }
7209
- function $i(e) {
7230
+ function ta(e) {
7210
7231
  return /(^|\n)```|(^|\n)#{1,6}\s|(^|\n)>\s?|(^|\n)\s*([-*_])(?:\s*\4){2,}\s*(?=\n|$)|(^|\n)\s*[-*+]\s+|(^|\n)\s*\d+[.)]\s+|(^|\n)\s*<img\s+|(^|\n)\s*\|.+\||(^|\n)\s*\$\$[\s\S]*?\$\$|(^|[^\\$])\$[^\s$\n](?:[^$\n]*[^\s$\n])?\$/i.test(e);
7211
7232
  }
7212
- function ea(e, t) {
7233
+ function na(e, t) {
7213
7234
  try {
7214
7235
  let n = e.storage?.markdown?.parser;
7215
7236
  if (!n) return null;
@@ -7219,20 +7240,20 @@ function ea(e, t) {
7219
7240
  return null;
7220
7241
  }
7221
7242
  }
7222
- var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.ImageUploadDialog }))), na = y(() => import("./storage-settings-dialog-DfJuUAkg.js").then((e) => ({ default: e.StorageSettingsDialog }))), ra = y(() => import("./export-dialog-Bnbjhxoc.js").then((e) => ({ default: e.ExportDialog }))), ia = y(() => import("./video-embed-dialog-eCCrqLDP.js").then((e) => ({ default: e.VideoEmbedDialog }))), aa = y(() => import("./md-import-dialog-WLWQ4INh.js").then((e) => ({ default: e.MdImportDialog }))), oa = () => /* @__PURE__ */ O("div", {
7243
+ var ra = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.ImageUploadDialog }))), ia = y(() => import("./storage-settings-dialog-DfJuUAkg.js").then((e) => ({ default: e.StorageSettingsDialog }))), aa = y(() => import("./export-dialog-Bnbjhxoc.js").then((e) => ({ default: e.ExportDialog }))), oa = y(() => import("./video-embed-dialog-eCCrqLDP.js").then((e) => ({ default: e.VideoEmbedDialog }))), sa = y(() => import("./md-import-dialog-WLWQ4INh.js").then((e) => ({ default: e.MdImportDialog }))), ca = () => /* @__PURE__ */ O("div", {
7223
7244
  className: "fixed inset-0 z-[9999] flex items-center justify-center",
7224
7245
  children: [/* @__PURE__ */ D("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm" }), /* @__PURE__ */ D("div", {
7225
7246
  className: "relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center",
7226
7247
  children: /* @__PURE__ */ D("div", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" })
7227
7248
  })]
7228
- }), sa = ({ initialContent: e = "", onChange: t, placeholder: n, mode: r, readonly: i = !1, maxLength: a, maxAttachmentSize: o, maxTotalAttachmentSize: s, className: c = "", borderless: l = !1, style: u, showToolbar: d = !0, showToc: m = !0, showSearch: h = !0, onEditorReady: g, immediatelyRender: _, onToast: y }) => {
7229
- let k = r === "view" || i, A = C(() => typeof e == "object" && e || $i(e) ? e : f(e), [e]), [j, M] = T(!1), [F, I] = T({}), [L, z] = T("below"), [ne, re] = T(50), B = w(null), [V, H] = T(!1), [U, ie] = T(!1), [ae, W] = T(!1), [G, oe] = T(!1), [K, q] = T("none"), [se, J] = T({}), ce = w(null), le = w(null), [ue, de] = T(""), [fe, pe] = T(null), [me, he] = T(m), [ge, _e] = T(!1);
7249
+ }), la = ({ initialContent: e = "", onChange: t, placeholder: n, mode: r, readonly: i = !1, maxLength: a, wordCounter: o, maxAttachmentSize: s, maxTotalAttachmentSize: c, className: l = "", borderless: u = !1, style: d, showToolbar: m = !0, showToc: h = !0, showSearch: g = !0, onEditorReady: _, immediatelyRender: y, onToast: k }) => {
7250
+ let A = r === "view" || i, j = C(() => typeof e == "object" && e || ta(e) ? e : f(e), [e]), [M, P] = T(!1), [F, I] = T({}), [R, re] = T("below"), [ie, z] = T(50), B = w(null), [V, H] = T(!1), [ae, oe] = T(!1), [U, W] = T(!1), [se, ce] = T(!1), [G, K] = T("none"), [le, ue] = T({}), de = w(null), fe = w(null), [pe, me] = T(""), [he, ge] = T(null), [q, _e] = T(h), [ve, ye] = T(!1);
7230
7251
  x(() => {
7231
- he(m);
7232
- }, [m]);
7233
- let [ve, ye] = T(!1), [be, xe] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [Se, Ce] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), we = w(null), Te = w(null), Ee = w(null), De = w(0), Oe = w(null), ke = w(null), Ae = w(null), je = w(null), Me = w(null), [Ne, Pe] = T(!1), [Fe, Ie] = T(!1), [Y, Le] = T(!1), [Re, ze] = T(!1), Be = w(null), Ve = b(() => {
7234
- let e = Te.current, t = Ee.current;
7235
- e && (Y ? (document.body.style.overflow = "", Object.assign(e.style, {
7252
+ _e(h);
7253
+ }, [h]);
7254
+ let [be, xe] = T(!1), [Se, Ce] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [we, Te] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), Ee = w(null), De = w(null), Oe = w(null), ke = w(0), Ae = w(null), je = w(null), Me = w(null), Ne = w(null), Pe = w(null), [Fe, Ie] = T(!1), [Le, Re] = T(!1), [J, ze] = T(!1), [Be, Ve] = T(!1), He = w(null), Ue = b(() => {
7255
+ let e = De.current, t = Oe.current;
7256
+ e && (J ? (document.body.style.overflow = "", Object.assign(e.style, {
7236
7257
  position: "",
7237
7258
  top: "",
7238
7259
  left: "",
@@ -7248,9 +7269,9 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7248
7269
  flex: "",
7249
7270
  overflow: "",
7250
7271
  minHeight: ""
7251
- }), Le(!1), requestAnimationFrame(() => {
7252
- window.scrollTo(0, De.current);
7253
- })) : (document.fullscreenElement && document.exitFullscreen(), De.current = window.scrollY, Object.assign(e.style, {
7272
+ }), ze(!1), requestAnimationFrame(() => {
7273
+ window.scrollTo(0, ke.current);
7274
+ })) : (document.fullscreenElement && document.exitFullscreen(), ke.current = window.scrollY, Object.assign(e.style, {
7254
7275
  position: "fixed",
7255
7276
  top: "0",
7256
7277
  left: "0",
@@ -7265,64 +7286,64 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7265
7286
  flex: "1",
7266
7287
  overflow: "auto",
7267
7288
  minHeight: "0"
7268
- }), document.body.style.overflow = "hidden", Le(!0)));
7269
- }, [Y]), He = b(() => {
7270
- let e = Te.current;
7271
- e && (document.fullscreenElement ? document.exitFullscreen() : (Y && Ve(), De.current = window.scrollY, e.requestFullscreen()));
7272
- }, [Y, Ve]);
7289
+ }), document.body.style.overflow = "hidden", ze(!0)));
7290
+ }, [J]), We = b(() => {
7291
+ let e = De.current;
7292
+ e && (document.fullscreenElement ? document.exitFullscreen() : (J && Ue(), ke.current = window.scrollY, e.requestFullscreen()));
7293
+ }, [J, Ue]);
7273
7294
  x(() => {
7274
7295
  let e = (e) => {
7275
- e.key === "Escape" && Y && Ve();
7296
+ e.key === "Escape" && J && Ue();
7276
7297
  }, t = () => {
7277
- document.fullscreenElement ? ze(!0) : (ze(!1), requestAnimationFrame(() => {
7278
- window.scrollTo(0, De.current);
7298
+ document.fullscreenElement ? Ve(!0) : (Ve(!1), requestAnimationFrame(() => {
7299
+ window.scrollTo(0, ke.current);
7279
7300
  }));
7280
7301
  };
7281
7302
  return window.addEventListener("keydown", e), document.addEventListener("fullscreenchange", t), () => {
7282
7303
  window.removeEventListener("keydown", e), document.removeEventListener("fullscreenchange", t);
7283
7304
  };
7284
- }, [Y, Ve]), x(() => {
7285
- if (!h) return;
7305
+ }, [J, Ue]), x(() => {
7306
+ if (!g) return;
7286
7307
  let e = (e) => {
7287
7308
  if ((e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F")) {
7288
- if (!Te.current) return;
7289
- e.preventDefault(), e.stopPropagation(), ye(!0);
7309
+ if (!De.current) return;
7310
+ e.preventDefault(), e.stopPropagation(), xe(!0);
7290
7311
  }
7291
7312
  };
7292
7313
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
7293
- }, [h]), x(() => {
7314
+ }, [g]), x(() => {
7294
7315
  if (typeof window > "u" || typeof window.matchMedia != "function") return;
7295
- let e = window.matchMedia("(min-width: 80rem)"), t = (e) => xe(e.matches);
7296
- return xe(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
7316
+ let e = window.matchMedia("(min-width: 80rem)"), t = (e) => Ce(e.matches);
7317
+ return Ce(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
7297
7318
  }, []), x(() => {
7298
7319
  if (typeof window > "u" || typeof window.matchMedia != "function") return;
7299
- let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Ce(e.matches);
7300
- return Ce(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
7320
+ let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Te(e.matches);
7321
+ return Te(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
7301
7322
  }, []);
7302
- let X = ee({
7303
- extensions: Fi({
7323
+ let Y = te({
7324
+ extensions: Li({
7304
7325
  placeholder: n || p("editor.placeholder"),
7305
7326
  maxLength: a,
7306
- maxAttachmentSize: o,
7307
- maxTotalAttachmentSize: s
7327
+ maxAttachmentSize: s,
7328
+ maxTotalAttachmentSize: c
7308
7329
  }),
7309
- content: A,
7310
- editable: !k,
7311
- immediatelyRender: _,
7330
+ content: j,
7331
+ editable: !A,
7332
+ immediatelyRender: y,
7312
7333
  onUpdate: ({ editor: e }) => {
7313
- t && (we.current && clearTimeout(we.current), we.current = setTimeout(() => {
7334
+ t && (Ee.current && clearTimeout(Ee.current), Ee.current = setTimeout(() => {
7314
7335
  t?.(e.getHTML(), e.getJSON());
7315
7336
  }, 300));
7316
7337
  },
7317
7338
  onCreate: () => {},
7318
7339
  onSelectionUpdate: ({ editor: e }) => {
7319
7340
  let { from: t, to: n } = e.state.selection, r = t === n ? "" : e.state.doc.textBetween(t, n, "\n");
7320
- Ie(Li(r));
7341
+ Re(zi(r));
7321
7342
  },
7322
7343
  editorProps: {
7323
7344
  attributes: {
7324
7345
  class: "prose prose-neutral dark:prose-invert max-w-none focus:outline-none min-h-[200px] px-4 sm:px-8 py-4",
7325
- ...k ? {} : { style: "padding-left: 2.75rem" }
7346
+ ...A ? {} : { style: "padding-left: 2.75rem" }
7326
7347
  },
7327
7348
  handlePaste(e, t) {
7328
7349
  let n = t.clipboardData;
@@ -7330,9 +7351,9 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7330
7351
  let r = n.getData("text/plain");
7331
7352
  if (!r || !r.includes("[[")) return !1;
7332
7353
  t.preventDefault();
7333
- let i = ke.current?.storage?.relativeMedia;
7354
+ let i = je.current?.storage?.relativeMedia;
7334
7355
  i && (i.clipboardFiles = new Map(Array.from(n.files ?? []).map((e) => [e.name.toLowerCase(), e])), i.pausedUntilPaste = !1);
7335
- let a = ke.current ? ea(ke.current, r) : null;
7356
+ let a = je.current ? na(je.current, r) : null;
7336
7357
  if (a) {
7337
7358
  let t = new N(a, 0, 0);
7338
7359
  e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView());
@@ -7342,59 +7363,59 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7342
7363
  }
7343
7364
  });
7344
7365
  x(() => {
7345
- ke.current = X, window.__editor = X;
7346
- }, [X]), x(() => {
7347
- if (X) return () => en(X);
7348
- }, [X]), x(() => {
7349
- X && g && g(X);
7350
- }, [X, g]), x(() => {
7351
- if (!X) return;
7366
+ je.current = Y, window.__editor = Y;
7367
+ }, [Y]), x(() => {
7368
+ if (Y) return () => en(Y);
7369
+ }, [Y]), x(() => {
7370
+ Y && _ && _(Y);
7371
+ }, [Y, _]), x(() => {
7372
+ if (!Y) return;
7352
7373
  let e = () => {
7353
- X.state.selection.empty && (q("none"), Pe(!1));
7374
+ Y.state.selection.empty && (K("none"), Ie(!1));
7354
7375
  };
7355
- return X.on("selectionUpdate", e), () => {
7356
- X.off("selectionUpdate", e);
7376
+ return Y.on("selectionUpdate", e), () => {
7377
+ Y.off("selectionUpdate", e);
7357
7378
  };
7358
- }, [X]), x(() => {
7359
- X && X.setOptions({ extensions: Fi({
7379
+ }, [Y]), x(() => {
7380
+ Y && Y.setOptions({ extensions: Li({
7360
7381
  placeholder: n || p("editor.placeholder"),
7361
7382
  maxLength: a,
7362
- maxAttachmentSize: o,
7363
- maxTotalAttachmentSize: s
7383
+ maxAttachmentSize: s,
7384
+ maxTotalAttachmentSize: c
7364
7385
  }) });
7365
7386
  }, [
7366
7387
  n,
7367
7388
  a,
7368
- o,
7369
- s
7389
+ s,
7390
+ c
7370
7391
  ]);
7371
- let Ue = w(e);
7392
+ let Ge = w(e);
7372
7393
  x(() => {
7373
- if (!X || e === Ue.current) return;
7374
- Ue.current = e;
7375
- let t = typeof e == "object" && e || $i(e) ? e : f(e);
7376
- X.commands.setContent(t, { emitUpdate: !1 });
7377
- }, [X, e]), x(() => {
7378
- X && X.setEditable(!k, !1);
7379
- }, [X, k]), x(() => {
7380
- if (y) return tt(y);
7381
- }, [y]), x(() => {
7382
- if (!X) return;
7383
- let e = fn(X.state.doc);
7384
- e > s && Z(`文档内附件总大小 ${pn(e)} 已超过限制 ${pn(s)}`, "info");
7385
- }, [X, s]), x(() => {
7386
- if (!X) return;
7387
- let e = X.storage.qingwuUI;
7394
+ if (!Y || e === Ge.current) return;
7395
+ Ge.current = e;
7396
+ let t = typeof e == "object" && e || ta(e) ? e : f(e);
7397
+ Y.commands.setContent(t, { emitUpdate: !1 });
7398
+ }, [Y, e]), x(() => {
7399
+ Y && Y.setEditable(!A, !1);
7400
+ }, [Y, A]), x(() => {
7401
+ if (k) return tt(k);
7402
+ }, [k]), x(() => {
7403
+ if (!Y) return;
7404
+ let e = fn(Y.state.doc);
7405
+ e > c && Z(`文档内附件总大小 ${pn(e)} 已超过限制 ${pn(c)}`, "info");
7406
+ }, [Y, c]), x(() => {
7407
+ if (!Y) return;
7408
+ let e = Y.storage.qingwuUI;
7388
7409
  e && (e.limits = {
7389
- maxAttachmentSize: o,
7390
- maxTotalAttachmentSize: s
7410
+ maxAttachmentSize: s,
7411
+ maxTotalAttachmentSize: c
7391
7412
  });
7392
7413
  }, [
7393
- X,
7394
- o,
7395
- s
7414
+ Y,
7415
+ s,
7416
+ c
7396
7417
  ]);
7397
- let We = b((e, t) => {
7418
+ let Ke = b((e, t) => {
7398
7419
  let n = window.visualViewport, r = n?.offsetLeft ?? 0, i = n?.offsetTop ?? 0, a = n?.width ?? window.innerWidth, o = n?.height ?? window.innerHeight, s = Math.min(252, a - 16), c = e ? Math.max(r + 8, Math.min(e.left, r + a - s - 8)) : r + 8, l;
7399
7420
  return l = e ? t && e.bottom + 8 + t > i + o - 8 ? e.top - t - 8 : e.bottom + 8 : i + 8, l = Math.max(i + 8, Math.min(l, i + o - (t ?? 0) - 8)), {
7400
7421
  position: "fixed",
@@ -7405,83 +7426,87 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7405
7426
  overflowY: "auto",
7406
7427
  zIndex: 9999
7407
7428
  };
7408
- }, []), Ge = b((e) => {
7409
- let t = je.current?.getBoundingClientRect() ?? null;
7410
- le.current = t, q(e), Pe(!1), J(We(t, void 0));
7411
- }, [We]);
7429
+ }, []), qe = b((e) => {
7430
+ let t = Ne.current?.getBoundingClientRect() ?? null;
7431
+ fe.current = t, K(e), Ie(!1), ue(Ke(t, void 0));
7432
+ }, [Ke]);
7412
7433
  S(() => {
7413
- if (K === "none") return;
7414
- let e = ce.current;
7415
- J(We(le.current, e?.offsetHeight || void 0));
7416
- }, [K, We]);
7417
- let Ke = b(() => {
7418
- let e = Me.current, t = je.current;
7434
+ if (G === "none") return;
7435
+ let e = de.current;
7436
+ ue(Ke(fe.current, e?.offsetHeight || void 0));
7437
+ }, [G, Ke]);
7438
+ let X = b(() => {
7439
+ let e = Pe.current, t = Ne.current;
7419
7440
  if (!e || !t) return;
7420
7441
  let n = t.getBoundingClientRect(), r = window.visualViewport, i = r?.offsetTop ?? 0, a = r?.height ?? window.innerHeight, o = i + a - n.bottom - 16, s = n.top - i - 16, c = o < e.scrollHeight + 2 && s > o;
7421
7442
  e.dataset.placement = c ? "above" : "below", e.style.maxHeight = `${Math.max(40, Math.min(a - 16, c ? s : o))}px`;
7422
7443
  }, []);
7423
7444
  S(() => {
7424
- if (!Ne) return;
7425
- Ke();
7445
+ if (!Fe) return;
7446
+ X();
7426
7447
  let e = window.visualViewport;
7427
- return window.addEventListener("resize", Ke), window.addEventListener("scroll", Ke, !0), e?.addEventListener("resize", Ke), e?.addEventListener("scroll", Ke), () => {
7428
- window.removeEventListener("resize", Ke), window.removeEventListener("scroll", Ke, !0), e?.removeEventListener("resize", Ke), e?.removeEventListener("scroll", Ke);
7448
+ return window.addEventListener("resize", X), window.addEventListener("scroll", X, !0), e?.addEventListener("resize", X), e?.addEventListener("scroll", X), () => {
7449
+ window.removeEventListener("resize", X), window.removeEventListener("scroll", X, !0), e?.removeEventListener("resize", X), e?.removeEventListener("scroll", X);
7429
7450
  };
7430
- }, [Ne, Ke]), x(() => {
7431
- if (K === "none") return;
7432
- let e = () => q("none"), t = () => {
7433
- let e = ce.current;
7434
- J(We(je.current?.getBoundingClientRect() ?? le.current, e?.offsetHeight || void 0));
7451
+ }, [Fe, X]), x(() => {
7452
+ if (G === "none") return;
7453
+ let e = () => K("none"), t = () => {
7454
+ let e = de.current;
7455
+ ue(Ke(Ne.current?.getBoundingClientRect() ?? fe.current, e?.offsetHeight || void 0));
7435
7456
  }, n = window.visualViewport;
7436
7457
  return window.addEventListener("scroll", e, !0), window.addEventListener("resize", t), n?.addEventListener("resize", t), n?.addEventListener("scroll", t), () => {
7437
7458
  window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", t), n?.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
7438
7459
  };
7439
- }, [K, We]), x(() => {
7440
- K === "none" && (le.current = null);
7441
- }, [K]);
7442
- let qe = Vi((e) => p(e)), Je = qe.filter((e) => !e.more), Ye = qe.filter((e) => e.more), Xe = Je.filter((e) => e.key !== "ai" && (e.key !== "mathInline" || Fe)), Ze = Je.find((e) => e.key === "ai"), Qe = b((e) => {
7443
- if (X) {
7444
- if (Pe(!1), e.key === "link") {
7445
- if (X.isActive("link")) X.chain().focus().unsetLink().run();
7460
+ }, [G, Ke]), x(() => {
7461
+ G === "none" && (fe.current = null);
7462
+ }, [G]);
7463
+ let Je = Ui((e) => p(e)), Ye = Je.filter((e) => !e.more), Xe = Je.filter((e) => e.more), Ze = Ye.filter((e) => e.key !== "ai" && (e.key !== "mathInline" || Le)), Qe = Ye.find((e) => e.key === "ai"), $e = b((e) => {
7464
+ if (Y) {
7465
+ if (Ie(!1), e.key === "link") {
7466
+ if (Y.isActive("link")) Y.chain().focus().unsetLink().run();
7446
7467
  else {
7447
- let e = X.getAttributes("link").href || "";
7448
- de(e), Ge("link");
7468
+ let e = Y.getAttributes("link").href || "";
7469
+ me(e), qe("link");
7449
7470
  }
7450
- } else e.key === "highlight" ? K === "highlight" ? q("none") : Ge("highlight") : e.command(X);
7471
+ } else e.key === "highlight" ? G === "highlight" ? K("none") : qe("highlight") : e.command(Y);
7451
7472
  }
7452
7473
  }, [
7453
- X,
7454
- K,
7455
- Ge
7456
- ]), $e = b((e) => X ? e.key === "highlight" ? K === "highlight" : e.key === "link" ? X.isActive("link") : e.isActive(X) : !1, [X, K]), [et, nt] = T(0);
7474
+ Y,
7475
+ G,
7476
+ qe
7477
+ ]), et = b((e) => Y ? e.key === "highlight" ? G === "highlight" : e.key === "link" ? Y.isActive("link") : e.isActive(Y) : !1, [Y, G]), [nt, rt] = T(0);
7457
7478
  x(() => {
7458
- if (!X) return;
7459
- let e = () => nt((e) => (e + 1) % 1e6);
7460
- return X.on("update", e), () => {
7461
- X.off("update", e);
7479
+ if (!Y) return;
7480
+ let e = () => rt((e) => (e + 1) % 1e6);
7481
+ return Y.on("update", e), () => {
7482
+ Y.off("update", e);
7462
7483
  };
7463
- }, [X]);
7464
- let [rt, it] = T(!1);
7484
+ }, [Y]);
7485
+ let [it, at] = T(!1);
7465
7486
  x(() => {
7466
- if (!X) return;
7487
+ if (!Y) return;
7467
7488
  let e = () => {
7468
7489
  let e = !1;
7469
- X.state.doc.descendants((t) => {
7490
+ Y.state.doc.descendants((t) => {
7470
7491
  t.type.name === "heading" && (e = !0);
7471
- }), it(e);
7492
+ }), at(e);
7472
7493
  };
7473
- return e(), X.on("update", e), () => {
7474
- X.off("update", e);
7494
+ return e(), Y.on("update", e), () => {
7495
+ Y.off("update", e);
7475
7496
  };
7476
- }, [X]);
7477
- let at = C(() => X?.storage?.characterCount?.characters?.() ?? 0, [X, et]), ot = a ? at > a : !1;
7497
+ }, [Y]);
7498
+ let ot = C(() => Y?.storage?.characterCount?.characters?.() ?? 0, [Y, nt]), st = a ? ot > a : !1, ct = C(() => o && Y ? o(Y.getText({ blockSeparator: "" })) : null, [
7499
+ Y,
7500
+ o,
7501
+ nt
7502
+ ]);
7478
7503
  x(() => () => {
7479
- we.current && clearTimeout(we.current);
7504
+ Ee.current && clearTimeout(Ee.current);
7480
7505
  }, []), x(() => () => {
7481
- fe && fe.resolve(null);
7506
+ he && he.resolve(null);
7482
7507
  }, []);
7483
- let st = b((e) => {
7484
- if (!X?.isEditable) return;
7508
+ let dt = b((e) => {
7509
+ if (!Y?.isEditable) return;
7485
7510
  let t = window.getSelection(), n;
7486
7511
  if (e) {
7487
7512
  let t = e.getBoundingClientRect();
@@ -7498,76 +7523,76 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7498
7523
  width: e.width
7499
7524
  };
7500
7525
  } else {
7501
- let e = X.view.coordsAtPos(X.state.selection.from);
7526
+ let e = Y.view.coordsAtPos(Y.state.selection.from);
7502
7527
  n = {
7503
7528
  top: e.bottom,
7504
7529
  left: e.left,
7505
7530
  width: 0
7506
7531
  };
7507
7532
  }
7508
- Oe.current = n;
7509
- let r = Te.current?.getBoundingClientRect(), i = Qi(n, void 0, {
7533
+ Ae.current = n;
7534
+ let r = De.current?.getBoundingClientRect(), i = ea(n, void 0, {
7510
7535
  panelWidth: r?.width,
7511
7536
  editorLeft: r?.left
7512
7537
  });
7513
- M(!0), I(i.style), z(i.placement), re(i.arrowLeft);
7514
- }, [X]);
7538
+ P(!0), I(i.style), re(i.placement), z(i.arrowLeft);
7539
+ }, [Y]);
7515
7540
  x(() => {
7516
- if (!X) return;
7517
- let e = X.storage.qingwuUI;
7518
- if (e) return e.openImageDialog = () => H(!0), e.openVideoDialog = () => ie(!0), e.chooseMd = (e, t) => {
7519
- pe({
7541
+ if (!Y) return;
7542
+ let e = Y.storage.qingwuUI;
7543
+ if (e) return e.openImageDialog = () => H(!0), e.openVideoDialog = () => oe(!0), e.chooseMd = (e, t) => {
7544
+ ge({
7520
7545
  filename: e,
7521
7546
  resolve: t
7522
7547
  });
7523
- }, e.openAI = st, e.parseMd = (e, t) => X ? ea(X, t) : null, () => {
7548
+ }, e.openAI = dt, e.parseMd = (e, t) => Y ? na(Y, t) : null, () => {
7524
7549
  delete e.openImageDialog, delete e.openVideoDialog, delete e.openAI, delete e.parseMd, delete e.chooseMd;
7525
7550
  };
7526
- }, [X, st]), S(() => {
7527
- if (!j || !X) return;
7528
- let e = Oe.current;
7551
+ }, [Y, dt]), S(() => {
7552
+ if (!M || !Y) return;
7553
+ let e = Ae.current;
7529
7554
  if (!e) return;
7530
- let t = B.current, n = Te.current?.getBoundingClientRect(), r = Qi(e, t?.offsetHeight || void 0, {
7555
+ let t = B.current, n = De.current?.getBoundingClientRect(), r = ea(e, t?.offsetHeight || void 0, {
7531
7556
  panelWidth: n?.width,
7532
7557
  editorLeft: n?.left
7533
7558
  });
7534
- z(r.placement), re(r.arrowLeft), I(r.style);
7535
- }, [j, X]), x(() => {
7536
- if (!j || !X) return;
7559
+ re(r.placement), z(r.arrowLeft), I(r.style);
7560
+ }, [M, Y]), x(() => {
7561
+ if (!M || !Y) return;
7537
7562
  let e = () => {
7538
- let e = Oe.current;
7563
+ let e = Ae.current;
7539
7564
  if (!e) return;
7540
- let t = B.current, n = Te.current?.getBoundingClientRect(), r = Qi(e, t?.offsetHeight || void 0, {
7565
+ let t = B.current, n = De.current?.getBoundingClientRect(), r = ea(e, t?.offsetHeight || void 0, {
7541
7566
  panelWidth: n?.width,
7542
7567
  editorLeft: n?.left
7543
7568
  });
7544
- z(r.placement), re(r.arrowLeft), I(r.style);
7569
+ re(r.placement), z(r.arrowLeft), I(r.style);
7545
7570
  };
7546
7571
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
7547
- }, [j, X]), x(() => {
7548
- j || (Oe.current = null);
7549
- }, [j]);
7550
- let ct = b((e) => {
7551
- X && Un(X.view, X.schema.nodes.image.create({ src: e }));
7552
- }, [X]), dt = b((e) => {
7553
- (X?.commands).insertVideo?.({ src: e });
7554
- }, [X]), ft = me && be && !Y && !Re, pt = !ft && !ge && (me || rt && !(!k && Se)), ht = w(!1);
7572
+ }, [M, Y]), x(() => {
7573
+ M || (Ae.current = null);
7574
+ }, [M]);
7575
+ let ft = b((e) => {
7576
+ Y && Un(Y.view, Y.schema.nodes.image.create({ src: e }));
7577
+ }, [Y]), pt = b((e) => {
7578
+ (Y?.commands).insertVideo?.({ src: e });
7579
+ }, [Y]), ht = q && Se && !J && !Be, gt = !ht && !ve && (q || it && !(!A && we)), _t = w(!1);
7555
7580
  return x(() => {
7556
- ht.current || (ht.current = !0, me && !ft && _e(!0));
7557
- }, [me, ft]), x(() => {
7558
- if (!ge) return;
7581
+ _t.current || (_t.current = !0, q && !ht && ye(!0));
7582
+ }, [q, ht]), x(() => {
7583
+ if (!ve) return;
7559
7584
  let e = (e) => {
7560
7585
  let t = e.target;
7561
- Be.current?.contains(t) || _e(!1);
7586
+ He.current?.contains(t) || ye(!1);
7562
7587
  }, t = (e) => {
7563
- e.key === "Escape" && _e(!1);
7588
+ e.key === "Escape" && ye(!1);
7564
7589
  };
7565
7590
  return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("keydown", t), () => {
7566
7591
  document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e), document.removeEventListener("keydown", t);
7567
7592
  };
7568
- }, [ge]), x(() => {
7569
- if (!X || !ft) return;
7570
- let e = Ae.current;
7593
+ }, [ve]), x(() => {
7594
+ if (!Y || !ht) return;
7595
+ let e = Me.current;
7571
7596
  if (!(e instanceof HTMLElement)) return;
7572
7597
  let t = (t) => {
7573
7598
  let n = t.deltaY;
@@ -7577,31 +7602,31 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7577
7602
  e.scrollTop += n, t.preventDefault(), t.stopPropagation();
7578
7603
  return;
7579
7604
  }
7580
- let a = ut(X), o = a ? lt(a) : null;
7605
+ let a = ut(Y), o = a ? lt(a) : null;
7581
7606
  o && (o.scrollTop += n, t.preventDefault(), t.stopPropagation());
7582
7607
  };
7583
7608
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
7584
- }, [X, ft]), X ? /* @__PURE__ */ O("div", {
7609
+ }, [Y, ht]), Y ? /* @__PURE__ */ O("div", {
7585
7610
  className: "qingwu-editor-row",
7586
7611
  children: [/* @__PURE__ */ O("div", {
7587
- ref: Te,
7588
- className: `qingwu-editor relative flex-1 min-w-0 bg-background ${k ? "qingwu-editor--readonly" : ""} ${l ? "" : "rounded-xl border border-default-200"} ${c}`,
7589
- style: u,
7612
+ ref: De,
7613
+ className: `qingwu-editor relative flex-1 min-w-0 bg-background ${A ? "qingwu-editor--readonly" : ""} ${u ? "" : "rounded-xl border border-default-200"} ${l}`,
7614
+ style: d,
7590
7615
  children: [
7591
- d && /* @__PURE__ */ O("div", {
7616
+ m && /* @__PURE__ */ O("div", {
7592
7617
  className: "qed-toolbar",
7593
7618
  children: [/* @__PURE__ */ O("div", {
7594
7619
  className: "qed-toolbar__group",
7595
7620
  children: [
7596
7621
  /* @__PURE__ */ D("button", {
7597
7622
  type: "button",
7598
- className: `qed-tb-btn qed-tb-btn--desktop-only${me ? " is-active" : ""}`,
7623
+ className: `qed-tb-btn qed-tb-btn--desktop-only${q ? " is-active" : ""}`,
7599
7624
  onClick: () => {
7600
- me ? (he(!1), _e(!1)) : (he(!0), (!be || Y || Re) && _e(!0));
7625
+ q ? (_e(!1), ye(!1)) : (_e(!0), (!Se || J || Be) && ye(!0));
7601
7626
  },
7602
- title: me ? "隐藏目录" : "显示目录",
7603
- "aria-label": me ? "隐藏目录" : "显示目录",
7604
- "aria-pressed": me,
7627
+ title: q ? "隐藏目录" : "显示目录",
7628
+ "aria-label": q ? "隐藏目录" : "显示目录",
7629
+ "aria-pressed": q,
7605
7630
  children: /* @__PURE__ */ D("svg", {
7606
7631
  fill: "none",
7607
7632
  viewBox: "0 0 24 24",
@@ -7615,13 +7640,13 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7615
7640
  })
7616
7641
  })
7617
7642
  }),
7618
- h && /* @__PURE__ */ D("button", {
7643
+ g && /* @__PURE__ */ D("button", {
7619
7644
  type: "button",
7620
- className: `qed-tb-btn${ve ? " is-active" : ""}`,
7621
- onClick: () => ye(!ve),
7645
+ className: `qed-tb-btn${be ? " is-active" : ""}`,
7646
+ onClick: () => xe(!be),
7622
7647
  title: "查找 (Ctrl+F)",
7623
7648
  "aria-label": "查找",
7624
- "aria-pressed": ve,
7649
+ "aria-pressed": be,
7625
7650
  children: /* @__PURE__ */ D("svg", {
7626
7651
  fill: "none",
7627
7652
  viewBox: "0 0 24 24",
@@ -7635,13 +7660,13 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7635
7660
  })
7636
7661
  })
7637
7662
  }),
7638
- !k && /* @__PURE__ */ D("button", {
7663
+ !A && /* @__PURE__ */ D("button", {
7639
7664
  type: "button",
7640
- className: `qed-tb-btn qed-tb-btn--ai${j ? " is-active" : ""}`,
7641
- onClick: (e) => j ? M(!1) : st(e.currentTarget),
7665
+ className: `qed-tb-btn qed-tb-btn--ai${M ? " is-active" : ""}`,
7666
+ onClick: (e) => M ? P(!1) : dt(e.currentTarget),
7642
7667
  title: p("editor.toolbar.aiTitle"),
7643
7668
  "aria-label": p("editor.toolbar.ai"),
7644
- "aria-pressed": j,
7669
+ "aria-pressed": M,
7645
7670
  children: /* @__PURE__ */ O("svg", {
7646
7671
  fill: "none",
7647
7672
  viewBox: "0 0 24 24",
@@ -7666,7 +7691,7 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7666
7691
  /* @__PURE__ */ O("button", {
7667
7692
  type: "button",
7668
7693
  className: "qed-tb-btn qed-tb-btn--solid",
7669
- onClick: () => oe(!0),
7694
+ onClick: () => ce(!0),
7670
7695
  title: p("editor.toolbar.exportTitle"),
7671
7696
  children: [/* @__PURE__ */ D("svg", {
7672
7697
  fill: "none",
@@ -7686,11 +7711,11 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7686
7711
  }),
7687
7712
  /* @__PURE__ */ D("button", {
7688
7713
  type: "button",
7689
- className: `qed-tb-btn${Y ? " is-active" : ""}`,
7690
- onClick: Ve,
7691
- title: Y ? "退出网页全屏" : "网页全屏",
7692
- "aria-label": Y ? "退出网页全屏" : "网页全屏",
7693
- "aria-pressed": Y,
7714
+ className: `qed-tb-btn${J ? " is-active" : ""}`,
7715
+ onClick: Ue,
7716
+ title: J ? "退出网页全屏" : "网页全屏",
7717
+ "aria-label": J ? "退出网页全屏" : "网页全屏",
7718
+ "aria-pressed": J,
7694
7719
  children: /* @__PURE__ */ D("svg", {
7695
7720
  fill: "none",
7696
7721
  viewBox: "0 0 24 24",
@@ -7706,11 +7731,11 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7706
7731
  }),
7707
7732
  /* @__PURE__ */ D("button", {
7708
7733
  type: "button",
7709
- className: `qed-tb-btn${Re ? " is-active" : ""}`,
7710
- onClick: He,
7711
- title: Re ? "退出全屏" : "全屏",
7712
- "aria-label": Re ? "退出全屏" : "全屏",
7713
- "aria-pressed": Re,
7734
+ className: `qed-tb-btn${Be ? " is-active" : ""}`,
7735
+ onClick: We,
7736
+ title: Be ? "退出全屏" : "全屏",
7737
+ "aria-label": Be ? "退出全屏" : "全屏",
7738
+ "aria-pressed": Be,
7714
7739
  children: /* @__PURE__ */ D("svg", {
7715
7740
  fill: "none",
7716
7741
  viewBox: "0 0 24 24",
@@ -7727,8 +7752,8 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7727
7752
  ]
7728
7753
  })]
7729
7754
  }),
7730
- X && !k && X.isEditable && /* @__PURE__ */ D(te, {
7731
- editor: X,
7755
+ Y && !A && Y.isEditable && /* @__PURE__ */ D(ne, {
7756
+ editor: Y,
7732
7757
  shouldShow: ({ editor: e, state: t }) => !(e.isActive("image") || e.isActive("videoEmbed") || e.isActive("codeBlock") || e.isActive("audioEmbed") || e.isActive("attachmentEmbed") || t.selection.empty),
7733
7758
  options: {
7734
7759
  placement: "bottom",
@@ -7741,23 +7766,23 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7741
7766
  t.floating.style.maxWidth = `${e}px`;
7742
7767
  }
7743
7768
  },
7744
- onUpdate: Ke
7769
+ onUpdate: X
7745
7770
  },
7746
7771
  className: "qw-bubble bubble-menu-pop",
7747
7772
  children: /* @__PURE__ */ O("div", {
7748
- ref: je,
7773
+ ref: Ne,
7749
7774
  className: "bubble-menu-items",
7750
7775
  onPointerDown: (e) => {
7751
7776
  e.target.closest("button") && e.preventDefault();
7752
7777
  },
7753
7778
  children: [
7754
- Xe.map((e) => /* @__PURE__ */ D("button", {
7779
+ Ze.map((e) => /* @__PURE__ */ D("button", {
7755
7780
  type: "button",
7756
7781
  className: "qw-bubble-button",
7757
- "data-active": e.isActive(X),
7758
- "aria-pressed": e.isActive(X),
7782
+ "data-active": e.isActive(Y),
7783
+ "aria-pressed": e.isActive(Y),
7759
7784
  onClick: (t) => {
7760
- t.preventDefault(), Qe(e);
7785
+ t.preventDefault(), $e(e);
7761
7786
  },
7762
7787
  title: e.label,
7763
7788
  "aria-label": e.label,
@@ -7770,12 +7795,12 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7770
7795
  /* @__PURE__ */ D("button", {
7771
7796
  type: "button",
7772
7797
  className: "qw-bubble-button qw-bubble-button--ai",
7773
- "data-active": j,
7798
+ "data-active": M,
7774
7799
  onClick: (e) => {
7775
- e.preventDefault(), Pe(!1), Ze?.command(X);
7800
+ e.preventDefault(), Ie(!1), Qe?.command(Y);
7776
7801
  },
7777
- title: Ze?.label,
7778
- "aria-label": Ze?.label,
7802
+ title: Qe?.label,
7803
+ "aria-label": Qe?.label,
7779
7804
  children: /* @__PURE__ */ D(Ut, {})
7780
7805
  }),
7781
7806
  /* @__PURE__ */ D("span", {
@@ -7784,31 +7809,31 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7784
7809
  }),
7785
7810
  /* @__PURE__ */ D("button", {
7786
7811
  type: "button",
7787
- "aria-expanded": Ne,
7812
+ "aria-expanded": Fe,
7788
7813
  "aria-haspopup": "menu",
7789
7814
  className: "qw-bubble-button",
7790
- "data-active": Ne,
7815
+ "data-active": Fe,
7791
7816
  onClick: (e) => {
7792
- e.preventDefault(), Pe((e) => !e);
7817
+ e.preventDefault(), Ie((e) => !e);
7793
7818
  },
7794
7819
  title: p("editor.bubble.more"),
7795
7820
  "aria-label": p("editor.bubble.more"),
7796
7821
  children: /* @__PURE__ */ D(Gt, {})
7797
7822
  }),
7798
- Ne && /* @__PURE__ */ D("div", {
7799
- ref: Me,
7823
+ Fe && /* @__PURE__ */ D("div", {
7824
+ ref: Pe,
7800
7825
  role: "menu",
7801
7826
  className: "bubble-more-menu",
7802
7827
  onPointerDown: (e) => {
7803
7828
  e.target.closest("button") && e.preventDefault();
7804
7829
  },
7805
- children: Ye.map((e) => /* @__PURE__ */ O("button", {
7830
+ children: Xe.map((e) => /* @__PURE__ */ O("button", {
7806
7831
  type: "button",
7807
7832
  role: "menuitem",
7808
7833
  className: "qw-bubble-menu-item",
7809
- "data-active": $e(e),
7834
+ "data-active": et(e),
7810
7835
  onClick: (t) => {
7811
- t.preventDefault(), Qe(e);
7836
+ t.preventDefault(), $e(e);
7812
7837
  },
7813
7838
  title: e.label,
7814
7839
  children: [/* @__PURE__ */ D("span", {
@@ -7820,24 +7845,24 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7820
7845
  ]
7821
7846
  })
7822
7847
  }),
7823
- X && K !== "none" && R(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7848
+ Y && G !== "none" && L(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7824
7849
  className: "fixed inset-0 z-[9998]",
7825
- onClick: () => q("none")
7850
+ onClick: () => K("none")
7826
7851
  }), /* @__PURE__ */ D("div", {
7827
- ref: ce,
7828
- style: se,
7852
+ ref: de,
7853
+ style: le,
7829
7854
  className: "qw-bubble-panel",
7830
7855
  onClick: (e) => e.stopPropagation(),
7831
- children: K === "highlight" ? /* @__PURE__ */ O("div", {
7856
+ children: G === "highlight" ? /* @__PURE__ */ O("div", {
7832
7857
  className: "qw-bubble-colors",
7833
- children: [Ji.map((e) => /* @__PURE__ */ D("button", {
7858
+ children: [Xi.map((e) => /* @__PURE__ */ D("button", {
7834
7859
  type: "button",
7835
7860
  className: "qw-bubble-swatch",
7836
7861
  style: { background: e.color },
7837
7862
  title: e.name,
7838
7863
  "aria-label": e.name,
7839
7864
  onClick: () => {
7840
- X.chain().focus().setHighlight({ color: e.color }).run(), q("none");
7865
+ Y.chain().focus().setHighlight({ color: e.color }).run(), K("none");
7841
7866
  }
7842
7867
  }, e.color)), /* @__PURE__ */ O("button", {
7843
7868
  type: "button",
@@ -7845,7 +7870,7 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7845
7870
  title: "清除高亮",
7846
7871
  "aria-label": "清除高亮",
7847
7872
  onClick: () => {
7848
- X.chain().focus().unsetHighlight().run(), q("none");
7873
+ Y.chain().focus().unsetHighlight().run(), K("none");
7849
7874
  },
7850
7875
  children: ["✕", " "]
7851
7876
  })]
@@ -7856,120 +7881,116 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7856
7881
  className: "qw-bubble-link-input",
7857
7882
  placeholder: "https://...",
7858
7883
  "aria-label": "链接地址",
7859
- value: ue,
7860
- onChange: (e) => de(e.target.value),
7884
+ value: pe,
7885
+ onChange: (e) => me(e.target.value),
7861
7886
  onKeyDown: (e) => {
7862
- e.key === "Enter" ? (ue.trim() && X.chain().focus().setLink({ href: ue.trim() }).run(), q("none")) : e.key === "Escape" && q("none");
7887
+ e.key === "Enter" ? (pe.trim() && Y.chain().focus().setLink({ href: pe.trim() }).run(), K("none")) : e.key === "Escape" && K("none");
7863
7888
  }
7864
7889
  }), /* @__PURE__ */ D("button", {
7865
7890
  type: "button",
7866
7891
  className: "qw-bubble-link-apply",
7867
7892
  onClick: () => {
7868
- ue.trim() && X.chain().focus().setLink({ href: ue.trim() }).run(), q("none");
7893
+ pe.trim() && Y.chain().focus().setLink({ href: pe.trim() }).run(), K("none");
7869
7894
  },
7870
7895
  children: "确定"
7871
7896
  })]
7872
7897
  })
7873
7898
  })] }), document.body),
7874
- !k && j && R(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7899
+ !A && M && L(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7875
7900
  className: "fixed inset-0 z-[9998]",
7876
- onClick: () => M(!1)
7901
+ onClick: () => P(!1)
7877
7902
  }), /* @__PURE__ */ O("div", {
7878
7903
  ref: B,
7879
7904
  "data-lenis-prevent": !0,
7880
7905
  style: F,
7881
- className: `ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${L === "above" ? " ai-panel--above" : ""}`,
7906
+ className: `ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${R === "above" ? " ai-panel--above" : ""}`,
7882
7907
  onClick: (e) => e.stopPropagation(),
7883
7908
  children: [/* @__PURE__ */ D("span", {
7884
7909
  className: "ai-panel__arrow",
7885
- style: { left: `${ne}%` },
7910
+ style: { left: `${ie}%` },
7886
7911
  "aria-hidden": "true"
7887
7912
  }), /* @__PURE__ */ D(un, {
7888
- editor: X,
7889
- onClose: () => M(!1)
7913
+ editor: Y,
7914
+ onClose: () => P(!1)
7890
7915
  })]
7891
7916
  })] }), document.body),
7892
7917
  V && /* @__PURE__ */ D(v, {
7893
- fallback: /* @__PURE__ */ D(oa, {}),
7894
- children: /* @__PURE__ */ D(ta, {
7918
+ fallback: /* @__PURE__ */ D(ca, {}),
7919
+ children: /* @__PURE__ */ D(ra, {
7895
7920
  open: V,
7896
7921
  onClose: () => H(!1),
7897
- onInsert: ct,
7898
- validate: (e) => X ? hn(X.state.doc, e, {
7899
- maxAttachmentSize: o,
7900
- maxTotalAttachmentSize: s
7922
+ onInsert: ft,
7923
+ validate: (e) => Y ? hn(Y.state.doc, e, {
7924
+ maxAttachmentSize: s,
7925
+ maxTotalAttachmentSize: c
7901
7926
  }) : null
7902
7927
  })
7903
7928
  }),
7929
+ ae && /* @__PURE__ */ D(v, {
7930
+ fallback: /* @__PURE__ */ D(ca, {}),
7931
+ children: /* @__PURE__ */ D(oa, {
7932
+ open: ae,
7933
+ onClose: () => oe(!1),
7934
+ onInsert: pt
7935
+ })
7936
+ }),
7904
7937
  U && /* @__PURE__ */ D(v, {
7905
- fallback: /* @__PURE__ */ D(oa, {}),
7938
+ fallback: /* @__PURE__ */ D(ca, {}),
7906
7939
  children: /* @__PURE__ */ D(ia, {
7907
7940
  open: U,
7908
- onClose: () => ie(!1),
7909
- onInsert: dt
7910
- })
7911
- }),
7912
- ae && /* @__PURE__ */ D(v, {
7913
- fallback: /* @__PURE__ */ D(oa, {}),
7914
- children: /* @__PURE__ */ D(na, {
7915
- open: ae,
7916
7941
  onClose: () => W(!1)
7917
7942
  })
7918
7943
  }),
7919
- G && /* @__PURE__ */ D(v, {
7920
- fallback: /* @__PURE__ */ D(oa, {}),
7921
- children: /* @__PURE__ */ D(ra, {
7922
- open: G,
7923
- onClose: () => oe(!1),
7924
- editor: X
7944
+ se && /* @__PURE__ */ D(v, {
7945
+ fallback: /* @__PURE__ */ D(ca, {}),
7946
+ children: /* @__PURE__ */ D(aa, {
7947
+ open: se,
7948
+ onClose: () => ce(!1),
7949
+ editor: Y
7925
7950
  })
7926
7951
  }),
7927
- fe && /* @__PURE__ */ D(v, {
7928
- fallback: /* @__PURE__ */ D(oa, {}),
7929
- children: /* @__PURE__ */ D(aa, {
7930
- open: !!fe,
7931
- filename: fe.filename,
7952
+ he && /* @__PURE__ */ D(v, {
7953
+ fallback: /* @__PURE__ */ D(ca, {}),
7954
+ children: /* @__PURE__ */ D(sa, {
7955
+ open: !!he,
7956
+ filename: he.filename,
7932
7957
  onRender: () => {
7933
- fe.resolve("render"), pe(null);
7958
+ he.resolve("render"), ge(null);
7934
7959
  },
7935
7960
  onAttach: () => {
7936
- fe.resolve("attach"), pe(null);
7961
+ he.resolve("attach"), ge(null);
7937
7962
  },
7938
7963
  onClose: () => {
7939
- fe.resolve(null), pe(null);
7964
+ he.resolve(null), ge(null);
7940
7965
  }
7941
7966
  })
7942
7967
  }),
7943
7968
  /* @__PURE__ */ D("div", {
7944
- ref: Ee,
7969
+ ref: Oe,
7945
7970
  className: "flex editor-body",
7946
7971
  children: /* @__PURE__ */ O("div", {
7947
7972
  className: "relative min-w-0 flex-1",
7948
7973
  children: [
7949
- /* @__PURE__ */ D(P, { editor: X }),
7950
- !k && /* @__PURE__ */ D(qi, { editor: X }),
7974
+ /* @__PURE__ */ D(ee, { editor: Y }),
7975
+ !A && /* @__PURE__ */ D(Yi, { editor: Y }),
7951
7976
  /* @__PURE__ */ D("div", {
7952
- className: `${Y || Re ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
7977
+ className: `${J || Be ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
7953
7978
  children: /* @__PURE__ */ O("span", {
7954
- className: `text-xs ${ot ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && at > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
7955
- children: [
7956
- at,
7957
- a ? ` / ${a}` : "",
7958
- " 字"
7959
- ]
7979
+ className: `text-xs ${st ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && ot > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
7980
+ children: [ct === null ? `${ot} 字符` : `${ct} 字`, a ? `(${ot} / ${a} 字符)` : ""]
7960
7981
  })
7961
7982
  })
7962
7983
  ]
7963
7984
  })
7964
7985
  }),
7965
- h && ve && /* @__PURE__ */ D(Mt, {
7966
- editor: X,
7967
- onClose: () => ye(!1)
7986
+ g && be && /* @__PURE__ */ D(Mt, {
7987
+ editor: Y,
7988
+ onClose: () => xe(!1)
7968
7989
  }),
7969
- pt && /* @__PURE__ */ D("button", {
7990
+ gt && /* @__PURE__ */ D("button", {
7970
7991
  type: "button",
7971
7992
  className: "qingwu-toc-fab",
7972
- onClick: () => _e(!0),
7993
+ onClick: () => ye(!0),
7973
7994
  title: "目录",
7974
7995
  "aria-label": "打开目录",
7975
7996
  children: /* @__PURE__ */ D("svg", {
@@ -7985,8 +8006,8 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7985
8006
  })
7986
8007
  })
7987
8008
  }),
7988
- ge && R(/* @__PURE__ */ O("div", {
7989
- ref: Be,
8009
+ ve && L(/* @__PURE__ */ O("div", {
8010
+ ref: He,
7990
8011
  className: "qingwu-toc-drawer toc-scroll",
7991
8012
  "data-lenis-prevent": !0,
7992
8013
  children: [/* @__PURE__ */ O("div", {
@@ -7997,7 +8018,7 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
7997
8018
  }), /* @__PURE__ */ D("button", {
7998
8019
  type: "button",
7999
8020
  className: "qed-drawer-head__close",
8000
- onClick: () => _e(!1),
8021
+ onClick: () => ye(!1),
8001
8022
  "aria-label": "关闭目录",
8002
8023
  children: /* @__PURE__ */ D("svg", {
8003
8024
  fill: "none",
@@ -8013,20 +8034,20 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
8013
8034
  })
8014
8035
  })]
8015
8036
  }), /* @__PURE__ */ D(mt, {
8016
- editor: X,
8037
+ editor: Y,
8017
8038
  className: "!p-3",
8018
8039
  onClose: () => {
8019
- _e(!1), he(!1);
8040
+ ye(!1), _e(!1);
8020
8041
  }
8021
8042
  })]
8022
8043
  }), document.body)
8023
8044
  ]
8024
- }), ft && R(/* @__PURE__ */ D("aside", {
8025
- ref: Ae,
8045
+ }), ht && L(/* @__PURE__ */ D("aside", {
8046
+ ref: Me,
8026
8047
  className: "qingwu-toc-desktop toc-scroll",
8027
8048
  children: /* @__PURE__ */ D(mt, {
8028
- editor: X,
8029
- onClose: () => he(!1)
8049
+ editor: Y,
8050
+ onClose: () => _e(!1)
8030
8051
  })
8031
8052
  }), document.body)]
8032
8053
  }) : /* @__PURE__ */ D("div", {
@@ -8035,7 +8056,7 @@ var ta = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.Imag
8035
8056
  });
8036
8057
  };
8037
8058
  // src/editor/clipper/receiver-browser.ts
8038
- function ca(e) {
8059
+ function ua(e) {
8039
8060
  let t = async (t) => {
8040
8061
  let n = t.data;
8041
8062
  if (!n || typeof n != "object" || n.kind !== "qingwu-clip" || t.origin !== window.location.origin || t.origin === "null" || t.source !== window) return;
@@ -8049,7 +8070,7 @@ function ca(e) {
8049
8070
  return window.addEventListener("message", t), { close: () => window.removeEventListener("message", t) };
8050
8071
  }
8051
8072
  // src/editor/storage/providers/cos.ts
8052
- function la(t) {
8073
+ function da(t) {
8053
8074
  return e({
8054
8075
  endpoint: `https://cos.${t.region}.myqcloud.com`,
8055
8076
  bucket: t.bucket,
@@ -8062,7 +8083,7 @@ function la(t) {
8062
8083
  });
8063
8084
  }
8064
8085
  // src/editor/storage/providers/oss.ts
8065
- function ua(t) {
8086
+ function fa(t) {
8066
8087
  return e({
8067
8088
  endpoint: `https://${t.bucket}.${t.region}.aliyuncs.com`,
8068
8089
  bucket: t.bucket,
@@ -8074,4 +8095,4 @@ function ua(t) {
8074
8095
  nameTemplate: t.nameTemplate
8075
8096
  });
8076
8097
  }
8077
- export { ur as CODE_LANGUAGES, gr as CodeBlock, Br as ImageUpload, rt as ImageUploadDialog, ai as MathBlock, ii as MathInline, sa as QingWuAIEditor, Ai as RelativeMedia, At as SearchHighlight, mt as TocPanel, $n as VideoEmbed, ht as buildSystemPrompt, _t as createAILanguageModelProvider, la as createCOSStorage, xt as createDeepSeekProvider, _ as createLocalStorage, ua as createOSSStorage, bt as createOpenAICompatProvider, St as createOpenAIProvider, Ct as createQwenProvider, e as createS3Storage, Mi as createSlashCommandExtension, g as escapeHtml, pn as formatBytes, yt as getAIProvider, Vi as getBubbleMenuActions, Ni as getDefaultSlashCommands, fn as getDocAttachmentTotal, Fi as getEditorExtensions, d as getLocale, Bi as getSearchEngine, jt as getSearchState, l as getStorageInfo, s as getStorageProvider, c as loadStorageConfig, i as registerS3PreviewConfig, f as sanitizeHtml, m as sanitizeSvg, vt as setAIProvider, xn as setConfirmProvider, u as setLocale, zi as setSearchEngine, a as setStorageProvider, et as setToastProvider, n as signPreviewUrlHeaders, ca as startBrowserClipperReceiver, tt as subscribeToast, p as t, h as tf, Z as toast, hn as validateAttachmentFile };
8098
+ export { fr as CODE_LANGUAGES, vr as CodeBlock, Hr as ImageUpload, rt as ImageUploadDialog, si as MathBlock, oi as MathInline, la as QingWuAIEditor, Mi as RelativeMedia, At as SearchHighlight, mt as TocPanel, $n as VideoEmbed, ht as buildSystemPrompt, _t as createAILanguageModelProvider, da as createCOSStorage, xt as createDeepSeekProvider, _ as createLocalStorage, fa as createOSSStorage, bt as createOpenAICompatProvider, St as createOpenAIProvider, Ct as createQwenProvider, e as createS3Storage, Pi as createSlashCommandExtension, g as escapeHtml, pn as formatBytes, yt as getAIProvider, Ui as getBubbleMenuActions, Fi as getDefaultSlashCommands, fn as getDocAttachmentTotal, Li as getEditorExtensions, d as getLocale, Hi as getSearchEngine, jt as getSearchState, l as getStorageInfo, s as getStorageProvider, c as loadStorageConfig, i as registerS3PreviewConfig, f as sanitizeHtml, m as sanitizeSvg, vt as setAIProvider, xn as setConfirmProvider, u as setLocale, Vi as setSearchEngine, a as setStorageProvider, et as setToastProvider, n as signPreviewUrlHeaders, ua as startBrowserClipperReceiver, tt as subscribeToast, p as t, h as tf, Z as toast, hn as validateAttachmentFile };