@markweave/react 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,237 +1,241 @@
1
1
  import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
2
- import { EditorContent as t, NodeViewWrapper as n, ReactNodeViewRenderer as r, useEditor as i } from "@tiptap/react";
3
- import { AlertTriangle as a, AlignCenter as o, AlignJustify as s, AlignLeft as c, AlignRight as l, Bold as u, Braces as d, Captions as f, Check as p, CheckCircle2 as m, ChevronDown as h, ChevronUp as g, CircleX as _, Code2 as v, CornerDownLeft as y, Download as b, ExternalLink as x, Eye as S, Heading1 as ee, Heading2 as C, Heading3 as w, Image as T, ImageUp as E, IndentDecrease as D, IndentIncrease as O, Info as k, Italic as A, Lightbulb as j, Link2 as M, List as N, ListChecks as P, ListOrdered as F, Minus as te, MoreVertical as I, Paperclip as L, Quote as ne, Replace as R, Sigma as z, SmilePlus as re, Sparkles as ie, Strikethrough as ae, Subscript as oe, Superscript as se, Table2 as ce, Text as le, Trash2 as ue, Type as de, Underline as fe, Upload as pe, Video as B } from "lucide-react";
4
- import { useCallback as V, useEffect as H, useLayoutEffect as me, useMemo as U, useRef as W, useState as G, useSyncExternalStore as he } from "react";
5
- import { detectUploadSource as ge, getDirectUploadResult as _e, resolveMarkweaveUploadResult as ve } from "markweave/internal/plugins/slash-command/upload";
6
- import { MarkweaveCoreImage as K, MarkweaveCoreVideo as ye, attrsFromMarkweaveImageUploadResult as be, attrsFromMarkweaveVideoUploadResult as xe, attrsFromMarkweaveVideoUrl as Se, clampMarkweaveImageWidth as q, createMarkweaveImageUploadRequest as Ce, createMarkweaveVideoUploadRequest as we, downloadMarkweaveImage as Te, markweaveVideoIframeAllow as Ee, normalizeMarkweaveCoreImageAlign as De, normalizeMarkweaveVideoEmbedUrl as Oe, numberAttribute as J, stringAttribute as Y } from "markweave/internal/plugins/media/core-media-nodes";
7
- import { getLocalizedSlashCommandSpecs as ke, getMarkweaveMessages as Ae, normalizeMarkweaveLang as je } from "markweave/internal/i18n";
8
- import { getMarkweaveEditorModeState as Me, isMarkweaveEditorLiveEditable as Ne, normalizeMarkweaveEditorMode as Pe, setMarkweaveEditorModeState as Fe, subscribeToMarkweaveEditorMode as Ie } from "markweave/internal/core/editor-mode-state";
9
- import { openMarkweaveImagePreview as Le } from "markweave/internal/plugins/media/image-preview";
2
+ import { getLocalizedSlashCommandSpecs as t, getMarkweaveMessages as n, normalizeMarkweaveLang as r } from "markweave/internal/i18n";
3
+ import { EditorContent as i, NodeViewWrapper as a, ReactNodeViewRenderer as o, useEditor as s } from "@tiptap/react";
4
+ import { AlertTriangle as c, AlignCenter as l, AlignJustify as u, AlignLeft as d, AlignRight as f, Bold as p, Braces as m, Captions as h, Check as g, CheckCircle2 as _, ChevronDown as v, ChevronUp as y, CircleX as b, Code2 as x, Copy as S, CornerDownLeft as C, Download as w, ExternalLink as T, Eye as E, Heading1 as D, Heading2 as O, Heading3 as k, Image as A, ImageUp as j, IndentDecrease as M, IndentIncrease as ee, Info as N, Italic as P, Lightbulb as te, Link2 as F, List as I, ListChecks as ne, ListOrdered as L, Minus as re, MoreVertical as R, Paperclip as z, Pencil as ie, Quote as ae, Replace as oe, Sigma as se, SmilePlus as ce, Sparkles as le, Strikethrough as ue, Subscript as de, Superscript as fe, Table2 as pe, Text as me, Trash2 as he, Type as ge, Underline as _e, Upload as ve, Video as ye } from "lucide-react";
5
+ import { useCallback as B, useEffect as V, useLayoutEffect as be, useMemo as H, useRef as U, useState as W, useSyncExternalStore as G } from "react";
6
+ import { detectUploadSource as xe, getDirectUploadResult as Se, resolveMarkweaveUploadResult as Ce } from "markweave/internal/plugins/slash-command/upload";
7
+ import { MarkweaveCoreImage as we, MarkweaveCoreVideo as Te, attrsFromMarkweaveImageUploadResult as K, attrsFromMarkweaveVideoUploadResult as Ee, attrsFromMarkweaveVideoUrl as De, clampMarkweaveImageWidth as Oe, createMarkweaveImageUploadRequest as ke, createMarkweaveVideoUploadRequest as q, downloadMarkweaveImage as Ae, markweaveVideoIframeAllow as je, normalizeMarkweaveCoreImageAlign as Me, normalizeMarkweaveVideoEmbedUrl as Ne, numberAttribute as Pe, stringAttribute as J } from "markweave/internal/plugins/media/core-media-nodes";
8
+ import { getMarkweaveEditorModeState as Y, isMarkweaveEditorLiveEditable as Fe, normalizeMarkweaveEditorMode as Ie, setMarkweaveEditorModeState as Le, subscribeToMarkweaveEditorMode as Re } from "markweave/internal/core/editor-mode-state";
9
+ import { openMarkweaveImagePreview as ze } from "markweave/internal/plugins/media/image-preview";
10
10
  import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
11
- import { createMarkweaveAdapterMediaExtensions as Re } from "markweave/internal/plugins/media/media-extension-factory";
12
- import { isEditorComposing as ze } from "markweave/internal/editor-core/composition-guard";
13
- import { createMarkweaveEditorUpdatePayload as Be, getMarkweaveContentType as Ve, isEditorContentCurrent as He, isMarkweaveControlledContentEchoCurrent as Ue, normalizeMarkweaveContentFormat as We } from "markweave/internal/editor-core/editor-content";
14
- import { openMarkweaveReadonlyLinkFromEvent as Ge } from "markweave/internal/editor-core/readonly-link";
15
- import { createMarkweaveEditorRuntimeSnapshot as Ke } from "markweave/internal/editor-core/runtime-snapshot";
16
- import { advanceFloatingToolbarMotionState as qe, areEditorSelectionSnapshotsEquivalent as Je, calculateFloatingToolbarFrameShift as Ye, calculateFloatingToolbarPopoverPlacement as Xe, calculateFloatingToolbarTopBoundary as Ze, createSelectionSnapshot as Qe, getFloatingToolbarFloatingOptions as $e, getFloatingToolbarState as et, markweaveRuntimeProjectionDelayMs as tt, shouldShowFloatingToolbar as nt, transitionFloatingToolbarState as rt } from "markweave/internal/editor-core/selection-state";
17
- import { codeBlockCollapsePluginKey as it, copyActiveCodeBlock as at, getActiveCodeBlockState as ot, getCodeBlockCopyFeedbackSnapshot as st, markweaveCodeBlockBehavior as ct, setCodeBlockCollapsedAtPosition as lt, setCodeBlockLanguageAtPosition as ut, setCodeBlockMermaidPreviewModeAtPosition as dt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
18
- import { isMermaidInlinePreviewTransaction as ft, setMermaidInlinePreviewEditorMode as pt, setReadonlyMermaidPreviewMode as mt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
19
- import { getMermaidPreviewState as ht } from "markweave/internal/plugins/mermaid/mermaid-renderer";
20
- import { applyMarkweaveMathLatex as gt, calculateMarkweaveMathPopoverPosition as _t, getMarkweaveMathAnchorRect as vt, getMarkweaveMathBlockIndex as yt, getMarkweaveMathRenderedHtml as bt, getMarkweaveMathTargetAtPos as xt, getMarkweaveMathTargetFromDomEvent as St, getMarkweaveMathTargetFromSelection as Ct, renderMarkweaveMathPreview as wt, setMarkweaveMathEditingDomState as Tt, setMarkweaveMathEditingDomStateInView as Et, setMarkweaveMathSelectionInView as Dt } from "markweave/internal/plugins/math/math-ui-model";
21
- import { filterSlashCommands as Ot, isExecutableSlashCommand as kt } from "markweave/internal/plugins/slash-command/command-spec";
22
- import { getSlashCommandKeyboardAction as At, isSlashCommandMenuState as jt } from "markweave/internal/plugins/slash-command/slash-keyboard";
23
- import { executeSlashCommand as Mt, getNextSlashCommandState as Nt, getSlashCommandAnchoredMenuPosition as Pt, getSlashCommandContext as Ft } from "markweave/internal/plugins/slash-command/slash-runtime";
24
- import { initialSlashCommandState as It, reduceSlashCommandState as Lt } from "markweave/internal/plugins/slash-command/slash-state";
25
- import { getFirstTableDebugSnapshot as Rt } from "markweave/internal/plugins/table/table-debug-snapshot";
26
- import { focusFirstTableBodyCell as zt } from "markweave/internal/plugins/table/table-focus-position";
27
- import { getTableFocusState as Bt } from "markweave/internal/plugins/table/table-focus-state";
28
- import { getTableSelectionOverlayState as Vt, initialTableInteractionState as Ht, tableInteractionPluginKey as Ut } from "markweave/internal/plugins/table/table-interaction-layer";
29
- import { calculateCodeBlockLanguageMenuPosition as Wt, clampFullscreenScale as Gt, codeBlockCopyFeedbackTimeoutMs as Kt, copyCodeBlockText as qt, createCodeBlockOverlayPosition as Jt, createMermaidFullscreenViewerState as Yt, createMermaidTabPosition as Xt, focusCodeBlockTarget as Zt, formatCodeBlockLanguageLabel as Qt, formatFullscreenZoom as $t, getActiveCodeBlockElement as en, getAnchoredRect as tn, getCodeBlockLanguageItems as nn, getCodeBlockPositionFromEventTarget as rn, getCodeBlockStateAtPosition as an, getFrameElement as on, getMermaidCodeBlockTargets as sn, getMermaidSvgMarkup as cn, isCodeBlockTargetCollapsed as ln, mergeStableMermaidTabPositions as un, mermaidFullscreenZoomStep as dn, moveMermaidFullscreenViewer as fn } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
30
- import { BubbleMenu as pn } from "@tiptap/react/menus";
31
- import { createMarkweaveFrameScheduler as mn } from "markweave/internal/editor-core/frame-scheduler";
32
- import { applyFloatingToolbarLink as hn, createFloatingToolbarAssistantRequest as gn, getFloatingToolbarButtonModels as _n, getFloatingToolbarHighlightColorOptions as vn, getFloatingToolbarLinkHref as yn, getFloatingToolbarMessageSet as bn, getFloatingToolbarMoreActions as xn, getFloatingToolbarTextColorOptions as Sn, getFloatingToolbarTooltipModel as Cn, getFloatingToolbarTurnIntoOptions as wn, isFloatingToolbarMoreActionActive as Tn, isFloatingToolbarTurnIntoActive as En, openFloatingToolbarLinkHref as Dn, preventFloatingToolbarPointerFocusLoss as On, removeFloatingToolbarLink as kn, runFloatingToolbarMoreAction as An, setFloatingToolbarHighlightColor as jn, setFloatingToolbarTextColor as Mn, setFloatingToolbarTurnInto as Nn } from "markweave/internal/editor-core/floating-toolbar-model";
33
- import { normalizeMarkdownLinkHref as Pn } from "markweave/internal/plugins/markdown/markdown-input";
34
- import { setMarkweaveTableMenuAxisTarget as Fn } from "markweave/internal/plugins/table/table-clipboard";
35
- import { calculateAnchoredTableMenuPosition as In, calculateTableEdgeHandlePosition as Ln, canRunTableCommand as Rn, executeTableMenuCommand as zn, formatTableCopyFeedback as Bn, getActiveTableElement as Vn, getAvailableCellMenuCommandSpecs as Hn, getTableAxisTargetRect as Un, getTableControlAxisSelectionModel as Wn, getTableEditWithAiRequest as Gn, getTableMenuItemGroup as Kn, getTableMenuItemLabel as qn, getTableMenuItems as Jn, getTableSelectionTargetRect as Yn, measureTableSelectionOverlay as Xn, selectTableAxisFromCell as Zn, tableCopyFeedbackTimeoutMs as Qn, tableMenuLabel as $n } from "markweave/internal/plugins/table/table-ui-model";
36
- import { createMarkweaveTocState as er, emptyMarkweaveTocState as tr, getActiveMarkweaveTocId as nr, getMarkweaveTocItems as rr, getValidMarkweaveTocActiveId as ir, normalizeMarkweaveInnerTocPlacement as ar, observeMarkweaveInnerTocContainerPosition as or, scrollToMarkweaveTocItem as sr } from "markweave/internal/core/toc-state";
11
+ import { createMarkweaveAdapterMediaExtensions as Be } from "markweave/internal/plugins/media/media-extension-factory";
12
+ import { normalizeMarkweaveLinkCardAttrs as Ve, normalizeMarkweaveLinkCardHref as He, replaceMarkweaveLinkCardWithLink as Ue } from "markweave/internal/plugins/link-card/link-card";
13
+ import { openMarkweaveLinkCardComposer as We } from "markweave/internal/plugins/link-card/link-card-composer";
14
+ import { MarkweaveLinkCard as Ge } from "markweave/internal/plugins/link-card/link-card-node";
15
+ import { isEditorComposing as Ke } from "markweave/internal/editor-core/composition-guard";
16
+ import { createMarkweaveEditorUpdatePayload as qe, getMarkweaveContentType as Je, isEditorContentCurrent as Ye, isMarkweaveControlledContentEchoCurrent as Xe, normalizeMarkweaveContentFormat as Ze } from "markweave/internal/editor-core/editor-content";
17
+ import { openMarkweaveReadonlyLinkFromEvent as Qe } from "markweave/internal/editor-core/readonly-link";
18
+ import { createMarkweaveEditorRuntimeSnapshot as $e } from "markweave/internal/editor-core/runtime-snapshot";
19
+ import { advanceFloatingToolbarMotionState as et, areEditorSelectionSnapshotsEquivalent as tt, calculateFloatingToolbarFrameShift as nt, calculateFloatingToolbarPopoverPlacement as rt, calculateFloatingToolbarTopBoundary as it, createSelectionSnapshot as at, getFloatingToolbarFloatingOptions as ot, getFloatingToolbarState as st, markweaveRuntimeProjectionDelayMs as ct, shouldShowFloatingToolbar as lt, transitionFloatingToolbarState as ut } from "markweave/internal/editor-core/selection-state";
20
+ import { codeBlockCollapsePluginKey as dt, copyActiveCodeBlock as ft, getActiveCodeBlockState as pt, getCodeBlockCopyFeedbackSnapshot as mt, markweaveCodeBlockBehavior as ht, setCodeBlockCollapsedAtPosition as gt, setCodeBlockLanguageAtPosition as _t, setCodeBlockMermaidPreviewModeAtPosition as vt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
21
+ import { isMermaidInlinePreviewTransaction as yt, setMarkweaveMermaidTheme as bt, setMermaidInlinePreviewEditorMode as xt, setReadonlyMermaidPreviewMode as St } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
22
+ import { getMermaidPreviewState as Ct } from "markweave/internal/plugins/mermaid/mermaid-renderer";
23
+ import { applyMarkweaveMathLatex as wt, calculateMarkweaveMathPopoverPosition as Tt, getMarkweaveMathAnchorRect as Et, getMarkweaveMathBlockIndex as Dt, getMarkweaveMathRenderedHtml as Ot, getMarkweaveMathTargetAtPos as kt, getMarkweaveMathTargetFromDomEvent as At, getMarkweaveMathTargetFromSelection as jt, renderMarkweaveMathPreview as Mt, setMarkweaveMathEditingDomState as Nt, setMarkweaveMathEditingDomStateInView as Pt, setMarkweaveMathSelectionInView as Ft } from "markweave/internal/plugins/math/math-ui-model";
24
+ import { filterSlashCommands as It, isExecutableSlashCommand as Lt } from "markweave/internal/plugins/slash-command/command-spec";
25
+ import { getSlashCommandKeyboardAction as Rt, isSlashCommandMenuState as zt } from "markweave/internal/plugins/slash-command/slash-keyboard";
26
+ import { executeSlashCommand as Bt, getNextSlashCommandState as Vt, getSlashCommandAnchoredMenuPosition as Ht, getSlashCommandContext as Ut } from "markweave/internal/plugins/slash-command/slash-runtime";
27
+ import { initialSlashCommandState as Wt, reduceSlashCommandState as Gt } from "markweave/internal/plugins/slash-command/slash-state";
28
+ import { getFirstTableDebugSnapshot as Kt } from "markweave/internal/plugins/table/table-debug-snapshot";
29
+ import { focusFirstTableBodyCell as qt } from "markweave/internal/plugins/table/table-focus-position";
30
+ import { getTableFocusState as Jt } from "markweave/internal/plugins/table/table-focus-state";
31
+ import { getTableSelectionOverlayState as Yt, initialTableInteractionState as Xt, tableInteractionPluginKey as Zt } from "markweave/internal/plugins/table/table-interaction-layer";
32
+ import { calculateCodeBlockLanguageMenuPosition as Qt, clampFullscreenScale as $t, codeBlockCopyFeedbackTimeoutMs as en, copyCodeBlockText as tn, createCodeBlockOverlayPosition as nn, createMermaidFullscreenViewerState as rn, createMermaidTabPosition as an, focusCodeBlockTarget as on, formatCodeBlockLanguageLabel as sn, formatFullscreenZoom as cn, getActiveCodeBlockElement as ln, getAnchoredRect as un, getCodeBlockLanguageItems as dn, getCodeBlockPositionFromEventTarget as fn, getCodeBlockStateAtPosition as pn, getFrameElement as mn, getMermaidCodeBlockTargets as hn, getMermaidSvgMarkup as gn, isCodeBlockTargetCollapsed as _n, mergeStableMermaidTabPositions as vn, mermaidFullscreenZoomStep as yn, moveMermaidFullscreenViewer as bn } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
33
+ import { BubbleMenu as xn } from "@tiptap/react/menus";
34
+ import { createMarkweaveFrameScheduler as Sn } from "markweave/internal/editor-core/frame-scheduler";
35
+ import { applyFloatingToolbarLink as Cn, createFloatingToolbarAssistantRequest as wn, getFloatingToolbarButtonModels as Tn, getFloatingToolbarHighlightColorOptions as En, getFloatingToolbarLinkHref as Dn, getFloatingToolbarMessageSet as On, getFloatingToolbarMoreActions as kn, getFloatingToolbarTextColorOptions as An, getFloatingToolbarTooltipModel as jn, getFloatingToolbarTurnIntoOptions as Mn, isFloatingToolbarMoreActionActive as Nn, isFloatingToolbarTurnIntoActive as Pn, openFloatingToolbarLinkHref as Fn, preventFloatingToolbarPointerFocusLoss as In, removeFloatingToolbarLink as Ln, runFloatingToolbarMoreAction as Rn, setFloatingToolbarHighlightColor as zn, setFloatingToolbarTextColor as Bn, setFloatingToolbarTurnInto as Vn } from "markweave/internal/editor-core/floating-toolbar-model";
36
+ import { normalizeMarkdownLinkHref as Hn } from "markweave/internal/plugins/markdown/markdown-input";
37
+ import { setMarkweaveTableMenuAxisTarget as Un } from "markweave/internal/plugins/table/table-clipboard";
38
+ import { calculateAnchoredTableMenuPosition as Wn, calculateTableEdgeHandlePosition as Gn, canRunTableCommand as Kn, executeTableMenuCommand as qn, formatTableCopyFeedback as Jn, getActiveTableElement as Yn, getAvailableCellMenuCommandSpecs as Xn, getTableAxisTargetRect as Zn, getTableControlAxisSelectionModel as Qn, getTableEditWithAiRequest as $n, getTableMenuItemGroup as er, getTableMenuItemLabel as tr, getTableMenuItems as nr, getTableSelectionTargetRect as rr, measureTableSelectionOverlay as ir, selectTableAxisFromCell as ar, tableCopyFeedbackTimeoutMs as or, tableMenuLabel as sr } from "markweave/internal/plugins/table/table-ui-model";
39
+ import { createMarkweaveTocState as cr, emptyMarkweaveTocState as lr, getActiveMarkweaveTocId as ur, getMarkweaveTocItems as dr, getValidMarkweaveTocActiveId as fr, normalizeMarkweaveInnerTocPlacement as pr, observeMarkweaveInnerTocContainerPosition as mr, scrollToMarkweaveTocItem as hr } from "markweave/internal/core/toc-state";
40
+ import { normalizeMarkweaveTheme as gr } from "markweave/internal/core/theme";
37
41
  //#region src/editor-mode-state.ts
38
- var cr = {
42
+ var _r = {
39
43
  mode: "live",
40
44
  editable: !0
41
45
  };
42
- function lr(e) {
43
- return he((t) => Ie(e, t), () => Me(e), () => cr);
46
+ function vr(e) {
47
+ return G((t) => Re(e, t), () => Y(e), () => _r);
44
48
  }
45
49
  //#endregion
46
50
  //#region src/media/image-node.tsx
47
- var ur = De;
48
- function dr(e) {
51
+ var yr = Me;
52
+ function br(e) {
49
53
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
50
54
  }
51
- function fr(e) {
52
- let { deleteNode: t, editor: r, getPos: i, node: a, selected: o, updateAttributes: s } = e, c = e.extension.options, l = c.messages ?? Ae("zh"), u = l.image, d = Ne(lr(r)), f = Y(a.attrs.src), p = ur(a.attrs.align), m = J(a.attrs.width), h = Y(a.attrs.caption), g = W(null), _ = W(null), [v, y] = G(!1), [b, x] = G(!1), [ee, C] = G(!1), [w, T] = G(""), [E, D] = G(null), [O, k] = G(!1), [A, j] = G(!!h), [M, N] = G(h ?? ""), P = d && (!f || b), F = () => {
53
- f && Le({
54
- src: f,
55
- alt: Y(a.attrs.alt) ?? "",
55
+ function xr(e) {
56
+ let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.image, f = Fe(vr(r)), p = J(o.attrs.src), m = yr(o.attrs.align), h = Pe(o.attrs.width), g = J(o.attrs.caption), _ = U(null), v = U(null), [y, b] = W(!1), [x, S] = W(!1), [C, w] = W(!1), [T, D] = W(""), [O, k] = W(null), [A, j] = W(!1), [M, ee] = W(!!g), [N, P] = W(g ?? ""), te = f && (!p || x), F = () => {
57
+ p && ze({
58
+ src: p,
59
+ alt: J(o.attrs.alt) ?? "",
56
60
  messages: {
57
- dialogAriaLabel: u.previewDialogAriaLabel,
58
- zoomOut: u.previewZoomOut,
59
- zoomIn: u.previewZoomIn,
60
- reset: u.previewReset,
61
- close: u.previewClose
61
+ dialogAriaLabel: d.previewDialogAriaLabel,
62
+ zoomOut: d.previewZoomOut,
63
+ zoomIn: d.previewZoomIn,
64
+ reset: d.previewReset,
65
+ close: d.previewClose
62
66
  }
63
67
  });
64
68
  };
65
- H(() => {
66
- A || N(h ?? "");
67
- }, [h, A]);
68
- let te = () => {
69
- if (!d) return;
69
+ V(() => {
70
+ M || P(g ?? "");
71
+ }, [g, M]);
72
+ let I = () => {
73
+ if (!f) return;
70
74
  let e = i();
71
75
  typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
72
- }, I = () => {
73
- if (d) {
74
- if (T(""), D(null), C(!1), f) {
75
- x(!1);
76
+ }, ne = () => {
77
+ if (f) {
78
+ if (D(""), k(null), w(!1), p) {
79
+ S(!1);
76
80
  return;
77
81
  }
78
82
  t();
79
83
  }
80
84
  }, L = async (e) => {
81
- if (d) {
82
- D(null), k(!0);
85
+ if (f) {
86
+ k(null), j(!0);
83
87
  try {
84
- let t = await ve(Ce(e, f && b ? "image-replace" : "image-insert"), c.onUpload);
85
- s(be(a.attrs, t)), x(!1), T("");
88
+ let t = await Ce(ke(e, p && x ? "image-replace" : "image-insert"), l.onUpload);
89
+ c(K(o.attrs, t)), S(!1), D("");
86
90
  } catch (e) {
87
- D(e instanceof Error ? e.message : u.uploadFailedError);
91
+ k(e instanceof Error ? e.message : d.uploadFailedError);
88
92
  } finally {
89
- k(!1), C(!1);
93
+ j(!1), w(!1);
90
94
  }
91
95
  }
92
- }, ne = () => {
93
- if (d) {
94
- if (!w.trim()) {
95
- D(u.uploadRequiredError);
96
+ }, re = () => {
97
+ if (f) {
98
+ if (!T.trim()) {
99
+ k(d.uploadRequiredError);
96
100
  return;
97
101
  }
98
- L(ge(w));
102
+ L(xe(T));
99
103
  }
100
104
  }, R = (e) => {
101
- !d || !e || L({
105
+ !f || !e || L({
102
106
  type: "file",
103
107
  file: e,
104
108
  mimeType: e.type
105
109
  });
106
110
  }, z = (e) => {
107
111
  R(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
108
- }, re = (e) => {
109
- e.preventDefault(), e.stopPropagation(), d && R(e.dataTransfer.files?.[0] ?? null);
110
- }, ie = () => {
111
- d && (j((e) => !e), A || N(h ?? ""));
112
- }, ae = (e) => {
113
- d && (N(e), s({ caption: e.trim() ? e : null }));
114
- }, oe = (e, t) => {
115
- if (t.preventDefault(), t.stopPropagation(), !d) return;
116
- te();
117
- let n = g.current;
112
+ }, ie = (e) => {
113
+ e.preventDefault(), e.stopPropagation(), f && R(e.dataTransfer.files?.[0] ?? null);
114
+ }, ae = () => {
115
+ f && (ee((e) => !e), M || P(g ?? ""));
116
+ }, oe = (e) => {
117
+ f && (P(e), c({ caption: e.trim() ? e : null }));
118
+ }, se = (e, t) => {
119
+ if (t.preventDefault(), t.stopPropagation(), !f) return;
120
+ I();
121
+ let n = _.current;
118
122
  if (!n) return;
119
- let r = t.clientX, i = n.getBoundingClientRect().width || m || 320, a = n.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? n.parentElement?.getBoundingClientRect().width ?? i, o = (t) => {
123
+ let r = t.clientX, i = n.getBoundingClientRect().width || h || 320, a = n.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? n.parentElement?.getBoundingClientRect().width ?? i, o = (t) => {
120
124
  let n = e === "right" ? t.clientX - r : r - t.clientX;
121
- s({ width: q(i + n, a) });
122
- }, c = () => {
123
- window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", c);
125
+ c({ width: Oe(i + n, a) });
126
+ }, s = () => {
127
+ window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s);
124
128
  };
125
- window.addEventListener("pointermove", o), window.addEventListener("pointerup", c, { once: !0 });
129
+ window.addEventListener("pointermove", o), window.addEventListener("pointerup", s, { once: !0 });
126
130
  };
127
- return /* @__PURE__ */ Z(n, {
131
+ return /* @__PURE__ */ Z(a, {
128
132
  as: "figure",
129
133
  className: "markweave-image-node",
130
134
  "data-testid": "markweave-image-node",
131
- "data-align": p,
132
- "data-selected": d && o ? "true" : "false",
133
- "data-hovered": v ? "true" : "false",
134
- "data-empty": P ? "true" : "false",
135
- onPointerEnter: () => y(!0),
136
- onPointerLeave: () => y(!1),
135
+ "data-align": m,
136
+ "data-selected": f && s ? "true" : "false",
137
+ "data-hovered": y ? "true" : "false",
138
+ "data-empty": te ? "true" : "false",
139
+ onPointerEnter: () => b(!0),
140
+ onPointerLeave: () => b(!1),
137
141
  onMouseDown: (e) => {
138
- d && !dr(e.target) && te();
142
+ f && !br(e.target) && I();
139
143
  },
140
- children: P ? /* @__PURE__ */ Z(pr, {
141
- dragActive: ee,
142
- error: E,
143
- inputValue: w,
144
- isSubmitting: O,
145
- fileInputRef: _,
146
- messages: l,
147
- onCancel: I,
148
- onDrop: re,
149
- onDragActiveChange: C,
144
+ children: te ? /* @__PURE__ */ Z(Sr, {
145
+ dragActive: C,
146
+ error: O,
147
+ inputValue: T,
148
+ isSubmitting: A,
149
+ fileInputRef: v,
150
+ messages: u,
151
+ onCancel: ne,
152
+ onDrop: ie,
153
+ onDragActiveChange: w,
150
154
  onFileChange: z,
151
- onInputChange: T,
152
- onSubmit: ne
155
+ onInputChange: D,
156
+ onSubmit: re
153
157
  }) : /* @__PURE__ */ Q(X, { children: [
154
- d ? /* @__PURE__ */ Z(mr, {
155
- align: p,
156
- captionActive: A || !!h,
157
- messages: l,
158
- onAlign: (e) => s({ align: e }),
159
- onCaption: ie,
158
+ f ? /* @__PURE__ */ Z(Cr, {
159
+ align: m,
160
+ captionActive: M || !!g,
161
+ messages: u,
162
+ onAlign: (e) => c({ align: e }),
163
+ onCaption: ae,
160
164
  onDelete: t,
161
165
  onDownload: () => {
162
- f && Te(f);
166
+ p && Ae(p);
163
167
  },
164
168
  onPreview: F,
165
169
  onReplace: () => {
166
- T(""), D(null), x(!0);
170
+ D(""), k(null), S(!0);
167
171
  }
168
172
  }) : null,
169
173
  /* @__PURE__ */ Q("div", {
170
174
  className: "markweave-image-box",
171
- ref: g,
172
- style: m ? { width: `${m}px` } : void 0,
175
+ ref: _,
176
+ style: h ? { width: `${h}px` } : void 0,
173
177
  children: [
174
- f ? /* @__PURE__ */ Z("img", {
178
+ p ? /* @__PURE__ */ Z("img", {
175
179
  className: "markweave-image",
176
- src: f,
177
- alt: Y(a.attrs.alt) ?? "",
178
- title: Y(a.attrs.title) ?? void 0,
180
+ src: p,
181
+ alt: J(o.attrs.alt) ?? "",
182
+ title: J(o.attrs.title) ?? void 0,
179
183
  draggable: !1
180
184
  }) : /* @__PURE__ */ Z("div", {
181
185
  className: "markweave-image-readonly-empty",
182
186
  "data-testid": "markweave-image-readonly-empty",
183
187
  "aria-hidden": "true"
184
188
  }),
185
- !d && f ? /* @__PURE__ */ Q("button", {
189
+ !f && p ? /* @__PURE__ */ Q("button", {
186
190
  type: "button",
187
191
  className: "markweave-image-preview-trigger",
188
192
  "data-testid": "markweave-image-preview",
189
193
  "data-markweave-image-ui": "true",
190
- "aria-label": u.preview,
191
- title: u.preview,
194
+ "aria-label": d.preview,
195
+ title: d.preview,
192
196
  onMouseDown: (e) => e.preventDefault(),
193
197
  onClick: F,
194
- children: [/* @__PURE__ */ Z(S, {
198
+ children: [/* @__PURE__ */ Z(E, {
195
199
  size: 16,
196
200
  strokeWidth: 1.8
197
201
  }), /* @__PURE__ */ Z("span", {
198
202
  className: "markweave-image-tooltip",
199
203
  role: "tooltip",
200
- children: u.preview
204
+ children: d.preview
201
205
  })]
202
206
  }) : null,
203
- d ? /* @__PURE__ */ Z(gr, {
207
+ f ? /* @__PURE__ */ Z(Tr, {
204
208
  side: "left",
205
- messages: l,
206
- onPointerDown: oe
209
+ messages: u,
210
+ onPointerDown: se
207
211
  }) : null,
208
- d ? /* @__PURE__ */ Z(gr, {
212
+ f ? /* @__PURE__ */ Z(Tr, {
209
213
  side: "right",
210
- messages: l,
211
- onPointerDown: oe
214
+ messages: u,
215
+ onPointerDown: se
212
216
  }) : null
213
217
  ]
214
218
  }),
215
- d && (A || h) ? /* @__PURE__ */ Z("input", {
219
+ f && (M || g) ? /* @__PURE__ */ Z("input", {
216
220
  className: "markweave-image-caption-input",
217
221
  "data-markweave-image-ui": "true",
218
222
  "data-testid": "markweave-image-caption-input",
219
- value: M,
220
- placeholder: u.captionPlaceholder,
221
- "aria-label": u.captionAriaLabel,
222
- onChange: (e) => ae(e.currentTarget.value),
223
+ value: N,
224
+ placeholder: d.captionPlaceholder,
225
+ "aria-label": d.captionAriaLabel,
226
+ onChange: (e) => oe(e.currentTarget.value),
223
227
  onKeyDown: (e) => {
224
- e.key === "Escape" && (e.preventDefault(), j(!1));
228
+ e.key === "Escape" && (e.preventDefault(), ee(!1));
225
229
  }
226
- }) : h ? /* @__PURE__ */ Z("figcaption", {
230
+ }) : g ? /* @__PURE__ */ Z("figcaption", {
227
231
  className: "markweave-image-caption",
228
232
  "data-testid": "markweave-image-caption",
229
- children: h
233
+ children: g
230
234
  }) : null
231
235
  ] })
232
236
  });
233
237
  }
234
- function pr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
238
+ function Sr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
235
239
  let f = a.image;
236
240
  return /* @__PURE__ */ Q("section", {
237
241
  className: "markweave-image-upload-placeholder",
@@ -258,7 +262,7 @@ function pr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
258
262
  /* @__PURE__ */ Z("div", {
259
263
  className: "markweave-image-upload-icon",
260
264
  "aria-hidden": "true",
261
- children: /* @__PURE__ */ Z(E, {
265
+ children: /* @__PURE__ */ Z(j, {
262
266
  size: 46,
263
267
  strokeWidth: 1.6
264
268
  })
@@ -293,7 +297,7 @@ function pr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
293
297
  "data-testid": "markweave-image-upload-submit",
294
298
  disabled: i || !r.trim(),
295
299
  onClick: d,
296
- children: [/* @__PURE__ */ Z(E, {
300
+ children: [/* @__PURE__ */ Z(j, {
297
301
  size: 16,
298
302
  strokeWidth: 1.8
299
303
  }), a.common.insert]
@@ -313,32 +317,32 @@ function pr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
313
317
  ]
314
318
  });
315
319
  }
316
- function mr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i, onDelete: a, onDownload: s, onPreview: u, onReplace: d }) {
317
- let p = n.image;
320
+ function Cr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i, onDelete: a, onDownload: o, onPreview: s, onReplace: c }) {
321
+ let u = n.image;
318
322
  return /* @__PURE__ */ Q("div", {
319
323
  className: "markweave-image-toolbar",
320
324
  "data-testid": "markweave-image-toolbar",
321
325
  "data-markweave-image-ui": "true",
322
- "aria-label": p.toolsAriaLabel,
326
+ "aria-label": u.toolsAriaLabel,
323
327
  children: [
324
- /* @__PURE__ */ Z(hr, {
328
+ /* @__PURE__ */ Z(wr, {
325
329
  testId: "markweave-image-align-left",
326
- label: p.alignLeft,
327
- icon: c,
330
+ label: u.alignLeft,
331
+ icon: d,
328
332
  active: e === "left",
329
333
  onClick: () => r("left")
330
334
  }),
331
- /* @__PURE__ */ Z(hr, {
335
+ /* @__PURE__ */ Z(wr, {
332
336
  testId: "markweave-image-align-center",
333
- label: p.alignCenter,
334
- icon: o,
337
+ label: u.alignCenter,
338
+ icon: l,
335
339
  active: e === "center",
336
340
  onClick: () => r("center")
337
341
  }),
338
- /* @__PURE__ */ Z(hr, {
342
+ /* @__PURE__ */ Z(wr, {
339
343
  testId: "markweave-image-align-right",
340
- label: p.alignRight,
341
- icon: l,
344
+ label: u.alignRight,
345
+ icon: f,
342
346
  active: e === "right",
343
347
  onClick: () => r("right")
344
348
  }),
@@ -346,45 +350,45 @@ function mr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
346
350
  className: "markweave-image-toolbar-divider",
347
351
  "aria-hidden": "true"
348
352
  }),
349
- /* @__PURE__ */ Z(hr, {
353
+ /* @__PURE__ */ Z(wr, {
350
354
  testId: "markweave-image-caption",
351
- label: p.caption,
352
- icon: f,
355
+ label: u.caption,
356
+ icon: h,
353
357
  active: t,
354
358
  onClick: i
355
359
  }),
356
- /* @__PURE__ */ Z(hr, {
360
+ /* @__PURE__ */ Z(wr, {
357
361
  testId: "markweave-image-preview",
358
- label: p.preview,
359
- icon: S,
360
- onClick: u
362
+ label: u.preview,
363
+ icon: E,
364
+ onClick: s
361
365
  }),
362
- /* @__PURE__ */ Z(hr, {
366
+ /* @__PURE__ */ Z(wr, {
363
367
  testId: "markweave-image-download",
364
- label: p.download,
365
- icon: b,
366
- onClick: s
368
+ label: u.download,
369
+ icon: w,
370
+ onClick: o
367
371
  }),
368
- /* @__PURE__ */ Z(hr, {
372
+ /* @__PURE__ */ Z(wr, {
369
373
  testId: "markweave-image-replace",
370
- label: p.replace,
371
- icon: R,
372
- onClick: d
374
+ label: u.replace,
375
+ icon: oe,
376
+ onClick: c
373
377
  }),
374
378
  /* @__PURE__ */ Z("span", {
375
379
  className: "markweave-image-toolbar-divider",
376
380
  "aria-hidden": "true"
377
381
  }),
378
- /* @__PURE__ */ Z(hr, {
382
+ /* @__PURE__ */ Z(wr, {
379
383
  testId: "markweave-image-delete",
380
- label: p.delete,
381
- icon: ue,
384
+ label: u.delete,
385
+ icon: he,
382
386
  onClick: a
383
387
  })
384
388
  ]
385
389
  });
386
390
  }
387
- function hr({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
391
+ function wr({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
388
392
  return /* @__PURE__ */ Q("button", {
389
393
  type: "button",
390
394
  "aria-label": n,
@@ -403,7 +407,7 @@ function hr({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
403
407
  })]
404
408
  });
405
409
  }
406
- function gr({ messages: e, onPointerDown: t, side: n }) {
410
+ function Tr({ messages: e, onPointerDown: t, side: n }) {
407
411
  return /* @__PURE__ */ Z("button", {
408
412
  type: "button",
409
413
  className: "markweave-image-resize-handle",
@@ -414,128 +418,128 @@ function gr({ messages: e, onPointerDown: t, side: n }) {
414
418
  onPointerDown: (e) => t(n, e)
415
419
  });
416
420
  }
417
- var _r = K.extend({
421
+ var Er = we.extend({
418
422
  addOptions() {
419
423
  return {
420
424
  ...this.parent?.(),
421
- messages: Ae("zh"),
425
+ messages: n("zh"),
422
426
  onUpload: void 0
423
427
  };
424
428
  },
425
429
  addNodeView() {
426
- return typeof document > "u" ? null : r(fr, { stopEvent: ({ event: e }) => dr(e.target) });
430
+ return typeof document > "u" ? null : o(xr, { stopEvent: ({ event: e }) => br(e.target) });
427
431
  }
428
432
  });
429
433
  //#endregion
430
434
  //#region src/media/video-node.tsx
431
- function vr(e) {
435
+ function Dr(e) {
432
436
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
433
437
  }
434
- function yr(e) {
435
- let { deleteNode: t, editor: r, getPos: i, node: a, selected: o, updateAttributes: s } = e, c = e.extension.options, l = c.messages ?? Ae("zh"), u = l.video, d = Ne(lr(r)), f = Y(a.attrs.src), p = Y(a.attrs.embedUrl), m = Y(a.attrs.provider), h = p ? Oe(p, m) : null, g = Y(a.attrs.mimeType), _ = Y(a.attrs.title), v = W(null), [y, b] = G(!1), [x, S] = G(""), [ee, C] = G(null), [w, T] = G(!1), E = d && !f, D = () => {
436
- if (!d) return;
438
+ function Or(e) {
439
+ let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.video, f = Fe(vr(r)), p = J(o.attrs.src), m = J(o.attrs.embedUrl), h = J(o.attrs.provider), g = m ? Ne(m, h) : null, _ = J(o.attrs.mimeType), v = J(o.attrs.title), y = U(null), [b, x] = W(!1), [S, C] = W(""), [w, T] = W(null), [E, D] = W(!1), O = f && !p, k = () => {
440
+ if (!f) return;
437
441
  let e = i();
438
442
  typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
439
- }, O = (e) => {
440
- d && (vr(e.target) || (e.preventDefault(), D()));
441
- }, k = (e) => {
442
- d && (e.key === "Delete" || e.key === "Backspace") && o && (e.preventDefault(), t());
443
- }, A = async (e) => {
444
- if (!(!d || !e)) {
445
- C(null), T(!0);
443
+ }, A = (e) => {
444
+ f && (Dr(e.target) || (e.preventDefault(), k()));
445
+ }, j = (e) => {
446
+ f && (e.key === "Delete" || e.key === "Backspace") && s && (e.preventDefault(), t());
447
+ }, M = async (e) => {
448
+ if (!(!f || !e)) {
449
+ T(null), D(!0);
446
450
  try {
447
- let t = await ve(we({
451
+ let t = await Ce(q({
448
452
  type: "file",
449
453
  file: e,
450
454
  mimeType: e.type
451
- }), c.onUpload);
452
- s(xe(t)), S("");
455
+ }), l.onUpload);
456
+ c(Ee(t)), C("");
453
457
  } catch (e) {
454
- C(e instanceof Error ? e.message : u.uploadFailedError);
458
+ T(e instanceof Error ? e.message : d.uploadFailedError);
455
459
  } finally {
456
- T(!1), b(!1);
460
+ D(!1), x(!1);
457
461
  }
458
462
  }
459
463
  };
460
- return E ? /* @__PURE__ */ Z(n, {
464
+ return O ? /* @__PURE__ */ Z(a, {
461
465
  as: "figure",
462
466
  className: "markweave-video-node",
463
467
  "data-testid": "markweave-video-node",
464
468
  "data-empty": "true",
465
469
  "data-selected": "false",
466
- children: /* @__PURE__ */ Z(br, {
467
- dragActive: y,
468
- error: ee,
469
- fileInputRef: v,
470
- inputValue: x,
471
- isSubmitting: w,
472
- messages: l,
470
+ children: /* @__PURE__ */ Z(kr, {
471
+ dragActive: b,
472
+ error: w,
473
+ fileInputRef: y,
474
+ inputValue: S,
475
+ isSubmitting: E,
476
+ messages: u,
473
477
  onCancel: t,
474
- onDragActiveChange: b,
478
+ onDragActiveChange: x,
475
479
  onDrop: (e) => {
476
- e.preventDefault(), e.stopPropagation(), d && A(e.dataTransfer.files?.[0] ?? null);
480
+ e.preventDefault(), e.stopPropagation(), f && M(e.dataTransfer.files?.[0] ?? null);
477
481
  },
478
482
  onFileChange: (e) => {
479
- A(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
483
+ M(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
480
484
  },
481
- onInputChange: S,
485
+ onInputChange: C,
482
486
  onSubmit: () => {
483
- if (!d) return;
484
- let e = Se(x);
487
+ if (!f) return;
488
+ let e = De(S);
485
489
  if (!e) {
486
- C(u.unsupportedUrlError);
490
+ T(d.unsupportedUrlError);
487
491
  return;
488
492
  }
489
- C(null), s(e), S("");
493
+ T(null), c(e), C("");
490
494
  }
491
495
  })
492
- }) : /* @__PURE__ */ Z(n, {
496
+ }) : /* @__PURE__ */ Z(a, {
493
497
  as: "figure",
494
498
  className: "markweave-video-node",
495
499
  "data-testid": "markweave-video-node",
496
- "data-provider": m ?? "file",
497
- "data-empty": f ? "false" : "true",
498
- "data-selected": d && o ? "true" : "false",
499
- tabIndex: d ? 0 : void 0,
500
- "aria-label": u.nodeAriaLabel,
501
- onFocus: D,
502
- onKeyDown: k,
503
- onMouseDown: O,
504
- children: h ? /* @__PURE__ */ Q("div", {
500
+ "data-provider": h ?? "file",
501
+ "data-empty": p ? "false" : "true",
502
+ "data-selected": f && s ? "true" : "false",
503
+ tabIndex: f ? 0 : void 0,
504
+ "aria-label": d.nodeAriaLabel,
505
+ onFocus: k,
506
+ onKeyDown: j,
507
+ onMouseDown: A,
508
+ children: g ? /* @__PURE__ */ Q("div", {
505
509
  className: "markweave-video-embed",
506
510
  children: [/* @__PURE__ */ Z("iframe", {
507
511
  className: "markweave-video-iframe",
508
- src: h,
509
- title: _ ?? `${m ?? "Video"} embed`,
512
+ src: g,
513
+ title: v ?? `${h ?? "Video"} embed`,
510
514
  "data-markweave-video-embed": "true",
511
- "data-markweave-video-provider": m ?? void 0,
512
- "data-markweave-video-src": f ?? void 0,
513
- allow: Ee,
515
+ "data-markweave-video-provider": h ?? void 0,
516
+ "data-markweave-video-src": p ?? void 0,
517
+ allow: je,
514
518
  loading: "lazy",
515
519
  allowFullScreen: !0
516
- }), d ? /* @__PURE__ */ Z("button", {
520
+ }), f ? /* @__PURE__ */ Z("button", {
517
521
  type: "button",
518
522
  className: "markweave-video-selection-layer",
519
523
  "data-testid": "markweave-video-selection-layer",
520
524
  tabIndex: -1,
521
- "aria-label": u.selectAriaLabel
525
+ "aria-label": d.selectAriaLabel
522
526
  }) : null]
523
- }) : f ? /* @__PURE__ */ Q("div", {
527
+ }) : p ? /* @__PURE__ */ Q("div", {
524
528
  className: "markweave-video-box",
525
529
  children: [/* @__PURE__ */ Z("video", {
526
530
  className: "markweave-video",
527
- src: f,
528
- title: _ ?? void 0,
531
+ src: p,
532
+ title: v ?? void 0,
529
533
  "data-markweave-video": "true",
530
- "data-markweave-mime-type": g ?? void 0,
534
+ "data-markweave-mime-type": _ ?? void 0,
531
535
  preload: "metadata",
532
536
  controls: !0
533
- }), d ? /* @__PURE__ */ Z("button", {
537
+ }), f ? /* @__PURE__ */ Z("button", {
534
538
  type: "button",
535
539
  className: "markweave-video-selection-layer",
536
540
  "data-testid": "markweave-video-selection-layer",
537
541
  tabIndex: -1,
538
- "aria-label": u.selectAriaLabel
542
+ "aria-label": d.selectAriaLabel
539
543
  }) : null]
540
544
  }) : /* @__PURE__ */ Z("div", {
541
545
  className: "markweave-video-readonly-empty",
@@ -544,7 +548,7 @@ function yr(e) {
544
548
  })
545
549
  });
546
550
  }
547
- function br({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
551
+ function kr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
548
552
  let f = a.video;
549
553
  return /* @__PURE__ */ Q("section", {
550
554
  className: "markweave-video-upload-placeholder",
@@ -571,7 +575,7 @@ function br({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
571
575
  /* @__PURE__ */ Z("div", {
572
576
  className: "markweave-video-upload-icon",
573
577
  "aria-hidden": "true",
574
- children: /* @__PURE__ */ Z(B, {
578
+ children: /* @__PURE__ */ Z(ye, {
575
579
  size: 46,
576
580
  strokeWidth: 1.6
577
581
  })
@@ -606,7 +610,7 @@ function br({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
606
610
  "data-testid": "markweave-video-upload-submit",
607
611
  disabled: i || !r.trim(),
608
612
  onClick: d,
609
- children: [/* @__PURE__ */ Z(pe, {
613
+ children: [/* @__PURE__ */ Z(ve, {
610
614
  size: 16,
611
615
  strokeWidth: 1.8
612
616
  }), a.common.insert]
@@ -626,26 +630,227 @@ function br({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
626
630
  ]
627
631
  });
628
632
  }
629
- var xr = ye.extend({
633
+ var Ar = Te.extend({
630
634
  addOptions() {
631
635
  return {
632
636
  ...this.parent?.(),
633
- messages: Ae("zh"),
637
+ messages: n("zh"),
634
638
  onUpload: void 0
635
639
  };
636
640
  },
637
641
  addNodeView() {
638
- return typeof document > "u" ? null : r(yr, { stopEvent: ({ event: e }) => vr(e.target) });
642
+ return typeof document > "u" ? null : o(Or, { stopEvent: ({ event: e }) => Dr(e.target) });
643
+ }
644
+ });
645
+ //#endregion
646
+ //#region src/link-card-node.tsx
647
+ function jr(e) {
648
+ return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
649
+ }
650
+ function Mr(e) {
651
+ return typeof navigator < "u" && navigator.clipboard?.writeText ? navigator.clipboard.writeText(e).catch(() => void 0) : Promise.resolve();
652
+ }
653
+ function Nr(e) {
654
+ !e || typeof window > "u" || window.open(e, "_blank", "noopener,noreferrer");
655
+ }
656
+ function Pr(e) {
657
+ try {
658
+ return new URL(e).host;
659
+ } catch {
660
+ return e;
661
+ }
662
+ }
663
+ function Fr(e) {
664
+ let { deleteNode: t, editor: r, getPos: i, node: o, updateAttributes: s } = e, c = e.extension.options, l = c.messages ?? n("zh"), u = l.linkCard, d = Fe(vr(r)), f = Ve(o.attrs), [p, m] = W(!1), [h, g] = W(!1), [_, v] = W(!1), [y, b] = W(f?.title ?? ""), [x, C] = W(f?.href ?? ""), w = U(null);
665
+ if (V(() => () => w.current?.abort(), []), V(() => {
666
+ b(f?.title ?? ""), C(f?.href ?? ""), v(!1);
667
+ }, [f?.href, f?.title]), !f) return null;
668
+ let T = async (e) => {
669
+ e.preventDefault();
670
+ let t = Ve({
671
+ ...f,
672
+ href: x,
673
+ title: y
674
+ });
675
+ if (!t) return;
676
+ s(t), g(!1), w.current?.abort();
677
+ let n = new AbortController();
678
+ w.current = n;
679
+ try {
680
+ let e = await c.resolver?.({
681
+ href: t.href,
682
+ title: t.title,
683
+ signal: n.signal
684
+ });
685
+ !n.signal.aborted && e && s(Ve({
686
+ ...t,
687
+ ...e
688
+ }) ?? t);
689
+ } catch {}
690
+ }, E = () => {
691
+ let e = i();
692
+ typeof e == "number" && Ue(r, e);
693
+ }, D = _ ? null : f.imageUrl, O = Pr(f.href);
694
+ return /* @__PURE__ */ Q(a, {
695
+ as: "article",
696
+ className: "markweave-link-card",
697
+ "data-testid": "markweave-link-card",
698
+ "data-markweave-link-card": "true",
699
+ "data-hovered": p ? "true" : "false",
700
+ "data-selected": e.selected ? "true" : "false",
701
+ onMouseEnter: () => m(!0),
702
+ onMouseLeave: () => m(!1),
703
+ onMouseDown: (e) => {
704
+ jr(e.target) || e.preventDefault();
705
+ },
706
+ onClick: (e) => {
707
+ jr(e.target) || (e.preventDefault(), Nr(f.href));
708
+ },
709
+ children: [
710
+ /* @__PURE__ */ Q("a", {
711
+ className: "markweave-link-card-main",
712
+ href: f.href,
713
+ "aria-label": u.open,
714
+ children: [/* @__PURE__ */ Q("span", {
715
+ className: "markweave-link-card-copy",
716
+ children: [
717
+ /* @__PURE__ */ Z("strong", { children: f.title }),
718
+ f.description ? /* @__PURE__ */ Z("span", { children: f.description }) : null,
719
+ /* @__PURE__ */ Z("small", { children: f.siteName ?? O })
720
+ ]
721
+ }), /* @__PURE__ */ Z("span", {
722
+ className: "markweave-link-card-media",
723
+ "aria-hidden": "true",
724
+ children: D ? /* @__PURE__ */ Z("img", {
725
+ src: D,
726
+ alt: "",
727
+ loading: "lazy",
728
+ referrerPolicy: "no-referrer",
729
+ onError: () => v(!0)
730
+ }) : !_ && f.faviconUrl ? /* @__PURE__ */ Z("img", {
731
+ className: "markweave-link-card-favicon",
732
+ src: f.faviconUrl,
733
+ alt: "",
734
+ loading: "lazy",
735
+ referrerPolicy: "no-referrer",
736
+ onError: () => v(!0)
737
+ }) : /* @__PURE__ */ Z("b", { children: O.slice(0, 1).toUpperCase() })
738
+ })]
739
+ }),
740
+ d && p ? /* @__PURE__ */ Q("div", {
741
+ className: "markweave-link-card-tools",
742
+ "data-markweave-link-card-ui": "true",
743
+ "aria-label": u.toolsAriaLabel,
744
+ children: [
745
+ /* @__PURE__ */ Z(Ir, {
746
+ label: u.convertToLink,
747
+ icon: F,
748
+ onClick: E,
749
+ testId: "markweave-link-card-convert"
750
+ }),
751
+ /* @__PURE__ */ Z(Ir, {
752
+ label: u.copyAddress,
753
+ icon: S,
754
+ onClick: () => void Mr(f.href),
755
+ testId: "markweave-link-card-copy"
756
+ }),
757
+ /* @__PURE__ */ Z(Ir, {
758
+ label: u.edit,
759
+ icon: ie,
760
+ onClick: (e) => {
761
+ let t = i();
762
+ typeof t == "number" && We({
763
+ anchor: e.currentTarget,
764
+ editor: r,
765
+ messages: l,
766
+ resolver: c.resolver,
767
+ card: {
768
+ pos: t,
769
+ attrs: f
770
+ }
771
+ });
772
+ },
773
+ testId: "markweave-link-card-edit"
774
+ }),
775
+ /* @__PURE__ */ Z(Ir, {
776
+ label: u.delete,
777
+ icon: he,
778
+ onClick: t,
779
+ testId: "markweave-link-card-delete"
780
+ })
781
+ ]
782
+ }) : null,
783
+ d && h ? /* @__PURE__ */ Q("form", {
784
+ className: "markweave-link-card-editor",
785
+ "data-markweave-link-card-ui": "true",
786
+ "data-testid": "markweave-link-card-editor",
787
+ onSubmit: T,
788
+ children: [
789
+ /* @__PURE__ */ Q("label", { children: [/* @__PURE__ */ Z("span", { children: u.titleLabel }), /* @__PURE__ */ Z("input", {
790
+ "aria-label": u.titleLabel,
791
+ placeholder: u.titlePlaceholder,
792
+ value: y,
793
+ onChange: (e) => b(e.currentTarget.value)
794
+ })] }),
795
+ /* @__PURE__ */ Q("label", { children: [/* @__PURE__ */ Z("span", { children: u.addressLabel }), /* @__PURE__ */ Z("input", {
796
+ "aria-label": u.addressLabel,
797
+ placeholder: u.addressPlaceholder,
798
+ value: x,
799
+ onChange: (e) => C(e.currentTarget.value)
800
+ })] }),
801
+ /* @__PURE__ */ Z("button", {
802
+ type: "submit",
803
+ "aria-label": u.edit,
804
+ disabled: !He(x),
805
+ children: /* @__PURE__ */ Z(F, { size: 16 })
806
+ })
807
+ ]
808
+ }) : null
809
+ ]
810
+ });
811
+ }
812
+ function Ir({ icon: e, label: t, onClick: n, testId: r }) {
813
+ return /* @__PURE__ */ Q("button", {
814
+ type: "button",
815
+ "aria-label": t,
816
+ title: t,
817
+ "data-testid": r,
818
+ onMouseDown: (e) => e.preventDefault(),
819
+ onClick: n,
820
+ children: [/* @__PURE__ */ Z(e, {
821
+ size: 16,
822
+ strokeWidth: 1.8
823
+ }), /* @__PURE__ */ Z("span", {
824
+ role: "tooltip",
825
+ children: t
826
+ })]
827
+ });
828
+ }
829
+ var Lr = Ge.extend({
830
+ addOptions() {
831
+ return {
832
+ ...this.parent?.(),
833
+ messages: n("zh"),
834
+ resolver: void 0
835
+ };
836
+ },
837
+ addNodeView() {
838
+ return typeof document > "u" ? null : o(Fr, { stopEvent: ({ event: e }) => jr(e.target) });
639
839
  }
640
840
  });
641
841
  //#endregion
642
842
  //#region src/create-editor-extensions.ts
643
- function Sr(t = {}) {
843
+ function Rr(t = {}) {
644
844
  return e({
645
845
  lang: t.lang,
646
- mediaExtensions: Re({
647
- image: _r,
648
- video: xr,
846
+ linkCardExtension: Lr.configure({
847
+ lang: t.lang,
848
+ messages: n(t.lang),
849
+ resolver: t.linkCardResolver
850
+ }),
851
+ mediaExtensions: Be({
852
+ image: Er,
853
+ video: Ar,
649
854
  lang: t.lang,
650
855
  onImageUpload: t.onImageUpload,
651
856
  onVideoUpload: t.onVideoUpload
@@ -654,7 +859,7 @@ function Sr(t = {}) {
654
859
  }
655
860
  //#endregion
656
861
  //#region src/ui/codeblock/CodeBlockControls.tsx
657
- function Cr(e) {
862
+ function zr(e) {
658
863
  return e === "clipboard" ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), /* @__PURE__ */ Z("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] }) : e === "search" ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("circle", {
659
864
  cx: "10",
660
865
  cy: "10",
@@ -691,7 +896,7 @@ function Cr(e) {
691
896
  /* @__PURE__ */ Z("path", { d: "m14 14 4 4" })
692
897
  ] }) : e === "reset" ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), /* @__PURE__ */ Z("path", { d: "M6.5 8.5H3.5v-3" })] }) : /* @__PURE__ */ Z("path", { d: "m6 9 6 6 6-6" });
693
898
  }
694
- function wr({ icon: e }) {
899
+ function Br({ icon: e }) {
695
900
  return /* @__PURE__ */ Z("svg", {
696
901
  viewBox: "0 0 24 24",
697
902
  "aria-hidden": "true",
@@ -702,50 +907,50 @@ function wr({ icon: e }) {
702
907
  strokeLinecap: "round",
703
908
  strokeLinejoin: "round",
704
909
  strokeWidth: "1.8",
705
- children: Cr(e)
910
+ children: zr(e)
706
911
  })
707
912
  });
708
913
  }
709
- function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, readOnly: i = !1 }) {
710
- let a = W(null), o = W(null), s = W(null), c = W({
914
+ function Vr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, readOnly: i = !1 }) {
915
+ let a = U(null), o = U(null), s = U(null), c = U({
711
916
  active: !1,
712
917
  lastX: 0,
713
918
  lastY: 0
714
- }), [l, u] = G(null), [d, f] = G(null), [p, m] = G([]), [h, g] = G(null), [_, v] = G(!1), [y, b] = G(""), [x, S] = G(null), [ee, C] = G(!1), [w, T] = G(null), [E, D] = G(null), [O, k] = G(!1), [A, j] = G(0), [M, N] = G(0), P = ot(t), F = an(t, l), te = !i && e && P.active && P.pos !== null ? {
919
+ }), [l, u] = W(null), [d, f] = W(null), [p, m] = W([]), [h, g] = W(null), [_, v] = W(!1), [y, b] = W(""), [x, S] = W(null), [C, w] = W(!1), [T, E] = W(null), [D, O] = W(null), [k, A] = W(!1), [j, M] = W(0), [ee, N] = W(0), P = pt(t), te = pn(t, l), F = !i && e && P.active && P.pos !== null ? {
715
920
  ...P,
716
921
  pos: P.pos,
717
922
  active: !0
718
- } : null, I = F ?? te, L = I !== null, ne = I?.language === "mermaid", R = ln(t, I), z = L && I !== null && !R, re = !i, ie = Qt(I ? I.language : "text"), ae = x?.status ?? "idle", oe = I?.mermaidPreviewMode ?? n, se = ne && oe === "preview", ce = sn(t), le = `${M}|${ce.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`, ue = U(() => nn(y.trim().toLowerCase()), [y]);
719
- if (H(() => {
923
+ } : null, I = te ?? F, ne = I !== null, L = I?.language === "mermaid", re = _n(t, I), R = ne && I !== null && !re, z = !i, ie = sn(I ? I.language : "text"), ae = x?.status ?? "idle", oe = I?.mermaidPreviewMode ?? n, se = L && oe === "preview", ce = hn(t), le = `${ee}|${ce.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`, ue = H(() => dn(y.trim().toLowerCase()), [y]);
924
+ if (V(() => {
720
925
  i && (v(!1), b(""));
721
- }, [i]), H(() => {
926
+ }, [i]), V(() => {
722
927
  if (!x) return;
723
928
  let e = window.setTimeout(() => {
724
929
  S(null);
725
- }, Kt);
930
+ }, en);
726
931
  return () => {
727
932
  window.clearTimeout(e);
728
933
  };
729
- }, [x]), H(() => {
730
- S(null), v(!1), b(""), T(null), D(null), k(!1);
934
+ }, [x]), V(() => {
935
+ S(null), v(!1), b(""), E(null), O(null), A(!1);
731
936
  }, [
732
937
  e,
733
938
  I?.language,
734
939
  I?.pos,
735
940
  I?.text
736
- ]), H(() => {
941
+ ]), V(() => {
737
942
  let e = ({ transaction: e }) => {
738
- e.getMeta(it) && j((e) => e + 1);
943
+ e.getMeta(dt) && M((e) => e + 1);
739
944
  };
740
945
  return t.on("transaction", e), () => {
741
946
  t.off("transaction", e);
742
947
  };
743
- }, [t]), H(() => {
948
+ }, [t]), V(() => {
744
949
  let e = t.view.dom.closest(".markweave-editor-frame");
745
950
  if (!e) return;
746
951
  let n = (e) => {
747
952
  if (e.target instanceof Node && a.current?.contains(e.target) || _) return;
748
- let n = an(t, rn(t, e.target)), r = n && !ln(t, n) ? n.pos : null;
953
+ let n = pn(t, fn(t, e.target)), r = n && !_n(t, n) ? n.pos : null;
749
954
  u((e) => e === r ? e : r);
750
955
  }, r = () => {
751
956
  _ || u(null);
@@ -753,12 +958,12 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
753
958
  return e.addEventListener("mousemove", n), e.addEventListener("mouseleave", r), () => {
754
959
  e.removeEventListener("mousemove", n), e.removeEventListener("mouseleave", r);
755
960
  };
756
- }, [t, _]), H(() => {
961
+ }, [t, _]), V(() => {
757
962
  _ && s.current?.focus({ preventScroll: !0 });
758
- }, [_]), H(() => {
759
- if (!w) return;
963
+ }, [_]), V(() => {
964
+ if (!T) return;
760
965
  let e = (e) => {
761
- e.key === "Escape" && (T(null), D(null), k(!1), c.current = {
966
+ e.key === "Escape" && (E(null), O(null), A(!1), c.current = {
762
967
  active: !1,
763
968
  lastX: 0,
764
969
  lastY: 0
@@ -767,8 +972,8 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
767
972
  return document.addEventListener("keydown", e), () => {
768
973
  document.removeEventListener("keydown", e);
769
974
  };
770
- }, [t, w]), H(() => {
771
- if (!L || !_) return;
975
+ }, [t, T]), V(() => {
976
+ if (!ne || !_) return;
772
977
  let e = (e) => {
773
978
  e.key === "Escape" && (v(!1), t.view.focus());
774
979
  }, n = (e) => {
@@ -778,22 +983,22 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
778
983
  document.removeEventListener("keydown", e), document.removeEventListener("mousedown", n);
779
984
  };
780
985
  }, [
781
- L,
986
+ ne,
782
987
  t,
783
988
  _
784
- ]), me(() => {
989
+ ]), be(() => {
785
990
  let e = () => {
786
991
  let e = a.current;
787
992
  if (!e) return;
788
- if (!on(e) || ce.length === 0) {
993
+ if (!mn(e) || ce.length === 0) {
789
994
  m([]);
790
995
  return;
791
996
  }
792
997
  let n = e.getBoundingClientRect(), r = ce.flatMap((e) => {
793
- let r = tn(en(t, e.pos, e.mermaidPreviewMode), n);
794
- return r ? [Xt(e, r, n)] : [];
998
+ let r = un(ln(t, e.pos, e.mermaidPreviewMode), n);
999
+ return r ? [an(e, r, n)] : [];
795
1000
  });
796
- m((e) => un(e, r, ce.map((e) => e.pos)));
1001
+ m((e) => vn(e, r, ce.map((e) => e.pos)));
797
1002
  };
798
1003
  e();
799
1004
  let n = window.requestAnimationFrame(e);
@@ -801,26 +1006,26 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
801
1006
  window.cancelAnimationFrame(n), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
802
1007
  };
803
1008
  }, [
804
- A,
1009
+ j,
805
1010
  t,
806
1011
  le
807
- ]), me(() => {
808
- if (!z || !I) {
1012
+ ]), be(() => {
1013
+ if (!R || !I) {
809
1014
  f(null), g(null);
810
1015
  return;
811
1016
  }
812
1017
  let e = () => {
813
1018
  let e = a.current;
814
1019
  if (!e) return;
815
- let n = en(t, I.pos, oe), r = e.getBoundingClientRect(), i = tn(n, r);
1020
+ let n = ln(t, I.pos, oe), r = e.getBoundingClientRect(), i = un(n, r);
816
1021
  if (!i) {
817
1022
  f((e) => e?.pos === I.pos ? e : null), g((e) => _ ? e : null);
818
1023
  return;
819
1024
  }
820
- let s = Jt(I.pos, i, r);
1025
+ let s = nn(I.pos, i, r);
821
1026
  if (f(s), _ && o.current) {
822
1027
  let e = o.current.getBoundingClientRect();
823
- g(Wt({
1028
+ g(Qt({
824
1029
  overlayRect: r,
825
1030
  buttonRect: e,
826
1031
  windowWidth: window.innerWidth,
@@ -832,79 +1037,79 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
832
1037
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
833
1038
  };
834
1039
  }, [
835
- z,
836
- A,
1040
+ R,
1041
+ j,
837
1042
  I?.pos,
838
1043
  t,
839
1044
  _,
840
1045
  oe
841
- ]), !z && ce.length === 0 && !w) return null;
1046
+ ]), !R && ce.length === 0 && !T) return null;
842
1047
  let de = d ? {
843
1048
  top: d.top,
844
1049
  right: d.right
845
1050
  } : void 0, fe = async () => {
846
1051
  if (i) {
847
1052
  if (!I) return;
848
- let e = await qt(I.text);
849
- S(st(I, e ? "copied" : "failed"));
1053
+ let e = await tn(I.text);
1054
+ S(mt(I, e ? "copied" : "failed"));
850
1055
  return;
851
1056
  }
852
- if (!Zt(t, I)) return;
853
- let e = await at(t);
854
- S(st(ot(t), e ? "copied" : "failed")), t.view.focus();
1057
+ if (!on(t, I)) return;
1058
+ let e = await ft(t);
1059
+ S(mt(pt(t), e ? "copied" : "failed")), t.view.focus();
855
1060
  }, pe = (e, n) => {
856
1061
  if (i) {
857
- mt(t, e.pos, n) && N((e) => e + 1);
1062
+ St(t, e.pos, n) && N((e) => e + 1);
858
1063
  return;
859
1064
  }
860
1065
  let a = P.active && P.pos === e.pos;
861
- dt(t, e.pos, n) && (r(n), N((e) => e + 1), a && t.view.focus());
862
- }, B = (e) => {
1066
+ vt(t, e.pos, n) && (r(n), N((e) => e + 1), a && t.view.focus());
1067
+ }, me = (e) => {
863
1068
  if (i || !I) return;
864
1069
  let n = P.active && P.pos === I.pos;
865
- ut(t, I.pos, e) && (e === "mermaid" && dt(t, I.pos, "preview") && r("preview"), v(!1), b(""), N((e) => e + 1), n && t.view.focus());
866
- }, V = () => {
867
- i || !I || lt(t, I.pos, !R) && (j((e) => e + 1), u(null));
1070
+ _t(t, I.pos, e) && (e === "mermaid" && vt(t, I.pos, "preview") && r("preview"), v(!1), b(""), N((e) => e + 1), n && t.view.focus());
868
1071
  }, he = () => {
1072
+ i || !I || gt(t, I.pos, !re) && (M((e) => e + 1), u(null));
1073
+ }, ge = () => {
869
1074
  if (!I) return;
870
- let e = cn(t, I.pos);
1075
+ let e = gn(t, I.pos);
871
1076
  if (!e) return;
872
1077
  let n = new Blob([e], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
873
1078
  i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), t.view.focus();
874
- }, ge = () => {
1079
+ }, _e = () => {
875
1080
  if (!I) return;
876
- let e = cn(t, I.pos);
877
- e && (T(Yt(e)), D(null), k(!1), c.current = {
1081
+ let e = gn(t, I.pos);
1082
+ e && (E(rn(e)), O(null), A(!1), c.current = {
878
1083
  active: !1,
879
1084
  lastX: 0,
880
1085
  lastY: 0
881
1086
  });
882
- }, _e = () => {
883
- T(null), D(null), k(!1), c.current = {
1087
+ }, ve = () => {
1088
+ E(null), O(null), A(!1), c.current = {
884
1089
  active: !1,
885
1090
  lastX: 0,
886
1091
  lastY: 0
887
1092
  }, t.view.focus();
888
- }, ve = (e) => {
889
- T((t) => t && {
1093
+ }, ye = (e) => {
1094
+ E((t) => t && {
890
1095
  ...t,
891
- scale: Gt(t.scale + e)
1096
+ scale: $t(t.scale + e)
892
1097
  });
893
- }, K = () => {
894
- T((e) => e && Yt(e.svg)), c.current = {
1098
+ }, B = () => {
1099
+ E((e) => e && rn(e.svg)), c.current = {
895
1100
  active: !1,
896
1101
  lastX: 0,
897
1102
  lastY: 0
898
- }, k(!1);
899
- }, ye = (e) => {
900
- e.preventDefault(), ve(e.deltaY < 0 ? dn : -dn);
901
- }, be = (e) => {
1103
+ }, A(!1);
1104
+ }, G = (e) => {
1105
+ e.preventDefault(), ye(e.deltaY < 0 ? yn : -yn);
1106
+ }, xe = (e) => {
902
1107
  e.button === 0 && (e.preventDefault(), c.current = {
903
1108
  active: !0,
904
1109
  lastX: e.clientX,
905
1110
  lastY: e.clientY
906
- }, k(!0));
907
- }, xe = (e) => {
1111
+ }, A(!0));
1112
+ }, Se = (e) => {
908
1113
  let t = c.current;
909
1114
  if (!t.active) return;
910
1115
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -912,13 +1117,13 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
912
1117
  active: !0,
913
1118
  lastX: e.clientX,
914
1119
  lastY: e.clientY
915
- }, T((e) => fn(e, n, r));
916
- }, Se = () => {
1120
+ }, E((e) => bn(e, n, r));
1121
+ }, Ce = () => {
917
1122
  c.current = {
918
1123
  active: !1,
919
1124
  lastX: 0,
920
1125
  lastY: 0
921
- }, k(!1);
1126
+ }, A(!1);
922
1127
  };
923
1128
  return /* @__PURE__ */ Q("div", {
924
1129
  ref: a,
@@ -947,11 +1152,11 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
947
1152
  }, t))
948
1153
  }, e.pos);
949
1154
  }),
950
- z ? /* @__PURE__ */ Q("div", {
1155
+ R ? /* @__PURE__ */ Q("div", {
951
1156
  className: "markweave-codeblock-controls",
952
1157
  "data-testid": "markweave-codeblock-controls",
953
1158
  "data-positioned": d ? "true" : "false",
954
- "data-collapsed": R ? "true" : "false",
1159
+ "data-collapsed": re ? "true" : "false",
955
1160
  "data-read-only": i ? "true" : "false",
956
1161
  "aria-label": "Code block controls",
957
1162
  style: de,
@@ -971,18 +1176,18 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
971
1176
  "data-testid": "markweave-codeblock-language",
972
1177
  onMouseDown: (e) => e.preventDefault(),
973
1178
  onClick: () => v((e) => !e),
974
- children: [/* @__PURE__ */ Z("span", { children: ie }), /* @__PURE__ */ Z(wr, { icon: "chevron" })]
1179
+ children: [/* @__PURE__ */ Z("span", { children: ie }), /* @__PURE__ */ Z(Br, { icon: "chevron" })]
975
1180
  }),
976
- re ? /* @__PURE__ */ Z("button", {
1181
+ z ? /* @__PURE__ */ Z("button", {
977
1182
  type: "button",
978
1183
  className: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
979
- "aria-label": R ? "Expand code block" : "Collapse code block",
980
- title: R ? "Expand code block" : "Collapse code block",
1184
+ "aria-label": re ? "Expand code block" : "Collapse code block",
1185
+ title: re ? "Expand code block" : "Collapse code block",
981
1186
  "data-testid": "markweave-codeblock-collapse",
982
- "data-collapsed": R ? "true" : "false",
1187
+ "data-collapsed": re ? "true" : "false",
983
1188
  onMouseDown: (e) => e.preventDefault(),
984
- onClick: V,
985
- children: /* @__PURE__ */ Z(wr, { icon: "chevron" })
1189
+ onClick: he,
1190
+ children: /* @__PURE__ */ Z(Br, { icon: "chevron" })
986
1191
  }) : null,
987
1192
  /* @__PURE__ */ Q("span", {
988
1193
  className: "markweave-codeblock-copy-wrap",
@@ -993,20 +1198,20 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
993
1198
  "data-testid": "markweave-codeblock-copy",
994
1199
  "data-copy-state": ae,
995
1200
  onMouseDown: (e) => e.preventDefault(),
996
- onMouseEnter: () => C(!0),
997
- onMouseLeave: () => C(!1),
998
- onFocus: () => C(!0),
999
- onBlur: () => C(!1),
1201
+ onMouseEnter: () => w(!0),
1202
+ onMouseLeave: () => w(!1),
1203
+ onFocus: () => w(!0),
1204
+ onBlur: () => w(!1),
1000
1205
  onClick: fe,
1001
- children: /* @__PURE__ */ Z(wr, { icon: ae === "copied" ? "check" : "clipboard" })
1002
- }), ee ? /* @__PURE__ */ Z("span", {
1206
+ children: /* @__PURE__ */ Z(Br, { icon: ae === "copied" ? "check" : "clipboard" })
1207
+ }), C ? /* @__PURE__ */ Z("span", {
1003
1208
  className: "markweave-codeblock-tooltip",
1004
1209
  role: "tooltip",
1005
1210
  "data-testid": "markweave-codeblock-copy-tooltip",
1006
1211
  children: "Copy to clipboard"
1007
1212
  }) : null]
1008
1213
  }),
1009
- ne && oe === "preview" ? /* @__PURE__ */ Q("div", {
1214
+ L && oe === "preview" ? /* @__PURE__ */ Q("div", {
1010
1215
  className: "markweave-mermaid-preview-actions",
1011
1216
  "data-testid": "markweave-mermaid-preview-actions",
1012
1217
  children: [/* @__PURE__ */ Z("button", {
@@ -1016,8 +1221,8 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1016
1221
  "data-testid": "markweave-mermaid-fullscreen",
1017
1222
  disabled: !se,
1018
1223
  onMouseDown: (e) => e.preventDefault(),
1019
- onClick: ge,
1020
- children: /* @__PURE__ */ Z(wr, { icon: "expand" })
1224
+ onClick: _e,
1225
+ children: /* @__PURE__ */ Z(Br, { icon: "expand" })
1021
1226
  }), /* @__PURE__ */ Z("button", {
1022
1227
  type: "button",
1023
1228
  className: "markweave-codeblock-icon-button",
@@ -1025,13 +1230,13 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1025
1230
  "data-testid": "markweave-mermaid-download",
1026
1231
  disabled: !se,
1027
1232
  onMouseDown: (e) => e.preventDefault(),
1028
- onClick: he,
1029
- children: /* @__PURE__ */ Z(wr, { icon: "download" })
1233
+ onClick: ge,
1234
+ children: /* @__PURE__ */ Z(Br, { icon: "download" })
1030
1235
  })]
1031
1236
  }) : null
1032
1237
  ]
1033
1238
  }) : null,
1034
- re && z && _ ? /* @__PURE__ */ Q("div", {
1239
+ z && R && _ ? /* @__PURE__ */ Q("div", {
1035
1240
  className: "markweave-codeblock-language-menu",
1036
1241
  role: "listbox",
1037
1242
  "aria-label": "Code block languages",
@@ -1052,7 +1257,7 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1052
1257
  onKeyDown: (e) => {
1053
1258
  e.key === "Escape" && (e.preventDefault(), v(!1), t.view.focus());
1054
1259
  }
1055
- }), /* @__PURE__ */ Z(wr, { icon: "search" })]
1260
+ }), /* @__PURE__ */ Z(Br, { icon: "search" })]
1056
1261
  }), /* @__PURE__ */ Z("div", {
1057
1262
  className: "markweave-codeblock-language-list",
1058
1263
  children: ue.map((e) => {
@@ -1064,13 +1269,13 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1064
1269
  "data-testid": `markweave-codeblock-language-option-${e.language}`,
1065
1270
  "data-active": t ? "true" : "false",
1066
1271
  onMouseDown: (e) => e.preventDefault(),
1067
- onClick: () => B(e.language),
1068
- children: [/* @__PURE__ */ Z("span", { children: e.label }), t ? /* @__PURE__ */ Z(wr, { icon: "check" }) : null]
1272
+ onClick: () => me(e.language),
1273
+ children: [/* @__PURE__ */ Z("span", { children: e.label }), t ? /* @__PURE__ */ Z(Br, { icon: "check" }) : null]
1069
1274
  }, e.language);
1070
1275
  })
1071
1276
  })]
1072
1277
  }) : null,
1073
- w ? /* @__PURE__ */ Q("div", {
1278
+ T ? /* @__PURE__ */ Q("div", {
1074
1279
  className: "markweave-mermaid-fullscreen-layer",
1075
1280
  role: "dialog",
1076
1281
  "aria-modal": "true",
@@ -1086,47 +1291,47 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1086
1291
  className: "markweave-mermaid-fullscreen-control",
1087
1292
  "aria-label": "Zoom out",
1088
1293
  "data-testid": "markweave-mermaid-fullscreen-zoom-out",
1089
- onMouseEnter: () => D("zoom-out"),
1090
- onMouseLeave: () => D(null),
1091
- onFocus: () => D("zoom-out"),
1092
- onBlur: () => D(null),
1093
- onClick: () => ve(-dn),
1094
- children: /* @__PURE__ */ Z(wr, { icon: "zoomOut" })
1294
+ onMouseEnter: () => O("zoom-out"),
1295
+ onMouseLeave: () => O(null),
1296
+ onFocus: () => O("zoom-out"),
1297
+ onBlur: () => O(null),
1298
+ onClick: () => ye(-yn),
1299
+ children: /* @__PURE__ */ Z(Br, { icon: "zoomOut" })
1095
1300
  }),
1096
1301
  /* @__PURE__ */ Z("span", {
1097
1302
  className: "markweave-mermaid-fullscreen-zoom-label",
1098
1303
  "data-testid": "markweave-mermaid-fullscreen-zoom-label",
1099
- children: $t(w.scale)
1304
+ children: cn(T.scale)
1100
1305
  }),
1101
1306
  /* @__PURE__ */ Z("button", {
1102
1307
  type: "button",
1103
1308
  className: "markweave-mermaid-fullscreen-control",
1104
1309
  "aria-label": "Zoom in",
1105
1310
  "data-testid": "markweave-mermaid-fullscreen-zoom-in",
1106
- onMouseEnter: () => D("zoom-in"),
1107
- onMouseLeave: () => D(null),
1108
- onFocus: () => D("zoom-in"),
1109
- onBlur: () => D(null),
1110
- onClick: () => ve(dn),
1111
- children: /* @__PURE__ */ Z(wr, { icon: "zoomIn" })
1311
+ onMouseEnter: () => O("zoom-in"),
1312
+ onMouseLeave: () => O(null),
1313
+ onFocus: () => O("zoom-in"),
1314
+ onBlur: () => O(null),
1315
+ onClick: () => ye(yn),
1316
+ children: /* @__PURE__ */ Z(Br, { icon: "zoomIn" })
1112
1317
  }),
1113
1318
  /* @__PURE__ */ Z("button", {
1114
1319
  type: "button",
1115
1320
  className: "markweave-mermaid-fullscreen-control",
1116
1321
  "aria-label": "Reset zoom",
1117
1322
  "data-testid": "markweave-mermaid-fullscreen-reset",
1118
- onMouseEnter: () => D("reset"),
1119
- onMouseLeave: () => D(null),
1120
- onFocus: () => D("reset"),
1121
- onBlur: () => D(null),
1122
- onClick: K,
1123
- children: /* @__PURE__ */ Z(wr, { icon: "reset" })
1323
+ onMouseEnter: () => O("reset"),
1324
+ onMouseLeave: () => O(null),
1325
+ onFocus: () => O("reset"),
1326
+ onBlur: () => O(null),
1327
+ onClick: B,
1328
+ children: /* @__PURE__ */ Z(Br, { icon: "reset" })
1124
1329
  }),
1125
- E ? /* @__PURE__ */ Z("span", {
1330
+ D ? /* @__PURE__ */ Z("span", {
1126
1331
  className: "markweave-mermaid-fullscreen-tooltip",
1127
1332
  role: "tooltip",
1128
1333
  "data-testid": "markweave-mermaid-fullscreen-tooltip",
1129
- children: E === "zoom-out" ? "Zoom out" : E === "zoom-in" ? "Zoom in" : "Reset"
1334
+ children: D === "zoom-out" ? "Zoom out" : D === "zoom-in" ? "Zoom in" : "Reset"
1130
1335
  }) : null
1131
1336
  ]
1132
1337
  }),
@@ -1135,29 +1340,29 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1135
1340
  className: "markweave-mermaid-fullscreen-close",
1136
1341
  "aria-label": "Close fullscreen Mermaid preview",
1137
1342
  "data-testid": "markweave-mermaid-fullscreen-close",
1138
- onClick: _e,
1139
- children: /* @__PURE__ */ Z(wr, { icon: "close" })
1343
+ onClick: ve,
1344
+ children: /* @__PURE__ */ Z(Br, { icon: "close" })
1140
1345
  }),
1141
1346
  /* @__PURE__ */ Z("div", {
1142
1347
  className: "markweave-mermaid-fullscreen-viewport",
1143
1348
  "data-testid": "markweave-mermaid-fullscreen-viewport",
1144
- "data-dragging": O ? "true" : "false",
1145
- onWheel: ye,
1146
- onMouseDown: be,
1147
- onMouseMove: xe,
1148
- onMouseUp: Se,
1149
- onMouseLeave: Se,
1349
+ "data-dragging": k ? "true" : "false",
1350
+ onWheel: G,
1351
+ onMouseDown: xe,
1352
+ onMouseMove: Se,
1353
+ onMouseUp: Ce,
1354
+ onMouseLeave: Ce,
1150
1355
  children: /* @__PURE__ */ Z("div", {
1151
1356
  className: "markweave-mermaid-fullscreen-content",
1152
1357
  "data-testid": "markweave-mermaid-fullscreen-content",
1153
- "data-scale-percent": Math.round(w.scale * 100),
1154
- "data-translate": `${Math.round(w.translateX)},${Math.round(w.translateY)}`,
1358
+ "data-scale-percent": Math.round(T.scale * 100),
1359
+ "data-translate": `${Math.round(T.translateX)},${Math.round(T.translateY)}`,
1155
1360
  style: {
1156
- width: `${w.width}px`,
1157
- height: `${w.height}px`,
1158
- transform: `translate(${w.translateX}px, ${w.translateY}px) scale(${w.scale})`
1361
+ width: `${T.width}px`,
1362
+ height: `${T.height}px`,
1363
+ transform: `translate(${T.translateX}px, ${T.translateY}px) scale(${T.scale})`
1159
1364
  },
1160
- dangerouslySetInnerHTML: { __html: w.svg }
1365
+ dangerouslySetInnerHTML: { __html: T.svg }
1161
1366
  })
1162
1367
  })
1163
1368
  ]
@@ -1167,25 +1372,25 @@ function Tr({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1167
1372
  }
1168
1373
  //#endregion
1169
1374
  //#region src/ui/floating-toolbar/FloatingToolbar.tsx
1170
- var Er = Ae("zh");
1171
- function Dr() {
1375
+ var Hr = n("zh");
1376
+ function Ur() {
1172
1377
  return typeof performance > "u" ? Date.now() : performance.now();
1173
1378
  }
1174
- function Or(e, t) {
1379
+ function Wr(e, t) {
1175
1380
  return {
1176
1381
  "--markweave-toolbar-motion-duration": `${e.motionDurationMs}ms`,
1177
1382
  "--markweave-toolbar-motion-easing": e.motionEasing,
1178
1383
  marginLeft: t === 0 ? void 0 : `${t}px`
1179
1384
  };
1180
1385
  }
1181
- function kr(e, t) {
1386
+ function Gr(e, t) {
1182
1387
  let n = e?.getBoundingClientRect().height ?? 0, r = t?.getBoundingClientRect().height ?? 0;
1183
1388
  return Math.max(n, r, 44);
1184
1389
  }
1185
- function Ar(e) {
1390
+ function Kr(e) {
1186
1391
  if (e !== null) return { "--markweave-floating-toolbar-tooltip-left": `${e}px` };
1187
1392
  }
1188
- function jr(e, t, n, r) {
1393
+ function qr(e, t, n, r) {
1189
1394
  let i = {
1190
1395
  bottom: t + r,
1191
1396
  height: r,
@@ -1201,26 +1406,26 @@ function jr(e, t, n, r) {
1201
1406
  toJSON: () => i
1202
1407
  };
1203
1408
  }
1204
- function Mr(e) {
1409
+ function Jr(e) {
1205
1410
  return e.width > 0 && e.height > 0;
1206
1411
  }
1207
- function Nr(e) {
1412
+ function Yr(e) {
1208
1413
  let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.right)), i = Math.max(...e.map((e) => e.bottom));
1209
- return jr(t, n, r - t, i - n);
1414
+ return qr(t, n, r - t, i - n);
1210
1415
  }
1211
- function Pr(e, t) {
1416
+ function Xr(e, t) {
1212
1417
  let n = e.view.dom.ownerDocument.defaultView?.Node.ELEMENT_NODE ?? 1, r = (t) => t ? e.view.dom.contains(t.nodeType === n ? t : t.parentNode) : !1;
1213
1418
  return r(t.anchorNode) && r(t.focusNode);
1214
1419
  }
1215
- function Fr(e) {
1420
+ function Zr(e) {
1216
1421
  if (typeof e.getClientRects != "function") return null;
1217
- let t = Array.from(e.getClientRects()).filter(Mr).map((e) => jr(e.left, e.top, e.width, e.height));
1422
+ let t = Array.from(e.getClientRects()).filter(Jr).map((e) => qr(e.left, e.top, e.width, e.height));
1218
1423
  if (t.length > 0) return t;
1219
1424
  if (typeof e.getBoundingClientRect != "function") return null;
1220
1425
  let n = e.getBoundingClientRect();
1221
- return Mr(n) ? [jr(n.left, n.top, n.width, n.height)] : null;
1426
+ return Jr(n) ? [qr(n.left, n.top, n.width, n.height)] : null;
1222
1427
  }
1223
- function Ir(e, t) {
1428
+ function Qr(e, t) {
1224
1429
  if (t.rangeCount === 0) return null;
1225
1430
  let n = t.getRangeAt(0);
1226
1431
  try {
@@ -1233,8 +1438,8 @@ function Ir(e, t) {
1233
1438
  return null;
1234
1439
  }
1235
1440
  }
1236
- function Lr(e, t) {
1237
- let n = Ir(e, t);
1441
+ function $r(e, t) {
1442
+ let n = Qr(e, t);
1238
1443
  if (!n) return !1;
1239
1444
  let { selection: r } = e.state, i = {
1240
1445
  from: Math.min(r.from, r.to),
@@ -1242,51 +1447,51 @@ function Lr(e, t) {
1242
1447
  };
1243
1448
  return n.from === i.from && n.to === i.to;
1244
1449
  }
1245
- function Rr(e) {
1450
+ function ei(e) {
1246
1451
  let t = e.view.dom.ownerDocument.getSelection();
1247
- return !t || t.rangeCount === 0 || t.isCollapsed || !Pr(e, t) || !Lr(e, t) ? null : Fr(t.getRangeAt(0));
1452
+ return !t || t.rangeCount === 0 || t.isCollapsed || !Xr(e, t) || !$r(e, t) ? null : Zr(t.getRangeAt(0));
1248
1453
  }
1249
- function zr(e) {
1454
+ function ti(e) {
1250
1455
  let { selection: t } = e.state;
1251
1456
  if (t.empty) return null;
1252
1457
  let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to);
1253
1458
  try {
1254
1459
  let t = e.view.domAtPos(n), i = e.view.domAtPos(r), a = e.view.dom.ownerDocument.createRange();
1255
- return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset), Fr(a);
1460
+ return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset), Zr(a);
1256
1461
  } catch {
1257
1462
  return null;
1258
1463
  }
1259
1464
  }
1260
- function Br(e) {
1465
+ function ni(e) {
1261
1466
  let { selection: t } = e.state;
1262
1467
  if (t.empty) return null;
1263
- let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to), i = e.view.coordsAtPos(n), a = e.view.coordsAtPos(r, -1), o = Math.min(i.top, a.top), s = Math.max(i.bottom, a.bottom), c = Math.min(i.left, a.left), l = jr(c, o, Math.max(i.right, a.right) - c, s - o);
1264
- return Mr(l) ? [l] : null;
1468
+ let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to), i = e.view.coordsAtPos(n), a = e.view.coordsAtPos(r, -1), o = Math.min(i.top, a.top), s = Math.max(i.bottom, a.bottom), c = Math.min(i.left, a.left), l = qr(c, o, Math.max(i.right, a.right) - c, s - o);
1469
+ return Jr(l) ? [l] : null;
1265
1470
  }
1266
- function Vr(e) {
1267
- return Rr(e) ?? zr(e) ?? Br(e);
1471
+ function ri(e) {
1472
+ return ei(e) ?? ti(e) ?? ni(e);
1268
1473
  }
1269
- function Hr(e) {
1270
- let t = Vr(e);
1271
- return t && t.length > 0 ? Nr(t) : null;
1474
+ function ii(e) {
1475
+ let t = ri(e);
1476
+ return t && t.length > 0 ? Yr(t) : null;
1272
1477
  }
1273
- function Ur(e) {
1478
+ function ai(e) {
1274
1479
  return {
1275
- getBoundingClientRect: () => Hr(e) ?? jr(0, 0, 0, 0),
1276
- getClientRects: () => Vr(e) ?? []
1480
+ getBoundingClientRect: () => ii(e) ?? qr(0, 0, 0, 0),
1481
+ getClientRects: () => ri(e) ?? []
1277
1482
  };
1278
1483
  }
1279
- function Wr(e) {
1484
+ function oi(e) {
1280
1485
  return e === "block-type" || e === "link" || e === "color" || e === "more";
1281
1486
  }
1282
- function Gr(e, t, n) {
1283
- n?.(gn(e, t)), e.commands.focus();
1487
+ function si(e, t, n) {
1488
+ n?.(wn(e, t)), e.commands.focus();
1284
1489
  }
1285
- function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelection: r }) {
1286
- let i = U(() => xn(t), [t]), a = et(n, { editable: e.isEditable }), [o, s] = G(a), [c, l] = G(null), [u, d] = G(null), [f, p] = G(null), [m, h] = G(""), [g, _] = G(""), [v, y] = G(null), [b, x] = G(0), [S, ee] = G(a.boundaryPadding), [C, w] = G("bottom"), T = W(0), E = W(null), D = W(null), O = W(null), k = W(null), A = _n(e, o.variant, t), j = Cn(A.find((e) => e.id === c) ?? null), M = Pn(m), N = V(() => {
1287
- let t = E.current, n = e.view.dom.closest(".markweave-editor-frame");
1490
+ function ci({ editor: e, messages: t = Hr, selectionSnapshot: n, onRewriteSelection: r }) {
1491
+ let i = H(() => kn(t), [t]), a = st(n, { editable: e.isEditable }), [o, s] = W(a), [c, l] = W(null), [u, d] = W(null), [f, p] = W(null), [m, h] = W(""), [g, _] = W(""), [v, y] = W(null), [b, x] = W(0), [S, C] = W(a.boundaryPadding), [w, T] = W("bottom"), E = U(0), D = U(null), O = U(null), k = U(null), A = U(null), j = Tn(e, o.variant, t), M = jn(j.find((e) => e.id === c) ?? null), ee = Hn(m), N = B(() => {
1492
+ let t = D.current, n = e.view.dom.closest(".markweave-editor-frame");
1288
1493
  if (!t || !(n instanceof HTMLElement)) return;
1289
- let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = kr(t, D.current), s = T.current, c = Ye({
1494
+ let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = Gr(t, O.current), s = E.current, c = nt({
1290
1495
  toolbarRect: {
1291
1496
  left: r.left - s,
1292
1497
  top: r.top,
@@ -1300,7 +1505,7 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1300
1505
  height: i.height
1301
1506
  },
1302
1507
  boundaryPadding: o.boundaryPadding
1303
- }), l = Ze({
1508
+ }), l = it({
1304
1509
  frameRect: {
1305
1510
  left: i.left,
1306
1511
  top: i.top,
@@ -1314,21 +1519,21 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1314
1519
  offset: o.offset,
1315
1520
  boundaryPadding: o.boundaryPadding
1316
1521
  });
1317
- t.style.marginLeft = c === 0 ? "" : `${c}px`, t.style.visibility = "visible", t.style.opacity = "1", T.current = c, x((e) => e === c ? e : c), ee((e) => e === l ? e : l);
1522
+ t.style.marginLeft = c === 0 ? "" : `${c}px`, t.style.visibility = "visible", t.style.opacity = "1", E.current = c, x((e) => e === c ? e : c), C((e) => e === l ? e : l);
1318
1523
  }, [
1319
1524
  e.view.dom,
1320
1525
  o.boundaryPadding,
1321
1526
  o.offset
1322
- ]), P = V(() => {
1323
- E.current && (E.current.style.visibility = "hidden", E.current.style.opacity = "0");
1324
- }, []), F = V(() => {
1527
+ ]), P = B(() => {
1528
+ D.current && (D.current.style.visibility = "hidden", D.current.style.opacity = "0");
1529
+ }, []), te = B(() => {
1325
1530
  N();
1326
- }, [N]), te = V(() => Ur(e), [e]), I = V((e) => {
1327
- O.current = e;
1328
- }, []), L = V(() => {
1329
- let t = E.current, n = O.current, r = e.view.dom.closest(".markweave-editor-frame");
1531
+ }, [N]), F = B(() => ai(e), [e]), I = B((e) => {
1532
+ k.current = e;
1533
+ }, []), ne = B(() => {
1534
+ let t = D.current, n = k.current, r = e.view.dom.closest(".markweave-editor-frame");
1330
1535
  if (!f || !t || !n) return;
1331
- let i = t.getBoundingClientRect(), a = n.getBoundingClientRect(), s = r?.getBoundingClientRect() ?? null, c = Xe({
1536
+ let i = t.getBoundingClientRect(), a = n.getBoundingClientRect(), s = r?.getBoundingClientRect() ?? null, c = rt({
1332
1537
  toolbarRect: i,
1333
1538
  popoverSize: a,
1334
1539
  viewport: {
@@ -1339,24 +1544,24 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1339
1544
  gap: f === "more" ? 8 : 6,
1340
1545
  boundaryPadding: o.boundaryPadding
1341
1546
  });
1342
- w((e) => e === c.placement ? e : c.placement);
1547
+ T((e) => e === c.placement ? e : c.placement);
1343
1548
  }, [
1344
1549
  e.view.dom,
1345
1550
  f,
1346
1551
  o.boundaryPadding
1347
- ]), ne = U(() => ({
1348
- ...$e(o, { topBoundaryPadding: S }),
1552
+ ]), L = H(() => ({
1553
+ ...ot(o, { topBoundaryPadding: S }),
1349
1554
  onShow: P,
1350
- onUpdate: F
1555
+ onUpdate: te
1351
1556
  }), [
1352
1557
  P,
1353
- F,
1558
+ te,
1354
1559
  o,
1355
1560
  S
1356
1561
  ]);
1357
- H(() => {
1358
- let e = Dr();
1359
- s((t) => rt(t, a, e));
1562
+ V(() => {
1563
+ let e = Ur();
1564
+ s((t) => ut(t, a, e));
1360
1565
  }, [
1361
1566
  a.hiddenReason,
1362
1567
  a.motionDurationMs,
@@ -1368,10 +1573,10 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1368
1573
  a.updateDelayMs,
1369
1574
  a.variant,
1370
1575
  a.visibility
1371
- ]), H(() => {
1576
+ ]), V(() => {
1372
1577
  if (o.motionStartedAtMs === null || o.motionDurationMs <= 0) return;
1373
- let e = Math.max(0, o.motionStartedAtMs + o.motionDurationMs - Dr()), t = window.setTimeout(() => {
1374
- s((e) => qe(e, Dr()));
1578
+ let e = Math.max(0, o.motionStartedAtMs + o.motionDurationMs - Ur()), t = window.setTimeout(() => {
1579
+ s((e) => et(e, Ur()));
1375
1580
  }, e);
1376
1581
  return () => {
1377
1582
  window.clearTimeout(t);
@@ -1380,12 +1585,12 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1380
1585
  o.motionDurationMs,
1381
1586
  o.motionPhase,
1382
1587
  o.motionStartedAtMs
1383
- ]), me(() => {
1588
+ ]), be(() => {
1384
1589
  if (o.visibility !== "visible") {
1385
- T.current = 0, E.current && (E.current.style.marginLeft = "", E.current.style.visibility = "hidden", E.current.style.opacity = "0"), x(0), ee(o.boundaryPadding);
1590
+ E.current = 0, D.current && (D.current.style.marginLeft = "", D.current.style.visibility = "hidden", D.current.style.opacity = "0"), x(0), C(o.boundaryPadding);
1386
1591
  return;
1387
1592
  }
1388
- let e = mn(N);
1593
+ let e = Sn(N);
1389
1594
  return e.schedule(), window.addEventListener("resize", e.schedule), window.addEventListener("scroll", e.schedule, !0), () => {
1390
1595
  e.cancel(), window.removeEventListener("resize", e.schedule), window.removeEventListener("scroll", e.schedule, !0);
1391
1596
  };
@@ -1397,42 +1602,42 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1397
1602
  n?.to,
1398
1603
  o.variant,
1399
1604
  o.visibility,
1400
- A.length
1401
- ]), me(() => {
1605
+ j.length
1606
+ ]), be(() => {
1402
1607
  if (!f) return;
1403
- let e = mn(L);
1608
+ let e = Sn(ne);
1404
1609
  return e.schedule(), window.addEventListener("resize", e.schedule), window.addEventListener("scroll", e.schedule, !0), () => {
1405
1610
  e.cancel(), window.removeEventListener("resize", e.schedule), window.removeEventListener("scroll", e.schedule, !0);
1406
1611
  };
1407
- }, [f, L]), H(() => {
1408
- f === "more" && i.some((e) => e.id === c) || A.some((e) => e.id === c) || (l(null), d(null));
1612
+ }, [f, ne]), V(() => {
1613
+ f === "more" && i.some((e) => e.id === c) || j.some((e) => e.id === c) || (l(null), d(null));
1409
1614
  }, [
1410
1615
  i,
1411
1616
  f,
1412
1617
  c,
1413
- A
1414
- ]), H(() => {
1618
+ j
1619
+ ]), V(() => {
1415
1620
  if (!f) return;
1416
1621
  let t = (e) => {
1417
- D.current?.contains(e.target) || p(null);
1622
+ O.current?.contains(e.target) || p(null);
1418
1623
  }, n = (t) => {
1419
1624
  t.key === "Escape" && (t.preventDefault(), p(null), e.commands.focus());
1420
1625
  };
1421
1626
  return document.addEventListener("pointerdown", t, !0), document.addEventListener("keydown", n, !0), () => {
1422
1627
  document.removeEventListener("pointerdown", t, !0), document.removeEventListener("keydown", n, !0);
1423
1628
  };
1424
- }, [e, f]), H(() => {
1629
+ }, [e, f]), V(() => {
1425
1630
  if (f !== "link") return;
1426
1631
  let e = window.requestAnimationFrame(() => {
1427
- k.current?.focus(), k.current?.select();
1632
+ A.current?.focus(), A.current?.select();
1428
1633
  });
1429
1634
  return () => window.cancelAnimationFrame(e);
1430
1635
  }, [f]);
1431
- let R = (t) => {
1432
- if (Wr(t.id)) {
1636
+ let re = (t) => {
1637
+ if (oi(t.id)) {
1433
1638
  let n = t.id;
1434
1639
  if (n === "link") {
1435
- let t = yn(e);
1640
+ let t = Dn(e);
1436
1641
  h(t), _(t), y({
1437
1642
  from: Math.min(e.state.selection.from, e.state.selection.to),
1438
1643
  to: Math.max(e.state.selection.from, e.state.selection.to)
@@ -1442,84 +1647,84 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1442
1647
  return;
1443
1648
  }
1444
1649
  if (p(null), t.id === "improve") {
1445
- Gr(e, "rewrite-selection", r);
1650
+ si(e, "rewrite-selection", r);
1446
1651
  return;
1447
1652
  }
1448
1653
  t.run(), e.commands.focus();
1449
- }, z = () => {
1654
+ }, R = () => {
1450
1655
  p(null), e.commands.focus();
1451
- }, re = () => {
1656
+ }, z = () => {
1452
1657
  v && e.commands.setTextSelection(v);
1453
1658
  }, ie = () => {
1454
- re(), hn(e, m) && z();
1659
+ z(), Cn(e, m) && R();
1455
1660
  }, ae = () => {
1456
- if (re(), kn(e)) {
1457
- h(""), _(""), z();
1661
+ if (z(), Ln(e)) {
1662
+ h(""), _(""), R();
1458
1663
  return;
1459
1664
  }
1460
1665
  m.trim() && h("");
1461
1666
  }, oe = (e, t) => {
1462
- if (l(e), !e || !t || !D.current) {
1667
+ if (l(e), !e || !t || !O.current) {
1463
1668
  d(null);
1464
1669
  return;
1465
1670
  }
1466
- let n = t.getBoundingClientRect(), r = D.current.getBoundingClientRect();
1671
+ let n = t.getBoundingClientRect(), r = O.current.getBoundingClientRect();
1467
1672
  d(n.left + n.width / 2 - r.left);
1468
1673
  };
1469
- return /* @__PURE__ */ Z(pn, {
1470
- ref: E,
1674
+ return /* @__PURE__ */ Z(xn, {
1675
+ ref: D,
1471
1676
  editor: e,
1472
1677
  className: `markweave-floating-toolbar markweave-floating-toolbar--${o.variant} markweave-floating-toolbar--motion-${o.motionPhase}`,
1473
1678
  "data-motion": o.motionPhase,
1474
- "data-position-strategy": ne.strategy,
1679
+ "data-position-strategy": L.strategy,
1475
1680
  "data-boundary-padding": o.boundaryPadding,
1476
- "data-popover-placement": f ? C : void 0,
1681
+ "data-popover-placement": f ? w : void 0,
1477
1682
  "data-testid": "markweave-floating-toolbar",
1478
- style: Or(o, b),
1683
+ style: Wr(o, b),
1479
1684
  updateDelay: 0,
1480
- getReferencedVirtualElement: te,
1481
- options: ne,
1482
- shouldShow: ({ editor: e }) => e.isEditable && nt(Qe(e)),
1685
+ getReferencedVirtualElement: F,
1686
+ options: L,
1687
+ shouldShow: ({ editor: e }) => e.isEditable && lt(at(e)),
1483
1688
  children: /* @__PURE__ */ Q("div", {
1484
- ref: D,
1689
+ ref: O,
1485
1690
  className: "markweave-floating-toolbar-content",
1486
1691
  "data-menu": f ?? "none",
1487
1692
  children: [
1488
- A.map((e, t) => /* @__PURE__ */ Z(Jr, {
1693
+ j.map((e, t) => /* @__PURE__ */ Z(ui, {
1489
1694
  button: e,
1490
1695
  expanded: f === e.id,
1491
- showDivider: t > 0 && A[t - 1].group !== e.group,
1696
+ showDivider: t > 0 && j[t - 1].group !== e.group,
1492
1697
  tooltipActive: c === e.id,
1493
- onPointerDown: On,
1698
+ onPointerDown: In,
1494
1699
  onTooltipChange: oe,
1495
- onRun: R
1700
+ onRun: re
1496
1701
  }, e.id)),
1497
- f === "block-type" ? /* @__PURE__ */ Z(Xr, {
1702
+ f === "block-type" ? /* @__PURE__ */ Z(fi, {
1498
1703
  editor: e,
1499
1704
  messages: t,
1500
1705
  onPopoverRef: I,
1501
1706
  onClose: () => p(null)
1502
1707
  }) : null,
1503
- f === "link" ? /* @__PURE__ */ Z(qr, {
1504
- inputRef: k,
1708
+ f === "link" ? /* @__PURE__ */ Z(li, {
1709
+ inputRef: A,
1505
1710
  messages: t,
1506
1711
  value: m,
1507
- canApply: !!M,
1508
- canOpen: !!M,
1712
+ canApply: !!ee,
1713
+ canOpen: !!ee,
1509
1714
  canRemove: !!(g || m.trim()),
1510
1715
  onValueChange: h,
1511
1716
  onApply: ie,
1512
- onOpen: () => Dn(m),
1717
+ onOpen: () => Fn(m),
1513
1718
  onRemove: ae,
1514
1719
  onPopoverRef: I
1515
1720
  }) : null,
1516
- f === "color" ? /* @__PURE__ */ Z(Qr, {
1721
+ f === "color" ? /* @__PURE__ */ Z(mi, {
1517
1722
  editor: e,
1518
1723
  messages: t,
1519
1724
  onPopoverRef: I,
1520
1725
  onClose: () => p(null)
1521
1726
  }) : null,
1522
- f === "more" ? /* @__PURE__ */ Z(ei, {
1727
+ f === "more" ? /* @__PURE__ */ Z(gi, {
1523
1728
  editor: e,
1524
1729
  messages: t,
1525
1730
  activeTooltipId: c,
@@ -1527,21 +1732,21 @@ function Kr({ editor: e, messages: t = Er, selectionSnapshot: n, onRewriteSelect
1527
1732
  onTooltipChange: l,
1528
1733
  onClose: () => p(null)
1529
1734
  }) : null,
1530
- j && f === null ? /* @__PURE__ */ Z("div", {
1735
+ M && f === null ? /* @__PURE__ */ Z("div", {
1531
1736
  className: "markweave-floating-toolbar-tooltip",
1532
1737
  role: "tooltip",
1533
1738
  "data-testid": "markweave-floating-toolbar-tooltip",
1534
- "data-button-id": j.buttonId,
1535
- "data-active": j.active,
1536
- style: Ar(u),
1537
- children: j.label
1739
+ "data-button-id": M.buttonId,
1740
+ "data-active": M.active,
1741
+ style: Kr(u),
1742
+ children: M.label
1538
1743
  }) : null
1539
1744
  ]
1540
1745
  })
1541
1746
  });
1542
1747
  }
1543
- function qr({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRemove: a, onValueChange: o, onApply: s, onOpen: c, onRemove: l, onPopoverRef: u }) {
1544
- let d = bn(t);
1748
+ function li({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRemove: a, onValueChange: o, onApply: s, onOpen: c, onRemove: l, onPopoverRef: u }) {
1749
+ let d = On(t);
1545
1750
  return /* @__PURE__ */ Q("form", {
1546
1751
  ref: u,
1547
1752
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
@@ -1564,7 +1769,7 @@ function qr({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1564
1769
  "aria-label": d.applyLink,
1565
1770
  "data-testid": "markweave-floating-toolbar-link-apply",
1566
1771
  disabled: !r,
1567
- onMouseDown: On,
1772
+ onMouseDown: In,
1568
1773
  children: /* @__PURE__ */ Z($, { name: "corner-down-left" })
1569
1774
  }),
1570
1775
  /* @__PURE__ */ Z("span", {
@@ -1576,7 +1781,7 @@ function qr({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1576
1781
  "aria-label": d.openLink,
1577
1782
  "data-testid": "markweave-floating-toolbar-link-open",
1578
1783
  disabled: !i,
1579
- onMouseDown: On,
1784
+ onMouseDown: In,
1580
1785
  onClick: c,
1581
1786
  children: /* @__PURE__ */ Z($, { name: "external-link" })
1582
1787
  }),
@@ -1585,7 +1790,7 @@ function qr({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1585
1790
  "aria-label": d.removeLink,
1586
1791
  "data-testid": "markweave-floating-toolbar-link-remove",
1587
1792
  disabled: !a,
1588
- onMouseDown: On,
1793
+ onMouseDown: In,
1589
1794
  onClick: l,
1590
1795
  children: /* @__PURE__ */ Z($, { name: "trash" })
1591
1796
  })
@@ -1593,7 +1798,7 @@ function qr({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1593
1798
  })]
1594
1799
  });
1595
1800
  }
1596
- function Jr({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointerDown: i, onTooltipChange: a, onRun: o }) {
1801
+ function ui({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointerDown: i, onTooltipChange: a, onRun: o }) {
1597
1802
  return /* @__PURE__ */ Q(X, { children: [n ? /* @__PURE__ */ Z("span", {
1598
1803
  className: "markweave-floating-toolbar-divider",
1599
1804
  "aria-hidden": "true"
@@ -1601,7 +1806,7 @@ function Jr({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointe
1601
1806
  type: "button",
1602
1807
  className: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${e.id}`,
1603
1808
  "aria-label": e.label,
1604
- "aria-expanded": Wr(e.id) ? t : void 0,
1809
+ "aria-expanded": oi(e.id) ? t : void 0,
1605
1810
  "data-active": e.active || t,
1606
1811
  "data-tooltip-active": r ? "true" : "false",
1607
1812
  "data-testid": `markweave-floating-toolbar-button-${e.id}`,
@@ -1611,13 +1816,13 @@ function Jr({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointe
1611
1816
  onMouseEnter: (t) => a(e.id, t.currentTarget),
1612
1817
  onMouseLeave: () => a(null),
1613
1818
  onClick: () => o(e),
1614
- children: /* @__PURE__ */ Z(Yr, {
1819
+ children: /* @__PURE__ */ Z(di, {
1615
1820
  button: e,
1616
1821
  expanded: t
1617
1822
  })
1618
1823
  })] });
1619
1824
  }
1620
- function Yr({ button: e, expanded: t }) {
1825
+ function di({ button: e, expanded: t }) {
1621
1826
  return e.id === "improve" ? /* @__PURE__ */ Q("span", {
1622
1827
  className: "markweave-floating-toolbar-button-inner",
1623
1828
  children: [/* @__PURE__ */ Z($, { name: "sparkles" }), /* @__PURE__ */ Z("span", { children: e.glyph })]
@@ -1635,8 +1840,8 @@ function Yr({ button: e, expanded: t }) {
1635
1840
  }), /* @__PURE__ */ Z($, { name: t ? "chevron-up" : "chevron-down" })]
1636
1841
  }) : /* @__PURE__ */ Z($, { name: "more" });
1637
1842
  }
1638
- function Xr({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1639
- let i = bn(t), a = wn(t);
1843
+ function fi({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1844
+ let i = On(t), a = Mn(t);
1640
1845
  return /* @__PURE__ */ Q("div", {
1641
1846
  ref: n,
1642
1847
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
@@ -1646,48 +1851,48 @@ function Xr({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1646
1851
  children: i.turnIntoTitle
1647
1852
  }), a.map((t) => /* @__PURE__ */ Q("button", {
1648
1853
  type: "button",
1649
- "data-active": En(e, t.id),
1854
+ "data-active": Pn(e, t.id),
1650
1855
  "data-testid": `markweave-floating-toolbar-turn-${t.id}`,
1651
- onMouseDown: On,
1856
+ onMouseDown: In,
1652
1857
  onClick: () => {
1653
- Nn(e, t.id), r();
1858
+ Vn(e, t.id), r();
1654
1859
  },
1655
1860
  children: [/* @__PURE__ */ Z("span", {
1656
1861
  className: "markweave-floating-toolbar-menu-icon",
1657
- children: /* @__PURE__ */ Z(Zr, { option: t })
1862
+ children: /* @__PURE__ */ Z(pi, { option: t })
1658
1863
  }), /* @__PURE__ */ Z("span", { children: t.label })]
1659
1864
  }, t.id))]
1660
1865
  });
1661
1866
  }
1662
- function Zr({ option: e }) {
1867
+ function pi({ option: e }) {
1663
1868
  return e.id === "paragraph" ? /* @__PURE__ */ Z($, { name: "text" }) : e.glyph === "bullet-list" || e.glyph === "numbered-list" || e.glyph === "todo-list" || e.glyph === "quote" || e.glyph === "code-block" ? /* @__PURE__ */ Z($, { name: e.glyph }) : /* @__PURE__ */ Z("span", { children: e.glyph });
1664
1869
  }
1665
- function Qr({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1666
- let i = bn(t), a = e.getAttributes("textStyle").color, o = e.getAttributes("highlight").color;
1870
+ function mi({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1871
+ let i = On(t), a = e.getAttributes("textStyle").color, o = e.getAttributes("highlight").color;
1667
1872
  return /* @__PURE__ */ Q("div", {
1668
1873
  ref: n,
1669
1874
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
1670
1875
  "data-testid": "markweave-floating-toolbar-color-menu",
1671
- children: [/* @__PURE__ */ Z($r, {
1876
+ children: [/* @__PURE__ */ Z(hi, {
1672
1877
  title: i.textColorTitle,
1673
1878
  mode: "text",
1674
1879
  activeColor: a ?? null,
1675
- options: Sn(t),
1880
+ options: An(t),
1676
1881
  onSelect: (t) => {
1677
- Mn(e, t), r();
1882
+ Bn(e, t), r();
1678
1883
  }
1679
- }), /* @__PURE__ */ Z($r, {
1884
+ }), /* @__PURE__ */ Z(hi, {
1680
1885
  title: i.highlightColorTitle,
1681
1886
  mode: "highlight",
1682
1887
  activeColor: o ?? null,
1683
- options: vn(t),
1888
+ options: En(t),
1684
1889
  onSelect: (t) => {
1685
- jn(e, t), r();
1890
+ zn(e, t), r();
1686
1891
  }
1687
1892
  })]
1688
1893
  });
1689
1894
  }
1690
- function $r({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
1895
+ function hi({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
1691
1896
  return /* @__PURE__ */ Q("section", {
1692
1897
  className: "markweave-floating-toolbar-color-section",
1693
1898
  "aria-label": e,
@@ -1701,7 +1906,7 @@ function $r({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
1701
1906
  "aria-label": e.label,
1702
1907
  "data-active": e.value === n || e.value === null && !n,
1703
1908
  "data-testid": `markweave-floating-toolbar-${t}-${e.id}`,
1704
- onMouseDown: On,
1909
+ onMouseDown: In,
1705
1910
  onClick: () => i(e.value),
1706
1911
  children: t === "text" ? /* @__PURE__ */ Z("span", {
1707
1912
  className: "markweave-floating-toolbar-text-swatch",
@@ -1716,25 +1921,25 @@ function $r({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
1716
1921
  })]
1717
1922
  });
1718
1923
  }
1719
- function ei({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onTooltipChange: i, onClose: a }) {
1720
- let o = xn(t);
1924
+ function gi({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onTooltipChange: i, onClose: a }) {
1925
+ let o = kn(t);
1721
1926
  return /* @__PURE__ */ Z("div", {
1722
1927
  ref: r,
1723
1928
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
1724
1929
  "data-testid": "markweave-floating-toolbar-more-menu",
1725
- children: o.map((t, r) => /* @__PURE__ */ Z(ti, {
1930
+ children: o.map((t, r) => /* @__PURE__ */ Z(_i, {
1726
1931
  action: t,
1727
- active: Tn(e, t.id),
1932
+ active: Nn(e, t.id),
1728
1933
  tooltipActive: n === t.id,
1729
1934
  showDivider: r > 0 && o[r - 1].group !== t.group,
1730
1935
  onTooltipChange: i,
1731
1936
  onRun: () => {
1732
- An(e, t.id), a();
1937
+ Rn(e, t.id), a();
1733
1938
  }
1734
1939
  }, t.id))
1735
1940
  });
1736
1941
  }
1737
- function ti({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipChange: i, onRun: a }) {
1942
+ function _i({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipChange: i, onRun: a }) {
1738
1943
  return /* @__PURE__ */ Q(X, { children: [r ? /* @__PURE__ */ Z("span", {
1739
1944
  className: "markweave-floating-toolbar-divider",
1740
1945
  "aria-hidden": "true"
@@ -1746,11 +1951,11 @@ function ti({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
1746
1951
  "data-active": t,
1747
1952
  "data-tooltip-active": n ? "true" : "false",
1748
1953
  "data-testid": `markweave-floating-toolbar-more-${e.id}`,
1749
- onMouseDown: On,
1954
+ onMouseDown: In,
1750
1955
  onMouseEnter: () => i(e.id),
1751
1956
  onMouseLeave: () => i(null),
1752
1957
  onClick: a,
1753
- children: /* @__PURE__ */ Z(ni, { id: e.id })
1958
+ children: /* @__PURE__ */ Z(vi, { id: e.id })
1754
1959
  }), n ? /* @__PURE__ */ Z("div", {
1755
1960
  className: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
1756
1961
  role: "tooltip",
@@ -1758,41 +1963,41 @@ function ti({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
1758
1963
  }) : null]
1759
1964
  })] });
1760
1965
  }
1761
- function ni({ id: e }) {
1966
+ function vi({ id: e }) {
1762
1967
  return e === "superscript" ? /* @__PURE__ */ Z($, { name: "superscript" }) : e === "subscript" ? /* @__PURE__ */ Z($, { name: "subscript" }) : e === "inline-math" ? /* @__PURE__ */ Z($, { name: "math" }) : Z($, { name: e });
1763
1968
  }
1764
- var ri = {
1765
- sparkles: ie,
1766
- "chevron-down": h,
1767
- "chevron-up": g,
1768
- "corner-down-left": y,
1769
- "external-link": x,
1770
- bold: u,
1771
- italic: A,
1772
- underline: fe,
1773
- strike: ae,
1774
- "inline-code": v,
1775
- link: M,
1776
- more: I,
1777
- text: de,
1778
- "bullet-list": N,
1779
- "numbered-list": F,
1780
- "todo-list": P,
1781
- quote: ne,
1782
- "code-block": d,
1783
- superscript: se,
1784
- subscript: oe,
1785
- math: z,
1786
- "align-left": c,
1787
- "align-center": o,
1788
- "align-right": l,
1789
- "align-justify": s,
1790
- "decrease-indent": D,
1791
- "increase-indent": O,
1792
- trash: ue
1969
+ var yi = {
1970
+ sparkles: le,
1971
+ "chevron-down": v,
1972
+ "chevron-up": y,
1973
+ "corner-down-left": C,
1974
+ "external-link": T,
1975
+ bold: p,
1976
+ italic: P,
1977
+ underline: _e,
1978
+ strike: ue,
1979
+ "inline-code": x,
1980
+ link: F,
1981
+ more: R,
1982
+ text: ge,
1983
+ "bullet-list": I,
1984
+ "numbered-list": L,
1985
+ "todo-list": ne,
1986
+ quote: ae,
1987
+ "code-block": m,
1988
+ superscript: fe,
1989
+ subscript: de,
1990
+ math: se,
1991
+ "align-left": d,
1992
+ "align-center": l,
1993
+ "align-right": f,
1994
+ "align-justify": u,
1995
+ "decrease-indent": M,
1996
+ "increase-indent": ee,
1997
+ trash: he
1793
1998
  };
1794
1999
  function $({ name: e }) {
1795
- let t = ri[e];
2000
+ let t = yi[e];
1796
2001
  return /* @__PURE__ */ Z(t, {
1797
2002
  "aria-hidden": "true",
1798
2003
  absoluteStrokeWidth: !0,
@@ -1802,24 +2007,24 @@ function $({ name: e }) {
1802
2007
  }
1803
2008
  //#endregion
1804
2009
  //#region src/ui/math/MathEditorPopover.tsx
1805
- function ii({ editor: e, messages: t, onClose: n, target: r }) {
1806
- let i = W(null), a = W(null), [o, s] = G(r.latex), [c, l] = G(null), u = t.math, d = U(() => yt(e, r) ?? 1, [e, r]), f = U(() => bt(e, r), [e, r]), m = U(() => o === r.latex && f ? {
2010
+ function bi({ editor: e, messages: t, onClose: n, target: r }) {
2011
+ let i = U(null), a = U(null), [o, s] = W(r.latex), [c, l] = W(null), u = t.math, d = H(() => Dt(e, r) ?? 1, [e, r]), f = H(() => Ot(e, r), [e, r]), p = H(() => o === r.latex && f ? {
1807
2012
  html: f,
1808
2013
  error: !1
1809
- } : wt(o, r.kind, e), [
2014
+ } : Mt(o, r.kind, e), [
1810
2015
  e,
1811
2016
  f,
1812
2017
  r.kind,
1813
2018
  r.latex,
1814
2019
  o
1815
- ]), h = o.trim().length > 0, g = V(() => {
2020
+ ]), m = o.trim().length > 0, h = B(() => {
1816
2021
  if (typeof window > "u") return;
1817
- let t = vt(e, r), i = e.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2022
+ let t = Et(e, r), i = e.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
1818
2023
  if (!t || !i) {
1819
2024
  n();
1820
2025
  return;
1821
2026
  }
1822
- l(_t({
2027
+ l(Tt({
1823
2028
  anchorRect: t,
1824
2029
  frameRect: i,
1825
2030
  kind: r.kind,
@@ -1833,50 +2038,50 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1833
2038
  r,
1834
2039
  o
1835
2040
  ]);
1836
- H(() => {
2041
+ V(() => {
1837
2042
  s(r.latex);
1838
- }, [r.latex, r.pos]), H(() => {
1839
- Tt(e, r, !0), g();
2043
+ }, [r.latex, r.pos]), V(() => {
2044
+ Nt(e, r, !0), h();
1840
2045
  let t = window.requestAnimationFrame(() => {
1841
- a.current?.focus({ preventScroll: !0 }), a.current?.select(), g();
2046
+ a.current?.focus({ preventScroll: !0 }), a.current?.select(), h();
1842
2047
  });
1843
- return window.addEventListener("resize", g), window.addEventListener("scroll", g, !0), () => {
1844
- window.cancelAnimationFrame(t), window.removeEventListener("resize", g), window.removeEventListener("scroll", g, !0), Tt(e, r, !1);
2048
+ return window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), () => {
2049
+ window.cancelAnimationFrame(t), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0), Nt(e, r, !1);
1845
2050
  };
1846
2051
  }, [
1847
2052
  e,
1848
2053
  n,
1849
2054
  r,
1850
- g
1851
- ]), H(() => {
2055
+ h
2056
+ ]), V(() => {
1852
2057
  let e = (e) => {
1853
2058
  let t = e.target;
1854
2059
  t instanceof Node && (i.current?.contains(t) || t instanceof Element && t.closest(".tiptap-mathematics-render") || n());
1855
2060
  };
1856
2061
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
1857
2062
  }, [n]);
1858
- let _ = V(() => {
1859
- h && gt(e, r, o) && n();
2063
+ let _ = B(() => {
2064
+ m && wt(e, r, o) && n();
1860
2065
  }, [
1861
- h,
2066
+ m,
1862
2067
  e,
1863
2068
  n,
1864
2069
  r,
1865
2070
  o
1866
- ]), y = (t) => {
2071
+ ]), v = (t) => {
1867
2072
  if (t.key === "Escape") {
1868
2073
  t.preventDefault(), n(), e.commands.focus();
1869
2074
  return;
1870
2075
  }
1871
2076
  t.key === "Enter" && (r.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), _());
1872
- }, b = c ? {
2077
+ }, y = c ? {
1873
2078
  left: c.left,
1874
2079
  top: c.top,
1875
2080
  width: c.width
1876
- } : void 0, x = r.kind === "block" ? u.blockTitle : u.inlineTitle;
2081
+ } : void 0, b = r.kind === "block" ? u.blockTitle : u.inlineTitle;
1877
2082
  return r.kind === "inline" ? /* @__PURE__ */ Q("form", {
1878
2083
  ref: i,
1879
- "aria-label": x,
2084
+ "aria-label": b,
1880
2085
  className: "markweave-math-editor-popover markweave-math-editor-popover--inline",
1881
2086
  "data-kind": "inline",
1882
2087
  "data-placement": c?.placement ?? "bottom",
@@ -1884,7 +2089,7 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1884
2089
  onSubmit: (e) => {
1885
2090
  e.preventDefault(), _();
1886
2091
  },
1887
- style: b,
2092
+ style: y,
1888
2093
  children: [/* @__PURE__ */ Q("label", {
1889
2094
  className: "markweave-math-inline-source",
1890
2095
  "data-testid": "markweave-math-inline-source",
@@ -1898,7 +2103,7 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1898
2103
  "aria-label": u.latexLabel,
1899
2104
  "data-testid": "markweave-math-editor-input",
1900
2105
  onChange: (e) => s(e.currentTarget.value),
1901
- onKeyDown: y,
2106
+ onKeyDown: v,
1902
2107
  placeholder: u.latexPlaceholder,
1903
2108
  size: Math.max(o.length, 1),
1904
2109
  spellCheck: !1,
@@ -1911,13 +2116,13 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1911
2116
  ]
1912
2117
  }), /* @__PURE__ */ Q("div", {
1913
2118
  className: "markweave-math-inline-preview",
1914
- "data-error": m.error ? "true" : "false",
2119
+ "data-error": p.error ? "true" : "false",
1915
2120
  "data-testid": "markweave-math-editor-preview",
1916
- children: [/* @__PURE__ */ Z("div", { dangerouslySetInnerHTML: { __html: m.html || "&nbsp;" } }), m.error ? /* @__PURE__ */ Z("small", { children: u.invalidPreview }) : null]
2121
+ children: [/* @__PURE__ */ Z("div", { dangerouslySetInnerHTML: { __html: p.html || "&nbsp;" } }), p.error ? /* @__PURE__ */ Z("small", { children: u.invalidPreview }) : null]
1917
2122
  })]
1918
2123
  }) : /* @__PURE__ */ Q("form", {
1919
2124
  ref: i,
1920
- "aria-label": x,
2125
+ "aria-label": b,
1921
2126
  className: "markweave-math-editor-popover markweave-math-editor-popover--block",
1922
2127
  "data-kind": r.kind,
1923
2128
  "data-placement": c?.placement ?? "bottom",
@@ -1925,13 +2130,13 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1925
2130
  onSubmit: (e) => {
1926
2131
  e.preventDefault(), _();
1927
2132
  },
1928
- style: b,
2133
+ style: y,
1929
2134
  children: [
1930
2135
  /* @__PURE__ */ Q("div", {
1931
2136
  className: "markweave-math-block-toolbar",
1932
2137
  children: [
1933
2138
  /* @__PURE__ */ Z("span", { children: u.label }),
1934
- /* @__PURE__ */ Z(v, {
2139
+ /* @__PURE__ */ Z(x, {
1935
2140
  "aria-hidden": "true",
1936
2141
  size: 15,
1937
2142
  strokeWidth: 1.75
@@ -1939,10 +2144,10 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1939
2144
  /* @__PURE__ */ Z("button", {
1940
2145
  "aria-label": u.apply,
1941
2146
  "data-testid": "markweave-math-editor-apply",
1942
- disabled: !h,
2147
+ disabled: !m,
1943
2148
  title: u.apply,
1944
2149
  type: "submit",
1945
- children: /* @__PURE__ */ Z(p, {
2150
+ children: /* @__PURE__ */ Z(g, {
1946
2151
  "aria-hidden": "true",
1947
2152
  size: 16,
1948
2153
  strokeWidth: 2
@@ -1963,7 +2168,7 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1963
2168
  "aria-label": u.latexLabel,
1964
2169
  "data-testid": "markweave-math-editor-input",
1965
2170
  onChange: (e) => s(e.currentTarget.value),
1966
- onKeyDown: y,
2171
+ onKeyDown: v,
1967
2172
  placeholder: u.latexPlaceholder,
1968
2173
  rows: 3,
1969
2174
  spellCheck: !1,
@@ -1977,41 +2182,41 @@ function ii({ editor: e, messages: t, onClose: n, target: r }) {
1977
2182
  }),
1978
2183
  /* @__PURE__ */ Q("div", {
1979
2184
  className: "markweave-math-block-preview",
1980
- "data-error": m.error ? "true" : "false",
2185
+ "data-error": p.error ? "true" : "false",
1981
2186
  "data-math-number": String(d),
1982
2187
  "data-testid": "markweave-math-editor-preview",
1983
- children: [/* @__PURE__ */ Z("div", { dangerouslySetInnerHTML: { __html: m.html || "&nbsp;" } }), m.error ? /* @__PURE__ */ Z("small", { children: u.invalidPreview }) : null]
2188
+ children: [/* @__PURE__ */ Z("div", { dangerouslySetInnerHTML: { __html: p.html || "&nbsp;" } }), p.error ? /* @__PURE__ */ Z("small", { children: u.invalidPreview }) : null]
1984
2189
  })
1985
2190
  ]
1986
2191
  });
1987
2192
  }
1988
2193
  //#endregion
1989
2194
  //#region src/ui/slash-command/SlashCommandMenu.tsx
1990
- var ai = Ae("zh"), oi = {
1991
- type: le,
1992
- "heading-1": ee,
1993
- "heading-2": C,
1994
- "heading-3": w,
1995
- "bullet-list": N,
1996
- "ordered-list": F,
1997
- "task-list": P,
1998
- blockquote: ne,
1999
- "code-block": d,
2000
- info: k,
2001
- tip: j,
2002
- warning: a,
2003
- error: _,
2004
- success: m,
2005
- emoji: re,
2006
- math: z,
2007
- table: ce,
2008
- separator: te,
2009
- image: T,
2010
- video: B,
2011
- attachment: L
2195
+ var xi = n("zh"), Si = {
2196
+ type: me,
2197
+ "heading-1": D,
2198
+ "heading-2": O,
2199
+ "heading-3": k,
2200
+ "bullet-list": I,
2201
+ "ordered-list": L,
2202
+ "task-list": ne,
2203
+ blockquote: ae,
2204
+ "code-block": m,
2205
+ info: N,
2206
+ tip: te,
2207
+ warning: c,
2208
+ error: b,
2209
+ success: _,
2210
+ emoji: ce,
2211
+ math: se,
2212
+ table: pe,
2213
+ separator: re,
2214
+ image: A,
2215
+ video: ye,
2216
+ attachment: z
2012
2217
  };
2013
- function si({ name: e }) {
2014
- let t = oi[e];
2218
+ function Ci({ name: e }) {
2219
+ let t = Si[e];
2015
2220
  return /* @__PURE__ */ Z(t, {
2016
2221
  "aria-hidden": "true",
2017
2222
  absoluteStrokeWidth: !0,
@@ -2019,8 +2224,8 @@ function si({ name: e }) {
2019
2224
  strokeWidth: 1.6
2020
2225
  });
2021
2226
  }
2022
- function ci(e, t, n) {
2023
- return !jt(e) || !n ? {
2227
+ function wi(e, t, n) {
2228
+ return !zt(e) || !n ? {
2024
2229
  visible: !1,
2025
2230
  empty: !1,
2026
2231
  activeIndex: -1
@@ -2034,17 +2239,17 @@ function ci(e, t, n) {
2034
2239
  activeIndex: Math.min(t.length - 1, Math.max(0, e.activeIndex))
2035
2240
  };
2036
2241
  }
2037
- function li(e, t) {
2242
+ function Ti(e, t) {
2038
2243
  return Object.values(t.slash.groups).map((t) => ({
2039
2244
  group: t,
2040
2245
  commands: e.filter((e) => e.group === t)
2041
2246
  })).filter((e) => e.commands.length > 0);
2042
2247
  }
2043
- function ui(e, t) {
2248
+ function Ei(e, t) {
2044
2249
  return t.slash.uploadKindLabels[e] ?? t.slash.uploadKindLabels.upload;
2045
2250
  }
2046
- function di({ command: e, messages: t, onBack: n, onSelect: r }) {
2047
- let [i, a] = G(""), [o, s] = G(0), c = U(() => {
2251
+ function Di({ command: e, messages: t, onBack: n, onSelect: r }) {
2252
+ let [i, a] = W(""), [o, s] = W(0), c = H(() => {
2048
2253
  let e = i.trim().toLowerCase();
2049
2254
  return (e ? t.slash.emojiItems.filter((t) => [
2050
2255
  t.emoji,
@@ -2110,9 +2315,9 @@ function di({ command: e, messages: t, onBack: n, onSelect: r }) {
2110
2315
  ]
2111
2316
  });
2112
2317
  }
2113
- function fi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2114
- let a = e.uploadKind ?? "attachment", [o, s] = G(""), [c, l] = G(null), [u, d] = G(null), [f, p] = G(!1), m = async (t) => {
2115
- r(e, { uploadResult: await ve({
2318
+ function Oi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2319
+ let a = e.uploadKind ?? "attachment", [o, s] = W(""), [c, l] = W(null), [u, d] = W(null), [f, p] = W(!1), m = async (t) => {
2320
+ r(e, { uploadResult: await Ce({
2116
2321
  kind: a,
2117
2322
  source: t,
2118
2323
  trigger: "slash-command"
@@ -2132,7 +2337,7 @@ function fi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2132
2337
  d(t.slash.uploadRequiredError);
2133
2338
  return;
2134
2339
  }
2135
- await m(ge(o));
2340
+ await m(xe(o));
2136
2341
  } catch (e) {
2137
2342
  d(e instanceof Error ? e.message : t.slash.uploadFailedError);
2138
2343
  } finally {
@@ -2150,7 +2355,7 @@ function fi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2150
2355
  onMouseDown: (e) => e.preventDefault(),
2151
2356
  onClick: n,
2152
2357
  children: t.common.back
2153
- }), /* @__PURE__ */ Z("span", { children: ui(a, t) })]
2358
+ }), /* @__PURE__ */ Z("span", { children: Ei(a, t) })]
2154
2359
  }),
2155
2360
  /* @__PURE__ */ Q("label", {
2156
2361
  className: "markweave-slash-upload-field",
@@ -2198,10 +2403,10 @@ function fi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2198
2403
  ]
2199
2404
  });
2200
2405
  }
2201
- function pi({ commands: e, messages: t = ai, state: n, position: r, inputCommand: i, onActiveIndexChange: a, onInputCommandChange: o, onSelect: s, onUpload: c }) {
2202
- let l = ci(n, e, r);
2406
+ function ki({ commands: e, messages: t = xi, state: n, position: r, inputCommand: i, onActiveIndexChange: a, onInputCommandChange: o, onSelect: s, onUpload: c }) {
2407
+ let l = wi(n, e, r);
2203
2408
  if (!l.visible || !r) return null;
2204
- let u = li(e, t), d = {
2409
+ let u = Ti(e, t), d = {
2205
2410
  left: r.left,
2206
2411
  top: r.top,
2207
2412
  maxHeight: r.maxHeight,
@@ -2223,12 +2428,12 @@ function pi({ commands: e, messages: t = ai, state: n, position: r, inputCommand
2223
2428
  "aria-label": t.slash.ariaLabel,
2224
2429
  "data-placement": r.placement,
2225
2430
  "data-testid": "markweave-slash-menu",
2226
- children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(di, {
2431
+ children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(Di, {
2227
2432
  command: i,
2228
2433
  messages: t,
2229
2434
  onBack: m,
2230
2435
  onSelect: s
2231
- }) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(fi, {
2436
+ }) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(Oi, {
2232
2437
  command: i,
2233
2438
  messages: t,
2234
2439
  onBack: m,
@@ -2248,7 +2453,7 @@ function pi({ commands: e, messages: t = ai, state: n, position: r, inputCommand
2248
2453
  className: "markweave-slash-group-title",
2249
2454
  children: t.group
2250
2455
  }), t.commands.map((t) => {
2251
- let n = e.indexOf(t), r = n === l.activeIndex, i = kt(t), o = !!t.disabled;
2456
+ let n = e.indexOf(t), r = n === l.activeIndex, i = Lt(t), o = !!t.disabled;
2252
2457
  return /* @__PURE__ */ Q("button", {
2253
2458
  type: "button",
2254
2459
  role: "option",
@@ -2272,7 +2477,7 @@ function pi({ commands: e, messages: t = ai, state: n, position: r, inputCommand
2272
2477
  }
2273
2478
  },
2274
2479
  children: [
2275
- /* @__PURE__ */ Z(si, { name: t.icon }),
2480
+ /* @__PURE__ */ Z(Ci, { name: t.icon }),
2276
2481
  /* @__PURE__ */ Z("span", { children: t.label }),
2277
2482
  o && t.disabledReason ? /* @__PURE__ */ Z("small", { children: t.disabledReason }) : null
2278
2483
  ]
@@ -2284,38 +2489,38 @@ function pi({ commands: e, messages: t = ai, state: n, position: r, inputCommand
2284
2489
  }
2285
2490
  //#endregion
2286
2491
  //#region src/ui/table/TableControls.tsx
2287
- var mi = Ae("zh");
2288
- function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi, onCopyPayload: i, onCommandResult: a, onEditWithAi: o }) {
2289
- let [s, c] = G(null), [l, u] = G("row-edge"), [d, f] = G(null), [p, m] = G(null), [h, g] = G(null), [_, v] = G(null), [y, b] = G(null), x = W(null), S = W(null), ee = W(null), C = W(null), w = W(null), T = e ? Bt(t.state) : null;
2290
- if (H(() => {
2492
+ var Ai = n("zh");
2493
+ function ji({ active: e, editor: t, interactionState: n = Xt, messages: r = Ai, onCopyPayload: i, onCommandResult: a, onEditWithAi: o }) {
2494
+ let [s, c] = W(null), [l, u] = W("row-edge"), [d, f] = W(null), [p, m] = W(null), [h, g] = W(null), [_, v] = W(null), [y, b] = W(null), x = U(null), S = U(null), C = U(null), w = U(null), T = U(null), E = e ? Jt(t.state) : null;
2495
+ if (V(() => {
2291
2496
  if (!y) return;
2292
2497
  let e = window.setTimeout(() => {
2293
2498
  b(null);
2294
- }, Qn);
2499
+ }, or);
2295
2500
  return () => {
2296
2501
  window.clearTimeout(e);
2297
2502
  };
2298
- }, [y]), me(() => {
2503
+ }, [y]), be(() => {
2299
2504
  if (!e) {
2300
2505
  m(null), g(null), v(null), b(null);
2301
2506
  return;
2302
2507
  }
2303
2508
  let r = () => {
2304
- let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = Wn(t, n, "row", T?.activeCellPos ?? null), i = Wn(t, n, "column", T?.activeCellPos ?? null), a = r ? Un(t, r) : null, o = i ? Un(t, i) : null, c = Hn(t).length > 0 ? Yn(t) : null;
2509
+ let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = Qn(t, n, "row", E?.activeCellPos ?? null), i = Qn(t, n, "column", E?.activeCellPos ?? null), a = r ? Zn(t, r) : null, o = i ? Zn(t, i) : null, c = Xn(t).length > 0 ? rr(t) : null;
2305
2510
  if (!e) {
2306
2511
  m(null), g(null), v(null);
2307
2512
  return;
2308
2513
  }
2309
2514
  let u = e.getBoundingClientRect();
2310
- a ? m(Ln({
2515
+ a ? m(Gn({
2311
2516
  targetRect: a,
2312
2517
  frameRect: u,
2313
2518
  kind: "row"
2314
- })) : s === "row" && l === "row-edge" || m(null), o ? g(Ln({
2519
+ })) : s === "row" && l === "row-edge" || m(null), o ? g(Gn({
2315
2520
  targetRect: o,
2316
2521
  frameRect: u,
2317
2522
  kind: "column"
2318
- })) : s === "column" && l === "column-edge" || g(null), c ? v(Ln({
2523
+ })) : s === "column" && l === "column-edge" || g(null), c ? v(Gn({
2319
2524
  targetRect: c,
2320
2525
  frameRect: u,
2321
2526
  kind: "selection"
@@ -2327,31 +2532,31 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2327
2532
  }, [
2328
2533
  e,
2329
2534
  t,
2330
- T?.activeCellPos,
2331
- T?.selectionFrom,
2332
- T?.selectionTo,
2535
+ E?.activeCellPos,
2536
+ E?.selectionFrom,
2537
+ E?.selectionTo,
2333
2538
  n.hoverCellPos,
2334
2539
  n.hoverVisualColumnIndex,
2335
2540
  n.hoverVisualRowIndex,
2336
2541
  l,
2337
2542
  s
2338
- ]), me(() => {
2543
+ ]), be(() => {
2339
2544
  if (!e || !s) {
2340
2545
  f(null);
2341
2546
  return;
2342
2547
  }
2343
2548
  let n = () => {
2344
- let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = l === "row-edge" ? ee.current : l === "column-edge" ? C.current : w.current, r = S.current;
2549
+ let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = l === "row-edge" ? C.current : l === "column-edge" ? w.current : T.current, r = S.current;
2345
2550
  if (!e || !n || !r) {
2346
2551
  f(null);
2347
2552
  return;
2348
2553
  }
2349
- let i = n.getBoundingClientRect(), a = s === "row" ? Vn(t)?.getBoundingClientRect() : null, o = a ? {
2554
+ let i = n.getBoundingClientRect(), a = s === "row" ? Yn(t)?.getBoundingClientRect() : null, o = a ? {
2350
2555
  left: i.left,
2351
2556
  top: a.top,
2352
2557
  width: i.width,
2353
2558
  height: i.height
2354
- } : i, c = e.getBoundingClientRect(), u = r.getBoundingClientRect(), d = In({
2559
+ } : i, c = e.getBoundingClientRect(), u = r.getBoundingClientRect(), d = Wn({
2355
2560
  anchorRect: o,
2356
2561
  frameRect: c,
2357
2562
  menuSize: {
@@ -2373,7 +2578,7 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2373
2578
  p,
2374
2579
  h,
2375
2580
  _
2376
- ]), H(() => {
2581
+ ]), V(() => {
2377
2582
  if (!e || !s) return;
2378
2583
  let n = (e) => {
2379
2584
  e.key === "Escape" && (c(null), t.view.focus());
@@ -2388,26 +2593,26 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2388
2593
  t,
2389
2594
  s
2390
2595
  ]), !e) return null;
2391
- let E = (e, t) => {
2596
+ let D = (e, t) => {
2392
2597
  let n = s === e && l === t;
2393
2598
  u(t), c(n ? null : e);
2394
- }, D = () => {
2395
- t.view.dispatch(Fn(t.state.tr, null));
2396
- }, O = (e, r) => {
2397
- let i = n.hoverCellPos ?? T?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
2398
- i !== null && Zn(t, i, e, { visualIndex: a }), E(e, r);
2399
- }, k = () => {
2400
- D(), E("selection", "selection-edge");
2401
- }, A = Wn(t, n, "row", T?.activeCellPos ?? null), j = Wn(t, n, "column", T?.activeCellPos ?? null), M = Hn(t).length > 0, N = s ? Jn(t, s) : [], P = async (e, n) => {
2402
- let o = await zn({
2599
+ }, O = () => {
2600
+ t.view.dispatch(Un(t.state.tr, null));
2601
+ }, k = (e, r) => {
2602
+ let i = n.hoverCellPos ?? E?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
2603
+ i !== null && ar(t, i, e, { visualIndex: a }), D(e, r);
2604
+ }, A = () => {
2605
+ O(), D("selection", "selection-edge");
2606
+ }, j = Qn(t, n, "row", E?.activeCellPos ?? null), M = Qn(t, n, "column", E?.activeCellPos ?? null), ee = Xn(t).length > 0, N = s ? nr(t, s) : [], P = async (e, n) => {
2607
+ let o = await qn({
2403
2608
  editor: t,
2404
2609
  commandId: e,
2405
2610
  menu: n ?? s ?? "selection",
2406
2611
  messages: r
2407
2612
  });
2408
2613
  return o.copyFeedback ? (b(o.copyFeedback), o.copyPayload && i?.(o.copyPayload)) : b(null), a?.(o.commandResult), o.success;
2409
- }, F = (e) => {
2410
- let n = Gn(t, e);
2614
+ }, te = (e) => {
2615
+ let n = $n(t, e);
2411
2616
  n && o?.(n), c(null), t.view.focus();
2412
2617
  };
2413
2618
  return /* @__PURE__ */ Q("div", {
@@ -2426,28 +2631,28 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2426
2631
  "data-copy-kind": y.kind,
2427
2632
  "data-text-length": y.textLength,
2428
2633
  "data-html-length": y.htmlLength,
2429
- children: Bn(y)
2634
+ children: Jn(y)
2430
2635
  }) : null,
2431
2636
  p ? /* @__PURE__ */ Z("button", {
2432
2637
  type: "button",
2433
- ref: ee,
2638
+ ref: C,
2434
2639
  className: "markweave-table-edge-handle markweave-table-edge-handle--row",
2435
2640
  "aria-label": r.table.activeRowActions,
2436
2641
  "aria-expanded": s === "row" && l === "row-edge",
2437
2642
  "aria-haspopup": "menu",
2438
2643
  title: r.table.rowActions,
2439
2644
  "data-testid": "markweave-table-hover-row-handle",
2440
- "data-axis-index": A?.index ?? "",
2441
- "data-axis-selected-cells": A?.selectedCellCount ?? "",
2442
- "data-axis-visual-cells": A?.visualCellCount ?? "",
2443
- "data-axis-visual-size": A?.visualHeight ?? "",
2645
+ "data-axis-index": j?.index ?? "",
2646
+ "data-axis-selected-cells": j?.selectedCellCount ?? "",
2647
+ "data-axis-visual-cells": j?.visualCellCount ?? "",
2648
+ "data-axis-visual-size": j?.visualHeight ?? "",
2444
2649
  style: {
2445
2650
  left: p.left,
2446
2651
  top: p.top
2447
2652
  },
2448
2653
  onMouseDown: (e) => e.preventDefault(),
2449
2654
  onClick: () => {
2450
- O("row", "row-edge");
2655
+ k("row", "row-edge");
2451
2656
  },
2452
2657
  children: /* @__PURE__ */ Z("span", {
2453
2658
  "aria-hidden": "true",
@@ -2456,33 +2661,33 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2456
2661
  }) : null,
2457
2662
  h ? /* @__PURE__ */ Z("button", {
2458
2663
  type: "button",
2459
- ref: C,
2664
+ ref: w,
2460
2665
  className: "markweave-table-edge-handle markweave-table-edge-handle--column",
2461
2666
  "aria-label": r.table.activeColumnActions,
2462
2667
  "aria-expanded": s === "column" && l === "column-edge",
2463
2668
  "aria-haspopup": "menu",
2464
2669
  title: r.table.columnActions,
2465
2670
  "data-testid": "markweave-table-hover-column-handle",
2466
- "data-axis-index": j?.index ?? "",
2467
- "data-axis-selected-cells": j?.selectedCellCount ?? "",
2468
- "data-axis-visual-cells": j?.visualCellCount ?? "",
2469
- "data-axis-visual-size": j?.visualWidth ?? "",
2671
+ "data-axis-index": M?.index ?? "",
2672
+ "data-axis-selected-cells": M?.selectedCellCount ?? "",
2673
+ "data-axis-visual-cells": M?.visualCellCount ?? "",
2674
+ "data-axis-visual-size": M?.visualWidth ?? "",
2470
2675
  style: {
2471
2676
  left: h.left,
2472
2677
  top: h.top
2473
2678
  },
2474
2679
  onMouseDown: (e) => e.preventDefault(),
2475
2680
  onClick: () => {
2476
- O("column", "column-edge");
2681
+ k("column", "column-edge");
2477
2682
  },
2478
2683
  children: /* @__PURE__ */ Z("span", {
2479
2684
  "aria-hidden": "true",
2480
2685
  children: "..."
2481
2686
  })
2482
2687
  }) : null,
2483
- M && _ ? /* @__PURE__ */ Z("button", {
2688
+ ee && _ ? /* @__PURE__ */ Z("button", {
2484
2689
  type: "button",
2485
- ref: w,
2690
+ ref: T,
2486
2691
  className: "markweave-table-edge-handle markweave-table-edge-handle--selection",
2487
2692
  "aria-label": r.table.selectionActions,
2488
2693
  "aria-expanded": s === "selection" && l === "selection-edge",
@@ -2494,7 +2699,7 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2494
2699
  top: _.top
2495
2700
  },
2496
2701
  onMouseDown: (e) => e.preventDefault(),
2497
- onClick: k,
2702
+ onClick: A,
2498
2703
  children: /* @__PURE__ */ Z("span", {
2499
2704
  "aria-hidden": "true",
2500
2705
  children: "..."
@@ -2504,7 +2709,7 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2504
2709
  ref: S,
2505
2710
  className: "markweave-table-menu",
2506
2711
  role: "menu",
2507
- "aria-label": $n(s, r),
2712
+ "aria-label": sr(s, r),
2508
2713
  "data-testid": "markweave-table-menu",
2509
2714
  "data-positioned": d ? "true" : "false",
2510
2715
  style: d ? {
@@ -2512,7 +2717,7 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2512
2717
  top: d.top
2513
2718
  } : void 0,
2514
2719
  children: N.map((e, n) => {
2515
- let i = Kn(e), a = n === 0 ? i : Kn(N[n - 1]), l = n > 0 && a !== i, u = e.commandId === null ? !!o : Rn(t, e.commandId), d = qn(e, r);
2720
+ let i = er(e), a = n === 0 ? i : er(N[n - 1]), l = n > 0 && a !== i, u = e.commandId === null ? !!o : Kn(t, e.commandId), d = tr(e, r);
2516
2721
  return /* @__PURE__ */ Z("button", {
2517
2722
  type: "button",
2518
2723
  role: "menuitem",
@@ -2527,7 +2732,7 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2527
2732
  onClick: () => {
2528
2733
  if (u) {
2529
2734
  if (e.commandId === null) {
2530
- F(s === "row" || s === "column" ? s : "selection");
2735
+ te(s === "row" || s === "column" ? s : "selection");
2531
2736
  return;
2532
2737
  }
2533
2738
  P(e.commandId).finally(() => c(null));
@@ -2542,15 +2747,15 @@ function hi({ active: e, editor: t, interactionState: n = Ht, messages: r = mi,
2542
2747
  }
2543
2748
  //#endregion
2544
2749
  //#region src/ui/table/TableSelectionOverlay.tsx
2545
- function gi({ editor: e, focusState: t }) {
2546
- let [n, r] = G(null);
2547
- return me(() => {
2750
+ function Mi({ editor: e, focusState: t }) {
2751
+ let [n, r] = W(null);
2752
+ return be(() => {
2548
2753
  if (t.mode !== "cell-selection") {
2549
2754
  r(null);
2550
2755
  return;
2551
2756
  }
2552
2757
  let n = () => {
2553
- r(Xn(e, Vt(e.state)));
2758
+ r(ir(e, Yt(e.state)));
2554
2759
  };
2555
2760
  return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
2556
2761
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
@@ -2585,16 +2790,16 @@ function gi({ editor: e, focusState: t }) {
2585
2790
  }
2586
2791
  //#endregion
2587
2792
  //#region src/ui/toc/MarkweaveInnerToc.tsx
2588
- function _i(e, t) {
2793
+ function Ni(e, t) {
2589
2794
  return `${e.toc.itemAriaLabel}: ${t.text}`;
2590
2795
  }
2591
- function vi({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2592
- let a = W(null);
2593
- if (H(() => {
2594
- if (!(i !== "container" || !a.current)) return or(a.current);
2796
+ function Pi({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2797
+ let a = U(null);
2798
+ if (V(() => {
2799
+ if (!(i !== "container" || !a.current)) return mr(a.current);
2595
2800
  }, [i]), !t.items.length) return null;
2596
2801
  let o = (t) => {
2597
- sr(e, t, {
2802
+ hr(e, t, {
2598
2803
  behavior: "smooth",
2599
2804
  focus: r
2600
2805
  });
@@ -2621,7 +2826,7 @@ function vi({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2621
2826
  "data-level": e.level,
2622
2827
  "data-active": e.active ? "true" : "false",
2623
2828
  "aria-current": e.active ? "location" : void 0,
2624
- "aria-label": _i(n, e),
2829
+ "aria-label": Ni(n, e),
2625
2830
  title: e.text,
2626
2831
  onClick: () => o(e),
2627
2832
  children: e.text
@@ -2632,7 +2837,7 @@ function vi({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2632
2837
  }
2633
2838
  //#endregion
2634
2839
  //#region src/MarkweaveEditor.tsx
2635
- var yi = {
2840
+ var Fi = {
2636
2841
  active: !1,
2637
2842
  mode: "outside",
2638
2843
  activeCellPos: null,
@@ -2640,21 +2845,21 @@ var yi = {
2640
2845
  selectedCellCount: 0,
2641
2846
  selectionFrom: 0,
2642
2847
  selectionTo: 0
2643
- }, bi = {
2848
+ }, Ii = {
2644
2849
  active: !1,
2645
- language: ct.defaultLanguage,
2850
+ language: ht.defaultLanguage,
2646
2851
  mermaidPreviewMode: "code",
2647
2852
  pos: null,
2648
2853
  text: ""
2649
- }, xi = ht({
2854
+ }, Li = Ct({
2650
2855
  active: !1,
2651
2856
  mode: "code",
2652
2857
  source: ""
2653
2858
  });
2654
- function Si(e) {
2655
- return Ut.getState(e.state) ?? Ht;
2859
+ function Ri(e) {
2860
+ return Zt.getState(e.state) ?? Xt;
2656
2861
  }
2657
- function Ci(e) {
2862
+ function zi(e) {
2658
2863
  if (!e || typeof window > "u") return null;
2659
2864
  let t = e.parentElement;
2660
2865
  for (; t;) {
@@ -2664,89 +2869,92 @@ function Ci(e) {
2664
2869
  }
2665
2870
  return null;
2666
2871
  }
2667
- function wi(e) {
2872
+ function Bi(e) {
2668
2873
  return typeof window > "u" || typeof window.requestAnimationFrame != "function" ? globalThis.setTimeout(() => e(0), 0) : window.requestAnimationFrame(e);
2669
2874
  }
2670
- function Ti(e) {
2875
+ function Vi(e) {
2671
2876
  if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
2672
2877
  window.cancelAnimationFrame(e);
2673
2878
  return;
2674
2879
  }
2675
2880
  globalThis.clearTimeout(e);
2676
2881
  }
2677
- function Ei({ ariaLabel: e, autoFocusFirstTableBodyCell: t = !1, autofocus: n = !1, content: r, contentFormat: a, defaultContent: o = "", defaultContentFormat: s, editable: c = !0, innerToc: l = !0, innerTocPlacement: u, lang: d, mode: f = "live", onEditWithAi: p, onExtractToNote: m, onRewriteSelection: h, onRuntimeStateChange: g, onSlashCommandUpload: _, onTableCommandResult: v, onTableCopyPayload: y, onTocChange: b, onUpdate: x } = {}) {
2678
- let S = Pe(f), ee = ar(u), C = S === "live" && c !== !1, w = We(r === void 0 ? s : a), T = W({
2679
- editorMode: S,
2680
- effectiveEditable: C
2882
+ function Hi({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a = !1, content: o, contentFormat: c, defaultContent: l = "", defaultContentFormat: u, editable: d = !0, innerToc: f = !0, innerTocPlacement: p, lang: m, mode: h = "live", theme: g, onEditWithAi: _, onExtractToNote: v, onRewriteSelection: y, onRuntimeStateChange: b, onSlashCommandUpload: x, onTableCommandResult: S, onTableCopyPayload: C, onTocChange: w, onUpdate: T, linkCardResolver: E } = {}) {
2883
+ let D = Ie(h), O = gr(g), k = pr(p), A = D === "live" && d !== !1, j = Ze(o === void 0 ? u : c), M = U({
2884
+ editorMode: D,
2885
+ effectiveEditable: A
2681
2886
  });
2682
- T.current = {
2683
- editorMode: S,
2684
- effectiveEditable: C
2887
+ M.current = {
2888
+ editorMode: D,
2889
+ effectiveEditable: A
2685
2890
  };
2686
- let E = W(null);
2687
- E.current === null && (E.current = je(d));
2688
- let D = E.current, O = U(() => Ae(D), [D]), k = U(() => ke(D), [D]), A = W(_);
2689
- A.current = _;
2690
- let j = U(() => Sr({
2691
- lang: D,
2891
+ let ee = U(null);
2892
+ ee.current === null && (ee.current = r(m));
2893
+ let N = ee.current, P = H(() => n(N), [N]), te = H(() => t(N), [N]), F = U(x);
2894
+ F.current = x;
2895
+ let I = U(E);
2896
+ I.current = E;
2897
+ let ne = H(() => Rr({
2898
+ lang: N,
2692
2899
  onImageUpload: (e) => {
2693
- if (A.current) return A.current(e);
2694
- let t = _e(e);
2900
+ if (F.current) return F.current(e);
2901
+ let t = Se(e);
2695
2902
  if (!t) throw Error("File upload requires an upload handler.");
2696
2903
  return t;
2697
2904
  },
2698
2905
  onVideoUpload: (e) => {
2699
- if (A.current) return A.current(e);
2700
- let t = _e(e);
2906
+ if (F.current) return F.current(e);
2907
+ let t = Se(e);
2701
2908
  if (!t) throw Error("File upload requires an upload handler.");
2702
2909
  return t;
2703
- }
2704
- }), [D]), [M, N] = G(null), [P, F] = G(It), [te, I] = G(null), [L, ne] = G(null), [R, z] = G("code"), [re, ie] = G(null), [ae, oe] = G(Ht), [se, ce] = G(null), [le, ue] = G(0), de = W(!1), fe = W({
2705
- content: r,
2706
- format: w
2707
- }), pe = W(null), B = W(null), me = W({ onUpdate: x }), he = U(() => Ot(P.query, k), [k, P.query]);
2708
- me.current = { onUpdate: x }, fe.current = {
2709
- content: r,
2710
- format: w
2910
+ },
2911
+ linkCardResolver: (e) => I.current?.(e) ?? Promise.resolve(null)
2912
+ }), [N]), [L, re] = W(null), [R, z] = W(Wt), [ie, ae] = W(null), [oe, se] = W(null), [ce, le] = W("code"), [ue, de] = W(null), [fe, pe] = W(Xt), [me, he] = W(null), [ge, _e] = W(0), ve = U(!1), ye = U({
2913
+ content: o,
2914
+ format: j
2915
+ }), be = U(null), G = U(null), xe = U({ onUpdate: T }), Ce = H(() => It(R.query, te), [te, R.query]);
2916
+ xe.current = { onUpdate: T }, ye.current = {
2917
+ content: o,
2918
+ format: j
2711
2919
  };
2712
- let ge = V(() => {
2713
- B.current !== null && (window.clearTimeout(B.current), B.current = null), ue((e) => e + 1);
2714
- }, []), ve = V(() => {
2715
- B.current !== null && window.clearTimeout(B.current), B.current = window.setTimeout(() => {
2716
- B.current = null, ue((e) => e + 1);
2717
- }, tt);
2920
+ let we = B(() => {
2921
+ G.current !== null && (window.clearTimeout(G.current), G.current = null), _e((e) => e + 1);
2922
+ }, []), Te = B(() => {
2923
+ G.current !== null && window.clearTimeout(G.current), G.current = window.setTimeout(() => {
2924
+ G.current = null, _e((e) => e + 1);
2925
+ }, ct);
2718
2926
  }, []);
2719
- H(() => () => {
2720
- B.current !== null && window.clearTimeout(B.current);
2927
+ V(() => () => {
2928
+ G.current !== null && window.clearTimeout(G.current);
2721
2929
  }, []);
2722
- let K = V(() => {
2723
- I(null), ne(null), F(It);
2724
- }, []), ye = V((e) => {
2725
- let t = Ft(e.state);
2930
+ let K = B(() => {
2931
+ ae(null), se(null), z(Wt);
2932
+ }, []), Ee = B((e) => {
2933
+ let t = Ut(e.state);
2726
2934
  if (!t) {
2727
- F((e) => e.name === "idle" ? e : It), I(null), ne(null);
2935
+ z((e) => e.name === "idle" ? e : Wt), ae(null), se(null);
2728
2936
  return;
2729
2937
  }
2730
2938
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2731
- I(Pt(n, {
2939
+ ae(Ht(n, {
2732
2940
  frameRect: i,
2733
2941
  triggerRect: r
2734
- })), F((e) => Nt(e, t));
2735
- }, []), be = V((e) => ye(e.view), [ye]), xe = V((e) => {
2736
- let t = Qe(e);
2737
- N((e) => Je(e, t) ? e : t);
2738
- let n = Ct(e);
2739
- n && (Tt(e, n, !0), ie(n));
2740
- let r = ot(e);
2741
- r.active && r.language === "mermaid" && z(r.mermaidPreviewMode);
2742
- }, []), Se = V((e) => {
2743
- oe(Si(e));
2744
- }, []), q = i({
2745
- extensions: j,
2746
- content: r ?? o,
2747
- contentType: Ve(w),
2748
- editable: C,
2749
- autofocus: n,
2942
+ })), z((e) => Vt(e, t));
2943
+ }, []), De = B((e) => Ee(e.view), [Ee]), Oe = B((e) => {
2944
+ let t = at(e);
2945
+ re((e) => tt(e, t) ? e : t);
2946
+ let n = jt(e);
2947
+ n && (Nt(e, n, !0), de(n));
2948
+ let r = pt(e);
2949
+ r.active && r.language === "mermaid" && le(r.mermaidPreviewMode);
2950
+ }, []), ke = B((e) => {
2951
+ pe(Ri(e));
2952
+ }, []), q = s({
2953
+ extensions: ne,
2954
+ content: o ?? l,
2955
+ contentType: Je(j),
2956
+ editable: A,
2957
+ autofocus: a,
2750
2958
  editorProps: {
2751
2959
  attributes: {
2752
2960
  class: "markweave-editor-surface",
@@ -2756,36 +2964,36 @@ function Ei({ ariaLabel: e, autoFocusFirstTableBodyCell: t = !1, autofocus: n =
2756
2964
  spellcheck: "false",
2757
2965
  translate: "no"
2758
2966
  },
2759
- handleClick: (e, t, n) => T.current.effectiveEditable ? !1 : Ge(n),
2967
+ handleClick: (e, t, n) => M.current.effectiveEditable ? !1 : Qe(n),
2760
2968
  handleDOMEvents: {
2761
- compositionstart: () => T.current.effectiveEditable ? (F((e) => Lt(e, { type: "composition-start" })), I(null), !1) : !1,
2762
- compositionend: (e) => (T.current.effectiveEditable && window.setTimeout(() => ye(e), 0), !1),
2969
+ compositionstart: () => M.current.effectiveEditable ? (z((e) => Gt(e, { type: "composition-start" })), ae(null), !1) : !1,
2970
+ compositionend: (e) => (M.current.effectiveEditable && window.setTimeout(() => Ee(e), 0), !1),
2763
2971
  click: (e, t) => {
2764
- if (T.current.effectiveEditable) {
2765
- let n = St(e, t);
2766
- return n ? (t.preventDefault(), t.stopPropagation(), K(), Et(e, n, !0), Dt(e, n), ie(n), !0) : (ie(null), !1);
2972
+ if (M.current.effectiveEditable) {
2973
+ let n = At(e, t);
2974
+ return n ? (t.preventDefault(), t.stopPropagation(), K(), Pt(e, n, !0), Ft(e, n), de(n), !0) : (de(null), !1);
2767
2975
  }
2768
- return Ge(t);
2976
+ return Qe(t);
2769
2977
  }
2770
2978
  }
2771
2979
  },
2772
2980
  onSelectionUpdate: ({ editor: e }) => {
2773
- xe(e);
2981
+ Oe(e);
2774
2982
  },
2775
2983
  onCreate: ({ editor: e }) => {
2776
- t && T.current.effectiveEditable && zt(e), Se(e), xe(e), ge();
2984
+ i && M.current.effectiveEditable && qt(e), ke(e), Oe(e), we();
2777
2985
  },
2778
2986
  onTransaction: ({ editor: e, transaction: t }) => {
2779
- Se(e), (t.docChanged || ft(t)) && ve(), t.docChanged && ie((t) => {
2987
+ ke(e), (t.docChanged || yt(t)) && Te(), t.docChanged && de((t) => {
2780
2988
  if (!t) return null;
2781
- let n = xt(e, t.pos);
2989
+ let n = kt(e, t.pos);
2782
2990
  return n?.kind === t.kind ? n : null;
2783
2991
  });
2784
2992
  },
2785
2993
  onUpdate: ({ editor: e }) => {
2786
- xe(e), T.current.effectiveEditable && be(e), de.current || me.current.onUpdate?.(Be(e, { onContentRead: (t, n) => {
2787
- let r = fe.current;
2788
- r.content !== void 0 && t === r.format && (pe.current = {
2994
+ Oe(e), M.current.effectiveEditable && De(e), ve.current || xe.current.onUpdate?.(qe(e, { onContentRead: (t, n) => {
2995
+ let r = ye.current;
2996
+ r.content !== void 0 && t === r.format && (be.current = {
2789
2997
  content: n,
2790
2998
  format: t,
2791
2999
  doc: e.state.doc
@@ -2793,308 +3001,312 @@ function Ei({ ariaLabel: e, autoFocusFirstTableBodyCell: t = !1, autofocus: n =
2793
3001
  } }));
2794
3002
  }
2795
3003
  });
2796
- H(() => {
2797
- q && (q.setEditable(C), Fe(q, {
2798
- mode: S,
2799
- editable: C
2800
- }), pt(q, C ? "live" : "view"), ge(), C || K());
3004
+ V(() => {
3005
+ q && (q.setEditable(A), Le(q, {
3006
+ mode: D,
3007
+ editable: A
3008
+ }), xt(q, A ? "live" : "view"), we(), A || K());
2801
3009
  }, [
2802
3010
  K,
2803
3011
  q,
2804
- S,
2805
- C,
2806
- ge
2807
- ]), H(() => {
2808
- let e = We(a);
2809
- if (!(!q || r === void 0)) {
2810
- if (Ue(q, pe.current, r, e)) {
2811
- pe.current = null;
3012
+ D,
3013
+ A,
3014
+ we
3015
+ ]), V(() => {
3016
+ q && bt(q, O);
3017
+ }, [q, O]), V(() => {
3018
+ let e = Ze(c);
3019
+ if (!(!q || o === void 0)) {
3020
+ if (Xe(q, be.current, o, e)) {
3021
+ be.current = null;
2812
3022
  return;
2813
3023
  }
2814
- pe.current = null, !He(q, r, e) && (de.current = !0, q.commands.setContent(r, {
2815
- contentType: Ve(e),
3024
+ be.current = null, !Ye(q, o, e) && (ve.current = !0, q.commands.setContent(o, {
3025
+ contentType: Je(e),
2816
3026
  emitUpdate: !1
2817
- }), de.current = !1, xe(q), C && be(q), Se(q), ge());
3027
+ }), ve.current = !1, Oe(q), A && De(q), ke(q), we());
2818
3028
  }
2819
3029
  }, [
2820
- r,
2821
- a,
2822
- C,
3030
+ o,
3031
+ c,
3032
+ A,
2823
3033
  q,
2824
- ge,
2825
- xe,
2826
- be,
2827
- Se
2828
- ]), H(() => {
2829
- if (!te) return;
3034
+ we,
3035
+ Oe,
3036
+ De,
3037
+ ke
3038
+ ]), V(() => {
3039
+ if (!ie) return;
2830
3040
  let e = (e) => {
2831
3041
  let t = e.target;
2832
3042
  t instanceof Element && (t.closest(".markweave-slash-menu") || t.closest(".markweave-slash-trigger") || K());
2833
3043
  };
2834
3044
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
2835
- }, [K, te]);
2836
- let Ce = U(() => q ? ot(q) : bi, [
3045
+ }, [K, ie]);
3046
+ let Ae = H(() => q ? pt(q) : Ii, [
2837
3047
  q,
2838
- le,
2839
- M
2840
- ]), we = U(() => q ? Bt(q.state) : yi, [
3048
+ ge,
3049
+ L
3050
+ ]), je = H(() => q ? Jt(q.state) : Fi, [
2841
3051
  q,
2842
- le,
2843
- M,
2844
- ae
2845
- ]), Te = M?.currentNode === "codeBlock", Ee = Te && Ce.language === "mermaid", De = U(() => q ? ht({
2846
- active: Ee,
2847
- mode: R,
2848
- source: Ce.text
2849
- }) : xi, [
2850
- Ce.text,
3052
+ ge,
3053
+ L,
3054
+ fe
3055
+ ]), Me = L?.currentNode === "codeBlock", Ne = Me && Ae.language === "mermaid", Pe = H(() => q ? Ct({
3056
+ active: Ne,
3057
+ mode: ce,
3058
+ source: Ae.text
3059
+ }) : Li, [
3060
+ Ae.text,
2851
3061
  q,
2852
- Ee,
2853
- R
2854
- ]), Oe = U(() => q ? Rt(q.state) : null, [q, le]), J = U(() => q ? rr(q.state.doc) : tr.items, [q, le]), Y = U(() => ir(J, se), [se, J]), Me = U(() => er(J, Y), [Y, J]), Ne = V(() => {
2855
- if (!q || !J.length) {
2856
- ce(null);
3062
+ Ne,
3063
+ ce
3064
+ ]), J = H(() => q ? Kt(q.state) : null, [q, ge]), Y = H(() => q ? dr(q.state.doc) : lr.items, [q, ge]), Fe = H(() => fr(Y, me), [me, Y]), Re = H(() => cr(Y, Fe), [Fe, Y]), ze = B(() => {
3065
+ if (!q || !Y.length) {
3066
+ he(null);
2857
3067
  return;
2858
3068
  }
2859
- let e = nr(q, J);
2860
- ce((t) => t === e ? t : e);
2861
- }, [q, J]);
2862
- H(() => {
2863
- ce((e) => {
2864
- let t = ir(J, e);
3069
+ let e = ur(q, Y);
3070
+ he((t) => t === e ? t : e);
3071
+ }, [q, Y]);
3072
+ V(() => {
3073
+ he((e) => {
3074
+ let t = fr(Y, e);
2865
3075
  return e === t ? e : t;
2866
3076
  });
2867
- }, [J]), H(() => {
2868
- if (!q || !J.length || typeof window > "u") return;
3077
+ }, [Y]), V(() => {
3078
+ if (!q || !Y.length || typeof window > "u") return;
2869
3079
  let e = null, t = () => {
2870
- e !== null && Ti(e), e = wi(() => {
2871
- e = null, Ne();
3080
+ e !== null && Vi(e), e = Bi(() => {
3081
+ e = null, ze();
2872
3082
  });
2873
- }, n = Ci(q.view.dom);
3083
+ }, n = zi(q.view.dom);
2874
3084
  return window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), () => {
2875
- window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null && Ti(e);
3085
+ window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null && Vi(e);
2876
3086
  };
2877
3087
  }, [
2878
3088
  q,
2879
- J.length,
2880
- Ne
3089
+ Y.length,
3090
+ ze
2881
3091
  ]);
2882
- let Ie = U(() => Ke({
2883
- revision: le,
2884
- mode: S,
2885
- editable: C,
2886
- toc: Me,
2887
- selection: M,
2888
- slash: P,
2889
- table: we,
2890
- tableInteraction: ae,
2891
- codeBlock: Ce,
2892
- mermaid: De,
2893
- tableDebugSnapshot: Oe
3092
+ let X = H(() => $e({
3093
+ revision: ge,
3094
+ mode: D,
3095
+ editable: A,
3096
+ toc: Re,
3097
+ selection: L,
3098
+ slash: R,
3099
+ table: je,
3100
+ tableInteraction: fe,
3101
+ codeBlock: Ae,
3102
+ mermaid: Pe,
3103
+ tableDebugSnapshot: J
2894
3104
  }), [
2895
- Ce,
2896
- S,
2897
- C,
2898
- De,
2899
- le,
2900
- M,
2901
- P,
2902
- Oe,
2903
- we,
2904
- ae,
2905
- Me
3105
+ Ae,
3106
+ D,
3107
+ A,
3108
+ Pe,
3109
+ ge,
3110
+ L,
3111
+ R,
3112
+ J,
3113
+ je,
3114
+ fe,
3115
+ Re
2906
3116
  ]);
2907
- H(() => {
2908
- g?.(Ie);
2909
- }, [g, Ie]), H(() => {
2910
- b?.(Me);
2911
- }, [b, Me]);
2912
- let Le = V((e, t) => {
2913
- if (!(!q || !C) && kt(e)) {
3117
+ V(() => {
3118
+ b?.(X);
3119
+ }, [b, X]), V(() => {
3120
+ w?.(Re);
3121
+ }, [w, Re]);
3122
+ let Z = B((e, t) => {
3123
+ if (!(!q || !A) && Lt(e)) {
2914
3124
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
2915
- ne(e);
3125
+ se(e);
2916
3126
  return;
2917
3127
  }
2918
- Mt(q, P, e, t), F((e) => Lt(e, { type: "execute" })), K();
3128
+ Bt(q, R, e, t), z((e) => Gt(e, { type: "execute" })), K();
2919
3129
  }
2920
3130
  }, [
2921
3131
  K,
2922
- C,
3132
+ A,
2923
3133
  q,
2924
- P
2925
- ]), X = V((e) => {
2926
- F((t) => Lt(t, {
3134
+ R
3135
+ ]), Q = B((e) => {
3136
+ z((t) => Gt(t, {
2927
3137
  type: "set-active",
2928
3138
  index: e,
2929
- optionCount: he.length
3139
+ optionCount: Ce.length
2930
3140
  }));
2931
- }, [he.length]), Z = V((e) => {
2932
- if (!q || L || !C) return;
2933
- let t = At(P, he, e.key, { isComposing: e.nativeEvent.isComposing || ze(q.state) });
3141
+ }, [Ce.length]), Be = B((e) => {
3142
+ if (!q || oe || !A) return;
3143
+ let t = Rt(R, Ce, e.key, { isComposing: e.nativeEvent.isComposing || Ke(q.state) });
2934
3144
  if (t.type !== "ignore") {
2935
3145
  if (t.type === "close") {
2936
- e.preventDefault(), F((e) => Lt(e, { type: "escape" })), K();
3146
+ e.preventDefault(), z((e) => Gt(e, { type: "escape" })), K();
2937
3147
  return;
2938
3148
  }
2939
3149
  if (t.type === "move-active") {
2940
- e.preventDefault(), F((e) => Lt(e, {
3150
+ e.preventDefault(), z((e) => Gt(e, {
2941
3151
  type: "move-active",
2942
3152
  delta: t.delta,
2943
3153
  optionCount: t.optionCount
2944
3154
  }));
2945
3155
  return;
2946
3156
  }
2947
- t.type === "execute-active" && (e.preventDefault(), Le(t.command));
3157
+ t.type === "execute-active" && (e.preventDefault(), Z(t.command));
2948
3158
  }
2949
3159
  }, [
2950
3160
  K,
2951
- C,
3161
+ A,
2952
3162
  q,
2953
- he,
2954
- Le,
2955
- L,
2956
- P
2957
- ]), Q = U(() => ({
3163
+ Ce,
3164
+ Z,
3165
+ oe,
3166
+ R
3167
+ ]), Ve = H(() => ({
2958
3168
  closeSlashMenu: K,
2959
- focusFirstTableBodyCell: () => q ? zt(q) : !1,
3169
+ focusFirstTableBodyCell: () => q ? qt(q) : !1,
2960
3170
  setContent: (e, t = {}) => {
2961
3171
  if (!q) return !1;
2962
- let n = We(t.format);
3172
+ let n = Ze(t.format);
2963
3173
  return q.commands.setContent(e, {
2964
- contentType: Ve(n),
3174
+ contentType: Je(n),
2965
3175
  emitUpdate: t.emitUpdate ?? !1
2966
- }), t.focusFirstTableBodyCell && zt(q), xe(q), C && be(q), Se(q), ge(), !0;
3176
+ }), t.focusFirstTableBodyCell && qt(q), Oe(q), A && De(q), ke(q), we(), !0;
2967
3177
  }
2968
3178
  }), [
2969
3179
  K,
2970
- C,
3180
+ A,
2971
3181
  q,
2972
- ge,
2973
- xe,
2974
- be,
2975
- Se
3182
+ we,
3183
+ Oe,
3184
+ De,
3185
+ ke
2976
3186
  ]);
2977
3187
  return {
2978
3188
  editor: q,
2979
- frameProps: U(() => ({
3189
+ frameProps: H(() => ({
2980
3190
  className: "markweave-editor-frame",
2981
- "aria-label": e ?? O.common.editorAriaLabel,
3191
+ "aria-label": e ?? P.common.editorAriaLabel,
2982
3192
  "data-testid": "markweave-editor-frame",
2983
- "data-markweave-mode": S,
2984
- "data-markweave-inner-toc": l ? "true" : "false",
2985
- "data-markweave-inner-toc-placement": ee,
2986
- "data-mermaid-mode": De.mode,
2987
- "data-table-focus-mode": we.mode,
2988
- onKeyDownCapture: Z
3193
+ "data-markweave-mode": D,
3194
+ "data-markweave-theme": O,
3195
+ "data-markweave-inner-toc": f ? "true" : "false",
3196
+ "data-markweave-inner-toc-placement": k,
3197
+ "data-mermaid-mode": Pe.mode,
3198
+ "data-table-focus-mode": je.mode,
3199
+ onKeyDownCapture: Be
2989
3200
  }), [
2990
3201
  e,
2991
- S,
2992
- Z,
2993
- l,
2994
- De.mode,
2995
- O.common.editorAriaLabel,
2996
- ee,
2997
- we.mode
3202
+ D,
3203
+ Be,
3204
+ f,
3205
+ Pe.mode,
3206
+ P.common.editorAriaLabel,
3207
+ k,
3208
+ O,
3209
+ je.mode
2998
3210
  ]),
2999
- overlayProps: U(() => ({
3000
- floatingToolbar: q && C ? {
3211
+ overlayProps: H(() => ({
3212
+ floatingToolbar: q && A ? {
3001
3213
  editor: q,
3002
- messages: O,
3003
- selectionSnapshot: M,
3004
- onRewriteSelection: h,
3005
- onExtractToNote: m
3214
+ messages: P,
3215
+ selectionSnapshot: L,
3216
+ onRewriteSelection: y,
3217
+ onExtractToNote: v
3006
3218
  } : null,
3007
- slashCommandMenu: q && C ? {
3008
- commands: he,
3009
- state: P,
3010
- position: te,
3011
- inputCommand: L,
3012
- messages: O,
3013
- onActiveIndexChange: X,
3014
- onInputCommandChange: ne,
3015
- onSelect: Le,
3016
- onUpload: _
3219
+ slashCommandMenu: q && A ? {
3220
+ commands: Ce,
3221
+ state: R,
3222
+ position: ie,
3223
+ inputCommand: oe,
3224
+ messages: P,
3225
+ onActiveIndexChange: Q,
3226
+ onInputCommandChange: se,
3227
+ onSelect: Z,
3228
+ onUpload: x
3017
3229
  } : null,
3018
- tableControls: q && C ? {
3230
+ tableControls: q && A ? {
3019
3231
  editor: q,
3020
- active: we.active,
3021
- interactionState: ae,
3022
- messages: O,
3023
- onCopyPayload: y,
3024
- onCommandResult: v,
3025
- onEditWithAi: p
3232
+ active: je.active,
3233
+ interactionState: fe,
3234
+ messages: P,
3235
+ onCopyPayload: C,
3236
+ onCommandResult: S,
3237
+ onEditWithAi: _
3026
3238
  } : null,
3027
- tableSelectionOverlay: q && C ? {
3239
+ tableSelectionOverlay: q && A ? {
3028
3240
  editor: q,
3029
- focusState: we
3241
+ focusState: je
3030
3242
  } : null,
3031
3243
  codeBlockControls: q ? {
3032
3244
  editor: q,
3033
- active: C && Te,
3034
- mermaidMode: R,
3035
- onMermaidModeChange: z,
3036
- readOnly: !C
3245
+ active: A && Me,
3246
+ mermaidMode: ce,
3247
+ onMermaidModeChange: le,
3248
+ readOnly: !A
3037
3249
  } : null,
3038
- innerToc: q && l && Me.items.length ? {
3250
+ innerToc: q && f && Re.items.length ? {
3039
3251
  editor: q,
3040
- editable: C,
3041
- messages: O,
3042
- placement: ee,
3043
- state: Me
3252
+ editable: A,
3253
+ messages: P,
3254
+ placement: k,
3255
+ state: Re
3044
3256
  } : null,
3045
- mathEditorPopover: q && C && re ? {
3257
+ mathEditorPopover: q && A && ue ? {
3046
3258
  editor: q,
3047
- messages: O,
3048
- target: re,
3049
- onClose: () => ie(null)
3259
+ messages: P,
3260
+ target: ue,
3261
+ onClose: () => de(null)
3050
3262
  } : null
3051
3263
  }), [
3052
- C,
3264
+ A,
3053
3265
  q,
3054
- he,
3055
- l,
3056
- Te,
3057
- R,
3058
- O,
3059
- re,
3060
- p,
3061
- m,
3062
- h,
3266
+ Ce,
3267
+ f,
3268
+ Me,
3269
+ ce,
3270
+ P,
3271
+ ue,
3063
3272
  _,
3064
3273
  v,
3065
3274
  y,
3066
- Le,
3067
- M,
3068
- X,
3275
+ x,
3276
+ S,
3277
+ C,
3278
+ Z,
3069
3279
  L,
3070
- te,
3071
- P,
3072
- we,
3073
- ae,
3074
- Me
3280
+ Q,
3281
+ oe,
3282
+ ie,
3283
+ R,
3284
+ je,
3285
+ fe,
3286
+ Re
3075
3287
  ]),
3076
- runtimeSnapshot: Ie,
3077
- actions: Q
3288
+ runtimeSnapshot: X,
3289
+ actions: Ve
3078
3290
  };
3079
3291
  }
3080
- function Di({ className: e, ...n }) {
3081
- let r = Ei(n);
3082
- if (!r.editor) return null;
3083
- let i = [r.frameProps.className, e].filter(Boolean).join(" ");
3292
+ function Ui({ className: e, ...t }) {
3293
+ let n = Hi(t);
3294
+ if (!n.editor) return null;
3295
+ let r = [n.frameProps.className, e].filter(Boolean).join(" ");
3084
3296
  return /* @__PURE__ */ Q("section", {
3085
- ...r.frameProps,
3086
- className: i,
3297
+ ...n.frameProps,
3298
+ className: r,
3087
3299
  children: [
3088
- r.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(Kr, { ...r.overlayProps.floatingToolbar }) : null,
3089
- r.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(pi, { ...r.overlayProps.slashCommandMenu }) : null,
3090
- r.overlayProps.tableControls ? /* @__PURE__ */ Z(hi, { ...r.overlayProps.tableControls }) : null,
3091
- r.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(gi, { ...r.overlayProps.tableSelectionOverlay }) : null,
3092
- r.overlayProps.codeBlockControls ? /* @__PURE__ */ Z(Tr, { ...r.overlayProps.codeBlockControls }) : null,
3093
- r.overlayProps.innerToc ? /* @__PURE__ */ Z(vi, { ...r.overlayProps.innerToc }) : null,
3094
- r.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(ii, { ...r.overlayProps.mathEditorPopover }) : null,
3095
- /* @__PURE__ */ Z(t, { editor: r.editor })
3300
+ n.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(ci, { ...n.overlayProps.floatingToolbar }) : null,
3301
+ n.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(ki, { ...n.overlayProps.slashCommandMenu }) : null,
3302
+ n.overlayProps.tableControls ? /* @__PURE__ */ Z(ji, { ...n.overlayProps.tableControls }) : null,
3303
+ n.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(Mi, { ...n.overlayProps.tableSelectionOverlay }) : null,
3304
+ n.overlayProps.codeBlockControls ? /* @__PURE__ */ Z(Vr, { ...n.overlayProps.codeBlockControls }) : null,
3305
+ n.overlayProps.innerToc ? /* @__PURE__ */ Z(Pi, { ...n.overlayProps.innerToc }) : null,
3306
+ n.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(bi, { ...n.overlayProps.mathEditorPopover }) : null,
3307
+ /* @__PURE__ */ Z(i, { editor: n.editor })
3096
3308
  ]
3097
3309
  });
3098
3310
  }
3099
3311
  //#endregion
3100
- export { Di as MarkweaveEditor, Sr as createMarkweaveEditorExtensions, Sr as createMarkweaveReactEditorExtensions, Ei as useMarkweaveEditorController };
3312
+ export { Ui as MarkweaveEditor, Rr as createMarkweaveEditorExtensions, Rr as createMarkweaveReactEditorExtensions, Hi as useMarkweaveEditorController };