zs_library 0.4.12 → 0.4.13

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.
Files changed (68) hide show
  1. package/dist/components/desktop/types.d.ts +1 -1
  2. package/dist/components/desktop/utils.d.ts +1 -0
  3. package/dist/components/index.d.ts +11 -0
  4. package/dist/index.d.ts +4 -1
  5. package/dist/index.js +4146 -12
  6. package/package.json +1 -6
  7. package/dist/components/desktop/config.js +0 -15
  8. package/dist/components/desktop/context/config/context.js +0 -14
  9. package/dist/components/desktop/context/config/hooks.js +0 -7
  10. package/dist/components/desktop/context/state/context.js +0 -221
  11. package/dist/components/desktop/context/state/hooks.js +0 -7
  12. package/dist/components/desktop/context-menu/index.js +0 -312
  13. package/dist/components/desktop/index.js +0 -40
  14. package/dist/components/desktop/items/group-item.js +0 -305
  15. package/dist/components/desktop/items/modal/group-item-modal.js +0 -158
  16. package/dist/components/desktop/items/modal/info-modal.js +0 -33
  17. package/dist/components/desktop/items/sortable-item.js +0 -120
  18. package/dist/components/desktop/sortable.js +0 -272
  19. package/dist/components/desktop/style.js +0 -18
  20. package/dist/components/desktop/theme.js +0 -32
  21. package/dist/components/desktop/utils.js +0 -15
  22. package/dist/components/dock/dock-desktop.js +0 -83
  23. package/dist/components/dock/dock-mobile.js +0 -69
  24. package/dist/components/dock/index.js +0 -24
  25. package/dist/components/dock/utils.js +0 -9
  26. package/dist/components/editor/editor.js +0 -199
  27. package/dist/components/editor/extensions/drag-handle/clipboard-serializer.js +0 -20
  28. package/dist/components/editor/extensions/drag-handle/index.js +0 -273
  29. package/dist/components/editor/extensions.js +0 -131
  30. package/dist/components/editor/generative/ai-completion-command.js +0 -59
  31. package/dist/components/editor/generative/ai-selector-commands.js +0 -78
  32. package/dist/components/editor/generative/ai-selector.js +0 -90
  33. package/dist/components/editor/generative/drag-handle.js +0 -70
  34. package/dist/components/editor/generative/generative-dropdown-menu.js +0 -55
  35. package/dist/components/editor/generative/generative-menu-switch.js +0 -59
  36. package/dist/components/editor/image-upload.js +0 -36
  37. package/dist/components/editor/index.js +0 -8
  38. package/dist/components/editor/lib/colors.js +0 -98
  39. package/dist/components/editor/lib/content.js +0 -8
  40. package/dist/components/editor/lib/nodes.js +0 -70
  41. package/dist/components/editor/lib/url-utils.js +0 -21
  42. package/dist/components/editor/preview.js +0 -12
  43. package/dist/components/editor/selectors/color-selector.js +0 -100
  44. package/dist/components/editor/selectors/link-selector.js +0 -82
  45. package/dist/components/editor/selectors/math-selector.js +0 -37
  46. package/dist/components/editor/selectors/node-selector.js +0 -56
  47. package/dist/components/editor/selectors/text-buttons.js +0 -75
  48. package/dist/components/editor/slash-command.js +0 -129
  49. package/dist/components/editor/ui/button.js +0 -44
  50. package/dist/components/editor/ui/command.js +0 -94
  51. package/dist/components/editor/ui/dialog.js +0 -68
  52. package/dist/components/editor/ui/dropdown-menu.js +0 -99
  53. package/dist/components/editor/ui/icons/crazy-spinner.js +0 -10
  54. package/dist/components/editor/ui/popover.js +0 -24
  55. package/dist/components/editor/ui/scroll-area.js +0 -39
  56. package/dist/components/editor/ui/separator.js +0 -25
  57. package/dist/components/editor/ui/tooltip.js +0 -25
  58. package/dist/components/md-editor/editor.js +0 -104
  59. package/dist/components/md-editor/i18n/index.js +0 -12
  60. package/dist/components/md-editor/i18n/zh_CN.js +0 -122
  61. package/dist/components/md-editor/index.js +0 -8
  62. package/dist/components/md-editor/preview.js +0 -81
  63. package/dist/components/md-editor/style.js +0 -267
  64. package/dist/components/md-editor/utils.js +0 -8
  65. package/dist/i18n/index.js +0 -23
  66. package/dist/i18n/locales/en-US.js +0 -30
  67. package/dist/i18n/locales/zh-CN.js +0 -30
  68. package/dist/node_modules/.pnpm/@tiptap_pm@2.11.5/node_modules/@tiptap/pm/view/dist/index.js +0 -3
package/dist/index.js CHANGED
@@ -1,15 +1,4149 @@
1
+ var Ut = Object.defineProperty;
2
+ var Xt = (r, e, o) => e in r ? Ut(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
3
+ var Ie = (r, e, o) => Xt(r, typeof e != "symbol" ? e + "" : e, o);
1
4
  import "./index.css";
2
- /* empty css */
3
- import "./i18n/index.js";
4
- import { default as f } from "./components/desktop/index.js";
5
- import { default as p } from "./components/md-editor/index.js";
6
- import { default as s } from "./components/md-editor/preview.js";
7
- import { default as l } from "./components/dock/index.js";
8
- import { default as x } from "./components/editor/index.js";
5
+ import Gt from "i18next";
6
+ import { initReactI18next as qt } from "react-i18next";
7
+ import { jsx as t, jsxs as d, Fragment as me } from "react/jsx-runtime";
8
+ import { cx as y, css as f } from "@emotion/css";
9
+ import * as G from "react";
10
+ import { createContext as Ze, useMemo as fe, useContext as Qe, useState as H, useRef as he, useEffect as ie, Fragment as Yt, forwardRef as Vt } from "react";
11
+ import Wt from "react-slick";
12
+ import { ReactSortable as ze } from "react-sortablejs";
13
+ import { AnimatePresence as Ee, motion as R, useMotionValue as Kt, useTransform as xe, useSpring as Se } from "framer-motion";
14
+ import { useLocalStorageState as Jt, useDebounceEffect as Zt } from "ahooks";
15
+ import { v4 as Ye } from "uuid";
16
+ import et from "rc-tooltip";
17
+ import { RiPencilRuler2Line as Qt, RiShareLine as eo, RiInformationLine as to, RiCloseCircleLine as oo, RiArrowUpDownLine as ro, RiArrowLeftRightLine as no, RiArrowRightLine as ao, RiArrowLeftLine as so, RiCloseLine as io, RiZoomOutLine as lo, RiZoomInLine as co, RiClockwise2Line as mo, RiAnticlockwise2Line as uo, RiMoreLine as po, RiArrowDropDownLine as tt, RiCheckLine as ye, RiLink as go, RiDeleteBinLine as ot, RiText as rt, RiH1 as nt, RiH2 as at, RiH3 as st, RiListCheck as it, RiListUnordered as lt, RiListOrdered as ct, RiQuoteText as dt, RiCodeLine as mt, RiSparklingFill as $e, RiImageLine as fo, RiArrowRightSLine as ho, RiRepeatLine as bo, RiFileCopyLine as xo, RiAddLine as yo, RiDraggable as vo } from "@remixicon/react";
18
+ import ut from "rc-dialog";
19
+ import ko from "react-json-view";
20
+ import { AdmonitionDirectiveDescriptor as Co, MDXEditor as wo, toolbarPlugin as No, diffSourcePlugin as Io, listsPlugin as So, quotePlugin as To, headingsPlugin as Mo, linkPlugin as Lo, linkDialogPlugin as Ao, imagePlugin as Ro, tablePlugin as Do, thematicBreakPlugin as Po, frontmatterPlugin as Bo, codeBlockPlugin as zo, codeMirrorPlugin as Eo, markdownShortcutPlugin as $o, directivesPlugin as Ho, DiffSourceToggleWrapper as Oo, UndoRedo as Fo, Separator as le, BoldItalicUnderlineToggles as _o, CodeToggle as jo, StrikeThroughSupSubToggles as Uo, ListsToggle as Xo, CreateLink as Go, InsertImage as qo, InsertTable as Yo, InsertThematicBreak as Vo, InsertCodeBlock as Wo, InsertFrontmatter as Ko } from "@mdxeditor/editor";
21
+ import pt from "react-markdown";
22
+ import Jo from "remark-gfm";
23
+ import Zo from "remark-emoji";
24
+ import Qo from "rehype-raw";
25
+ import { Prism as er } from "react-syntax-highlighter";
26
+ import { oneLight as tr } from "react-syntax-highlighter/dist/esm/styles/prism";
27
+ import or from "rc-image";
28
+ import { clsx as rr } from "clsx";
29
+ import { twMerge as nr } from "tailwind-merge";
30
+ import { Placeholder as ar, TiptapLink as sr, TiptapImage as ir, UploadImagesPlugin as lr, UpdatedImage as cr, TaskList as dr, TaskItem as mr, HorizontalRule as ur, StarterKit as pr, CodeBlockLowlight as gr, Mathematics as fr, CharacterCount as hr, AIHighlight as br, TiptapUnderline as xr, HighlightExtension as yr, TextStyle as vr, Color as kr, CustomKeymap as Cr, useEditor as Q, EditorBubbleItem as Le, getPrevText as wr, addAIHighlight as Nr, removeAIHighlight as Ir, EditorBubble as Sr, createImageUpload as gt, Command as Tr, createSuggestionItems as Mr, renderItems as Lr, EditorRoot as Ar, EditorContent as Rr, handleImageDrop as Dr, handleImagePaste as Pr, handleCommandNavigation as Br, EditorCommand as zr, EditorCommandEmpty as Er, EditorCommandList as $r, EditorCommandItem as Hr, ImageResizer as Or } from "novel";
31
+ import { useDebouncedCallback as Fr } from "use-debounce";
32
+ import { Markdown as _r } from "tiptap-markdown";
33
+ import { cx as q, cva as jr } from "class-variance-authority";
34
+ import { createLowlight as Ur, common as Xr } from "lowlight";
35
+ import { Extension as Gr } from "@tiptap/core";
36
+ import { Plugin as qr, PluginKey as Yr, NodeSelection as K, TextSelection as Vr } from "prosemirror-state";
37
+ import { Slice as Wr, Fragment as Kr } from "prosemirror-model";
38
+ import * as Jr from "prosemirror-view";
39
+ import * as ve from "@radix-ui/react-popover";
40
+ import { Popover as ft, PopoverTrigger as Zr } from "@radix-ui/react-popover";
41
+ import { Slot as Qr } from "@radix-ui/react-slot";
42
+ import { SigmaIcon as en, X as tn, Check as on, TextQuote as rn, TrashIcon as nn, RefreshCcwDot as an, CheckCheck as sn, ArrowDownWideNarrow as ln, WrapText as cn, StepForward as dn, ArrowUp as mn, BoldIcon as un, ItalicIcon as pn, UnderlineIcon as gn, StrikethroughIcon as fn, CodeIcon as hn } from "lucide-react";
43
+ import * as ht from "@radix-ui/react-separator";
44
+ import { useCompletion as bn } from "@ai-sdk/react";
45
+ import { toast as ke } from "sonner";
46
+ import * as ce from "@radix-ui/react-scroll-area";
47
+ import { Command as V } from "cmdk";
48
+ import * as te from "@radix-ui/react-dialog";
49
+ import xn from "highlight.js";
50
+ import yn from "rc-dropdown";
51
+ import Te from "rc-menu";
52
+ import { generateHTML as vn } from "@tiptap/html";
53
+ function kn(r, e) {
54
+ for (var o = 0; o < e.length; o++) {
55
+ const a = e[o];
56
+ if (typeof a != "string" && !Array.isArray(a)) {
57
+ for (const n in a)
58
+ if (n !== "default" && !(n in r)) {
59
+ const s = Object.getOwnPropertyDescriptor(a, n);
60
+ s && Object.defineProperty(r, n, s.get ? s : {
61
+ enumerable: !0,
62
+ get: () => a[n]
63
+ });
64
+ }
65
+ }
66
+ }
67
+ return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
68
+ }
69
+ const Cn = {
70
+ common: {
71
+ ok: "确定",
72
+ cancel: "取消",
73
+ confirm: "确认",
74
+ loading: "加载中...",
75
+ noData: "暂无数据",
76
+ edit: "编辑",
77
+ delete: "删除",
78
+ save: "保存"
79
+ },
80
+ desktop: {
81
+ maximize: "最大化",
82
+ minimize: "最小化",
83
+ restore: "还原",
84
+ close: "关闭"
85
+ },
86
+ editor: {
87
+ placeholder: "请输入内容...",
88
+ bold: "加粗",
89
+ italic: "斜体",
90
+ code: "代码",
91
+ link: "链接",
92
+ image: "图片"
93
+ }
94
+ }, wn = {
95
+ common: {
96
+ ok: "OK",
97
+ cancel: "Cancel",
98
+ confirm: "Confirm",
99
+ loading: "Loading...",
100
+ noData: "No Data",
101
+ edit: "Edit",
102
+ delete: "Delete",
103
+ save: "Save"
104
+ },
105
+ desktop: {
106
+ maximize: "Maximize",
107
+ minimize: "Minimize",
108
+ restore: "Restore",
109
+ close: "Close"
110
+ },
111
+ editor: {
112
+ placeholder: "Please enter content...",
113
+ bold: "Bold",
114
+ italic: "Italic",
115
+ code: "Code",
116
+ link: "Link",
117
+ image: "Image"
118
+ }
119
+ }, Nn = "common";
120
+ Gt.use(qt).init({
121
+ resources: {
122
+ "zh-CN": Cn,
123
+ "en-US": wn
124
+ },
125
+ lng: "zh-CN",
126
+ fallbackLng: "zh-CN",
127
+ defaultNS: Nn,
128
+ interpolation: {
129
+ escapeValue: !1
130
+ }
131
+ });
132
+ const He = {
133
+ token: {
134
+ itemNameColor: "#1a1a1a",
135
+ itemIconBackgroundColor: "white",
136
+ itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
137
+ groupItemIconBackgroundColor: "rgba(255, 255, 255, 0.1)",
138
+ groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
139
+ groupItemModalBackgroundColor: "rgba(255, 255, 255, 0.8)",
140
+ contextMenuTextColor: "black",
141
+ contextMenuActiveColor: "#f3f4f6",
142
+ contextMenuBackgroundColor: "white",
143
+ contextMenuShadowColor: "rgba(0, 0, 0, 0.1)"
144
+ }
145
+ }, Oe = {
146
+ token: {
147
+ itemNameColor: "white",
148
+ itemIconBackgroundColor: "#1f2937",
149
+ itemIconShadowColor: "rgba(0, 0, 0, 0.1)",
150
+ groupItemIconBackgroundColor: "rgba(0, 0, 0, 0.1)",
151
+ groupItemIconShadowColor: "rgba(0, 0, 0, 0.1)",
152
+ groupItemModalBackgroundColor: "rgba(0, 0, 0, 0.1)",
153
+ contextMenuTextColor: "white",
154
+ contextMenuActiveColor: "#1a1a1a",
155
+ contextMenuBackgroundColor: "#1a1a1a",
156
+ contextMenuShadowColor: "rgba(255, 255, 255, 0.1)"
157
+ }
158
+ }, bt = Ze(
159
+ {}
160
+ ), xt = (r) => {
161
+ const { children: e, theme: o, ...a } = r, n = fe(() => o === "light" ? He : o === "dark" ? Oe : o, [o]);
162
+ return /* @__PURE__ */ t(bt.Provider, { value: { theme: n, ...a }, children: e });
163
+ }, ue = () => Qe(bt), Fe = {
164
+ maxRow: 2,
165
+ maxCol: 2
166
+ }, yt = {
167
+ ...Fe
168
+ }, _e = {
169
+ app: Fe,
170
+ group: yt
171
+ };
172
+ class Y {
173
+ }
174
+ /** 清理重复id */
175
+ Ie(Y, "uniqueArray", (e) => e.reduce((o, a) => o.find((s) => s.id === a.id) ? o : o.concat([a]), [])), Ie(Y, "getTheme", (e) => {
176
+ const o = He.token, a = Oe.token, n = { ...o, ...e == null ? void 0 : e.token }, s = { ...a, ...e == null ? void 0 : e.token };
177
+ return { light: n, dark: s };
178
+ }), Ie(Y, "quickJSONCheck", (e) => {
179
+ if (typeof e != "string" || e.trim() === "") return !1;
180
+ if (!/^\s*(\{.*\}|\[.*\])\s*$/.test(e))
181
+ return /^\s*(".*?"|[\d.]+|true|false|null)\s*$/.test(e);
182
+ try {
183
+ return new Function(`return ${e.replace(/"/g, '\\"')}`)(), !0;
184
+ } catch {
185
+ return !1;
186
+ }
187
+ });
188
+ const vt = Ze({
189
+ list: [],
190
+ setList: () => {
191
+ },
192
+ contextMenu: null,
193
+ setContextMenu: () => {
194
+ },
195
+ listStatus: null,
196
+ setListStatus: () => {
197
+ },
198
+ contextMenuFuns: () => {
199
+ },
200
+ hideContextMenu: () => {
201
+ },
202
+ showInfoItemData: null,
203
+ setShowInfoItemData: () => {
204
+ },
205
+ openGroupItemData: null,
206
+ setOpenGroupItemData: () => {
207
+ },
208
+ longPressTriggered: !1,
209
+ updateItem: () => {
210
+ },
211
+ updateItemConfig: () => {
212
+ },
213
+ removeItem: () => {
214
+ },
215
+ addItem: () => {
216
+ },
217
+ moveItemId: null,
218
+ setMoveItemId: () => {
219
+ },
220
+ moveTargetId: null,
221
+ setMoveTargetId: () => {
222
+ }
223
+ }), kt = (r) => {
224
+ const {
225
+ children: e,
226
+ list: o = [],
227
+ onChange: a,
228
+ storageKey: n = "ZS_LIBRARY_DESKTOP_SORTABLE_CONFIG",
229
+ enableCaching: s = !0
230
+ } = r, [i, m] = H(), [p, C] = H(), [l, c] = H(null), b = he(l), [x, A] = H(null), [h, g] = H([]), [N, v] = H(
231
+ null
232
+ ), [I, u] = H(
233
+ null
234
+ ), [T, D] = H(!1), [w, k] = H(null), [U, Z] = H(
235
+ null
236
+ ), [_, ae] = H(!1), [oe, S] = Jt(n, {
237
+ defaultValue: [],
238
+ listenStorageChange: !0
239
+ }), O = () => {
240
+ A(null), clearTimeout(i), m(void 0), b.current = null;
241
+ }, B = (M, X) => {
242
+ A({ ...M, pageX: M.pageX, pageY: M.pageY, data: X }), clearTimeout(i);
243
+ }, W = (M, X = !0) => {
244
+ const { config: F = {} } = M;
245
+ return F.allowContextMenu === !1 ? {} : {
246
+ onMouseDown: (E) => {
247
+ m(
248
+ setTimeout(() => {
249
+ X && b.current === null && B(E, M);
250
+ }, 800)
251
+ ), D(!1), C(
252
+ setTimeout(() => {
253
+ D(!0);
254
+ }, 800)
255
+ );
256
+ },
257
+ onMouseUp: () => {
258
+ clearTimeout(p), C(void 0), clearTimeout(i), m(void 0);
259
+ },
260
+ onContextMenu: (E) => {
261
+ X && (E.preventDefault(), B(E, M));
262
+ }
263
+ };
264
+ }, re = (M, X) => {
265
+ const F = [...X || []];
266
+ if (F.length > 0)
267
+ g((E) => {
268
+ const P = [...E], z = (L) => {
269
+ var Ge, qe;
270
+ const $ = F.shift(), j = L.find((ne) => ne.id === $), ee = L.findIndex((ne) => ne.id === $);
271
+ if (F.length && j) {
272
+ if (((Ge = j.children) == null ? void 0 : Ge.filter(
273
+ (ne) => !M.some((jt) => jt.id === ne.id)
274
+ ).length) === 1 && M.length === 1) {
275
+ const ne = { ...M[0] };
276
+ return L.splice(ee, 1, ne), a == null || a(L), L;
277
+ }
278
+ return j.children = z(j.children || []), L.splice(ee, 1, j), a == null || a(L), L;
279
+ }
280
+ if (j) {
281
+ if (!((qe = j.children) != null && qe.length) && M.length) {
282
+ const ne = { ...j };
283
+ return j.data = { name: "文件夹" }, j.type = "group", j.children = [ne, ...M], j.id = Ye(), L.splice(ee, 1, j), a == null || a(L), L;
284
+ }
285
+ return j.children = Y.uniqueArray(M), L.splice(ee, 1, j), a == null || a(L), L;
286
+ }
287
+ return Y.uniqueArray(M);
288
+ };
289
+ return Y.uniqueArray(z(P));
290
+ });
291
+ else {
292
+ const E = Y.uniqueArray(M);
293
+ a == null || a(E), g(E);
294
+ }
295
+ }, Re = (M, X) => {
296
+ g((F) => {
297
+ const E = [...F], P = (z) => {
298
+ var L;
299
+ for (let $ = 0; $ < z.length; $++)
300
+ if (z[$].id === M) {
301
+ z[$].config = X;
302
+ break;
303
+ } else ((L = z[$].children) == null ? void 0 : L.length) !== void 0 && P(z[$].children);
304
+ };
305
+ return P(E), a == null || a(E), E;
306
+ });
307
+ }, we = (M, X) => {
308
+ g((F) => {
309
+ const E = [...F], P = (z) => {
310
+ var L;
311
+ for (let $ = 0; $ < z.length; $++)
312
+ if (z[$].id === M) {
313
+ z[$].data = X;
314
+ break;
315
+ } else ((L = z[$].children) == null ? void 0 : L.length) !== void 0 && P(z[$].children);
316
+ };
317
+ return P(E), a == null || a(E), E;
318
+ });
319
+ }, Ne = (M) => {
320
+ g((X) => {
321
+ const F = [...X], E = (P) => {
322
+ var z;
323
+ for (let L = 0; L < P.length; L++)
324
+ if (P[L].id === M) {
325
+ P.splice(L, 1);
326
+ break;
327
+ } else ((z = P[L].children) == null ? void 0 : z.length) !== void 0 && E(P[L].children);
328
+ };
329
+ return E(F), a == null || a(F), F;
330
+ });
331
+ }, se = (M, X) => {
332
+ const F = [...h], E = (P, z) => {
333
+ const L = z.shift(), $ = P.find((ee) => ee.id === L), j = P.findIndex((ee) => ee.id === L);
334
+ if ($) {
335
+ if (z.length)
336
+ $.children = E($.children || [], z);
337
+ else {
338
+ const ee = (M == null ? void 0 : M.type) ?? "app";
339
+ $.children = [
340
+ ...$.children ?? [],
341
+ {
342
+ ...M,
343
+ id: Ye(),
344
+ config: (M == null ? void 0 : M.config) ?? _e[ee]
345
+ }
346
+ ];
347
+ }
348
+ return P.splice(j, 1, $), P;
349
+ } else
350
+ return P;
351
+ };
352
+ g(E(F, X));
353
+ };
354
+ return ie(() => {
355
+ (o == null ? void 0 : o.length) > 0 && h.length === 0 && re(o);
356
+ }, [o]), ie(() => {
357
+ b.current = l, l !== null && O();
358
+ }, [l]), ie(() => {
359
+ s && oe != null && oe.length && !_ && (re(oe), ae(!0));
360
+ }, [oe, _, s]), Zt(
361
+ () => {
362
+ s && S(h);
363
+ },
364
+ [h, s],
365
+ {
366
+ wait: 1e3
367
+ }
368
+ ), /* @__PURE__ */ t(
369
+ vt.Provider,
370
+ {
371
+ value: {
372
+ list: h,
373
+ setList: re,
374
+ contextMenu: x,
375
+ setContextMenu: A,
376
+ listStatus: l,
377
+ setListStatus: c,
378
+ contextMenuFuns: W,
379
+ hideContextMenu: O,
380
+ showInfoItemData: N,
381
+ setShowInfoItemData: v,
382
+ openGroupItemData: I,
383
+ setOpenGroupItemData: u,
384
+ longPressTriggered: T,
385
+ updateItemConfig: Re,
386
+ updateItem: we,
387
+ removeItem: Ne,
388
+ addItem: se,
389
+ moveItemId: w,
390
+ setMoveItemId: k,
391
+ moveTargetId: U,
392
+ setMoveTargetId: Z
393
+ },
394
+ children: e
395
+ }
396
+ );
397
+ }, be = () => Qe(vt), In = {
398
+ menuShow: {
399
+ opacity: 1,
400
+ y: 0,
401
+ transition: { type: "spring", stiffness: 300, damping: 24 }
402
+ },
403
+ menuHide: { opacity: 0, y: 20, transition: { duration: 0.2 } }
404
+ }, De = (r) => {
405
+ const { icon: e, title: o, onClick: a } = r, { theme: n } = ue(), { light: s, dark: i } = Y.getTheme(n);
406
+ return /* @__PURE__ */ t(
407
+ R.div,
408
+ {
409
+ className: f`
410
+ &:hover {
411
+ background-color: ${s.contextMenuActiveColor};
412
+ @media (prefers-color-scheme: dark) {
413
+ background-color: ${i.contextMenuActiveColor};
414
+ }
415
+ }
416
+ @media (prefers-color-scheme: dark) {
417
+ color: black;
418
+ }
419
+ font-size: 0.75rem;
420
+ line-height: 1rem;
421
+ cursor: pointer;
422
+ transition: all 0.3s;
423
+ user-select: none;
424
+ border-radius: 0.5rem;
425
+ `,
426
+ onClick: (m) => {
427
+ m.stopPropagation(), a == null || a();
428
+ },
429
+ variants: In,
430
+ children: /* @__PURE__ */ d(
431
+ R.div,
432
+ {
433
+ className: y(
434
+ "py-1.5 px-3 rounded-lg",
435
+ f`
436
+ padding-top: 0.375rem;
437
+ padding-bottom: 0.375rem;
438
+ padding-left: 0.75rem;
439
+ padding-right: 0.75rem;
440
+ border-radius: 0.5rem;
441
+ `
442
+ ),
443
+ whileTap: { scale: 0.9 },
444
+ children: [
445
+ /* @__PURE__ */ t(
446
+ R.div,
447
+ {
448
+ className: y(
449
+ f`
450
+ margin-bottom: 0.375rem;
451
+ display: flex;
452
+ justify-content: center;
453
+ `
454
+ ),
455
+ children: e
456
+ }
457
+ ),
458
+ /* @__PURE__ */ t(R.div, { children: o })
459
+ ]
460
+ }
461
+ )
462
+ }
463
+ );
464
+ }, Sn = (r) => {
465
+ const {
466
+ showInfoButton: e = !0,
467
+ showRemoveButton: o = !0,
468
+ showShareButton: a = !0,
469
+ showSizeButton: n = !0,
470
+ onInfoClick: s,
471
+ onShareClick: i,
472
+ onRemoveClick: m
473
+ } = r, {
474
+ contextMenu: p,
475
+ setContextMenu: C,
476
+ hideContextMenu: l,
477
+ setShowInfoItemData: c,
478
+ removeItem: b,
479
+ updateItemConfig: x
480
+ } = be(), { theme: A } = ue(), { light: h, dark: g } = Y.getTheme(A), { data: N } = p ?? {}, { config: v = {} } = N ?? {}, I = () => {
481
+ var D;
482
+ const u = _e[(D = p == null ? void 0 : p.data) == null ? void 0 : D.type], T = [];
483
+ for (let w = 1; w <= ((u == null ? void 0 : u.maxRow) ?? 2); w++)
484
+ for (let k = 1; k <= ((u == null ? void 0 : u.maxCol) ?? 2); k++)
485
+ T.push(`${w}x${k}`);
486
+ return T;
487
+ };
488
+ return /* @__PURE__ */ t(Ee, { children: p && /* @__PURE__ */ d(
489
+ R.div,
490
+ {
491
+ initial: { opacity: 0 },
492
+ animate: { opacity: 1 },
493
+ exit: { opacity: 0 },
494
+ onMouseDown: (u) => {
495
+ u.stopPropagation(), u.preventDefault();
496
+ },
497
+ children: [
498
+ /* @__PURE__ */ t(
499
+ R.div,
500
+ {
501
+ className: y(
502
+ f`
503
+ border-radius: 0.5rem;
504
+ overflow: hidden;
505
+ background-color: ${h.contextMenuBackgroundColor};
506
+ box-shadow: 0 0 0.5rem ${h.contextMenuShadowColor};
507
+ @media (prefers-color-scheme: dark) {
508
+ background-color: ${g.contextMenuBackgroundColor};
509
+ box-shadow: 0 0 0.5rem ${g.contextMenuShadowColor};
510
+ }
511
+ `
512
+ ),
513
+ children: n && v.allowResize !== !1 && /* @__PURE__ */ t(
514
+ R.ul,
515
+ {
516
+ className: f`
517
+ background-color: white;
518
+ padding: 0.25rem;
519
+ margin: 0;
520
+ `,
521
+ children: [
522
+ {
523
+ label: "修改大小",
524
+ key: "size",
525
+ icon: /* @__PURE__ */ t(Qt, { size: 14 }),
526
+ items: I().map((u) => ({
527
+ label: u,
528
+ key: u,
529
+ onClick: () => {
530
+ const [T, D] = u.split("x").map(Number);
531
+ x(p.data.id, {
532
+ row: T,
533
+ col: D
534
+ });
535
+ }
536
+ }))
537
+ }
538
+ ].map((u) => /* @__PURE__ */ d(
539
+ R.li,
540
+ {
541
+ className: f`
542
+ padding-top: 0.5rem;
543
+ padding-bottom: 0.5rem;
544
+ padding-left: 0.75rem;
545
+ padding-right: 0.75rem;
546
+ `,
547
+ children: [
548
+ /* @__PURE__ */ d(
549
+ R.p,
550
+ {
551
+ className: f`
552
+ display: flex;
553
+ align-items: center;
554
+ font-size: 0.875rem;
555
+ line-height: 1.25rem;
556
+ gap: 0.5rem;
557
+ padding-bottom: 0.5rem;
558
+ margin: 0;
559
+ `,
560
+ children: [
561
+ u.icon,
562
+ " ",
563
+ u.label
564
+ ]
565
+ }
566
+ ),
567
+ /* @__PURE__ */ t(
568
+ R.div,
569
+ {
570
+ className: f`
571
+ display: grid;
572
+ grid-template-columns: repeat(2, minmax(0, 1fr));
573
+ gap: 0.25rem;
574
+ `,
575
+ children: u.items.map((T) => /* @__PURE__ */ t(
576
+ R.div,
577
+ {
578
+ className: y(
579
+ "py-1 px-2 hover:bg-gray-100 rounded transition-all cursor-pointer text-center text-sm",
580
+ f`
581
+ padding-top: 0.25rem;
582
+ padding-bottom: 0.25rem;
583
+ padding-left: 0.5rem;
584
+ padding-right: 0.5rem;
585
+ border-radius: 0.25rem;
586
+ transition: all 0.3s;
587
+ font-size: 0.875rem;
588
+ line-height: 1.25rem;
589
+ cursor: pointer;
590
+ text-align: center;
591
+ color: ${h.contextMenuTextColor};
592
+ @media (prefers-color-scheme: dark) {
593
+ color: ${g.contextMenuTextColor};
594
+ }
595
+ &:hover {
596
+ background-color: ${h.contextMenuActiveColor};
597
+ @media (prefers-color-scheme: dark) {
598
+ background-color: ${g.contextMenuActiveColor};
599
+ }
600
+ }
601
+ `,
602
+ `${v.row}x${v.col}` === T.key && f`
603
+ background-color: ${h.contextMenuActiveColor};
604
+ @media (prefers-color-scheme: dark) {
605
+ background-color: ${g.contextMenuActiveColor};
606
+ }
607
+ `
608
+ ),
609
+ onClick: T.onClick,
610
+ children: T.label
611
+ },
612
+ T.key
613
+ ))
614
+ }
615
+ )
616
+ ]
617
+ },
618
+ u.key
619
+ ))
620
+ }
621
+ )
622
+ }
623
+ ),
624
+ /* @__PURE__ */ d(
625
+ R.div,
626
+ {
627
+ className: y(
628
+ f`
629
+ background-color: ${h.contextMenuBackgroundColor};
630
+ box-shadow: 0 0 0.5rem ${h.contextMenuShadowColor};
631
+ @media (prefers-color-scheme: dark) {
632
+ background-color: ${g.contextMenuBackgroundColor};
633
+ box-shadow: 0 0 0.5rem ${g.contextMenuShadowColor};
634
+ }
635
+ display: flex;
636
+ justify-content: space-around;
637
+ align-items: center;
638
+ margin-top: 0.5rem;
639
+ border-radius: 0.5rem;
640
+ overflow: hidden;
641
+ padding: 0.25rem;
642
+ `
643
+ ),
644
+ children: [
645
+ a && /* @__PURE__ */ t(
646
+ De,
647
+ {
648
+ icon: /* @__PURE__ */ t(eo, { size: 20 }),
649
+ title: "分享",
650
+ onClick: () => {
651
+ if (i) {
652
+ i(p.data);
653
+ return;
654
+ }
655
+ }
656
+ }
657
+ ),
658
+ e && /* @__PURE__ */ t(
659
+ De,
660
+ {
661
+ icon: /* @__PURE__ */ t(to, { size: 20 }),
662
+ title: "信息",
663
+ onClick: () => {
664
+ if (s) {
665
+ s(p.data);
666
+ return;
667
+ }
668
+ c({
669
+ ...p.data,
670
+ pageX: p.pageX,
671
+ pageY: p.pageY
672
+ }), l();
673
+ }
674
+ }
675
+ ),
676
+ o && /* @__PURE__ */ t(
677
+ De,
678
+ {
679
+ icon: /* @__PURE__ */ t(oo, { size: 20 }),
680
+ title: "移除",
681
+ onClick: () => {
682
+ if (m) {
683
+ m(p.data, b);
684
+ return;
685
+ }
686
+ C(null), b(p.data.id);
687
+ }
688
+ }
689
+ )
690
+ ]
691
+ }
692
+ )
693
+ ]
694
+ }
695
+ ) });
696
+ }, Tn = (r) => {
697
+ const { data: e, noLetters: o = !1 } = r, { contextMenuFuns: a } = be(), { itemIconBuilder: n, theme: s, contextMenu: i } = ue(), { light: m, dark: p } = Y.getTheme(s), { data: C = {} } = e, { name: l } = C;
698
+ return /* @__PURE__ */ d(me, { children: [
699
+ /* @__PURE__ */ t(
700
+ R.div,
701
+ {
702
+ className: f`
703
+ width: 4rem;
704
+ height: 4rem;
705
+ background-color: ${m.itemIconBackgroundColor};
706
+ border-radius: 0.75rem;
707
+ box-shadow: 0 0 0.5rem ${m.itemIconShadowColor};
708
+ cursor: pointer;
709
+ position: relative;
710
+ overflow: hidden;
711
+ @media (prefers-color-scheme: dark) {
712
+ background-color: ${p.itemIconBackgroundColor};
713
+ box-shadow: 0 0 0.5rem ${p.itemIconShadowColor};
714
+ }
715
+ `,
716
+ whileTap: { scale: 0.9 },
717
+ children: /* @__PURE__ */ t(
718
+ "div",
719
+ {
720
+ className: f`
721
+ position: absolute;
722
+ left: 0;
723
+ top: 0;
724
+ width: 100%;
725
+ height: 100%;
726
+ color: ${m.itemNameColor};
727
+ @media (prefers-color-scheme: dark) {
728
+ color: ${p.itemNameColor};
729
+ }
730
+ `,
731
+ ...a(e, i !== !1),
732
+ children: n == null ? void 0 : n(e)
733
+ }
734
+ )
735
+ }
736
+ ),
737
+ /* @__PURE__ */ t(
738
+ R.p,
739
+ {
740
+ className: y(
741
+ f`
742
+ text-align: center;
743
+ margin-top: 0.25rem;
744
+ margin-bottom: 0;
745
+ color: ${m.itemNameColor};
746
+ @media (prefers-color-scheme: dark) {
747
+ color: ${p.itemNameColor};
748
+ }
749
+ `,
750
+ o && f`
751
+ color: transparent;
752
+ `
753
+ ),
754
+ children: l
755
+ }
756
+ )
757
+ ] });
758
+ }, je = (r) => {
759
+ const {
760
+ data: e,
761
+ className: o,
762
+ itemIndex: a,
763
+ onClick: n,
764
+ disabledDrag: s = !1,
765
+ children: i,
766
+ parentIds: m,
767
+ childrenLength: p
768
+ } = r, { contextMenu: C, setContextMenu: l } = be(), { contextMenu: c } = ue();
769
+ return /* @__PURE__ */ t(
770
+ et,
771
+ {
772
+ placement: "bottom",
773
+ overlayClassName: f`
774
+ background-color: transparent;
775
+ .rc-tooltip-inner {
776
+ background-color: transparent;
777
+ padding: 0;
778
+ border: none;
779
+ }
780
+ `,
781
+ overlay: /* @__PURE__ */ t(Sn, { ...c }),
782
+ visible: (C == null ? void 0 : C.data.id) === e.id,
783
+ onVisibleChange: (b) => {
784
+ b || l(null);
785
+ },
786
+ destroyTooltipOnHide: !0,
787
+ children: /* @__PURE__ */ t(
788
+ R.div,
789
+ {
790
+ "data-id": e.id,
791
+ "data-index": a,
792
+ "data-parent-ids": m == null ? void 0 : m.join(","),
793
+ "data-children-length": p,
794
+ onClick: () => n == null ? void 0 : n(e),
795
+ className: y(s && "drag-disabled", o),
796
+ children: i ?? /* @__PURE__ */ t(Tn, { ...r })
797
+ }
798
+ )
799
+ }
800
+ );
801
+ }, Mn = (r) => {
802
+ const {
803
+ data: e,
804
+ className: o,
805
+ parentIds: a,
806
+ itemIndex: n,
807
+ onClick: s,
808
+ noLetters: i = !1
809
+ } = r, {
810
+ contextMenuFuns: m,
811
+ setList: p,
812
+ setOpenGroupItemData: C,
813
+ longPressTriggered: l,
814
+ moveItemId: c,
815
+ moveTargetId: b,
816
+ setMoveTargetId: x,
817
+ listStatus: A
818
+ } = be(), { itemIconBuilder: h, theme: g, contextMenu: N } = ue(), { light: v, dark: I } = Y.getTheme(g), { children: u, data: T, config: D } = e, { row: w = 1, col: k = 1 } = D ?? {}, U = {
819
+ visible: { opacity: 1, scale: 1 },
820
+ hidden: { opacity: 0, scale: 0.95 }
821
+ }, Z = ((u == null ? void 0 : u.length) ?? 0) === 0, _ = Z ? [e] : [...u ?? []].slice(0, 9), ae = fe(() => c === e.id.toString(), [e.id, c]), oe = fe(() => b === e.id, [e.id, b]), S = f`
822
+ overflow: hidden;
823
+ cursor: pointer;
824
+ background-color: ${v.itemIconBackgroundColor};
825
+ box-shadow: 0 0 0.5rem ${v.itemIconShadowColor};
826
+ @media (prefers-color-scheme: dark) {
827
+ background-color: ${I.itemIconBackgroundColor};
828
+ box-shadow: 0 0 0.5rem ${I.itemIconShadowColor};
829
+ }
830
+ `, O = () => {
831
+ if (Z)
832
+ return /* @__PURE__ */ t(
833
+ R.div,
834
+ {
835
+ className: y(
836
+ "sortable-group-item",
837
+ f`
838
+ overflow: hidden;
839
+ cursor: pointer;
840
+ width: 100%;
841
+ height: 100%;
842
+ background-color: ${v.itemIconBackgroundColor};
843
+ position: absolute;
844
+ left: 0;
845
+ top: 0;
846
+ border-radius: 0.75rem;
847
+ @media (prefers-color-scheme: dark) {
848
+ background-color: ${I.itemIconBackgroundColor};
849
+ }
850
+ `
851
+ ),
852
+ onClick: (B) => {
853
+ B.stopPropagation(), s == null || s(e);
854
+ },
855
+ children: h == null ? void 0 : h(e)
856
+ }
857
+ );
858
+ if (w === 1 && k === 1 || w === 2 && k === 2)
859
+ return /* @__PURE__ */ t(
860
+ R.div,
861
+ {
862
+ className: f`
863
+ display: grid;
864
+ width: 100%;
865
+ height: 100%;
866
+ grid-template-columns: repeat(3, minmax(0, 1fr));
867
+ grid-template-rows: repeat(3, minmax(0, 1fr));
868
+ padding: ${k === 1 ? "0.125rem" : "0.25rem"};
869
+ gap: ${k === 1 ? "0.125rem" : "0.5rem"};
870
+ place-items: center;
871
+ `,
872
+ children: _ == null ? void 0 : _.slice(0, 9).map((B) => /* @__PURE__ */ t(
873
+ R.div,
874
+ {
875
+ className: y(
876
+ S,
877
+ f`
878
+ border-radius: ${k === 1 ? "0.25rem" : "0.5rem"};
879
+ width: 100%;
880
+ height: 100%;
881
+ `
882
+ ),
883
+ onClick: (W) => {
884
+ W.stopPropagation(), s == null || s(B);
885
+ },
886
+ children: h == null ? void 0 : h(B)
887
+ },
888
+ B.id
889
+ ))
890
+ }
891
+ );
892
+ if (w === 1 && k === 2)
893
+ return /* @__PURE__ */ t(
894
+ R.div,
895
+ {
896
+ className: f`
897
+ display: grid;
898
+ grid-template-columns: repeat(10, minmax(0, 1fr));
899
+ grid-template-rows: repeat(4, minmax(0, 1fr));
900
+ column-gap: 0.5rem;
901
+ row-gap: 0.25rem;
902
+ width: 144px;
903
+ height: 52px;
904
+ place-items: center;
905
+ `,
906
+ children: _ == null ? void 0 : _.slice(0, 4).map((B, W) => /* @__PURE__ */ t(
907
+ R.div,
908
+ {
909
+ className: y(
910
+ S,
911
+ W < 2 ? f`
912
+ width: 52px;
913
+ height: 52px;
914
+ border-radius: 0.5rem;
915
+ grid-column: span 4 / span 4;
916
+ grid-row: span 4 / span 4;
917
+ ` : f`
918
+ width: 1.5rem;
919
+ height: 1.5rem;
920
+ border-radius: 0.375rem;
921
+ grid-column: span 2 / span 2;
922
+ grid-row: span 2 / span 2;
923
+ `
924
+ ),
925
+ onClick: (re) => {
926
+ W > 2 || (re.stopPropagation(), s == null || s(B));
927
+ },
928
+ children: h == null ? void 0 : h(B)
929
+ },
930
+ B.id
931
+ ))
932
+ }
933
+ );
934
+ if (w === 2 && k === 1)
935
+ return /* @__PURE__ */ t(
936
+ R.div,
937
+ {
938
+ className: f`
939
+ display: grid;
940
+ grid-template-columns: repeat(4, minmax(0, 1fr));
941
+ grid-template-rows: repeat(10, minmax(0, 1fr));
942
+ column-gap: 0.25rem;
943
+ row-gap: 0.5rem;
944
+ width: 52px;
945
+ height: 144px;
946
+ place-items: center;
947
+ `,
948
+ children: _ == null ? void 0 : _.slice(0, 4).map((B, W) => /* @__PURE__ */ t(
949
+ R.div,
950
+ {
951
+ className: y(
952
+ S,
953
+ W < 2 ? f`
954
+ width: 52px;
955
+ height: 52px;
956
+ border-radius: 0.5rem;
957
+ grid-column: span 4 / span 4;
958
+ grid-row: span 4 / span 4;
959
+ ` : f`
960
+ width: 1.5rem;
961
+ height: 1.5rem;
962
+ grid-column: span 2 / span 2;
963
+ grid-row: span 2 / span 2;
964
+ `
965
+ ),
966
+ onClick: (re) => {
967
+ W > 2 || (re.stopPropagation(), s == null || s(B));
968
+ },
969
+ children: h == null ? void 0 : h(B)
970
+ },
971
+ B.id
972
+ ))
973
+ }
974
+ );
975
+ };
976
+ return /* @__PURE__ */ d(
977
+ je,
978
+ {
979
+ data: e,
980
+ itemIndex: n,
981
+ parentIds: a,
982
+ childrenLength: u == null ? void 0 : u.length,
983
+ className: y(
984
+ f`
985
+ grid-row: span ${w};
986
+ grid-column: span ${k};
987
+ `,
988
+ o
989
+ ),
990
+ children: [
991
+ /* @__PURE__ */ t(
992
+ R.div,
993
+ {
994
+ whileTap: { scale: 0.9 },
995
+ className: y(
996
+ oe ? "!scale-110" : "",
997
+ f`
998
+ cursor: pointer;
999
+ position: relative;
1000
+ border-radius: 0.75rem;
1001
+ background-color: ${v.groupItemIconBackgroundColor};
1002
+ box-shadow: 0 0 0.5rem ${v.groupItemIconShadowColor};
1003
+ @media (prefers-color-scheme: dark) {
1004
+ background-color: ${I.groupItemIconBackgroundColor};
1005
+ box-shadow: 0 0 0.5rem ${I.groupItemIconShadowColor};
1006
+ }
1007
+ /* overflow: hidden; */
1008
+ transition: all 0.3s;
1009
+ margin: 0 auto;
1010
+ width: ${k * 64 + 32 * (k - 1)}px;
1011
+ height: ${w * 64 + 32 * (w - 1)}px;
1012
+ `
1013
+ ),
1014
+ onClick: (B) => {
1015
+ !Z && !l && (e.parentIds = a, e.pageX = B.pageX, e.pageY = B.pageY, C(e));
1016
+ },
1017
+ ...m(e, N !== !1),
1018
+ children: /* @__PURE__ */ d(
1019
+ R.div,
1020
+ {
1021
+ className: f`
1022
+ position: relative;
1023
+ width: 100%;
1024
+ height: 100%;
1025
+ display: flex;
1026
+ justify-content: center;
1027
+ align-items: center;
1028
+ padding: 0.375rem;
1029
+ `,
1030
+ children: [
1031
+ O(),
1032
+ /* @__PURE__ */ t(
1033
+ ze,
1034
+ {
1035
+ className: y(
1036
+ "sortable-group-item",
1037
+ f`
1038
+ position: absolute;
1039
+ cursor: pointer;
1040
+ left: 0.375rem;
1041
+ top: 0.375rem;
1042
+ width: calc(100% - 0.75rem);
1043
+ height: calc(100% - 0.75rem);
1044
+ pointer-events: ${A === null ? "none" : "auto"};
1045
+ > * {
1046
+ opacity: 0;
1047
+ }
1048
+ `
1049
+ ),
1050
+ group: { name: "nested", pull: !1, put: !0 },
1051
+ animation: 150,
1052
+ fallbackOnBody: !0,
1053
+ list: u ?? [],
1054
+ setList: (B) => p(B, a),
1055
+ filter: () => !0,
1056
+ "data-id": e.id,
1057
+ onChange: () => {
1058
+ x(e.id);
1059
+ }
1060
+ }
1061
+ )
1062
+ ]
1063
+ }
1064
+ )
1065
+ }
1066
+ ),
1067
+ /* @__PURE__ */ t(
1068
+ R.p,
1069
+ {
1070
+ className: y(
1071
+ f`
1072
+ text-align: center;
1073
+ margin-top: 0.25rem;
1074
+ margin-bottom: 0;
1075
+ color: ${v.itemNameColor};
1076
+ @media (prefers-color-scheme: dark) {
1077
+ color: ${I.itemNameColor};
1078
+ }
1079
+ `,
1080
+ i && f`
1081
+ color: transparent;
1082
+ `
1083
+ ),
1084
+ variants: U,
1085
+ animate: ae ? "hidden" : "visible",
1086
+ children: (T == null ? void 0 : T.name) ?? "文件夹"
1087
+ }
1088
+ )
1089
+ ]
1090
+ }
1091
+ );
1092
+ }, Ct = f`
1093
+ padding: 8px;
1094
+ transition: all 0.2s;
1095
+ > div {
1096
+ transition: all 0.2s;
1097
+ border: 2px solid aquamarine;
1098
+ background-color: transparent;
1099
+ > div {
1100
+ opacity: 0;
1101
+ transition: all 0.2s;
1102
+ }
1103
+ }
1104
+ `, Ln = (r) => {
1105
+ const { data: e, onClose: o, onItemClick: a } = r, {
1106
+ list: n,
1107
+ setList: s,
1108
+ setListStatus: i,
1109
+ setMoveItemId: m,
1110
+ setMoveTargetId: p,
1111
+ updateItem: C
1112
+ } = be(), { theme: l } = ue(), { light: c, dark: b } = Y.getTheme(l), [x, A] = H("文件夹"), h = [...(e == null ? void 0 : e.children) ?? []];
1113
+ return ie(() => {
1114
+ var g;
1115
+ e && A((g = e.data) == null ? void 0 : g.name);
1116
+ }, [e]), /* @__PURE__ */ t(
1117
+ ut,
1118
+ {
1119
+ visible: !!e,
1120
+ onClose: () => {
1121
+ o();
1122
+ },
1123
+ animation: "zoom",
1124
+ maskAnimation: "fade",
1125
+ mousePosition: e != null && e.pageX && (e != null && e.pageY) ? {
1126
+ x: e == null ? void 0 : e.pageX,
1127
+ y: e == null ? void 0 : e.pageY
1128
+ } : null,
1129
+ title: /* @__PURE__ */ t(
1130
+ "input",
1131
+ {
1132
+ className: f`
1133
+ background-color: transparent;
1134
+ border-style: none;
1135
+ text-align: center;
1136
+ font-size: 1.25rem;
1137
+ line-height: 1.75rem;
1138
+ color: white;
1139
+ @media (prefers-color-scheme: dark) {
1140
+ color: black;
1141
+ }
1142
+ &:focus {
1143
+ outline: none;
1144
+ }
1145
+ `,
1146
+ value: x,
1147
+ onChange: (g) => {
1148
+ A(g.target.value);
1149
+ },
1150
+ onBlur: () => {
1151
+ e && C(e.id, {
1152
+ ...e.data,
1153
+ name: x
1154
+ });
1155
+ }
1156
+ }
1157
+ ),
1158
+ footer: null,
1159
+ closable: !1,
1160
+ className: y(
1161
+ "group-item-modal",
1162
+ f`
1163
+ .rc-dialog-content {
1164
+ background-color: transparent;
1165
+ box-shadow: none;
1166
+ padding: 0;
1167
+ .rc-dialog-header {
1168
+ text-align: center;
1169
+ background-color: transparent;
1170
+ margin-bottom: 1rem;
1171
+ border-bottom: none;
1172
+ .ant-modal-name {
1173
+ color: #fff;
1174
+ }
1175
+ }
1176
+ .rc-dialog-body {
1177
+ background-color: ${c.groupItemModalBackgroundColor};
1178
+ @media (prefers-color-scheme: dark) {
1179
+ background-color: ${b.groupItemModalBackgroundColor};
1180
+ }
1181
+ border-radius: 0.5rem;
1182
+ overflow: hidden;
1183
+ }
1184
+ }
1185
+ `
1186
+ ),
1187
+ width: 600,
1188
+ destroyOnClose: !0,
1189
+ children: /* @__PURE__ */ t(
1190
+ "div",
1191
+ {
1192
+ className: f`
1193
+ overflow-y: auto;
1194
+ max-height: 60vh;
1195
+ padding: 1.25rem 0;
1196
+ `,
1197
+ onDragLeave: (g) => {
1198
+ const N = g.relatedTarget;
1199
+ N && (g.currentTarget.contains(N) || setTimeout(() => {
1200
+ o();
1201
+ }, 500));
1202
+ },
1203
+ children: /* @__PURE__ */ t(
1204
+ ze,
1205
+ {
1206
+ className: f`
1207
+ display: grid;
1208
+ gap: 1rem;
1209
+ place-items: center;
1210
+ grid-template-columns: repeat(auto-fill, 96px);
1211
+ grid-auto-flow: dense;
1212
+ grid-auto-rows: 96px;
1213
+ `,
1214
+ group: { name: "nested", pull: !0, put: !1 },
1215
+ animation: 150,
1216
+ fallbackOnBody: !0,
1217
+ list: (e == null ? void 0 : e.children) ?? [],
1218
+ setList: (g) => {
1219
+ var I, u;
1220
+ const N = g.map((T) => T.id), v = (u = (I = n.find((T) => T.id === (e == null ? void 0 : e.id))) == null ? void 0 : I.children) == null ? void 0 : u.map((T) => T.id);
1221
+ N.length === (v == null ? void 0 : v.length) && N.every((T, D) => T === v[D]) || N.length < ((v == null ? void 0 : v.length) ?? 0) || s(g, [...(e == null ? void 0 : e.parentIds) ?? [], e == null ? void 0 : e.id]);
1222
+ },
1223
+ onMove: () => (p(null), i("onMove"), !0),
1224
+ onStart: (g) => {
1225
+ const N = g.item.dataset;
1226
+ N != null && N.id && m(N.id), i("onMove");
1227
+ },
1228
+ onEnd: () => {
1229
+ m(null), p(null), i(null);
1230
+ },
1231
+ ghostClass: Ct,
1232
+ children: h.map((g, N) => /* @__PURE__ */ t(
1233
+ je,
1234
+ {
1235
+ data: g,
1236
+ itemIndex: N,
1237
+ onClick: a
1238
+ },
1239
+ g.id
1240
+ ))
1241
+ }
1242
+ )
1243
+ }
1244
+ )
1245
+ }
1246
+ );
1247
+ }, An = (r) => {
1248
+ var a;
1249
+ const { data: e, onClose: o } = r;
1250
+ return /* @__PURE__ */ t(
1251
+ ut,
1252
+ {
1253
+ visible: !!e,
1254
+ onClose: () => {
1255
+ o();
1256
+ },
1257
+ animation: "zoom",
1258
+ maskAnimation: "fade",
1259
+ mousePosition: e != null && e.pageX && (e != null && e.pageY) ? {
1260
+ x: e == null ? void 0 : e.pageX,
1261
+ y: e == null ? void 0 : e.pageY
1262
+ } : null,
1263
+ footer: null,
1264
+ title: ((a = e == null ? void 0 : e.data) == null ? void 0 : a.name) ?? "信息",
1265
+ children: e && /* @__PURE__ */ d("div", { children: [
1266
+ /* @__PURE__ */ t("div", { className: "mb-2", children: "开发者信息" }),
1267
+ /* @__PURE__ */ t("div", { className: "p-2 rounded-md bg-[#272822]", children: /* @__PURE__ */ t(ko, { src: e, theme: "monokai" }) })
1268
+ ] })
1269
+ }
1270
+ );
1271
+ }, wt = (r) => {
1272
+ const {
1273
+ pagination: e = { position: "bottom" },
1274
+ className: o,
1275
+ sliderProps: a,
1276
+ sliderRef: n,
1277
+ onItemClick: s
1278
+ } = r, i = he(null), m = he(null), {
1279
+ list: p,
1280
+ setList: C,
1281
+ setListStatus: l,
1282
+ showInfoItemData: c,
1283
+ setShowInfoItemData: b,
1284
+ openGroupItemData: x,
1285
+ setOpenGroupItemData: A,
1286
+ setMoveItemId: h,
1287
+ setMoveTargetId: g,
1288
+ addItem: N
1289
+ } = be(), { pagingDotBuilder: v, pagingDotsBuilder: I, itemBuilder: u } = ue(), T = fe(() => e === !1 ? {} : {
1290
+ top: f`
1291
+ display: flex;
1292
+ flex-direction: column;
1293
+ .slick-list {
1294
+ order: 1;
1295
+ }
1296
+ .slick-dots {
1297
+ position: static;
1298
+ }
1299
+ `,
1300
+ bottom: f`
1301
+ .slick-dots {
1302
+ position: static;
1303
+ }
1304
+ `,
1305
+ left: f`
1306
+ .slick-dots {
1307
+ position: absolute;
1308
+ width: auto;
1309
+ left: 0;
1310
+ top: 0;
1311
+ bottom: 0;
1312
+ transform: translateX(-100%);
1313
+ display: flex;
1314
+ justify-content: center;
1315
+ align-items: center;
1316
+ .slick-dots-default {
1317
+ flex-direction: column;
1318
+ }
1319
+ }
1320
+ `,
1321
+ right: f`
1322
+ .slick-dots {
1323
+ position: absolute;
1324
+ width: auto;
1325
+ right: 0;
1326
+ top: 0;
1327
+ bottom: 0;
1328
+ transform: translateX(100%);
1329
+ display: flex;
1330
+ justify-content: center;
1331
+ align-items: center;
1332
+ .slick-dots-default {
1333
+ flex-direction: column;
1334
+ }
1335
+ }
1336
+ `
1337
+ }[e.position ?? "bottom"], [e]);
1338
+ return /* @__PURE__ */ d(me, { children: [
1339
+ /* @__PURE__ */ t(
1340
+ Wt,
1341
+ {
1342
+ useCSS: !0,
1343
+ useTransform: !0,
1344
+ arrows: !1,
1345
+ ref: n ?? i,
1346
+ infinite: !1,
1347
+ dots: !0,
1348
+ touchMove: !1,
1349
+ lazyLoad: "anticipated",
1350
+ className: y(
1351
+ T,
1352
+ f`
1353
+ .slick-track {
1354
+ display: flex;
1355
+ align-items: stretch;
1356
+ }
1357
+ .slick-slide {
1358
+ display: flex;
1359
+ align-self: stretch;
1360
+ height: unset;
1361
+ > div {
1362
+ display: flex;
1363
+ align-self: stretch;
1364
+ width: 100%;
1365
+ }
1366
+ }
1367
+ `,
1368
+ o
1369
+ ),
1370
+ customPaging: (D) => {
1371
+ var w, k;
1372
+ return v ? v(p[D], D) : /* @__PURE__ */ t(
1373
+ "div",
1374
+ {
1375
+ onDragEnter: () => {
1376
+ var U;
1377
+ (U = (n ?? i).current) == null || U.slickGoTo(D);
1378
+ },
1379
+ children: (k = (w = p[D]) == null ? void 0 : w.data) == null ? void 0 : k.name
1380
+ }
1381
+ );
1382
+ },
1383
+ appendDots: (D) => I ? I(D) : e === !1 ? /* @__PURE__ */ t("div", {}) : /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
1384
+ "ul",
1385
+ {
1386
+ ref: m,
1387
+ className: y(
1388
+ "slick-dots-default",
1389
+ f`
1390
+ padding: 0.5rem;
1391
+ display: inline-flex;
1392
+ justify-content: center;
1393
+ align-items: center;
1394
+ gap: 0.5rem;
1395
+ background-color: rgba(0, 0, 0, 0.1);
1396
+ border-radius: 0.5rem;
1397
+ .slick-active {
1398
+ background-color: rgba(0, 0, 0, 0.3);
1399
+ color: white;
1400
+ padding: 0.25rem;
1401
+ border-radius: 0.25rem;
1402
+ }
1403
+ li {
1404
+ margin: 0;
1405
+ width: auto;
1406
+ height: auto;
1407
+ }
1408
+ `
1409
+ ),
1410
+ children: D
1411
+ }
1412
+ ) }),
1413
+ ...a,
1414
+ children: p.map((D) => /* @__PURE__ */ t(
1415
+ "div",
1416
+ {
1417
+ onDrop: (w) => {
1418
+ w.preventDefault();
1419
+ const k = w.dataTransfer.getData("text/plain");
1420
+ if (Y.quickJSONCheck(k))
1421
+ try {
1422
+ N(JSON.parse(k), [D.id]);
1423
+ } catch (Z) {
1424
+ console.log("drag error", Z);
1425
+ }
1426
+ },
1427
+ onDragOver: (w) => {
1428
+ w.preventDefault();
1429
+ },
1430
+ children: /* @__PURE__ */ t(
1431
+ ze,
1432
+ {
1433
+ className: y(
1434
+ f`
1435
+ display: grid;
1436
+ transition: all 0.3s;
1437
+ grid-template-columns: repeat(auto-fill, 96px);
1438
+ grid-auto-flow: dense;
1439
+ grid-auto-rows: 96px;
1440
+ place-items: center;
1441
+ justify-content: center;
1442
+ align-items: center;
1443
+ `
1444
+ ),
1445
+ animation: 150,
1446
+ fallbackOnBody: !0,
1447
+ swapThreshold: 0.65,
1448
+ group: "nested",
1449
+ list: D.children ?? [],
1450
+ setList: (w) => C(w, [D.id]),
1451
+ filter: ".drag-disabled",
1452
+ onMove: (w) => {
1453
+ l("onMove");
1454
+ const { dragged: k, related: U } = w, Z = k.dataset, _ = U.dataset;
1455
+ return g(null), !((Object.keys(_).length === 0 || _.parentIds) && Number(Z.childrenLength) > 0 && U.classList.contains("sortable-group-item"));
1456
+ },
1457
+ onStart: (w) => {
1458
+ const k = w.item.dataset;
1459
+ k != null && k.id && h(k.id), l("onMove");
1460
+ },
1461
+ onEnd: () => {
1462
+ h(null), g(null), l(null);
1463
+ },
1464
+ ghostClass: Ct,
1465
+ children: (D.children ?? []).map((w, k) => {
1466
+ let U;
1467
+ if (u)
1468
+ return u(w);
1469
+ switch (w.type) {
1470
+ case "group":
1471
+ case "app":
1472
+ U = /* @__PURE__ */ t(
1473
+ Mn,
1474
+ {
1475
+ data: w,
1476
+ itemIndex: k,
1477
+ parentIds: [D.id, w.id],
1478
+ onClick: s
1479
+ },
1480
+ w.id
1481
+ );
1482
+ break;
1483
+ default:
1484
+ U = /* @__PURE__ */ t(
1485
+ je,
1486
+ {
1487
+ data: w,
1488
+ itemIndex: k,
1489
+ onClick: s
1490
+ },
1491
+ w.id
1492
+ );
1493
+ break;
1494
+ }
1495
+ return U;
1496
+ })
1497
+ }
1498
+ )
1499
+ },
1500
+ D.id
1501
+ ))
1502
+ }
1503
+ ),
1504
+ /* @__PURE__ */ t(
1505
+ An,
1506
+ {
1507
+ data: c,
1508
+ onClose: () => {
1509
+ b(null);
1510
+ }
1511
+ }
1512
+ ),
1513
+ /* @__PURE__ */ t(
1514
+ Ln,
1515
+ {
1516
+ data: x,
1517
+ onClose: () => {
1518
+ A(null);
1519
+ },
1520
+ onItemClick: s
1521
+ }
1522
+ )
1523
+ ] });
1524
+ }, Rn = (r) => {
1525
+ const {
1526
+ list: e,
1527
+ onChange: o,
1528
+ storageKey: a,
1529
+ enableCaching: n,
1530
+ theme: s,
1531
+ noLetters: i,
1532
+ contextMenu: m,
1533
+ contextMenuBuilder: p,
1534
+ itemBuilder: C,
1535
+ itemIconBuilder: l,
1536
+ pagingDotBuilder: c,
1537
+ pagingDotsBuilder: b,
1538
+ ...x
1539
+ } = r;
1540
+ return /* @__PURE__ */ t(kt, { ...{
1541
+ list: e,
1542
+ onChange: o,
1543
+ storageKey: a,
1544
+ enableCaching: n
1545
+ }, children: /* @__PURE__ */ t(xt, { ...{
1546
+ theme: s,
1547
+ noLetters: i,
1548
+ contextMenu: m,
1549
+ pagingDotsBuilder: b,
1550
+ pagingDotBuilder: c,
1551
+ itemBuilder: C,
1552
+ itemIconBuilder: l,
1553
+ contextMenuBuilder: p
1554
+ }, children: /* @__PURE__ */ t(wt, { ...x }) }) });
1555
+ }, Dn = {
1556
+ frontmatterEditor: {
1557
+ title: "编辑前置元数据",
1558
+ key: "键",
1559
+ value: "值",
1560
+ addEntry: "添加项目"
1561
+ },
1562
+ dialogControls: {
1563
+ save: "保存",
1564
+ cancel: "取消"
1565
+ },
1566
+ uploadImage: {
1567
+ uploadInstructions: "从您的设备中上传图片:",
1568
+ addViaUrlInstructions: "或从网址新增图片:",
1569
+ autoCompletePlaceholder: "选择或粘贴图片",
1570
+ alt: "替代文本:",
1571
+ title: "标题:"
1572
+ },
1573
+ imageEditor: {
1574
+ editImage: "编辑图片"
1575
+ },
1576
+ createLink: {
1577
+ url: "网址",
1578
+ urlPlaceholder: "选择或粘贴网址",
1579
+ title: "标题",
1580
+ saveTooltip: "设置网址",
1581
+ cancelTooltip: "取消更改"
1582
+ },
1583
+ linkPreview: {
1584
+ open: "在新窗口中打开 {{url}}",
1585
+ edit: "编辑链接网址",
1586
+ copyToClipboard: "复制到剪贴板",
1587
+ copied: "已复制!",
1588
+ remove: "移除链接"
1589
+ },
1590
+ table: {
1591
+ deleteTable: "删除表格",
1592
+ columnMenu: "列菜单",
1593
+ textAlignment: "文字对齐",
1594
+ alignLeft: "左对齐",
1595
+ alignCenter: "居中对齐",
1596
+ alignRight: "右对齐",
1597
+ insertColumnLeft: "在当前列左侧插入一列",
1598
+ insertColumnRight: "在当前列右侧插入一列",
1599
+ deleteColumn: "删除此列",
1600
+ rowMenu: "行菜单",
1601
+ insertRowAbove: "在当前行上方插入一行",
1602
+ insertRowBelow: "在当前行下方插入一行",
1603
+ deleteRow: "删除此行"
1604
+ },
1605
+ toolbar: {
1606
+ blockTypes: {
1607
+ paragraph: "段落",
1608
+ quote: "引用",
1609
+ heading: "标题 {{level}}"
1610
+ },
1611
+ blockTypeSelect: {
1612
+ selectBlockTypeTooltip: "选择块类型",
1613
+ placeholder: "块类型"
1614
+ },
1615
+ toggleGroup: "切换组",
1616
+ removeBold: "移除粗体",
1617
+ bold: "粗体",
1618
+ removeItalic: "移除斜体",
1619
+ italic: "斜体",
1620
+ underline: "移除下划线",
1621
+ removeUnderline: "下划线",
1622
+ removeInlineCode: "移除内联代码样式",
1623
+ inlineCode: "内联代码样式",
1624
+ link: "创建链接",
1625
+ richText: "富文本",
1626
+ diffMode: "差异模式",
1627
+ source: "源码模式",
1628
+ admonition: "插入注释区块",
1629
+ codeBlock: "插入代码块",
1630
+ editFrontmatter: "编辑前置元数据",
1631
+ insertFrontmatter: "插入前置元数据",
1632
+ image: "插入图片",
1633
+ insertSandpack: "插入 Sandpack",
1634
+ table: "插入表格",
1635
+ thematicBreak: "插入主题换行",
1636
+ bulletedList: "无序列表",
1637
+ numberedList: "有序列表",
1638
+ checkList: "任务列表",
1639
+ deleteSandpack: "删除 Sandpack",
1640
+ undo: "撤销 {{shortcut}}",
1641
+ redo: "重做 {{shortcut}}",
1642
+ superscript: "上标",
1643
+ subscript: "下标",
1644
+ strikethrough: "删除线",
1645
+ removeSubscript: "移除下标",
1646
+ removeSuperscript: "移除上标",
1647
+ removeStrikethrough: "移除删除线"
1648
+ },
1649
+ admonitions: {
1650
+ note: "注意",
1651
+ tip: "提示",
1652
+ danger: "危险",
1653
+ info: "信息",
1654
+ caution: "警告",
1655
+ changeType: "选择注释区块类型",
1656
+ placeholder: "注释区块类型"
1657
+ },
1658
+ codeBlock: {
1659
+ language: "代码块语言",
1660
+ selectLanguage: "选择代码块语言",
1661
+ inlineLanguage: "代码块语言"
1662
+ },
1663
+ codeblock: {
1664
+ delete: "删除代码块"
1665
+ },
1666
+ contentArea: {
1667
+ editableMarkdown: "可编辑的 Markdown"
1668
+ },
1669
+ image: {
1670
+ delete: "删除图片"
1671
+ }
1672
+ }, Pn = (r, e, o) => {
1673
+ const n = r.split(".").reduce(
1674
+ (s, i) => typeof s == "string" ? s : s[i],
1675
+ Dn
1676
+ );
1677
+ return typeof n != "string" ? e : o ? n.replace(/{{(.*?)}}/g, (s, i) => o[i]) : n;
1678
+ }, Bn = f`
1679
+ --accentBase: var(--tomato-1);
1680
+ --accentBgSubtle: var(--tomato-2);
1681
+ --accentBg: var(--tomato-3);
1682
+ --accentBgHover: var(--tomato-4);
1683
+ --accentBgActive: var(--tomato-5);
1684
+ --accentLine: var(--tomato-6);
1685
+ --accentBorder: var(--tomato-7);
1686
+ --accentBorderHover: var(--tomato-8);
1687
+ --accentSolid: var(--tomato-9);
1688
+ --accentSolidHover: var(--tomato-10);
1689
+ --accentText: var(--tomato-11);
1690
+ --accentTextContrast: var(--tomato-12);
1691
+
1692
+ --baseBase: var(--mauve-1);
1693
+ --baseBgSubtle: var(--mauve-2);
1694
+ --baseBg: var(--mauve-3);
1695
+ --baseBgHover: var(--mauve-4);
1696
+ --baseBgActive: var(--mauve-5);
1697
+ --baseLine: var(--mauve-6);
1698
+ --baseBorder: var(--mauve-7);
1699
+ --baseBorderHover: var(--mauve-8);
1700
+ --baseSolid: var(--mauve-9);
1701
+ --baseSolidHover: var(--mauve-10);
1702
+ --baseText: var(--mauve-11);
1703
+ --baseTextContrast: var(--mauve-12);
1704
+
1705
+ --admonitionTipBg: var(--cyan-4);
1706
+ --admonitionTipBorder: var(--cyan-8);
1707
+
1708
+ --admonitionInfoBg: var(--grass-4);
1709
+ --admonitionInfoBorder: var(--grass-8);
1710
+
1711
+ --admonitionCautionBg: var(--amber-4);
1712
+ --admonitionCautionBorder: var(--amber-8);
1713
+
1714
+ --admonitionDangerBg: var(--red-4);
1715
+ --admonitionDangerBorder: var(--red-8);
1716
+
1717
+ --admonitionNoteBg: var(--mauve-4);
1718
+ --admonitionNoteBorder: var(--mauve-8);
1719
+
1720
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
1721
+ Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
1722
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
1723
+ "Liberation Mono", "Courier New", monospace;
1724
+
1725
+ color: var(--baseText);
1726
+ --basePageBg: #000000;
1727
+ background-color: var(--basePageBg);
1728
+ background-image: linear-gradient(
1729
+ rgba(255, 255, 255, 0.05),
1730
+ rgba(255, 255, 255, 0.05)
1731
+ );
1732
+ `, zn = f`
1733
+ [class*="_toolbarRoot"] {
1734
+ flex-wrap: wrap;
1735
+ transition: all 0.3s;
1736
+ }
1737
+ [class*="_codeMirrorWrapper"] {
1738
+ padding: 0;
1739
+ [class*="_codeMirrorToolbar"] {
1740
+ position: static;
1741
+ background-color: var(--bgColor-muted);
1742
+ justify-content: flex-end;
1743
+ [class*="_iconButton"] {
1744
+ cursor: pointer;
1745
+ }
1746
+ }
1747
+ }
1748
+ [class*="_tableEditor"] {
1749
+ border-spacing: 0;
1750
+ border-collapse: collapse;
1751
+ width: 100%;
1752
+ display: table;
1753
+ th[data-tool-cell],
1754
+ td[data-tool-cell] {
1755
+ padding: 0;
1756
+ border: none;
1757
+ }
1758
+ tr {
1759
+ border-top: 0;
1760
+ }
1761
+ thead {
1762
+ th {
1763
+ padding: 0;
1764
+ border: none;
1765
+ }
1766
+ }
1767
+ tfoot {
1768
+ th {
1769
+ padding: 0;
1770
+ border: none;
1771
+ }
1772
+ }
1773
+ [class*="_addRowButton"],
1774
+ [class*="_addColumnButton"],
1775
+ [class*="_tableColumnEditorTrigger"],
1776
+ [class*="_iconButton"] {
1777
+ cursor: pointer;
1778
+ transition: all 0.3s;
1779
+ }
1780
+ }
1781
+ ul {
1782
+ [role="checkbox"] {
1783
+ padding: 0 20px;
1784
+ &::before {
1785
+ width: 13px;
1786
+ height: 13px;
1787
+ top: 6px;
1788
+ }
1789
+ &::after {
1790
+ top: 7px;
1791
+ left: 4px;
1792
+ }
1793
+ }
1794
+ }
1795
+ ul,
1796
+ ol {
1797
+ li {
1798
+ margin-top: 4px;
1799
+ margin-bottom: 0;
1800
+ }
1801
+ }
1802
+ `, Nt = y(
1803
+ "markdown-body",
1804
+ f`
1805
+ p {
1806
+ margin-bottom: 8px;
1807
+ }
1808
+ ul {
1809
+ list-style: disc;
1810
+ }
1811
+ ol {
1812
+ list-style: decimal;
1813
+ }
1814
+ table {
1815
+ width: 100%;
1816
+ display: table;
1817
+ }
1818
+ pre {
1819
+ padding: 0;
1820
+ > div {
1821
+ margin: 0 !important;
1822
+ }
1823
+ }
1824
+ `
1825
+ ), It = f`
1826
+ .markdown-body {
1827
+ /* light */
1828
+ color-scheme: light;
1829
+ --focus-outlineColor: #0969da;
1830
+ --fgColor-default: #1f2328;
1831
+ --fgColor-muted: #59636e;
1832
+ --fgColor-accent: #0969da;
1833
+ --fgColor-success: #1a7f37;
1834
+ --fgColor-attention: #9a6700;
1835
+ --fgColor-danger: #d1242f;
1836
+ --fgColor-done: #8250df;
1837
+ --bgColor-default: #ffffff;
1838
+ --bgColor-muted: #f6f8fa;
1839
+ --bgColor-neutral-muted: #818b981f;
1840
+ --bgColor-attention-muted: #fff8c5;
1841
+ --borderColor-default: transparent;
1842
+ --borderColor-muted: #d1d9e0b3;
1843
+ --borderColor-neutral-muted: #d1d9e0b3;
1844
+ --borderColor-accent-emphasis: #0969da;
1845
+ --borderColor-success-emphasis: #1a7f37;
1846
+ --borderColor-attention-emphasis: #9a6700;
1847
+ --borderColor-danger-emphasis: #cf222e;
1848
+ --borderColor-done-emphasis: #8250df;
1849
+ --color-prettylights-syntax-comment: #59636e;
1850
+ --color-prettylights-syntax-constant: #0550ae;
1851
+ --color-prettylights-syntax-constant-other-reference-link: #0a3069;
1852
+ --color-prettylights-syntax-entity: #6639ba;
1853
+ --color-prettylights-syntax-storage-modifier-import: #1f2328;
1854
+ --color-prettylights-syntax-entity-tag: #0550ae;
1855
+ --color-prettylights-syntax-keyword: #cf222e;
1856
+ --color-prettylights-syntax-string: #0a3069;
1857
+ --color-prettylights-syntax-variable: #953800;
1858
+ --color-prettylights-syntax-brackethighlighter-unmatched: #82071e;
1859
+ --color-prettylights-syntax-brackethighlighter-angle: #59636e;
1860
+ --color-prettylights-syntax-invalid-illegal-text: #f6f8fa;
1861
+ --color-prettylights-syntax-invalid-illegal-bg: #82071e;
1862
+ --color-prettylights-syntax-carriage-return-text: #f6f8fa;
1863
+ --color-prettylights-syntax-carriage-return-bg: #cf222e;
1864
+ --color-prettylights-syntax-string-regexp: #116329;
1865
+ --color-prettylights-syntax-markup-list: #3b2300;
1866
+ --color-prettylights-syntax-markup-heading: #0550ae;
1867
+ --color-prettylights-syntax-markup-italic: #1f2328;
1868
+ --color-prettylights-syntax-markup-bold: #1f2328;
1869
+ --color-prettylights-syntax-markup-deleted-text: #82071e;
1870
+ --color-prettylights-syntax-markup-deleted-bg: #ffebe9;
1871
+ --color-prettylights-syntax-markup-inserted-text: #116329;
1872
+ --color-prettylights-syntax-markup-inserted-bg: #dafbe1;
1873
+ --color-prettylights-syntax-markup-changed-text: #953800;
1874
+ --color-prettylights-syntax-markup-changed-bg: #ffd8b5;
1875
+ --color-prettylights-syntax-markup-ignored-text: #d1d9e0;
1876
+ --color-prettylights-syntax-markup-ignored-bg: #0550ae;
1877
+ --color-prettylights-syntax-meta-diff-range: #8250df;
1878
+ --color-prettylights-syntax-sublimelinter-gutter-mark: #818b98;
1879
+ }
1880
+ `, St = f`
1881
+ .markdown-body {
1882
+ /* dark */
1883
+ color-scheme: dark;
1884
+ --focus-outlineColor: #1f6feb;
1885
+ --fgColor-default: #f0f6fc;
1886
+ --fgColor-muted: #9198a1;
1887
+ --fgColor-accent: #4493f8;
1888
+ --fgColor-success: #3fb950;
1889
+ --fgColor-attention: #d29922;
1890
+ --fgColor-danger: #f85149;
1891
+ --fgColor-done: #ab7df8;
1892
+ --bgColor-default: transparent;
1893
+ --bgColor-muted: #151b23;
1894
+ --bgColor-neutral-muted: #656c7633;
1895
+ --bgColor-attention-muted: #bb800926;
1896
+ --borderColor-default: #3d444d;
1897
+ --borderColor-muted: #3d444db3;
1898
+ --borderColor-neutral-muted: #3d444db3;
1899
+ --borderColor-accent-emphasis: #1f6feb;
1900
+ --borderColor-success-emphasis: #238636;
1901
+ --borderColor-attention-emphasis: #9e6a03;
1902
+ --borderColor-danger-emphasis: #da3633;
1903
+ --borderColor-done-emphasis: #8957e5;
1904
+ --color-prettylights-syntax-comment: #9198a1;
1905
+ --color-prettylights-syntax-constant: #79c0ff;
1906
+ --color-prettylights-syntax-constant-other-reference-link: #a5d6ff;
1907
+ --color-prettylights-syntax-entity: #d2a8ff;
1908
+ --color-prettylights-syntax-storage-modifier-import: #f0f6fc;
1909
+ --color-prettylights-syntax-entity-tag: #7ee787;
1910
+ --color-prettylights-syntax-keyword: #ff7b72;
1911
+ --color-prettylights-syntax-string: #a5d6ff;
1912
+ --color-prettylights-syntax-variable: #ffa657;
1913
+ --color-prettylights-syntax-brackethighlighter-unmatched: #f85149;
1914
+ --color-prettylights-syntax-brackethighlighter-angle: #9198a1;
1915
+ --color-prettylights-syntax-invalid-illegal-text: #f0f6fc;
1916
+ --color-prettylights-syntax-invalid-illegal-bg: #8e1519;
1917
+ --color-prettylights-syntax-carriage-return-text: #f0f6fc;
1918
+ --color-prettylights-syntax-carriage-return-bg: #b62324;
1919
+ --color-prettylights-syntax-string-regexp: #7ee787;
1920
+ --color-prettylights-syntax-markup-list: #f2cc60;
1921
+ --color-prettylights-syntax-markup-heading: #1f6feb;
1922
+ --color-prettylights-syntax-markup-italic: #f0f6fc;
1923
+ --color-prettylights-syntax-markup-bold: #f0f6fc;
1924
+ --color-prettylights-syntax-markup-deleted-text: #ffdcd7;
1925
+ --color-prettylights-syntax-markup-deleted-bg: #67060c;
1926
+ --color-prettylights-syntax-markup-inserted-text: #aff5b4;
1927
+ --color-prettylights-syntax-markup-inserted-bg: #033a16;
1928
+ --color-prettylights-syntax-markup-changed-text: #ffdfb6;
1929
+ --color-prettylights-syntax-markup-changed-bg: #5a1e02;
1930
+ --color-prettylights-syntax-markup-ignored-text: #f0f6fc;
1931
+ --color-prettylights-syntax-markup-ignored-bg: #1158c7;
1932
+ --color-prettylights-syntax-meta-diff-range: #d2a8ff;
1933
+ --color-prettylights-syntax-sublimelinter-gutter-mark: #3d444d;
1934
+ }
1935
+ `, Pe = (r) => {
1936
+ var e, o;
1937
+ return r === "dark" ? !0 : r === "light" ? !1 : (e = document.documentElement.getAttribute("style")) != null && e.includes("color-scheme: dark;") ? !0 : (o = document.documentElement.getAttribute("style")) != null && o.includes("color-scheme: light;") ? !1 : window.matchMedia("(prefers-color-scheme: dark)").matches;
1938
+ }, En = (r) => {
1939
+ const {
1940
+ value: e,
1941
+ onChange: o,
1942
+ translation: a,
1943
+ pluginConfig: n,
1944
+ className: s,
1945
+ theme: i = "auto",
1946
+ ...m
1947
+ } = r, p = he(null), {
1948
+ image: C,
1949
+ diffSource: l = {
1950
+ viewMode: "rich-text"
1951
+ },
1952
+ headings: c,
1953
+ link: b,
1954
+ codeBlock: x,
1955
+ codeMirror: A = {
1956
+ codeBlockLanguages: {
1957
+ js: "JavaScript",
1958
+ css: "CSS",
1959
+ txt: "Plain Text",
1960
+ tsx: "TypeScript",
1961
+ "": "Unspecified"
1962
+ }
1963
+ },
1964
+ directives: h = {
1965
+ directiveDescriptors: [Co]
1966
+ }
1967
+ } = n ?? {}, [g, N] = H("");
1968
+ return ie(() => {
1969
+ var v;
1970
+ e !== void 0 && p.current && ((v = p.current) == null || v.setMarkdown(e), N(e));
1971
+ }, [e, p]), /* @__PURE__ */ t(
1972
+ wo,
1973
+ {
1974
+ ref: p,
1975
+ className: y(
1976
+ zn,
1977
+ Pe(i) ? Bn : "",
1978
+ Pe(i) ? St : It,
1979
+ s
1980
+ ),
1981
+ contentEditableClassName: Nt,
1982
+ markdown: g,
1983
+ onChange: (v) => {
1984
+ !e && !o && N(v), o && o(v);
1985
+ },
1986
+ translation: a ?? Pn,
1987
+ plugins: [
1988
+ No({
1989
+ toolbarContents: () => /* @__PURE__ */ d(Oo, { options: ["rich-text", "source"], children: [
1990
+ /* @__PURE__ */ t(Fo, {}),
1991
+ /* @__PURE__ */ t(le, {}),
1992
+ /* @__PURE__ */ t(_o, {}),
1993
+ /* @__PURE__ */ t(jo, {}),
1994
+ /* @__PURE__ */ t(le, {}),
1995
+ /* @__PURE__ */ t(Uo, {}),
1996
+ /* @__PURE__ */ t(le, {}),
1997
+ /* @__PURE__ */ t(Xo, {}),
1998
+ /* @__PURE__ */ t(le, {}),
1999
+ /* @__PURE__ */ t(Go, {}),
2000
+ /* @__PURE__ */ t(qo, {}),
2001
+ /* @__PURE__ */ t(le, {}),
2002
+ /* @__PURE__ */ t(Yo, {}),
2003
+ /* @__PURE__ */ t(Vo, {}),
2004
+ /* @__PURE__ */ t(le, {}),
2005
+ /* @__PURE__ */ t(Wo, {}),
2006
+ /* @__PURE__ */ t(le, {}),
2007
+ /* @__PURE__ */ t(Ko, {})
2008
+ ] })
2009
+ }),
2010
+ Io(l),
2011
+ So(),
2012
+ To(),
2013
+ Mo(c),
2014
+ Lo(b),
2015
+ Ao(),
2016
+ Ro(C),
2017
+ Do(),
2018
+ Po(),
2019
+ Bo(),
2020
+ zo(x),
2021
+ Eo(A),
2022
+ $o(),
2023
+ Ho(h)
2024
+ ],
2025
+ ...m
2026
+ }
2027
+ );
2028
+ }, Tt = (r) => {
2029
+ const { children: e = "", className: o, theme: a = "auto", imageProps: n } = r;
2030
+ return /* @__PURE__ */ t(
2031
+ "div",
2032
+ {
2033
+ className: Pe(a) ? St : It,
2034
+ children: /* @__PURE__ */ t(
2035
+ pt,
2036
+ {
2037
+ className: y(Nt, o),
2038
+ remarkPlugins: [Jo, Zo],
2039
+ rehypePlugins: [Qo],
2040
+ components: {
2041
+ code(s) {
2042
+ const { children: i, className: m, node: p, ref: C, ...l } = s, c = /language-(\w+)/.exec(m || "");
2043
+ return c ? /* @__PURE__ */ t(
2044
+ er,
2045
+ {
2046
+ ...l,
2047
+ PreTag: "div",
2048
+ children: String(i).replace(/\n$/, ""),
2049
+ language: c[1],
2050
+ style: tr
2051
+ }
2052
+ ) : /* @__PURE__ */ t("code", { ...l, className: m, children: i });
2053
+ },
2054
+ img(s) {
2055
+ const { preview: i, ...m } = n ?? {};
2056
+ return /* @__PURE__ */ t(
2057
+ or,
2058
+ {
2059
+ ...s,
2060
+ preview: i instanceof Boolean ? i : {
2061
+ icons: {
2062
+ rotateLeft: /* @__PURE__ */ t(uo, {}),
2063
+ rotateRight: /* @__PURE__ */ t(mo, {}),
2064
+ zoomIn: /* @__PURE__ */ t(co, {}),
2065
+ zoomOut: /* @__PURE__ */ t(lo, {}),
2066
+ close: /* @__PURE__ */ t(io, {}),
2067
+ left: /* @__PURE__ */ t(so, {}),
2068
+ right: /* @__PURE__ */ t(ao, {}),
2069
+ flipX: /* @__PURE__ */ t(no, {}),
2070
+ flipY: /* @__PURE__ */ t(ro, {})
2071
+ },
2072
+ zIndex: 9999,
2073
+ mask: " ",
2074
+ ...i
2075
+ },
2076
+ className: f`
2077
+ cursor: zoom-in;
2078
+ `,
2079
+ ...m
2080
+ }
2081
+ );
2082
+ }
2083
+ },
2084
+ children: e
2085
+ }
2086
+ )
2087
+ }
2088
+ );
2089
+ }, Mt = En;
2090
+ Mt.Preview = Tt;
2091
+ function Lt(...r) {
2092
+ return nr(rr(r));
2093
+ }
2094
+ const $n = (r) => {
2095
+ const { mouseX: e, title: o, icon: a, href: n } = r, s = he(null), i = xe(e, (N) => {
2096
+ var I;
2097
+ const v = ((I = s.current) == null ? void 0 : I.getBoundingClientRect()) ?? { x: 0, width: 0 };
2098
+ return N - v.x - v.width / 2;
2099
+ }), m = xe(i, [-150, 0, 150], [40, 80, 40]), p = xe(i, [-150, 0, 150], [40, 80, 40]), C = xe(
2100
+ i,
2101
+ [-150, 0, 150],
2102
+ [20, 40, 20]
2103
+ ), l = xe(
2104
+ i,
2105
+ [-150, 0, 150],
2106
+ [20, 40, 20]
2107
+ ), c = Se(m, {
2108
+ mass: 0.1,
2109
+ stiffness: 150,
2110
+ damping: 12
2111
+ }), b = Se(p, {
2112
+ mass: 0.1,
2113
+ stiffness: 150,
2114
+ damping: 12
2115
+ }), x = Se(C, {
2116
+ mass: 0.1,
2117
+ stiffness: 150,
2118
+ damping: 12
2119
+ }), A = Se(l, {
2120
+ mass: 0.1,
2121
+ stiffness: 150,
2122
+ damping: 12
2123
+ }), [h, g] = H(!1);
2124
+ return /* @__PURE__ */ t("a", { href: n, children: /* @__PURE__ */ d(
2125
+ R.div,
2126
+ {
2127
+ ref: s,
2128
+ style: { width: c, height: b },
2129
+ onMouseEnter: () => g(!0),
2130
+ onMouseLeave: () => g(!1),
2131
+ className: "aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative",
2132
+ children: [
2133
+ /* @__PURE__ */ t(Ee, { children: h && /* @__PURE__ */ t(
2134
+ R.div,
2135
+ {
2136
+ initial: { opacity: 0, y: 10, x: "-50%" },
2137
+ animate: { opacity: 1, y: 0, x: "-50%" },
2138
+ exit: { opacity: 0, y: 2, x: "-50%" },
2139
+ className: "px-2 py-0.5 whitespace-pre rounded-md bg-gray-100 border dark:bg-neutral-800 dark:border-neutral-900 dark:text-white border-gray-200 text-neutral-700 absolute left-1/2 -translate-x-1/2 -top-8 w-fit text-xs",
2140
+ children: o
2141
+ }
2142
+ ) }),
2143
+ /* @__PURE__ */ t(
2144
+ R.div,
2145
+ {
2146
+ style: { width: x, height: A },
2147
+ className: "flex items-center justify-center",
2148
+ children: a
2149
+ }
2150
+ )
2151
+ ]
2152
+ }
2153
+ ) });
2154
+ }, At = (r) => {
2155
+ const { items: e, className: o } = r, a = Kt(1 / 0);
2156
+ return /* @__PURE__ */ t(
2157
+ R.div,
2158
+ {
2159
+ onMouseMove: (n) => a.set(n.pageX),
2160
+ onMouseLeave: () => a.set(1 / 0),
2161
+ className: Lt(
2162
+ "mx-auto hidden md:flex h-16 gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4 pb-3",
2163
+ o
2164
+ ),
2165
+ children: e.map((n) => /* @__PURE__ */ t($n, { mouseX: a, ...n }, n.title))
2166
+ }
2167
+ );
2168
+ }, Rt = (r) => {
2169
+ const { items: e, className: o, collapseIcon: a, autoHidden: n = !1 } = r, [s, i] = H(!1), m = () => {
2170
+ i(!s);
2171
+ };
2172
+ return /* @__PURE__ */ d(
2173
+ "div",
2174
+ {
2175
+ className: Lt(
2176
+ "relative block",
2177
+ n ? "md:hidden" : "",
2178
+ o
2179
+ ),
2180
+ children: [
2181
+ /* @__PURE__ */ t(Ee, { children: s && /* @__PURE__ */ t(
2182
+ R.div,
2183
+ {
2184
+ layoutId: "nav",
2185
+ className: "absolute bottom-full mb-2 inset-x-0 flex flex-col gap-2",
2186
+ children: e.map((p, C) => /* @__PURE__ */ t(
2187
+ R.div,
2188
+ {
2189
+ initial: { opacity: 0, y: 10 },
2190
+ animate: {
2191
+ opacity: 1,
2192
+ y: 0
2193
+ },
2194
+ exit: {
2195
+ opacity: 0,
2196
+ y: 10,
2197
+ transition: {
2198
+ delay: C * 0.05
2199
+ }
2200
+ },
2201
+ transition: { delay: (e.length - 1 - C) * 0.05 },
2202
+ children: /* @__PURE__ */ t(
2203
+ "a",
2204
+ {
2205
+ href: p.href,
2206
+ className: "h-10 w-10 rounded-full bg-gray-50 dark:bg-neutral-900 flex items-center justify-center",
2207
+ children: /* @__PURE__ */ t("div", { className: "h-4 w-4", children: p.icon })
2208
+ },
2209
+ p.title
2210
+ )
2211
+ },
2212
+ p.title
2213
+ ))
2214
+ }
2215
+ ) }),
2216
+ /* @__PURE__ */ t(
2217
+ "button",
2218
+ {
2219
+ onClick: m,
2220
+ className: "h-10 w-10 rounded-full bg-gray-50 dark:bg-neutral-800 flex items-center justify-center",
2221
+ children: a || /* @__PURE__ */ t(po, { className: "h-5 w-5 text-neutral-500 dark:text-neutral-400" })
2222
+ }
2223
+ )
2224
+ ]
2225
+ }
2226
+ );
2227
+ }, Hn = (r) => {
2228
+ const { items: e, desktopClassName: o, mobileClassName: a, ...n } = r;
2229
+ return /* @__PURE__ */ d(me, { children: [
2230
+ /* @__PURE__ */ t(At, { items: e, className: o, ...n }),
2231
+ /* @__PURE__ */ t(
2232
+ Rt,
2233
+ {
2234
+ items: e,
2235
+ className: a,
2236
+ autoHidden: !0,
2237
+ ...n
2238
+ }
2239
+ )
2240
+ ] });
2241
+ }, Ue = Hn;
2242
+ Ue.Desktop = At;
2243
+ Ue.Mobile = Rt;
2244
+ const On = /* @__PURE__ */ kn({
2245
+ __proto__: null
2246
+ }, [Jr]);
2247
+ function Fn() {
2248
+ try {
2249
+ return On;
2250
+ } catch {
2251
+ return null;
2252
+ }
2253
+ }
2254
+ function _n(r, e) {
2255
+ if (r && typeof r.serializeForClipboard == "function")
2256
+ return r.serializeForClipboard(e);
2257
+ const o = Fn();
2258
+ if (o && typeof (o == null ? void 0 : o.__serializeForClipboard) == "function")
2259
+ return o.__serializeForClipboard(r, e);
2260
+ throw new Error("No supported clipboard serialization method found.");
2261
+ }
2262
+ function jn(r) {
2263
+ const e = r.getBoundingClientRect(), o = r.closest('[role="dialog"]'), a = r.closest(".ProseMirror"), n = a == null ? void 0 : a.getBoundingClientRect(), s = window.pageXOffset || document.documentElement.scrollLeft, i = window.pageYOffset || document.documentElement.scrollTop;
2264
+ if (o && window.getComputedStyle(o).transform !== "none") {
2265
+ const m = o.getBoundingClientRect();
2266
+ return {
2267
+ top: e.top - m.top + i,
2268
+ left: e.left - m.left + s,
2269
+ width: e.width
2270
+ };
2271
+ }
2272
+ return {
2273
+ top: n ? e.top - n.top : e.top + i,
2274
+ left: n ? e.left - n.left : e.left + s,
2275
+ width: e.width
2276
+ };
2277
+ }
2278
+ function Ve(r, e) {
2279
+ const o = [
2280
+ "li",
2281
+ "p:not(:first-child)",
2282
+ "pre",
2283
+ "blockquote",
2284
+ "h1",
2285
+ "h2",
2286
+ "h3",
2287
+ "h4",
2288
+ "h5",
2289
+ "h6",
2290
+ ...e.customNodes.map((a) => `[data-type=${a}]`)
2291
+ ].join(", ");
2292
+ return document.elementsFromPoint(r.x, r.y).find(
2293
+ (a) => {
2294
+ var n, s;
2295
+ return ((s = (n = a.parentElement) == null ? void 0 : n.matches) == null ? void 0 : s.call(n, ".ProseMirror")) || a.matches(o);
2296
+ }
2297
+ );
2298
+ }
2299
+ function We(r, e, o) {
2300
+ var n;
2301
+ const a = r.getBoundingClientRect();
2302
+ return (n = e.posAtCoords({
2303
+ left: a.left + 50 + o.dragHandleWidth,
2304
+ top: a.top + 1
2305
+ })) == null ? void 0 : n.inside;
2306
+ }
2307
+ function Me(r, e) {
2308
+ const o = e.state.doc.resolve(r);
2309
+ return o.depth > 1 ? o.before(o.depth) : r;
2310
+ }
2311
+ function Un(r) {
2312
+ let e = "", o = !1;
2313
+ function a(l, c) {
2314
+ if (c.focus(), !l.dataTransfer) return;
2315
+ const b = Ve(
2316
+ {
2317
+ x: l.clientX + 50 + r.dragHandleWidth,
2318
+ y: l.clientY
2319
+ },
2320
+ r
2321
+ );
2322
+ if (!(b instanceof Element)) return;
2323
+ let x = We(b, c, r);
2324
+ if (x == null || x < 0) return;
2325
+ x = Me(x, c);
2326
+ const { from: A, to: h } = c.state.selection, g = A - h, N = Me(A, c);
2327
+ let v = !1;
2328
+ const I = c.state.doc.resolve(N);
2329
+ if (I.node().type.name === "doc") v = !0;
2330
+ else {
2331
+ const k = K.create(
2332
+ c.state.doc,
2333
+ I.before()
2334
+ );
2335
+ v = !(x + 1 >= k.$from.pos && x <= k.$to.pos);
2336
+ }
2337
+ let u = c.state.selection;
2338
+ if (!v && g !== 0 && !(c.state.selection instanceof K)) {
2339
+ const k = K.create(c.state.doc, h - 1);
2340
+ u = Vr.create(
2341
+ c.state.doc,
2342
+ x,
2343
+ k.$to.pos
2344
+ );
2345
+ } else if (u = K.create(c.state.doc, x), u.node.type.isInline || u.node.type.name === "tableRow") {
2346
+ const k = c.state.doc.resolve(u.from);
2347
+ u = K.create(c.state.doc, k.before());
2348
+ }
2349
+ c.dispatch(c.state.tr.setSelection(u)), c.state.selection instanceof K && c.state.selection.node.type.name === "listItem" && (e = b.parentElement.tagName);
2350
+ const T = c.state.selection.content(), { dom: D, text: w } = _n(c, T);
2351
+ l.dataTransfer.clearData(), l.dataTransfer.setData("text/html", D.innerHTML), l.dataTransfer.setData("text/plain", w), l.dataTransfer.effectAllowed = "copyMove", l.dataTransfer.setDragImage(b, 0, 0), c.dragging = { slice: T, move: l.ctrlKey };
2352
+ }
2353
+ let n = null;
2354
+ function s() {
2355
+ n && n.classList.add("hide");
2356
+ }
2357
+ function i() {
2358
+ n && n.classList.remove("hide");
2359
+ }
2360
+ function m(l, c) {
2361
+ const b = Me(c, l), x = K.create(l.state.doc, b);
2362
+ l.dispatch(l.state.tr.setSelection(x)), l.focus(), o = !0;
2363
+ }
2364
+ function p(l) {
2365
+ if (o = l.state.selection instanceof K, o && (n != null && n.dataset.nodePos)) {
2366
+ const b = parseInt(n.dataset.nodePos, 10);
2367
+ try {
2368
+ const x = l.state.doc.resolve(b);
2369
+ x && x.parent && x.parent.type.name !== "doc" || (o = !1, s());
2370
+ } catch {
2371
+ o = !1, s();
2372
+ }
2373
+ }
2374
+ o && n && !n.classList.contains("hide") ? i() : o || s();
2375
+ }
2376
+ function C(l) {
2377
+ if (!(l.target instanceof Element)) return;
2378
+ const c = l.relatedTarget;
2379
+ if (!c) {
2380
+ o || s();
2381
+ return;
2382
+ }
2383
+ const b = c.closest(".drag-handle") || c.classList.contains("drag-handle"), x = c.closest(".tiptap") || c.classList.contains("tiptap");
2384
+ !b && !x && !o && s();
2385
+ }
2386
+ return new qr({
2387
+ key: new Yr(r.pluginKey),
2388
+ view: (l) => {
2389
+ var h, g, N, v;
2390
+ const c = r.dragHandleSelector ? document.querySelector(r.dragHandleSelector) : null;
2391
+ n = c ?? document.createElement("div"), n.draggable = !0, n.dataset.dragHandle = "", n.classList.add("drag-handle");
2392
+ function b(I) {
2393
+ a(I, l);
2394
+ }
2395
+ n.addEventListener("dragstart", b);
2396
+ function x(I) {
2397
+ c || (I.preventDefault(), I.stopPropagation());
2398
+ const u = n == null ? void 0 : n.dataset.nodePos;
2399
+ u && m(l, parseInt(u, 10));
2400
+ }
2401
+ n.addEventListener("click", x);
2402
+ function A(I) {
2403
+ s();
2404
+ const u = window.scrollY;
2405
+ I.clientY < r.scrollTreshold ? window.scrollTo({ top: u - 30, behavior: "smooth" }) : window.innerHeight - I.clientY < r.scrollTreshold && window.scrollTo({ top: u + 30, behavior: "smooth" });
2406
+ }
2407
+ return n.addEventListener("drag", A), s(), c || (g = (h = l == null ? void 0 : l.dom) == null ? void 0 : h.parentElement) == null || g.appendChild(n), (v = (N = l == null ? void 0 : l.dom) == null ? void 0 : N.parentElement) == null || v.addEventListener(
2408
+ "mouseout",
2409
+ C
2410
+ ), {
2411
+ destroy: () => {
2412
+ var I, u, T;
2413
+ c || (I = n == null ? void 0 : n.remove) == null || I.call(n), n == null || n.removeEventListener("drag", A), n == null || n.removeEventListener(
2414
+ "dragstart",
2415
+ b
2416
+ ), n == null || n.removeEventListener("click", x), n = null, (T = (u = l == null ? void 0 : l.dom) == null ? void 0 : u.parentElement) == null || T.removeEventListener(
2417
+ "mouseout",
2418
+ C
2419
+ );
2420
+ }
2421
+ };
2422
+ },
2423
+ props: {
2424
+ handleDOMEvents: {
2425
+ mousemove: (l, c) => {
2426
+ if (!l.editable)
2427
+ return;
2428
+ const b = Ve(
2429
+ {
2430
+ x: c.clientX + 50 + r.dragHandleWidth,
2431
+ y: c.clientY
2432
+ },
2433
+ r
2434
+ ), x = b == null ? void 0 : b.closest(".not-draggable"), A = r.excludedTags.concat(["ol", "ul"]).join(", ");
2435
+ if (!(b instanceof Element) || b.matches(A) || x) {
2436
+ o || s();
2437
+ return;
2438
+ }
2439
+ const h = We(b, l, r);
2440
+ h != null && h >= 0 && (n.dataset.nodePos = String(
2441
+ Me(h, l)
2442
+ ));
2443
+ const g = window.getComputedStyle(b), N = parseInt(g.lineHeight, 10), v = isNaN(N) ? parseInt(g.fontSize) * 1.2 : N, I = parseInt(g.paddingTop, 10), u = jn(b);
2444
+ u.top += (v - 24) / 2, u.top += I, b.matches("ul:not([data-type=taskList]) li, ol li") && (u.left -= r.dragHandleWidth - 28), u.width = r.dragHandleWidth, n && (n.style.position = "absolute", n.style.left = `${u.left - u.width}px`, n.style.top = `${u.top}px`, i());
2445
+ },
2446
+ keydown: () => {
2447
+ o || s();
2448
+ },
2449
+ mousewheel: () => {
2450
+ o || s();
2451
+ },
2452
+ // 在选择状态变化时更新拖拽按钮的状态
2453
+ selectionChange: (l) => {
2454
+ p(l);
2455
+ },
2456
+ // dragging class is used for CSS
2457
+ dragstart: (l) => {
2458
+ l.dom.classList.add("dragging");
2459
+ },
2460
+ drop: (l, c) => {
2461
+ var g;
2462
+ l.dom.classList.remove("dragging"), s();
2463
+ let b = null;
2464
+ const x = l.posAtCoords({
2465
+ left: c.clientX,
2466
+ top: c.clientY
2467
+ });
2468
+ if (!x || (l.state.selection instanceof K && (b = l.state.selection.node), !b)) return;
2469
+ const h = l.state.doc.resolve(x.pos).parent.type.name === "listItem";
2470
+ if (l.state.selection instanceof K && l.state.selection.node.type.name === "listItem" && !h && e == "OL") {
2471
+ const N = (g = l.state.schema.nodes.orderedList) == null ? void 0 : g.createAndFill(
2472
+ null,
2473
+ b
2474
+ ), v = new Wr(Kr.from(N), 0, 0);
2475
+ l.dragging = { slice: v, move: c.ctrlKey };
2476
+ }
2477
+ },
2478
+ dragend: (l) => {
2479
+ l.dom.classList.remove("dragging");
2480
+ }
2481
+ }
2482
+ },
2483
+ // 简化对文档变化的监听
2484
+ state: {
2485
+ init() {
2486
+ return {};
2487
+ },
2488
+ apply(l, c, b, x) {
2489
+ if (l.docChanged && n && n.dataset.nodePos) {
2490
+ const A = parseInt(n.dataset.nodePos, 10);
2491
+ try {
2492
+ const h = x.doc.resolve(A);
2493
+ (!h || h.parent.type.name === "doc") && (o = !1, s());
2494
+ } catch {
2495
+ o = !1, s();
2496
+ }
2497
+ }
2498
+ return c;
2499
+ }
2500
+ }
2501
+ });
2502
+ }
2503
+ const Xn = Gr.create({
2504
+ name: "globalDragHandle",
2505
+ addOptions() {
2506
+ return {
2507
+ dragHandleWidth: 20,
2508
+ scrollTreshold: 100,
2509
+ excludedTags: [],
2510
+ customNodes: []
2511
+ };
2512
+ },
2513
+ addProseMirrorPlugins() {
2514
+ return [
2515
+ Un({
2516
+ pluginKey: "globalDragHandle",
2517
+ dragHandleWidth: this.options.dragHandleWidth,
2518
+ scrollTreshold: this.options.scrollTreshold,
2519
+ dragHandleSelector: this.options.dragHandleSelector,
2520
+ excludedTags: this.options.excludedTags,
2521
+ customNodes: this.options.customNodes
2522
+ })
2523
+ ];
2524
+ }
2525
+ }), Gn = br, qn = ar.configure({
2526
+ placeholder: "撰写任何内容,或者按“/”输入命令..."
2527
+ }), Yn = sr.configure({
2528
+ HTMLAttributes: {
2529
+ class: q(
2530
+ "text-muted-foreground underline underline-offset-[3px] hover:text-primary transition-colors cursor-pointer"
2531
+ )
2532
+ }
2533
+ }), Vn = ir.extend({
2534
+ addProseMirrorPlugins() {
2535
+ return [
2536
+ lr({
2537
+ imageClass: q("opacity-40 rounded-lg border border-stone-200")
2538
+ })
2539
+ ];
2540
+ }
2541
+ }).configure({
2542
+ allowBase64: !0,
2543
+ HTMLAttributes: {
2544
+ class: q("rounded-lg border border-muted")
2545
+ }
2546
+ }), Wn = cr.configure({
2547
+ HTMLAttributes: {
2548
+ class: q("rounded-lg border border-muted")
2549
+ }
2550
+ }), Kn = dr.configure({
2551
+ HTMLAttributes: {
2552
+ class: q("not-prose pl-2 ")
2553
+ }
2554
+ }), Jn = mr.configure({
2555
+ HTMLAttributes: {
2556
+ class: q("flex gap-2 items-start my-4")
2557
+ },
2558
+ nested: !0
2559
+ }), Zn = ur.configure({
2560
+ HTMLAttributes: {
2561
+ class: q("mt-4 mb-6 border-t border-muted-foreground")
2562
+ }
2563
+ }), Qn = pr.configure({
2564
+ bulletList: {
2565
+ HTMLAttributes: {
2566
+ class: q("list-disc list-outside leading-3 -mt-2")
2567
+ }
2568
+ },
2569
+ orderedList: {
2570
+ HTMLAttributes: {
2571
+ class: q("list-decimal list-outside leading-3 -mt-2")
2572
+ }
2573
+ },
2574
+ listItem: {
2575
+ HTMLAttributes: {
2576
+ class: q("leading-normal -mb-2")
2577
+ }
2578
+ },
2579
+ blockquote: {
2580
+ HTMLAttributes: {
2581
+ class: q("border-l-4 border-primary")
2582
+ }
2583
+ },
2584
+ codeBlock: {
2585
+ HTMLAttributes: {
2586
+ class: q(
2587
+ "rounded-md bg-muted text-muted-foreground border p-5 font-mono font-medium"
2588
+ )
2589
+ }
2590
+ },
2591
+ code: {
2592
+ HTMLAttributes: {
2593
+ class: q("rounded-md bg-muted px-1.5 py-1 font-mono font-medium"),
2594
+ spellcheck: "false"
2595
+ }
2596
+ },
2597
+ horizontalRule: !1,
2598
+ dropcursor: {
2599
+ color: "#DBEAFE",
2600
+ width: 4
2601
+ },
2602
+ gapcursor: !1
2603
+ }), ea = gr.configure({
2604
+ // configure lowlight: common / all / use highlightJS in case there is a need to specify certain language grammars only
2605
+ // common: covers 37 language grammars which should be good enough in most cases
2606
+ lowlight: Ur(Xr)
2607
+ }), ta = fr.configure({
2608
+ HTMLAttributes: {
2609
+ class: q("text-foreground rounded p-1 hover:bg-accent cursor-pointer")
2610
+ },
2611
+ katexOptions: {
2612
+ throwOnError: !1
2613
+ }
2614
+ }), oa = hr.configure(), ra = _r.configure({
2615
+ html: !0,
2616
+ tightLists: !0,
2617
+ tightListClass: "tight",
2618
+ bulletListMarker: "-",
2619
+ linkify: !1,
2620
+ breaks: !1,
2621
+ transformPastedText: !1,
2622
+ transformCopiedText: !1
2623
+ }), na = Xn.configure({
2624
+ dragHandleWidth: 56,
2625
+ dragHandleSelector: ".custom-drag-handle"
2626
+ }), Dt = [
2627
+ Qn,
2628
+ qn,
2629
+ Yn,
2630
+ Vn,
2631
+ Wn,
2632
+ Kn,
2633
+ Jn,
2634
+ Zn,
2635
+ Gn,
2636
+ ea,
2637
+ ta,
2638
+ oa,
2639
+ xr,
2640
+ ra,
2641
+ yr,
2642
+ vr,
2643
+ kr,
2644
+ Cr,
2645
+ na
2646
+ ], aa = ve.Root, Pt = ve.Trigger, Ae = G.forwardRef(({ className: r, align: e = "center", sideOffset: o = 4, ...a }, n) => /* @__PURE__ */ t(ve.Portal, { children: /* @__PURE__ */ t(
2647
+ ve.Content,
2648
+ {
2649
+ ref: n,
2650
+ align: e,
2651
+ sideOffset: o,
2652
+ className: y(
2653
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
2654
+ r
2655
+ ),
2656
+ ...a
2657
+ }
2658
+ ) }));
2659
+ Ae.displayName = ve.Content.displayName;
2660
+ const sa = jr(
2661
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
2662
+ {
2663
+ variants: {
2664
+ variant: {
2665
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
2666
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
2667
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
2668
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
2669
+ ghost: "hover:bg-accent hover:text-accent-foreground",
2670
+ link: "text-primary underline-offset-4 hover:underline"
2671
+ },
2672
+ size: {
2673
+ default: "h-10 px-4 py-2",
2674
+ sm: "h-7 rounded-md px-3",
2675
+ lg: "h-11 rounded-md px-8",
2676
+ icon: "h-10 w-10"
2677
+ }
2678
+ },
2679
+ defaultVariants: {
2680
+ variant: "default",
2681
+ size: "default"
2682
+ }
2683
+ }
2684
+ ), J = G.forwardRef(
2685
+ ({ className: r, variant: e, size: o, asChild: a = !1, ...n }, s) => /* @__PURE__ */ t(
2686
+ a ? Qr : "button",
2687
+ {
2688
+ className: y(sa({ variant: e, size: o, className: r })),
2689
+ ref: s,
2690
+ ...n
2691
+ }
2692
+ )
2693
+ );
2694
+ J.displayName = "Button";
2695
+ const Ke = [
2696
+ {
2697
+ name: "默认",
2698
+ // Default
2699
+ color: "var(--novel-black)"
2700
+ },
2701
+ {
2702
+ name: "紫色",
2703
+ // Purple
2704
+ color: "#9333EA"
2705
+ },
2706
+ {
2707
+ name: "红色",
2708
+ // Red
2709
+ color: "#E00000"
2710
+ },
2711
+ {
2712
+ name: "黄色",
2713
+ // Yellow
2714
+ color: "#EAB308"
2715
+ },
2716
+ {
2717
+ name: "蓝色",
2718
+ // Blue
2719
+ color: "#2563EB"
2720
+ },
2721
+ {
2722
+ name: "绿色",
2723
+ // Green
2724
+ color: "#008A00"
2725
+ },
2726
+ {
2727
+ name: "橙色",
2728
+ // Orange
2729
+ color: "#FFA500"
2730
+ },
2731
+ {
2732
+ name: "粉色",
2733
+ // Pink
2734
+ color: "#BA4081"
2735
+ },
2736
+ {
2737
+ name: "灰色",
2738
+ // Gray
2739
+ color: "#A8A29E"
2740
+ }
2741
+ ], Je = [
2742
+ {
2743
+ name: "默认背景",
2744
+ // Default
2745
+ color: "var(--novel-highlight-default)"
2746
+ },
2747
+ {
2748
+ name: "紫色背景",
2749
+ // Purple
2750
+ color: "var(--novel-highlight-purple)"
2751
+ },
2752
+ {
2753
+ name: "红色背景",
2754
+ // Red
2755
+ color: "var(--novel-highlight-red)"
2756
+ },
2757
+ {
2758
+ name: "黄色背景",
2759
+ // Yellow
2760
+ color: "var(--novel-highlight-yellow)"
2761
+ },
2762
+ {
2763
+ name: "蓝色背景",
2764
+ // Blue
2765
+ color: "var(--novel-highlight-blue)"
2766
+ },
2767
+ {
2768
+ name: "绿色背景",
2769
+ // Green
2770
+ color: "var(--novel-highlight-green)"
2771
+ },
2772
+ {
2773
+ name: "橙色背景",
2774
+ // Orange
2775
+ color: "var(--novel-highlight-orange)"
2776
+ },
2777
+ {
2778
+ name: "粉色背景",
2779
+ // Pink
2780
+ color: "var(--novel-highlight-pink)"
2781
+ },
2782
+ {
2783
+ name: "灰色背景",
2784
+ // Gray
2785
+ color: "var(--novel-highlight-gray)"
2786
+ }
2787
+ ], de = (r) => /* @__PURE__ */ t(
2788
+ et,
2789
+ {
2790
+ classNames: {
2791
+ root: f`
2792
+ background-color: transparent;
2793
+ padding: 0;
2794
+ .rc-tooltip-content {
2795
+ border: none;
2796
+ }
2797
+ `,
2798
+ body: "!p-2 !rounded-md !bg-background !border !border-muted !text-secondary-foreground"
2799
+ },
2800
+ showArrow: !1,
2801
+ ...r
2802
+ }
2803
+ ), ia = ({ open: r, onOpenChange: e }) => {
2804
+ const { editor: o } = Q();
2805
+ if (!o) return null;
2806
+ const a = Ke.find(
2807
+ ({ color: s }) => o.isActive("textStyle", { color: s })
2808
+ ), n = Je.find(
2809
+ ({ color: s }) => o.isActive("highlight", { color: s })
2810
+ );
2811
+ return /* @__PURE__ */ d(aa, { modal: !0, open: r, onOpenChange: e, children: [
2812
+ /* @__PURE__ */ t(de, { overlay: "文本颜色", placement: "top", children: /* @__PURE__ */ t(Pt, { asChild: !0, children: /* @__PURE__ */ d(J, { size: "sm", className: "gap-1 rounded-md pr-0", variant: "ghost", children: [
2813
+ /* @__PURE__ */ t(
2814
+ "span",
2815
+ {
2816
+ className: "rounded-sm px-1",
2817
+ style: {
2818
+ color: a == null ? void 0 : a.color,
2819
+ backgroundColor: n == null ? void 0 : n.color
2820
+ },
2821
+ children: "A"
2822
+ }
2823
+ ),
2824
+ /* @__PURE__ */ t(tt, {})
2825
+ ] }) }) }),
2826
+ /* @__PURE__ */ d(
2827
+ Ae,
2828
+ {
2829
+ sideOffset: 5,
2830
+ className: "my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",
2831
+ align: "start",
2832
+ children: [
2833
+ /* @__PURE__ */ d("div", { className: "flex flex-col", children: [
2834
+ /* @__PURE__ */ t("div", { className: "my-1 px-2 text-sm font-semibold text-muted-foreground", children: "颜色" }),
2835
+ Ke.map(({ name: s, color: i }) => /* @__PURE__ */ d(
2836
+ Le,
2837
+ {
2838
+ onSelect: () => {
2839
+ o.commands.unsetColor(), s !== "Default" && o.chain().focus().setColor(i || "").run(), e(!1);
2840
+ },
2841
+ className: "flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",
2842
+ children: [
2843
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
2844
+ /* @__PURE__ */ t(
2845
+ "div",
2846
+ {
2847
+ className: "rounded-sm border px-2 py-px font-medium",
2848
+ style: { color: i },
2849
+ children: "A"
2850
+ }
2851
+ ),
2852
+ /* @__PURE__ */ t("span", { children: s })
2853
+ ] }),
2854
+ o.isActive("textStyle", { color: i }) && /* @__PURE__ */ t(ye, { size: 14 })
2855
+ ]
2856
+ },
2857
+ s
2858
+ ))
2859
+ ] }),
2860
+ /* @__PURE__ */ d("div", { children: [
2861
+ /* @__PURE__ */ t("div", { className: "my-1 px-2 text-sm font-semibold text-muted-foreground", children: "背景 " }),
2862
+ Je.map(({ name: s, color: i }) => /* @__PURE__ */ d(
2863
+ Le,
2864
+ {
2865
+ onSelect: () => {
2866
+ o.commands.unsetHighlight(), s !== "Default" && o.chain().focus().setHighlight({ color: i }).run(), e(!1);
2867
+ },
2868
+ className: "flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",
2869
+ children: [
2870
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
2871
+ /* @__PURE__ */ t(
2872
+ "div",
2873
+ {
2874
+ className: "rounded-sm border px-2 py-px font-medium",
2875
+ style: { backgroundColor: i },
2876
+ children: "A"
2877
+ }
2878
+ ),
2879
+ /* @__PURE__ */ t("span", { children: s })
2880
+ ] }),
2881
+ o.isActive("highlight", { color: i }) && /* @__PURE__ */ t(ye, { size: 14 })
2882
+ ]
2883
+ },
2884
+ s
2885
+ ))
2886
+ ] })
2887
+ ]
2888
+ }
2889
+ )
2890
+ ] });
2891
+ };
2892
+ function la(r) {
2893
+ try {
2894
+ return new URL(r), !0;
2895
+ } catch {
2896
+ return !1;
2897
+ }
2898
+ }
2899
+ function ca(r) {
2900
+ if (la(r)) return r;
2901
+ try {
2902
+ if (r.includes(".") && !r.includes(" "))
2903
+ return new URL(`https://${r}`).toString();
2904
+ } catch {
2905
+ return null;
2906
+ }
2907
+ }
2908
+ const da = ({ open: r, onOpenChange: e }) => {
2909
+ const o = he(null), { editor: a } = Q();
2910
+ return ie(() => {
2911
+ var n;
2912
+ (n = o.current) == null || n.focus();
2913
+ }), a ? /* @__PURE__ */ d(ft, { modal: !0, open: r, onOpenChange: e, children: [
2914
+ /* @__PURE__ */ t(de, { overlay: "添加链接", placement: "top", children: /* @__PURE__ */ t(Zr, { asChild: !0, children: /* @__PURE__ */ d(
2915
+ J,
2916
+ {
2917
+ size: "sm",
2918
+ variant: "ghost",
2919
+ className: "gap-2 rounded-md border-none",
2920
+ children: [
2921
+ /* @__PURE__ */ t("p", { className: "text-base", children: /* @__PURE__ */ t(go, { size: 16 }) }),
2922
+ /* @__PURE__ */ t(
2923
+ "p",
2924
+ {
2925
+ className: y(
2926
+ "underline decoration-stone-400 underline-offset-4",
2927
+ {
2928
+ "text-blue-500": a.isActive("link")
2929
+ }
2930
+ ),
2931
+ children: "链接 "
2932
+ }
2933
+ )
2934
+ ]
2935
+ }
2936
+ ) }) }),
2937
+ /* @__PURE__ */ t(Ae, { align: "start", className: "w-60 p-0", sideOffset: 10, children: /* @__PURE__ */ d(
2938
+ "form",
2939
+ {
2940
+ onSubmit: (n) => {
2941
+ const s = n.currentTarget;
2942
+ n.preventDefault();
2943
+ const i = s[0], m = ca(i.value);
2944
+ m && (a.chain().focus().setLink({ href: m }).run(), e(!1));
2945
+ },
2946
+ className: "flex p-1 ",
2947
+ children: [
2948
+ /* @__PURE__ */ t(
2949
+ "input",
2950
+ {
2951
+ ref: o,
2952
+ type: "text",
2953
+ placeholder: "粘贴链接",
2954
+ className: "flex-1 bg-background p-1 text-sm outline-none",
2955
+ defaultValue: a.getAttributes("link").href || ""
2956
+ }
2957
+ ),
2958
+ a.getAttributes("link").href ? /* @__PURE__ */ t(
2959
+ J,
2960
+ {
2961
+ size: "icon",
2962
+ variant: "outline",
2963
+ type: "button",
2964
+ className: "flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",
2965
+ onClick: () => {
2966
+ a.chain().focus().unsetLink().run(), o.current.value = "", e(!1);
2967
+ },
2968
+ children: /* @__PURE__ */ t(ot, { className: "h-4 w-4" })
2969
+ }
2970
+ ) : /* @__PURE__ */ t(J, { size: "icon", className: "h-8", children: /* @__PURE__ */ t(ye, { className: "h-4 w-4" }) })
2971
+ ]
2972
+ }
2973
+ ) })
2974
+ ] }) : null;
2975
+ }, ma = () => {
2976
+ const { editor: r } = Q();
2977
+ return r ? /* @__PURE__ */ t(de, { overlay: "标记为公式", placement: "top", children: /* @__PURE__ */ t(
2978
+ J,
2979
+ {
2980
+ variant: "ghost",
2981
+ size: "sm",
2982
+ className: "rounded-md w-12",
2983
+ onClick: () => {
2984
+ if (r.isActive("math"))
2985
+ r.chain().focus().unsetLatex().run();
2986
+ else {
2987
+ const { from: e, to: o } = r.state.selection, a = r.state.doc.textBetween(e, o);
2988
+ if (!a) return;
2989
+ r.chain().focus().setLatex({ latex: a }).run();
2990
+ }
2991
+ },
2992
+ children: /* @__PURE__ */ t(
2993
+ en,
2994
+ {
2995
+ className: y("size-4", { "text-blue-500": r.isActive("math") }),
2996
+ strokeWidth: 2.3
2997
+ }
2998
+ )
2999
+ }
3000
+ ) }) : null;
3001
+ }, Be = [
3002
+ {
3003
+ name: "正文",
3004
+ // Text
3005
+ icon: rt,
3006
+ command: (r) => r.chain().focus().clearNodes().run(),
3007
+ isActive: (r) => r.isActive("paragraph") && !r.isActive("bulletList") && !r.isActive("orderedList")
3008
+ },
3009
+ {
3010
+ name: "标题 1",
3011
+ // Heading 1
3012
+ icon: nt,
3013
+ command: (r) => r.chain().focus().clearNodes().toggleHeading({ level: 1 }).run(),
3014
+ isActive: (r) => r.isActive("heading", { level: 1 })
3015
+ },
3016
+ {
3017
+ name: "标题 2",
3018
+ // Heading 2
3019
+ icon: at,
3020
+ command: (r) => r.chain().focus().clearNodes().toggleHeading({ level: 2 }).run(),
3021
+ isActive: (r) => r.isActive("heading", { level: 2 })
3022
+ },
3023
+ {
3024
+ name: "标题 3",
3025
+ // Heading 3
3026
+ icon: st,
3027
+ command: (r) => r.chain().focus().clearNodes().toggleHeading({ level: 3 }).run(),
3028
+ isActive: (r) => r.isActive("heading", { level: 3 })
3029
+ },
3030
+ {
3031
+ name: "待办列表",
3032
+ // To-do List
3033
+ icon: it,
3034
+ command: (r) => r.chain().focus().clearNodes().toggleTaskList().run(),
3035
+ isActive: (r) => r.isActive("taskItem")
3036
+ },
3037
+ {
3038
+ name: "无序列表",
3039
+ // Bullet List
3040
+ icon: lt,
3041
+ command: (r) => r.chain().focus().clearNodes().toggleBulletList().run(),
3042
+ isActive: (r) => r.isActive("bulletList")
3043
+ },
3044
+ {
3045
+ name: "有序列表",
3046
+ // Numbered List
3047
+ icon: ct,
3048
+ command: (r) => r.chain().focus().clearNodes().toggleOrderedList().run(),
3049
+ isActive: (r) => r.isActive("orderedList")
3050
+ },
3051
+ {
3052
+ name: "引用",
3053
+ // Quote
3054
+ icon: dt,
3055
+ command: (r) => r.chain().focus().clearNodes().toggleBlockquote().run(),
3056
+ isActive: (r) => r.isActive("blockquote")
3057
+ },
3058
+ {
3059
+ name: "代码块",
3060
+ // Code
3061
+ icon: mt,
3062
+ command: (r) => r.chain().focus().clearNodes().toggleCodeBlock().run(),
3063
+ isActive: (r) => r.isActive("codeBlock")
3064
+ }
3065
+ ], ua = ({ open: r, onOpenChange: e }) => {
3066
+ const { editor: o } = Q();
3067
+ if (!o) return null;
3068
+ const a = Be.filter(
3069
+ (n) => n.isActive(o)
3070
+ ).pop() ?? {
3071
+ name: "多个选中"
3072
+ // Multiple
3073
+ };
3074
+ return /* @__PURE__ */ d(ft, { modal: !0, open: r, onOpenChange: e, children: [
3075
+ /* @__PURE__ */ t(de, { overlay: "转换成", placement: "top", children: /* @__PURE__ */ t(
3076
+ Pt,
3077
+ {
3078
+ asChild: !0,
3079
+ className: "rounded-md border-none hover:bg-accent focus:ring-0 pr-0",
3080
+ children: /* @__PURE__ */ d(J, { size: "sm", variant: "ghost", children: [
3081
+ /* @__PURE__ */ t("span", { className: "whitespace-nowrap text-sm", children: a.name }),
3082
+ /* @__PURE__ */ t(tt, {})
3083
+ ] })
3084
+ }
3085
+ ) }),
3086
+ /* @__PURE__ */ d(Ae, { sideOffset: 5, align: "start", className: "w-48 p-1", children: [
3087
+ /* @__PURE__ */ t("p", { className: "mb-2 text-sm text-secondary-foreground", children: "转换成" }),
3088
+ " ",
3089
+ Be.map((n) => /* @__PURE__ */ d(
3090
+ Le,
3091
+ {
3092
+ onSelect: (s) => {
3093
+ n.command(s), e(!1);
3094
+ },
3095
+ className: "flex cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent",
3096
+ children: [
3097
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
3098
+ /* @__PURE__ */ t("div", { className: "rounded-sm border p-1", children: /* @__PURE__ */ t(n.icon, { className: "h-3 w-3" }) }),
3099
+ /* @__PURE__ */ t("span", { children: n.name })
3100
+ ] }),
3101
+ a.name === n.name && /* @__PURE__ */ t(ye, { size: 14 })
3102
+ ]
3103
+ },
3104
+ n.name
3105
+ ))
3106
+ ] })
3107
+ ] });
3108
+ }, pe = G.forwardRef(
3109
+ ({ className: r, orientation: e = "horizontal", decorative: o = !0, ...a }, n) => /* @__PURE__ */ t(
3110
+ ht.Root,
3111
+ {
3112
+ ref: n,
3113
+ decorative: o,
3114
+ orientation: e,
3115
+ className: y(
3116
+ "shrink-0 bg-border",
3117
+ e === "horizontal" ? "h-[1px] w-full" : " w-[1px]",
3118
+ r
3119
+ ),
3120
+ ...a
3121
+ }
3122
+ )
3123
+ );
3124
+ pe.displayName = ht.Root.displayName;
3125
+ const pa = () => /* @__PURE__ */ d("div", { className: "flex items-center justify-center gap-0.5", children: [
3126
+ /* @__PURE__ */ t("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.3s]" }),
3127
+ /* @__PURE__ */ t("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.15s]" }),
3128
+ /* @__PURE__ */ t("div", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500" })
3129
+ ] }), Bt = G.forwardRef(({ className: r, children: e, ...o }, a) => /* @__PURE__ */ d(
3130
+ ce.Root,
3131
+ {
3132
+ ref: a,
3133
+ className: y("relative overflow-hidden", r),
3134
+ ...o,
3135
+ children: [
3136
+ /* @__PURE__ */ t(ce.Viewport, { className: "h-full w-full rounded-[inherit]", children: e }),
3137
+ /* @__PURE__ */ t(zt, {}),
3138
+ /* @__PURE__ */ t(ce.Corner, {})
3139
+ ]
3140
+ }
3141
+ ));
3142
+ Bt.displayName = ce.Root.displayName;
3143
+ const zt = G.forwardRef(({ className: r, orientation: e = "vertical", ...o }, a) => /* @__PURE__ */ t(
3144
+ ce.ScrollAreaScrollbar,
3145
+ {
3146
+ ref: a,
3147
+ orientation: e,
3148
+ className: y(
3149
+ "flex touch-none select-none transition-colors",
3150
+ e === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
3151
+ e === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
3152
+ r
3153
+ ),
3154
+ ...o,
3155
+ children: /* @__PURE__ */ t(ce.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
3156
+ }
3157
+ ));
3158
+ zt.displayName = ce.ScrollAreaScrollbar.displayName;
3159
+ const ga = te.Portal, Et = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3160
+ te.Overlay,
3161
+ {
3162
+ ref: o,
3163
+ className: y(
3164
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
3165
+ r
3166
+ ),
3167
+ ...e
3168
+ }
3169
+ ));
3170
+ Et.displayName = te.Overlay.displayName;
3171
+ const fa = G.forwardRef(({ className: r, children: e, ...o }, a) => /* @__PURE__ */ d(ga, { children: [
3172
+ /* @__PURE__ */ t(Et, {}),
3173
+ /* @__PURE__ */ d(
3174
+ te.Content,
3175
+ {
3176
+ ref: a,
3177
+ className: y(
3178
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
3179
+ r
3180
+ ),
3181
+ ...o,
3182
+ children: [
3183
+ e,
3184
+ /* @__PURE__ */ d(te.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
3185
+ /* @__PURE__ */ t(tn, { className: "h-4 w-4" }),
3186
+ /* @__PURE__ */ t("span", { className: "sr-only", children: "Close" })
3187
+ ] })
3188
+ ]
3189
+ }
3190
+ )
3191
+ ] }));
3192
+ fa.displayName = te.Content.displayName;
3193
+ const ha = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3194
+ te.Title,
3195
+ {
3196
+ ref: o,
3197
+ className: y(
3198
+ "text-lg font-semibold leading-none tracking-tight",
3199
+ r
3200
+ ),
3201
+ ...e
3202
+ }
3203
+ ));
3204
+ ha.displayName = te.Title.displayName;
3205
+ const ba = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3206
+ te.Description,
3207
+ {
3208
+ ref: o,
3209
+ className: y("text-sm text-muted-foreground", r),
3210
+ ...e
3211
+ }
3212
+ ));
3213
+ ba.displayName = te.Description.displayName;
3214
+ const $t = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3215
+ V,
3216
+ {
3217
+ ref: o,
3218
+ className: y(
3219
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
3220
+ r
3221
+ ),
3222
+ ...e
3223
+ }
3224
+ ));
3225
+ $t.displayName = V.displayName;
3226
+ const Ht = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ d("div", { className: "flex items-center border-b px-4", "cmdk-input-wrapper": "", children: [
3227
+ /* @__PURE__ */ t($e, { size: 14, className: "mr-2 shrink-0 text-purple-500 " }),
3228
+ /* @__PURE__ */ t(
3229
+ V.Input,
3230
+ {
3231
+ ref: o,
3232
+ className: y(
3233
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
3234
+ r
3235
+ ),
3236
+ ...e
3237
+ }
3238
+ )
3239
+ ] }));
3240
+ Ht.displayName = V.Input.displayName;
3241
+ const xa = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3242
+ V.List,
3243
+ {
3244
+ ref: o,
3245
+ className: y("max-h-[300px] overflow-y-auto overflow-x-hidden", r),
3246
+ ...e
3247
+ }
3248
+ ));
3249
+ xa.displayName = V.List.displayName;
3250
+ const ya = G.forwardRef((r, e) => /* @__PURE__ */ t(
3251
+ V.Empty,
3252
+ {
3253
+ ref: e,
3254
+ className: "py-6 text-center text-sm",
3255
+ ...r
3256
+ }
3257
+ ));
3258
+ ya.displayName = V.Empty.displayName;
3259
+ const Ce = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3260
+ V.Group,
3261
+ {
3262
+ ref: o,
3263
+ className: y(
3264
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
3265
+ r
3266
+ ),
3267
+ ...e
3268
+ }
3269
+ ));
3270
+ Ce.displayName = V.Group.displayName;
3271
+ const Xe = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3272
+ V.Separator,
3273
+ {
3274
+ ref: o,
3275
+ className: y("-mx-1 h-px bg-border", r),
3276
+ ...e
3277
+ }
3278
+ ));
3279
+ Xe.displayName = V.Separator.displayName;
3280
+ const ge = G.forwardRef(({ className: r, ...e }, o) => /* @__PURE__ */ t(
3281
+ V.Item,
3282
+ {
3283
+ ref: o,
3284
+ className: y(
3285
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50",
3286
+ r
3287
+ ),
3288
+ ...e
3289
+ }
3290
+ ));
3291
+ ge.displayName = V.Item.displayName;
3292
+ const va = ({
3293
+ completion: r,
3294
+ onDiscard: e
3295
+ }) => {
3296
+ const { editor: o } = Q();
3297
+ return /* @__PURE__ */ d(me, { children: [
3298
+ /* @__PURE__ */ d(Ce, { children: [
3299
+ /* @__PURE__ */ d(
3300
+ ge,
3301
+ {
3302
+ className: "gap-2 px-4",
3303
+ value: "replace",
3304
+ onSelect: () => {
3305
+ const a = o.view.state.selection;
3306
+ o.chain().focus().insertContentAt(
3307
+ {
3308
+ from: a.from,
3309
+ to: a.to
3310
+ },
3311
+ r
3312
+ ).run();
3313
+ },
3314
+ children: [
3315
+ /* @__PURE__ */ t(on, { className: "h-4 w-4 text-muted-foreground" }),
3316
+ "替换选择"
3317
+ ]
3318
+ }
3319
+ ),
3320
+ /* @__PURE__ */ d(
3321
+ ge,
3322
+ {
3323
+ className: "gap-2 px-4",
3324
+ value: "insert",
3325
+ onSelect: () => {
3326
+ const a = o.view.state.selection;
3327
+ o.chain().focus().insertContentAt(a.to + 1, r).run();
3328
+ },
3329
+ children: [
3330
+ /* @__PURE__ */ t(rn, { className: "h-4 w-4 text-muted-foreground" }),
3331
+ "在下面插入"
3332
+ ]
3333
+ }
3334
+ )
3335
+ ] }),
3336
+ /* @__PURE__ */ t(Xe, {}),
3337
+ /* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ d(ge, { onSelect: e, value: "thrash", className: "gap-2 px-4", children: [
3338
+ /* @__PURE__ */ t(nn, { className: "h-4 w-4 text-muted-foreground" }),
3339
+ "丢弃"
3340
+ ] }) })
3341
+ ] });
3342
+ }, ka = [
3343
+ {
3344
+ value: "improve",
3345
+ label: "改进写作",
3346
+ // Improve writing
3347
+ icon: an
3348
+ },
3349
+ {
3350
+ value: "fix",
3351
+ label: "修正语法",
3352
+ // Fix grammar
3353
+ icon: sn
3354
+ },
3355
+ {
3356
+ value: "shorter",
3357
+ label: "缩短文本",
3358
+ // Make shorter
3359
+ icon: ln
3360
+ },
3361
+ {
3362
+ value: "longer",
3363
+ label: "扩展文本",
3364
+ // Make longer
3365
+ icon: cn
3366
+ }
3367
+ ], Ca = ({ onSelect: r }) => {
3368
+ const { editor: e } = Q();
3369
+ return /* @__PURE__ */ d(me, { children: [
3370
+ /* @__PURE__ */ d(Ce, { heading: "编辑或校对选中文本", children: [
3371
+ " ",
3372
+ ka.map((o) => /* @__PURE__ */ d(
3373
+ ge,
3374
+ {
3375
+ onSelect: (a) => {
3376
+ const n = e.state.selection.content(), s = e.storage.markdown.serializer.serialize(
3377
+ n.content
3378
+ );
3379
+ r(s, a);
3380
+ },
3381
+ className: "flex gap-2 px-4",
3382
+ value: o.value,
3383
+ children: [
3384
+ /* @__PURE__ */ t(o.icon, { className: "h-4 w-4 text-purple-500" }),
3385
+ o.label
3386
+ ]
3387
+ },
3388
+ o.value
3389
+ ))
3390
+ ] }),
3391
+ /* @__PURE__ */ t(Xe, {}),
3392
+ /* @__PURE__ */ d(Ce, { heading: "使用 AI 完成更多", children: [
3393
+ " ",
3394
+ /* @__PURE__ */ d(
3395
+ ge,
3396
+ {
3397
+ onSelect: () => {
3398
+ const o = e.state.selection.from, a = wr(e, o);
3399
+ r(a, "continue");
3400
+ },
3401
+ value: "continue",
3402
+ className: "gap-2 px-4",
3403
+ children: [
3404
+ /* @__PURE__ */ t(dn, { className: "h-4 w-4 text-purple-500" }),
3405
+ "继续写作"
3406
+ ]
3407
+ }
3408
+ )
3409
+ ] })
3410
+ ] });
3411
+ };
3412
+ function wa({ onOpenChange: r, options: e }) {
3413
+ const { editor: o } = Q(), [a, n] = H(""), { completion: s, complete: i, isLoading: m } = bn({
3414
+ // id: "novel",
3415
+ api: "/api/generate",
3416
+ onResponse: (C) => {
3417
+ if (C.status === 429) {
3418
+ ke.error("You have reached your request limit for the day.");
3419
+ return;
3420
+ }
3421
+ },
3422
+ onError: (C) => {
3423
+ ke.error(C.message);
3424
+ },
3425
+ ...e
3426
+ }), p = s.length > 0;
3427
+ return /* @__PURE__ */ d($t, { className: "w-[350px]", children: [
3428
+ p && /* @__PURE__ */ t("div", { className: "flex max-h-[400px]", children: /* @__PURE__ */ t(Bt, { children: /* @__PURE__ */ t("div", { className: "prose p-2 px-4 prose-sm", children: /* @__PURE__ */ t(pt, { children: s }) }) }) }),
3429
+ m && /* @__PURE__ */ d("div", { className: "flex h-12 w-full items-center px-4 text-sm font-medium text-muted-foreground text-purple-500", children: [
3430
+ /* @__PURE__ */ t($e, { size: 14, className: "mr-2 shrink-0" }),
3431
+ "AI正在思考",
3432
+ /* @__PURE__ */ t("div", { className: "ml-2 mt-1", children: /* @__PURE__ */ t(pa, {}) })
3433
+ ] }),
3434
+ !m && /* @__PURE__ */ d(me, { children: [
3435
+ /* @__PURE__ */ d("div", { className: "relative", children: [
3436
+ /* @__PURE__ */ t(
3437
+ Ht,
3438
+ {
3439
+ value: a,
3440
+ onValueChange: n,
3441
+ autoFocus: !0,
3442
+ placeholder: p ? "告诉AI下一步该怎么做" : "要求AI编辑或生成……",
3443
+ onFocus: () => Nr(o)
3444
+ }
3445
+ ),
3446
+ /* @__PURE__ */ t(
3447
+ J,
3448
+ {
3449
+ size: "icon",
3450
+ className: "absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 rounded-full bg-purple-500 hover:bg-purple-900",
3451
+ onClick: () => {
3452
+ if (s)
3453
+ return i(s, {
3454
+ body: { option: "zap", command: a }
3455
+ }).then(() => n(""));
3456
+ const C = o.state.selection.content(), l = o.storage.markdown.serializer.serialize(
3457
+ C.content
3458
+ );
3459
+ i(l, {
3460
+ body: { option: "zap", command: a }
3461
+ }).then(() => n(""));
3462
+ },
3463
+ children: /* @__PURE__ */ t(mn, { className: "h-4 w-4" })
3464
+ }
3465
+ )
3466
+ ] }),
3467
+ p ? /* @__PURE__ */ t(
3468
+ va,
3469
+ {
3470
+ onDiscard: () => {
3471
+ o.chain().unsetHighlight().focus().run(), r(!1);
3472
+ },
3473
+ completion: s
3474
+ }
3475
+ ) : /* @__PURE__ */ t(
3476
+ Ca,
3477
+ {
3478
+ onSelect: (C, l) => i(C, { body: { option: l } })
3479
+ }
3480
+ )
3481
+ ] })
3482
+ ] });
3483
+ }
3484
+ const Na = ({
3485
+ children: r,
3486
+ open: e,
3487
+ onOpenChange: o,
3488
+ enableAI: a = !1,
3489
+ aiOptions: n
3490
+ }) => {
3491
+ const { editor: s } = Q();
3492
+ return ie(() => {
3493
+ e || Ir(s);
3494
+ }, [e]), /* @__PURE__ */ d(
3495
+ Sr,
3496
+ {
3497
+ tippyOptions: {
3498
+ placement: e ? "bottom-start" : "top",
3499
+ onHidden: () => {
3500
+ o(!1), s.chain().unsetHighlight().run();
3501
+ }
3502
+ },
3503
+ className: "flex w-fit max-w-[90vw] overflow-hidden rounded-lg border border-muted bg-background shadow-xl p-1 gap-1",
3504
+ children: [
3505
+ e && a && /* @__PURE__ */ t(
3506
+ wa,
3507
+ {
3508
+ open: e,
3509
+ onOpenChange: o,
3510
+ options: n
3511
+ }
3512
+ ),
3513
+ !e && /* @__PURE__ */ d(Yt, { children: [
3514
+ a && /* @__PURE__ */ d(
3515
+ J,
3516
+ {
3517
+ className: "gap-1 text-purple-500",
3518
+ variant: "ghost",
3519
+ onClick: () => o(!0),
3520
+ size: "sm",
3521
+ children: [
3522
+ /* @__PURE__ */ t($e, { size: 14 }),
3523
+ "询问AI"
3524
+ ]
3525
+ }
3526
+ ),
3527
+ r
3528
+ ] })
3529
+ ]
3530
+ }
3531
+ );
3532
+ }, Ia = (r) => {
3533
+ const e = fetch("/api/upload", {
3534
+ method: "POST",
3535
+ headers: {
3536
+ "content-type": (r == null ? void 0 : r.type) || "application/octet-stream",
3537
+ "x-vercel-filename": (r == null ? void 0 : r.name) || "image.png"
3538
+ },
3539
+ body: r
3540
+ });
3541
+ return new Promise((o, a) => {
3542
+ ke.promise(
3543
+ e.then(async (n) => {
3544
+ if (n.status === 200) {
3545
+ const { url: s } = await n.json(), i = new Image();
3546
+ i.src = s, i.onload = () => {
3547
+ o(s);
3548
+ };
3549
+ } else throw n.status === 401 ? (o(r), new Error("`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead.")) : new Error("Error uploading image. Please try again.");
3550
+ }),
3551
+ {
3552
+ loading: "Uploading image...",
3553
+ success: "Image uploaded successfully.",
3554
+ error: (n) => (a(n), n.message)
3555
+ }
3556
+ );
3557
+ });
3558
+ }, Sa = gt({
3559
+ onUpload: Ia,
3560
+ validateFn: (r) => r.type.includes("image/") ? r.size / 1024 / 1024 > 20 ? (ke.error("File size too big (max 20MB)."), !1) : !0 : (ke.error("File type not supported."), !1)
3561
+ }), Ta = () => {
3562
+ const { editor: r } = Q();
3563
+ return r ? /* @__PURE__ */ t("div", { className: "flex", children: [
3564
+ {
3565
+ name: "粗体",
3566
+ // bold
3567
+ isActive: (o) => o.isActive("bold"),
3568
+ command: (o) => o.chain().focus().toggleBold().run(),
3569
+ icon: un
3570
+ },
3571
+ {
3572
+ name: "斜体",
3573
+ // italic
3574
+ isActive: (o) => o.isActive("italic"),
3575
+ command: (o) => o.chain().focus().toggleItalic().run(),
3576
+ icon: pn
3577
+ },
3578
+ {
3579
+ name: "下划线",
3580
+ // underline
3581
+ isActive: (o) => o.isActive("underline"),
3582
+ command: (o) => o.chain().focus().toggleUnderline().run(),
3583
+ icon: gn
3584
+ },
3585
+ {
3586
+ name: "删除线",
3587
+ // strike
3588
+ isActive: (o) => o.isActive("strike"),
3589
+ command: (o) => o.chain().focus().toggleStrike().run(),
3590
+ icon: fn
3591
+ },
3592
+ {
3593
+ name: "代码",
3594
+ // code
3595
+ isActive: (o) => o.isActive("code"),
3596
+ command: (o) => o.chain().focus().toggleCode().run(),
3597
+ icon: hn
3598
+ }
3599
+ ].map((o) => /* @__PURE__ */ t(
3600
+ Le,
3601
+ {
3602
+ onSelect: (a) => {
3603
+ o.command(a);
3604
+ },
3605
+ children: /* @__PURE__ */ t(de, { overlay: o.name, placement: "top", children: /* @__PURE__ */ t(
3606
+ J,
3607
+ {
3608
+ size: "sm",
3609
+ className: "rounded-md",
3610
+ variant: "ghost",
3611
+ type: "button",
3612
+ children: /* @__PURE__ */ t(
3613
+ o.icon,
3614
+ {
3615
+ className: y("h-4 w-4", {
3616
+ "text-blue-500": o.isActive(r)
3617
+ })
3618
+ }
3619
+ )
3620
+ }
3621
+ ) })
3622
+ },
3623
+ o.name
3624
+ )) }) : null;
3625
+ }, Ot = ({ uploadFn: r }) => Mr([
3626
+ {
3627
+ title: "文本",
3628
+ // "Text",
3629
+ description: "从纯文本开始编写。",
3630
+ // "Just start typing with plain text.",
3631
+ searchTerms: ["p", "paragraph"],
3632
+ icon: /* @__PURE__ */ t(rt, { size: 18 }),
3633
+ command: ({ editor: e, range: o }) => {
3634
+ e.chain().focus().deleteRange(o).toggleNode("paragraph", "paragraph").run();
3635
+ }
3636
+ },
3637
+ {
3638
+ title: "标题1",
3639
+ // "Heading 1",
3640
+ description: "大标题。",
3641
+ // "Big section heading.",
3642
+ searchTerms: ["title", "big", "large"],
3643
+ icon: /* @__PURE__ */ t(nt, { size: 18 }),
3644
+ command: ({ editor: e, range: o }) => {
3645
+ e.chain().focus().deleteRange(o).setNode("heading", { level: 1 }).run();
3646
+ }
3647
+ },
3648
+ {
3649
+ title: "标题2",
3650
+ // "Heading 2",
3651
+ description: "中标题。",
3652
+ // "Medium section heading.",
3653
+ searchTerms: ["subtitle", "medium"],
3654
+ icon: /* @__PURE__ */ t(at, { size: 18 }),
3655
+ command: ({ editor: e, range: o }) => {
3656
+ e.chain().focus().deleteRange(o).setNode("heading", { level: 2 }).run();
3657
+ }
3658
+ },
3659
+ {
3660
+ title: "标题3",
3661
+ // "Heading 3",
3662
+ description: "小标题。",
3663
+ // "Small section heading.",
3664
+ searchTerms: ["subtitle", "small"],
3665
+ icon: /* @__PURE__ */ t(st, { size: 18 }),
3666
+ command: ({ editor: e, range: o }) => {
3667
+ e.chain().focus().deleteRange(o).setNode("heading", { level: 3 }).run();
3668
+ }
3669
+ },
3670
+ {
3671
+ title: "待办清单",
3672
+ // "To-do List",
3673
+ description: "使用待办清单追踪任务。",
3674
+ // "Track tasks with a to-do list.",
3675
+ searchTerms: ["todo", "task", "list", "check", "checkbox"],
3676
+ icon: /* @__PURE__ */ t(it, { size: 18 }),
3677
+ command: ({ editor: e, range: o }) => {
3678
+ e.chain().focus().deleteRange(o).toggleTaskList().run();
3679
+ }
3680
+ },
3681
+ {
3682
+ title: "项目符号列表",
3683
+ // "Bullet List",
3684
+ description: "创建一个简单的项目符号列表。",
3685
+ // "Create a simple bullet list.",
3686
+ searchTerms: ["unordered", "point"],
3687
+ icon: /* @__PURE__ */ t(lt, { size: 18 }),
3688
+ command: ({ editor: e, range: o }) => {
3689
+ e.chain().focus().deleteRange(o).toggleBulletList().run();
3690
+ }
3691
+ },
3692
+ {
3693
+ title: "有序列表",
3694
+ // "Numbered List",
3695
+ description: "创建一个带有序号的列表。",
3696
+ // "Create a list with numbering.",
3697
+ searchTerms: ["ordered"],
3698
+ icon: /* @__PURE__ */ t(ct, { size: 18 }),
3699
+ command: ({ editor: e, range: o }) => {
3700
+ e.chain().focus().deleteRange(o).toggleOrderedList().run();
3701
+ }
3702
+ },
3703
+ {
3704
+ title: "引用",
3705
+ // "Quote",
3706
+ description: "摘取引用。",
3707
+ // "Capture a quote.",
3708
+ searchTerms: ["blockquote"],
3709
+ icon: /* @__PURE__ */ t(dt, { size: 18 }),
3710
+ command: ({ editor: e, range: o }) => e.chain().focus().deleteRange(o).toggleNode("paragraph", "paragraph").toggleBlockquote().run()
3711
+ },
3712
+ {
3713
+ title: "代码",
3714
+ // "Code",
3715
+ description: "捕获代码段。",
3716
+ // "Capture a code snippet.",
3717
+ searchTerms: ["codeblock"],
3718
+ icon: /* @__PURE__ */ t(mt, { size: 18 }),
3719
+ command: ({ editor: e, range: o }) => e.chain().focus().deleteRange(o).toggleCodeBlock().run()
3720
+ },
3721
+ {
3722
+ title: "图片",
3723
+ // "Image",
3724
+ description: "从您的计算机上传图像。",
3725
+ // "Upload an image from your computer.",
3726
+ searchTerms: ["photo", "picture", "media"],
3727
+ icon: /* @__PURE__ */ t(fo, { size: 18 }),
3728
+ command: ({ editor: e, range: o }) => {
3729
+ e.chain().focus().deleteRange(o).run();
3730
+ const a = document.createElement("input");
3731
+ a.type = "file", a.accept = "image/*", a.onchange = async () => {
3732
+ var n;
3733
+ if ((n = a.files) != null && n.length) {
3734
+ const s = a.files[0], i = e.view.state.selection.from;
3735
+ r(s, e.view, i);
3736
+ }
3737
+ }, a.click();
3738
+ }
3739
+ }
3740
+ ]), Ma = (r) => Tr.configure({
3741
+ suggestion: {
3742
+ items: () => Ot(r),
3743
+ render: Lr
3744
+ }
3745
+ }), La = {
3746
+ type: "doc",
3747
+ content: []
3748
+ }, Ft = Vt(({ children: r, items: e, ...o }, a) => {
3749
+ const n = (i) => /* @__PURE__ */ d(
3750
+ Te.Item,
3751
+ {
3752
+ onClick: i.onClick,
3753
+ className: y(
3754
+ "gap-2 !p-1.5 text-sm hover:bg-accent focus:ring-0 rounded-md cursor-pointer",
3755
+ i.className
3756
+ ),
3757
+ itemIcon: i.isActive ? /* @__PURE__ */ t(ye, { size: 16 }) : void 0,
3758
+ children: [
3759
+ i.icon,
3760
+ i.label,
3761
+ /* @__PURE__ */ t("div", { className: "flex-1" })
3762
+ ]
3763
+ },
3764
+ i.key
3765
+ ), s = (i) => {
3766
+ var m;
3767
+ return /* @__PURE__ */ t(
3768
+ Te.SubMenu,
3769
+ {
3770
+ expandIcon: /* @__PURE__ */ t(ho, { size: 16 }),
3771
+ popupClassName: y(
3772
+ "!rounded-lg border border-muted bg-background shadow-xl !p-2 min-w-48 !m-0 z-[1080]",
3773
+ f`
3774
+ .rc-menu {
3775
+ border: none !important;
3776
+ box-shadow: none !important;
3777
+ }
3778
+ `
3779
+ ),
3780
+ popupOffset: [4, 0],
3781
+ className: y(
3782
+ "gap-2 !p-0 text-sm hover:bg-accent focus:ring-0 rounded-md cursor-pointer",
3783
+ f`
3784
+ .rc-menu-submenu-title {
3785
+ display: flex;
3786
+ align-items: center;
3787
+ gap: 0.5rem;
3788
+ padding: 0.375rem 0 0.375rem 0.375rem !important;
3789
+ border-radius: calc(var(--radius) - 2px);
3790
+
3791
+ &:hover {
3792
+ background-color: transparent !important;
3793
+ }
3794
+ }
3795
+ `
3796
+ ),
3797
+ title: /* @__PURE__ */ d(me, { children: [
3798
+ i.icon,
3799
+ i.label,
3800
+ /* @__PURE__ */ t("div", { className: "flex-1" })
3801
+ ] }),
3802
+ children: (m = i.children) == null ? void 0 : m.map(n)
3803
+ },
3804
+ i.key
3805
+ );
3806
+ };
3807
+ return /* @__PURE__ */ t(
3808
+ yn,
3809
+ {
3810
+ ref: a,
3811
+ trigger: "click",
3812
+ overlay: /* @__PURE__ */ t(
3813
+ Te,
3814
+ {
3815
+ className: y(
3816
+ "!rounded-lg border border-muted bg-background shadow-xl !p-2 min-w-48 !m-0",
3817
+ f`
3818
+ .rc-menu-submenu-active {
3819
+ .rc-menu-submenu-title {
3820
+ background-color: hsl(var(--accent)) !important;
3821
+ }
3822
+ }
3823
+ `
3824
+ ),
3825
+ ...o,
3826
+ children: e.map((i) => i.type === "divider" ? /* @__PURE__ */ t(Te.Divider, { className: "!my-1" }, i.key) : i.type === "submenu" ? s(i) : n(i))
3827
+ }
3828
+ ),
3829
+ ...o,
3830
+ children: r
3831
+ }
3832
+ );
3833
+ });
3834
+ Ft.displayName = "DropdownMenu";
3835
+ const Aa = ({ children: r, ...e }) => {
3836
+ const { editor: o } = Q(), a = () => {
3837
+ o && o.state.selection instanceof K && (o.commands.deleteSelection(), o.commands.focus());
3838
+ }, n = () => {
3839
+ if (o && o.state.selection instanceof K) {
3840
+ const m = o.state.selection.node, p = o.state.selection.to;
3841
+ o.chain().insertContentAt(p, {
3842
+ type: m.type.name,
3843
+ attrs: { ...m.attrs },
3844
+ content: m.content.toJSON()
3845
+ }).focus().run();
3846
+ }
3847
+ }, s = Be.map((m) => ({
3848
+ key: `transform-${m.name}`,
3849
+ icon: /* @__PURE__ */ t(m.icon, { size: 16 }),
3850
+ label: m.name,
3851
+ onClick: () => {
3852
+ o && o.state.selection instanceof K && m.command(o);
3853
+ },
3854
+ isActive: m.isActive(o)
3855
+ }));
3856
+ return /* @__PURE__ */ t(Ft, { items: [
3857
+ {
3858
+ key: "transform",
3859
+ type: "submenu",
3860
+ icon: /* @__PURE__ */ t(bo, { size: 16 }),
3861
+ label: "转换成",
3862
+ children: s
3863
+ },
3864
+ {
3865
+ key: "duplicate",
3866
+ icon: /* @__PURE__ */ t(xo, { size: 16 }),
3867
+ label: "创建副本",
3868
+ onClick: n
3869
+ },
3870
+ { key: "divider", type: "divider" },
3871
+ {
3872
+ key: "delete",
3873
+ icon: /* @__PURE__ */ t(ot, { size: 16 }),
3874
+ label: "删除",
3875
+ className: "text-red-500",
3876
+ onClick: a
3877
+ }
3878
+ ], ...e, children: r });
3879
+ }, Ra = () => {
3880
+ const { editor: r } = Q(), e = (o) => {
3881
+ if (!r) return;
3882
+ const a = o.target.closest(".custom-drag-handle");
3883
+ if (!a) return;
3884
+ const n = a.dataset.nodePos, s = n !== void 0 ? parseInt(a.dataset.nodePos || "0", 10) : n;
3885
+ s !== void 0 && (r.commands.focus(), r.commands.setNodeSelection(s), r.commands.createParagraphNear() ? r.commands.insertContent("/") : r.chain().insertContentAt(s, {
3886
+ type: "paragraph",
3887
+ content: [{ type: "text", text: "/" }]
3888
+ }).run());
3889
+ };
3890
+ return /* @__PURE__ */ d(
3891
+ "div",
3892
+ {
3893
+ className: y(
3894
+ "custom-drag-handle",
3895
+ f`
3896
+ width: auto;
3897
+ background: none;
3898
+ display: flex;
3899
+ align-items: center;
3900
+ `
3901
+ ),
3902
+ children: [
3903
+ /* @__PURE__ */ t(
3904
+ de,
3905
+ {
3906
+ placement: "bottom",
3907
+ overlay: /* @__PURE__ */ d("div", { children: [
3908
+ "点击",
3909
+ /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "以在下方添加快" })
3910
+ ] }),
3911
+ children: /* @__PURE__ */ t(
3912
+ J,
3913
+ {
3914
+ size: "icon",
3915
+ variant: "ghost",
3916
+ className: "w-auto h-auto p-0.5",
3917
+ onClick: e,
3918
+ children: /* @__PURE__ */ t(yo, { className: "cursor-pointer", size: 22 })
3919
+ }
3920
+ )
3921
+ }
3922
+ ),
3923
+ /* @__PURE__ */ t(Aa, { children: /* @__PURE__ */ t(
3924
+ de,
3925
+ {
3926
+ placement: "bottom",
3927
+ overlay: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ d("div", { children: [
3928
+ "拖动",
3929
+ /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "以移动" })
3930
+ ] }) }),
3931
+ children: /* @__PURE__ */ t(J, { size: "icon", variant: "ghost", className: "w-auto h-auto p-0.5", children: /* @__PURE__ */ t(vo, { size: 22 }) })
3932
+ }
3933
+ ) })
3934
+ ]
3935
+ }
3936
+ );
3937
+ }, Da = (r) => {
3938
+ const {
3939
+ className: e,
3940
+ initialContent: o = {},
3941
+ onChange: a,
3942
+ cacheKey: n = "novel-content",
3943
+ enableCache: s = !1,
3944
+ showSaveStatus: i = !0,
3945
+ showWordCount: m = !0,
3946
+ uploadImageProps: p,
3947
+ editorRef: C,
3948
+ enableAI: l = !1,
3949
+ aiOptions: c
3950
+ } = r, [b, x] = H(
3951
+ o
3952
+ ), [A, h] = H("Saved"), [g, N] = H(), [v, I] = H(!1), [u, T] = H(!1), [D, w] = H(!1), [k, U] = H(!1), Z = (S) => {
3953
+ const O = new DOMParser().parseFromString(S, "text/html");
3954
+ return O.querySelectorAll("pre code").forEach((B) => {
3955
+ xn.highlightElement(B);
3956
+ }), new XMLSerializer().serializeToString(O);
3957
+ }, _ = Fr(
3958
+ async (S) => {
3959
+ const O = S.getJSON();
3960
+ N(S.storage.characterCount.words()), a == null || a(O), s && (window.localStorage.setItem(
3961
+ "html-content",
3962
+ Z(S.getHTML())
3963
+ ), window.localStorage.setItem(n, JSON.stringify(O)), window.localStorage.setItem(
3964
+ "markdown",
3965
+ S.storage.markdown.getMarkdown()
3966
+ ), h("Saved"));
3967
+ },
3968
+ 500
3969
+ ), ae = fe(() => {
3970
+ if (!p) return Sa;
3971
+ const {
3972
+ beforeUpload: S,
3973
+ maxSize: O,
3974
+ action: B,
3975
+ headers: W,
3976
+ method: re,
3977
+ name: Re,
3978
+ onSuccess: we,
3979
+ onError: Ne
3980
+ } = p;
3981
+ return gt({
3982
+ onUpload: (se) => {
3983
+ const M = new FormData();
3984
+ M.append(Re || "file", se);
3985
+ const X = fetch(B, {
3986
+ method: re || "POST",
3987
+ headers: {
3988
+ ...W
3989
+ },
3990
+ body: M
3991
+ });
3992
+ return new Promise((F, E) => {
3993
+ X.then(async (P) => {
3994
+ if (we) {
3995
+ const z = await P.json();
3996
+ F(we(z));
3997
+ return;
3998
+ }
3999
+ if (P.status === 200) {
4000
+ const { url: z } = await P.json(), L = new Image();
4001
+ L.src = z, L.onload = () => {
4002
+ F(z);
4003
+ };
4004
+ } else throw P.status === 401 ? (F(se), new Error(
4005
+ "`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead."
4006
+ )) : new Error("Error uploading image. Please try again.");
4007
+ }).catch((P) => {
4008
+ Ne && Ne(P), E(P);
4009
+ });
4010
+ });
4011
+ },
4012
+ validateFn: (se) => S ? S(se) : se.type.includes("image/") ? O && se.size > O ? (console.error("File size too big (max 20MB)."), !1) : !0 : (console.error("File type not supported."), !1)
4013
+ });
4014
+ }, [p]);
4015
+ if (ie(() => {
4016
+ if (!s) return;
4017
+ const S = window.localStorage.getItem(n);
4018
+ x(S ? JSON.parse(S) : La);
4019
+ }, [n, s]), !b) return null;
4020
+ const oe = [
4021
+ ...Dt,
4022
+ Ma({
4023
+ uploadFn: ae
4024
+ })
4025
+ ];
4026
+ return /* @__PURE__ */ d("div", { className: y("relative w-full max-w-screen-lg", e), children: [
4027
+ (s && i || m) && /* @__PURE__ */ d("div", { className: "flex absolute right-5 top-5 z-10 mb-5 gap-2", children: [
4028
+ s && i && /* @__PURE__ */ t("div", { className: "rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground", children: A }),
4029
+ m && /* @__PURE__ */ d(
4030
+ "div",
4031
+ {
4032
+ className: g ? "rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground" : "hidden",
4033
+ children: [
4034
+ g,
4035
+ " Words"
4036
+ ]
4037
+ }
4038
+ )
4039
+ ] }),
4040
+ /* @__PURE__ */ t(Ar, { children: /* @__PURE__ */ d(
4041
+ Rr,
4042
+ {
4043
+ onCreate: ({ editor: S }) => {
4044
+ C && (C.current = S);
4045
+ },
4046
+ initialContent: b,
4047
+ extensions: oe,
4048
+ className: "relative min-h-[500px] w-full max-w-screen-lg border-muted bg-background sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:shadow-lg editor-content",
4049
+ editorProps: {
4050
+ handleDOMEvents: {
4051
+ keydown: (S, O) => Br(O)
4052
+ },
4053
+ handlePaste: (S, O) => Pr(S, O, ae),
4054
+ handleDrop: (S, O, B, W) => Dr(S, O, W, ae),
4055
+ attributes: {
4056
+ class: "prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"
4057
+ }
4058
+ },
4059
+ onUpdate: ({ editor: S }) => {
4060
+ _(S), h("Unsaved");
4061
+ },
4062
+ slotAfter: /* @__PURE__ */ t(Or, {}),
4063
+ children: [
4064
+ /* @__PURE__ */ d(zr, { className: "z-50 h-auto max-h-[330px] overflow-y-auto rounded-md border border-muted bg-background px-1 py-2 shadow-md transition-all", children: [
4065
+ /* @__PURE__ */ t(Er, { className: "px-2 text-muted-foreground", children: "没有结果" }),
4066
+ /* @__PURE__ */ t($r, { children: Ot({
4067
+ uploadFn: ae
4068
+ }).map((S) => /* @__PURE__ */ d(
4069
+ Hr,
4070
+ {
4071
+ value: S.title,
4072
+ onCommand: (O) => S.command(O),
4073
+ className: "flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent",
4074
+ children: [
4075
+ /* @__PURE__ */ t("div", { className: "flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background", children: S.icon }),
4076
+ /* @__PURE__ */ d("div", { children: [
4077
+ /* @__PURE__ */ t("p", { className: "font-medium", children: S.title }),
4078
+ /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: S.description })
4079
+ ] })
4080
+ ]
4081
+ },
4082
+ S.title
4083
+ )) })
4084
+ ] }),
4085
+ /* @__PURE__ */ d(
4086
+ Na,
4087
+ {
4088
+ open: k,
4089
+ onOpenChange: U,
4090
+ enableAI: l,
4091
+ aiOptions: c,
4092
+ children: [
4093
+ l && /* @__PURE__ */ t(pe, { orientation: "vertical" }),
4094
+ /* @__PURE__ */ t(ua, { open: v, onOpenChange: I }),
4095
+ /* @__PURE__ */ t(pe, { orientation: "vertical" }),
4096
+ /* @__PURE__ */ t(da, { open: D, onOpenChange: w }),
4097
+ /* @__PURE__ */ t(pe, { orientation: "vertical" }),
4098
+ /* @__PURE__ */ t(ma, {}),
4099
+ /* @__PURE__ */ t(pe, { orientation: "vertical" }),
4100
+ /* @__PURE__ */ t(Ta, {}),
4101
+ /* @__PURE__ */ t(pe, { orientation: "vertical" }),
4102
+ /* @__PURE__ */ t(ia, { open: u, onOpenChange: T })
4103
+ ]
4104
+ }
4105
+ ),
4106
+ /* @__PURE__ */ t(Ra, {})
4107
+ ]
4108
+ }
4109
+ ) })
4110
+ ] });
4111
+ }, Pa = ({ json: r }) => {
4112
+ const e = fe(() => vn(r ?? {}, Dt), [r]);
4113
+ return /* @__PURE__ */ t("div", { className: "tiptap ProseMirror prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full", children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: e } }) });
4114
+ }, _t = Da;
4115
+ _t.Preview = Pa;
4116
+ const Ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4117
+ __proto__: null,
4118
+ Desktop: Rn,
4119
+ DesktopSortable: wt,
4120
+ DesktopSortableConfigProvider: xt,
4121
+ DesktopSortableStateProvider: kt,
4122
+ Dock: Ue,
4123
+ Editor: _t,
4124
+ Markdown: Tt,
4125
+ MdEditor: Mt,
4126
+ SortableUtils: Y,
4127
+ desktopAppConfig: Fe,
4128
+ desktopConfigMap: _e,
4129
+ desktopGroupConfig: yt,
4130
+ desktopThemeDark: Oe,
4131
+ desktopThemeLight: He
4132
+ }, Symbol.toStringTag, { value: "Module" }));
9
4133
  export {
10
- f as Desktop,
11
- l as Dock,
12
- x as Editor,
13
- s as Markdown,
14
- p as MdEditor
4134
+ Rn as Desktop,
4135
+ wt as DesktopSortable,
4136
+ xt as DesktopSortableConfigProvider,
4137
+ kt as DesktopSortableStateProvider,
4138
+ Ue as Dock,
4139
+ _t as Editor,
4140
+ Tt as Markdown,
4141
+ Mt as MdEditor,
4142
+ Y as SortableUtils,
4143
+ Ns as default,
4144
+ Fe as desktopAppConfig,
4145
+ _e as desktopConfigMap,
4146
+ yt as desktopGroupConfig,
4147
+ Oe as desktopThemeDark,
4148
+ He as desktopThemeLight
15
4149
  };