@qingwu-ui/ai-editor 0.9.0-beta.20 → 0.9.0-beta.24

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
@@ -9,56 +9,56 @@ import { DOMParser as j, Fragment as M, Slice as N } from "@tiptap/pm/model";
9
9
  import { EditorContent as P, NodeViewWrapper as F, ReactNodeViewRenderer as I, ReactRenderer as L, useEditor as ee } from "@tiptap/react";
10
10
  import { BubbleMenu as te } from "@tiptap/react/menus";
11
11
  import { createPortal as ne } from "react-dom";
12
- import { Extension as R, Node as re } from "@tiptap/core";
13
- import { NodeSelection as ie, Plugin as z, PluginKey as B, TextSelection as V } from "@tiptap/pm/state";
14
- import { Decoration as H, DecorationSet as ae } from "@tiptap/pm/view";
15
- import { Image as oe } from "@tiptap/extension-image";
16
- import { Link as U } from "@tiptap/extension-link";
17
- import { Underline as W } 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 q } from "@tiptap/extension-color";
21
- import { Highlight as se } from "@tiptap/extension-highlight";
22
- import { HorizontalRule as ce } from "@tiptap/extension-horizontal-rule";
23
- import { Placeholder as le } from "@tiptap/extension-placeholder";
24
- import { Table as ue } from "@tiptap/extension-table";
25
- import { TableCell as de } from "@tiptap/extension-table-cell";
26
- import { TableHeader as fe } from "@tiptap/extension-table-header";
27
- import { TableRow as pe } from "@tiptap/extension-table-row";
28
- import { TaskItem as me } from "@tiptap/extension-task-item";
29
- import { TaskList as he } from "@tiptap/extension-task-list";
30
- import { TextStyle as ge } from "@tiptap/extension-text-style";
31
- import { Markdown as _e } from "tiptap-markdown";
32
- import { CodeBlockLowlight as ve } from "@tiptap/extension-code-block-lowlight";
33
- import ye from "highlight.js/lib/languages/dockerfile";
34
- import { common as be, createLowlight as xe } from "lowlight";
35
- import Se, { exitSuggestion as Ce, findSuggestionMatch as we } from "@tiptap/suggestion";
12
+ import { Extension as R, Node as re, markInputRule as ie } from "@tiptap/core";
13
+ import { NodeSelection as z, Plugin as B, PluginKey as V, TextSelection as H } from "@tiptap/pm/state";
14
+ import { Decoration as ae, DecorationSet as oe } from "@tiptap/pm/view";
15
+ import { Image as U } from "@tiptap/extension-image";
16
+ import { Link as W } from "@tiptap/extension-link";
17
+ import { Underline as G } from "@tiptap/extension-underline";
18
+ import K from "@tiptap/starter-kit";
19
+ import { CharacterCount as q } from "@tiptap/extension-character-count";
20
+ import { Color as se } 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, { exitSuggestion as we, findSuggestionMatch as Te } from "@tiptap/suggestion";
36
36
  //#region ../text-layout/dist/index.mjs
37
- var Te = null, Ee = null;
38
- function De() {
39
- return Ee || (typeof document > "u" ? null : (Te = document.createElement("canvas"), Ee = Te.getContext("2d"), Ee));
40
- }
41
- var Oe = /* @__PURE__ */ new Map();
42
- function ke(e, t) {
43
- let n = Oe.get(t);
44
- n || (n = /* @__PURE__ */ new Map(), Oe.set(t, n));
37
+ var Ee = null, De = null;
38
+ function Oe() {
39
+ return De || (typeof document > "u" ? null : (Ee = document.createElement("canvas"), De = Ee.getContext("2d"), De));
40
+ }
41
+ var ke = /* @__PURE__ */ new Map();
42
+ function Ae(e, t) {
43
+ let n = ke.get(t);
44
+ n || (n = /* @__PURE__ */ new Map(), ke.set(t, n));
45
45
  let r = n.get(e);
46
46
  if (r !== void 0) return r;
47
- let i = De();
48
- return i ? (i.font = t, r = i.measureText(e).width) : r = Ae(e, t), n.set(e, r), r;
47
+ let i = Oe();
48
+ return i ? (i.font = t, r = i.measureText(e).width) : r = je(e, t), n.set(e, r), r;
49
49
  }
50
- function Ae(e, t) {
50
+ function je(e, t) {
51
51
  let n = parseFloat(t) || 16, r = 0;
52
- for (let t of e) je(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
52
+ for (let t of e) Me(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
53
53
  return r;
54
54
  }
55
- function je(e) {
55
+ function Me(e) {
56
56
  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;
57
57
  }
58
- function Me(e) {
58
+ function Ne(e) {
59
59
  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;
60
60
  }
61
- function J(e, t) {
61
+ function Pe(e, t) {
62
62
  let n = [], r = [];
63
63
  if (typeof Intl < "u" && Intl.Segmenter) try {
64
64
  let t = new Intl.Segmenter("zh", { granularity: "grapheme" });
@@ -69,27 +69,27 @@ function J(e, t) {
69
69
  else r = [...e];
70
70
  for (let e of r) {
71
71
  let r = e.codePointAt(0) ?? 0, i = "latin";
72
- e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : je(r) && (i = Me(r) ? "punct" : "cjk"), n.push({
72
+ e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : Me(r) && (i = Ne(r) ? "punct" : "cjk"), n.push({
73
73
  text: e,
74
- width: ke(e, t),
74
+ width: Ae(e, t),
75
75
  type: i
76
76
  });
77
77
  }
78
78
  return n;
79
79
  }
80
- function Ne(e, t, n) {
80
+ function J(e, t, n) {
81
81
  let r = 0, i = Math.min(n, e.length);
82
82
  for (let n = t; n < i; n++) r += e[n].width;
83
83
  return r;
84
84
  }
85
- function Y(e, t, n, r) {
85
+ function Fe(e, t, n, r) {
86
86
  return {
87
87
  text: e.slice(t, Math.min(n, e.length)).map((e) => e.text).join(""),
88
88
  width: r
89
89
  };
90
90
  }
91
- function Pe(e, t, n = "16px system-ui") {
92
- let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = J(e, n), c = [], l = {
91
+ function Ie(e, t, n = "16px system-ui") {
92
+ let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = Pe(e, n), c = [], l = {
93
93
  lineStart: 0,
94
94
  lineWidth: 0,
95
95
  lastBreakIdx: -1,
@@ -98,28 +98,28 @@ function Pe(e, t, n = "16px system-ui") {
98
98
  for (let e = 0; e < s.length; e++) {
99
99
  let t = s[e];
100
100
  if (t.type === "break") {
101
- c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
101
+ c.push(Fe(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
102
102
  continue;
103
103
  }
104
104
  let n = l.lineWidth + t.width;
105
105
  if (t.type === "space") {
106
- 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 = Ne(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;
106
+ if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(Fe(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = J(s, l.lineStart, e + 1)) : (c.push(Fe(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
107
  continue;
108
108
  }
109
109
  if (t.type === "cjk") {
110
- 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;
110
+ if (n > r && l.lineWidth > 0 ? (c.push(Fe(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;
111
111
  continue;
112
112
  }
113
113
  if (t.type === "punct") {
114
- 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 = Ne(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
114
+ 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(Fe(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = J(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
115
115
  continue;
116
116
  }
117
- 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 = Ne(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;
117
+ if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(Fe(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = J(s, l.lineStart, e + 1), l.lastBreakIdx = -1) : o === "break-word" ? (c.push(Fe(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width) : l.lineWidth = n : l.lineWidth = n, a && c.length >= a) break;
118
118
  }
119
119
  let u = l.lineStart < s.length;
120
120
  if (u && (!a || c.length < a)) {
121
- let e = Ne(s, l.lineStart, s.length);
122
- c.push(Y(s, l.lineStart, s.length, e));
121
+ let e = J(s, l.lineStart, s.length);
122
+ c.push(Fe(s, l.lineStart, s.length, e));
123
123
  }
124
124
  return {
125
125
  lines: c,
@@ -130,36 +130,36 @@ function Pe(e, t, n = "16px system-ui") {
130
130
  }
131
131
  //#endregion
132
132
  //#region ../toast/dist/index.mjs
133
- var Fe = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, Ie = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
134
- function Le() {
133
+ var Le = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, Re = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
134
+ function ze() {
135
135
  if (typeof window > "u") return 290;
136
136
  let e = window.innerWidth;
137
137
  return e <= 480 ? Math.max(140, e - 98) : 290;
138
138
  }
139
- var X = {
139
+ var Be = {
140
140
  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>",
141
141
  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>",
142
142
  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>",
143
143
  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>"
144
- }, Re = 1;
145
- function ze() {
146
- return `qt${Re++}${Date.now().toString(36)}`;
144
+ }, Y = 1;
145
+ function Ve() {
146
+ return `qt${Y++}${Date.now().toString(36)}`;
147
147
  }
148
- function Be(e, t, n) {
148
+ function X(e, t, n) {
149
149
  let r = document.createElement(e);
150
150
  return t && (r.className = t), n != null && (r.innerHTML = n), r;
151
151
  }
152
- function Ve(e, t) {
152
+ function He(e, t) {
153
153
  let n = t.split(/\*\*(.+?)\*\*/g);
154
154
  for (let t = 0; t < n.length; t++) {
155
155
  let r = n[t];
156
156
  if (r) if (t % 2 == 1) {
157
- let t = Be("em", "qt-mark");
157
+ let t = X("em", "qt-mark");
158
158
  t.textContent = r, e.appendChild(t);
159
159
  } else e.appendChild(document.createTextNode(r));
160
160
  }
161
161
  }
162
- var He = {
162
+ var Ue = {
163
163
  type: "info",
164
164
  position: "top-center",
165
165
  duration: 4e3,
@@ -168,19 +168,19 @@ var He = {
168
168
  persistMaxVisible: 3,
169
169
  maxLines: void 0,
170
170
  vibrate: !0
171
- }, Ue = [
171
+ }, We = [
172
172
  80,
173
173
  40,
174
174
  80
175
175
  ];
176
- function We() {
176
+ function Ge() {
177
177
  if (!(typeof navigator > "u" || !("vibrate" in navigator))) try {
178
- navigator.vibrate(Ue);
178
+ navigator.vibrate(We);
179
179
  } catch {}
180
180
  }
181
- var Ge = class {
181
+ var Ke = class {
182
182
  containers = /* @__PURE__ */ new Map();
183
- opts = { ...He };
183
+ opts = { ...Ue };
184
184
  toasts = /* @__PURE__ */ new Map();
185
185
  queue = [];
186
186
  _seq = 0;
@@ -189,10 +189,10 @@ var Ge = class {
189
189
  }
190
190
  ensureContainer(e) {
191
191
  let t = this.containers.get(e);
192
- return t || (t = Be("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;
192
+ return t || (t = X("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;
193
193
  }
194
194
  show(e, t) {
195
- 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 = ze(), u = {
195
+ 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 = Ve(), u = {
196
196
  id: l,
197
197
  type: n,
198
198
  dismissible: a,
@@ -275,30 +275,30 @@ var Ge = class {
275
275
  this.containers.clear();
276
276
  }
277
277
  buildElement(e, t, n, r, i, a, o) {
278
- let s = Be("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
278
+ let s = X("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
279
279
  s.setAttribute("data-qt-id", e);
280
- let c = Be("span", "qt-icon");
281
- c.innerHTML = X[n], s.appendChild(c);
282
- let l = Be("div", "qt-body"), u = Be("span", "qt-msg"), d = Pe(t, {
283
- maxWidth: Le(),
280
+ let c = X("span", "qt-icon");
281
+ c.innerHTML = Be[n], s.appendChild(c);
282
+ let l = X("div", "qt-body"), u = X("span", "qt-msg"), d = Ie(t, {
283
+ maxWidth: ze(),
284
284
  lineHeight: 1,
285
285
  maxLines: i
286
- }, Ie);
287
- if (d.lineCount <= 1 ? Ve(u, t) : d.lines.forEach((e, t) => {
288
- let n = Be("span", "qt-line"), r = e.text;
289
- t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"), Ve(n, r), u.appendChild(n);
286
+ }, Re);
287
+ if (d.lineCount <= 1 ? He(u, t) : d.lines.forEach((e, t) => {
288
+ let n = X("span", "qt-line"), r = e.text;
289
+ t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"), He(n, r), u.appendChild(n);
290
290
  }), l.appendChild(u), a) {
291
- let e = Be("div", "qt-desc");
291
+ let e = X("div", "qt-desc");
292
292
  e.textContent = a, l.appendChild(e);
293
293
  }
294
294
  if (s.appendChild(l), o) {
295
- let t = Be("button", "qt-action");
295
+ let t = X("button", "qt-action");
296
296
  t.type = "button", t.textContent = o.label, t.addEventListener("click", (t) => {
297
297
  t.stopPropagation(), this.dismiss(e), o.onClick();
298
298
  }), s.appendChild(t);
299
299
  }
300
300
  if (r) {
301
- let t = Be("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>");
301
+ let t = X("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>");
302
302
  t.type = "button", t.setAttribute("aria-label", "关闭通知"), t.addEventListener("click", (t) => {
303
303
  t.stopPropagation(), this.dismiss(e);
304
304
  }), s.appendChild(t);
@@ -310,7 +310,7 @@ var Ge = class {
310
310
  mount(e) {
311
311
  e.duration === 0 && this.evictPersistIfNeeded(e);
312
312
  let t = this.ensureContainer(e.position);
313
- this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate && We(), requestAnimationFrame(() => {
313
+ this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate && Ge(), requestAnimationFrame(() => {
314
314
  requestAnimationFrame(() => {
315
315
  e.element.classList.add("qt-enter");
316
316
  });
@@ -332,7 +332,7 @@ var Ge = class {
332
332
  let t = () => {
333
333
  e.element.remove(), this.toasts.delete(e.id), this._dequeue();
334
334
  };
335
- if (Fe) t();
335
+ if (Le) t();
336
336
  else {
337
337
  let n = !1, r = () => {
338
338
  n || (n = !0, t());
@@ -345,46 +345,46 @@ var Ge = class {
345
345
  let e = this.queue.shift();
346
346
  this.mount(e);
347
347
  }
348
- }, Ke = null;
349
- function qe() {
350
- return Ke ||= new Ge(), Ke;
351
- }
352
- var Je = Object.assign((e, t) => qe().show(e, t), {
353
- info: (e, t) => qe().info(e, t),
354
- success: (e, t) => qe().success(e, t),
355
- warn: (e, t) => qe().warn(e, t),
356
- error: (e, t) => qe().error(e, t),
357
- promise: (e, t, n) => qe().promise(e, t, n),
358
- dismiss: (e) => qe().dismiss(e),
359
- dismissAll: () => qe().dismissAll(),
360
- configure: (e) => qe().configure(e)
361
- }), Ye = /* @__PURE__ */ new Set(), Xe = null;
362
- function Ze(e) {
363
- Xe = e;
348
+ }, qe = null;
349
+ function Je() {
350
+ return qe ||= new Ke(), qe;
351
+ }
352
+ var Ye = Object.assign((e, t) => Je().show(e, t), {
353
+ info: (e, t) => Je().info(e, t),
354
+ success: (e, t) => Je().success(e, t),
355
+ warn: (e, t) => Je().warn(e, t),
356
+ error: (e, t) => Je().error(e, t),
357
+ promise: (e, t, n) => Je().promise(e, t, n),
358
+ dismiss: (e) => Je().dismiss(e),
359
+ dismissAll: () => Je().dismissAll(),
360
+ configure: (e) => Je().configure(e)
361
+ }), Xe = /* @__PURE__ */ new Set(), Ze = null;
362
+ function Qe(e) {
363
+ Ze = e;
364
364
  }
365
365
  function Z(e, t = "error", n) {
366
366
  let r = {
367
367
  persist: !0,
368
368
  ...n
369
369
  };
370
- if (Ye.size > 0) {
371
- for (let n of Ye) n(e, t, r);
370
+ if (Xe.size > 0) {
371
+ for (let n of Xe) n(e, t, r);
372
372
  return;
373
373
  }
374
- if (Xe) {
375
- Xe(e, t, r);
374
+ if (Ze) {
375
+ Ze(e, t, r);
376
376
  return;
377
377
  }
378
- t === "success" ? Je.success(e, r) : t === "info" ? Je.info(e, r) : Je.error(e, r);
378
+ t === "success" ? Ye.success(e, r) : t === "info" ? Ye.info(e, r) : Ye.error(e, r);
379
379
  }
380
- function Qe(e) {
381
- return Ye.add(e), () => {
382
- Ye.delete(e);
380
+ function $e(e) {
381
+ return Xe.add(e), () => {
382
+ Xe.delete(e);
383
383
  };
384
384
  }
385
385
  //#endregion
386
386
  //#region src/components/image-upload-dialog.tsx
387
- var $e = /* @__PURE__ */ e({ ImageUploadDialog: () => et }), et = ({ open: e, onClose: t, onInsert: n, validate: r }) => {
387
+ var et = /* @__PURE__ */ e({ ImageUploadDialog: () => tt }), tt = ({ open: e, onClose: t, onInsert: n, validate: r }) => {
388
388
  let [i, a] = T("upload"), [s, c] = T(!1), [l, u] = T(!1), [d, f] = T(null), [p, m] = T(null), [h, g] = T(""), [_, v] = T(null), y = w(null), x = (() => {
389
389
  try {
390
390
  let e = o();
@@ -676,10 +676,10 @@ var $e = /* @__PURE__ */ e({ ImageUploadDialog: () => et }), et = ({ open: e, on
676
676
  };
677
677
  //#endregion
678
678
  //#region src/components/toc.tsx
679
- function tt(e, t) {
679
+ function nt(e, t) {
680
680
  return `${e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu, "").replace(/\s+/g, "-").slice(0, 40) || "heading"}-${t}`;
681
681
  }
682
- function nt(e) {
682
+ function rt(e) {
683
683
  let t = [], n = [];
684
684
  for (let r of e) {
685
685
  let e = {
@@ -691,18 +691,18 @@ function nt(e) {
691
691
  }
692
692
  return t;
693
693
  }
694
- function rt(e) {
694
+ function it(e) {
695
695
  let t = /* @__PURE__ */ new Set(), n = (e) => {
696
696
  for (let r of e) r.children.length > 0 && (t.add(r.id), n(r.children));
697
697
  };
698
698
  return n(e), t;
699
699
  }
700
- function it(e, t) {
700
+ function at(e, t) {
701
701
  let n = [];
702
- for (let r of e) n.push(r), r.children.length > 0 && !t.has(r.id) && n.push(...it(r.children, t));
702
+ for (let r of e) n.push(r), r.children.length > 0 && !t.has(r.id) && n.push(...at(r.children, t));
703
703
  return n;
704
704
  }
705
- function at(e, t) {
705
+ function ot(e, t) {
706
706
  let n = t.toLowerCase(), r = (e) => {
707
707
  let t = [];
708
708
  for (let i of e) {
@@ -716,7 +716,7 @@ function at(e, t) {
716
716
  };
717
717
  return r(e);
718
718
  }
719
- function ot(e) {
719
+ function st(e) {
720
720
  let t = e.parentElement;
721
721
  for (; t && t !== document.documentElement;) {
722
722
  let e = getComputedStyle(t).overflowY;
@@ -725,7 +725,7 @@ function ot(e) {
725
725
  }
726
726
  return null;
727
727
  }
728
- function st(e) {
728
+ function ct(e) {
729
729
  if (e.isDestroyed) return null;
730
730
  try {
731
731
  return e.view.dom;
@@ -733,7 +733,7 @@ function st(e) {
733
733
  return null;
734
734
  }
735
735
  }
736
- function ct(e, t) {
736
+ function lt(e, t) {
737
737
  if (!t) return e;
738
738
  let n = e.toLowerCase(), r = t.toLowerCase(), i = [], a = 0, o = 0;
739
739
  for (;;) {
@@ -746,12 +746,12 @@ function ct(e, t) {
746
746
  }
747
747
  return a < e.length && i.push(e.slice(a)), i.length ? i : e;
748
748
  }
749
- var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
749
+ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
750
750
  let [r, i] = T([]), [a, o] = T(""), [s, c] = T(/* @__PURE__ */ new Set()), [l, u] = T(""), d = w(""), f = w([]), p = w(null), m = w(null), h = w(null), g = w(0), _ = b(() => {
751
751
  h.current &&= (clearTimeout(h.current.timer), null);
752
752
  }, []), v = b(() => {
753
- let t = st(e);
754
- return t ? Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((e, t) => (e.id ||= tt(e.textContent || "", t), {
753
+ let t = ct(e);
754
+ return t ? Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((e, t) => (e.id ||= nt(e.textContent || "", t), {
755
755
  id: e.id,
756
756
  level: Number(e.tagName.slice(1)),
757
757
  text: e.textContent?.trim() || "(无标题)",
@@ -760,7 +760,7 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
760
760
  }, [e]), y = b(() => {
761
761
  let e = f.current;
762
762
  if ((!e.length || e.some((e) => !e.el.isConnected)) && (e = v(), f.current = e), !e.length) return;
763
- let t = m.current, n = (t ? t.getBoundingClientRect().top : 0) + lt, r = t ? t.scrollHeight - t.scrollTop - t.clientHeight < 2 : document.documentElement.scrollHeight - window.scrollY - window.innerHeight < 2, i = "";
763
+ let t = m.current, n = (t ? t.getBoundingClientRect().top : 0) + ut, r = t ? t.scrollHeight - t.scrollTop - t.clientHeight < 2 : document.documentElement.scrollHeight - window.scrollY - window.innerHeight < 2, i = "";
764
764
  for (let t of e) t.el.isConnected && t.el.getBoundingClientRect().top <= n && (i = t.id);
765
765
  if (r) {
766
766
  for (let t = e.length - 1; t >= 0; t--) if (e[t].el.isConnected) {
@@ -784,7 +784,7 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
784
784
  t !== d.current && (d.current = t, f.current = e, i(e), S());
785
785
  }, [v, S]);
786
786
  x(() => {
787
- let t = st(e), n = t ? ot(t) : null;
787
+ let t = ct(e), n = t ? st(t) : null;
788
788
  m.current = n;
789
789
  let r = n ?? window;
790
790
  return r.addEventListener("scroll", S, { passive: !0 }), window.addEventListener("resize", S), r.addEventListener("wheel", _, { passive: !0 }), r.addEventListener("touchstart", _, { passive: !0 }), () => {
@@ -812,7 +812,7 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
812
812
  _
813
813
  ]);
814
814
  let k = b((t) => {
815
- let n = st(e);
815
+ let n = ct(e);
816
816
  if (!n) return;
817
817
  let r = t.el;
818
818
  if ((!r || !n.contains(r)) && (r = n.querySelector(`[id="${CSS.escape(t.id)}"]`)), !r) {
@@ -825,29 +825,29 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
825
825
  if (!r) return;
826
826
  _(), h.current = {
827
827
  id: t.id,
828
- timer: setTimeout(_, ut)
828
+ timer: setTimeout(_, dt)
829
829
  }, o(t.id);
830
830
  let i = m.current, a = r.getBoundingClientRect().top;
831
831
  if (i) {
832
832
  let e = i.getBoundingClientRect().top;
833
833
  i.scrollTo({
834
- top: i.scrollTop + a - e - lt,
834
+ top: i.scrollTop + a - e - ut,
835
835
  behavior: "smooth"
836
836
  });
837
837
  } else window.scrollTo({
838
- top: window.scrollY + a - lt,
838
+ top: window.scrollY + a - ut,
839
839
  behavior: "smooth"
840
840
  });
841
- }, [e, _]), A = C(() => nt(r), [r]), j = C(() => rt(A), [A]), M = C(() => {
841
+ }, [e, _]), A = C(() => rt(r), [r]), j = C(() => it(A), [A]), M = C(() => {
842
842
  let e = /* @__PURE__ */ new Map(), t = (n, r) => {
843
843
  for (let i of n) r && e.set(i.id, r), t(i.children, i.id);
844
844
  };
845
845
  return t(A, ""), e;
846
- }, [A]), N = l.trim().length > 0, P = C(() => N ? at(A, l.trim()) : A, [
846
+ }, [A]), N = l.trim().length > 0, P = C(() => N ? ot(A, l.trim()) : A, [
847
847
  A,
848
848
  N,
849
849
  l
850
- ]), F = C(() => it(P, N ? /* @__PURE__ */ new Set() : s), [
850
+ ]), F = C(() => at(P, N ? /* @__PURE__ */ new Set() : s), [
851
851
  P,
852
852
  s,
853
853
  N
@@ -1078,7 +1078,7 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
1078
1078
  title: e.text,
1079
1079
  children: /* @__PURE__ */ D("span", {
1080
1080
  className: "toc-text",
1081
- children: N ? ct(e.text, l.trim()) : e.text
1081
+ children: N ? lt(e.text, l.trim()) : e.text
1082
1082
  })
1083
1083
  })]
1084
1084
  }, e.id);
@@ -1102,7 +1102,7 @@ var lt = 84, ut = 3e3, dt = ({ editor: e, className: t = "", onClose: n }) => {
1102
1102
  };
1103
1103
  //#endregion
1104
1104
  //#region src/editor/ai/index.ts
1105
- function ft(e, t) {
1105
+ function pt(e, t) {
1106
1106
  return {
1107
1107
  continue: "你是一个写作助手。请从下文尾部自然流畅地续写内容,保持风格一致。只输出续写的内容,不要加任何前缀说明。",
1108
1108
  improve: "你是一个文字润色专家。请优化以下文本的表达,提升文采和流畅度,保持原意不变。只输出润色后的文本。",
@@ -1113,8 +1113,8 @@ function ft(e, t) {
1113
1113
  zap: t || "你是一个全能的 AI 写作助手。请根据用户的指令处理文本。"
1114
1114
  }[e];
1115
1115
  }
1116
- var pt = null;
1117
- async function mt(e) {
1116
+ var mt = null;
1117
+ async function ht(e) {
1118
1118
  let t;
1119
1119
  try {
1120
1120
  ({createOpenAI: t} = await import("@ai-sdk/openai"));
@@ -1129,7 +1129,7 @@ async function mt(e) {
1129
1129
  async *stream(e) {
1130
1130
  let t = await A({
1131
1131
  model: n,
1132
- system: ft(e.mode, e.instruction),
1132
+ system: pt(e.mode, e.instruction),
1133
1133
  prompt: e.context,
1134
1134
  temperature: .7,
1135
1135
  maxOutputTokens: 2048
@@ -1139,7 +1139,7 @@ async function mt(e) {
1139
1139
  async generate(e) {
1140
1140
  return (await k({
1141
1141
  model: n,
1142
- system: ft(e.mode, e.instruction),
1142
+ system: pt(e.mode, e.instruction),
1143
1143
  prompt: e.context,
1144
1144
  temperature: .7,
1145
1145
  maxOutputTokens: 2048
@@ -1147,16 +1147,16 @@ async function mt(e) {
1147
1147
  }
1148
1148
  };
1149
1149
  }
1150
- function ht(e) {
1151
- pt = e;
1150
+ function gt(e) {
1151
+ mt = e;
1152
1152
  }
1153
- function gt() {
1154
- if (!pt) throw Error("未配置 AI 服务。请调用 createAILanguageModelProvider() 创建并通过 setAIProvider() 注册。");
1155
- return pt;
1153
+ function _t() {
1154
+ if (!mt) throw Error("未配置 AI 服务。请调用 createAILanguageModelProvider() 创建并通过 setAIProvider() 注册。");
1155
+ return mt;
1156
1156
  }
1157
1157
  //#endregion
1158
1158
  //#region src/editor/ai/providers/openai-compat.ts
1159
- function _t(e) {
1159
+ function vt(e) {
1160
1160
  let { apiKey: t, baseURL: n, model: r, headers: i } = e;
1161
1161
  async function* a(e, a) {
1162
1162
  let o = await fetch(`${n}/chat/completions`, {
@@ -1207,10 +1207,10 @@ function _t(e) {
1207
1207
  }
1208
1208
  return {
1209
1209
  async *stream(e) {
1210
- yield* a(ft(e.mode, e.instruction), e.context);
1210
+ yield* a(pt(e.mode, e.instruction), e.context);
1211
1211
  },
1212
1212
  async generate(e) {
1213
- let t = ft(e.mode, e.instruction), n = "";
1213
+ let t = pt(e.mode, e.instruction), n = "";
1214
1214
  for await (let r of a(t, e.context)) n += r;
1215
1215
  return n;
1216
1216
  }
@@ -1218,8 +1218,8 @@ function _t(e) {
1218
1218
  }
1219
1219
  //#endregion
1220
1220
  //#region src/editor/ai/providers/deepseek.ts
1221
- function vt(e) {
1222
- return _t({
1221
+ function yt(e) {
1222
+ return vt({
1223
1223
  apiKey: e.apiKey,
1224
1224
  baseURL: e.baseURL || "https://api.deepseek.com/v1",
1225
1225
  model: e.model || "deepseek-v4-flash",
@@ -1228,8 +1228,8 @@ function vt(e) {
1228
1228
  }
1229
1229
  //#endregion
1230
1230
  //#region src/editor/ai/providers/openai.ts
1231
- function yt(e) {
1232
- return _t({
1231
+ function bt(e) {
1232
+ return vt({
1233
1233
  apiKey: e.apiKey,
1234
1234
  baseURL: e.baseURL || "https://api.openai.com/v1",
1235
1235
  model: e.model || "gpt-5.6-luna",
@@ -1238,8 +1238,8 @@ function yt(e) {
1238
1238
  }
1239
1239
  //#endregion
1240
1240
  //#region src/editor/ai/providers/qwen.ts
1241
- function bt(e) {
1242
- return _t({
1241
+ function xt(e) {
1242
+ return vt({
1243
1243
  apiKey: e.apiKey,
1244
1244
  baseURL: e.baseURL || "https://dashscope.aliyuncs.com/compatible-mode/v1",
1245
1245
  model: e.model || "qwen3.7-plus",
@@ -1248,20 +1248,20 @@ function bt(e) {
1248
1248
  }
1249
1249
  //#endregion
1250
1250
  //#region src/editor/extensions/search-highlight.ts
1251
- var xt = {
1251
+ var St = {
1252
1252
  keyword: "",
1253
1253
  caseSensitive: !1,
1254
1254
  wholeWord: !1,
1255
1255
  matches: [],
1256
1256
  currentIndex: -1
1257
- }, St = new B("search-highlight");
1258
- function Ct(e) {
1257
+ }, Ct = new V("search-highlight");
1258
+ function wt(e) {
1259
1259
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1260
1260
  }
1261
- function wt(e, t) {
1261
+ function Tt(e, t) {
1262
1262
  let { keyword: n, caseSensitive: r, wholeWord: i } = t;
1263
1263
  if (!n) return [];
1264
- let a = r ? "g" : "gi", o = i ? `\\b${Ct(n)}\\b` : Ct(n), s = new RegExp(o, a), c = [];
1264
+ let a = r ? "g" : "gi", o = i ? `\\b${wt(n)}\\b` : wt(n), s = new RegExp(o, a), c = [];
1265
1265
  return e.descendants((e, t) => {
1266
1266
  if (!e.isText || !e.text) return;
1267
1267
  s.lastIndex = 0;
@@ -1275,12 +1275,12 @@ function wt(e, t) {
1275
1275
  }
1276
1276
  }), c;
1277
1277
  }
1278
- function Tt(e, t) {
1279
- if (t.matches.length === 0) return ae.empty;
1280
- let n = t.matches.map((e, n) => H.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
1281
- return ae.create(e, n);
1282
- }
1283
1278
  function Et(e, t) {
1279
+ if (t.matches.length === 0) return oe.empty;
1280
+ let n = t.matches.map((e, n) => ae.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
1281
+ return oe.create(e, n);
1282
+ }
1283
+ function Dt(e, t) {
1284
1284
  if (t.currentIndex < 0 || t.currentIndex >= t.matches.length) return;
1285
1285
  let n = t.matches[t.currentIndex];
1286
1286
  n && requestAnimationFrame(() => {
@@ -1305,15 +1305,15 @@ function Et(e, t) {
1305
1305
  } catch {}
1306
1306
  });
1307
1307
  }
1308
- var Dt = R.create({
1308
+ var Ot = R.create({
1309
1309
  name: "searchHighlight",
1310
1310
  addProseMirrorPlugins() {
1311
- return [new z({
1312
- key: St,
1311
+ return [new B({
1312
+ key: Ct,
1313
1313
  state: {
1314
- init: () => xt,
1314
+ init: () => St,
1315
1315
  apply(e, t) {
1316
- let n = e.getMeta(St);
1316
+ let n = e.getMeta(Ct);
1317
1317
  if (n) return {
1318
1318
  ...t,
1319
1319
  ...n,
@@ -1321,7 +1321,7 @@ var Dt = R.create({
1321
1321
  currentIndex: n.currentIndex === void 0 ? t.currentIndex : n.currentIndex
1322
1322
  };
1323
1323
  if (e.docChanged && t.keyword) {
1324
- let n = wt(e.doc, t), r = t.currentIndex;
1324
+ let n = Tt(e.doc, t), r = t.currentIndex;
1325
1325
  return r >= n.length && (r = n.length - 1), r < 0 && (r = n.length > 0 ? 0 : -1), {
1326
1326
  ...t,
1327
1327
  matches: n,
@@ -1332,52 +1332,52 @@ var Dt = R.create({
1332
1332
  }
1333
1333
  },
1334
1334
  props: { decorations(e) {
1335
- let t = St.getState(e);
1336
- return t ? Tt(e.doc, t) : ae.empty;
1335
+ let t = Ct.getState(e);
1336
+ return t ? Et(e.doc, t) : oe.empty;
1337
1337
  } }
1338
1338
  })];
1339
1339
  },
1340
1340
  addCommands() {
1341
1341
  return {
1342
1342
  setSearch: (e, t = {}) => ({ state: n, dispatch: r, view: i }) => {
1343
- let a = St.getState(n) || xt, o = {
1343
+ let a = Ct.getState(n) || St, o = {
1344
1344
  keyword: e,
1345
1345
  caseSensitive: t.caseSensitive ?? a.caseSensitive,
1346
1346
  wholeWord: t.wholeWord ?? a.wholeWord,
1347
1347
  matches: [],
1348
1348
  currentIndex: -1
1349
1349
  };
1350
- return o.matches = wt(n.doc, o), o.currentIndex = o.matches.length > 0 ? 0 : -1, r && (r(n.tr.setMeta(St, o)), i && Et(i, o)), !0;
1350
+ return o.matches = Tt(n.doc, o), o.currentIndex = o.matches.length > 0 ? 0 : -1, r && (r(n.tr.setMeta(Ct, o)), i && Dt(i, o)), !0;
1351
1351
  },
1352
1352
  nextMatch: () => ({ state: e, dispatch: t, view: n }) => {
1353
- let r = St.getState(e) || xt;
1353
+ let r = Ct.getState(e) || St;
1354
1354
  if (r.matches.length === 0) return !1;
1355
1355
  let i = (r.currentIndex + 1) % r.matches.length;
1356
- return t && (t(e.tr.setMeta(St, { currentIndex: i })), n && Et(n, {
1356
+ return t && (t(e.tr.setMeta(Ct, { currentIndex: i })), n && Dt(n, {
1357
1357
  ...r,
1358
1358
  currentIndex: i
1359
1359
  })), !0;
1360
1360
  },
1361
1361
  prevMatch: () => ({ state: e, dispatch: t, view: n }) => {
1362
- let r = St.getState(e) || xt;
1362
+ let r = Ct.getState(e) || St;
1363
1363
  if (r.matches.length === 0) return !1;
1364
1364
  let i = (r.currentIndex - 1 + r.matches.length) % r.matches.length;
1365
- return t && (t(e.tr.setMeta(St, { currentIndex: i })), n && Et(n, {
1365
+ return t && (t(e.tr.setMeta(Ct, { currentIndex: i })), n && Dt(n, {
1366
1366
  ...r,
1367
1367
  currentIndex: i
1368
1368
  })), !0;
1369
1369
  },
1370
- clearSearch: () => ({ state: e, dispatch: t }) => (t && t(e.tr.setMeta(St, xt)), !0)
1370
+ clearSearch: () => ({ state: e, dispatch: t }) => (t && t(e.tr.setMeta(Ct, St)), !0)
1371
1371
  };
1372
1372
  }
1373
1373
  });
1374
- function Ot(e) {
1374
+ function kt(e) {
1375
1375
  let t = e.state;
1376
- return St.getState(t) || xt;
1376
+ return Ct.getState(t) || St;
1377
1377
  }
1378
1378
  //#endregion
1379
1379
  //#region src/components/search-bar.tsx
1380
- var kt = ({ editor: e, onClose: t }) => {
1380
+ var At = ({ editor: e, onClose: t }) => {
1381
1381
  let [n, r] = T(""), [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(0), u = w(null), d = w({
1382
1382
  keyword: n,
1383
1383
  caseSensitive: i,
@@ -1442,7 +1442,7 @@ var kt = ({ editor: e, onClose: t }) => {
1442
1442
  }, [f, p]), h = C(() => {
1443
1443
  if (!e) return null;
1444
1444
  try {
1445
- return Ot(e);
1445
+ return kt(e);
1446
1446
  } catch {
1447
1447
  return null;
1448
1448
  }
@@ -1594,36 +1594,36 @@ function Q({ children: e, ...t }) {
1594
1594
  children: e
1595
1595
  });
1596
1596
  }
1597
- var At = (e) => /* @__PURE__ */ O(Q, {
1597
+ var jt = (e) => /* @__PURE__ */ O(Q, {
1598
1598
  ...e,
1599
1599
  children: [/* @__PURE__ */ D("path", { d: "M6 4h8a4 4 0 0 1 0 8H6z" }), /* @__PURE__ */ D("path", { d: "M6 12h9a4 4 0 0 1 0 8H6z" })]
1600
- }), jt = (e) => /* @__PURE__ */ O(Q, {
1600
+ }), Mt = (e) => /* @__PURE__ */ O(Q, {
1601
1601
  ...e,
1602
1602
  children: [
1603
1603
  /* @__PURE__ */ D("path", { d: "M19 4h-9" }),
1604
1604
  /* @__PURE__ */ D("path", { d: "M14 20H5" }),
1605
1605
  /* @__PURE__ */ D("path", { d: "M15 4 9 20" })
1606
1606
  ]
1607
- }), Mt = (e) => /* @__PURE__ */ O(Q, {
1607
+ }), Nt = (e) => /* @__PURE__ */ O(Q, {
1608
1608
  ...e,
1609
1609
  children: [/* @__PURE__ */ D("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ D("path", { d: "M4 20h16" })]
1610
- }), Nt = (e) => /* @__PURE__ */ O(Q, {
1610
+ }), Pt = (e) => /* @__PURE__ */ O(Q, {
1611
1611
  ...e,
1612
1612
  children: [
1613
1613
  /* @__PURE__ */ D("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
1614
1614
  /* @__PURE__ */ D("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
1615
1615
  /* @__PURE__ */ D("path", { d: "M4 12h16" })
1616
1616
  ]
1617
- }), Pt = (e) => /* @__PURE__ */ O(Q, {
1617
+ }), Ft = (e) => /* @__PURE__ */ O(Q, {
1618
1618
  ...e,
1619
1619
  children: [/* @__PURE__ */ D("path", { d: "m16 18 6-6-6-6" }), /* @__PURE__ */ D("path", { d: "m8 6-6 6 6 6" })]
1620
- }), Ft = (e) => /* @__PURE__ */ O(Q, {
1620
+ }), It = (e) => /* @__PURE__ */ O(Q, {
1621
1621
  ...e,
1622
1622
  children: [/* @__PURE__ */ D("path", { d: "m9 11-6 6v3h9l3-3" }), /* @__PURE__ */ D("path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4" })]
1623
- }), It = (e) => /* @__PURE__ */ O(Q, {
1623
+ }), Lt = (e) => /* @__PURE__ */ O(Q, {
1624
1624
  ...e,
1625
1625
  children: [/* @__PURE__ */ D("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ D("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
1626
- }), Lt = (e) => /* @__PURE__ */ O(Q, {
1626
+ }), Rt = (e) => /* @__PURE__ */ O(Q, {
1627
1627
  ...e,
1628
1628
  children: [/* @__PURE__ */ D("rect", {
1629
1629
  x: "3",
@@ -1633,7 +1633,7 @@ var At = (e) => /* @__PURE__ */ O(Q, {
1633
1633
  rx: "2",
1634
1634
  ry: "2"
1635
1635
  }), /* @__PURE__ */ D("path", { d: "M3 9h18M3 15h18M9 3v18M15 3v18" })]
1636
- }), Rt = (e) => /* @__PURE__ */ O(Q, {
1636
+ }), zt = (e) => /* @__PURE__ */ O(Q, {
1637
1637
  ...e,
1638
1638
  children: [/* @__PURE__ */ D("rect", {
1639
1639
  x: "8",
@@ -1643,17 +1643,17 @@ var At = (e) => /* @__PURE__ */ O(Q, {
1643
1643
  rx: "2",
1644
1644
  ry: "2"
1645
1645
  }), /* @__PURE__ */ D("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]
1646
- }), zt = (e) => /* @__PURE__ */ O(Q, {
1646
+ }), Bt = (e) => /* @__PURE__ */ O(Q, {
1647
1647
  ...e,
1648
1648
  children: [/* @__PURE__ */ D("circle", {
1649
1649
  cx: "11",
1650
1650
  cy: "11",
1651
1651
  r: "8"
1652
1652
  }), /* @__PURE__ */ D("path", { d: "m21 21-4.3-4.3" })]
1653
- }), Bt = (e) => /* @__PURE__ */ O(Q, {
1653
+ }), Vt = (e) => /* @__PURE__ */ O(Q, {
1654
1654
  ...e,
1655
1655
  children: [/* @__PURE__ */ D("path", { d: "M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3z" }), /* @__PURE__ */ D("path", { d: "M18.5 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7.7-1.9z" })]
1656
- }), Vt = (e) => /* @__PURE__ */ O(Q, {
1656
+ }), Ht = (e) => /* @__PURE__ */ O(Q, {
1657
1657
  ...e,
1658
1658
  children: [
1659
1659
  /* @__PURE__ */ D("circle", {
@@ -1672,13 +1672,13 @@ var At = (e) => /* @__PURE__ */ O(Q, {
1672
1672
  r: "1"
1673
1673
  })
1674
1674
  ]
1675
- }), Ht = (e) => /* @__PURE__ */ O(Q, {
1675
+ }), Ut = (e) => /* @__PURE__ */ O(Q, {
1676
1676
  ...e,
1677
1677
  children: [/* @__PURE__ */ D("path", { d: "M18 6 6 18" }), /* @__PURE__ */ D("path", { d: "m6 6 12 12" })]
1678
1678
  });
1679
1679
  //#endregion
1680
1680
  //#region src/editor/storage/remove-resource.ts
1681
- async function Ut(e) {
1681
+ async function Wt(e) {
1682
1682
  if (e) {
1683
1683
  if (e.startsWith("blob:")) {
1684
1684
  URL.revokeObjectURL(e);
@@ -1693,61 +1693,61 @@ async function Ut(e) {
1693
1693
  }
1694
1694
  //#endregion
1695
1695
  //#region src/editor/ai/pending-removal.ts
1696
- var Wt = 3e4, Gt = /* @__PURE__ */ new Set([
1696
+ var Gt = 3e4, Kt = /* @__PURE__ */ new Set([
1697
1697
  "image",
1698
1698
  "attachmentEmbed",
1699
1699
  "audioEmbed",
1700
1700
  "videoEmbed"
1701
- ]), Kt = /* @__PURE__ */ new WeakMap();
1702
- function qt(e) {
1701
+ ]), qt = /* @__PURE__ */ new WeakMap();
1702
+ function Jt(e) {
1703
1703
  let t = /* @__PURE__ */ new Set();
1704
1704
  return e.state.doc.descendants((e) => {
1705
- if (Gt.has(e.type.name)) {
1705
+ if (Kt.has(e.type.name)) {
1706
1706
  let n = e.attrs.src;
1707
1707
  n && t.add(n);
1708
1708
  }
1709
1709
  return !0;
1710
1710
  }), t;
1711
1711
  }
1712
- function Jt(e) {
1713
- let t = Kt.get(e);
1712
+ function Yt(e) {
1713
+ let t = qt.get(e);
1714
1714
  return t || (t = {
1715
1715
  timers: /* @__PURE__ */ new Map(),
1716
1716
  onTransaction: () => {},
1717
1717
  listening: !1
1718
- }, Kt.set(e, t)), t;
1718
+ }, qt.set(e, t)), t;
1719
1719
  }
1720
- function Yt(e, t) {
1720
+ function Xt(e, t) {
1721
1721
  let n = [...new Set(t.filter(Boolean))];
1722
1722
  if (n.length === 0) return;
1723
- let r = Jt(e);
1723
+ let r = Yt(e);
1724
1724
  r.listening ||= (r.onTransaction = () => {
1725
1725
  if (r.timers.size === 0) return;
1726
- let t = qt(e);
1726
+ let t = Jt(e);
1727
1727
  for (let [e, n] of r.timers) t.has(e) && (clearTimeout(n), r.timers.delete(e));
1728
1728
  }, e.on("transaction", r.onTransaction), !0);
1729
1729
  for (let t of n) {
1730
1730
  if (r.timers.has(t)) continue;
1731
1731
  let n = setTimeout(() => {
1732
- qt(e).has(t) || Ut(t), r.timers.delete(t);
1733
- }, Wt);
1732
+ Jt(e).has(t) || Wt(t), r.timers.delete(t);
1733
+ }, Gt);
1734
1734
  r.timers.set(t, n);
1735
1735
  }
1736
1736
  }
1737
- function Xt(e) {
1738
- let t = Kt.get(e);
1737
+ function Zt(e) {
1738
+ let t = qt.get(e);
1739
1739
  if (t) {
1740
1740
  if (t.listening &&= (e.off("transaction", t.onTransaction), !1), t.timers.size > 0) {
1741
- let n = qt(e);
1742
- for (let [e, r] of t.timers) clearTimeout(r), n.has(e) || Ut(e);
1741
+ let n = Jt(e);
1742
+ for (let [e, r] of t.timers) clearTimeout(r), n.has(e) || Wt(e);
1743
1743
  t.timers.clear();
1744
1744
  }
1745
- Kt.delete(e);
1745
+ qt.delete(e);
1746
1746
  }
1747
1747
  }
1748
1748
  //#endregion
1749
1749
  //#region src/editor/ai/components/ai-selector.tsx
1750
- var Zt = [
1750
+ var Qt = [
1751
1751
  {
1752
1752
  mode: "continue",
1753
1753
  labelKey: "editor.ai.continue",
@@ -1790,24 +1790,24 @@ var Zt = [
1790
1790
  descKey: "editor.ai.zapDesc",
1791
1791
  icon: "⚡"
1792
1792
  }
1793
- ], Qt = /* @__PURE__ */ new Set([
1793
+ ], $t = /* @__PURE__ */ new Set([
1794
1794
  "image",
1795
1795
  "attachmentEmbed",
1796
1796
  "audioEmbed",
1797
1797
  "videoEmbed"
1798
- ]), $t = {
1798
+ ]), en = {
1799
1799
  image: "editor.ai.nodeImage",
1800
1800
  attachmentEmbed: "editor.ai.nodeAttachment",
1801
1801
  videoEmbed: "editor.ai.nodeVideo",
1802
1802
  audioEmbed: "editor.ai.nodeAudio"
1803
1803
  };
1804
- function en(e, t) {
1804
+ function tn(e, t) {
1805
1805
  return e.storage.qingwuUI?.parseMd?.(e.schema, t) || null;
1806
1806
  }
1807
- function tn(e, t, n) {
1807
+ function nn(e, t, n) {
1808
1808
  let r = [];
1809
1809
  return e.state.doc.nodesBetween(t, n, (e) => {
1810
- if (Qt.has(e.type.name)) {
1810
+ if ($t.has(e.type.name)) {
1811
1811
  let t = e.attrs.src;
1812
1812
  t && r.push({
1813
1813
  type: e.type.name,
@@ -1817,27 +1817,27 @@ function tn(e, t, n) {
1817
1817
  return !0;
1818
1818
  }), r;
1819
1819
  }
1820
- function nn(e) {
1820
+ function rn(e) {
1821
1821
  let t = /* @__PURE__ */ new Set();
1822
1822
  return e.state.doc.descendants((e) => {
1823
- if (Qt.has(e.type.name)) {
1823
+ if ($t.has(e.type.name)) {
1824
1824
  let n = e.attrs.src;
1825
1825
  n && t.add(n);
1826
1826
  }
1827
1827
  return !0;
1828
1828
  }), t;
1829
1829
  }
1830
- function rn(e, t) {
1831
- let n = en(e, t);
1830
+ function an(e, t) {
1831
+ let n = tn(e, t);
1832
1832
  if (n && n.size > 0) {
1833
1833
  let t = e.state.tr;
1834
- t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(V.create(t.doc, t.doc.content.size)), e.view.dispatch(t.scrollIntoView()), e.commands.focus();
1834
+ t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(H.create(t.doc, t.doc.content.size)), e.view.dispatch(t.scrollIntoView()), e.commands.focus();
1835
1835
  return;
1836
1836
  }
1837
1837
  e.commands.setContent(t), e.commands.focus();
1838
1838
  }
1839
- function an(e, t, n, r) {
1840
- let i = en(e, t);
1839
+ function on(e, t, n, r) {
1840
+ let i = tn(e, t);
1841
1841
  if (e.commands.focus(), !i) {
1842
1842
  let i = e.chain().focus();
1843
1843
  n === "replace" ? i.setTextSelection({
@@ -1849,7 +1849,7 @@ function an(e, t, n, r) {
1849
1849
  let a = e.state.tr;
1850
1850
  n === "replace" ? a.replaceRange(r.from, r.to, new N(i, 0, 0)) : a.insert(Math.min(r.to, e.state.doc.content.size), i), e.view.dispatch(a.scrollIntoView());
1851
1851
  }
1852
- function on({ editor: e, onClose: t }) {
1852
+ function sn({ editor: e, onClose: t }) {
1853
1853
  let [n, r] = T(null), [i, a] = T(""), [o, s] = T(""), [c, l] = T(!1), [u, d] = T(null), [p, m] = T(null), h = w({
1854
1854
  from: 0,
1855
1855
  to: 0,
@@ -1868,7 +1868,7 @@ function on({ editor: e, onClose: t }) {
1868
1868
  empty: n.empty
1869
1869
  }, l(!0), s(""), v.current = !0, d(null);
1870
1870
  try {
1871
- let r = gt(), a = n.empty ? e.state.doc.textContent : e.state.doc.textBetween(n.from, n.to), o = [];
1871
+ let r = _t(), a = n.empty ? e.state.doc.textContent : e.state.doc.textBetween(n.from, n.to), o = [];
1872
1872
  for await (let e of r.stream({
1873
1873
  mode: t,
1874
1874
  context: a,
@@ -1893,13 +1893,13 @@ function on({ editor: e, onClose: t }) {
1893
1893
  !e || !v.current || (e.scrollTop = e.scrollHeight);
1894
1894
  }, [o]);
1895
1895
  let k = b((t, n, r) => {
1896
- let i = new Set(tn(e, r.from, r.to).map((e) => e.src));
1897
- t === "replaceAll" ? rn(e, n) : an(e, n, "replace", h.current);
1898
- let a = nn(e);
1899
- Yt(e, [...i].filter((e) => !a.has(e)));
1896
+ let i = new Set(nn(e, r.from, r.to).map((e) => e.src));
1897
+ t === "replaceAll" ? an(e, n) : on(e, n, "replace", h.current);
1898
+ let a = rn(e);
1899
+ Xt(e, [...i].filter((e) => !a.has(e)));
1900
1900
  }, [e]), A = b((n) => {
1901
1901
  if (n === "below") {
1902
- an(e, o, "below", h.current), t();
1902
+ on(e, o, "below", h.current), t();
1903
1903
  return;
1904
1904
  }
1905
1905
  let r = h.current, i = n === "replaceAll" ? {
@@ -1908,7 +1908,7 @@ function on({ editor: e, onClose: t }) {
1908
1908
  } : {
1909
1909
  from: r.from,
1910
1910
  to: r.to
1911
- }, a = tn(e, i.from, i.to);
1911
+ }, a = nn(e, i.from, i.to);
1912
1912
  if (a.length > 0) {
1913
1913
  m({
1914
1914
  position: n,
@@ -1949,19 +1949,19 @@ function on({ editor: e, onClose: t }) {
1949
1949
  className: "flex items-center justify-between pl-3 pr-1.5 py-1.5 border-b border-default-100 shrink-0",
1950
1950
  children: [/* @__PURE__ */ O("span", {
1951
1951
  className: "flex items-center gap-1.5 text-xs font-medium text-default-500",
1952
- children: [/* @__PURE__ */ D(Bt, { className: "text-primary" }), f("editor.ai.trigger")]
1952
+ children: [/* @__PURE__ */ D(Vt, { className: "text-primary" }), f("editor.ai.trigger")]
1953
1953
  }), /* @__PURE__ */ D("button", {
1954
1954
  type: "button",
1955
1955
  onClick: t,
1956
1956
  "aria-label": f("editor.ai.close"),
1957
1957
  title: f("editor.ai.close"),
1958
1958
  className: "flex items-center justify-center w-6 h-6 rounded-md text-default-400 hover:bg-default-100 hover:text-default-700 transition-colors",
1959
- children: /* @__PURE__ */ D(Ht, {})
1959
+ children: /* @__PURE__ */ D(Ut, {})
1960
1960
  })]
1961
1961
  }),
1962
1962
  /* @__PURE__ */ D("div", {
1963
1963
  className: "grid grid-cols-[repeat(auto-fit,minmax(64px,1fr))] gap-1.5 p-2 shrink-0",
1964
- children: Zt.map(({ mode: e, labelKey: t, descKey: r, icon: i }) => /* @__PURE__ */ O("button", {
1964
+ children: Qt.map(({ mode: e, labelKey: t, descKey: r, icon: i }) => /* @__PURE__ */ O("button", {
1965
1965
  type: "button",
1966
1966
  className: `flex flex-col items-center gap-1 px-1 py-2 rounded-xl border transition-colors ${n === e ? "border-primary/40 bg-primary/10 text-primary" : "border-default-200 text-default-600 hover:bg-default-100 hover:text-default-900"}`,
1967
1967
  onClick: () => y(e),
@@ -2104,7 +2104,7 @@ function on({ editor: e, onClose: t }) {
2104
2104
  children: Object.entries(N).map(([e, t]) => /* @__PURE__ */ O("li", {
2105
2105
  className: "text-sm text-default-700",
2106
2106
  children: [
2107
- f($t[e] ?? e),
2107
+ f(en[e] ?? e),
2108
2108
  " ×",
2109
2109
  t
2110
2110
  ]
@@ -2136,19 +2136,19 @@ function on({ editor: e, onClose: t }) {
2136
2136
  }
2137
2137
  //#endregion
2138
2138
  //#region src/editor/attachment-limits.ts
2139
- var sn = /* @__PURE__ */ new Set([
2139
+ var cn = /* @__PURE__ */ new Set([
2140
2140
  "attachmentEmbed",
2141
2141
  "videoEmbed",
2142
2142
  "audioEmbed",
2143
2143
  "image"
2144
2144
  ]);
2145
- function cn(e) {
2145
+ function ln(e) {
2146
2146
  let t = 0;
2147
2147
  return e.descendants((e) => {
2148
- sn.has(e.type.name) && (t += Number(e.attrs?.size) || 0);
2148
+ cn.has(e.type.name) && (t += Number(e.attrs?.size) || 0);
2149
2149
  }), t;
2150
2150
  }
2151
- function ln(e) {
2151
+ function un(e) {
2152
2152
  if (!Number.isFinite(e) || e <= 0) return "0 B";
2153
2153
  let t = [
2154
2154
  "B",
@@ -2159,41 +2159,41 @@ function ln(e) {
2159
2159
  ], n = Math.min(t.length - 1, Math.floor(Math.log(e) / Math.log(1024))), r = e / 1024 ** n;
2160
2160
  return `${n === 0 || r >= 100 ? `${Math.round(r)}` : `${Math.round(r * 10) / 10}`} ${t[n]}`;
2161
2161
  }
2162
- function un(e) {
2162
+ function dn(e) {
2163
2163
  return (e?.storage)?.qingwuUI?.limits;
2164
2164
  }
2165
- function dn(e, t, n) {
2165
+ function fn(e, t, n) {
2166
2166
  let { maxAttachmentSize: r, maxTotalAttachmentSize: i } = n;
2167
- if (r && t.size > r) return `单文件大小不能超过 ${ln(r)}(当前 ${ln(t.size)})`;
2167
+ if (r && t.size > r) return `单文件大小不能超过 ${un(r)}(当前 ${un(t.size)})`;
2168
2168
  if (i) {
2169
- let n = cn(e) + t.size;
2170
- if (n > i) return `附件总大小不能超过 ${ln(i)}(当前合计 ${ln(n)})`;
2169
+ let n = ln(e) + t.size;
2170
+ if (n > i) return `附件总大小不能超过 ${un(i)}(当前合计 ${un(n)})`;
2171
2171
  }
2172
2172
  return null;
2173
2173
  }
2174
2174
  //#endregion
2175
2175
  //#region src/editor/utils/delete-confirm.ts
2176
- var fn = !1, pn = null, mn = 5e3;
2177
- function hn() {
2178
- return fn;
2176
+ var pn = !1, mn = null, hn = 5e3;
2177
+ function gn() {
2178
+ return pn;
2179
2179
  }
2180
2180
  function $(e) {
2181
- fn = e, pn &&= (clearTimeout(pn), null), e && (pn = setTimeout(() => {
2182
- fn = !1, pn = null;
2183
- }, mn));
2181
+ pn = e, mn &&= (clearTimeout(mn), null), e && (mn = setTimeout(() => {
2182
+ pn = !1, mn = null;
2183
+ }, hn));
2184
2184
  }
2185
- var gn = null;
2186
- function _n(e) {
2187
- gn = e;
2185
+ var _n = null;
2186
+ function vn(e) {
2187
+ _n = e;
2188
2188
  }
2189
- function vn() {
2190
- return gn;
2189
+ function yn() {
2190
+ return _n;
2191
2191
  }
2192
2192
  //#endregion
2193
2193
  //#region src/editor/utils/delete-confirm-dialog.tsx
2194
- var yn = 300;
2195
- function bn({ open: e, title: t, message: n, confirmText: r = "删除", cancelText: i = "取消", onConfirm: a, onCancel: o }) {
2196
- let [s, c] = T(!1), l = w(!1), u = vn();
2194
+ var bn = 300;
2195
+ function xn({ open: e, title: t, message: n, confirmText: r = "删除", cancelText: i = "取消", onConfirm: a, onCancel: o }) {
2196
+ let [s, c] = T(!1), l = w(!1), u = yn();
2197
2197
  return x(() => {
2198
2198
  if (!e) {
2199
2199
  l.current = !1;
@@ -2263,7 +2263,7 @@ function bn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
2263
2263
  await a();
2264
2264
  } finally {
2265
2265
  let t = Date.now() - e;
2266
- t < yn && await new Promise((e) => setTimeout(e, yn - t)), c(!1), o();
2266
+ t < bn && await new Promise((e) => setTimeout(e, bn - t)), c(!1), o();
2267
2267
  }
2268
2268
  },
2269
2269
  disabled: s,
@@ -2276,10 +2276,10 @@ function bn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
2276
2276
  }
2277
2277
  //#endregion
2278
2278
  //#region src/editor/extensions/image-view.tsx
2279
- function xn(e) {
2279
+ function Sn(e) {
2280
2280
  return /^(\.\.?\/|[a-zA-Z]:\\|file:\/\/)/.test(e) ? !0 : !(/^[a-z]+:\/\//i.test(e) || e.startsWith("/") || e.startsWith("data:") || e.startsWith("blob:"));
2281
2281
  }
2282
- function Sn({ node: e, deleteNode: t, editor: r }) {
2282
+ function Cn({ node: e, deleteNode: t, editor: r }) {
2283
2283
  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(() => {
2284
2284
  o || (A.current = window.scrollY, a(!0));
2285
2285
  }, [o]), I = b(() => {
@@ -2332,7 +2332,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2332
2332
  };
2333
2333
  return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
2334
2334
  }, []);
2335
- let te = o || xn(p);
2335
+ let te = o || Sn(p);
2336
2336
  return /* @__PURE__ */ O(F, {
2337
2337
  as: "div",
2338
2338
  className: "image-node-view group/img",
@@ -2345,7 +2345,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2345
2345
  type: "button",
2346
2346
  className: "img-ctrl-btn img-ctrl-btn--del image-placeholder-del",
2347
2347
  onClick: () => {
2348
- hn() || ($(!0), f(!0));
2348
+ gn() || ($(!0), f(!0));
2349
2349
  },
2350
2350
  title: "删除",
2351
2351
  children: /* @__PURE__ */ D("svg", {
@@ -2377,7 +2377,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2377
2377
  }),
2378
2378
  /* @__PURE__ */ D("span", {
2379
2379
  className: "image-placeholder-text",
2380
- children: xn(p) ? "本地图片无法加载" : "图片加载失败"
2380
+ children: Sn(p) ? "本地图片无法加载" : "图片加载失败"
2381
2381
  }),
2382
2382
  /* @__PURE__ */ D("span", {
2383
2383
  className: "image-placeholder-path",
@@ -2458,7 +2458,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2458
2458
  type: "button",
2459
2459
  className: "img-ctrl-btn img-ctrl-btn--del",
2460
2460
  onClick: () => {
2461
- hn() || ($(!0), f(!0));
2461
+ gn() || ($(!0), f(!0));
2462
2462
  },
2463
2463
  title: "删除",
2464
2464
  children: /* @__PURE__ */ D("svg", {
@@ -2545,7 +2545,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2545
2545
  }
2546
2546
  })]
2547
2547
  }),
2548
- /* @__PURE__ */ D(bn, {
2548
+ /* @__PURE__ */ D(xn, {
2549
2549
  open: d,
2550
2550
  title: "确认删除图片",
2551
2551
  message: te ? "该图片无法在当前环境加载,仅从编辑器中移除该图片节点,不影响存储文件。" : "此操作将同时删除对象存储中的文件,不可撤销。",
@@ -2554,7 +2554,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2554
2554
  },
2555
2555
  onConfirm: async () => {
2556
2556
  if (!te) try {
2557
- await Ut(p);
2557
+ await Wt(p);
2558
2558
  } catch {}
2559
2559
  $(!1), await new Promise((e) => setTimeout(e, 300)), t();
2560
2560
  }
@@ -2564,7 +2564,7 @@ function Sn({ node: e, deleteNode: t, editor: r }) {
2564
2564
  }
2565
2565
  //#endregion
2566
2566
  //#region src/editor/embeds/attachment-view.tsx
2567
- var Cn = y(() => import("@file-viewer/react")), wn = /* @__PURE__ */ new Set(), Tn = {
2567
+ var wn = y(() => import("@file-viewer/react")), Tn = /* @__PURE__ */ new Set(), En = {
2568
2568
  rendererMode: "replace",
2569
2569
  autoRenderers: !0,
2570
2570
  theme: "light",
@@ -2593,7 +2593,7 @@ var Cn = y(() => import("@file-viewer/react")), wn = /* @__PURE__ */ new Set(),
2593
2593
  cache: !0,
2594
2594
  workerTimeoutMs: 3e4
2595
2595
  }
2596
- }, En = {
2596
+ }, Dn = {
2597
2597
  pdf: "pdf",
2598
2598
  docx: "word",
2599
2599
  docm: "word",
@@ -2648,7 +2648,7 @@ var Cn = y(() => import("@file-viewer/react")), wn = /* @__PURE__ */ new Set(),
2648
2648
  xml: "text",
2649
2649
  yml: "text",
2650
2650
  yaml: "text"
2651
- }, Dn = {
2651
+ }, On = {
2652
2652
  pdf: () => import("@file-viewer/renderer-pdf").then((e) => e.pdfRenderer),
2653
2653
  word: () => import("@file-viewer/renderer-word").then((e) => e.wordRenderer),
2654
2654
  spreadsheet: () => import("@file-viewer/renderer-spreadsheet").then((e) => e.spreadsheetRenderer),
@@ -2656,10 +2656,10 @@ var Cn = y(() => import("@file-viewer/react")), wn = /* @__PURE__ */ new Set(),
2656
2656
  archive: () => import("@file-viewer/renderer-archive").then((e) => e.archiveRenderer),
2657
2657
  text: () => import("@file-viewer/renderer-text").then((e) => e.textRenderer)
2658
2658
  };
2659
- function On(e) {
2659
+ function kn(e) {
2660
2660
  return e ? e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB` : "";
2661
2661
  }
2662
- function kn(e) {
2662
+ function An(e) {
2663
2663
  let t = e.split(".").pop()?.toLowerCase() || "", n = {
2664
2664
  pdf: {
2665
2665
  label: "PDF",
@@ -2832,22 +2832,22 @@ function kn(e) {
2832
2832
  ]
2833
2833
  });
2834
2834
  }
2835
- function An(e) {
2835
+ function jn(e) {
2836
2836
  return e.split(".").pop()?.toLowerCase() || "";
2837
2837
  }
2838
- function jn(e) {
2838
+ function Mn(e) {
2839
2839
  let t = e.split(".").pop()?.toLowerCase() || "";
2840
2840
  return /^(pdf|docx?|dotx?|xlsx?|xltx?|pptx?|potx?|txt|md|html?|csv|json|xml|yml|yaml|log|zip|rar|7z|tar|gz|odt|ods|odp|rtf|xlsm|xlsb|ppsx|numbers|tgz|bz2|xz|zst|js|ts|tsx|py|sh|sql)$/.test(t);
2841
2841
  }
2842
- function Mn(e) {
2842
+ function Nn(e) {
2843
2843
  return !!e && !e.startsWith("file:");
2844
2844
  }
2845
- function Nn(e) {
2845
+ function Pn(e) {
2846
2846
  return btoa(encodeURIComponent(e)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
2847
2847
  }
2848
- async function Pn(e, t) {
2848
+ async function Fn(e, t) {
2849
2849
  try {
2850
- let n = Nn(e), r = await fetch(`/api/preview/${n}`, {
2850
+ let n = Pn(e), r = await fetch(`/api/preview/${n}`, {
2851
2851
  signal: t,
2852
2852
  cache: "no-store"
2853
2853
  });
@@ -2859,7 +2859,7 @@ async function Pn(e, t) {
2859
2859
  return null;
2860
2860
  }
2861
2861
  }
2862
- function Fn(e, t, n) {
2862
+ function In(e, t, n) {
2863
2863
  return new Promise((r, i) => {
2864
2864
  let a = new XMLHttpRequest();
2865
2865
  if (a.open("GET", e, !0), a.responseType = "arraybuffer", t) {
@@ -2897,20 +2897,20 @@ function Fn(e, t, n) {
2897
2897
  a.send();
2898
2898
  });
2899
2899
  }
2900
- function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2901
- let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() => wn.has(s)), [u, d] = T(null), [p, 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, ne] = 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" : f("editor.attachment.lost")), G = e.attrs.size || 0, K = An(W), q = !U;
2900
+ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
2901
+ let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() => Tn.has(s)), [u, d] = T(null), [p, 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, ne] = 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" : f("editor.attachment.lost")), G = e.attrs.size || 0, K = jn(W), q = !U;
2902
2902
  x(() => {
2903
2903
  if (!c) {
2904
2904
  H(void 0), oe(!1);
2905
2905
  return;
2906
2906
  }
2907
- let e = En[K];
2907
+ let e = Dn[K];
2908
2908
  if (!e) {
2909
2909
  H(void 0), oe(!1);
2910
2910
  return;
2911
2911
  }
2912
2912
  let t = !0;
2913
- return H(void 0), oe(!1), Dn[e]().then((e) => {
2913
+ return H(void 0), oe(!1), On[e]().then((e) => {
2914
2914
  t && H(e);
2915
2915
  }).catch((n) => {
2916
2916
  console.error(`[attachment] renderer "${e}" load failed:`, n), t && oe(!0);
@@ -2919,17 +2919,17 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2919
2919
  };
2920
2920
  }, [c, K]);
2921
2921
  let se = C(() => ({
2922
- ...Tn,
2922
+ ...En,
2923
2923
  renderers: V ? [V] : [],
2924
2924
  rendererMode: "replace"
2925
2925
  }), [V]), ce = b((e) => {
2926
2926
  l((t) => {
2927
2927
  let n = typeof e == "function" ? e(t) : e;
2928
- return U && (n ? wn.add(U) : wn.delete(U)), n;
2928
+ return U && (n ? Tn.add(U) : Tn.delete(U)), n;
2929
2929
  });
2930
2930
  }, [U]);
2931
2931
  x(() => {
2932
- l(U ? wn.has(U) : !1);
2932
+ l(U ? Tn.has(U) : !1);
2933
2933
  }, [U]);
2934
2934
  let le = b(() => {
2935
2935
  I.current = !0, ce(!0), window.setTimeout(() => {
@@ -2954,7 +2954,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2954
2954
  };
2955
2955
  }, [z, le]), x(() => {
2956
2956
  let e = (e) => {
2957
- if (!(e.key !== "Backspace" && e.key !== "Delete") && o && i && !hn()) {
2957
+ if (!(e.key !== "Backspace" && e.key !== "Delete") && o && i && !gn()) {
2958
2958
  if (e.preventDefault(), e.stopPropagation(), a) {
2959
2959
  let { from: e, to: t } = a.state.selection;
2960
2960
  R.current = {
@@ -2971,7 +2971,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2971
2971
  a,
2972
2972
  o
2973
2973
  ]), x(() => {
2974
- if (!c || !Mn(U)) {
2974
+ if (!c || !Nn(U)) {
2975
2975
  d(null), y(null), N.current = null;
2976
2976
  return;
2977
2977
  }
@@ -2979,9 +2979,9 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2979
2979
  let e = new AbortController(), r = !0;
2980
2980
  return g(!0), y(null), (async () => {
2981
2981
  let i = U.includes("?X-Amz-"), a = null, o = null;
2982
- if (!a && !i && (a = await Pn(U, e.signal)), !a && !i) try {
2982
+ if (!a && !i && (a = await Fn(U, e.signal)), !a && !i) try {
2983
2983
  let n = await t(U);
2984
- n && (a = await Pn(n, e.signal) || await Fn(n, void 0, e.signal));
2984
+ n && (a = await Fn(n, e.signal) || await In(n, void 0, e.signal));
2985
2985
  } catch (e) {
2986
2986
  console.warn("[attachment] signPreviewUrl failed:", e);
2987
2987
  }
@@ -2993,7 +2993,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
2993
2993
  n[t] = e;
2994
2994
  });
2995
2995
  try {
2996
- a = await Fn(U, n, e.signal);
2996
+ a = await In(U, n, e.signal);
2997
2997
  } catch (e) {
2998
2998
  console.warn("[attachment] signed headers XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
2999
2999
  }
@@ -3002,7 +3002,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3002
3002
  console.warn("[attachment] signPreviewUrlHeaders failed:", e);
3003
3003
  }
3004
3004
  if (!a) try {
3005
- a = await Fn(U, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
3005
+ a = await In(U, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
3006
3006
  } catch (e) {
3007
3007
  console.warn("[attachment] plain XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
3008
3008
  }
@@ -3097,7 +3097,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3097
3097
  /* @__PURE__ */ D("path", { d: "M12 9v4" }),
3098
3098
  /* @__PURE__ */ D("path", { d: "M12 17h.01" })
3099
3099
  ]
3100
- }) : kn(W)
3100
+ }) : An(W)
3101
3101
  }), /* @__PURE__ */ O("div", {
3102
3102
  className: "att-meta",
3103
3103
  children: [/* @__PURE__ */ D("span", {
@@ -3105,7 +3105,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3105
3105
  children: W
3106
3106
  }), G > 0 && /* @__PURE__ */ D("span", {
3107
3107
  className: "att-size",
3108
- children: On(G)
3108
+ children: kn(G)
3109
3109
  })]
3110
3110
  })]
3111
3111
  }), /* @__PURE__ */ O("div", {
@@ -3158,7 +3158,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3158
3158
  }), /* @__PURE__ */ O("div", {
3159
3159
  className: "att-actions",
3160
3160
  children: [
3161
- U && jn(W) && /* @__PURE__ */ D("button", {
3161
+ U && Mn(W) && /* @__PURE__ */ D("button", {
3162
3162
  type: "button",
3163
3163
  className: "att-btn",
3164
3164
  onMouseDown: (e) => {
@@ -3211,7 +3211,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3211
3211
  type: "button",
3212
3212
  className: "att-btn att-btn--del",
3213
3213
  onClick: () => {
3214
- !o || hn() || ($(!0), ne(!0));
3214
+ !o || gn() || ($(!0), ne(!0));
3215
3215
  },
3216
3216
  title: f("editor.attachment.delete"),
3217
3217
  "aria-label": f("editor.attachment.delete"),
@@ -3267,7 +3267,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3267
3267
  style: { background: "#fff" },
3268
3268
  children: f("editor.attachment.loadingPreview")
3269
3269
  }),
3270
- children: u || p || U ? V ? /* @__PURE__ */ D(Cn, {
3270
+ children: u || p || U ? V ? /* @__PURE__ */ D(wn, {
3271
3271
  buffer: u || void 0,
3272
3272
  url: p || U,
3273
3273
  name: W,
@@ -3379,7 +3379,7 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3379
3379
  })]
3380
3380
  })]
3381
3381
  })]
3382
- }), /* @__PURE__ */ D(bn, {
3382
+ }), /* @__PURE__ */ D(xn, {
3383
3383
  open: te,
3384
3384
  title: "确认删除附件",
3385
3385
  message: q ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${W}),不可撤销。`,
@@ -3391,12 +3391,12 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3391
3391
  if (a) {
3392
3392
  let e = R.current, t = e?.from ?? a.state.selection.from, n = e?.to ?? a.state.selection.to, r = [];
3393
3393
  a.state.doc.nodesBetween(t, n, (e) => {
3394
- e.type.name === "attachmentEmbed" && e.attrs?.src && r.push(Ut(e.attrs.src));
3394
+ e.type.name === "attachmentEmbed" && e.attrs?.src && r.push(Wt(e.attrs.src));
3395
3395
  }), await Promise.all(r), $(!1), await new Promise((e) => setTimeout(e, 300)), a.chain().focus().setTextSelection({
3396
3396
  from: t,
3397
3397
  to: n
3398
3398
  }).deleteSelection().run();
3399
- } else await Ut(U), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3399
+ } else await Wt(U), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3400
3400
  } catch {
3401
3401
  $(!1);
3402
3402
  }
@@ -3406,13 +3406,13 @@ function In({ node: e, deleteNode: r, selected: i, editor: a }) {
3406
3406
  }
3407
3407
  //#endregion
3408
3408
  //#region src/editor/embeds/attachment.ts
3409
- var Ln = re.create({
3409
+ var Rn = re.create({
3410
3410
  name: "attachmentEmbed",
3411
3411
  group: "block",
3412
3412
  atom: !0,
3413
3413
  inline: !1,
3414
3414
  addNodeView() {
3415
- return I(In);
3415
+ return I(Ln);
3416
3416
  },
3417
3417
  addAttributes() {
3418
3418
  return {
@@ -3461,7 +3461,7 @@ var Ln = re.create({
3461
3461
  });
3462
3462
  //#endregion
3463
3463
  //#region src/editor/embeds/audio-view.tsx
3464
- function Rn({ node: e, deleteNode: t, editor: r }) {
3464
+ function zn({ node: e, deleteNode: t, editor: r }) {
3465
3465
  let i = e.attrs.src || "", a = e.attrs.name || i.split("/").pop()?.split("?")[0] || "audio", [o, s] = T(!1), c = r?.isEditable ?? !0;
3466
3466
  x(() => () => {
3467
3467
  i.startsWith("blob:") && URL.revokeObjectURL(i);
@@ -3527,7 +3527,7 @@ function Rn({ node: e, deleteNode: t, editor: r }) {
3527
3527
  type: "button",
3528
3528
  className: "audio-embed-btn audio-embed-btn--del",
3529
3529
  onClick: () => {
3530
- hn() || ($(!0), s(!0));
3530
+ gn() || ($(!0), s(!0));
3531
3531
  },
3532
3532
  title: "删除",
3533
3533
  children: /* @__PURE__ */ D("svg", {
@@ -3573,7 +3573,7 @@ function Rn({ node: e, deleteNode: t, editor: r }) {
3573
3573
  }), "音频文件缺失"]
3574
3574
  })
3575
3575
  })]
3576
- }), /* @__PURE__ */ D(bn, {
3576
+ }), /* @__PURE__ */ D(xn, {
3577
3577
  open: o,
3578
3578
  title: "确认删除音频",
3579
3579
  message: `此操作将同时删除对象存储中的文件(${a}),不可撤销。`,
@@ -3582,7 +3582,7 @@ function Rn({ node: e, deleteNode: t, editor: r }) {
3582
3582
  },
3583
3583
  onConfirm: async () => {
3584
3584
  try {
3585
- await Ut(i);
3585
+ await Wt(i);
3586
3586
  } catch {}
3587
3587
  $(!1), await new Promise((e) => setTimeout(e, 300)), t();
3588
3588
  }
@@ -3591,25 +3591,25 @@ function Rn({ node: e, deleteNode: t, editor: r }) {
3591
3591
  }
3592
3592
  //#endregion
3593
3593
  //#region src/editor/embeds/audio.ts
3594
- function zn(e) {
3594
+ function Bn(e) {
3595
3595
  return /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|$)/i.test(e) || /\/.*\.(mp3|wav|ogg|flac)/i.test(e);
3596
3596
  }
3597
- var Bn = re.create({
3597
+ var Vn = re.create({
3598
3598
  name: "audioEmbed",
3599
3599
  group: "block",
3600
3600
  atom: !0,
3601
3601
  inline: !1,
3602
3602
  addNodeView() {
3603
- return I(Rn);
3603
+ return I(zn);
3604
3604
  },
3605
3605
  addProseMirrorPlugins() {
3606
- return [new z({ props: { handlePaste(e, t) {
3606
+ return [new B({ props: { handlePaste(e, t) {
3607
3607
  let n = t.clipboardData?.getData("text/plain");
3608
3608
  if (!n) return !1;
3609
3609
  let r = n.split(/\r?\n/);
3610
3610
  for (let n of r) {
3611
3611
  let r = n.trim();
3612
- if (!r || r.includes(" ") || !zn(r)) continue;
3612
+ if (!r || r.includes(" ") || !Bn(r)) continue;
3613
3613
  t.preventDefault();
3614
3614
  let i = e.state.schema.nodes.audioEmbed.create({ src: r });
3615
3615
  return e.dispatch(e.state.tr.replaceSelectionWith(i)), !0;
@@ -3656,17 +3656,17 @@ var Bn = re.create({
3656
3656
  });
3657
3657
  //#endregion
3658
3658
  //#region src/editor/embeds/video-view.tsx
3659
- function Vn(e) {
3659
+ function Hn(e) {
3660
3660
  return e ? /bilibili\.com|BV[a-zA-Z0-9]{10}|av\d+/i.test(e) ? "bilibili" : /xiaohongshu\.com|xhslink\.com/i.test(e) ? "xiaohongshu" : /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|$)/i.test(e) || /\/.*\.(mp4|m3u8|mov|webm|flv|mkv)/i.test(e) ? "direct" : "unknown" : "unknown";
3661
3661
  }
3662
- function Hn(e) {
3662
+ function Un(e) {
3663
3663
  let t = e.match(/BV[a-zA-Z0-9]{10}/);
3664
3664
  if (t) return t[0];
3665
3665
  let n = e.match(/av(\d+)/i);
3666
3666
  return n ? n[0] : e;
3667
3667
  }
3668
- function Un({ node: e, deleteNode: t, editor: n }) {
3669
- let r = e.attrs.src || "", i = e.attrs.source || "unknown", a = i === "unknown" ? Vn(r) : i, [o, s] = T(!1), [c, l] = T(!1), [u, d] = T(!1), f = n?.isEditable ?? !0, p = !f && r.startsWith("blob:"), m = /* @__PURE__ */ D(bn, {
3668
+ function Wn({ node: e, deleteNode: t, editor: n }) {
3669
+ let r = e.attrs.src || "", i = e.attrs.source || "unknown", a = i === "unknown" ? Hn(r) : i, [o, s] = T(!1), [c, l] = T(!1), [u, d] = T(!1), f = n?.isEditable ?? !0, p = !f && r.startsWith("blob:"), m = /* @__PURE__ */ D(xn, {
3670
3670
  open: o,
3671
3671
  title: "确认删除视频",
3672
3672
  message: "此操作将同时删除对象存储中的文件,不可撤销。",
@@ -3675,7 +3675,7 @@ function Un({ node: e, deleteNode: t, editor: n }) {
3675
3675
  },
3676
3676
  onConfirm: async () => {
3677
3677
  try {
3678
- await Ut(r);
3678
+ await Wt(r);
3679
3679
  } catch {}
3680
3680
  $(!1), await new Promise((e) => setTimeout(e, 300)), t();
3681
3681
  }
@@ -3778,7 +3778,7 @@ function Un({ node: e, deleteNode: t, editor: n }) {
3778
3778
  }, [a, h]), x(() => {
3779
3779
  u && (_.current?.destroy(), _.current = null);
3780
3780
  }, [u]), a === "bilibili") {
3781
- let e = Hn(r);
3781
+ let e = Un(r);
3782
3782
  return /* @__PURE__ */ O(F, {
3783
3783
  as: "div",
3784
3784
  className: "video-embed video-embed--bilibili group/video",
@@ -3855,7 +3855,7 @@ function Un({ node: e, deleteNode: t, editor: n }) {
3855
3855
  className: "video-fs-btn video-fs-btn--del",
3856
3856
  title: "删除",
3857
3857
  onClick: () => {
3858
- hn() || ($(!0), s(!0));
3858
+ gn() || ($(!0), s(!0));
3859
3859
  },
3860
3860
  children: /* @__PURE__ */ D("svg", {
3861
3861
  width: "12",
@@ -3962,7 +3962,7 @@ function Un({ node: e, deleteNode: t, editor: n }) {
3962
3962
  className: "video-fs-btn video-fs-btn--del",
3963
3963
  title: "删除",
3964
3964
  onClick: () => {
3965
- hn() || ($(!0), s(!0));
3965
+ gn() || ($(!0), s(!0));
3966
3966
  },
3967
3967
  children: /* @__PURE__ */ D("svg", {
3968
3968
  width: "12",
@@ -4119,33 +4119,33 @@ function Un({ node: e, deleteNode: t, editor: n }) {
4119
4119
  }
4120
4120
  //#endregion
4121
4121
  //#region src/editor/embeds/video.ts
4122
- function Wn(e) {
4122
+ function Gn(e) {
4123
4123
  return /bilibili\.com|BV[a-zA-Z0-9]{10}|av\d+/i.test(e) ? "bilibili" : /xiaohongshu\.com|xhslink\.com/i.test(e) ? "xiaohongshu" : /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|$)/i.test(e) || /\/.*\.(mp4|m3u8|mov|webm|flv|mkv)/i.test(e) ? "direct" : "unknown";
4124
4124
  }
4125
- function Gn(e) {
4125
+ function Kn(e) {
4126
4126
  let t = e.match(/BV[a-zA-Z0-9]{10}/);
4127
4127
  if (t) return t[0];
4128
4128
  let n = e.match(/av(\d+)/i);
4129
4129
  return n ? n[0] : e;
4130
4130
  }
4131
- function Kn(e) {
4131
+ function qn(e) {
4132
4132
  let t = e.match(/explore\/([a-zA-Z0-9]+)/);
4133
4133
  return t ? t[1] : e;
4134
4134
  }
4135
- var qn = re.create({
4135
+ var Jn = re.create({
4136
4136
  name: "videoEmbed",
4137
4137
  group: "block",
4138
4138
  atom: !0,
4139
4139
  inline: !1,
4140
4140
  addNodeView() {
4141
- return I(Un);
4141
+ return I(Wn);
4142
4142
  },
4143
4143
  addProseMirrorPlugins() {
4144
- return [new z({ props: {
4144
+ return [new B({ props: {
4145
4145
  handleKeyDown(e, t) {
4146
4146
  if (t.key !== " ") return !1;
4147
4147
  let n = e.state.selection;
4148
- if (n instanceof ie && n.node.type.name === "videoEmbed") {
4148
+ if (n instanceof z && n.node.type.name === "videoEmbed") {
4149
4149
  t.preventDefault();
4150
4150
  let r = e.nodeDOM(n.from);
4151
4151
  if (r) {
@@ -4163,7 +4163,7 @@ var qn = re.create({
4163
4163
  for (let n of r) {
4164
4164
  let r = n.trim();
4165
4165
  if (!r || r.includes(" ")) continue;
4166
- let i = Wn(r);
4166
+ let i = Gn(r);
4167
4167
  if (i === "unknown") continue;
4168
4168
  t.preventDefault();
4169
4169
  let a = e.state.schema.nodes.videoEmbed.create({
@@ -4195,7 +4195,7 @@ var qn = re.create({
4195
4195
  let t = e, n = t.getAttribute("src") || t.getAttribute("data-src") || "";
4196
4196
  return {
4197
4197
  src: n,
4198
- source: Wn(n)
4198
+ source: Gn(n)
4199
4199
  };
4200
4200
  }
4201
4201
  },
@@ -4204,9 +4204,9 @@ var qn = re.create({
4204
4204
  ];
4205
4205
  },
4206
4206
  renderHTML({ HTMLAttributes: e }) {
4207
- let t = e.src || "", n = Wn(t);
4207
+ let t = e.src || "", n = Gn(t);
4208
4208
  if (n === "bilibili") {
4209
- let e = Gn(t);
4209
+ let e = Kn(t);
4210
4210
  return [
4211
4211
  "div",
4212
4212
  {
@@ -4227,7 +4227,7 @@ var qn = re.create({
4227
4227
  }]
4228
4228
  ];
4229
4229
  }
4230
- if (n === "xiaohongshu") return Kn(t), [
4230
+ if (n === "xiaohongshu") return qn(t), [
4231
4231
  "div",
4232
4232
  {
4233
4233
  "data-video-embed": "xiaohongshu",
@@ -4279,7 +4279,7 @@ var qn = re.create({
4279
4279
  },
4280
4280
  addCommands() {
4281
4281
  return { insertVideo: (e) => ({ chain: t }) => {
4282
- let n = Wn(e.src);
4282
+ let n = Gn(e.src);
4283
4283
  return t().insertContent({
4284
4284
  type: this.name,
4285
4285
  attrs: {
@@ -4289,13 +4289,13 @@ var qn = re.create({
4289
4289
  }).focus().run();
4290
4290
  } };
4291
4291
  }
4292
- }), Jn = null;
4293
- async function Yn(e) {
4294
- Jn ||= await import("beautiful-mermaid");
4295
- let t = Jn.renderMermaidSVG;
4292
+ }), Yn = null;
4293
+ async function Xn(e) {
4294
+ Yn ||= await import("beautiful-mermaid");
4295
+ let t = Yn.renderMermaidSVG;
4296
4296
  return t(e);
4297
4297
  }
4298
- var Xn = [
4298
+ var Zn = [
4299
4299
  {
4300
4300
  value: "javascript",
4301
4301
  label: "JavaScript",
@@ -4456,7 +4456,7 @@ var Xn = [
4456
4456
  label: "Plain Text",
4457
4457
  color: "#6b7280"
4458
4458
  }
4459
- ], Zn = {
4459
+ ], Qn = {
4460
4460
  javascript: "js",
4461
4461
  typescript: "ts",
4462
4462
  python: "py",
@@ -4482,7 +4482,7 @@ var Xn = [
4482
4482
  txt: "txt",
4483
4483
  vue: "vue",
4484
4484
  react: "jsx"
4485
- }, Qn = {
4485
+ }, $n = {
4486
4486
  js: "javascript",
4487
4487
  ts: "typescript",
4488
4488
  py: "python",
@@ -4498,12 +4498,12 @@ var Xn = [
4498
4498
  jsx: "javascript",
4499
4499
  tsx: "typescript"
4500
4500
  };
4501
- function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
4501
+ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
4502
4502
  let o = n?.isEditable ?? !0, s = !o, [c, l] = T(!1), [u, d] = T(!1), [f, m] = T(!1), [h, g] = T(!1), [_, v] = T(220), [y, S] = T({
4503
4503
  top: 0,
4504
4504
  left: 0,
4505
4505
  width: 210
4506
- }), [k, A] = T(""), [j, M] = T(!1), [N, P] = T(null), [F, I] = T(null), [L, ee] = T(!1), te = w(null), R = w(null), re = w(null), ie = w(null), z = w(null), B = w(null), V = e.attrs.language || "", H = Xn.find((e) => e.value === (Qn[V] ?? V)), ae = V === "mermaid", oe = b(() => {
4506
+ }), [k, A] = T(""), [j, M] = T(!1), [N, P] = T(null), [F, I] = T(null), [L, ee] = T(!1), te = w(null), R = w(null), re = w(null), ie = w(null), z = w(null), B = w(null), V = e.attrs.language || "", H = Zn.find((e) => e.value === ($n[V] ?? V)), ae = V === "mermaid", oe = b(() => {
4507
4507
  if (!n || typeof r != "function") return null;
4508
4508
  let t = r();
4509
4509
  return typeof t == "number" ? {
@@ -4515,10 +4515,10 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4515
4515
  r,
4516
4516
  e.nodeSize
4517
4517
  ]), U = b(() => {
4518
- o && (hn() || (B.current = oe(), window.getSelection()?.removeAllRanges(), $(!0), M(!0)));
4518
+ o && (gn() || (B.current = oe(), window.getSelection()?.removeAllRanges(), $(!0), M(!0)));
4519
4519
  }, [oe, o]), W = C(() => {
4520
4520
  let e = k.trim().toLowerCase();
4521
- return e ? Xn.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : Xn;
4521
+ return e ? Zn.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : Zn;
4522
4522
  }, [k]);
4523
4523
  x(() => {
4524
4524
  (z.current?.parentElement?.querySelector(".cb-code-area"))?.classList.toggle("cb-code-area--collapsed", u);
@@ -4526,7 +4526,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4526
4526
  let G = b(() => {
4527
4527
  let e = re.current;
4528
4528
  if (!e) return;
4529
- let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a = Xn.length * 31 + 8, o = r - 52, s = i - 52;
4529
+ let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a = Zn.length * 31 + 8, o = r - 52, s = i - 52;
4530
4530
  o < 220 && s > o ? (g(!0), v(Math.max(120, Math.min(a, s))), S({
4531
4531
  top: t.top,
4532
4532
  left: n,
@@ -4559,7 +4559,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4559
4559
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
4560
4560
  }, [f]), x(() => {
4561
4561
  let e = (e) => {
4562
- if (!(e.key !== "Backspace" && e.key !== "Delete") && o && a && !hn()) {
4562
+ if (!(e.key !== "Backspace" && e.key !== "Delete") && o && a && !gn()) {
4563
4563
  if (e.preventDefault(), e.stopPropagation(), n) {
4564
4564
  let { from: e, to: t } = n.state.selection;
4565
4565
  B.current = {
@@ -4601,7 +4601,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4601
4601
  };
4602
4602
  navigator.clipboard?.writeText ? navigator.clipboard.writeText(t).catch(() => n(t)) : n(t), l(!0), setTimeout(() => l(!1), 1500);
4603
4603
  }, [e.textContent]), ce = b(() => {
4604
- let t = Zn[V] || "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");
4604
+ let t = Qn[V] || "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");
4605
4605
  a.href = i, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
4606
4606
  }, [e.textContent, V]), le = b(async () => {
4607
4607
  if (N || L) {
@@ -4615,7 +4615,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4615
4615
  I("代码块内容为空");
4616
4616
  return;
4617
4617
  }
4618
- let n = p(await Yn(t));
4618
+ let n = p(await Xn(t));
4619
4619
  P(n);
4620
4620
  } catch (e) {
4621
4621
  I(e instanceof Error ? e.message : "Mermaid 渲染失败");
@@ -4900,7 +4900,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4900
4900
  })
4901
4901
  ]
4902
4902
  }),
4903
- /* @__PURE__ */ D(bn, {
4903
+ /* @__PURE__ */ D(xn, {
4904
4904
  open: j,
4905
4905
  title: "确认删除代码块",
4906
4906
  message: "此操作不可撤销。",
@@ -4916,7 +4916,7 @@ function $n({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4916
4916
  }
4917
4917
  //#endregion
4918
4918
  //#region src/editor/extensions/code-block.ts
4919
- var er = [
4919
+ var tr = [
4920
4920
  {
4921
4921
  value: "javascript",
4922
4922
  label: "JavaScript"
@@ -5017,12 +5017,12 @@ var er = [
5017
5017
  value: "mermaid",
5018
5018
  label: "Mermaid"
5019
5019
  }
5020
- ], tr = xe(be);
5021
- tr.register({ dockerfile: ye }), tr.registerAlias("xml", ["vue", "html"]), tr.registerAlias("javascript", ["react", "jsx"]), tr.registerAlias("typescript", ["tsx"]);
5022
- function nr(e) {
5020
+ ], nr = Se(xe);
5021
+ nr.register({ dockerfile: be }), nr.registerAlias("xml", ["vue", "html"]), nr.registerAlias("javascript", ["react", "jsx"]), nr.registerAlias("typescript", ["tsx"]);
5022
+ function rr(e) {
5023
5023
  return e ? e.split("\n") : [""];
5024
5024
  }
5025
- function rr(e, t) {
5025
+ function ir(e, t) {
5026
5026
  if (e.childElementCount !== t) {
5027
5027
  e.replaceChildren();
5028
5028
  for (let n = 1; n <= t; n++) {
@@ -5031,14 +5031,14 @@ function rr(e, t) {
5031
5031
  }
5032
5032
  }
5033
5033
  }
5034
- function ir(e, t) {
5034
+ function ar(e, t) {
5035
5035
  e.replaceChildren();
5036
5036
  for (let n of t) {
5037
5037
  let t = document.createElement("span");
5038
5038
  t.className = "cb-mirror-line", t.textContent = n.length ? n : "\xA0", e.appendChild(t);
5039
5039
  }
5040
5040
  }
5041
- function ar(e, t, n) {
5041
+ function or(e, t, n) {
5042
5042
  let r = getComputedStyle(e), i = parseFloat(r.paddingLeft), a = parseFloat(r.paddingRight);
5043
5043
  t.style.boxSizing = "content-box", t.style.width = `${Math.max(0, e.clientWidth - i - a)}px`, t.style.padding = r.padding;
5044
5044
  let o = getComputedStyle(n);
@@ -5085,7 +5085,7 @@ function ar(e, t, n) {
5085
5085
  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;
5086
5086
  }
5087
5087
  }
5088
- var or = ve.extend({
5088
+ var sr = ye.extend({
5089
5089
  addNodeView() {
5090
5090
  return (e) => {
5091
5091
  let { node: t, editor: n, getPos: r } = e, i = t, a = (e) => {
@@ -5111,9 +5111,9 @@ var or = ve.extend({
5111
5111
  d.appendChild(f);
5112
5112
  let p = document.createElement("div");
5113
5113
  p.className = "cb-code-mirror", p.contentEditable = "false", p.setAttribute("aria-hidden", "true"), l.appendChild(u), l.appendChild(d), l.appendChild(p), s.appendChild(l);
5114
- let m = nr(t.textContent);
5115
- rr(u, m.length), ir(p, m);
5116
- let h = new L($n, {
5114
+ let m = rr(t.textContent);
5115
+ ir(u, m.length), ar(p, m);
5116
+ let h = new L(er, {
5117
5117
  editor: n,
5118
5118
  props: {
5119
5119
  node: t,
@@ -5126,12 +5126,12 @@ var or = ve.extend({
5126
5126
  });
5127
5127
  c.appendChild(h.element);
5128
5128
  let g = (e) => {
5129
- let t = nr(e.textContent);
5130
- rr(u, t.length), ir(p, t), requestAnimationFrame(() => ar(d, p, u));
5129
+ let t = rr(e.textContent);
5130
+ ir(u, t.length), ar(p, t), requestAnimationFrame(() => or(d, p, u));
5131
5131
  };
5132
- requestAnimationFrame(() => ar(d, p, u));
5133
- let _ = new ResizeObserver(() => ar(d, p, u));
5134
- return _.observe(d), document.fonts?.ready?.then(() => ar(d, p, u)), {
5132
+ requestAnimationFrame(() => or(d, p, u));
5133
+ let _ = new ResizeObserver(() => or(d, p, u));
5134
+ return _.observe(d), document.fonts?.ready?.then(() => or(d, p, u)), {
5135
5135
  dom: s,
5136
5136
  contentDOM: f,
5137
5137
  update(e) {
@@ -5191,10 +5191,10 @@ var or = ve.extend({
5191
5191
  }
5192
5192
  }));
5193
5193
  }
5194
- }).configure({ lowlight: tr });
5194
+ }).configure({ lowlight: nr });
5195
5195
  //#endregion
5196
5196
  //#region src/editor/utils/import-choice-dialog.ts
5197
- function sr(e) {
5197
+ function cr(e) {
5198
5198
  return new Promise((t) => {
5199
5199
  let n = document.createElement("div");
5200
5200
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -5224,16 +5224,16 @@ function sr(e) {
5224
5224
  }
5225
5225
  //#endregion
5226
5226
  //#region src/editor/utils/local-media.ts
5227
- var cr = /\.(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, lr = /^(?:mailto:|tel:|javascript:|about:|data:|blob:)/i;
5228
- function ur(e) {
5227
+ var lr = /\.(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, ur = /^(?:mailto:|tel:|javascript:|about:|data:|blob:)/i;
5228
+ function dr(e) {
5229
5229
  if (!e) return !1;
5230
5230
  let t = e.trim();
5231
- return !(!t || /^(?:https?:)?\/\//i.test(t) || lr.test(t) || t.startsWith("#"));
5232
- }
5233
- function dr(e) {
5234
- return cr.test(e);
5231
+ return !(!t || /^(?:https?:)?\/\//i.test(t) || ur.test(t) || t.startsWith("#"));
5235
5232
  }
5236
5233
  function fr(e) {
5234
+ return lr.test(e);
5235
+ }
5236
+ function pr(e) {
5237
5237
  let t = e.trim();
5238
5238
  t = t.replace(/^(?:file|app):\/\/(?:localhost)?/i, "");
5239
5239
  try {
@@ -5241,26 +5241,26 @@ function fr(e) {
5241
5241
  } catch {}
5242
5242
  return t = t.replace(/\\/g, "/"), t = t.replace(/^\.\//, ""), t = t.replace(/^\/+/, ""), t = t.replace(/^[a-zA-Z]:\//, ""), t;
5243
5243
  }
5244
- function pr(e) {
5245
- let t = fr(e), n = t.split("/").filter(Boolean);
5244
+ function mr(e) {
5245
+ let t = pr(e), n = t.split("/").filter(Boolean);
5246
5246
  return (n[n.length - 1] || t).toLowerCase();
5247
5247
  }
5248
- function mr() {
5248
+ function hr() {
5249
5249
  return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showDirectoryPicker == "function";
5250
5250
  }
5251
- async function hr() {
5252
- if (!mr()) return null;
5251
+ async function gr() {
5252
+ if (!hr()) return null;
5253
5253
  try {
5254
5254
  return await window.showDirectoryPicker.call(window, { mode: "read" }) ?? null;
5255
5255
  } catch {
5256
5256
  return null;
5257
5257
  }
5258
5258
  }
5259
- function gr() {
5259
+ function _r() {
5260
5260
  return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showOpenFilePicker == "function";
5261
5261
  }
5262
- async function _r() {
5263
- if (!gr()) return null;
5262
+ async function vr() {
5263
+ if (!_r()) return null;
5264
5264
  try {
5265
5265
  let e = await window.showOpenFilePicker.call(window, { multiple: !0 });
5266
5266
  return await Promise.all(e.map((e) => e.getFile()));
@@ -5268,7 +5268,7 @@ async function _r() {
5268
5268
  return null;
5269
5269
  }
5270
5270
  }
5271
- async function vr(e, t) {
5271
+ async function yr(e, t) {
5272
5272
  if (t.length === 0) return { file: null };
5273
5273
  let n = e;
5274
5274
  for (let e = 0; e < t.length - 1; e++) try {
@@ -5290,7 +5290,7 @@ async function vr(e, t) {
5290
5290
  return { file: null };
5291
5291
  }
5292
5292
  }
5293
- async function yr(e, t, n = 5e3) {
5293
+ async function br(e, t, n = 5e3) {
5294
5294
  let r = t.toLowerCase(), i = [e], a = 0, o;
5295
5295
  for (; i.length > 0 && a < n;) {
5296
5296
  let e = i.pop();
@@ -5312,37 +5312,37 @@ async function yr(e, t, n = 5e3) {
5312
5312
  readError: o
5313
5313
  };
5314
5314
  }
5315
- async function br(e, t) {
5316
- let n = fr(t).split("/").filter(Boolean);
5315
+ async function xr(e, t) {
5316
+ let n = pr(t).split("/").filter(Boolean);
5317
5317
  if (n.length === 0) return { file: null };
5318
5318
  let r;
5319
5319
  for (let t = 0; t < n.length; t++) {
5320
- let i = await vr(e, n.slice(t));
5320
+ let i = await yr(e, n.slice(t));
5321
5321
  if (i.file) return i;
5322
5322
  i.readError && (r = i.readError);
5323
5323
  }
5324
- let i = await yr(e, n[n.length - 1]);
5324
+ let i = await br(e, n[n.length - 1]);
5325
5325
  return i.file || i.readError ? i : {
5326
5326
  file: null,
5327
5327
  readError: r
5328
5328
  };
5329
5329
  }
5330
- var xr = {
5330
+ var Sr = {
5331
5331
  image: "image",
5332
5332
  videoEmbed: "video",
5333
5333
  audioEmbed: "audio",
5334
5334
  attachmentEmbed: "attachment"
5335
5335
  };
5336
- function Sr(e, t) {
5336
+ function Cr(e, t) {
5337
5337
  let n = /* @__PURE__ */ new Set(), r = [];
5338
5338
  return e.descendants((e) => {
5339
- let i = xr[e.type?.name];
5339
+ let i = Sr[e.type?.name];
5340
5340
  if (i) {
5341
5341
  let a = e.attrs?.src, o = `node:${a}`;
5342
- typeof a == "string" && ur(a) && !n.has(o) && !t?.(a) && (n.add(o), r.push({
5342
+ typeof a == "string" && dr(a) && !n.has(o) && !t?.(a) && (n.add(o), r.push({
5343
5343
  src: a,
5344
- normalized: fr(a),
5345
- basename: pr(a),
5344
+ normalized: pr(a),
5345
+ basename: mr(a),
5346
5346
  kind: i,
5347
5347
  isLink: !1
5348
5348
  }));
@@ -5351,17 +5351,17 @@ function Sr(e, t) {
5351
5351
  if (e.isText && e.marks) for (let i of e.marks) {
5352
5352
  if (i.type.name !== "link") continue;
5353
5353
  let e = i.attrs?.href, a = `link:${e}`;
5354
- typeof e == "string" && ur(e) && dr(e) && !n.has(a) && !t?.(e) && (n.add(a), r.push({
5354
+ typeof e == "string" && dr(e) && fr(e) && !n.has(a) && !t?.(e) && (n.add(a), r.push({
5355
5355
  src: e,
5356
- normalized: fr(e),
5357
- basename: pr(e),
5356
+ normalized: pr(e),
5357
+ basename: mr(e),
5358
5358
  kind: "attachment",
5359
5359
  isLink: !0
5360
5360
  }));
5361
5361
  }
5362
5362
  }), r;
5363
5363
  }
5364
- function Cr(e, t, n) {
5364
+ function wr(e, t, n) {
5365
5365
  let r = t ? `${e}\n${t}` : e;
5366
5366
  if (!r) return !1;
5367
5367
  let i = [];
@@ -5369,28 +5369,28 @@ function Cr(e, t, n) {
5369
5369
  for (let e of r.matchAll(/!?\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g)) i.push(e[1]);
5370
5370
  for (let e of r.matchAll(/<(?:img|video|audio|source)[^>]*\bsrc=["']([^"']+)["']/gi)) i.push(e[1]);
5371
5371
  for (let e of r.matchAll(/<a[^>]*\bhref=["']([^"']+)["']/gi)) i.push(e[1]);
5372
- return i.some((e) => dr(e) && ur(e) && !n?.(e));
5372
+ return i.some((e) => fr(e) && dr(e) && !n?.(e));
5373
5373
  }
5374
5374
  //#endregion
5375
5375
  //#region src/editor/extensions/image-upload.ts
5376
- function wr(e) {
5376
+ function Tr(e) {
5377
5377
  if (e.type.startsWith("image/")) return "image";
5378
5378
  if (e.type.startsWith("video/")) return "video";
5379
5379
  if (e.type.startsWith("audio/")) return "audio";
5380
5380
  let t = e.name.split(".").pop()?.toLowerCase() || "";
5381
5381
  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";
5382
5382
  }
5383
- function Tr(e) {
5383
+ function Er(e) {
5384
5384
  let t = e.name.split(".").pop()?.toLowerCase() || "";
5385
5385
  return t === "md" || t === "markdown";
5386
5386
  }
5387
- async function Er(e, t, n, r) {
5388
- let i = n ?? e.state.selection.from, a = r ? un(r) : void 0, o = r?.storage?.qingwuUI, s = await new Promise((e) => {
5389
- o?.chooseMd ? o.chooseMd(t.name, e) : sr(t.name).then(e);
5387
+ async function Dr(e, t, n, r) {
5388
+ let i = n ?? e.state.selection.from, a = r ? dn(r) : void 0, o = r?.storage?.qingwuUI, s = await new Promise((e) => {
5389
+ o?.chooseMd ? o.chooseMd(t.name, e) : cr(t.name).then(e);
5390
5390
  });
5391
5391
  if (s === null) return;
5392
5392
  if (s === "attach") {
5393
- let n = a ? dn(e.state.doc, t, a) : null;
5393
+ let n = a ? fn(e.state.doc, t, a) : null;
5394
5394
  if (n) {
5395
5395
  Z(n);
5396
5396
  return;
@@ -5421,8 +5421,8 @@ async function Er(e, t, n, r) {
5421
5421
  e.dispatch(e.state.tr.insert(i, t.from(u)));
5422
5422
  }
5423
5423
  }
5424
- function Dr(e, t, n) {
5425
- switch (wr(t)) {
5424
+ function Or(e, t, n) {
5425
+ switch (Tr(t)) {
5426
5426
  case "image": return e.nodes.image?.create({
5427
5427
  src: n,
5428
5428
  alt: t.name
@@ -5448,7 +5448,7 @@ function Dr(e, t, n) {
5448
5448
  }
5449
5449
  }
5450
5450
  }
5451
- async function Or(e, t, n) {
5451
+ async function kr(e, t, n) {
5452
5452
  let r;
5453
5453
  try {
5454
5454
  r = o();
@@ -5467,13 +5467,13 @@ async function Or(e, t, n) {
5467
5467
  return console.error(`${t.type} upload failed:`, e), URL.revokeObjectURL(n), null;
5468
5468
  }
5469
5469
  }
5470
- async function kr(e, t, n, r) {
5471
- let i = r ? un(r) : void 0, a = i ? dn(e.state.doc, t, i) : null;
5470
+ async function Ar(e, t, n, r) {
5471
+ let i = r ? dn(r) : void 0, a = i ? fn(e.state.doc, t, i) : null;
5472
5472
  if (a) {
5473
5473
  Z(a);
5474
5474
  return;
5475
5475
  }
5476
- let o = URL.createObjectURL(t), s = Dr(e.state.schema, t, o);
5476
+ let o = URL.createObjectURL(t), s = Or(e.state.schema, t, o);
5477
5477
  if (!s) return;
5478
5478
  let c = n ?? e.state.selection.from;
5479
5479
  try {
@@ -5481,9 +5481,9 @@ async function kr(e, t, n, r) {
5481
5481
  } catch {
5482
5482
  return;
5483
5483
  }
5484
- await Or(e, t, o);
5484
+ await kr(e, t, o);
5485
5485
  }
5486
- var Ar = R.create({
5486
+ var jr = R.create({
5487
5487
  name: "imageUpload",
5488
5488
  addOptions() {
5489
5489
  return {
@@ -5493,8 +5493,8 @@ var Ar = R.create({
5493
5493
  },
5494
5494
  addProseMirrorPlugins() {
5495
5495
  let e = this.editor;
5496
- return [new z({
5497
- key: new B("imageUpload"),
5496
+ return [new B({
5497
+ key: new V("imageUpload"),
5498
5498
  props: {
5499
5499
  handleDrop(t, n) {
5500
5500
  let r = n.dataTransfer?.files;
@@ -5504,23 +5504,23 @@ var Ar = R.create({
5504
5504
  left: n.clientX,
5505
5505
  top: n.clientY
5506
5506
  });
5507
- for (let n of Array.from(r)) Tr(n) ? Er(t, n, i?.pos, e) : kr(t, n, i?.pos, e);
5507
+ for (let n of Array.from(r)) Er(n) ? Dr(t, n, i?.pos, e) : Ar(t, n, i?.pos, e);
5508
5508
  return !0;
5509
5509
  },
5510
5510
  handlePaste(t, n) {
5511
5511
  let r = n.clipboardData?.items;
5512
5512
  if (!r) return !1;
5513
5513
  let i = n.clipboardData?.getData("text/plain") || "";
5514
- if ((n.clipboardData?.files?.length ?? 0) > 0 && Cr(i, void 0, a())) return !1;
5514
+ if ((n.clipboardData?.files?.length ?? 0) > 0 && wr(i, void 0, a())) return !1;
5515
5515
  for (let i of Array.from(r)) {
5516
5516
  if (i.type.startsWith("image/") || i.type.startsWith("video/") || i.type.startsWith("audio/")) {
5517
5517
  n.preventDefault();
5518
5518
  let r = i.getAsFile();
5519
- return r && wr(r) !== "file" && kr(t, r, void 0, e), !0;
5519
+ return r && Tr(r) !== "file" && Ar(t, r, void 0, e), !0;
5520
5520
  }
5521
5521
  if (i.kind === "file") {
5522
5522
  let r = i.getAsFile();
5523
- if (r && Tr(r)) return n.preventDefault(), Er(t, r, void 0, e), !0;
5523
+ if (r && Er(r)) return n.preventDefault(), Dr(t, r, void 0, e), !0;
5524
5524
  }
5525
5525
  }
5526
5526
  return !1;
@@ -5528,12 +5528,12 @@ var Ar = R.create({
5528
5528
  }
5529
5529
  })];
5530
5530
  }
5531
- }), jr = 100, Mr = R.create({
5531
+ }), Mr = 100, Nr = R.create({
5532
5532
  name: "imeCommitSpaceGuard",
5533
5533
  addProseMirrorPlugins() {
5534
5534
  let e = 0;
5535
- return [new z({
5536
- key: new B("imeCommitSpaceGuard"),
5535
+ return [new B({
5536
+ key: new V("imeCommitSpaceGuard"),
5537
5537
  props: { handleDOMEvents: {
5538
5538
  compositionend() {
5539
5539
  return e = performance.now(), !1;
@@ -5543,30 +5543,39 @@ var Ar = R.create({
5543
5543
  },
5544
5544
  beforeinput(t, n) {
5545
5545
  let r = n;
5546
- return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > jr ? !1 : (r.preventDefault(), !0);
5546
+ return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > Mr ? !1 : (r.preventDefault(), !0);
5547
5547
  }
5548
5548
  } }
5549
5549
  })];
5550
5550
  }
5551
- }), Nr = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, Pr = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, Fr = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
5552
- function Ir(e) {
5551
+ }), Pr = R.create({
5552
+ name: "inlineCodeEnd",
5553
+ addInputRules() {
5554
+ let e = this.editor.schema.marks.code;
5555
+ return e ? [ie({
5556
+ find: /`([^`]+)`$/,
5557
+ type: e
5558
+ })] : [];
5559
+ }
5560
+ }), Fr = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, Ir = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, Lr = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
5561
+ function Rr(e) {
5553
5562
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
5554
5563
  }
5555
- function Lr(e) {
5564
+ function zr(e) {
5556
5565
  let t = e.trim().replace(/\\/g, "/");
5557
5566
  return t.split("/").pop() || t;
5558
5567
  }
5559
- function Rr(e, t) {
5568
+ function Br(e, t) {
5560
5569
  let n = e.src.slice(e.pos), r = /^!\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !0;
5561
5570
  if (r || (r = /^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !1), !r) return !1;
5562
5571
  let a = r[1].trim(), o = r[2]?.trim();
5563
5572
  if (!t) {
5564
- let t = o || Lr(a);
5573
+ let t = o || zr(a);
5565
5574
  if (i) {
5566
5575
  let n = "";
5567
- if (Nr.test(a) || /^data:image\//i.test(a)) n = `<img src="${Ir(a)}" alt="${Ir(t)}">`;
5568
- else if (Pr.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${Ir(a)}"></div>`;
5569
- else if (Fr.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${Ir(a)}"></audio>`;
5576
+ if (Fr.test(a) || /^data:image\//i.test(a)) n = `<img src="${Rr(a)}" alt="${Rr(t)}">`;
5577
+ else if (Ir.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${Rr(a)}"></div>`;
5578
+ else if (Lr.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${Rr(a)}"></audio>`;
5570
5579
  else {
5571
5580
  let n = e.push("link_open", "a", 1);
5572
5581
  n.attrs = [["href", a]];
@@ -5584,14 +5593,14 @@ function Rr(e, t) {
5584
5593
  }
5585
5594
  return e.pos += r[0].length, !0;
5586
5595
  }
5587
- var zr = R.create({
5596
+ var Vr = R.create({
5588
5597
  name: "obsidianMarkdown",
5589
5598
  addStorage() {
5590
5599
  return { markdown: { parse: { setup(e) {
5591
- e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", Rr));
5600
+ e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", Br));
5592
5601
  } } } };
5593
5602
  }
5594
- }), Br = R.create({
5603
+ }), Hr = R.create({
5595
5604
  name: "qingwuUI",
5596
5605
  addStorage() {
5597
5606
  return {};
@@ -5599,7 +5608,7 @@ var zr = R.create({
5599
5608
  });
5600
5609
  //#endregion
5601
5610
  //#region src/editor/utils/render-probe.ts
5602
- function Vr(e, t) {
5611
+ function Ur(e, t) {
5603
5612
  return new Promise((n) => {
5604
5613
  if (typeof Image != "function") return n(!0);
5605
5614
  let r = new Image(), i = !1, a = setTimeout(() => o(!1), t), o = (e) => {
@@ -5608,14 +5617,14 @@ function Vr(e, t) {
5608
5617
  r.onload = () => o(!0), r.onerror = () => o(!1), r.src = e;
5609
5618
  });
5610
5619
  }
5611
- async function Hr(e, t = 8e3) {
5612
- if (await Vr(e, t)) return !0;
5620
+ async function Wr(e, t = 8e3) {
5621
+ if (await Ur(e, t)) return !0;
5613
5622
  try {
5614
5623
  let r = await n(e);
5615
5624
  if (!r) return !1;
5616
5625
  let i = await fetch(e, { headers: r });
5617
5626
  if (!i.ok) return !1;
5618
- let a = URL.createObjectURL(await i.blob()), o = await Vr(a, t);
5627
+ let a = URL.createObjectURL(await i.blob()), o = await Ur(a, t);
5619
5628
  return URL.revokeObjectURL(a), o;
5620
5629
  } catch {
5621
5630
  return !1;
@@ -5623,7 +5632,7 @@ async function Hr(e, t = 8e3) {
5623
5632
  }
5624
5633
  //#endregion
5625
5634
  //#region src/editor/utils/resolve-local-media.ts
5626
- function Ur() {
5635
+ function Gr() {
5627
5636
  return {
5628
5637
  uploaded: 0,
5629
5638
  sessionOnly: 0,
@@ -5633,10 +5642,10 @@ function Ur() {
5633
5642
  readFailed: []
5634
5643
  };
5635
5644
  }
5636
- function Wr(e, t) {
5645
+ function Kr(e, t) {
5637
5646
  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);
5638
5647
  }
5639
- function Gr(e, t, n, r) {
5648
+ function qr(e, t, n, r) {
5640
5649
  let { state: i } = e, a = [];
5641
5650
  if (i.doc.descendants((e, n) => {
5642
5651
  e.attrs?.src === t && a.push(n);
@@ -5652,7 +5661,7 @@ function Gr(e, t, n, r) {
5652
5661
  }
5653
5662
  return e.dispatch(o), !0;
5654
5663
  }
5655
- function Kr(e, t, n) {
5664
+ function Jr(e, t, n) {
5656
5665
  let { state: r } = e, i = r.schema.marks.link;
5657
5666
  if (!i) return !1;
5658
5667
  let a = [];
@@ -5670,7 +5679,7 @@ function Kr(e, t, n) {
5670
5679
  }));
5671
5680
  return e.dispatch(o), !0;
5672
5681
  }
5673
- function qr(e) {
5682
+ function Yr(e) {
5674
5683
  let t = /* @__PURE__ */ new Map();
5675
5684
  for (let n of e) {
5676
5685
  let e = t.get(n.normalized);
@@ -5678,36 +5687,36 @@ function qr(e) {
5678
5687
  }
5679
5688
  return Array.from(t.values());
5680
5689
  }
5681
- async function Jr(e, t, n, r) {
5690
+ async function Xr(e, t, n, r) {
5682
5691
  if (n.length === 0) return "sessionOnly";
5683
- let i = n[0], a = un(t);
5692
+ let i = n[0], a = dn(t);
5684
5693
  if (a) {
5685
- let t = dn(e.state.doc, r, a);
5694
+ let t = fn(e.state.doc, r, a);
5686
5695
  if (t) return Z(`${i.basename}:${t}`, "error"), "limitRejected";
5687
5696
  }
5688
5697
  let s = n.filter((e) => !e.isLink), c = n.filter((e) => e.isLink);
5689
5698
  if (s.length === 0) try {
5690
5699
  let t = await o().upload(r, "editor"), n = !1;
5691
- for (let r of c) Kr(e, r.src, t) && (n = !0);
5700
+ for (let r of c) Jr(e, r.src, t) && (n = !0);
5692
5701
  return n ? "uploaded" : "sessionOnly";
5693
5702
  } catch (e) {
5694
5703
  return console.error(`本地附件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), "sessionOnly";
5695
5704
  }
5696
5705
  let l = URL.createObjectURL(r), u = !1;
5697
- for (let t of s) Gr(e, t.src, l, r.size) && (u = !0);
5706
+ for (let t of s) qr(e, t.src, l, r.size) && (u = !0);
5698
5707
  let d;
5699
5708
  try {
5700
5709
  d = await o().upload(r, "editor");
5701
5710
  } catch (e) {
5702
5711
  return console.error(`本地文件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), URL.revokeObjectURL(l), "sessionOnly";
5703
5712
  }
5704
- URL.revokeObjectURL(l), u && Gr(e, l, d, r.size);
5705
- for (let t of c) Kr(e, t.src, d);
5706
- return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await Hr(d) ? "uploaded" : "renderFailed" : "uploaded";
5713
+ URL.revokeObjectURL(l), u && qr(e, l, d, r.size);
5714
+ for (let t of c) Jr(e, t.src, d);
5715
+ return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await Wr(d) ? "uploaded" : "renderFailed" : "uploaded";
5707
5716
  }
5708
- function Yr(e, t) {
5717
+ function Zr(e, t) {
5709
5718
  let n = [], r = [];
5710
- for (let i of qr(e)) {
5719
+ for (let i of Yr(e)) {
5711
5720
  let e = i[0], a = t.get(e.basename);
5712
5721
  a ? (n.push({
5713
5722
  refs: i,
@@ -5719,30 +5728,30 @@ function Yr(e, t) {
5719
5728
  unmatched: r
5720
5729
  };
5721
5730
  }
5722
- async function Xr(e, t, n, r) {
5723
- let i = Ur();
5724
- for (let a of qr(n)) {
5725
- let n = a[0], { file: o, readError: s } = await br(r, n.src);
5731
+ async function Qr(e, t, n, r) {
5732
+ let i = Gr();
5733
+ for (let a of Yr(n)) {
5734
+ let n = a[0], { file: o, readError: s } = await xr(r, n.src);
5726
5735
  if (!o) {
5727
5736
  s ? (console.warn(`本地文件「${n.basename}」在所选文件夹中找到但读取失败:`, s), i.readFailed.push(n)) : (console.warn(`本地文件「${n.basename}」未在所选文件夹「${r.name}」中找到`), i.missing.push(n));
5728
5737
  continue;
5729
5738
  }
5730
- let c = await Jr(e, t, a, o);
5739
+ let c = await Xr(e, t, a, o);
5731
5740
  i[c]++;
5732
5741
  }
5733
5742
  return i;
5734
5743
  }
5735
- function Zr(e) {
5744
+ function $r(e) {
5736
5745
  let t = e.map((e) => e.basename);
5737
5746
  return t.length <= 3 ? t.join("、") : `${t.slice(0, 3).join("、")} 等 ${t.length} 个文件`;
5738
5747
  }
5739
- function Qr(e) {
5748
+ function ei(e) {
5740
5749
  let t = [];
5741
- 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} 个找到但读取失败:${Zr(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${Zr(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
5750
+ 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} 个找到但读取失败:${$r(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${$r(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
5742
5751
  let n = e.uploaded > 0 && e.renderFailed === 0 && e.missing.length === 0 && e.readFailed.length === 0;
5743
5752
  Z(`本地文件解析完成:${t.join(";")}`, n ? "success" : "info");
5744
5753
  }
5745
- function $r(e) {
5754
+ function ti(e) {
5746
5755
  return new Promise((t) => {
5747
5756
  let n = document.createElement("div");
5748
5757
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -5769,7 +5778,7 @@ function $r(e) {
5769
5778
  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);
5770
5779
  });
5771
5780
  }
5772
- function ei(e) {
5781
+ function ni(e) {
5773
5782
  let t = document.createElement("div");
5774
5783
  t.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
5775
5784
  let n = document.createElement("div");
@@ -5791,7 +5800,7 @@ function ei(e) {
5791
5800
  let c = document.createElement("button");
5792
5801
  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);
5793
5802
  }
5794
- function ti(e) {
5803
+ function ri(e) {
5795
5804
  return new Promise((t) => {
5796
5805
  let n = document.createElement("div");
5797
5806
  n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
@@ -5817,8 +5826,8 @@ function ti(e) {
5817
5826
  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);
5818
5827
  });
5819
5828
  }
5820
- async function ni(e, t, n) {
5821
- let r = Ur(), i = qr(n), a = await _r();
5829
+ async function ii(e, t, n) {
5830
+ let r = Gr(), i = Yr(n), a = await vr();
5822
5831
  if (!a) {
5823
5832
  for (let e of i) r.missing.push(e[0]);
5824
5833
  return r;
@@ -5831,14 +5840,14 @@ async function ni(e, t, n) {
5831
5840
  continue;
5832
5841
  }
5833
5842
  o.delete(i.basename);
5834
- let s = await Jr(e, t, n, a);
5843
+ let s = await Xr(e, t, n, a);
5835
5844
  r[s]++;
5836
5845
  }
5837
5846
  return r;
5838
5847
  }
5839
5848
  //#endregion
5840
5849
  //#region src/editor/extensions/relative-media.ts
5841
- var ri = R.create({
5850
+ var ai = R.create({
5842
5851
  name: "relativeMedia",
5843
5852
  addStorage() {
5844
5853
  return {
@@ -5848,42 +5857,42 @@ var ri = R.create({
5848
5857
  },
5849
5858
  addProseMirrorPlugins() {
5850
5859
  let e = this.editor, t = this.storage, n = !1, r = null, i = async (n, i) => {
5851
- let a = e.view, o = Ur(), { matched: s, unmatched: c } = Yr(n, t.clipboardFiles);
5860
+ let a = e.view, o = Gr(), { matched: s, unmatched: c } = Zr(n, t.clipboardFiles);
5852
5861
  for (let { refs: t, file: n } of s) {
5853
- let r = await Jr(a, e, t, n);
5862
+ let r = await Xr(a, e, t, n);
5854
5863
  o[r]++;
5855
5864
  }
5856
5865
  if (c.length > 0) {
5857
- let t = qr(c).length;
5858
- if (mr()) {
5866
+ let t = Yr(c).length;
5867
+ if (hr()) {
5859
5868
  let n = i ?? null;
5860
- if (n || (await $r(t) === "pick" ? (n = await hr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
5861
- r = n, Wr(o, await Xr(a, e, c, n));
5869
+ if (n || (await ti(t) === "pick" ? (n = await gr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
5870
+ r = n, Kr(o, await Qr(a, e, c, n));
5862
5871
  let t = [...o.missing, ...o.readFailed];
5863
- if (t.length > 0 && gr() && await ti(t.map((e) => e.basename)) === "pick") {
5864
- let n = await ni(a, e, t);
5865
- Wr(o, n), o.missing = n.missing, o.readFailed = [];
5872
+ if (t.length > 0 && _r() && await ri(t.map((e) => e.basename)) === "pick") {
5873
+ let n = await ii(a, e, t);
5874
+ Kr(o, n), o.missing = n.missing, o.readFailed = [];
5866
5875
  }
5867
5876
  }
5868
- } else ei(t);
5877
+ } else ni(t);
5869
5878
  }
5870
- Qr(o);
5879
+ ei(o);
5871
5880
  }, o = () => {
5872
5881
  if (!e || e.isDestroyed || t.pausedUntilPaste) return;
5873
- let o = a(), s = Sr(e.state.doc, o);
5882
+ let o = a(), s = Cr(e.state.doc, o);
5874
5883
  if (s.length === 0 || n) return;
5875
5884
  n = !0;
5876
5885
  let c = new Set(s.map((e) => e.src));
5877
5886
  i(s).then(() => {
5878
5887
  if (e.isDestroyed) return;
5879
- let t = Sr(e.state.doc, o).filter((e) => !c.has(e.src));
5888
+ let t = Cr(e.state.doc, o).filter((e) => !c.has(e.src));
5880
5889
  if (t.length !== 0) return i(t, r);
5881
5890
  }).finally(() => {
5882
- n = !1, !(!e || e.isDestroyed) && (t.pausedUntilPaste = Sr(e.state.doc, o).length > 0);
5891
+ n = !1, !(!e || e.isDestroyed) && (t.pausedUntilPaste = Cr(e.state.doc, o).length > 0);
5883
5892
  });
5884
5893
  };
5885
- return [new z({
5886
- key: new B("relativeMedia"),
5894
+ return [new B({
5895
+ key: new V("relativeMedia"),
5887
5896
  props: { handlePaste(e, n) {
5888
5897
  let r = n.clipboardData?.files;
5889
5898
  return t.clipboardFiles = new Map(Array.from(r ?? []).map((e) => [e.name.toLowerCase(), e])), t.pausedUntilPaste = !1, !1;
@@ -5893,18 +5902,18 @@ var ri = R.create({
5893
5902
  }
5894
5903
  })];
5895
5904
  }
5896
- }), ii = new B("slashCommand");
5897
- function ai(e) {
5905
+ }), oi = new V("slashCommand");
5906
+ function si(e) {
5898
5907
  return R.create({
5899
5908
  name: "slashCommand",
5900
5909
  addProseMirrorPlugins() {
5901
5910
  let t = {
5902
5911
  char: "/",
5903
- pluginKey: ii,
5912
+ pluginKey: oi,
5904
5913
  findSuggestionMatch: (e) => {
5905
5914
  let { $position: t } = e;
5906
5915
  for (let e = t.depth; e >= 0; e--) if (t.node(e).type.name === "codeBlock") return null;
5907
- return t.marks().some((e) => e.type.name === "code") ? null : we(e);
5916
+ return t.marks().some((e) => e.type.name === "code") ? null : Te(e);
5908
5917
  },
5909
5918
  allow: ({ editor: e, state: t }) => {
5910
5919
  if (!e.isEditable) return !1;
@@ -5986,7 +5995,7 @@ function ai(e) {
5986
5995
  if (e.key === "Escape") {
5987
5996
  e.preventDefault();
5988
5997
  let t = a?.view;
5989
- t && Ce(t, ii);
5998
+ t && we(t, oi);
5990
5999
  }
5991
6000
  });
5992
6001
  }
@@ -6004,7 +6013,7 @@ function ai(e) {
6004
6013
  if (!e || e.style.display === "none" || n.target instanceof Node && e.contains(n.target) || t) return;
6005
6014
  let r = a?.view;
6006
6015
  r && (t = !0, window.setTimeout(() => {
6007
- t = !1, e?.style.display !== "none" && Ce(r, ii);
6016
+ t = !1, e?.style.display !== "none" && we(r, oi);
6008
6017
  }, 0));
6009
6018
  }, document.addEventListener("mousedown", o, !0), document.addEventListener("touchstart", o, !0);
6010
6019
  }
@@ -6028,11 +6037,11 @@ function ai(e) {
6028
6037
  };
6029
6038
  }
6030
6039
  };
6031
- return [Se({
6040
+ return [Ce({
6032
6041
  editor: this.editor,
6033
6042
  ...t
6034
- }), new z({
6035
- key: new B("slashCodeBlockGuard"),
6043
+ }), new B({
6044
+ key: new V("slashCodeBlockGuard"),
6036
6045
  appendTransaction: (e, t, n) => {
6037
6046
  let { $from: r } = n.selection, i = !1;
6038
6047
  for (let e = r.depth; e >= 0; e--) if (r.node(e).type.name === "codeBlock") {
@@ -6040,14 +6049,14 @@ function ai(e) {
6040
6049
  break;
6041
6050
  }
6042
6051
  if (!i && !r.marks().some((e) => e.type.name === "code")) return null;
6043
- let a = ii.getState(n);
6044
- return a && a.active ? n.tr.setMeta(ii, { exit: !0 }) : null;
6052
+ let a = oi.getState(n);
6053
+ return a && a.active ? n.tr.setMeta(oi, { exit: !0 }) : null;
6045
6054
  }
6046
6055
  })];
6047
6056
  }
6048
6057
  });
6049
6058
  }
6050
- function oi(e, t) {
6059
+ function ci(e, t) {
6051
6060
  return [
6052
6061
  {
6053
6062
  title: e("editor.slash.heading1"),
@@ -6146,7 +6155,7 @@ function oi(e, t) {
6146
6155
  n.type = "file", n.accept = "audio/*", n.onchange = async () => {
6147
6156
  let r = n.files?.[0];
6148
6157
  if (!r) return;
6149
- let i = un(e) ?? t, a = i ? dn(e.state.doc, r, i) : null;
6158
+ let i = dn(e) ?? t, a = i ? fn(e.state.doc, r, i) : null;
6150
6159
  if (a) {
6151
6160
  Z(a);
6152
6161
  return;
@@ -6156,7 +6165,7 @@ function oi(e, t) {
6156
6165
  name: r.name,
6157
6166
  size: r.size
6158
6167
  });
6159
- s && (e.chain().focus().insertContent(s).run(), await Or(e.view, r, o));
6168
+ s && (e.chain().focus().insertContent(s).run(), await kr(e.view, r, o));
6160
6169
  }, n.click();
6161
6170
  }
6162
6171
  },
@@ -6169,7 +6178,7 @@ function oi(e, t) {
6169
6178
  n.type = "file", n.accept = "*/*", n.multiple = !0, n.onchange = async () => {
6170
6179
  let r = n.files;
6171
6180
  if (!(!r || r.length === 0)) for (let n of Array.from(r)) {
6172
- let r = un(e) ?? t, i = r ? dn(e.state.doc, n, r) : null;
6181
+ let r = dn(e) ?? t, i = r ? fn(e.state.doc, n, r) : null;
6173
6182
  if (i) {
6174
6183
  Z(i);
6175
6184
  continue;
@@ -6186,7 +6195,7 @@ function oi(e, t) {
6186
6195
  } catch {
6187
6196
  continue;
6188
6197
  }
6189
- await Or(e.view, n, a);
6198
+ await kr(e.view, n, a);
6190
6199
  }
6191
6200
  }
6192
6201
  }, n.click();
@@ -6196,9 +6205,9 @@ function oi(e, t) {
6196
6205
  }
6197
6206
  //#endregion
6198
6207
  //#region src/editor/extensions/index.ts
6199
- var si = oe.extend({
6208
+ var li = U.extend({
6200
6209
  addNodeView() {
6201
- return I(Sn);
6210
+ return I(Cn);
6202
6211
  },
6203
6212
  addAttributes() {
6204
6213
  return {
@@ -6221,112 +6230,113 @@ var si = oe.extend({
6221
6230
  };
6222
6231
  }
6223
6232
  });
6224
- function ci(e = {}) {
6233
+ function ui(e = {}) {
6225
6234
  return [
6226
- G.configure({
6235
+ K.configure({
6227
6236
  codeBlock: !1,
6228
6237
  horizontalRule: !1,
6229
6238
  underline: !1,
6230
6239
  link: !1
6231
6240
  }),
6232
- W,
6233
- U.configure({
6241
+ G,
6242
+ W.configure({
6234
6243
  openOnClick: !0,
6235
6244
  HTMLAttributes: {
6236
6245
  rel: "noopener noreferrer",
6237
6246
  target: "_blank"
6238
6247
  }
6239
6248
  }),
6240
- si.configure({
6249
+ li.configure({
6241
6250
  inline: !1,
6242
6251
  allowBase64: !0
6243
6252
  }),
6244
- he,
6245
- me.configure({ nested: !0 }),
6246
- se.configure({ multicolor: !0 }),
6247
6253
  ge,
6248
- q,
6249
- K.configure(e.maxLength ? { limit: e.maxLength } : {}),
6250
- ce,
6251
- or,
6252
- ue.configure({ resizable: !0 }),
6253
- pe,
6254
- de,
6254
+ he.configure({ nested: !0 }),
6255
+ ce.configure({ multicolor: !0 }),
6256
+ _e,
6257
+ se,
6258
+ q.configure(e.maxLength ? { limit: e.maxLength } : {}),
6259
+ le,
6260
+ Pr,
6261
+ sr,
6262
+ de.configure({ resizable: !0 }),
6263
+ me,
6255
6264
  fe,
6256
- _e.configure({
6265
+ pe,
6266
+ ve.configure({
6257
6267
  html: !0,
6258
6268
  transformPastedText: !0,
6259
6269
  transformCopiedText: !1
6260
6270
  }),
6261
- le.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
6262
- ai(() => oi((e) => f(e), {
6271
+ ue.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
6272
+ si(() => ci((e) => f(e), {
6263
6273
  maxAttachmentSize: e.maxAttachmentSize,
6264
6274
  maxTotalAttachmentSize: e.maxTotalAttachmentSize
6265
6275
  })),
6266
- Ar.configure({
6276
+ jr.configure({
6267
6277
  maxAttachmentSize: e.maxAttachmentSize,
6268
6278
  maxTotalAttachmentSize: e.maxTotalAttachmentSize
6269
6279
  }),
6270
- ri,
6271
- zr,
6272
- Dt,
6273
- Mr,
6274
- Br,
6275
- qn,
6276
- Bn,
6277
- Ln
6280
+ ai,
6281
+ Vr,
6282
+ Ot,
6283
+ Nr,
6284
+ Hr,
6285
+ Jn,
6286
+ Vn,
6287
+ Rn
6278
6288
  ];
6279
6289
  }
6280
6290
  //#endregion
6281
6291
  //#region src/editor/extensions/bubble-menu.tsx
6282
- var li = "https://www.bing.com/search?q={query}";
6283
- function ui(e) {
6284
- li = e;
6292
+ var di = "https://www.bing.com/search?q={query}";
6293
+ function fi(e) {
6294
+ di = e;
6285
6295
  }
6286
- function di() {
6287
- return li;
6296
+ function pi() {
6297
+ return di;
6288
6298
  }
6289
- function fi(e) {
6299
+ function mi(e) {
6290
6300
  return [
6291
6301
  {
6292
6302
  key: "bold",
6293
6303
  label: e("editor.bubble.bold"),
6294
- icon: /* @__PURE__ */ D(At, {}),
6304
+ icon: /* @__PURE__ */ D(jt, {}),
6295
6305
  isActive: (e) => e.isActive("bold"),
6296
6306
  command: (e) => e.isEditable && e.chain().focus().toggleBold().run()
6297
6307
  },
6298
6308
  {
6299
6309
  key: "italic",
6300
6310
  label: e("editor.bubble.italic"),
6301
- icon: /* @__PURE__ */ D(jt, {}),
6311
+ icon: /* @__PURE__ */ D(Mt, {}),
6302
6312
  isActive: (e) => e.isActive("italic"),
6303
6313
  command: (e) => e.isEditable && e.chain().focus().toggleItalic().run()
6304
6314
  },
6305
6315
  {
6306
6316
  key: "underline",
6307
6317
  label: e("editor.bubble.underline"),
6308
- icon: /* @__PURE__ */ D(Mt, {}),
6318
+ icon: /* @__PURE__ */ D(Nt, {}),
6309
6319
  isActive: (e) => e.isActive("underline"),
6310
6320
  command: (e) => e.isEditable && e.chain().focus().toggleUnderline().run()
6311
6321
  },
6312
6322
  {
6313
6323
  key: "strikethrough",
6314
6324
  label: e("editor.bubble.strikethrough"),
6315
- icon: /* @__PURE__ */ D(Nt, {}),
6325
+ icon: /* @__PURE__ */ D(Pt, {}),
6316
6326
  isActive: (e) => e.isActive("strike"),
6317
6327
  command: (e) => e.isEditable && e.chain().focus().toggleStrike().run()
6318
6328
  },
6319
6329
  {
6320
6330
  key: "code",
6321
6331
  label: e("editor.bubble.emphasis"),
6322
- icon: /* @__PURE__ */ D(Pt, {}),
6332
+ icon: /* @__PURE__ */ D(Ft, {}),
6323
6333
  isActive: (e) => e.isActive("code"),
6324
6334
  command: (e) => e.isEditable && e.chain().focus().toggleCode().run()
6325
6335
  },
6326
6336
  {
6327
6337
  key: "highlight",
6328
6338
  label: e("editor.bubble.highlight"),
6329
- icon: /* @__PURE__ */ D(Ft, {}),
6339
+ icon: /* @__PURE__ */ D(It, {}),
6330
6340
  more: !0,
6331
6341
  isActive: (e) => e.isActive("highlight"),
6332
6342
  command: () => {}
@@ -6334,7 +6344,7 @@ function fi(e) {
6334
6344
  {
6335
6345
  key: "link",
6336
6346
  label: e("editor.bubble.link"),
6337
- icon: /* @__PURE__ */ D(It, {}),
6347
+ icon: /* @__PURE__ */ D(Lt, {}),
6338
6348
  more: !0,
6339
6349
  isActive: (e) => e.isActive("link"),
6340
6350
  command: () => {}
@@ -6342,7 +6352,7 @@ function fi(e) {
6342
6352
  {
6343
6353
  key: "copy",
6344
6354
  label: e("editor.bubble.copy"),
6345
- icon: /* @__PURE__ */ D(Rt, {}),
6355
+ icon: /* @__PURE__ */ D(zt, {}),
6346
6356
  more: !0,
6347
6357
  isActive: () => !1,
6348
6358
  command: (e) => {
@@ -6353,21 +6363,21 @@ function fi(e) {
6353
6363
  {
6354
6364
  key: "search",
6355
6365
  label: e("editor.bubble.search"),
6356
- icon: /* @__PURE__ */ D(zt, {}),
6366
+ icon: /* @__PURE__ */ D(Bt, {}),
6357
6367
  more: !0,
6358
6368
  isActive: () => !1,
6359
6369
  command: (e) => {
6360
6370
  if (e.isActive("table")) return;
6361
6371
  let { from: t, to: n } = e.state.selection, r = e.state.doc.textBetween(t, n, " ").trim();
6362
6372
  if (!r) return;
6363
- let i = li.replace("{query}", encodeURIComponent(r));
6373
+ let i = di.replace("{query}", encodeURIComponent(r));
6364
6374
  window.open(i, "_blank", "noopener,noreferrer");
6365
6375
  }
6366
6376
  },
6367
6377
  {
6368
6378
  key: "table",
6369
6379
  label: e("editor.bubble.table"),
6370
- icon: /* @__PURE__ */ D(Lt, {}),
6380
+ icon: /* @__PURE__ */ D(Rt, {}),
6371
6381
  more: !0,
6372
6382
  isActive: (e) => e.isActive("table"),
6373
6383
  command: (e) => {
@@ -6383,7 +6393,7 @@ function fi(e) {
6383
6393
  {
6384
6394
  key: "ai",
6385
6395
  label: e("editor.ai.trigger"),
6386
- icon: /* @__PURE__ */ D(Bt, {}),
6396
+ icon: /* @__PURE__ */ D(Vt, {}),
6387
6397
  isActive: () => !1,
6388
6398
  command: (e) => {
6389
6399
  e.isEditable && e.storage.qingwuUI?.openAI?.();
@@ -6394,7 +6404,7 @@ function fi(e) {
6394
6404
  R.create({ name: "bubbleMenu" });
6395
6405
  //#endregion
6396
6406
  //#region src/editor/extensions/table-toolbar.tsx
6397
- function pi(e) {
6407
+ function hi(e) {
6398
6408
  let { $from: t } = e.state.selection;
6399
6409
  for (let e = t.depth; e > 0; e--) {
6400
6410
  let n = t.node(e);
@@ -6405,7 +6415,7 @@ function pi(e) {
6405
6415
  }
6406
6416
  return null;
6407
6417
  }
6408
- function mi(e) {
6418
+ function gi(e) {
6409
6419
  let t = [];
6410
6420
  return e.forEach((e) => {
6411
6421
  let n = [];
@@ -6414,7 +6424,7 @@ function mi(e) {
6414
6424
  }), t.push(n);
6415
6425
  }), t;
6416
6426
  }
6417
- function hi(e) {
6427
+ function _i(e) {
6418
6428
  if (e.length === 0) return "";
6419
6429
  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(" | ")} |`;
6420
6430
  return [
@@ -6423,11 +6433,11 @@ function hi(e) {
6423
6433
  ...i.map(a)
6424
6434
  ].join("\n");
6425
6435
  }
6426
- function gi(e) {
6436
+ function vi(e) {
6427
6437
  let t = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e;
6428
6438
  return e.map((e) => e.map(t).join(",")).join("\n");
6429
6439
  }
6430
- function _i(e) {
6440
+ function yi(e) {
6431
6441
  let t = e.trim();
6432
6442
  if (!t) return null;
6433
6443
  let n = t.split(/\r?\n/);
@@ -6441,7 +6451,7 @@ function _i(e) {
6441
6451
  }
6442
6452
  return null;
6443
6453
  }
6444
- function vi({ editor: e }) {
6454
+ function bi({ editor: e }) {
6445
6455
  let [t, n] = T(null), [r, i] = T(!1), [a, o] = T(!1), s = w(null), c = w(null), l = e.isEditable, u = b(() => {
6446
6456
  c.current != null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
6447
6457
  c.current = null;
@@ -6457,7 +6467,7 @@ function vi({ editor: e }) {
6457
6467
  n(null);
6458
6468
  return;
6459
6469
  }
6460
- let t = pi(e);
6470
+ let t = hi(e);
6461
6471
  if (!t) {
6462
6472
  n(null);
6463
6473
  return;
@@ -6486,24 +6496,24 @@ function vi({ editor: e }) {
6486
6496
  });
6487
6497
  return n.nodes.table.create(null, i);
6488
6498
  }, p = () => {
6489
- let t = pi(e);
6499
+ let t = hi(e);
6490
6500
  if (!t) return;
6491
- let n = hi(mi(t.node));
6501
+ let n = _i(gi(t.node));
6492
6502
  navigator.clipboard?.writeText(n), i(!0), setTimeout(() => i(!1), 1500);
6493
6503
  }, m = () => {
6494
- let t = pi(e);
6504
+ let t = hi(e);
6495
6505
  if (!t) return;
6496
- let n = gi(mi(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
6506
+ let n = vi(gi(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
6497
6507
  a.href = i, a.download = "table.csv", document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
6498
6508
  }, h = async () => {
6499
6509
  if (l) try {
6500
6510
  let t = await navigator.clipboard?.readText();
6501
6511
  if (!t) return;
6502
- let n = _i(t);
6512
+ let n = yi(t);
6503
6513
  if (!n || n.length === 0) return;
6504
6514
  let r = f(n);
6505
6515
  if (!r) return;
6506
- let i = pi(e), a = e.chain().focus();
6516
+ let i = hi(e), a = e.chain().focus();
6507
6517
  if (i) {
6508
6518
  let t = Math.min(i.pos + i.node.nodeSize, e.state.doc.content.size);
6509
6519
  a.setTextSelection(t);
@@ -6623,7 +6633,7 @@ function vi({ editor: e }) {
6623
6633
  type: "button",
6624
6634
  className: "tbl-btn tbl-btn--del",
6625
6635
  onClick: () => {
6626
- !l || hn() || ($(!0), o(!0));
6636
+ !l || gn() || ($(!0), o(!0));
6627
6637
  },
6628
6638
  title: "删除",
6629
6639
  children: /* @__PURE__ */ D("svg", {
@@ -6641,7 +6651,7 @@ function vi({ editor: e }) {
6641
6651
  })
6642
6652
  })
6643
6653
  }),
6644
- /* @__PURE__ */ D(bn, {
6654
+ /* @__PURE__ */ D(xn, {
6645
6655
  open: a,
6646
6656
  title: "确认删除表格",
6647
6657
  message: "此操作不可撤销。",
@@ -6657,7 +6667,7 @@ function vi({ editor: e }) {
6657
6667
  }
6658
6668
  //#endregion
6659
6669
  //#region src/editor/ai-editor.tsx
6660
- var yi = [
6670
+ var xi = [
6661
6671
  {
6662
6672
  color: "#fef08a",
6663
6673
  name: "黄"
@@ -6682,9 +6692,9 @@ var yi = [
6682
6692
  color: "#ddd6fe",
6683
6693
  name: "紫"
6684
6694
  }
6685
- ], bi = 288, xi = 480, Si = 320;
6686
- function Ci(e, t, n = {}) {
6687
- let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || bi, xi, r - 32), o = Math.max(t || Si, 160);
6695
+ ], Si = 288, Ci = 480, wi = 320;
6696
+ function Ti(e, t, n = {}) {
6697
+ let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || Si, Ci, r - 32), o = Math.max(t || wi, 160);
6688
6698
  if (r < 640) {
6689
6699
  let t = Math.max(8, Math.min(e.top + 10, i - 420));
6690
6700
  return {
@@ -6725,10 +6735,10 @@ function Ci(e, t, n = {}) {
6725
6735
  arrowLeft: p
6726
6736
  };
6727
6737
  }
6728
- function wi(e) {
6738
+ function Ei(e) {
6729
6739
  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*\|.+\|/i.test(e);
6730
6740
  }
6731
- function Ti(e, t) {
6741
+ function Di(e, t) {
6732
6742
  try {
6733
6743
  let n = e.storage?.markdown?.parser;
6734
6744
  if (!n) return null;
@@ -6738,19 +6748,19 @@ function Ti(e, t) {
6738
6748
  return null;
6739
6749
  }
6740
6750
  }
6741
- var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.ImageUploadDialog }))), Di = y(() => import("./storage-settings-dialog-DZqqDAiO.js").then((e) => ({ default: e.StorageSettingsDialog }))), Oi = y(() => import("./export-dialog-CL7ie13Z.js").then((e) => ({ default: e.ExportDialog }))), ki = y(() => import("./video-embed-dialog-AeGcMb4X.js").then((e) => ({ default: e.VideoEmbedDialog }))), Ai = y(() => import("./md-import-dialog-Cf3ZOwA_.js").then((e) => ({ default: e.MdImportDialog }))), ji = () => /* @__PURE__ */ O("div", {
6751
+ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.ImageUploadDialog }))), ki = y(() => import("./storage-settings-dialog-DZqqDAiO.js").then((e) => ({ default: e.StorageSettingsDialog }))), Ai = y(() => import("./export-dialog-CL7ie13Z.js").then((e) => ({ default: e.ExportDialog }))), ji = y(() => import("./video-embed-dialog-AeGcMb4X.js").then((e) => ({ default: e.VideoEmbedDialog }))), Mi = y(() => import("./md-import-dialog-Cf3ZOwA_.js").then((e) => ({ default: e.MdImportDialog }))), Ni = () => /* @__PURE__ */ O("div", {
6742
6752
  className: "fixed inset-0 z-[9999] flex items-center justify-center",
6743
6753
  children: [/* @__PURE__ */ D("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm" }), /* @__PURE__ */ D("div", {
6744
6754
  className: "relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center",
6745
6755
  children: /* @__PURE__ */ D("div", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" })
6746
6756
  })]
6747
- }), Mi = ({ 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: p = !0, showToc: m = !0, showSearch: h = !0, onEditorReady: g, immediatelyRender: _, onToast: y }) => {
6748
- let k = r === "view" || i, A = C(() => typeof e == "object" && e || wi(e) ? e : d(e), [e]), [j, M] = T(!1), [F, I] = T({}), [L, R] = T("below"), [re, ie] = T(50), z = w(null), [B, V] = T(!1), [H, ae] = T(!1), [oe, U] = T(!1), [W, G] = T(!1), [K, q] = T("none"), [se, ce] = T({}), [le, ue] = T(""), [de, fe] = T(null), [pe, me] = T(m), [he, ge] = T(!1);
6757
+ }), Pi = ({ 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: p = !0, showToc: m = !0, showSearch: h = !0, onEditorReady: g, immediatelyRender: _, onToast: y }) => {
6758
+ let k = r === "view" || i, A = C(() => typeof e == "object" && e || Ei(e) ? e : d(e), [e]), [j, M] = T(!1), [F, I] = T({}), [L, R] = T("below"), [re, ie] = T(50), z = w(null), [B, V] = T(!1), [H, ae] = T(!1), [oe, U] = T(!1), [W, G] = T(!1), [K, q] = T("none"), [se, ce] = T({}), le = w(null), ue = w(null), [de, fe] = T(""), [pe, me] = T(null), [he, ge] = T(m), [_e, ve] = T(!1);
6749
6759
  x(() => {
6750
- me(m);
6760
+ ge(m);
6751
6761
  }, [m]);
6752
- let [_e, ve] = T(!1), [ye, be] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [xe, Se] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), Ce = w(null), we = w(null), Te = w(null), Ee = w(0), De = w(null), Oe = w(null), ke = w(null), Ae = w(null), [je, Me] = T(!1), [J, Ne] = T(!1), [Y, Pe] = T(!1), Fe = w(null), Ie = b(() => {
6753
- let e = we.current, t = Te.current;
6762
+ let [ye, be] = T(!1), [xe, Se] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [Ce, we] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), Te = w(null), Ee = w(null), De = w(null), Oe = w(0), ke = w(null), Ae = w(null), je = w(null), Me = w(null), [Ne, Pe] = T(!1), [J, Fe] = T(!1), [Ie, Le] = T(!1), Re = w(null), ze = b(() => {
6763
+ let e = Ee.current, t = De.current;
6754
6764
  e && (J ? (document.body.style.overflow = "", Object.assign(e.style, {
6755
6765
  position: "",
6756
6766
  top: "",
@@ -6767,9 +6777,9 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6767
6777
  flex: "",
6768
6778
  overflow: "",
6769
6779
  minHeight: ""
6770
- }), Ne(!1), requestAnimationFrame(() => {
6771
- window.scrollTo(0, Ee.current);
6772
- })) : (document.fullscreenElement && document.exitFullscreen(), Ee.current = window.scrollY, Object.assign(e.style, {
6780
+ }), Fe(!1), requestAnimationFrame(() => {
6781
+ window.scrollTo(0, Oe.current);
6782
+ })) : (document.fullscreenElement && document.exitFullscreen(), Oe.current = window.scrollY, Object.assign(e.style, {
6773
6783
  position: "fixed",
6774
6784
  top: "0",
6775
6785
  left: "0",
@@ -6785,42 +6795,42 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6785
6795
  flex: "1",
6786
6796
  overflow: "auto",
6787
6797
  minHeight: "0"
6788
- }), document.body.style.overflow = "hidden", Ne(!0)));
6789
- }, [J]), Le = b(() => {
6790
- let e = we.current;
6791
- e && (document.fullscreenElement ? document.exitFullscreen() : (J && Ie(), Ee.current = window.scrollY, e.requestFullscreen()));
6792
- }, [J, Ie]);
6798
+ }), document.body.style.overflow = "hidden", Fe(!0)));
6799
+ }, [J]), Be = b(() => {
6800
+ let e = Ee.current;
6801
+ e && (document.fullscreenElement ? document.exitFullscreen() : (J && ze(), Oe.current = window.scrollY, e.requestFullscreen()));
6802
+ }, [J, ze]);
6793
6803
  x(() => {
6794
6804
  let e = (e) => {
6795
- e.key === "Escape" && J && Ie();
6805
+ e.key === "Escape" && J && ze();
6796
6806
  }, t = () => {
6797
- document.fullscreenElement ? Pe(!0) : (Pe(!1), requestAnimationFrame(() => {
6798
- window.scrollTo(0, Ee.current);
6807
+ document.fullscreenElement ? Le(!0) : (Le(!1), requestAnimationFrame(() => {
6808
+ window.scrollTo(0, Oe.current);
6799
6809
  }));
6800
6810
  };
6801
6811
  return window.addEventListener("keydown", e), document.addEventListener("fullscreenchange", t), () => {
6802
6812
  window.removeEventListener("keydown", e), document.removeEventListener("fullscreenchange", t);
6803
6813
  };
6804
- }, [J, Ie]), x(() => {
6814
+ }, [J, ze]), x(() => {
6805
6815
  if (!h) return;
6806
6816
  let e = (e) => {
6807
6817
  if ((e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F")) {
6808
- if (!we.current) return;
6809
- e.preventDefault(), e.stopPropagation(), ve(!0);
6818
+ if (!Ee.current) return;
6819
+ e.preventDefault(), e.stopPropagation(), be(!0);
6810
6820
  }
6811
6821
  };
6812
6822
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
6813
6823
  }, [h]), x(() => {
6814
6824
  if (typeof window > "u" || typeof window.matchMedia != "function") return;
6815
- let e = window.matchMedia("(min-width: 80rem)"), t = (e) => be(e.matches);
6816
- return be(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6825
+ let e = window.matchMedia("(min-width: 80rem)"), t = (e) => Se(e.matches);
6826
+ return Se(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6817
6827
  }, []), x(() => {
6818
6828
  if (typeof window > "u" || typeof window.matchMedia != "function") return;
6819
- let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Se(e.matches);
6820
- return Se(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6829
+ let e = window.matchMedia("(min-width: 64rem)"), t = (e) => we(e.matches);
6830
+ return we(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6821
6831
  }, []);
6822
- let X = ee({
6823
- extensions: ci({
6832
+ let Y = ee({
6833
+ extensions: ui({
6824
6834
  placeholder: n || f("editor.placeholder"),
6825
6835
  maxLength: a,
6826
6836
  maxAttachmentSize: o,
@@ -6830,7 +6840,7 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6830
6840
  editable: !k,
6831
6841
  immediatelyRender: _,
6832
6842
  onUpdate: ({ editor: e }) => {
6833
- t && (Ce.current && clearTimeout(Ce.current), Ce.current = setTimeout(() => {
6843
+ t && (Te.current && clearTimeout(Te.current), Te.current = setTimeout(() => {
6834
6844
  t?.(e.getHTML(), e.getJSON());
6835
6845
  }, 300));
6836
6846
  },
@@ -6846,9 +6856,9 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6846
6856
  let r = n.getData("text/plain");
6847
6857
  if (!r || !r.includes("[[")) return !1;
6848
6858
  t.preventDefault();
6849
- let i = Oe.current?.storage?.relativeMedia;
6859
+ let i = Ae.current?.storage?.relativeMedia;
6850
6860
  i && (i.clipboardFiles = new Map(Array.from(n.files ?? []).map((e) => [e.name.toLowerCase(), e])), i.pausedUntilPaste = !1);
6851
- let a = Oe.current ? Ti(Oe.current, r) : null;
6861
+ let a = Ae.current ? Di(Ae.current, r) : null;
6852
6862
  if (a) {
6853
6863
  let t = new N(a, 0, 0);
6854
6864
  e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView());
@@ -6858,21 +6868,21 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6858
6868
  }
6859
6869
  });
6860
6870
  x(() => {
6861
- Oe.current = X, window.__editor = X;
6862
- }, [X]), x(() => {
6863
- if (X) return () => Xt(X);
6864
- }, [X]), x(() => {
6865
- !X || !g || g(X);
6866
- }, [X, g]), x(() => {
6867
- if (!X) return;
6871
+ Ae.current = Y, window.__editor = Y;
6872
+ }, [Y]), x(() => {
6873
+ if (Y) return () => Zt(Y);
6874
+ }, [Y]), x(() => {
6875
+ !Y || !g || g(Y);
6876
+ }, [Y, g]), x(() => {
6877
+ if (!Y) return;
6868
6878
  let e = () => {
6869
- X.state.selection.empty && (q("none"), Me(!1));
6879
+ Y.state.selection.empty && (q("none"), Pe(!1));
6870
6880
  };
6871
- return X.on("selectionUpdate", e), () => {
6872
- X.off("selectionUpdate", e);
6881
+ return Y.on("selectionUpdate", e), () => {
6882
+ Y.off("selectionUpdate", e);
6873
6883
  };
6874
- }, [X]), x(() => {
6875
- X && X.setOptions({ extensions: ci({
6884
+ }, [Y]), x(() => {
6885
+ Y && Y.setOptions({ extensions: ui({
6876
6886
  placeholder: n || f("editor.placeholder"),
6877
6887
  maxLength: a,
6878
6888
  maxAttachmentSize: o,
@@ -6884,80 +6894,100 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6884
6894
  o,
6885
6895
  s
6886
6896
  ]);
6887
- let Re = w(e);
6897
+ let Ve = w(e);
6888
6898
  x(() => {
6889
- if (!X || e === Re.current) return;
6890
- Re.current = e;
6891
- let t = typeof e == "object" && e || wi(e) ? e : d(e);
6892
- X.commands.setContent(t, { emitUpdate: !1 });
6893
- }, [X, e]), x(() => {
6894
- X && X.setEditable(!k, !1);
6895
- }, [X, k]), x(() => {
6896
- if (y) return Qe(y);
6899
+ if (!Y || e === Ve.current) return;
6900
+ Ve.current = e;
6901
+ let t = typeof e == "object" && e || Ei(e) ? e : d(e);
6902
+ Y.commands.setContent(t, { emitUpdate: !1 });
6903
+ }, [Y, e]), x(() => {
6904
+ Y && Y.setEditable(!k, !1);
6905
+ }, [Y, k]), x(() => {
6906
+ if (y) return $e(y);
6897
6907
  }, [y]), x(() => {
6898
- if (!X) return;
6899
- let e = cn(X.state.doc);
6900
- e > s && Z(`文档内附件总大小 ${ln(e)} 已超过限制 ${ln(s)}`, "info");
6901
- }, [X, s]), x(() => {
6902
- if (!X) return;
6903
- let e = X.storage.qingwuUI;
6908
+ if (!Y) return;
6909
+ let e = ln(Y.state.doc);
6910
+ e > s && Z(`文档内附件总大小 ${un(e)} 已超过限制 ${un(s)}`, "info");
6911
+ }, [Y, s]), x(() => {
6912
+ if (!Y) return;
6913
+ let e = Y.storage.qingwuUI;
6904
6914
  e && (e.limits = {
6905
6915
  maxAttachmentSize: o,
6906
6916
  maxTotalAttachmentSize: s
6907
6917
  });
6908
6918
  }, [
6909
- X,
6919
+ Y,
6910
6920
  o,
6911
6921
  s
6912
6922
  ]);
6913
- let ze = b((e) => {
6914
- let t = Ae.current?.getBoundingClientRect();
6915
- q(e), Me(!1), ce({
6923
+ let X = b((e, t) => {
6924
+ let n = e ? Math.max(8, Math.min(e.left, window.innerWidth - 240 - 8)) : 8, r;
6925
+ return r = e ? t && e.bottom + 8 + t > window.innerHeight ? Math.max(8, e.top - t - 8) : e.bottom + 8 : 8, {
6916
6926
  position: "fixed",
6917
- top: t ? t.bottom + 8 : void 0,
6918
- left: t ? Math.max(8, Math.min(t.left, window.innerWidth - 240)) : 8,
6927
+ top: r,
6928
+ left: n,
6919
6929
  zIndex: 9999
6920
- });
6921
- }, []), Be = fi((e) => f(e)), Ve = Be.filter((e) => !e.more), He = Be.filter((e) => e.more), Ue = Ve.filter((e) => e.key !== "ai"), We = Ve.find((e) => e.key === "ai"), Ge = b((e) => {
6922
- if (X) if (Me(!1), e.key === "link") if (X.isActive("link")) X.chain().focus().unsetLink().run();
6930
+ };
6931
+ }, []), He = b((e) => {
6932
+ let t = Me.current?.getBoundingClientRect() ?? null;
6933
+ ue.current = t, q(e), Pe(!1), ce(X(t, void 0));
6934
+ }, [X]);
6935
+ S(() => {
6936
+ if (K === "none") return;
6937
+ let e = le.current;
6938
+ ce(X(ue.current, e?.offsetHeight || void 0));
6939
+ }, [K, X]), x(() => {
6940
+ if (K === "none") return;
6941
+ let e = () => q("none"), t = () => {
6942
+ let e = le.current;
6943
+ ce(X(ue.current, e?.offsetHeight || void 0));
6944
+ };
6945
+ return window.addEventListener("scroll", e, !0), window.addEventListener("resize", t), () => {
6946
+ window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", t);
6947
+ };
6948
+ }, [K, X]), x(() => {
6949
+ K === "none" && (ue.current = null);
6950
+ }, [K]);
6951
+ let Ue = mi((e) => f(e)), We = Ue.filter((e) => !e.more), Ge = Ue.filter((e) => e.more), Ke = We.filter((e) => e.key !== "ai"), qe = We.find((e) => e.key === "ai"), Je = b((e) => {
6952
+ if (Y) if (Pe(!1), e.key === "link") if (Y.isActive("link")) Y.chain().focus().unsetLink().run();
6923
6953
  else {
6924
- let e = X.getAttributes("link").href || "";
6925
- ue(e), ze("link");
6954
+ let e = Y.getAttributes("link").href || "";
6955
+ fe(e), He("link");
6926
6956
  }
6927
- else e.key === "highlight" ? K === "highlight" ? q("none") : ze("highlight") : e.command(X);
6957
+ else e.key === "highlight" ? K === "highlight" ? q("none") : He("highlight") : e.command(Y);
6928
6958
  }, [
6929
- X,
6959
+ Y,
6930
6960
  K,
6931
- ze
6932
- ]), Ke = b((e) => X ? e.key === "highlight" ? K === "highlight" : e.key === "link" ? X.isActive("link") : e.isActive(X) : !1, [X, K]), [qe, Je] = T(0);
6961
+ He
6962
+ ]), Ye = b((e) => Y ? e.key === "highlight" ? K === "highlight" : e.key === "link" ? Y.isActive("link") : e.isActive(Y) : !1, [Y, K]), [Xe, Ze] = T(0);
6933
6963
  x(() => {
6934
- if (!X) return;
6935
- let e = () => Je((e) => (e + 1) % 1e6);
6936
- return X.on("update", e), () => {
6937
- X.off("update", e);
6964
+ if (!Y) return;
6965
+ let e = () => Ze((e) => (e + 1) % 1e6);
6966
+ return Y.on("update", e), () => {
6967
+ Y.off("update", e);
6938
6968
  };
6939
- }, [X]);
6940
- let [Ye, Xe] = T(!1);
6969
+ }, [Y]);
6970
+ let [Qe, et] = T(!1);
6941
6971
  x(() => {
6942
- if (!X) return;
6972
+ if (!Y) return;
6943
6973
  let e = () => {
6944
6974
  let e = !1;
6945
- X.state.doc.descendants((t) => {
6975
+ Y.state.doc.descendants((t) => {
6946
6976
  t.type.name === "heading" && (e = !0);
6947
- }), Xe(e);
6977
+ }), et(e);
6948
6978
  };
6949
- return e(), X.on("update", e), () => {
6950
- X.off("update", e);
6979
+ return e(), Y.on("update", e), () => {
6980
+ Y.off("update", e);
6951
6981
  };
6952
- }, [X]);
6953
- let Ze = C(() => X?.storage?.characterCount?.characters?.() ?? 0, [X, qe]), $e = a ? Ze > a : !1;
6982
+ }, [Y]);
6983
+ let tt = C(() => Y?.storage?.characterCount?.characters?.() ?? 0, [Y, Xe]), nt = a ? tt > a : !1;
6954
6984
  x(() => () => {
6955
- Ce.current && clearTimeout(Ce.current);
6985
+ Te.current && clearTimeout(Te.current);
6956
6986
  }, []), x(() => () => {
6957
- de && de.resolve(null);
6987
+ pe && pe.resolve(null);
6958
6988
  }, []);
6959
- let et = b((e) => {
6960
- if (!X?.isEditable) return;
6989
+ let rt = b((e) => {
6990
+ if (!Y?.isEditable) return;
6961
6991
  let t = window.getSelection(), n;
6962
6992
  if (e) {
6963
6993
  let t = e.getBoundingClientRect();
@@ -6974,76 +7004,76 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
6974
7004
  width: e.width
6975
7005
  };
6976
7006
  } else {
6977
- let e = X.view.coordsAtPos(X.state.selection.from);
7007
+ let e = Y.view.coordsAtPos(Y.state.selection.from);
6978
7008
  n = {
6979
7009
  top: e.bottom,
6980
7010
  left: e.left,
6981
7011
  width: 0
6982
7012
  };
6983
7013
  }
6984
- De.current = n;
6985
- let r = we.current?.getBoundingClientRect(), i = Ci(n, void 0, {
7014
+ ke.current = n;
7015
+ let r = Ee.current?.getBoundingClientRect(), i = Ti(n, void 0, {
6986
7016
  panelWidth: r?.width,
6987
7017
  editorLeft: r?.left
6988
7018
  });
6989
7019
  M(!0), I(i.style), R(i.placement), ie(i.arrowLeft);
6990
- }, [X]);
7020
+ }, [Y]);
6991
7021
  x(() => {
6992
- if (!X) return;
6993
- let e = X.storage.qingwuUI;
7022
+ if (!Y) return;
7023
+ let e = Y.storage.qingwuUI;
6994
7024
  if (e) return e.openImageDialog = () => V(!0), e.openVideoDialog = () => ae(!0), e.chooseMd = (e, t) => {
6995
- fe({
7025
+ me({
6996
7026
  filename: e,
6997
7027
  resolve: t
6998
7028
  });
6999
- }, e.openAI = et, e.parseMd = (e, t) => X ? Ti(X, t) : null, () => {
7029
+ }, e.openAI = rt, e.parseMd = (e, t) => Y ? Di(Y, t) : null, () => {
7000
7030
  delete e.openImageDialog, delete e.openVideoDialog, delete e.openAI, delete e.parseMd, delete e.chooseMd;
7001
7031
  };
7002
- }, [X, et]), S(() => {
7003
- if (!j || !X) return;
7004
- let e = De.current;
7032
+ }, [Y, rt]), S(() => {
7033
+ if (!j || !Y) return;
7034
+ let e = ke.current;
7005
7035
  if (!e) return;
7006
- let t = z.current, n = we.current?.getBoundingClientRect(), r = Ci(e, t?.offsetHeight || void 0, {
7036
+ let t = z.current, n = Ee.current?.getBoundingClientRect(), r = Ti(e, t?.offsetHeight || void 0, {
7007
7037
  panelWidth: n?.width,
7008
7038
  editorLeft: n?.left
7009
7039
  });
7010
7040
  R(r.placement), ie(r.arrowLeft), I(r.style);
7011
- }, [j, X]), x(() => {
7012
- if (!j || !X) return;
7041
+ }, [j, Y]), x(() => {
7042
+ if (!j || !Y) return;
7013
7043
  let e = () => {
7014
- let e = De.current;
7044
+ let e = ke.current;
7015
7045
  if (!e) return;
7016
- let t = z.current, n = we.current?.getBoundingClientRect(), r = Ci(e, t?.offsetHeight || void 0, {
7046
+ let t = z.current, n = Ee.current?.getBoundingClientRect(), r = Ti(e, t?.offsetHeight || void 0, {
7017
7047
  panelWidth: n?.width,
7018
7048
  editorLeft: n?.left
7019
7049
  });
7020
7050
  R(r.placement), ie(r.arrowLeft), I(r.style);
7021
7051
  };
7022
7052
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
7023
- }, [j, X]), x(() => {
7024
- j || (De.current = null);
7053
+ }, [j, Y]), x(() => {
7054
+ j || (ke.current = null);
7025
7055
  }, [j]);
7026
- let tt = b((e) => {
7027
- X?.chain().focus().setImage({ src: e }).run();
7028
- }, [X]), nt = b((e) => {
7029
- (X?.commands).insertVideo?.({ src: e });
7030
- }, [X]), rt = pe && ye && !J && !Y, it = !rt && !he && (pe || Ye && !(!k && xe)), at = w(!1);
7056
+ let it = b((e) => {
7057
+ Y?.chain().focus().setImage({ src: e }).run();
7058
+ }, [Y]), at = b((e) => {
7059
+ (Y?.commands).insertVideo?.({ src: e });
7060
+ }, [Y]), ot = he && xe && !J && !Ie, lt = !ot && !_e && (he || Qe && !(!k && Ce)), ut = w(!1);
7031
7061
  return x(() => {
7032
- at.current || (at.current = !0, pe && !rt && ge(!0));
7033
- }, [pe, rt]), x(() => {
7034
- if (!he) return;
7062
+ ut.current || (ut.current = !0, he && !ot && ve(!0));
7063
+ }, [he, ot]), x(() => {
7064
+ if (!_e) return;
7035
7065
  let e = (e) => {
7036
7066
  let t = e.target;
7037
- Fe.current?.contains(t) || ge(!1);
7067
+ Re.current?.contains(t) || ve(!1);
7038
7068
  }, t = (e) => {
7039
- e.key === "Escape" && ge(!1);
7069
+ e.key === "Escape" && ve(!1);
7040
7070
  };
7041
7071
  return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("keydown", t), () => {
7042
7072
  document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e), document.removeEventListener("keydown", t);
7043
7073
  };
7044
- }, [he]), x(() => {
7045
- if (!X || !rt) return;
7046
- let e = ke.current;
7074
+ }, [_e]), x(() => {
7075
+ if (!Y || !ot) return;
7076
+ let e = je.current;
7047
7077
  if (!(e instanceof HTMLElement)) return;
7048
7078
  let t = (t) => {
7049
7079
  let n = t.deltaY;
@@ -7053,17 +7083,17 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7053
7083
  e.scrollTop += n, t.preventDefault(), t.stopPropagation();
7054
7084
  return;
7055
7085
  }
7056
- let a = st(X), o = a ? ot(a) : null;
7086
+ let a = ct(Y), o = a ? st(a) : null;
7057
7087
  if (o) {
7058
7088
  o.scrollTop += n, t.preventDefault(), t.stopPropagation();
7059
7089
  return;
7060
7090
  }
7061
7091
  };
7062
7092
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
7063
- }, [X, rt]), X ? /* @__PURE__ */ O("div", {
7093
+ }, [Y, ot]), Y ? /* @__PURE__ */ O("div", {
7064
7094
  className: "qingwu-editor-row",
7065
7095
  children: [/* @__PURE__ */ O("div", {
7066
- ref: we,
7096
+ ref: Ee,
7067
7097
  className: `qingwu-editor relative flex-1 min-w-0 bg-background ${k ? "qingwu-editor--readonly" : ""} ${l ? "" : "rounded-xl border border-default-200"} ${c}`,
7068
7098
  style: u,
7069
7099
  children: [
@@ -7074,13 +7104,13 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7074
7104
  children: [
7075
7105
  /* @__PURE__ */ D("button", {
7076
7106
  type: "button",
7077
- className: `qed-tb-btn qed-tb-btn--desktop-only${pe ? " is-active" : ""}`,
7107
+ className: `qed-tb-btn qed-tb-btn--desktop-only${he ? " is-active" : ""}`,
7078
7108
  onClick: () => {
7079
- pe ? (me(!1), ge(!1)) : (me(!0), ye && !J && !Y || ge(!0));
7109
+ he ? (ge(!1), ve(!1)) : (ge(!0), xe && !J && !Ie || ve(!0));
7080
7110
  },
7081
- title: pe ? "隐藏目录" : "显示目录",
7082
- "aria-label": pe ? "隐藏目录" : "显示目录",
7083
- "aria-pressed": pe,
7111
+ title: he ? "隐藏目录" : "显示目录",
7112
+ "aria-label": he ? "隐藏目录" : "显示目录",
7113
+ "aria-pressed": he,
7084
7114
  children: /* @__PURE__ */ D("svg", {
7085
7115
  fill: "none",
7086
7116
  viewBox: "0 0 24 24",
@@ -7096,11 +7126,11 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7096
7126
  }),
7097
7127
  h && /* @__PURE__ */ D("button", {
7098
7128
  type: "button",
7099
- className: `qed-tb-btn${_e ? " is-active" : ""}`,
7100
- onClick: () => ve(!_e),
7129
+ className: `qed-tb-btn${ye ? " is-active" : ""}`,
7130
+ onClick: () => be(!ye),
7101
7131
  title: "查找 (Ctrl+F)",
7102
7132
  "aria-label": "查找",
7103
- "aria-pressed": _e,
7133
+ "aria-pressed": ye,
7104
7134
  children: /* @__PURE__ */ D("svg", {
7105
7135
  fill: "none",
7106
7136
  viewBox: "0 0 24 24",
@@ -7117,7 +7147,7 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7117
7147
  !k && /* @__PURE__ */ D("button", {
7118
7148
  type: "button",
7119
7149
  className: `qed-tb-btn qed-tb-btn--ai${j ? " is-active" : ""}`,
7120
- onClick: (e) => j ? M(!1) : et(e.currentTarget),
7150
+ onClick: (e) => j ? M(!1) : rt(e.currentTarget),
7121
7151
  title: f("editor.toolbar.aiTitle"),
7122
7152
  "aria-label": f("editor.toolbar.ai"),
7123
7153
  "aria-pressed": j,
@@ -7166,7 +7196,7 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7166
7196
  /* @__PURE__ */ D("button", {
7167
7197
  type: "button",
7168
7198
  className: `qed-tb-btn${J ? " is-active" : ""}`,
7169
- onClick: Ie,
7199
+ onClick: ze,
7170
7200
  title: J ? "退出网页全屏" : "网页全屏",
7171
7201
  "aria-label": J ? "退出网页全屏" : "网页全屏",
7172
7202
  "aria-pressed": J,
@@ -7185,11 +7215,11 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7185
7215
  }),
7186
7216
  /* @__PURE__ */ D("button", {
7187
7217
  type: "button",
7188
- className: `qed-tb-btn${Y ? " is-active" : ""}`,
7189
- onClick: Le,
7190
- title: Y ? "退出全屏" : "全屏",
7191
- "aria-label": Y ? "退出全屏" : "全屏",
7192
- "aria-pressed": Y,
7218
+ className: `qed-tb-btn${Ie ? " is-active" : ""}`,
7219
+ onClick: Be,
7220
+ title: Ie ? "退出全屏" : "全屏",
7221
+ "aria-label": Ie ? "退出全屏" : "全屏",
7222
+ "aria-pressed": Ie,
7193
7223
  children: /* @__PURE__ */ D("svg", {
7194
7224
  fill: "none",
7195
7225
  viewBox: "0 0 24 24",
@@ -7206,8 +7236,8 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7206
7236
  ]
7207
7237
  })]
7208
7238
  }),
7209
- X && !k && X.isEditable && /* @__PURE__ */ D(te, {
7210
- editor: X,
7239
+ Y && !k && Y.isEditable && /* @__PURE__ */ D(te, {
7240
+ editor: Y,
7211
7241
  shouldShow: ({ editor: e, state: t }) => !(e.isActive("image") || e.isActive("videoEmbed") || e.isActive("codeBlock") || e.isActive("audioEmbed") || e.isActive("attachmentEmbed") || t.selection.empty),
7212
7242
  options: {
7213
7243
  placement: "bottom",
@@ -7216,17 +7246,17 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7216
7246
  },
7217
7247
  className: "bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg",
7218
7248
  children: /* @__PURE__ */ O("div", {
7219
- ref: Ae,
7249
+ ref: Me,
7220
7250
  className: "bubble-menu-items relative flex items-center gap-0.5",
7221
7251
  onPointerDown: (e) => {
7222
7252
  e.target.closest("button") && e.preventDefault();
7223
7253
  },
7224
7254
  children: [
7225
- Ue.map((e) => /* @__PURE__ */ D("button", {
7255
+ Ke.map((e) => /* @__PURE__ */ D("button", {
7226
7256
  type: "button",
7227
- className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(X) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
7257
+ className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(Y) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
7228
7258
  onClick: (t) => {
7229
- t.preventDefault(), Ge(e);
7259
+ t.preventDefault(), Je(e);
7230
7260
  },
7231
7261
  title: e.label,
7232
7262
  "aria-label": e.label,
@@ -7240,11 +7270,11 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7240
7270
  type: "button",
7241
7271
  className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${j ? "bg-primary/15 text-primary" : "text-primary hover:bg-primary/10"}`,
7242
7272
  onClick: (e) => {
7243
- e.preventDefault(), Me(!1), We?.command(X);
7273
+ e.preventDefault(), Pe(!1), qe?.command(Y);
7244
7274
  },
7245
- title: We?.label,
7246
- "aria-label": We?.label,
7247
- children: /* @__PURE__ */ D(Bt, {})
7275
+ title: qe?.label,
7276
+ "aria-label": qe?.label,
7277
+ children: /* @__PURE__ */ D(Vt, {})
7248
7278
  }),
7249
7279
  /* @__PURE__ */ D("span", {
7250
7280
  className: "w-px h-4 bg-default-200 mx-0.5 shrink-0",
@@ -7252,27 +7282,27 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7252
7282
  }),
7253
7283
  /* @__PURE__ */ D("button", {
7254
7284
  type: "button",
7255
- "aria-expanded": je,
7256
- className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${je ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
7285
+ "aria-expanded": Ne,
7286
+ className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${Ne ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
7257
7287
  onClick: (e) => {
7258
- e.preventDefault(), Me((e) => !e);
7288
+ e.preventDefault(), Pe((e) => !e);
7259
7289
  },
7260
7290
  title: f("editor.bubble.more"),
7261
7291
  "aria-label": f("editor.bubble.more"),
7262
- children: /* @__PURE__ */ D(Vt, {})
7292
+ children: /* @__PURE__ */ D(Ht, {})
7263
7293
  }),
7264
- je && /* @__PURE__ */ D("div", {
7294
+ Ne && /* @__PURE__ */ D("div", {
7265
7295
  role: "menu",
7266
7296
  className: "bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70vh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl",
7267
7297
  onPointerDown: (e) => {
7268
7298
  e.target.closest("button") && e.preventDefault();
7269
7299
  },
7270
- children: He.map((e) => /* @__PURE__ */ O("button", {
7300
+ children: Ge.map((e) => /* @__PURE__ */ O("button", {
7271
7301
  type: "button",
7272
7302
  role: "menuitem",
7273
- className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${Ke(e) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
7303
+ className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${Ye(e) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
7274
7304
  onClick: (t) => {
7275
- t.preventDefault(), Ge(e);
7305
+ t.preventDefault(), Je(e);
7276
7306
  },
7277
7307
  title: e.label,
7278
7308
  children: [/* @__PURE__ */ D("span", {
@@ -7287,29 +7317,30 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7287
7317
  ]
7288
7318
  })
7289
7319
  }),
7290
- X && K !== "none" && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7320
+ Y && K !== "none" && ne(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7291
7321
  className: "fixed inset-0 z-[9998]",
7292
7322
  onClick: () => q("none")
7293
7323
  }), /* @__PURE__ */ D("div", {
7324
+ ref: le,
7294
7325
  style: se,
7295
7326
  className: "bg-background border border-default-200 rounded-xl shadow-xl",
7296
7327
  onClick: (e) => e.stopPropagation(),
7297
7328
  children: K === "highlight" ? /* @__PURE__ */ O("div", {
7298
7329
  className: "flex items-center gap-1 p-1.5 flex-wrap",
7299
- children: [yi.map((e) => /* @__PURE__ */ D("button", {
7330
+ children: [xi.map((e) => /* @__PURE__ */ D("button", {
7300
7331
  type: "button",
7301
7332
  className: "w-5 h-5 rounded-full border border-default-200 hover:scale-110 transition-transform",
7302
7333
  style: { background: e.color },
7303
7334
  title: e.name,
7304
7335
  onClick: () => {
7305
- X.chain().focus().setHighlight({ color: e.color }).run(), q("none");
7336
+ Y.chain().focus().setHighlight({ color: e.color }).run(), q("none");
7306
7337
  }
7307
7338
  }, e.color)), /* @__PURE__ */ O("button", {
7308
7339
  type: "button",
7309
7340
  className: "w-5 h-5 rounded-full border border-default-200 text-default-500 hover:bg-default-100 flex items-center justify-center text-[10px]",
7310
7341
  title: "清除高亮",
7311
7342
  onClick: () => {
7312
- X.chain().focus().unsetHighlight().run(), q("none");
7343
+ Y.chain().focus().unsetHighlight().run(), q("none");
7313
7344
  },
7314
7345
  children: ["✕", " "]
7315
7346
  })]
@@ -7319,21 +7350,21 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7319
7350
  type: "url",
7320
7351
  className: "flex-1 px-2 py-1 text-xs rounded-md border border-default-200 bg-background focus:outline-none focus:border-primary",
7321
7352
  placeholder: "https://...",
7322
- value: le,
7323
- onChange: (e) => ue(e.target.value),
7353
+ value: de,
7354
+ onChange: (e) => fe(e.target.value),
7324
7355
  onKeyDown: (e) => {
7325
- e.key === "Enter" ? (le.trim() && X.chain().focus().setLink({ href: le.trim() }).run(), q("none")) : e.key === "Escape" && q("none");
7356
+ e.key === "Enter" ? (de.trim() && Y.chain().focus().setLink({ href: de.trim() }).run(), q("none")) : e.key === "Escape" && q("none");
7326
7357
  }
7327
7358
  }), /* @__PURE__ */ D("button", {
7328
7359
  type: "button",
7329
7360
  className: "px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90",
7330
7361
  onClick: () => {
7331
- le.trim() && X.chain().focus().setLink({ href: le.trim() }).run(), q("none");
7362
+ de.trim() && Y.chain().focus().setLink({ href: de.trim() }).run(), q("none");
7332
7363
  },
7333
7364
  children: "确定"
7334
7365
  })]
7335
7366
  })
7336
- })] }),
7367
+ })] }), document.body),
7337
7368
  !k && j && ne(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
7338
7369
  className: "fixed inset-0 z-[9998]",
7339
7370
  onClick: () => M(!1)
@@ -7347,76 +7378,76 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7347
7378
  className: "ai-panel__arrow",
7348
7379
  style: { left: `${re}%` },
7349
7380
  "aria-hidden": "true"
7350
- }), /* @__PURE__ */ D(on, {
7351
- editor: X,
7381
+ }), /* @__PURE__ */ D(sn, {
7382
+ editor: Y,
7352
7383
  onClose: () => M(!1)
7353
7384
  })]
7354
7385
  })] }), document.body),
7355
7386
  B && /* @__PURE__ */ D(v, {
7356
- fallback: /* @__PURE__ */ D(ji, {}),
7357
- children: /* @__PURE__ */ D(Ei, {
7387
+ fallback: /* @__PURE__ */ D(Ni, {}),
7388
+ children: /* @__PURE__ */ D(Oi, {
7358
7389
  open: B,
7359
7390
  onClose: () => V(!1),
7360
- onInsert: tt,
7361
- validate: (e) => X ? dn(X.state.doc, e, {
7391
+ onInsert: it,
7392
+ validate: (e) => Y ? fn(Y.state.doc, e, {
7362
7393
  maxAttachmentSize: o,
7363
7394
  maxTotalAttachmentSize: s
7364
7395
  }) : null
7365
7396
  })
7366
7397
  }),
7367
7398
  H && /* @__PURE__ */ D(v, {
7368
- fallback: /* @__PURE__ */ D(ji, {}),
7369
- children: /* @__PURE__ */ D(ki, {
7399
+ fallback: /* @__PURE__ */ D(Ni, {}),
7400
+ children: /* @__PURE__ */ D(ji, {
7370
7401
  open: H,
7371
7402
  onClose: () => ae(!1),
7372
- onInsert: nt
7403
+ onInsert: at
7373
7404
  })
7374
7405
  }),
7375
7406
  oe && /* @__PURE__ */ D(v, {
7376
- fallback: /* @__PURE__ */ D(ji, {}),
7377
- children: /* @__PURE__ */ D(Di, {
7407
+ fallback: /* @__PURE__ */ D(Ni, {}),
7408
+ children: /* @__PURE__ */ D(ki, {
7378
7409
  open: oe,
7379
7410
  onClose: () => U(!1)
7380
7411
  })
7381
7412
  }),
7382
7413
  W && /* @__PURE__ */ D(v, {
7383
- fallback: /* @__PURE__ */ D(ji, {}),
7384
- children: /* @__PURE__ */ D(Oi, {
7414
+ fallback: /* @__PURE__ */ D(Ni, {}),
7415
+ children: /* @__PURE__ */ D(Ai, {
7385
7416
  open: W,
7386
7417
  onClose: () => G(!1),
7387
- editor: X
7418
+ editor: Y
7388
7419
  })
7389
7420
  }),
7390
- de && /* @__PURE__ */ D(v, {
7391
- fallback: /* @__PURE__ */ D(ji, {}),
7392
- children: /* @__PURE__ */ D(Ai, {
7393
- open: !!de,
7394
- filename: de.filename,
7421
+ pe && /* @__PURE__ */ D(v, {
7422
+ fallback: /* @__PURE__ */ D(Ni, {}),
7423
+ children: /* @__PURE__ */ D(Mi, {
7424
+ open: !!pe,
7425
+ filename: pe.filename,
7395
7426
  onRender: () => {
7396
- de.resolve("render"), fe(null);
7427
+ pe.resolve("render"), me(null);
7397
7428
  },
7398
7429
  onAttach: () => {
7399
- de.resolve("attach"), fe(null);
7430
+ pe.resolve("attach"), me(null);
7400
7431
  },
7401
7432
  onClose: () => {
7402
- de.resolve(null), fe(null);
7433
+ pe.resolve(null), me(null);
7403
7434
  }
7404
7435
  })
7405
7436
  }),
7406
7437
  /* @__PURE__ */ D("div", {
7407
- ref: Te,
7438
+ ref: De,
7408
7439
  className: "flex editor-body",
7409
7440
  children: /* @__PURE__ */ O("div", {
7410
7441
  className: "relative min-w-0 flex-1",
7411
7442
  children: [
7412
- /* @__PURE__ */ D(P, { editor: X }),
7413
- !k && /* @__PURE__ */ D(vi, { editor: X }),
7443
+ /* @__PURE__ */ D(P, { editor: Y }),
7444
+ !k && /* @__PURE__ */ D(bi, { editor: Y }),
7414
7445
  /* @__PURE__ */ D("div", {
7415
- className: `${J || Y ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
7446
+ className: `${J || Ie ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
7416
7447
  children: /* @__PURE__ */ O("span", {
7417
- className: `text-xs ${$e ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && Ze > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
7448
+ className: `text-xs ${nt ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && tt > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
7418
7449
  children: [
7419
- Ze,
7450
+ tt,
7420
7451
  a ? ` / ${a}` : "",
7421
7452
  " 字"
7422
7453
  ]
@@ -7425,14 +7456,14 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7425
7456
  ]
7426
7457
  })
7427
7458
  }),
7428
- h && _e && /* @__PURE__ */ D(kt, {
7429
- editor: X,
7430
- onClose: () => ve(!1)
7459
+ h && ye && /* @__PURE__ */ D(At, {
7460
+ editor: Y,
7461
+ onClose: () => be(!1)
7431
7462
  }),
7432
- it && /* @__PURE__ */ D("button", {
7463
+ lt && /* @__PURE__ */ D("button", {
7433
7464
  type: "button",
7434
7465
  className: "qingwu-toc-fab",
7435
- onClick: () => ge(!0),
7466
+ onClick: () => ve(!0),
7436
7467
  title: "目录",
7437
7468
  "aria-label": "打开目录",
7438
7469
  children: /* @__PURE__ */ D("svg", {
@@ -7448,8 +7479,8 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7448
7479
  })
7449
7480
  })
7450
7481
  }),
7451
- he && ne(/* @__PURE__ */ O("div", {
7452
- ref: Fe,
7482
+ _e && ne(/* @__PURE__ */ O("div", {
7483
+ ref: Re,
7453
7484
  className: "qingwu-toc-drawer toc-scroll",
7454
7485
  "data-lenis-prevent": !0,
7455
7486
  children: [/* @__PURE__ */ O("div", {
@@ -7460,7 +7491,7 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7460
7491
  }), /* @__PURE__ */ D("button", {
7461
7492
  type: "button",
7462
7493
  className: "qed-drawer-head__close",
7463
- onClick: () => ge(!1),
7494
+ onClick: () => ve(!1),
7464
7495
  "aria-label": "关闭目录",
7465
7496
  children: /* @__PURE__ */ D("svg", {
7466
7497
  fill: "none",
@@ -7475,21 +7506,21 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7475
7506
  })
7476
7507
  })
7477
7508
  })]
7478
- }), /* @__PURE__ */ D(dt, {
7479
- editor: X,
7509
+ }), /* @__PURE__ */ D(ft, {
7510
+ editor: Y,
7480
7511
  className: "!p-3",
7481
7512
  onClose: () => {
7482
- ge(!1), me(!1);
7513
+ ve(!1), ge(!1);
7483
7514
  }
7484
7515
  })]
7485
7516
  }), document.body)
7486
7517
  ]
7487
- }), rt && ne(/* @__PURE__ */ D("aside", {
7488
- ref: ke,
7518
+ }), ot && ne(/* @__PURE__ */ D("aside", {
7519
+ ref: je,
7489
7520
  className: "qingwu-toc-desktop toc-scroll",
7490
- children: /* @__PURE__ */ D(dt, {
7491
- editor: X,
7492
- onClose: () => me(!1)
7521
+ children: /* @__PURE__ */ D(ft, {
7522
+ editor: Y,
7523
+ onClose: () => ge(!1)
7493
7524
  })
7494
7525
  }), document.body)]
7495
7526
  }) : /* @__PURE__ */ D("div", {
@@ -7499,7 +7530,7 @@ var Ei = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
7499
7530
  };
7500
7531
  //#endregion
7501
7532
  //#region src/editor/clipper/receiver-browser.ts
7502
- function Ni(e) {
7533
+ function Fi(e) {
7503
7534
  let t = async (t) => {
7504
7535
  let n = t.data;
7505
7536
  if (!n || typeof n != "object" || n.kind !== "qingwu-clip") return;
@@ -7516,7 +7547,7 @@ function Ni(e) {
7516
7547
  }
7517
7548
  //#endregion
7518
7549
  //#region src/editor/storage/providers/cos.ts
7519
- function Pi(e) {
7550
+ function Ii(e) {
7520
7551
  return g({
7521
7552
  endpoint: `https://cos.${e.region}.myqcloud.com`,
7522
7553
  bucket: e.bucket,
@@ -7530,7 +7561,7 @@ function Pi(e) {
7530
7561
  }
7531
7562
  //#endregion
7532
7563
  //#region src/editor/storage/providers/oss.ts
7533
- function Fi(e) {
7564
+ function Li(e) {
7534
7565
  return g({
7535
7566
  endpoint: `https://${e.bucket}.${e.region}.aliyuncs.com`,
7536
7567
  bucket: e.bucket,
@@ -7543,4 +7574,4 @@ function Fi(e) {
7543
7574
  });
7544
7575
  }
7545
7576
  //#endregion
7546
- export { er as CODE_LANGUAGES, or as CodeBlock, Ar as ImageUpload, et as ImageUploadDialog, Mi as QingWuAIEditor, ri as RelativeMedia, Dt as SearchHighlight, dt as TocPanel, qn as VideoEmbed, ft as buildSystemPrompt, mt as createAILanguageModelProvider, Pi as createCOSStorage, vt as createDeepSeekProvider, _ as createLocalStorage, Fi as createOSSStorage, _t as createOpenAICompatProvider, yt as createOpenAIProvider, bt as createQwenProvider, g as createS3Storage, ai as createSlashCommandExtension, h as escapeHtml, ln as formatBytes, gt as getAIProvider, fi as getBubbleMenuActions, oi as getDefaultSlashCommands, cn as getDocAttachmentTotal, ci as getEditorExtensions, u as getLocale, di as getSearchEngine, Ot as getSearchState, c as getStorageInfo, o as getStorageProvider, s as loadStorageConfig, r as registerS3PreviewConfig, d as sanitizeHtml, p as sanitizeSvg, ht as setAIProvider, _n as setConfirmProvider, l as setLocale, ui as setSearchEngine, i as setStorageProvider, Ze as setToastProvider, n as signPreviewUrlHeaders, Ni as startBrowserClipperReceiver, Qe as subscribeToast, f as t, m as tf, Z as toast, dn as validateAttachmentFile };
7577
+ export { tr as CODE_LANGUAGES, sr as CodeBlock, jr as ImageUpload, tt as ImageUploadDialog, Pi as QingWuAIEditor, ai as RelativeMedia, Ot as SearchHighlight, ft as TocPanel, Jn as VideoEmbed, pt as buildSystemPrompt, ht as createAILanguageModelProvider, Ii as createCOSStorage, yt as createDeepSeekProvider, _ as createLocalStorage, Li as createOSSStorage, vt as createOpenAICompatProvider, bt as createOpenAIProvider, xt as createQwenProvider, g as createS3Storage, si as createSlashCommandExtension, h as escapeHtml, un as formatBytes, _t as getAIProvider, mi as getBubbleMenuActions, ci as getDefaultSlashCommands, ln as getDocAttachmentTotal, ui as getEditorExtensions, u as getLocale, pi as getSearchEngine, kt as getSearchState, c as getStorageInfo, o as getStorageProvider, s as loadStorageConfig, r as registerS3PreviewConfig, d as sanitizeHtml, p as sanitizeSvg, gt as setAIProvider, vn as setConfirmProvider, l as setLocale, fi as setSearchEngine, i as setStorageProvider, Qe as setToastProvider, n as signPreviewUrlHeaders, Fi as startBrowserClipperReceiver, $e as subscribeToast, f as t, m as tf, Z as toast, fn as validateAttachmentFile };