@markweave/react 0.3.1 → 0.3.3

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,67 +1,67 @@
1
1
  import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
2
2
  import { getLocalizedSlashCommandSpecs as t, getMarkweaveMessages as n, normalizeMarkweaveLang as r } from "markweave/internal/i18n";
3
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 F, Link2 as te, List as I, ListChecks as L, ListOrdered as ne, Minus as re, MoreVertical as R, Paperclip as ie, Pencil as ae, Quote as z, Replace as oe, Sigma as se, SmilePlus as ce, Sparkles as le, Strikethrough as ue, Subscript as de, Superscript as fe, Table2 as B, Text as V, Trash2 as pe, Type as me, Underline as he, Upload as ge, Video as _e } from "lucide-react";
5
- import { useCallback as H, useEffect as U, useLayoutEffect as ve, useMemo as W, useRef as G, useState as K, useSyncExternalStore as ye } from "react";
6
- import { detectUploadSource as be, getDirectUploadResult as xe, resolveMarkweaveUploadResult as Se } from "markweave/internal/plugins/slash-command/upload";
7
- import { MarkweaveCoreImage as Ce, MarkweaveCoreVideo as we, attrsFromMarkweaveImageUploadResult as Te, attrsFromMarkweaveVideoUploadResult as Ee, attrsFromMarkweaveVideoUrl as De, clampMarkweaveImageWidth as Oe, createMarkweaveImageUploadRequest as ke, createMarkweaveVideoUploadRequest as Ae, downloadMarkweaveImage as q, 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 Fe, isMarkweaveEditorLiveEditable as Ie, normalizeMarkweaveEditorMode as Le, setMarkweaveEditorModeState as Re, subscribeToMarkweaveEditorMode as ze } from "markweave/internal/core/editor-mode-state";
9
- import { openMarkweaveImagePreview as Be } from "markweave/internal/plugins/media/image-preview";
10
- import { createMarkweaveLightweightImageNodeViewRenderer as Y } from "markweave/internal/plugins/media/lightweight-image-node-view";
11
- import { resolveMarkweaveMediaSource as Ve } from "markweave/internal/plugins/media/media-source";
12
- import { Fragment as X, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
- import { createMarkweaveAdapterMediaExtensions as He } from "markweave/internal/plugins/media/media-extension-factory";
14
- import { normalizeMarkweaveLinkCardAttrs as Ue, normalizeMarkweaveLinkCardHref as We, replaceMarkweaveLinkCardWithLink as Ge } from "markweave/internal/plugins/link-card/link-card";
15
- import { openMarkweaveLinkCardComposer as Ke } from "markweave/internal/plugins/link-card/link-card-composer";
16
- import { MarkweaveLinkCard as qe } from "markweave/internal/plugins/link-card/link-card-node";
17
- import { isEditorComposing as Je } from "markweave/internal/editor-core/composition-guard";
18
- import { createMarkweaveEditorUpdatePayload as Ye, getMarkweaveContentType as Xe, isEditorContentCurrent as Ze, isMarkweaveControlledContentEchoCurrent as Qe, normalizeMarkweaveContentFormat as $e } from "markweave/internal/editor-core/editor-content";
19
- import { openMarkweaveReadonlyLinkFromEvent as et } from "markweave/internal/editor-core/readonly-link";
20
- import { createMarkweaveEditorRuntimeSnapshot as tt } from "markweave/internal/editor-core/runtime-snapshot";
21
- import { advanceFloatingToolbarMotionState as nt, areEditorSelectionSnapshotsEquivalent as rt, calculateFloatingToolbarFrameShift as it, calculateFloatingToolbarPopoverPlacement as at, calculateFloatingToolbarTopBoundary as ot, createSelectionSnapshot as st, getFloatingToolbarFloatingOptions as ct, getFloatingToolbarState as lt, markweaveRuntimeProjectionDelayMs as ut, shouldShowFloatingToolbar as dt, transitionFloatingToolbarState as ft } from "markweave/internal/editor-core/selection-state";
22
- import { codeBlockCollapsePluginKey as pt, copyActiveCodeBlock as mt, getActiveCodeBlockState as ht, getCodeBlockCopyFeedbackSnapshot as gt, markweaveCodeBlockBehavior as _t, setCodeBlockCollapsedAtPosition as vt, setCodeBlockLanguageAtPosition as yt, setCodeBlockMermaidPreviewModeAtPosition as bt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
23
- import { isMermaidInlinePreviewTransaction as xt, setMarkweaveMermaidTheme as St, setMermaidInlinePreviewEditorMode as Ct, setReadonlyMermaidPreviewMode as wt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
24
- import { getMermaidPreviewState as Tt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
25
- import { applyMarkweaveMathLatex as Et, calculateMarkweaveMathPopoverPosition as Dt, getMarkweaveMathAnchorRect as Ot, getMarkweaveMathBlockIndex as kt, getMarkweaveMathRenderedHtml as At, getMarkweaveMathTargetAtPos as jt, getMarkweaveMathTargetFromDomEvent as Mt, getMarkweaveMathTargetFromSelection as Nt, renderMarkweaveMathPreview as Pt, setMarkweaveMathEditingDomState as Ft, setMarkweaveMathEditingDomStateInView as It, setMarkweaveMathSelectionInView as Lt } from "markweave/internal/plugins/math/math-ui-model";
26
- import { filterSlashCommands as Rt, isExecutableSlashCommand as zt } from "markweave/internal/plugins/slash-command/command-spec";
27
- import { getSlashCommandKeyboardAction as Bt, isSlashCommandMenuState as Vt } from "markweave/internal/plugins/slash-command/slash-keyboard";
28
- import { executeSlashCommand as Ht, getNextSlashCommandState as Ut, getSlashCommandAnchoredMenuPosition as Wt, getSlashCommandContext as Gt } from "markweave/internal/plugins/slash-command/slash-runtime";
29
- import { initialSlashCommandState as Kt, reduceSlashCommandState as qt } from "markweave/internal/plugins/slash-command/slash-state";
30
- import { getFirstTableDebugSnapshot as Jt } from "markweave/internal/plugins/table/table-debug-snapshot";
31
- import { focusFirstTableBodyCell as Yt } from "markweave/internal/plugins/table/table-focus-position";
32
- import { getTableFocusState as Xt } from "markweave/internal/plugins/table/table-focus-state";
33
- import { getTableSelectionOverlayState as Zt, initialTableInteractionState as Qt, tableInteractionPluginKey as $t } from "markweave/internal/plugins/table/table-interaction-layer";
34
- import { saveMarkweaveBrowserFile as en } from "markweave/internal/core/browser-file-save";
35
- import { calculateCodeBlockLanguageMenuPosition as tn, clampFullscreenScale as nn, codeBlockCopyFeedbackTimeoutMs as rn, copyCodeBlockText as an, createCodeBlockLanguageMenuDomId as on, createCodeBlockOverlayPosition as sn, createMermaidFullscreenViewerState as cn, createMermaidTabPosition as ln, focusCodeBlockTarget as un, formatCodeBlockLanguageLabel as dn, formatFullscreenZoom as fn, getActiveCodeBlockElement as pn, getAnchoredRect as mn, getCodeBlockLanguageItems as hn, getCodeBlockLanguageOptionDomId as gn, getCodeBlockPositionFromEventTarget as _n, getCodeBlockStateAtPosition as vn, getFrameElement as yn, getInitialCodeBlockLanguageItemIndex as bn, getMermaidCodeBlockTargets as xn, getMermaidSvgMarkup as Sn, isCodeBlockTargetCollapsed as Cn, mergeStableMermaidTabPositions as wn, mermaidFullscreenZoomStep as Tn, moveCodeBlockLanguageItemIndex as En, moveMermaidFullscreenViewer as Dn, scrollCodeBlockLanguageItemIntoView as On } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
36
- import { BubbleMenu as kn } from "@tiptap/react/menus";
37
- import { createMarkweaveFrameScheduler as An } from "markweave/internal/editor-core/frame-scheduler";
38
- import { applyFloatingToolbarLink as jn, createFloatingToolbarAssistantRequest as Mn, getFloatingToolbarButtonModels as Nn, getFloatingToolbarHighlightColorOptions as Pn, getFloatingToolbarLinkHref as Fn, getFloatingToolbarMessageSet as In, getFloatingToolbarMoreActions as Ln, getFloatingToolbarTextColorOptions as Rn, getFloatingToolbarTooltipModel as zn, getFloatingToolbarTurnIntoOptions as Bn, isFloatingToolbarMoreActionActive as Vn, isFloatingToolbarTurnIntoActive as Hn, openFloatingToolbarLinkHref as Un, preventFloatingToolbarPointerFocusLoss as Wn, removeFloatingToolbarLink as Gn, runFloatingToolbarMoreAction as Kn, setFloatingToolbarHighlightColor as qn, setFloatingToolbarTextColor as Jn, setFloatingToolbarTurnInto as Yn } from "markweave/internal/editor-core/floating-toolbar-model";
39
- import { normalizeMarkdownLinkHref as Xn } from "markweave/internal/plugins/markdown/markdown-input";
40
- import { setMarkweaveTableMenuAxisTarget as Zn } from "markweave/internal/plugins/table/table-clipboard";
41
- import { calculateAnchoredTableMenuPosition as Qn, calculateTableEdgeHandlePosition as $n, canRunTableCommand as er, executeTableMenuCommand as tr, formatTableCopyFeedback as nr, getActiveTableElement as rr, getAvailableCellMenuCommandSpecs as ir, getTableAxisTargetRect as ar, getTableControlAxisSelectionModel as or, getTableEditWithAiRequest as sr, getTableMenuItemGroup as cr, getTableMenuItemLabel as lr, getTableMenuItems as ur, getTableSelectionTargetRect as dr, measureTableSelectionOverlay as fr, selectTableAxisFromCell as pr, tableCopyFeedbackTimeoutMs as mr, tableMenuLabel as hr } from "markweave/internal/plugins/table/table-ui-model";
42
- import { createMarkweaveTocState as gr, emptyMarkweaveTocState as _r, getActiveMarkweaveTocId as vr, getMarkweaveTocItemsFromState as yr, getValidMarkweaveTocActiveId as br, normalizeMarkweaveInnerTocPlacement as xr, observeMarkweaveInnerTocContainerPosition as Sr, scrollToMarkweaveTocItem as Cr } from "markweave/internal/core/toc-state";
43
- import { normalizeMarkweaveCanvasColor as wr, normalizeMarkweaveTheme as Tr } from "markweave/internal/core/theme";
44
- import { splitMarkweaveLargeMarkdown as Er } from "markweave/internal/core/large-document";
45
- import { createMarkweaveSearchController as Dr } from "markweave/internal/plugins/search/search-controller";
4
+ import { AlertTriangle as c, AlignCenter as l, AlignJustify as u, AlignLeft as d, AlignRight as f, AlignVerticalJustifyCenter as p, AlignVerticalJustifyEnd as m, AlignVerticalJustifyStart as h, ArrowDown as g, ArrowDownAZ as _, ArrowLeft as v, ArrowRight as y, ArrowUp as b, ArrowUpZA as x, BetweenHorizontalEnd as S, BetweenHorizontalStart as C, BetweenVerticalEnd as w, BetweenVerticalStart as T, Bold as E, Braces as D, Captions as O, Check as k, CheckCircle2 as A, ChevronDown as j, ChevronRight as M, ChevronUp as N, CircleX as P, Code2 as ee, Copy as F, CornerDownLeft as te, Download as I, ExternalLink as L, Eye as ne, Heading1 as re, Heading2 as R, Heading3 as ie, Image as z, ImageUp as B, IndentDecrease as ae, IndentIncrease as oe, Info as se, Italic as ce, Lightbulb as le, Link2 as V, List as ue, ListChecks as de, ListOrdered as H, Minus as fe, MoreVertical as pe, PaintBucket as me, Paperclip as he, Pencil as ge, Plus as _e, Quote as ve, Replace as ye, Sigma as be, SmilePlus as xe, Sparkles as Se, SquareX as Ce, Strikethrough as we, Subscript as Te, Superscript as Ee, Table2 as De, TableCellsMerge as Oe, TableCellsSplit as ke, Text as Ae, Trash2 as je, Type as Me, Underline as Ne, Upload as Pe, Video as Fe } from "lucide-react";
5
+ import { useCallback as U, useEffect as W, useLayoutEffect as G, useMemo as K, useRef as q, useState as J, useSyncExternalStore as Ie } from "react";
6
+ import { detectUploadSource as Le, getDirectUploadResult as Re, resolveMarkweaveUploadResult as Y } from "markweave/internal/plugins/slash-command/upload";
7
+ import { MarkweaveCoreImage as ze, MarkweaveCoreVideo as Be, attrsFromMarkweaveImageUploadResult as Ve, attrsFromMarkweaveVideoUploadResult as He, attrsFromMarkweaveVideoUrl as Ue, clampMarkweaveImageWidth as We, createMarkweaveImageUploadRequest as Ge, createMarkweaveVideoUploadRequest as Ke, downloadMarkweaveImage as qe, markweaveVideoIframeAllow as Je, normalizeMarkweaveCoreImageAlign as Ye, normalizeMarkweaveVideoEmbedUrl as Xe, numberAttribute as Ze, stringAttribute as X } from "markweave/internal/plugins/media/core-media-nodes";
8
+ import { getMarkweaveEditorModeState as Qe, isMarkweaveEditorLiveEditable as $e, normalizeMarkweaveEditorMode as et, setMarkweaveEditorModeState as tt, subscribeToMarkweaveEditorMode as nt } from "markweave/internal/core/editor-mode-state";
9
+ import { openMarkweaveImagePreview as rt } from "markweave/internal/plugins/media/image-preview";
10
+ import { createMarkweaveLightweightImageNodeViewRenderer as it } from "markweave/internal/plugins/media/lightweight-image-node-view";
11
+ import { resolveMarkweaveMediaSource as at } from "markweave/internal/plugins/media/media-source";
12
+ import { Fragment as ot, jsx as Z, jsxs as Q } from "react/jsx-runtime";
13
+ import { createMarkweaveAdapterMediaExtensions as st } from "markweave/internal/plugins/media/media-extension-factory";
14
+ import { normalizeMarkweaveLinkCardAttrs as ct, normalizeMarkweaveLinkCardHref as lt, replaceMarkweaveLinkCardWithLink as ut } from "markweave/internal/plugins/link-card/link-card";
15
+ import { openMarkweaveLinkCardComposer as dt } from "markweave/internal/plugins/link-card/link-card-composer";
16
+ import { MarkweaveLinkCard as ft } from "markweave/internal/plugins/link-card/link-card-node";
17
+ import { isEditorComposing as pt } from "markweave/internal/editor-core/composition-guard";
18
+ import { createMarkweaveFrameScheduler as mt } from "markweave/internal/editor-core/frame-scheduler";
19
+ import { createMarkweaveEditorUpdatePayload as ht, getMarkweaveContentType as gt, isEditorContentCurrent as _t, isMarkweaveControlledContentEchoCurrent as vt, normalizeMarkweaveContentFormat as yt } from "markweave/internal/editor-core/editor-content";
20
+ import { openMarkweaveReadonlyLinkFromEvent as bt } from "markweave/internal/editor-core/readonly-link";
21
+ import { createMarkweaveEditorRuntimeSnapshot as xt } from "markweave/internal/editor-core/runtime-snapshot";
22
+ import { advanceFloatingToolbarMotionState as St, areEditorSelectionSnapshotsEquivalent as Ct, calculateFloatingToolbarFrameShift as wt, calculateFloatingToolbarPopoverPlacement as Tt, calculateFloatingToolbarTopBoundary as Et, createSelectionSnapshot as Dt, getFloatingToolbarFloatingOptions as Ot, getFloatingToolbarState as kt, markweaveRuntimeProjectionDelayMs as At, shouldShowFloatingToolbar as jt, transitionFloatingToolbarState as Mt } from "markweave/internal/editor-core/selection-state";
23
+ import { codeBlockCollapsePluginKey as Nt, copyActiveCodeBlock as Pt, getActiveCodeBlockState as Ft, getCodeBlockCopyFeedbackSnapshot as It, markweaveCodeBlockBehavior as Lt, setCodeBlockCollapsedAtPosition as Rt, setCodeBlockLanguageAtPosition as zt, setCodeBlockMermaidPreviewModeAtPosition as Bt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
24
+ import { isMermaidInlinePreviewTransaction as Vt, setMarkweaveMermaidTheme as Ht, setMermaidInlinePreviewEditorMode as Ut, setReadonlyMermaidPreviewMode as Wt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
25
+ import { getMermaidPreviewState as Gt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
26
+ import { applyMarkweaveMathLatex as Kt, calculateMarkweaveMathPopoverPosition as qt, getMarkweaveMathAnchorRect as Jt, getMarkweaveMathBlockIndex as Yt, getMarkweaveMathRenderedHtml as Xt, getMarkweaveMathTargetAtPos as Zt, getMarkweaveMathTargetFromDomEvent as Qt, getMarkweaveMathTargetFromSelection as $t, renderMarkweaveMathPreview as en, setMarkweaveMathEditingDomState as tn, setMarkweaveMathEditingDomStateInView as nn, setMarkweaveMathSelectionInView as rn } from "markweave/internal/plugins/math/math-ui-model";
27
+ import { filterSlashCommands as an, isExecutableSlashCommand as on } from "markweave/internal/plugins/slash-command/command-spec";
28
+ import { getSlashCommandKeyboardAction as sn, isSlashCommandMenuState as cn } from "markweave/internal/plugins/slash-command/slash-keyboard";
29
+ import { areSlashCommandMenuPositionsEquivalent as ln, executeSlashCommand as un, getNextSlashCommandState as dn, getSlashCommandAnchoredMenuPosition as fn, getSlashCommandContext as pn, isSlashCommandAnchorVisible as mn } from "markweave/internal/plugins/slash-command/slash-runtime";
30
+ import { initialSlashCommandState as hn, reduceSlashCommandState as gn } from "markweave/internal/plugins/slash-command/slash-state";
31
+ import { getFirstTableDebugSnapshot as _n } from "markweave/internal/plugins/table/table-debug-snapshot";
32
+ import { focusFirstTableBodyCell as vn } from "markweave/internal/plugins/table/table-focus-position";
33
+ import { getTableFocusState as yn } from "markweave/internal/plugins/table/table-focus-state";
34
+ import { getTableSelectionOverlayState as bn, initialTableInteractionState as xn, tableInteractionPluginKey as Sn } from "markweave/internal/plugins/table/table-interaction-layer";
35
+ import { saveMarkweaveBrowserFile as Cn } from "markweave/internal/core/browser-file-save";
36
+ import { calculateCodeBlockLanguageMenuPosition as wn, clampFullscreenScale as Tn, codeBlockCopyFeedbackTimeoutMs as En, copyCodeBlockText as Dn, createCodeBlockLanguageMenuDomId as On, createCodeBlockOverlayPosition as kn, createMermaidFullscreenViewerState as An, createMermaidTabPosition as jn, focusCodeBlockTarget as Mn, formatCodeBlockLanguageLabel as Nn, formatFullscreenZoom as Pn, getActiveCodeBlockElement as Fn, getAnchoredRect as In, getCodeBlockLanguageItems as Ln, getCodeBlockLanguageOptionDomId as Rn, getCodeBlockPositionFromEventTarget as zn, getCodeBlockStateAtPosition as Bn, getFrameElement as Vn, getInitialCodeBlockLanguageItemIndex as Hn, getMermaidCodeBlockTargets as Un, getMermaidSvgMarkup as Wn, isCodeBlockTargetCollapsed as Gn, mergeStableMermaidTabPositions as Kn, mermaidFullscreenZoomStep as qn, moveCodeBlockLanguageItemIndex as Jn, moveMermaidFullscreenViewer as Yn, scrollCodeBlockLanguageItemIntoView as Xn } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
37
+ import { BubbleMenu as Zn } from "@tiptap/react/menus";
38
+ import { applyFloatingToolbarLink as Qn, createFloatingToolbarAssistantRequest as $n, getFloatingToolbarButtonModels as er, getFloatingToolbarHighlightColorOptions as tr, getFloatingToolbarLinkHref as nr, getFloatingToolbarMessageSet as rr, getFloatingToolbarMoreActions as ir, getFloatingToolbarTextColorOptions as ar, getFloatingToolbarTooltipModel as or, getFloatingToolbarTurnIntoOptions as sr, isFloatingToolbarMoreActionActive as cr, isFloatingToolbarTurnIntoActive as lr, openFloatingToolbarLinkHref as ur, preventFloatingToolbarPointerFocusLoss as dr, removeFloatingToolbarLink as fr, runFloatingToolbarMoreAction as pr, setFloatingToolbarHighlightColor as mr, setFloatingToolbarTextColor as hr, setFloatingToolbarTurnInto as gr } from "markweave/internal/editor-core/floating-toolbar-model";
39
+ import { normalizeMarkdownLinkHref as _r } from "markweave/internal/plugins/markdown/markdown-input";
40
+ import { setMarkweaveTableMenuAxisTarget as vr } from "markweave/internal/plugins/table/table-clipboard";
41
+ import { applyTableAxisAlignment as yr, applyTableAxisBackgroundColor as br, applyTableAxisTextColor as xr, calculateAnchoredTableMenuPosition as Sr, calculateTableAxisHandleLayout as Cr, calculateTableExtendButtonLayout as wr, canRunTableCommand as Tr, executeTableMenuCommand as Er, formatTableCopyFeedback as Dr, getActiveTableElement as Or, getTableAxisDropIndexAtPoint as kr, getTableAxisFormattingState as Ar, getTableAxisTargetRect as jr, getTableControlAxisSelectionModel as Mr, getTableEditWithAiRequest as Nr, getTableMenuItemGroup as Pr, getTableMenuItemLabel as Fr, getTableMenuItems as Ir, getTableSelectionTargetRect as Lr, measureTableSelectionOverlay as Rr, moveTargetedTableAxis as zr, selectTableAxisFromCell as Br, tableColorOptions as Vr, tableCopyFeedbackTimeoutMs as Hr, tableHorizontalAlignmentOptions as Ur, tableMenuLabel as Wr, tableVerticalAlignmentOptions as Gr, targetTableAxisFromCell as Kr } from "markweave/internal/plugins/table/table-ui-model";
42
+ import { createMarkweaveTocState as qr, emptyMarkweaveTocState as Jr, getActiveMarkweaveTocId as Yr, getMarkweaveTocItemsFromState as Xr, getValidMarkweaveTocActiveId as Zr, normalizeMarkweaveInnerTocPlacement as Qr, observeMarkweaveInnerTocContainerPosition as $r, scrollToMarkweaveTocItem as ei } from "markweave/internal/core/toc-state";
43
+ import { normalizeMarkweaveCanvasColor as ti, normalizeMarkweaveTheme as ni } from "markweave/internal/core/theme";
44
+ import { splitMarkweaveLargeMarkdown as ri } from "markweave/internal/core/large-document";
45
+ import { createMarkweaveSearchController as ii } from "markweave/internal/plugins/search/search-controller";
46
46
  //#region src/editor-mode-state.ts
47
- var Or = {
47
+ var ai = {
48
48
  mode: "live",
49
49
  editable: !0
50
50
  };
51
- function kr(e) {
52
- return ye((t) => ze(e, t), () => Fe(e), () => Or);
51
+ function oi(e) {
52
+ return Ie((t) => nt(e, t), () => Qe(e), () => ai);
53
53
  }
54
54
  //#endregion
55
55
  //#region src/media/image-node.tsx
56
- var Ar = Me;
57
- function jr(e) {
56
+ var si = Ye;
57
+ function ci(e) {
58
58
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
59
59
  }
60
- function Mr(e) {
61
- 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 = Ie(kr(r)), p = J(o.attrs.src), m = Ar(o.attrs.align), h = Pe(o.attrs.width), g = J(o.attrs.caption), _ = G(null), v = Rr(p, l.resolveMediaSource, _, s), y = v?.src ?? (l.resolveMediaSource ? null : p), b = G(null), [x, S] = K(!1), [C, w] = K(!1), [T, D] = K(!1), [O, k] = K(""), [A, j] = K(null), [M, ee] = K(!1), [N, P] = K(!!g), [F, te] = K(g ?? ""), I = f && (!p || C), L = () => {
62
- y && Be({
60
+ function li(e) {
61
+ 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 = $e(oi(r)), p = X(o.attrs.src), m = si(o.attrs.align), h = Ze(o.attrs.width), g = X(o.attrs.caption), _ = q(null), v = hi(p, l.resolveMediaSource, _, s), y = v?.src ?? (l.resolveMediaSource ? null : p), b = q(null), [x, S] = J(!1), [C, w] = J(!1), [T, E] = J(!1), [D, O] = J(""), [k, A] = J(null), [j, M] = J(!1), [N, P] = J(!!g), [ee, F] = J(g ?? ""), te = f && (!p || C), I = () => {
62
+ y && rt({
63
63
  src: y,
64
- alt: J(o.attrs.alt) ?? "",
64
+ alt: X(o.attrs.alt) ?? "",
65
65
  messages: {
66
66
  dialogAriaLabel: d.previewDialogAriaLabel,
67
67
  zoomOut: d.previewZoomOut,
@@ -71,16 +71,16 @@ function Mr(e) {
71
71
  }
72
72
  });
73
73
  };
74
- U(() => {
75
- N || te(g ?? "");
74
+ W(() => {
75
+ N || F(g ?? "");
76
76
  }, [g, N]);
77
- let ne = () => {
77
+ let L = () => {
78
78
  if (!f) return;
79
79
  let e = i();
80
80
  typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
81
81
  }, re = () => {
82
82
  if (f) {
83
- if (k(""), j(null), D(!1), p) {
83
+ if (O(""), A(null), E(!1), p) {
84
84
  w(!1);
85
85
  return;
86
86
  }
@@ -88,46 +88,46 @@ function Mr(e) {
88
88
  }
89
89
  }, R = async (e) => {
90
90
  if (f) {
91
- j(null), ee(!0);
91
+ A(null), M(!0);
92
92
  try {
93
- let t = await Se(ke(e, p && C ? "image-replace" : "image-insert"), l.onUpload);
94
- c(Te(o.attrs, t)), w(!1), k("");
93
+ let t = await Y(Ge(e, p && C ? "image-replace" : "image-insert"), l.onUpload);
94
+ c(Ve(o.attrs, t)), w(!1), O("");
95
95
  } catch (e) {
96
- j(e instanceof Error ? e.message : d.uploadFailedError);
96
+ A(e instanceof Error ? e.message : d.uploadFailedError);
97
97
  } finally {
98
- ee(!1), D(!1);
98
+ M(!1), E(!1);
99
99
  }
100
100
  }
101
101
  }, ie = () => {
102
102
  if (f) {
103
- if (!O.trim()) {
104
- j(d.uploadRequiredError);
103
+ if (!D.trim()) {
104
+ A(d.uploadRequiredError);
105
105
  return;
106
106
  }
107
- R(be(O));
107
+ R(Le(D));
108
108
  }
109
- }, ae = (e) => {
109
+ }, z = (e) => {
110
110
  !f || !e || R({
111
111
  type: "file",
112
112
  file: e,
113
113
  mimeType: e.type
114
114
  });
115
- }, z = (e) => {
116
- ae(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
117
- }, oe = (e) => {
118
- e.preventDefault(), e.stopPropagation(), f && ae(e.dataTransfer.files?.[0] ?? null);
119
- }, se = () => {
120
- f && (P((e) => !e), N || te(g ?? ""));
121
- }, ce = (e) => {
122
- f && (te(e), c({ caption: e.trim() ? e : null }));
123
- }, le = (e, t) => {
115
+ }, B = (e) => {
116
+ z(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
117
+ }, ae = (e) => {
118
+ e.preventDefault(), e.stopPropagation(), f && z(e.dataTransfer.files?.[0] ?? null);
119
+ }, oe = () => {
120
+ f && (P((e) => !e), N || F(g ?? ""));
121
+ }, se = (e) => {
122
+ f && (F(e), c({ caption: e.trim() ? e : null }));
123
+ }, ce = (e, t) => {
124
124
  if (t.preventDefault(), t.stopPropagation(), !f) return;
125
- ne();
125
+ L();
126
126
  let n = _.current;
127
127
  if (!n) return;
128
128
  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) => {
129
129
  let n = e === "right" ? t.clientX - r : r - t.clientX;
130
- c({ width: Oe(i + n, a) });
130
+ c({ width: We(i + n, a) });
131
131
  }, s = () => {
132
132
  window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", s);
133
133
  };
@@ -140,39 +140,39 @@ function Mr(e) {
140
140
  "data-align": m,
141
141
  "data-selected": f && s ? "true" : "false",
142
142
  "data-hovered": x ? "true" : "false",
143
- "data-empty": I ? "true" : "false",
143
+ "data-empty": te ? "true" : "false",
144
144
  onPointerEnter: () => S(!0),
145
145
  onPointerLeave: () => S(!1),
146
146
  onMouseDown: (e) => {
147
- f && !jr(e.target) && ne();
147
+ f && !ci(e.target) && L();
148
148
  },
149
- children: I ? /* @__PURE__ */ Z(Nr, {
149
+ children: te ? /* @__PURE__ */ Z(ui, {
150
150
  dragActive: T,
151
- error: A,
152
- inputValue: O,
153
- isSubmitting: M,
151
+ error: k,
152
+ inputValue: D,
153
+ isSubmitting: j,
154
154
  fileInputRef: b,
155
155
  messages: u,
156
156
  onCancel: re,
157
- onDrop: oe,
158
- onDragActiveChange: D,
159
- onFileChange: z,
160
- onInputChange: k,
157
+ onDrop: ae,
158
+ onDragActiveChange: E,
159
+ onFileChange: B,
160
+ onInputChange: O,
161
161
  onSubmit: ie
162
- }) : /* @__PURE__ */ Q(X, { children: [
163
- f ? /* @__PURE__ */ Z(Pr, {
162
+ }) : /* @__PURE__ */ Q(ot, { children: [
163
+ f ? /* @__PURE__ */ Z(di, {
164
164
  align: m,
165
165
  captionActive: N || !!g,
166
166
  messages: u,
167
167
  onAlign: (e) => c({ align: e }),
168
- onCaption: se,
168
+ onCaption: oe,
169
169
  onDelete: t,
170
170
  onDownload: () => {
171
- y && q(y);
171
+ y && qe(y);
172
172
  },
173
- onPreview: L,
173
+ onPreview: I,
174
174
  onReplace: () => {
175
- k(""), j(null), w(!0);
175
+ O(""), A(null), w(!0);
176
176
  }
177
177
  }) : null,
178
178
  /* @__PURE__ */ Q("div", {
@@ -186,8 +186,8 @@ function Mr(e) {
186
186
  y ? /* @__PURE__ */ Z("img", {
187
187
  className: "markweave-image",
188
188
  src: y,
189
- alt: J(o.attrs.alt) ?? "",
190
- title: J(o.attrs.title) ?? void 0,
189
+ alt: X(o.attrs.alt) ?? "",
190
+ title: X(o.attrs.title) ?? void 0,
191
191
  draggable: !1,
192
192
  loading: "lazy",
193
193
  decoding: "async",
@@ -206,8 +206,8 @@ function Mr(e) {
206
206
  "aria-label": d.preview,
207
207
  title: d.preview,
208
208
  onMouseDown: (e) => e.preventDefault(),
209
- onClick: L,
210
- children: [/* @__PURE__ */ Z(E, {
209
+ onClick: I,
210
+ children: [/* @__PURE__ */ Z(ne, {
211
211
  size: 16,
212
212
  strokeWidth: 1.8
213
213
  }), /* @__PURE__ */ Z("span", {
@@ -216,15 +216,15 @@ function Mr(e) {
216
216
  children: d.preview
217
217
  })]
218
218
  }) : null,
219
- f ? /* @__PURE__ */ Z(Ir, {
219
+ f ? /* @__PURE__ */ Z(pi, {
220
220
  side: "left",
221
221
  messages: u,
222
- onPointerDown: le
222
+ onPointerDown: ce
223
223
  }) : null,
224
- f ? /* @__PURE__ */ Z(Ir, {
224
+ f ? /* @__PURE__ */ Z(pi, {
225
225
  side: "right",
226
226
  messages: u,
227
- onPointerDown: le
227
+ onPointerDown: ce
228
228
  }) : null
229
229
  ]
230
230
  }),
@@ -232,10 +232,10 @@ function Mr(e) {
232
232
  className: "markweave-image-caption-input",
233
233
  "data-markweave-image-ui": "true",
234
234
  "data-testid": "markweave-image-caption-input",
235
- value: F,
235
+ value: ee,
236
236
  placeholder: d.captionPlaceholder,
237
237
  "aria-label": d.captionAriaLabel,
238
- onChange: (e) => ce(e.currentTarget.value),
238
+ onChange: (e) => se(e.currentTarget.value),
239
239
  onKeyDown: (e) => {
240
240
  e.key === "Escape" && (e.preventDefault(), P(!1));
241
241
  }
@@ -247,7 +247,7 @@ function Mr(e) {
247
247
  ] })
248
248
  });
249
249
  }
250
- function Nr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
250
+ function ui({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
251
251
  let f = a.image;
252
252
  return /* @__PURE__ */ Q("section", {
253
253
  className: "markweave-image-upload-placeholder",
@@ -274,7 +274,7 @@ function Nr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
274
274
  /* @__PURE__ */ Z("div", {
275
275
  className: "markweave-image-upload-icon",
276
276
  "aria-hidden": "true",
277
- children: /* @__PURE__ */ Z(j, {
277
+ children: /* @__PURE__ */ Z(B, {
278
278
  size: 46,
279
279
  strokeWidth: 1.6
280
280
  })
@@ -309,7 +309,7 @@ function Nr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
309
309
  "data-testid": "markweave-image-upload-submit",
310
310
  disabled: i || !r.trim(),
311
311
  onClick: d,
312
- children: [/* @__PURE__ */ Z(j, {
312
+ children: [/* @__PURE__ */ Z(B, {
313
313
  size: 16,
314
314
  strokeWidth: 1.8
315
315
  }), a.common.insert]
@@ -329,7 +329,7 @@ function Nr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
329
329
  ]
330
330
  });
331
331
  }
332
- function Pr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i, onDelete: a, onDownload: o, onPreview: s, onReplace: c }) {
332
+ function di({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i, onDelete: a, onDownload: o, onPreview: s, onReplace: c }) {
333
333
  let u = n.image;
334
334
  return /* @__PURE__ */ Q("div", {
335
335
  className: "markweave-image-toolbar",
@@ -337,21 +337,21 @@ function Pr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
337
337
  "data-markweave-image-ui": "true",
338
338
  "aria-label": u.toolsAriaLabel,
339
339
  children: [
340
- /* @__PURE__ */ Z(Fr, {
340
+ /* @__PURE__ */ Z(fi, {
341
341
  testId: "markweave-image-align-left",
342
342
  label: u.alignLeft,
343
343
  icon: d,
344
344
  active: e === "left",
345
345
  onClick: () => r("left")
346
346
  }),
347
- /* @__PURE__ */ Z(Fr, {
347
+ /* @__PURE__ */ Z(fi, {
348
348
  testId: "markweave-image-align-center",
349
349
  label: u.alignCenter,
350
350
  icon: l,
351
351
  active: e === "center",
352
352
  onClick: () => r("center")
353
353
  }),
354
- /* @__PURE__ */ Z(Fr, {
354
+ /* @__PURE__ */ Z(fi, {
355
355
  testId: "markweave-image-align-right",
356
356
  label: u.alignRight,
357
357
  icon: f,
@@ -362,45 +362,45 @@ function Pr({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
362
362
  className: "markweave-image-toolbar-divider",
363
363
  "aria-hidden": "true"
364
364
  }),
365
- /* @__PURE__ */ Z(Fr, {
365
+ /* @__PURE__ */ Z(fi, {
366
366
  testId: "markweave-image-caption",
367
367
  label: u.caption,
368
- icon: h,
368
+ icon: O,
369
369
  active: t,
370
370
  onClick: i
371
371
  }),
372
- /* @__PURE__ */ Z(Fr, {
372
+ /* @__PURE__ */ Z(fi, {
373
373
  testId: "markweave-image-preview",
374
374
  label: u.preview,
375
- icon: E,
375
+ icon: ne,
376
376
  onClick: s
377
377
  }),
378
- /* @__PURE__ */ Z(Fr, {
378
+ /* @__PURE__ */ Z(fi, {
379
379
  testId: "markweave-image-download",
380
380
  label: u.download,
381
- icon: w,
381
+ icon: I,
382
382
  onClick: o
383
383
  }),
384
- /* @__PURE__ */ Z(Fr, {
384
+ /* @__PURE__ */ Z(fi, {
385
385
  testId: "markweave-image-replace",
386
386
  label: u.replace,
387
- icon: oe,
387
+ icon: ye,
388
388
  onClick: c
389
389
  }),
390
390
  /* @__PURE__ */ Z("span", {
391
391
  className: "markweave-image-toolbar-divider",
392
392
  "aria-hidden": "true"
393
393
  }),
394
- /* @__PURE__ */ Z(Fr, {
394
+ /* @__PURE__ */ Z(fi, {
395
395
  testId: "markweave-image-delete",
396
396
  label: u.delete,
397
- icon: pe,
397
+ icon: je,
398
398
  onClick: a
399
399
  })
400
400
  ]
401
401
  });
402
402
  }
403
- function Fr({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
403
+ function fi({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
404
404
  return /* @__PURE__ */ Q("button", {
405
405
  type: "button",
406
406
  "aria-label": n,
@@ -419,7 +419,7 @@ function Fr({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
419
419
  })]
420
420
  });
421
421
  }
422
- function Ir({ messages: e, onPointerDown: t, side: n }) {
422
+ function pi({ messages: e, onPointerDown: t, side: n }) {
423
423
  return /* @__PURE__ */ Z("button", {
424
424
  type: "button",
425
425
  className: "markweave-image-resize-handle",
@@ -430,7 +430,7 @@ function Ir({ messages: e, onPointerDown: t, side: n }) {
430
430
  onPointerDown: (e) => t(n, e)
431
431
  });
432
432
  }
433
- var Lr = Ce.extend({
433
+ var mi = ze.extend({
434
434
  addOptions() {
435
435
  return {
436
436
  ...this.parent?.(),
@@ -441,21 +441,21 @@ var Lr = Ce.extend({
441
441
  },
442
442
  addNodeView() {
443
443
  if (typeof document > "u") return null;
444
- let e = o(Mr, { stopEvent: ({ event: e }) => jr(e.target) }), t = this.options.resolveMediaSource;
444
+ let e = o(li, { stopEvent: ({ event: e }) => ci(e.target) }), t = this.options.resolveMediaSource;
445
445
  if (!t) return e;
446
- let r = Y({
446
+ let r = it({
447
447
  messages: this.options.messages ?? n("zh"),
448
448
  onUpload: this.options.onUpload,
449
449
  resolveMediaSource: t
450
450
  });
451
- return (t) => J(t.node.attrs.src) ? r(t) : e(t);
451
+ return (t) => X(t.node.attrs.src) ? r(t) : e(t);
452
452
  }
453
453
  });
454
- function Rr(e, t, n, r) {
455
- let [i, a] = K(t ? "background" : "visible"), [o, s] = K(() => !t && e ? { src: e } : null);
456
- return U(() => {
454
+ function hi(e, t, n, r) {
455
+ let [i, a] = J(t ? "background" : "visible"), [o, s] = J(() => !t && e ? { src: e } : null);
456
+ return W(() => {
457
457
  s(!t && e ? { src: e } : null), a(t ? "background" : "visible");
458
- }, [t, e]), U(() => {
458
+ }, [t, e]), W(() => {
459
459
  if (!t || !e) return;
460
460
  if (r) {
461
461
  a("visible");
@@ -478,10 +478,10 @@ function Rr(e, t, n, r) {
478
478
  t,
479
479
  r,
480
480
  e
481
- ]), U(() => {
481
+ ]), W(() => {
482
482
  if (!t || !e || i === "background") return;
483
483
  let n = new AbortController();
484
- return Ve(t, {
484
+ return at(t, {
485
485
  kind: "image",
486
486
  priority: i,
487
487
  signal: n.signal,
@@ -497,28 +497,28 @@ function Rr(e, t, n, r) {
497
497
  }
498
498
  //#endregion
499
499
  //#region src/media/video-node.tsx
500
- function zr(e) {
500
+ function gi(e) {
501
501
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
502
502
  }
503
- function Br(e) {
504
- 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 = Ie(kr(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 = G(null), [b, x] = K(!1), [S, C] = K(""), [w, T] = K(null), [E, D] = K(!1), O = f && !p, k = () => {
503
+ function _i(e) {
504
+ 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 = $e(oi(r)), p = X(o.attrs.src), m = X(o.attrs.embedUrl), h = X(o.attrs.provider), g = m ? Xe(m, h) : null, _ = X(o.attrs.mimeType), v = X(o.attrs.title), y = q(null), [b, x] = J(!1), [S, C] = J(""), [w, T] = J(null), [E, D] = J(!1), O = f && !p, k = () => {
505
505
  if (!f) return;
506
506
  let e = i();
507
507
  typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
508
508
  }, A = (e) => {
509
- f && (zr(e.target) || (e.preventDefault(), k()));
509
+ f && (gi(e.target) || (e.preventDefault(), k()));
510
510
  }, j = (e) => {
511
511
  f && (e.key === "Delete" || e.key === "Backspace") && s && (e.preventDefault(), t());
512
512
  }, M = async (e) => {
513
513
  if (!(!f || !e)) {
514
514
  T(null), D(!0);
515
515
  try {
516
- let t = await Se(Ae({
516
+ let t = await Y(Ke({
517
517
  type: "file",
518
518
  file: e,
519
519
  mimeType: e.type
520
520
  }), l.onUpload);
521
- c(Ee(t)), C("");
521
+ c(He(t)), C("");
522
522
  } catch (e) {
523
523
  T(e instanceof Error ? e.message : d.uploadFailedError);
524
524
  } finally {
@@ -532,7 +532,7 @@ function Br(e) {
532
532
  "data-testid": "markweave-video-node",
533
533
  "data-empty": "true",
534
534
  "data-selected": "false",
535
- children: /* @__PURE__ */ Z(Vr, {
535
+ children: /* @__PURE__ */ Z(vi, {
536
536
  dragActive: b,
537
537
  error: w,
538
538
  fileInputRef: y,
@@ -550,7 +550,7 @@ function Br(e) {
550
550
  onInputChange: C,
551
551
  onSubmit: () => {
552
552
  if (!f) return;
553
- let e = De(S);
553
+ let e = Ue(S);
554
554
  if (!e) {
555
555
  T(d.unsupportedUrlError);
556
556
  return;
@@ -579,7 +579,7 @@ function Br(e) {
579
579
  "data-markweave-video-embed": "true",
580
580
  "data-markweave-video-provider": h ?? void 0,
581
581
  "data-markweave-video-src": p ?? void 0,
582
- allow: je,
582
+ allow: Je,
583
583
  loading: "lazy",
584
584
  allowFullScreen: !0
585
585
  }), f ? /* @__PURE__ */ Z("button", {
@@ -613,7 +613,7 @@ function Br(e) {
613
613
  })
614
614
  });
615
615
  }
616
- function Vr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
616
+ function vi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
617
617
  let f = a.video;
618
618
  return /* @__PURE__ */ Q("section", {
619
619
  className: "markweave-video-upload-placeholder",
@@ -640,7 +640,7 @@ function Vr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
640
640
  /* @__PURE__ */ Z("div", {
641
641
  className: "markweave-video-upload-icon",
642
642
  "aria-hidden": "true",
643
- children: /* @__PURE__ */ Z(_e, {
643
+ children: /* @__PURE__ */ Z(Fe, {
644
644
  size: 46,
645
645
  strokeWidth: 1.6
646
646
  })
@@ -675,7 +675,7 @@ function Vr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
675
675
  "data-testid": "markweave-video-upload-submit",
676
676
  disabled: i || !r.trim(),
677
677
  onClick: d,
678
- children: [/* @__PURE__ */ Z(ge, {
678
+ children: [/* @__PURE__ */ Z(Pe, {
679
679
  size: 16,
680
680
  strokeWidth: 1.8
681
681
  }), a.common.insert]
@@ -695,7 +695,7 @@ function Vr({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
695
695
  ]
696
696
  });
697
697
  }
698
- var Hr = we.extend({
698
+ var yi = Be.extend({
699
699
  addOptions() {
700
700
  return {
701
701
  ...this.parent?.(),
@@ -705,58 +705,58 @@ var Hr = we.extend({
705
705
  };
706
706
  },
707
707
  addNodeView() {
708
- return typeof document > "u" ? null : o(Br, { stopEvent: ({ event: e }) => zr(e.target) });
708
+ return typeof document > "u" ? null : o(_i, { stopEvent: ({ event: e }) => gi(e.target) });
709
709
  }
710
710
  });
711
711
  //#endregion
712
712
  //#region src/link-card-node.tsx
713
- function Ur(e) {
713
+ function bi(e) {
714
714
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
715
715
  }
716
- function Wr(e) {
716
+ function xi(e) {
717
717
  return typeof navigator < "u" && navigator.clipboard?.writeText ? navigator.clipboard.writeText(e).catch(() => void 0) : Promise.resolve();
718
718
  }
719
- function Gr(e) {
719
+ function Si(e) {
720
720
  !e || typeof window > "u" || window.open(e, "_blank", "noopener,noreferrer");
721
721
  }
722
- function Kr(e) {
722
+ function Ci(e) {
723
723
  try {
724
724
  return new URL(e).host;
725
725
  } catch {
726
726
  return e;
727
727
  }
728
728
  }
729
- function qr(e) {
730
- 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 = Ie(kr(r)), f = Ue(o.attrs), [p, m] = K(!1), [h, g] = K(!1), [_, v] = K(!1), [y, b] = K(f?.title ?? ""), [x, C] = K(f?.href ?? ""), w = G(null);
731
- if (U(() => () => w.current?.abort(), []), U(() => {
732
- b(f?.title ?? ""), C(f?.href ?? ""), v(!1);
729
+ function wi(e) {
730
+ 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 = $e(oi(r)), f = ct(o.attrs), [p, m] = J(!1), [h, g] = J(!1), [_, v] = J(!1), [y, b] = J(f?.title ?? ""), [x, S] = J(f?.href ?? ""), C = q(null);
731
+ if (W(() => () => C.current?.abort(), []), W(() => {
732
+ b(f?.title ?? ""), S(f?.href ?? ""), v(!1);
733
733
  }, [f?.href, f?.title]), !f) return null;
734
- let T = async (e) => {
734
+ let w = async (e) => {
735
735
  e.preventDefault();
736
- let t = Ue({
736
+ let t = ct({
737
737
  ...f,
738
738
  href: x,
739
739
  title: y
740
740
  });
741
741
  if (!t) return;
742
- s(t), g(!1), w.current?.abort();
742
+ s(t), g(!1), C.current?.abort();
743
743
  let n = new AbortController();
744
- w.current = n;
744
+ C.current = n;
745
745
  try {
746
746
  let e = await c.resolver?.({
747
747
  href: t.href,
748
748
  title: t.title,
749
749
  signal: n.signal
750
750
  });
751
- !n.signal.aborted && e && s(Ue({
751
+ !n.signal.aborted && e && s(ct({
752
752
  ...t,
753
753
  ...e
754
754
  }) ?? t);
755
755
  } catch {}
756
- }, E = () => {
756
+ }, T = () => {
757
757
  let e = i();
758
- typeof e == "number" && Ge(r, e);
759
- }, D = _ ? null : f.imageUrl, O = Kr(f.href);
758
+ typeof e == "number" && ut(r, e);
759
+ }, E = _ ? null : f.imageUrl, D = Ci(f.href);
760
760
  return /* @__PURE__ */ Q(a, {
761
761
  as: "article",
762
762
  className: "markweave-link-card",
@@ -767,10 +767,10 @@ function qr(e) {
767
767
  onMouseEnter: () => m(!0),
768
768
  onMouseLeave: () => m(!1),
769
769
  onMouseDown: (e) => {
770
- Ur(e.target) || e.preventDefault();
770
+ bi(e.target) || e.preventDefault();
771
771
  },
772
772
  onClick: (e) => {
773
- Ur(e.target) || (e.preventDefault(), Gr(f.href));
773
+ bi(e.target) || (e.preventDefault(), Si(f.href));
774
774
  },
775
775
  children: [
776
776
  /* @__PURE__ */ Q("a", {
@@ -782,13 +782,13 @@ function qr(e) {
782
782
  children: [
783
783
  /* @__PURE__ */ Z("strong", { children: f.title }),
784
784
  f.description ? /* @__PURE__ */ Z("span", { children: f.description }) : null,
785
- /* @__PURE__ */ Z("small", { children: f.siteName ?? O })
785
+ /* @__PURE__ */ Z("small", { children: f.siteName ?? D })
786
786
  ]
787
787
  }), /* @__PURE__ */ Z("span", {
788
788
  className: "markweave-link-card-media",
789
789
  "aria-hidden": "true",
790
- children: D ? /* @__PURE__ */ Z("img", {
791
- src: D,
790
+ children: E ? /* @__PURE__ */ Z("img", {
791
+ src: E,
792
792
  alt: "",
793
793
  loading: "lazy",
794
794
  referrerPolicy: "no-referrer",
@@ -800,7 +800,7 @@ function qr(e) {
800
800
  loading: "lazy",
801
801
  referrerPolicy: "no-referrer",
802
802
  onError: () => v(!0)
803
- }) : /* @__PURE__ */ Z("b", { children: O.slice(0, 1).toUpperCase() })
803
+ }) : /* @__PURE__ */ Z("b", { children: D.slice(0, 1).toUpperCase() })
804
804
  })]
805
805
  }),
806
806
  d && p ? /* @__PURE__ */ Q("div", {
@@ -808,24 +808,24 @@ function qr(e) {
808
808
  "data-markweave-link-card-ui": "true",
809
809
  "aria-label": u.toolsAriaLabel,
810
810
  children: [
811
- /* @__PURE__ */ Z(Jr, {
811
+ /* @__PURE__ */ Z(Ti, {
812
812
  label: u.convertToLink,
813
- icon: te,
814
- onClick: E,
813
+ icon: V,
814
+ onClick: T,
815
815
  testId: "markweave-link-card-convert"
816
816
  }),
817
- /* @__PURE__ */ Z(Jr, {
817
+ /* @__PURE__ */ Z(Ti, {
818
818
  label: u.copyAddress,
819
- icon: S,
820
- onClick: () => void Wr(f.href),
819
+ icon: F,
820
+ onClick: () => void xi(f.href),
821
821
  testId: "markweave-link-card-copy"
822
822
  }),
823
- /* @__PURE__ */ Z(Jr, {
823
+ /* @__PURE__ */ Z(Ti, {
824
824
  label: u.edit,
825
- icon: ae,
825
+ icon: ge,
826
826
  onClick: (e) => {
827
827
  let t = i();
828
- typeof t == "number" && Ke({
828
+ typeof t == "number" && dt({
829
829
  anchor: e.currentTarget,
830
830
  editor: r,
831
831
  messages: l,
@@ -838,9 +838,9 @@ function qr(e) {
838
838
  },
839
839
  testId: "markweave-link-card-edit"
840
840
  }),
841
- /* @__PURE__ */ Z(Jr, {
841
+ /* @__PURE__ */ Z(Ti, {
842
842
  label: u.delete,
843
- icon: pe,
843
+ icon: je,
844
844
  onClick: t,
845
845
  testId: "markweave-link-card-delete"
846
846
  })
@@ -850,7 +850,7 @@ function qr(e) {
850
850
  className: "markweave-link-card-editor",
851
851
  "data-markweave-link-card-ui": "true",
852
852
  "data-testid": "markweave-link-card-editor",
853
- onSubmit: T,
853
+ onSubmit: w,
854
854
  children: [
855
855
  /* @__PURE__ */ Q("label", { children: [/* @__PURE__ */ Z("span", { children: u.titleLabel }), /* @__PURE__ */ Z("input", {
856
856
  "aria-label": u.titleLabel,
@@ -862,20 +862,20 @@ function qr(e) {
862
862
  "aria-label": u.addressLabel,
863
863
  placeholder: u.addressPlaceholder,
864
864
  value: x,
865
- onChange: (e) => C(e.currentTarget.value)
865
+ onChange: (e) => S(e.currentTarget.value)
866
866
  })] }),
867
867
  /* @__PURE__ */ Z("button", {
868
868
  type: "submit",
869
869
  "aria-label": u.edit,
870
- disabled: !We(x),
871
- children: /* @__PURE__ */ Z(te, { size: 16 })
870
+ disabled: !lt(x),
871
+ children: /* @__PURE__ */ Z(V, { size: 16 })
872
872
  })
873
873
  ]
874
874
  }) : null
875
875
  ]
876
876
  });
877
877
  }
878
- function Jr({ icon: e, label: t, onClick: n, testId: r }) {
878
+ function Ti({ icon: e, label: t, onClick: n, testId: r }) {
879
879
  return /* @__PURE__ */ Q("button", {
880
880
  type: "button",
881
881
  "aria-label": t,
@@ -892,7 +892,7 @@ function Jr({ icon: e, label: t, onClick: n, testId: r }) {
892
892
  })]
893
893
  });
894
894
  }
895
- var Yr = qe.extend({
895
+ var Ei = ft.extend({
896
896
  addOptions() {
897
897
  return {
898
898
  ...this.parent?.(),
@@ -901,23 +901,23 @@ var Yr = qe.extend({
901
901
  };
902
902
  },
903
903
  addNodeView() {
904
- return typeof document > "u" ? null : o(qr, { stopEvent: ({ event: e }) => Ur(e.target) });
904
+ return typeof document > "u" ? null : o(wi, { stopEvent: ({ event: e }) => bi(e.target) });
905
905
  }
906
906
  });
907
907
  //#endregion
908
908
  //#region src/create-editor-extensions.ts
909
- function Xr(t = {}) {
909
+ function Di(t = {}) {
910
910
  return e({
911
911
  lang: t.lang,
912
912
  onImageUpload: t.onImageUpload,
913
- linkCardExtension: Yr.configure({
913
+ linkCardExtension: Ei.configure({
914
914
  lang: t.lang,
915
915
  messages: n(t.lang),
916
916
  resolver: t.linkCardResolver
917
917
  }),
918
- mediaExtensions: He({
919
- image: Lr,
920
- video: Hr,
918
+ mediaExtensions: st({
919
+ image: mi,
920
+ video: yi,
921
921
  lang: t.lang,
922
922
  onImageUpload: t.onImageUpload,
923
923
  onVideoUpload: t.onVideoUpload,
@@ -927,12 +927,12 @@ function Xr(t = {}) {
927
927
  }
928
928
  //#endregion
929
929
  //#region src/ui/codeblock/CodeBlockControls.tsx
930
- function Zr(e) {
931
- 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", {
930
+ function Oi(e) {
931
+ return e === "clipboard" ? /* @__PURE__ */ Q(ot, { 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(ot, { children: [/* @__PURE__ */ Z("circle", {
932
932
  cx: "10",
933
933
  cy: "10",
934
934
  r: "5.5"
935
- }), /* @__PURE__ */ Z("path", { d: "m14 14 4 4" })] }) : e === "check" ? /* @__PURE__ */ Z("path", { d: "m5 11 4 4 8-9" }) : e === "expand" ? /* @__PURE__ */ Q(X, { children: [
935
+ }), /* @__PURE__ */ Z("path", { d: "m14 14 4 4" })] }) : e === "check" ? /* @__PURE__ */ Z("path", { d: "m5 11 4 4 8-9" }) : e === "expand" ? /* @__PURE__ */ Q(ot, { children: [
936
936
  /* @__PURE__ */ Z("path", { d: "M8 4H4v4" }),
937
937
  /* @__PURE__ */ Z("path", { d: "M4 4l5 5" }),
938
938
  /* @__PURE__ */ Z("path", { d: "M16 4h4v4" }),
@@ -941,11 +941,11 @@ function Zr(e) {
941
941
  /* @__PURE__ */ Z("path", { d: "m4 20 5-5" }),
942
942
  /* @__PURE__ */ Z("path", { d: "M16 20h4v-4" }),
943
943
  /* @__PURE__ */ Z("path", { d: "m20 20-5-5" })
944
- ] }) : e === "download" ? /* @__PURE__ */ Q(X, { children: [
944
+ ] }) : e === "download" ? /* @__PURE__ */ Q(ot, { children: [
945
945
  /* @__PURE__ */ Z("path", { d: "M12 4v10" }),
946
946
  /* @__PURE__ */ Z("path", { d: "m8 10 4 4 4-4" }),
947
947
  /* @__PURE__ */ Z("path", { d: "M5 19h14" })
948
- ] }) : e === "close" ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("path", { d: "M6 6l12 12" }), /* @__PURE__ */ Z("path", { d: "M18 6 6 18" })] }) : e === "zoomOut" ? /* @__PURE__ */ Q(X, { children: [
948
+ ] }) : e === "close" ? /* @__PURE__ */ Q(ot, { children: [/* @__PURE__ */ Z("path", { d: "M6 6l12 12" }), /* @__PURE__ */ Z("path", { d: "M18 6 6 18" })] }) : e === "zoomOut" ? /* @__PURE__ */ Q(ot, { children: [
949
949
  /* @__PURE__ */ Z("circle", {
950
950
  cx: "10",
951
951
  cy: "10",
@@ -953,7 +953,7 @@ function Zr(e) {
953
953
  }),
954
954
  /* @__PURE__ */ Z("path", { d: "M7.5 10h5" }),
955
955
  /* @__PURE__ */ Z("path", { d: "m14 14 4 4" })
956
- ] }) : e === "zoomIn" ? /* @__PURE__ */ Q(X, { children: [
956
+ ] }) : e === "zoomIn" ? /* @__PURE__ */ Q(ot, { children: [
957
957
  /* @__PURE__ */ Z("circle", {
958
958
  cx: "10",
959
959
  cy: "10",
@@ -962,9 +962,9 @@ function Zr(e) {
962
962
  /* @__PURE__ */ Z("path", { d: "M7.5 10h5" }),
963
963
  /* @__PURE__ */ Z("path", { d: "M10 7.5v5" }),
964
964
  /* @__PURE__ */ Z("path", { d: "m14 14 4 4" })
965
- ] }) : 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" });
965
+ ] }) : e === "reset" ? /* @__PURE__ */ Q(ot, { 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" });
966
966
  }
967
- function Qr({ icon: e }) {
967
+ function ki({ icon: e }) {
968
968
  return /* @__PURE__ */ Z("svg", {
969
969
  viewBox: "0 0 24 24",
970
970
  "aria-hidden": "true",
@@ -975,50 +975,50 @@ function Qr({ icon: e }) {
975
975
  strokeLinecap: "round",
976
976
  strokeLinejoin: "round",
977
977
  strokeWidth: "1.8",
978
- children: Zr(e)
978
+ children: Oi(e)
979
979
  })
980
980
  });
981
981
  }
982
- function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, readOnly: i = !1 }) {
983
- let a = G(null), o = G(null), s = G(null), c = G(null), l = G(null), u = G({
982
+ function Ai({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, readOnly: i = !1 }) {
983
+ let a = q(null), o = q(null), s = q(null), c = q(null), l = q(null), u = q({
984
984
  active: !1,
985
985
  lastX: 0,
986
986
  lastY: 0
987
- }), [d, f] = K(null), [p, m] = K(null), [h, g] = K([]), [_, v] = K(null), [y, b] = K(!1), [x, S] = K(""), [C, w] = K(-1), [T, E] = K(null), [D, O] = K(!1), [k, A] = K(null), [j, M] = K(null), [ee, N] = K(!1), [P, F] = K(0), [te, I] = K(0), L = ht(t), ne = vn(t, d), re = !i && e && L.active && L.pos !== null ? {
987
+ }), [d, f] = J(null), [p, m] = J(null), [h, g] = J([]), [_, v] = J(null), [y, b] = J(!1), [x, S] = J(""), [C, w] = J(-1), [T, E] = J(null), [D, O] = J(!1), [k, A] = J(null), [j, M] = J(null), [N, P] = J(!1), [ee, F] = J(0), [te, I] = J(0), L = Ft(t), ne = Bn(t, d), re = !i && e && L.active && L.pos !== null ? {
988
988
  ...L,
989
989
  pos: L.pos,
990
990
  active: !0
991
- } : null, R = ne ?? re, ie = R !== null, ae = R?.language === "mermaid", z = Cn(t, R), oe = ie && R !== null && !z, se = !i, ce = dn(R ? R.language : "text"), le = T?.status ?? "idle", ue = R?.mermaidPreviewMode ?? n, de = ae && ue === "preview", fe = xn(t), B = `${te}|${fe.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`, V = W(() => hn(x.trim().toLowerCase()), [x]);
992
- if (U(() => {
991
+ } : null, R = ne ?? re, ie = R !== null, z = R?.language === "mermaid", B = Gn(t, R), ae = ie && R !== null && !B, oe = !i, se = Nn(R ? R.language : "text"), ce = T?.status ?? "idle", le = R?.mermaidPreviewMode ?? n, V = z && le === "preview", ue = Un(t), de = `${te}|${ue.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`, H = K(() => Ln(x.trim().toLowerCase()), [x]);
992
+ if (W(() => {
993
993
  i && (b(!1), S(""), w(-1));
994
- }, [i]), U(() => {
994
+ }, [i]), W(() => {
995
995
  if (!T) return;
996
996
  let e = window.setTimeout(() => {
997
997
  E(null);
998
- }, rn);
998
+ }, En);
999
999
  return () => {
1000
1000
  window.clearTimeout(e);
1001
1001
  };
1002
- }, [T]), U(() => {
1003
- E(null), b(!1), S(""), w(-1), A(null), M(null), N(!1);
1002
+ }, [T]), W(() => {
1003
+ E(null), b(!1), S(""), w(-1), A(null), M(null), P(!1);
1004
1004
  }, [
1005
1005
  e,
1006
1006
  R?.language,
1007
1007
  R?.pos,
1008
1008
  R?.text
1009
- ]), U(() => {
1009
+ ]), W(() => {
1010
1010
  let e = ({ transaction: e }) => {
1011
- e.getMeta(pt) && F((e) => e + 1);
1011
+ e.getMeta(Nt) && F((e) => e + 1);
1012
1012
  };
1013
1013
  return t.on("transaction", e), () => {
1014
1014
  t.off("transaction", e);
1015
1015
  };
1016
- }, [t]), U(() => {
1016
+ }, [t]), W(() => {
1017
1017
  let e = t.view.dom.closest(".markweave-editor-frame");
1018
1018
  if (!e) return;
1019
1019
  let n = (e) => {
1020
1020
  if (e.target instanceof Node && a.current?.contains(e.target) || y) return;
1021
- let n = vn(t, _n(t, e.target)), r = n && !Cn(t, n) ? n.pos : null;
1021
+ let n = Bn(t, zn(t, e.target)), r = n && !Gn(t, n) ? n.pos : null;
1022
1022
  f((e) => e === r ? e : r);
1023
1023
  }, r = () => {
1024
1024
  y || f(null);
@@ -1026,20 +1026,20 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1026
1026
  return e.addEventListener("mousemove", n), e.addEventListener("mouseleave", r), () => {
1027
1027
  e.removeEventListener("mousemove", n), e.removeEventListener("mouseleave", r);
1028
1028
  };
1029
- }, [t, y]), U(() => {
1029
+ }, [t, y]), W(() => {
1030
1030
  y && s.current?.focus({ preventScroll: !0 });
1031
- }, [y]), ve(() => {
1031
+ }, [y]), G(() => {
1032
1032
  if (!y || C < 0) return;
1033
1033
  let e = c.current, t = e?.querySelector(`[data-language-index="${C}"]`);
1034
- e && t && On(e, t);
1034
+ e && t && Xn(e, t);
1035
1035
  }, [
1036
1036
  C,
1037
- V,
1037
+ H,
1038
1038
  y
1039
- ]), U(() => {
1039
+ ]), W(() => {
1040
1040
  if (!k) return;
1041
1041
  let e = (e) => {
1042
- e.key === "Escape" && (A(null), M(null), N(!1), u.current = {
1042
+ e.key === "Escape" && (A(null), M(null), P(!1), u.current = {
1043
1043
  active: !1,
1044
1044
  lastX: 0,
1045
1045
  lastY: 0
@@ -1048,7 +1048,7 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1048
1048
  return document.addEventListener("keydown", e), () => {
1049
1049
  document.removeEventListener("keydown", e);
1050
1050
  };
1051
- }, [t, k]), U(() => {
1051
+ }, [t, k]), W(() => {
1052
1052
  if (!ie || !y) return;
1053
1053
  let e = (e) => {
1054
1054
  e.key === "Escape" && (b(!1), w(-1), t.view.focus());
@@ -1062,19 +1062,19 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1062
1062
  ie,
1063
1063
  t,
1064
1064
  y
1065
- ]), ve(() => {
1065
+ ]), G(() => {
1066
1066
  let e = () => {
1067
1067
  let e = a.current;
1068
1068
  if (!e) return;
1069
- if (!yn(e) || fe.length === 0) {
1069
+ if (!Vn(e) || ue.length === 0) {
1070
1070
  g([]);
1071
1071
  return;
1072
1072
  }
1073
- let n = e.getBoundingClientRect(), r = fe.flatMap((e) => {
1074
- let r = mn(pn(t, e.pos, e.mermaidPreviewMode), n);
1075
- return r ? [ln(e, r, n)] : [];
1073
+ let n = e.getBoundingClientRect(), r = ue.flatMap((e) => {
1074
+ let r = In(Fn(t, e.pos, e.mermaidPreviewMode), n);
1075
+ return r ? [jn(e, r, n)] : [];
1076
1076
  });
1077
- g((e) => wn(e, r, fe.map((e) => e.pos)));
1077
+ g((e) => Kn(e, r, ue.map((e) => e.pos)));
1078
1078
  };
1079
1079
  e();
1080
1080
  let n = window.requestAnimationFrame(e);
@@ -1082,26 +1082,26 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1082
1082
  window.cancelAnimationFrame(n), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
1083
1083
  };
1084
1084
  }, [
1085
- P,
1085
+ ee,
1086
1086
  t,
1087
- B
1088
- ]), ve(() => {
1089
- if (!oe || !R) {
1087
+ de
1088
+ ]), G(() => {
1089
+ if (!ae || !R) {
1090
1090
  m(null), v(null);
1091
1091
  return;
1092
1092
  }
1093
1093
  let e = () => {
1094
1094
  let e = a.current;
1095
1095
  if (!e) return;
1096
- let n = pn(t, R.pos, ue), r = e.getBoundingClientRect(), i = mn(n, r);
1096
+ let n = Fn(t, R.pos, le), r = e.getBoundingClientRect(), i = In(n, r);
1097
1097
  if (!i) {
1098
1098
  m((e) => e?.pos === R.pos ? e : null), v((e) => y ? e : null);
1099
1099
  return;
1100
1100
  }
1101
- let s = sn(R.pos, i, r);
1101
+ let s = kn(R.pos, i, r);
1102
1102
  if (m(s), y && o.current) {
1103
1103
  let e = o.current.getBoundingClientRect();
1104
- v(tn({
1104
+ v(wn({
1105
1105
  overlayRect: r,
1106
1106
  buttonRect: e,
1107
1107
  windowWidth: window.innerWidth,
@@ -1113,101 +1113,101 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1113
1113
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
1114
1114
  };
1115
1115
  }, [
1116
- oe,
1117
- P,
1116
+ ae,
1117
+ ee,
1118
1118
  R?.pos,
1119
1119
  t,
1120
1120
  y,
1121
- ue
1122
- ]), !oe && fe.length === 0 && !k) return null;
1123
- let pe = p ? {
1121
+ le
1122
+ ]), !ae && ue.length === 0 && !k) return null;
1123
+ let fe = p ? {
1124
1124
  top: p.top,
1125
1125
  right: p.right
1126
- } : void 0, me = async () => {
1126
+ } : void 0, pe = async () => {
1127
1127
  if (i) {
1128
1128
  if (!R) return;
1129
- let e = await an(R.text);
1130
- E(gt(R, e ? "copied" : "failed"));
1129
+ let e = await Dn(R.text);
1130
+ E(It(R, e ? "copied" : "failed"));
1131
1131
  return;
1132
1132
  }
1133
- if (!un(t, R)) return;
1134
- let e = await mt(t);
1135
- E(gt(ht(t), e ? "copied" : "failed")), t.view.focus();
1136
- }, he = (e, n) => {
1133
+ if (!Mn(t, R)) return;
1134
+ let e = await Pt(t);
1135
+ E(It(Ft(t), e ? "copied" : "failed")), t.view.focus();
1136
+ }, me = (e, n) => {
1137
1137
  if (i) {
1138
- wt(t, e.pos, n) && I((e) => e + 1);
1138
+ Wt(t, e.pos, n) && I((e) => e + 1);
1139
1139
  return;
1140
1140
  }
1141
1141
  let a = L.active && L.pos === e.pos;
1142
- bt(t, e.pos, n) && (r(n), I((e) => e + 1), a && t.view.focus());
1143
- }, ge = (e) => {
1142
+ Bt(t, e.pos, n) && (r(n), I((e) => e + 1), a && t.view.focus());
1143
+ }, he = (e) => {
1144
1144
  if (i || !R) return;
1145
1145
  let n = L.active && L.pos === R.pos;
1146
- yt(t, R.pos, e) && (e === "mermaid" && bt(t, R.pos, "preview") && r("preview"), b(!1), S(""), w(-1), I((e) => e + 1), n && t.view.focus());
1147
- }, _e = () => {
1146
+ zt(t, R.pos, e) && (e === "mermaid" && Bt(t, R.pos, "preview") && r("preview"), b(!1), S(""), w(-1), I((e) => e + 1), n && t.view.focus());
1147
+ }, ge = () => {
1148
1148
  let e = !y;
1149
- e && l.current === null && (l.current = on()), w(e ? bn(V, R?.language ?? null) : -1), b(e);
1150
- }, H = (e) => {
1151
- let t = hn(e);
1152
- S(e), w(bn(t, e.trim() ? null : R?.language ?? null));
1153
- }, ye = (e) => {
1149
+ e && l.current === null && (l.current = On()), w(e ? Hn(H, R?.language ?? null) : -1), b(e);
1150
+ }, _e = (e) => {
1151
+ let t = Ln(e);
1152
+ S(e), w(Hn(t, e.trim() ? null : R?.language ?? null));
1153
+ }, ve = (e) => {
1154
1154
  if (!e.nativeEvent.isComposing) {
1155
1155
  if (e.key === "ArrowDown" || e.key === "ArrowUp") {
1156
- e.preventDefault(), w((t) => En(t, V.length, e.key === "ArrowUp" ? "previous" : "next"));
1156
+ e.preventDefault(), w((t) => Jn(t, H.length, e.key === "ArrowUp" ? "previous" : "next"));
1157
1157
  return;
1158
1158
  }
1159
1159
  if (e.key === "Enter") {
1160
- let t = V[C];
1161
- t && (e.preventDefault(), ge(t.language));
1160
+ let t = H[C];
1161
+ t && (e.preventDefault(), he(t.language));
1162
1162
  return;
1163
1163
  }
1164
1164
  e.key === "Escape" && (e.preventDefault(), b(!1), w(-1), t.view.focus());
1165
1165
  }
1166
- }, be = V[C], xe = l.current && be ? gn(l.current, be.language) : void 0, Se = () => {
1167
- i || !R || vt(t, R.pos, !z) && (F((e) => e + 1), f(null));
1168
- }, Ce = () => {
1166
+ }, ye = H[C], be = l.current && ye ? Rn(l.current, ye.language) : void 0, xe = () => {
1167
+ i || !R || Rt(t, R.pos, !B) && (F((e) => e + 1), f(null));
1168
+ }, Se = () => {
1169
1169
  if (!R) return;
1170
- let e = Sn(t, R.pos);
1171
- e && en({
1170
+ let e = Wn(t, R.pos);
1171
+ e && Cn({
1172
1172
  data: new Blob([e], { type: "image/svg+xml" }),
1173
1173
  fileName: "markweave-mermaid.svg",
1174
1174
  onSettled: () => t.view.focus(),
1175
1175
  ownerDocument: document
1176
1176
  });
1177
- }, we = () => {
1177
+ }, Ce = () => {
1178
1178
  if (!R) return;
1179
- let e = Sn(t, R.pos);
1180
- e && (A(cn(e)), M(null), N(!1), u.current = {
1179
+ let e = Wn(t, R.pos);
1180
+ e && (A(An(e)), M(null), P(!1), u.current = {
1181
1181
  active: !1,
1182
1182
  lastX: 0,
1183
1183
  lastY: 0
1184
1184
  });
1185
- }, Te = () => {
1186
- A(null), M(null), N(!1), u.current = {
1185
+ }, we = () => {
1186
+ A(null), M(null), P(!1), u.current = {
1187
1187
  active: !1,
1188
1188
  lastX: 0,
1189
1189
  lastY: 0
1190
1190
  }, t.view.focus();
1191
- }, Ee = (e) => {
1191
+ }, Te = (e) => {
1192
1192
  A((t) => t && {
1193
1193
  ...t,
1194
- scale: nn(t.scale + e)
1194
+ scale: Tn(t.scale + e)
1195
1195
  });
1196
- }, De = () => {
1197
- A((e) => e && cn(e.svg)), u.current = {
1196
+ }, Ee = () => {
1197
+ A((e) => e && An(e.svg)), u.current = {
1198
1198
  active: !1,
1199
1199
  lastX: 0,
1200
1200
  lastY: 0
1201
- }, N(!1);
1201
+ }, P(!1);
1202
+ }, De = (e) => {
1203
+ e.preventDefault(), Te(e.deltaY < 0 ? qn : -qn);
1202
1204
  }, Oe = (e) => {
1203
- e.preventDefault(), Ee(e.deltaY < 0 ? Tn : -Tn);
1204
- }, ke = (e) => {
1205
1205
  e.button === 0 && (e.preventDefault(), u.current = {
1206
1206
  active: !0,
1207
1207
  lastX: e.clientX,
1208
1208
  lastY: e.clientY
1209
- }, N(!0));
1210
- }, Ae = (e) => {
1209
+ }, P(!0));
1210
+ }, ke = (e) => {
1211
1211
  let t = u.current;
1212
1212
  if (!t.active) return;
1213
1213
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -1215,13 +1215,13 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1215
1215
  active: !0,
1216
1216
  lastX: e.clientX,
1217
1217
  lastY: e.clientY
1218
- }, A((e) => Dn(e, n, r));
1219
- }, q = () => {
1218
+ }, A((e) => Yn(e, n, r));
1219
+ }, Ae = () => {
1220
1220
  u.current = {
1221
1221
  active: !1,
1222
1222
  lastX: 0,
1223
1223
  lastY: 0
1224
- }, N(!1);
1224
+ }, P(!1);
1225
1225
  };
1226
1226
  return /* @__PURE__ */ Q("div", {
1227
1227
  ref: a,
@@ -1229,7 +1229,7 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1229
1229
  "data-testid": "markweave-codeblock-overlay",
1230
1230
  "data-read-only": i ? "true" : "false",
1231
1231
  children: [
1232
- fe.map((e) => {
1232
+ ue.map((e) => {
1233
1233
  let t = h.find((t) => t.pos === e.pos);
1234
1234
  return /* @__PURE__ */ Z("div", {
1235
1235
  className: "markweave-mermaid-tabs",
@@ -1245,25 +1245,25 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1245
1245
  "data-testid": `markweave-mermaid-mode-${t}`,
1246
1246
  "data-active": e.mermaidPreviewMode === t,
1247
1247
  onMouseDown: (e) => e.preventDefault(),
1248
- onClick: () => he(e, t),
1248
+ onClick: () => me(e, t),
1249
1249
  children: t === "code" ? "Code" : "Preview"
1250
1250
  }, t))
1251
1251
  }, e.pos);
1252
1252
  }),
1253
- oe ? /* @__PURE__ */ Q("div", {
1253
+ ae ? /* @__PURE__ */ Q("div", {
1254
1254
  className: "markweave-codeblock-controls",
1255
1255
  "data-testid": "markweave-codeblock-controls",
1256
1256
  "data-positioned": p ? "true" : "false",
1257
- "data-collapsed": z ? "true" : "false",
1257
+ "data-collapsed": B ? "true" : "false",
1258
1258
  "data-read-only": i ? "true" : "false",
1259
1259
  "aria-label": "Code block controls",
1260
- style: pe,
1260
+ style: fe,
1261
1261
  children: [
1262
1262
  i ? /* @__PURE__ */ Z("span", {
1263
1263
  className: "markweave-codeblock-language-button markweave-codeblock-language-label",
1264
1264
  "aria-label": "Code block language",
1265
1265
  "data-testid": "markweave-codeblock-language",
1266
- children: /* @__PURE__ */ Z("span", { children: ce })
1266
+ children: /* @__PURE__ */ Z("span", { children: se })
1267
1267
  }) : /* @__PURE__ */ Q("button", {
1268
1268
  ref: o,
1269
1269
  type: "button",
@@ -1273,19 +1273,19 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1273
1273
  "aria-haspopup": "listbox",
1274
1274
  "data-testid": "markweave-codeblock-language",
1275
1275
  onMouseDown: (e) => e.preventDefault(),
1276
- onClick: _e,
1277
- children: [/* @__PURE__ */ Z("span", { children: ce }), /* @__PURE__ */ Z(Qr, { icon: "chevron" })]
1276
+ onClick: ge,
1277
+ children: [/* @__PURE__ */ Z("span", { children: se }), /* @__PURE__ */ Z(ki, { icon: "chevron" })]
1278
1278
  }),
1279
- se ? /* @__PURE__ */ Z("button", {
1279
+ oe ? /* @__PURE__ */ Z("button", {
1280
1280
  type: "button",
1281
1281
  className: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
1282
- "aria-label": z ? "Expand code block" : "Collapse code block",
1283
- title: z ? "Expand code block" : "Collapse code block",
1282
+ "aria-label": B ? "Expand code block" : "Collapse code block",
1283
+ title: B ? "Expand code block" : "Collapse code block",
1284
1284
  "data-testid": "markweave-codeblock-collapse",
1285
- "data-collapsed": z ? "true" : "false",
1285
+ "data-collapsed": B ? "true" : "false",
1286
1286
  onMouseDown: (e) => e.preventDefault(),
1287
- onClick: Se,
1288
- children: /* @__PURE__ */ Z(Qr, { icon: "chevron" })
1287
+ onClick: xe,
1288
+ children: /* @__PURE__ */ Z(ki, { icon: "chevron" })
1289
1289
  }) : null,
1290
1290
  /* @__PURE__ */ Q("span", {
1291
1291
  className: "markweave-codeblock-copy-wrap",
@@ -1294,14 +1294,14 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1294
1294
  className: "markweave-codeblock-icon-button",
1295
1295
  "aria-label": "Copy to clipboard",
1296
1296
  "data-testid": "markweave-codeblock-copy",
1297
- "data-copy-state": le,
1297
+ "data-copy-state": ce,
1298
1298
  onMouseDown: (e) => e.preventDefault(),
1299
1299
  onMouseEnter: () => O(!0),
1300
1300
  onMouseLeave: () => O(!1),
1301
1301
  onFocus: () => O(!0),
1302
1302
  onBlur: () => O(!1),
1303
- onClick: me,
1304
- children: /* @__PURE__ */ Z(Qr, { icon: le === "copied" ? "check" : "clipboard" })
1303
+ onClick: pe,
1304
+ children: /* @__PURE__ */ Z(ki, { icon: ce === "copied" ? "check" : "clipboard" })
1305
1305
  }), D ? /* @__PURE__ */ Z("span", {
1306
1306
  className: "markweave-codeblock-tooltip",
1307
1307
  role: "tooltip",
@@ -1309,7 +1309,7 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1309
1309
  children: "Copy to clipboard"
1310
1310
  }) : null]
1311
1311
  }),
1312
- ae && ue === "preview" ? /* @__PURE__ */ Q("div", {
1312
+ z && le === "preview" ? /* @__PURE__ */ Q("div", {
1313
1313
  className: "markweave-mermaid-preview-actions",
1314
1314
  "data-testid": "markweave-mermaid-preview-actions",
1315
1315
  children: [/* @__PURE__ */ Z("button", {
@@ -1317,24 +1317,24 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1317
1317
  className: "markweave-codeblock-icon-button",
1318
1318
  "aria-label": "Fullscreen Mermaid preview",
1319
1319
  "data-testid": "markweave-mermaid-fullscreen",
1320
- disabled: !de,
1320
+ disabled: !V,
1321
1321
  onMouseDown: (e) => e.preventDefault(),
1322
- onClick: we,
1323
- children: /* @__PURE__ */ Z(Qr, { icon: "expand" })
1322
+ onClick: Ce,
1323
+ children: /* @__PURE__ */ Z(ki, { icon: "expand" })
1324
1324
  }), /* @__PURE__ */ Z("button", {
1325
1325
  type: "button",
1326
1326
  className: "markweave-codeblock-icon-button",
1327
1327
  "aria-label": "Download Mermaid SVG",
1328
1328
  "data-testid": "markweave-mermaid-download",
1329
- disabled: !de,
1329
+ disabled: !V,
1330
1330
  onMouseDown: (e) => e.preventDefault(),
1331
- onClick: Ce,
1332
- children: /* @__PURE__ */ Z(Qr, { icon: "download" })
1331
+ onClick: Se,
1332
+ children: /* @__PURE__ */ Z(ki, { icon: "download" })
1333
1333
  })]
1334
1334
  }) : null
1335
1335
  ]
1336
1336
  }) : null,
1337
- se && oe && y ? /* @__PURE__ */ Q("div", {
1337
+ oe && ae && y ? /* @__PURE__ */ Q("div", {
1338
1338
  className: "markweave-codeblock-language-menu",
1339
1339
  "data-testid": "markweave-codeblock-language-menu",
1340
1340
  "data-positioned": _ ? "true" : "false",
@@ -1350,24 +1350,24 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1350
1350
  "aria-autocomplete": "list",
1351
1351
  "aria-controls": l.current ?? void 0,
1352
1352
  "aria-expanded": "true",
1353
- "aria-activedescendant": xe,
1353
+ "aria-activedescendant": be,
1354
1354
  "aria-label": "Search code block languages",
1355
1355
  value: x,
1356
1356
  placeholder: "Search...",
1357
1357
  "data-testid": "markweave-codeblock-language-search",
1358
- onChange: (e) => H(e.target.value),
1359
- onKeyDown: ye
1360
- }), /* @__PURE__ */ Z(Qr, { icon: "search" })]
1358
+ onChange: (e) => _e(e.target.value),
1359
+ onKeyDown: ve
1360
+ }), /* @__PURE__ */ Z(ki, { icon: "search" })]
1361
1361
  }), /* @__PURE__ */ Z("div", {
1362
1362
  ref: c,
1363
1363
  id: l.current ?? void 0,
1364
1364
  className: "markweave-codeblock-language-list",
1365
1365
  role: "listbox",
1366
1366
  "aria-label": "Code block languages",
1367
- children: V.map((e, t) => {
1367
+ children: H.map((e, t) => {
1368
1368
  let n = e.language === R.language, r = t === C;
1369
1369
  return /* @__PURE__ */ Q("button", {
1370
- id: l.current ? gn(l.current, e.language) : void 0,
1370
+ id: l.current ? Rn(l.current, e.language) : void 0,
1371
1371
  type: "button",
1372
1372
  role: "option",
1373
1373
  "aria-selected": n,
@@ -1377,8 +1377,8 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1377
1377
  "data-language-index": t,
1378
1378
  onMouseDown: (e) => e.preventDefault(),
1379
1379
  onMouseEnter: () => w(t),
1380
- onClick: () => ge(e.language),
1381
- children: [/* @__PURE__ */ Z("span", { children: e.label }), n ? /* @__PURE__ */ Z(Qr, { icon: "check" }) : null]
1380
+ onClick: () => he(e.language),
1381
+ children: [/* @__PURE__ */ Z("span", { children: e.label }), n ? /* @__PURE__ */ Z(ki, { icon: "check" }) : null]
1382
1382
  }, e.language);
1383
1383
  })
1384
1384
  })]
@@ -1403,13 +1403,13 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1403
1403
  onMouseLeave: () => M(null),
1404
1404
  onFocus: () => M("zoom-out"),
1405
1405
  onBlur: () => M(null),
1406
- onClick: () => Ee(-Tn),
1407
- children: /* @__PURE__ */ Z(Qr, { icon: "zoomOut" })
1406
+ onClick: () => Te(-qn),
1407
+ children: /* @__PURE__ */ Z(ki, { icon: "zoomOut" })
1408
1408
  }),
1409
1409
  /* @__PURE__ */ Z("span", {
1410
1410
  className: "markweave-mermaid-fullscreen-zoom-label",
1411
1411
  "data-testid": "markweave-mermaid-fullscreen-zoom-label",
1412
- children: fn(k.scale)
1412
+ children: Pn(k.scale)
1413
1413
  }),
1414
1414
  /* @__PURE__ */ Z("button", {
1415
1415
  type: "button",
@@ -1420,8 +1420,8 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1420
1420
  onMouseLeave: () => M(null),
1421
1421
  onFocus: () => M("zoom-in"),
1422
1422
  onBlur: () => M(null),
1423
- onClick: () => Ee(Tn),
1424
- children: /* @__PURE__ */ Z(Qr, { icon: "zoomIn" })
1423
+ onClick: () => Te(qn),
1424
+ children: /* @__PURE__ */ Z(ki, { icon: "zoomIn" })
1425
1425
  }),
1426
1426
  /* @__PURE__ */ Z("button", {
1427
1427
  type: "button",
@@ -1432,8 +1432,8 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1432
1432
  onMouseLeave: () => M(null),
1433
1433
  onFocus: () => M("reset"),
1434
1434
  onBlur: () => M(null),
1435
- onClick: De,
1436
- children: /* @__PURE__ */ Z(Qr, { icon: "reset" })
1435
+ onClick: Ee,
1436
+ children: /* @__PURE__ */ Z(ki, { icon: "reset" })
1437
1437
  }),
1438
1438
  j ? /* @__PURE__ */ Z("span", {
1439
1439
  className: "markweave-mermaid-fullscreen-tooltip",
@@ -1448,18 +1448,18 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1448
1448
  className: "markweave-mermaid-fullscreen-close",
1449
1449
  "aria-label": "Close fullscreen Mermaid preview",
1450
1450
  "data-testid": "markweave-mermaid-fullscreen-close",
1451
- onClick: Te,
1452
- children: /* @__PURE__ */ Z(Qr, { icon: "close" })
1451
+ onClick: we,
1452
+ children: /* @__PURE__ */ Z(ki, { icon: "close" })
1453
1453
  }),
1454
1454
  /* @__PURE__ */ Z("div", {
1455
1455
  className: "markweave-mermaid-fullscreen-viewport",
1456
1456
  "data-testid": "markweave-mermaid-fullscreen-viewport",
1457
- "data-dragging": ee ? "true" : "false",
1458
- onWheel: Oe,
1459
- onMouseDown: ke,
1460
- onMouseMove: Ae,
1461
- onMouseUp: q,
1462
- onMouseLeave: q,
1457
+ "data-dragging": N ? "true" : "false",
1458
+ onWheel: De,
1459
+ onMouseDown: Oe,
1460
+ onMouseMove: ke,
1461
+ onMouseUp: Ae,
1462
+ onMouseLeave: Ae,
1463
1463
  children: /* @__PURE__ */ Z("div", {
1464
1464
  className: "markweave-mermaid-fullscreen-content",
1465
1465
  "data-testid": "markweave-mermaid-fullscreen-content",
@@ -1480,25 +1480,25 @@ function $r({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
1480
1480
  }
1481
1481
  //#endregion
1482
1482
  //#region src/ui/floating-toolbar/FloatingToolbar.tsx
1483
- var ei = n("zh");
1484
- function ti() {
1483
+ var ji = n("zh");
1484
+ function Mi() {
1485
1485
  return typeof performance > "u" ? Date.now() : performance.now();
1486
1486
  }
1487
- function ni(e, t) {
1487
+ function Ni(e, t) {
1488
1488
  return {
1489
1489
  "--markweave-toolbar-motion-duration": `${e.motionDurationMs}ms`,
1490
1490
  "--markweave-toolbar-motion-easing": e.motionEasing,
1491
1491
  marginLeft: t === 0 ? void 0 : `${t}px`
1492
1492
  };
1493
1493
  }
1494
- function ri(e, t) {
1494
+ function Pi(e, t) {
1495
1495
  let n = e?.getBoundingClientRect().height ?? 0, r = t?.getBoundingClientRect().height ?? 0;
1496
1496
  return Math.max(n, r, 44);
1497
1497
  }
1498
- function ii(e) {
1498
+ function Fi(e) {
1499
1499
  if (e !== null) return { "--markweave-floating-toolbar-tooltip-left": `${e}px` };
1500
1500
  }
1501
- function ai(e, t, n, r) {
1501
+ function Ii(e, t, n, r) {
1502
1502
  let i = {
1503
1503
  bottom: t + r,
1504
1504
  height: r,
@@ -1514,26 +1514,26 @@ function ai(e, t, n, r) {
1514
1514
  toJSON: () => i
1515
1515
  };
1516
1516
  }
1517
- function oi(e) {
1517
+ function Li(e) {
1518
1518
  return e.width > 0 && e.height > 0;
1519
1519
  }
1520
- function si(e) {
1520
+ function Ri(e) {
1521
1521
  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));
1522
- return ai(t, n, r - t, i - n);
1522
+ return Ii(t, n, r - t, i - n);
1523
1523
  }
1524
- function ci(e, t) {
1524
+ function zi(e, t) {
1525
1525
  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;
1526
1526
  return r(t.anchorNode) && r(t.focusNode);
1527
1527
  }
1528
- function li(e) {
1528
+ function Bi(e) {
1529
1529
  if (typeof e.getClientRects != "function") return null;
1530
- let t = Array.from(e.getClientRects()).filter(oi).map((e) => ai(e.left, e.top, e.width, e.height));
1530
+ let t = Array.from(e.getClientRects()).filter(Li).map((e) => Ii(e.left, e.top, e.width, e.height));
1531
1531
  if (t.length > 0) return t;
1532
1532
  if (typeof e.getBoundingClientRect != "function") return null;
1533
1533
  let n = e.getBoundingClientRect();
1534
- return oi(n) ? [ai(n.left, n.top, n.width, n.height)] : null;
1534
+ return Li(n) ? [Ii(n.left, n.top, n.width, n.height)] : null;
1535
1535
  }
1536
- function ui(e, t) {
1536
+ function Vi(e, t) {
1537
1537
  if (t.rangeCount === 0) return null;
1538
1538
  let n = t.getRangeAt(0);
1539
1539
  try {
@@ -1546,8 +1546,8 @@ function ui(e, t) {
1546
1546
  return null;
1547
1547
  }
1548
1548
  }
1549
- function di(e, t) {
1550
- let n = ui(e, t);
1549
+ function Hi(e, t) {
1550
+ let n = Vi(e, t);
1551
1551
  if (!n) return !1;
1552
1552
  let { selection: r } = e.state, i = {
1553
1553
  from: Math.min(r.from, r.to),
@@ -1555,51 +1555,51 @@ function di(e, t) {
1555
1555
  };
1556
1556
  return n.from === i.from && n.to === i.to;
1557
1557
  }
1558
- function fi(e) {
1558
+ function Ui(e) {
1559
1559
  let t = e.view.dom.ownerDocument.getSelection();
1560
- return !t || t.rangeCount === 0 || t.isCollapsed || !ci(e, t) || !di(e, t) ? null : li(t.getRangeAt(0));
1560
+ return !t || t.rangeCount === 0 || t.isCollapsed || !zi(e, t) || !Hi(e, t) ? null : Bi(t.getRangeAt(0));
1561
1561
  }
1562
- function pi(e) {
1562
+ function Wi(e) {
1563
1563
  let { selection: t } = e.state;
1564
1564
  if (t.empty) return null;
1565
1565
  let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to);
1566
1566
  try {
1567
1567
  let t = e.view.domAtPos(n), i = e.view.domAtPos(r), a = e.view.dom.ownerDocument.createRange();
1568
- return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset), li(a);
1568
+ return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset), Bi(a);
1569
1569
  } catch {
1570
1570
  return null;
1571
1571
  }
1572
1572
  }
1573
- function mi(e) {
1573
+ function Gi(e) {
1574
1574
  let { selection: t } = e.state;
1575
1575
  if (t.empty) return null;
1576
- 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 = ai(c, o, Math.max(i.right, a.right) - c, s - o);
1577
- return oi(l) ? [l] : null;
1576
+ 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 = Ii(c, o, Math.max(i.right, a.right) - c, s - o);
1577
+ return Li(l) ? [l] : null;
1578
1578
  }
1579
- function hi(e) {
1580
- return fi(e) ?? pi(e) ?? mi(e);
1579
+ function Ki(e) {
1580
+ return Ui(e) ?? Wi(e) ?? Gi(e);
1581
1581
  }
1582
- function gi(e) {
1583
- let t = hi(e);
1584
- return t && t.length > 0 ? si(t) : null;
1582
+ function qi(e) {
1583
+ let t = Ki(e);
1584
+ return t && t.length > 0 ? Ri(t) : null;
1585
1585
  }
1586
- function _i(e) {
1586
+ function Ji(e) {
1587
1587
  return {
1588
- getBoundingClientRect: () => gi(e) ?? ai(0, 0, 0, 0),
1589
- getClientRects: () => hi(e) ?? []
1588
+ getBoundingClientRect: () => qi(e) ?? Ii(0, 0, 0, 0),
1589
+ getClientRects: () => Ki(e) ?? []
1590
1590
  };
1591
1591
  }
1592
- function vi(e) {
1592
+ function Yi(e) {
1593
1593
  return e === "block-type" || e === "link" || e === "color" || e === "more";
1594
1594
  }
1595
- function yi(e, t, n) {
1596
- n?.(Mn(e, t)), e.commands.focus();
1595
+ function Xi(e, t, n) {
1596
+ n?.($n(e, t)), e.commands.focus();
1597
1597
  }
1598
- function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelection: r }) {
1599
- let i = W(() => Ln(t), [t]), a = lt(n, { editable: e.isEditable }), [o, s] = K(a), [c, l] = K(null), [u, d] = K(null), [f, p] = K(null), [m, h] = K(""), [g, _] = K(""), [v, y] = K(null), [b, x] = K(0), [S, C] = K(a.boundaryPadding), [w, T] = K("bottom"), E = G(0), D = G(null), O = G(null), k = G(null), A = G(null), j = Nn(e, o.variant, t), M = zn(j.find((e) => e.id === c) ?? null), ee = Xn(m), N = H(() => {
1598
+ function Zi({ editor: e, messages: t = ji, selectionSnapshot: n, onRewriteSelection: r }) {
1599
+ let i = K(() => ir(t), [t]), a = kt(n, { editable: e.isEditable }), [o, s] = J(a), [c, l] = J(null), [u, d] = J(null), [f, p] = J(null), [m, h] = J(""), [g, _] = J(""), [v, y] = J(null), [b, x] = J(0), [S, C] = J(a.boundaryPadding), [w, T] = J("bottom"), E = q(0), D = q(null), O = q(null), k = q(null), A = q(null), j = er(e, o.variant, t), M = or(j.find((e) => e.id === c) ?? null), N = _r(m), P = U(() => {
1600
1600
  let t = D.current, n = e.view.dom.closest(".markweave-editor-frame");
1601
1601
  if (!t || !(n instanceof HTMLElement)) return;
1602
- let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = ri(t, O.current), s = E.current, c = it({
1602
+ let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = Pi(t, O.current), s = E.current, c = wt({
1603
1603
  toolbarRect: {
1604
1604
  left: r.left - s,
1605
1605
  top: r.top,
@@ -1613,7 +1613,7 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1613
1613
  height: i.height
1614
1614
  },
1615
1615
  boundaryPadding: o.boundaryPadding
1616
- }), l = ot({
1616
+ }), l = Et({
1617
1617
  frameRect: {
1618
1618
  left: i.left,
1619
1619
  top: i.top,
@@ -1632,16 +1632,16 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1632
1632
  e.view.dom,
1633
1633
  o.boundaryPadding,
1634
1634
  o.offset
1635
- ]), P = H(() => {
1635
+ ]), ee = U(() => {
1636
1636
  D.current && (D.current.style.visibility = "hidden", D.current.style.opacity = "0");
1637
- }, []), F = H(() => {
1638
- N();
1639
- }, [N]), te = H(() => _i(e), [e]), I = H((e) => {
1637
+ }, []), F = U(() => {
1638
+ P();
1639
+ }, [P]), te = U(() => Ji(e), [e]), I = U((e) => {
1640
1640
  k.current = e;
1641
- }, []), L = H(() => {
1641
+ }, []), L = U(() => {
1642
1642
  let t = D.current, n = k.current, r = e.view.dom.closest(".markweave-editor-frame");
1643
1643
  if (!f || !t || !n) return;
1644
- let i = t.getBoundingClientRect(), a = n.getBoundingClientRect(), s = r?.getBoundingClientRect() ?? null, c = at({
1644
+ let i = t.getBoundingClientRect(), a = n.getBoundingClientRect(), s = r?.getBoundingClientRect() ?? null, c = Tt({
1645
1645
  toolbarRect: i,
1646
1646
  popoverSize: a,
1647
1647
  viewport: {
@@ -1657,19 +1657,19 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1657
1657
  e.view.dom,
1658
1658
  f,
1659
1659
  o.boundaryPadding
1660
- ]), ne = W(() => ({
1661
- ...ct(o, { topBoundaryPadding: S }),
1662
- onShow: P,
1660
+ ]), ne = K(() => ({
1661
+ ...Ot(o, { topBoundaryPadding: S }),
1662
+ onShow: ee,
1663
1663
  onUpdate: F
1664
1664
  }), [
1665
- P,
1665
+ ee,
1666
1666
  F,
1667
1667
  o,
1668
1668
  S
1669
1669
  ]);
1670
- U(() => {
1671
- let e = ti();
1672
- s((t) => ft(t, a, e));
1670
+ W(() => {
1671
+ let e = Mi();
1672
+ s((t) => Mt(t, a, e));
1673
1673
  }, [
1674
1674
  a.hiddenReason,
1675
1675
  a.motionDurationMs,
@@ -1681,10 +1681,10 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1681
1681
  a.updateDelayMs,
1682
1682
  a.variant,
1683
1683
  a.visibility
1684
- ]), U(() => {
1684
+ ]), W(() => {
1685
1685
  if (o.motionStartedAtMs === null || o.motionDurationMs <= 0) return;
1686
- let e = Math.max(0, o.motionStartedAtMs + o.motionDurationMs - ti()), t = window.setTimeout(() => {
1687
- s((e) => nt(e, ti()));
1686
+ let e = Math.max(0, o.motionStartedAtMs + o.motionDurationMs - Mi()), t = window.setTimeout(() => {
1687
+ s((e) => St(e, Mi()));
1688
1688
  }, e);
1689
1689
  return () => {
1690
1690
  window.clearTimeout(t);
@@ -1693,17 +1693,17 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1693
1693
  o.motionDurationMs,
1694
1694
  o.motionPhase,
1695
1695
  o.motionStartedAtMs
1696
- ]), ve(() => {
1696
+ ]), G(() => {
1697
1697
  if (o.visibility !== "visible") {
1698
1698
  E.current = 0, D.current && (D.current.style.marginLeft = "", D.current.style.visibility = "hidden", D.current.style.opacity = "0"), x(0), C(o.boundaryPadding);
1699
1699
  return;
1700
1700
  }
1701
- let e = An(N);
1701
+ let e = mt(P);
1702
1702
  return e.schedule(), window.addEventListener("resize", e.schedule), window.addEventListener("scroll", e.schedule, !0), () => {
1703
1703
  e.cancel(), window.removeEventListener("resize", e.schedule), window.removeEventListener("scroll", e.schedule, !0);
1704
1704
  };
1705
1705
  }, [
1706
- N,
1706
+ P,
1707
1707
  e.view.dom,
1708
1708
  f,
1709
1709
  n?.from,
@@ -1711,20 +1711,20 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1711
1711
  o.variant,
1712
1712
  o.visibility,
1713
1713
  j.length
1714
- ]), ve(() => {
1714
+ ]), G(() => {
1715
1715
  if (!f) return;
1716
- let e = An(L);
1716
+ let e = mt(L);
1717
1717
  return e.schedule(), window.addEventListener("resize", e.schedule), window.addEventListener("scroll", e.schedule, !0), () => {
1718
1718
  e.cancel(), window.removeEventListener("resize", e.schedule), window.removeEventListener("scroll", e.schedule, !0);
1719
1719
  };
1720
- }, [f, L]), U(() => {
1720
+ }, [f, L]), W(() => {
1721
1721
  f === "more" && i.some((e) => e.id === c) || j.some((e) => e.id === c) || (l(null), d(null));
1722
1722
  }, [
1723
1723
  i,
1724
1724
  f,
1725
1725
  c,
1726
1726
  j
1727
- ]), U(() => {
1727
+ ]), W(() => {
1728
1728
  if (!f) return;
1729
1729
  let t = (e) => {
1730
1730
  O.current?.contains(e.target) || p(null);
@@ -1734,7 +1734,7 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1734
1734
  return document.addEventListener("pointerdown", t, !0), document.addEventListener("keydown", n, !0), () => {
1735
1735
  document.removeEventListener("pointerdown", t, !0), document.removeEventListener("keydown", n, !0);
1736
1736
  };
1737
- }, [e, f]), U(() => {
1737
+ }, [e, f]), W(() => {
1738
1738
  if (f !== "link") return;
1739
1739
  let e = window.requestAnimationFrame(() => {
1740
1740
  A.current?.focus(), A.current?.select();
@@ -1742,10 +1742,10 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1742
1742
  return () => window.cancelAnimationFrame(e);
1743
1743
  }, [f]);
1744
1744
  let re = (t) => {
1745
- if (vi(t.id)) {
1745
+ if (Yi(t.id)) {
1746
1746
  let n = t.id;
1747
1747
  if (n === "link") {
1748
- let t = Fn(e);
1748
+ let t = nr(e);
1749
1749
  h(t), _(t), y({
1750
1750
  from: Math.min(e.state.selection.from, e.state.selection.to),
1751
1751
  to: Math.max(e.state.selection.from, e.state.selection.to)
@@ -1755,7 +1755,7 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1755
1755
  return;
1756
1756
  }
1757
1757
  if (p(null), t.id === "improve") {
1758
- yi(e, "rewrite-selection", r);
1758
+ Xi(e, "rewrite-selection", r);
1759
1759
  return;
1760
1760
  }
1761
1761
  t.run(), e.commands.focus();
@@ -1763,15 +1763,15 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1763
1763
  p(null), e.commands.focus();
1764
1764
  }, ie = () => {
1765
1765
  v && e.commands.setTextSelection(v);
1766
- }, ae = () => {
1767
- ie(), jn(e, m) && R();
1768
1766
  }, z = () => {
1769
- if (ie(), Gn(e)) {
1767
+ ie(), Qn(e, m) && R();
1768
+ }, B = () => {
1769
+ if (ie(), fr(e)) {
1770
1770
  h(""), _(""), R();
1771
1771
  return;
1772
1772
  }
1773
1773
  m.trim() && h("");
1774
- }, oe = (e, t) => {
1774
+ }, ae = (e, t) => {
1775
1775
  if (l(e), !e || !t || !O.current) {
1776
1776
  d(null);
1777
1777
  return;
@@ -1779,7 +1779,7 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1779
1779
  let n = t.getBoundingClientRect(), r = O.current.getBoundingClientRect();
1780
1780
  d(n.left + n.width / 2 - r.left);
1781
1781
  };
1782
- return /* @__PURE__ */ Z(kn, {
1782
+ return /* @__PURE__ */ Z(Zn, {
1783
1783
  ref: D,
1784
1784
  editor: e,
1785
1785
  className: `markweave-floating-toolbar markweave-floating-toolbar--${o.variant} markweave-floating-toolbar--motion-${o.motionPhase}`,
@@ -1788,51 +1788,51 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1788
1788
  "data-boundary-padding": o.boundaryPadding,
1789
1789
  "data-popover-placement": f ? w : void 0,
1790
1790
  "data-testid": "markweave-floating-toolbar",
1791
- style: ni(o, b),
1791
+ style: Ni(o, b),
1792
1792
  updateDelay: 0,
1793
1793
  getReferencedVirtualElement: te,
1794
1794
  options: ne,
1795
- shouldShow: ({ editor: e }) => e.isEditable && dt(st(e)),
1795
+ shouldShow: ({ editor: e }) => e.isEditable && jt(Dt(e)),
1796
1796
  children: /* @__PURE__ */ Q("div", {
1797
1797
  ref: O,
1798
1798
  className: "markweave-floating-toolbar-content",
1799
1799
  "data-menu": f ?? "none",
1800
1800
  children: [
1801
- j.map((e, t) => /* @__PURE__ */ Z(Si, {
1801
+ j.map((e, t) => /* @__PURE__ */ Z($i, {
1802
1802
  button: e,
1803
1803
  expanded: f === e.id,
1804
1804
  showDivider: t > 0 && j[t - 1].group !== e.group,
1805
1805
  tooltipActive: c === e.id,
1806
- onPointerDown: Wn,
1807
- onTooltipChange: oe,
1806
+ onPointerDown: dr,
1807
+ onTooltipChange: ae,
1808
1808
  onRun: re
1809
1809
  }, e.id)),
1810
- f === "block-type" ? /* @__PURE__ */ Z(wi, {
1810
+ f === "block-type" ? /* @__PURE__ */ Z(ta, {
1811
1811
  editor: e,
1812
1812
  messages: t,
1813
1813
  onPopoverRef: I,
1814
1814
  onClose: () => p(null)
1815
1815
  }) : null,
1816
- f === "link" ? /* @__PURE__ */ Z(xi, {
1816
+ f === "link" ? /* @__PURE__ */ Z(Qi, {
1817
1817
  inputRef: A,
1818
1818
  messages: t,
1819
1819
  value: m,
1820
- canApply: !!ee,
1821
- canOpen: !!ee,
1820
+ canApply: !!N,
1821
+ canOpen: !!N,
1822
1822
  canRemove: !!(g || m.trim()),
1823
1823
  onValueChange: h,
1824
- onApply: ae,
1825
- onOpen: () => Un(m),
1826
- onRemove: z,
1824
+ onApply: z,
1825
+ onOpen: () => ur(m),
1826
+ onRemove: B,
1827
1827
  onPopoverRef: I
1828
1828
  }) : null,
1829
- f === "color" ? /* @__PURE__ */ Z(Ei, {
1829
+ f === "color" ? /* @__PURE__ */ Z(ra, {
1830
1830
  editor: e,
1831
1831
  messages: t,
1832
1832
  onPopoverRef: I,
1833
1833
  onClose: () => p(null)
1834
1834
  }) : null,
1835
- f === "more" ? /* @__PURE__ */ Z(Oi, {
1835
+ f === "more" ? /* @__PURE__ */ Z(aa, {
1836
1836
  editor: e,
1837
1837
  messages: t,
1838
1838
  activeTooltipId: c,
@@ -1846,15 +1846,15 @@ function bi({ editor: e, messages: t = ei, selectionSnapshot: n, onRewriteSelect
1846
1846
  "data-testid": "markweave-floating-toolbar-tooltip",
1847
1847
  "data-button-id": M.buttonId,
1848
1848
  "data-active": M.active,
1849
- style: ii(u),
1849
+ style: Fi(u),
1850
1850
  children: M.label
1851
1851
  }) : null
1852
1852
  ]
1853
1853
  })
1854
1854
  });
1855
1855
  }
1856
- function xi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRemove: a, onValueChange: o, onApply: s, onOpen: c, onRemove: l, onPopoverRef: u }) {
1857
- let d = In(t);
1856
+ function Qi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRemove: a, onValueChange: o, onApply: s, onOpen: c, onRemove: l, onPopoverRef: u }) {
1857
+ let d = rr(t);
1858
1858
  return /* @__PURE__ */ Q("form", {
1859
1859
  ref: u,
1860
1860
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
@@ -1877,7 +1877,7 @@ function xi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1877
1877
  "aria-label": d.applyLink,
1878
1878
  "data-testid": "markweave-floating-toolbar-link-apply",
1879
1879
  disabled: !r,
1880
- onMouseDown: Wn,
1880
+ onMouseDown: dr,
1881
1881
  children: /* @__PURE__ */ Z($, { name: "corner-down-left" })
1882
1882
  }),
1883
1883
  /* @__PURE__ */ Z("span", {
@@ -1889,7 +1889,7 @@ function xi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1889
1889
  "aria-label": d.openLink,
1890
1890
  "data-testid": "markweave-floating-toolbar-link-open",
1891
1891
  disabled: !i,
1892
- onMouseDown: Wn,
1892
+ onMouseDown: dr,
1893
1893
  onClick: c,
1894
1894
  children: /* @__PURE__ */ Z($, { name: "external-link" })
1895
1895
  }),
@@ -1898,7 +1898,7 @@ function xi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1898
1898
  "aria-label": d.removeLink,
1899
1899
  "data-testid": "markweave-floating-toolbar-link-remove",
1900
1900
  disabled: !a,
1901
- onMouseDown: Wn,
1901
+ onMouseDown: dr,
1902
1902
  onClick: l,
1903
1903
  children: /* @__PURE__ */ Z($, { name: "trash" })
1904
1904
  })
@@ -1906,15 +1906,15 @@ function xi({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
1906
1906
  })]
1907
1907
  });
1908
1908
  }
1909
- function Si({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointerDown: i, onTooltipChange: a, onRun: o }) {
1910
- return /* @__PURE__ */ Q(X, { children: [n ? /* @__PURE__ */ Z("span", {
1909
+ function $i({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointerDown: i, onTooltipChange: a, onRun: o }) {
1910
+ return /* @__PURE__ */ Q(ot, { children: [n ? /* @__PURE__ */ Z("span", {
1911
1911
  className: "markweave-floating-toolbar-divider",
1912
1912
  "aria-hidden": "true"
1913
1913
  }) : null, /* @__PURE__ */ Z("button", {
1914
1914
  type: "button",
1915
1915
  className: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${e.id}`,
1916
1916
  "aria-label": e.label,
1917
- "aria-expanded": vi(e.id) ? t : void 0,
1917
+ "aria-expanded": Yi(e.id) ? t : void 0,
1918
1918
  "data-active": e.active || t,
1919
1919
  "data-tooltip-active": r ? "true" : "false",
1920
1920
  "data-testid": `markweave-floating-toolbar-button-${e.id}`,
@@ -1924,13 +1924,13 @@ function Si({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointe
1924
1924
  onMouseEnter: (t) => a(e.id, t.currentTarget),
1925
1925
  onMouseLeave: () => a(null),
1926
1926
  onClick: () => o(e),
1927
- children: /* @__PURE__ */ Z(Ci, {
1927
+ children: /* @__PURE__ */ Z(ea, {
1928
1928
  button: e,
1929
1929
  expanded: t
1930
1930
  })
1931
1931
  })] });
1932
1932
  }
1933
- function Ci({ button: e, expanded: t }) {
1933
+ function ea({ button: e, expanded: t }) {
1934
1934
  return e.id === "improve" ? /* @__PURE__ */ Q("span", {
1935
1935
  className: "markweave-floating-toolbar-button-inner",
1936
1936
  children: [/* @__PURE__ */ Z($, { name: "sparkles" }), /* @__PURE__ */ Z("span", { children: e.glyph })]
@@ -1948,8 +1948,8 @@ function Ci({ button: e, expanded: t }) {
1948
1948
  }), /* @__PURE__ */ Z($, { name: t ? "chevron-up" : "chevron-down" })]
1949
1949
  }) : /* @__PURE__ */ Z($, { name: "more" });
1950
1950
  }
1951
- function wi({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1952
- let i = In(t), a = Bn(t);
1951
+ function ta({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1952
+ let i = rr(t), a = sr(t);
1953
1953
  return /* @__PURE__ */ Q("div", {
1954
1954
  ref: n,
1955
1955
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
@@ -1959,48 +1959,48 @@ function wi({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1959
1959
  children: i.turnIntoTitle
1960
1960
  }), a.map((t) => /* @__PURE__ */ Q("button", {
1961
1961
  type: "button",
1962
- "data-active": Hn(e, t.id),
1962
+ "data-active": lr(e, t.id),
1963
1963
  "data-testid": `markweave-floating-toolbar-turn-${t.id}`,
1964
- onMouseDown: Wn,
1964
+ onMouseDown: dr,
1965
1965
  onClick: () => {
1966
- Yn(e, t.id), r();
1966
+ gr(e, t.id), r();
1967
1967
  },
1968
1968
  children: [/* @__PURE__ */ Z("span", {
1969
1969
  className: "markweave-floating-toolbar-menu-icon",
1970
- children: /* @__PURE__ */ Z(Ti, { option: t })
1970
+ children: /* @__PURE__ */ Z(na, { option: t })
1971
1971
  }), /* @__PURE__ */ Z("span", { children: t.label })]
1972
1972
  }, t.id))]
1973
1973
  });
1974
1974
  }
1975
- function Ti({ option: e }) {
1975
+ function na({ option: e }) {
1976
1976
  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 });
1977
1977
  }
1978
- function Ei({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1979
- let i = In(t), a = e.getAttributes("textStyle").color, o = e.getAttributes("highlight").color;
1978
+ function ra({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
1979
+ let i = rr(t), a = e.getAttributes("textStyle").color, o = e.getAttributes("highlight").color;
1980
1980
  return /* @__PURE__ */ Q("div", {
1981
1981
  ref: n,
1982
1982
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
1983
1983
  "data-testid": "markweave-floating-toolbar-color-menu",
1984
- children: [/* @__PURE__ */ Z(Di, {
1984
+ children: [/* @__PURE__ */ Z(ia, {
1985
1985
  title: i.textColorTitle,
1986
1986
  mode: "text",
1987
1987
  activeColor: a ?? null,
1988
- options: Rn(t),
1988
+ options: ar(t),
1989
1989
  onSelect: (t) => {
1990
- Jn(e, t), r();
1990
+ hr(e, t), r();
1991
1991
  }
1992
- }), /* @__PURE__ */ Z(Di, {
1992
+ }), /* @__PURE__ */ Z(ia, {
1993
1993
  title: i.highlightColorTitle,
1994
1994
  mode: "highlight",
1995
1995
  activeColor: o ?? null,
1996
- options: Pn(t),
1996
+ options: tr(t),
1997
1997
  onSelect: (t) => {
1998
- qn(e, t), r();
1998
+ mr(e, t), r();
1999
1999
  }
2000
2000
  })]
2001
2001
  });
2002
2002
  }
2003
- function Di({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
2003
+ function ia({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
2004
2004
  return /* @__PURE__ */ Q("section", {
2005
2005
  className: "markweave-floating-toolbar-color-section",
2006
2006
  "aria-label": e,
@@ -2014,7 +2014,7 @@ function Di({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
2014
2014
  "aria-label": e.label,
2015
2015
  "data-active": e.value === n || e.value === null && !n,
2016
2016
  "data-testid": `markweave-floating-toolbar-${t}-${e.id}`,
2017
- onMouseDown: Wn,
2017
+ onMouseDown: dr,
2018
2018
  onClick: () => i(e.value),
2019
2019
  children: t === "text" ? /* @__PURE__ */ Z("span", {
2020
2020
  className: "markweave-floating-toolbar-text-swatch",
@@ -2029,26 +2029,26 @@ function Di({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
2029
2029
  })]
2030
2030
  });
2031
2031
  }
2032
- function Oi({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onTooltipChange: i, onClose: a }) {
2033
- let o = Ln(t);
2032
+ function aa({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onTooltipChange: i, onClose: a }) {
2033
+ let o = ir(t);
2034
2034
  return /* @__PURE__ */ Z("div", {
2035
2035
  ref: r,
2036
2036
  className: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
2037
2037
  "data-testid": "markweave-floating-toolbar-more-menu",
2038
- children: o.map((t, r) => /* @__PURE__ */ Z(ki, {
2038
+ children: o.map((t, r) => /* @__PURE__ */ Z(oa, {
2039
2039
  action: t,
2040
- active: Vn(e, t.id),
2040
+ active: cr(e, t.id),
2041
2041
  tooltipActive: n === t.id,
2042
2042
  showDivider: r > 0 && o[r - 1].group !== t.group,
2043
2043
  onTooltipChange: i,
2044
2044
  onRun: () => {
2045
- Kn(e, t.id), a();
2045
+ pr(e, t.id), a();
2046
2046
  }
2047
2047
  }, t.id))
2048
2048
  });
2049
2049
  }
2050
- function ki({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipChange: i, onRun: a }) {
2051
- return /* @__PURE__ */ Q(X, { children: [r ? /* @__PURE__ */ Z("span", {
2050
+ function oa({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipChange: i, onRun: a }) {
2051
+ return /* @__PURE__ */ Q(ot, { children: [r ? /* @__PURE__ */ Z("span", {
2052
2052
  className: "markweave-floating-toolbar-divider",
2053
2053
  "aria-hidden": "true"
2054
2054
  }) : null, /* @__PURE__ */ Q("span", {
@@ -2059,11 +2059,11 @@ function ki({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
2059
2059
  "data-active": t,
2060
2060
  "data-tooltip-active": n ? "true" : "false",
2061
2061
  "data-testid": `markweave-floating-toolbar-more-${e.id}`,
2062
- onMouseDown: Wn,
2062
+ onMouseDown: dr,
2063
2063
  onMouseEnter: () => i(e.id),
2064
2064
  onMouseLeave: () => i(null),
2065
2065
  onClick: a,
2066
- children: /* @__PURE__ */ Z(Ai, { id: e.id })
2066
+ children: /* @__PURE__ */ Z(sa, { id: e.id })
2067
2067
  }), n ? /* @__PURE__ */ Z("div", {
2068
2068
  className: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2069
2069
  role: "tooltip",
@@ -2071,41 +2071,41 @@ function ki({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
2071
2071
  }) : null]
2072
2072
  })] });
2073
2073
  }
2074
- function Ai({ id: e }) {
2074
+ function sa({ id: e }) {
2075
2075
  return e === "superscript" ? /* @__PURE__ */ Z($, { name: "superscript" }) : e === "subscript" ? /* @__PURE__ */ Z($, { name: "subscript" }) : e === "inline-math" ? /* @__PURE__ */ Z($, { name: "math" }) : Z($, { name: e });
2076
2076
  }
2077
- var ji = {
2078
- sparkles: le,
2079
- "chevron-down": v,
2080
- "chevron-up": y,
2081
- "corner-down-left": C,
2082
- "external-link": T,
2083
- bold: p,
2084
- italic: P,
2085
- underline: he,
2086
- strike: ue,
2087
- "inline-code": x,
2088
- link: te,
2089
- more: R,
2090
- text: me,
2091
- "bullet-list": I,
2092
- "numbered-list": ne,
2093
- "todo-list": L,
2094
- quote: z,
2095
- "code-block": m,
2096
- superscript: fe,
2097
- subscript: de,
2098
- math: se,
2077
+ var ca = {
2078
+ sparkles: Se,
2079
+ "chevron-down": j,
2080
+ "chevron-up": N,
2081
+ "corner-down-left": te,
2082
+ "external-link": L,
2083
+ bold: E,
2084
+ italic: ce,
2085
+ underline: Ne,
2086
+ strike: we,
2087
+ "inline-code": ee,
2088
+ link: V,
2089
+ more: pe,
2090
+ text: Me,
2091
+ "bullet-list": ue,
2092
+ "numbered-list": H,
2093
+ "todo-list": de,
2094
+ quote: ve,
2095
+ "code-block": D,
2096
+ superscript: Ee,
2097
+ subscript: Te,
2098
+ math: be,
2099
2099
  "align-left": d,
2100
2100
  "align-center": l,
2101
2101
  "align-right": f,
2102
2102
  "align-justify": u,
2103
- "decrease-indent": M,
2104
- "increase-indent": ee,
2105
- trash: pe
2103
+ "decrease-indent": ae,
2104
+ "increase-indent": oe,
2105
+ trash: je
2106
2106
  };
2107
2107
  function $({ name: e }) {
2108
- let t = ji[e];
2108
+ let t = ca[e];
2109
2109
  return /* @__PURE__ */ Z(t, {
2110
2110
  "aria-hidden": "true",
2111
2111
  absoluteStrokeWidth: !0,
@@ -2115,24 +2115,24 @@ function $({ name: e }) {
2115
2115
  }
2116
2116
  //#endregion
2117
2117
  //#region src/ui/math/MathEditorPopover.tsx
2118
- function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2119
- let i = G(null), a = G(null), [o, s] = K(r.latex), [c, l] = K(null), u = t.math, d = W(() => kt(e, r) ?? 1, [e, r]), f = W(() => At(e, r), [e, r]), p = W(() => o === r.latex && f ? {
2118
+ function la({ editor: e, messages: t, onClose: n, target: r }) {
2119
+ let i = q(null), a = q(null), [o, s] = J(r.latex), [c, l] = J(null), u = t.math, d = K(() => Yt(e, r) ?? 1, [e, r]), f = K(() => Xt(e, r), [e, r]), p = K(() => o === r.latex && f ? {
2120
2120
  html: f,
2121
2121
  error: !1
2122
- } : Pt(o, r.kind, e), [
2122
+ } : en(o, r.kind, e), [
2123
2123
  e,
2124
2124
  f,
2125
2125
  r.kind,
2126
2126
  r.latex,
2127
2127
  o
2128
- ]), m = o.trim().length > 0, h = H(() => {
2128
+ ]), m = o.trim().length > 0, h = U(() => {
2129
2129
  if (typeof window > "u") return;
2130
- let t = Ot(e, r), i = e.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2130
+ let t = Jt(e, r), i = e.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2131
2131
  if (!t || !i) {
2132
2132
  n();
2133
2133
  return;
2134
2134
  }
2135
- l(Dt({
2135
+ l(qt({
2136
2136
  anchorRect: t,
2137
2137
  frameRect: i,
2138
2138
  kind: r.kind,
@@ -2146,58 +2146,58 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2146
2146
  r,
2147
2147
  o
2148
2148
  ]);
2149
- U(() => {
2149
+ W(() => {
2150
2150
  s(r.latex);
2151
- }, [r.latex, r.pos]), U(() => {
2152
- Ft(e, r, !0), h();
2151
+ }, [r.latex, r.pos]), W(() => {
2152
+ tn(e, r, !0), h();
2153
2153
  let t = window.requestAnimationFrame(() => {
2154
2154
  a.current?.focus({ preventScroll: !0 }), a.current?.select(), h();
2155
2155
  });
2156
2156
  return window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), () => {
2157
- window.cancelAnimationFrame(t), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0), Ft(e, r, !1);
2157
+ window.cancelAnimationFrame(t), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0), tn(e, r, !1);
2158
2158
  };
2159
2159
  }, [
2160
2160
  e,
2161
2161
  n,
2162
2162
  r,
2163
2163
  h
2164
- ]), U(() => {
2164
+ ]), W(() => {
2165
2165
  let e = (e) => {
2166
2166
  let t = e.target;
2167
2167
  t instanceof Node && (i.current?.contains(t) || t instanceof Element && t.closest(".tiptap-mathematics-render") || n());
2168
2168
  };
2169
2169
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
2170
2170
  }, [n]);
2171
- let _ = H(() => {
2172
- m && Et(e, r, o) && n();
2171
+ let g = U(() => {
2172
+ m && Kt(e, r, o) && n();
2173
2173
  }, [
2174
2174
  m,
2175
2175
  e,
2176
2176
  n,
2177
2177
  r,
2178
2178
  o
2179
- ]), v = (t) => {
2179
+ ]), _ = (t) => {
2180
2180
  if (t.key === "Escape") {
2181
2181
  t.preventDefault(), n(), e.commands.focus();
2182
2182
  return;
2183
2183
  }
2184
- t.key === "Enter" && (r.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), _());
2185
- }, y = c ? {
2184
+ t.key === "Enter" && (r.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), g());
2185
+ }, v = c ? {
2186
2186
  left: c.left,
2187
2187
  top: c.top,
2188
2188
  width: c.width
2189
- } : void 0, b = r.kind === "block" ? u.blockTitle : u.inlineTitle;
2189
+ } : void 0, y = r.kind === "block" ? u.blockTitle : u.inlineTitle;
2190
2190
  return r.kind === "inline" ? /* @__PURE__ */ Q("form", {
2191
2191
  ref: i,
2192
- "aria-label": b,
2192
+ "aria-label": y,
2193
2193
  className: "markweave-math-editor-popover markweave-math-editor-popover--inline",
2194
2194
  "data-kind": "inline",
2195
2195
  "data-placement": c?.placement ?? "bottom",
2196
2196
  "data-testid": "markweave-math-editor-popover",
2197
2197
  onSubmit: (e) => {
2198
- e.preventDefault(), _();
2198
+ e.preventDefault(), g();
2199
2199
  },
2200
- style: y,
2200
+ style: v,
2201
2201
  children: [/* @__PURE__ */ Q("label", {
2202
2202
  className: "markweave-math-inline-source",
2203
2203
  "data-testid": "markweave-math-inline-source",
@@ -2211,7 +2211,7 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2211
2211
  "aria-label": u.latexLabel,
2212
2212
  "data-testid": "markweave-math-editor-input",
2213
2213
  onChange: (e) => s(e.currentTarget.value),
2214
- onKeyDown: v,
2214
+ onKeyDown: _,
2215
2215
  placeholder: u.latexPlaceholder,
2216
2216
  size: Math.max(o.length, 1),
2217
2217
  spellCheck: !1,
@@ -2230,21 +2230,21 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2230
2230
  })]
2231
2231
  }) : /* @__PURE__ */ Q("form", {
2232
2232
  ref: i,
2233
- "aria-label": b,
2233
+ "aria-label": y,
2234
2234
  className: "markweave-math-editor-popover markweave-math-editor-popover--block",
2235
2235
  "data-kind": r.kind,
2236
2236
  "data-placement": c?.placement ?? "bottom",
2237
2237
  "data-testid": "markweave-math-editor-popover",
2238
2238
  onSubmit: (e) => {
2239
- e.preventDefault(), _();
2239
+ e.preventDefault(), g();
2240
2240
  },
2241
- style: y,
2241
+ style: v,
2242
2242
  children: [
2243
2243
  /* @__PURE__ */ Q("div", {
2244
2244
  className: "markweave-math-block-toolbar",
2245
2245
  children: [
2246
2246
  /* @__PURE__ */ Z("span", { children: u.label }),
2247
- /* @__PURE__ */ Z(x, {
2247
+ /* @__PURE__ */ Z(ee, {
2248
2248
  "aria-hidden": "true",
2249
2249
  size: 15,
2250
2250
  strokeWidth: 1.75
@@ -2255,7 +2255,7 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2255
2255
  disabled: !m,
2256
2256
  title: u.apply,
2257
2257
  type: "submit",
2258
- children: /* @__PURE__ */ Z(g, {
2258
+ children: /* @__PURE__ */ Z(k, {
2259
2259
  "aria-hidden": "true",
2260
2260
  size: 16,
2261
2261
  strokeWidth: 2
@@ -2276,7 +2276,7 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2276
2276
  "aria-label": u.latexLabel,
2277
2277
  "data-testid": "markweave-math-editor-input",
2278
2278
  onChange: (e) => s(e.currentTarget.value),
2279
- onKeyDown: v,
2279
+ onKeyDown: _,
2280
2280
  placeholder: u.latexPlaceholder,
2281
2281
  rows: 3,
2282
2282
  spellCheck: !1,
@@ -2300,31 +2300,31 @@ function Mi({ editor: e, messages: t, onClose: n, target: r }) {
2300
2300
  }
2301
2301
  //#endregion
2302
2302
  //#region src/ui/slash-command/SlashCommandMenu.tsx
2303
- var Ni = n("zh"), Pi = {
2304
- type: V,
2305
- "heading-1": D,
2306
- "heading-2": O,
2307
- "heading-3": k,
2308
- "bullet-list": I,
2309
- "ordered-list": ne,
2310
- "task-list": L,
2311
- blockquote: z,
2312
- "code-block": m,
2313
- info: N,
2314
- tip: F,
2303
+ var ua = n("zh"), da = {
2304
+ type: Ae,
2305
+ "heading-1": re,
2306
+ "heading-2": R,
2307
+ "heading-3": ie,
2308
+ "bullet-list": ue,
2309
+ "ordered-list": H,
2310
+ "task-list": de,
2311
+ blockquote: ve,
2312
+ "code-block": D,
2313
+ info: se,
2314
+ tip: le,
2315
2315
  warning: c,
2316
- error: b,
2317
- success: _,
2318
- emoji: ce,
2319
- math: se,
2320
- table: B,
2321
- separator: re,
2322
- image: A,
2323
- video: _e,
2324
- attachment: ie
2316
+ error: P,
2317
+ success: A,
2318
+ emoji: xe,
2319
+ math: be,
2320
+ table: De,
2321
+ separator: fe,
2322
+ image: z,
2323
+ video: Fe,
2324
+ attachment: he
2325
2325
  };
2326
- function Fi({ name: e }) {
2327
- let t = Pi[e];
2326
+ function fa({ name: e }) {
2327
+ let t = da[e];
2328
2328
  return /* @__PURE__ */ Z(t, {
2329
2329
  "aria-hidden": "true",
2330
2330
  absoluteStrokeWidth: !0,
@@ -2332,8 +2332,8 @@ function Fi({ name: e }) {
2332
2332
  strokeWidth: 1.6
2333
2333
  });
2334
2334
  }
2335
- function Ii(e, t, n) {
2336
- return !Vt(e) || !n ? {
2335
+ function pa(e, t, n) {
2336
+ return !cn(e) || !n ? {
2337
2337
  visible: !1,
2338
2338
  empty: !1,
2339
2339
  activeIndex: -1
@@ -2347,17 +2347,17 @@ function Ii(e, t, n) {
2347
2347
  activeIndex: Math.min(t.length - 1, Math.max(0, e.activeIndex))
2348
2348
  };
2349
2349
  }
2350
- function Li(e, t) {
2350
+ function ma(e, t) {
2351
2351
  return Object.values(t.slash.groups).map((t) => ({
2352
2352
  group: t,
2353
2353
  commands: e.filter((e) => e.group === t)
2354
2354
  })).filter((e) => e.commands.length > 0);
2355
2355
  }
2356
- function Ri(e, t) {
2356
+ function ha(e, t) {
2357
2357
  return t.slash.uploadKindLabels[e] ?? t.slash.uploadKindLabels.upload;
2358
2358
  }
2359
- function zi({ command: e, messages: t, onBack: n, onSelect: r }) {
2360
- let [i, a] = K(""), [o, s] = K(0), c = W(() => {
2359
+ function ga({ command: e, messages: t, onBack: n, onSelect: r }) {
2360
+ let [i, a] = J(""), [o, s] = J(0), c = K(() => {
2361
2361
  let e = i.trim().toLowerCase();
2362
2362
  return (e ? t.slash.emojiItems.filter((t) => [
2363
2363
  t.emoji,
@@ -2423,9 +2423,9 @@ function zi({ command: e, messages: t, onBack: n, onSelect: r }) {
2423
2423
  ]
2424
2424
  });
2425
2425
  }
2426
- function Bi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2427
- let a = e.uploadKind ?? "attachment", [o, s] = K(""), [c, l] = K(null), [u, d] = K(null), [f, p] = K(!1), m = async (t) => {
2428
- r(e, { uploadResult: await Se({
2426
+ function _a({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2427
+ let a = e.uploadKind ?? "attachment", [o, s] = J(""), [c, l] = J(null), [u, d] = J(null), [f, p] = J(!1), m = async (t) => {
2428
+ r(e, { uploadResult: await Y({
2429
2429
  kind: a,
2430
2430
  source: t,
2431
2431
  trigger: "slash-command"
@@ -2445,7 +2445,7 @@ function Bi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2445
2445
  d(t.slash.uploadRequiredError);
2446
2446
  return;
2447
2447
  }
2448
- await m(be(o));
2448
+ await m(Le(o));
2449
2449
  } catch (e) {
2450
2450
  d(e instanceof Error ? e.message : t.slash.uploadFailedError);
2451
2451
  } finally {
@@ -2463,7 +2463,7 @@ function Bi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2463
2463
  onMouseDown: (e) => e.preventDefault(),
2464
2464
  onClick: n,
2465
2465
  children: t.common.back
2466
- }), /* @__PURE__ */ Z("span", { children: Ri(a, t) })]
2466
+ }), /* @__PURE__ */ Z("span", { children: ha(a, t) })]
2467
2467
  }),
2468
2468
  /* @__PURE__ */ Q("label", {
2469
2469
  className: "markweave-slash-upload-field",
@@ -2511,10 +2511,10 @@ function Bi({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
2511
2511
  ]
2512
2512
  });
2513
2513
  }
2514
- function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand: i, onActiveIndexChange: a, onInputCommandChange: o, onSelect: s, onUpload: c }) {
2515
- let l = Ii(n, e, r);
2514
+ function va({ commands: e, messages: t = ua, state: n, position: r, inputCommand: i, onActiveIndexChange: a, onInputCommandChange: o, onSelect: s, onUpload: c }) {
2515
+ let l = pa(n, e, r);
2516
2516
  if (!l.visible || !r) return null;
2517
- let u = Li(e, t), d = {
2517
+ let u = ma(e, t), d = {
2518
2518
  left: r.left,
2519
2519
  top: r.top,
2520
2520
  maxHeight: r.maxHeight,
@@ -2523,7 +2523,7 @@ function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand
2523
2523
  left: r.triggerLeft,
2524
2524
  top: r.triggerTop
2525
2525
  }, p = (e) => o?.(e), m = () => o?.(null);
2526
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Q("div", {
2526
+ return /* @__PURE__ */ Q(ot, { children: [/* @__PURE__ */ Q("div", {
2527
2527
  className: "markweave-slash-trigger",
2528
2528
  style: f,
2529
2529
  "aria-hidden": "true",
@@ -2536,12 +2536,12 @@ function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand
2536
2536
  "aria-label": t.slash.ariaLabel,
2537
2537
  "data-placement": r.placement,
2538
2538
  "data-testid": "markweave-slash-menu",
2539
- children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(zi, {
2539
+ children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(ga, {
2540
2540
  command: i,
2541
2541
  messages: t,
2542
2542
  onBack: m,
2543
2543
  onSelect: s
2544
- }) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(Bi, {
2544
+ }) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(_a, {
2545
2545
  command: i,
2546
2546
  messages: t,
2547
2547
  onBack: m,
@@ -2561,7 +2561,7 @@ function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand
2561
2561
  className: "markweave-slash-group-title",
2562
2562
  children: t.group
2563
2563
  }), t.commands.map((t) => {
2564
- let n = e.indexOf(t), r = n === l.activeIndex, i = zt(t), o = !!t.disabled;
2564
+ let n = e.indexOf(t), r = n === l.activeIndex, i = on(t), o = !!t.disabled;
2565
2565
  return /* @__PURE__ */ Q("button", {
2566
2566
  type: "button",
2567
2567
  role: "option",
@@ -2585,7 +2585,7 @@ function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand
2585
2585
  }
2586
2586
  },
2587
2587
  children: [
2588
- /* @__PURE__ */ Z(Fi, { name: t.icon }),
2588
+ /* @__PURE__ */ Z(fa, { name: t.icon }),
2589
2589
  /* @__PURE__ */ Z("span", { children: t.label }),
2590
2590
  o && t.disabledReason ? /* @__PURE__ */ Z("small", { children: t.disabledReason }) : null
2591
2591
  ]
@@ -2597,42 +2597,93 @@ function Vi({ commands: e, messages: t = Ni, state: n, position: r, inputCommand
2597
2597
  }
2598
2598
  //#endregion
2599
2599
  //#region src/ui/table/TableControls.tsx
2600
- var Hi = n("zh");
2601
- function Ui({ active: e, editor: t, interactionState: n = Qt, messages: r = Hi, onCopyPayload: i, onCommandResult: a, onEditWithAi: o }) {
2602
- let [s, c] = K(null), [l, u] = K("row-edge"), [d, f] = K(null), [p, m] = K(null), [h, g] = K(null), [_, v] = K(null), [y, b] = K(null), x = G(null), S = G(null), C = G(null), w = G(null), T = G(null), E = e ? Xt(t.state) : null;
2603
- if (U(() => {
2604
- if (!y) return;
2600
+ var ya = n("zh"), ba = {
2601
+ "move-left": v,
2602
+ "move-right": y,
2603
+ "move-up": b,
2604
+ "move-down": g,
2605
+ "insert-left": T,
2606
+ "insert-right": w,
2607
+ "insert-above": C,
2608
+ "insert-below": S,
2609
+ "sort-asc": _,
2610
+ "sort-desc": x,
2611
+ color: me,
2612
+ alignment: d,
2613
+ clear: Ce,
2614
+ duplicate: F,
2615
+ copy: F,
2616
+ merge: Oe,
2617
+ split: ke,
2618
+ delete: je
2619
+ }, xa = {
2620
+ left: d,
2621
+ center: l,
2622
+ right: f,
2623
+ top: h,
2624
+ middle: p,
2625
+ bottom: m
2626
+ };
2627
+ function Sa({ active: e, editor: t, interactionState: n = xn, messages: r = ya, onCopyPayload: i, onCommandResult: a, onEditWithAi: o }) {
2628
+ let [s, c] = J(null), [l, u] = J(null), [d, f] = J("row-edge"), [p, m] = J(null), [h, g] = J(null), [_, v] = J(null), [y, b] = J(null), [x, S] = J(null), [C, w] = J(null), [, T] = J(0), E = q(null), D = q(null), [O, k] = J(null), A = q(null), j = q(null), N = q(null), P = q(null), ee = q(null), F = e ? yn(t.state) : null;
2629
+ if (W(() => {
2630
+ if (!O) return;
2605
2631
  let e = window.setTimeout(() => {
2606
- b(null);
2607
- }, mr);
2632
+ k(null);
2633
+ }, Hr);
2608
2634
  return () => {
2609
2635
  window.clearTimeout(e);
2610
2636
  };
2611
- }, [y]), ve(() => {
2637
+ }, [O]), W(() => {
2638
+ let e = (e) => {
2639
+ let n = E.current;
2640
+ if (!n) return;
2641
+ let r = kr(t, n.axis, e.clientX, e.clientY);
2642
+ r !== null && (e.preventDefault(), D.current = r, e.dataTransfer && (e.dataTransfer.dropEffect = "move"));
2643
+ }, n = (e) => {
2644
+ let n = E.current;
2645
+ if (!n) return;
2646
+ let r = kr(t, n.axis, e.clientX, e.clientY) ?? D.current;
2647
+ e.preventDefault(), E.current = null, D.current = null, r !== null && zr(t, n.axis, n.index, r);
2648
+ };
2649
+ return document.addEventListener("dragover", e), document.addEventListener("drop", n), () => {
2650
+ document.removeEventListener("dragover", e), document.removeEventListener("drop", n);
2651
+ };
2652
+ }, [t]), G(() => {
2612
2653
  if (!e) {
2613
- m(null), g(null), v(null), b(null);
2654
+ g(null), v(null), b(null), S(null), w(null), k(null);
2614
2655
  return;
2615
2656
  }
2616
2657
  let r = () => {
2617
- let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = or(t, n, "row", E?.activeCellPos ?? null), i = or(t, n, "column", E?.activeCellPos ?? null), a = r ? ar(t, r) : null, o = i ? ar(t, i) : null, c = ir(t).length > 0 ? dr(t) : null;
2658
+ let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = Mr(t, n, "row", F?.activeCellPos ?? null), i = Mr(t, n, "column", F?.activeCellPos ?? null), a = r ? jr(t, r) : null, o = i ? jr(t, i) : null, c = Ir(t, "selection").length > 0 ? Lr(t) : null, l = Or(t)?.getBoundingClientRect() ?? null;
2618
2659
  if (!e) {
2619
- m(null), g(null), v(null);
2660
+ g(null), v(null), b(null), S(null), w(null);
2620
2661
  return;
2621
2662
  }
2622
2663
  let u = e.getBoundingClientRect();
2623
- a ? m($n({
2664
+ a ? g(Cr({
2624
2665
  targetRect: a,
2625
2666
  frameRect: u,
2626
2667
  kind: "row"
2627
- })) : s === "row" && l === "row-edge" || m(null), o ? g($n({
2668
+ })) : s === "row" && d === "row-edge" || g(null), o ? v(Cr({
2628
2669
  targetRect: o,
2629
2670
  frameRect: u,
2630
2671
  kind: "column"
2631
- })) : s === "column" && l === "column-edge" || g(null), c ? v($n({
2672
+ })) : s === "column" && d === "column-edge" || v(null), c ? b(Cr({
2632
2673
  targetRect: c,
2633
2674
  frameRect: u,
2634
2675
  kind: "selection"
2635
- })) : s === "selection" && l === "selection-edge" || v(null);
2676
+ })) : s === "selection" && d === "selection-edge" || b(null);
2677
+ let f = n.hoverCellPos !== null && !!(r && r.index === r.visualHeight - 1), p = n.hoverCellPos !== null && !!(i && i.index === i.visualWidth - 1);
2678
+ S(l && f ? wr({
2679
+ tableRect: l,
2680
+ frameRect: u,
2681
+ kind: "row"
2682
+ }) : null), w(l && p ? wr({
2683
+ tableRect: l,
2684
+ frameRect: u,
2685
+ kind: "column"
2686
+ }) : null);
2636
2687
  };
2637
2688
  return r(), window.addEventListener("resize", r), window.addEventListener("scroll", r, !0), () => {
2638
2689
  window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
@@ -2640,40 +2691,40 @@ function Ui({ active: e, editor: t, interactionState: n = Qt, messages: r = Hi,
2640
2691
  }, [
2641
2692
  e,
2642
2693
  t,
2643
- E?.activeCellPos,
2644
- E?.selectionFrom,
2645
- E?.selectionTo,
2694
+ F?.activeCellPos,
2695
+ F?.selectionFrom,
2696
+ F?.selectionTo,
2646
2697
  n.hoverCellPos,
2647
2698
  n.hoverVisualColumnIndex,
2648
2699
  n.hoverVisualRowIndex,
2649
- l,
2700
+ d,
2650
2701
  s
2651
- ]), ve(() => {
2702
+ ]), G(() => {
2652
2703
  if (!e || !s) {
2653
- f(null);
2704
+ m(null);
2654
2705
  return;
2655
2706
  }
2656
2707
  let n = () => {
2657
- 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;
2708
+ let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = d === "row-edge" ? N.current : d === "column-edge" ? P.current : ee.current, r = j.current;
2658
2709
  if (!e || !n || !r) {
2659
- f(null);
2710
+ m(null);
2660
2711
  return;
2661
2712
  }
2662
- let i = n.getBoundingClientRect(), a = s === "row" ? rr(t)?.getBoundingClientRect() : null, o = a ? {
2713
+ let i = n.getBoundingClientRect(), a = s === "row" ? Or(t)?.getBoundingClientRect() : null, o = a ? {
2663
2714
  left: i.left,
2664
2715
  top: a.top,
2665
2716
  width: i.width,
2666
2717
  height: i.height
2667
- } : i, c = e.getBoundingClientRect(), u = r.getBoundingClientRect(), d = Qn({
2718
+ } : i, c = e.getBoundingClientRect(), l = r.getBoundingClientRect(), u = Sr({
2668
2719
  anchorRect: o,
2669
2720
  frameRect: c,
2670
2721
  menuSize: {
2671
- width: u.width || 204,
2672
- height: u.height || 220
2722
+ width: l.width || 254,
2723
+ height: l.height || 410
2673
2724
  },
2674
2725
  kind: s
2675
2726
  });
2676
- f(d);
2727
+ m(u);
2677
2728
  };
2678
2729
  return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
2679
2730
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
@@ -2681,17 +2732,23 @@ function Ui({ active: e, editor: t, interactionState: n = Qt, messages: r = Hi,
2681
2732
  }, [
2682
2733
  e,
2683
2734
  t,
2684
- l,
2735
+ d,
2685
2736
  s,
2686
- p,
2687
2737
  h,
2688
- _
2689
- ]), U(() => {
2738
+ _,
2739
+ y
2740
+ ]), W(() => {
2690
2741
  if (!e || !s) return;
2691
2742
  let n = (e) => {
2692
- e.key === "Escape" && (c(null), t.view.focus());
2743
+ if (e.key === "Escape") {
2744
+ if (l) {
2745
+ u(null);
2746
+ return;
2747
+ }
2748
+ c(null), u(null), t.view.focus();
2749
+ }
2693
2750
  }, r = (e) => {
2694
- e.target instanceof Node && x.current?.contains(e.target) || c(null);
2751
+ e.target instanceof Node && A.current?.contains(e.target) || (c(null), u(null));
2695
2752
  };
2696
2753
  return document.addEventListener("keydown", n), document.addEventListener("mousedown", r), () => {
2697
2754
  document.removeEventListener("keydown", n), document.removeEventListener("mousedown", r);
@@ -2699,171 +2756,366 @@ function Ui({ active: e, editor: t, interactionState: n = Qt, messages: r = Hi,
2699
2756
  }, [
2700
2757
  e,
2701
2758
  t,
2702
- s
2759
+ s,
2760
+ l
2703
2761
  ]), !e) return null;
2704
- let D = (e, t) => {
2705
- let n = s === e && l === t;
2706
- u(t), c(n ? null : e);
2707
- }, O = () => {
2708
- t.view.dispatch(Zn(t.state.tr, null));
2709
- }, k = (e, r) => {
2710
- let i = n.hoverCellPos ?? E?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
2711
- i !== null && pr(t, i, e, { visualIndex: a }), D(e, r);
2712
- }, A = () => {
2713
- O(), D("selection", "selection-edge");
2714
- }, j = or(t, n, "row", E?.activeCellPos ?? null), M = or(t, n, "column", E?.activeCellPos ?? null), ee = ir(t).length > 0, N = s ? ur(t, s) : [], P = async (e, n) => {
2715
- let o = await tr({
2762
+ let te = (e, t) => {
2763
+ let n = s === e && d === t;
2764
+ f(t), c(n ? null : e), u(null);
2765
+ }, I = () => {
2766
+ t.view.dispatch(vr(t.state.tr, null));
2767
+ }, L = (e, r) => {
2768
+ let i = n.hoverCellPos ?? F?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
2769
+ i !== null && Br(t, i, e, { visualIndex: a }), te(e, r);
2770
+ }, ne = () => {
2771
+ I(), te("selection", "selection-edge");
2772
+ }, re = Mr(t, n, "row", F?.activeCellPos ?? null), R = Mr(t, n, "column", F?.activeCellPos ?? null), ie = Ir(t, "selection").length > 0, z = s ? Ir(t, s) : [], B = async (e, n) => {
2773
+ let o = await Er({
2716
2774
  editor: t,
2717
2775
  commandId: e,
2718
2776
  menu: n ?? s ?? "selection",
2719
2777
  messages: r
2720
2778
  });
2721
- return o.copyFeedback ? (b(o.copyFeedback), o.copyPayload && i?.(o.copyPayload)) : b(null), a?.(o.commandResult), o.success;
2722
- }, F = (e) => {
2723
- let n = sr(t, e);
2724
- n && o?.(n), c(null), t.view.focus();
2725
- };
2779
+ return o.copyFeedback ? (k(o.copyFeedback), o.copyPayload && i?.(o.copyPayload)) : k(null), a?.(o.commandResult), o.success;
2780
+ }, ae = (e) => {
2781
+ let n = Nr(t, e);
2782
+ n && o?.(n), c(null), u(null), t.view.focus();
2783
+ }, oe = (e) => {
2784
+ s !== "row" && s !== "column" || e(s) && T((e) => e + 1);
2785
+ }, se = (e) => {
2786
+ let r = e === "row" ? re : R, i = n.hoverCellPos ?? F?.activeCellPos ?? null;
2787
+ !r || i === null || Kr(t, i, e, { visualIndex: r.index }) && B(e === "row" ? "add-row-after" : "add-column-after", e);
2788
+ }, ce = (e, t, n) => {
2789
+ E.current = {
2790
+ axis: e,
2791
+ index: t
2792
+ }, D.current = t, n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData("application/x-markweave-table-axis", `${e}:${t}`);
2793
+ }, le = (e) => {
2794
+ let t = e.currentTarget, n = Array.from(t.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), r = n.indexOf(document.activeElement);
2795
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
2796
+ e.preventDefault(), e.stopPropagation();
2797
+ let t = e.key === "ArrowDown" ? 1 : -1;
2798
+ n[r < 0 ? 0 : Math.min(n.length - 1, Math.max(0, r + t))]?.focus();
2799
+ }
2800
+ }, V = s === "row" || s === "column" ? Ar(t, s) : null;
2726
2801
  return /* @__PURE__ */ Q("div", {
2727
- ref: x,
2802
+ ref: A,
2728
2803
  className: "markweave-table-controls",
2729
2804
  "data-testid": "markweave-table-controls",
2730
2805
  "aria-label": r.table.controlsAriaLabel,
2731
2806
  "data-open-menu": s ?? "none",
2732
- "data-positioned": p || h || _ ? "true" : "false",
2807
+ "data-positioned": h || _ || y ? "true" : "false",
2808
+ onMouseLeave: () => {
2809
+ t.view.dispatch(t.state.tr.setMeta(Sn, { type: "clear-hover" }));
2810
+ },
2733
2811
  children: [
2734
- y ? /* @__PURE__ */ Z("div", {
2812
+ O ? /* @__PURE__ */ Z("div", {
2735
2813
  className: "markweave-table-copy-feedback",
2736
2814
  role: "status",
2737
2815
  "aria-live": "polite",
2738
2816
  "data-testid": "markweave-table-copy-feedback",
2739
- "data-copy-kind": y.kind,
2740
- "data-text-length": y.textLength,
2741
- "data-html-length": y.htmlLength,
2742
- children: nr(y)
2817
+ "data-copy-kind": O.kind,
2818
+ "data-text-length": O.textLength,
2819
+ "data-html-length": O.htmlLength,
2820
+ children: Dr(O)
2743
2821
  }) : null,
2744
- p ? /* @__PURE__ */ Z("button", {
2822
+ h ? /* @__PURE__ */ Z("button", {
2745
2823
  type: "button",
2746
- ref: C,
2824
+ ref: N,
2747
2825
  className: "markweave-table-edge-handle markweave-table-edge-handle--row",
2748
2826
  "aria-label": r.table.activeRowActions,
2749
- "aria-expanded": s === "row" && l === "row-edge",
2827
+ "aria-expanded": s === "row" && d === "row-edge",
2750
2828
  "aria-haspopup": "menu",
2751
2829
  title: r.table.rowActions,
2752
2830
  "data-testid": "markweave-table-hover-row-handle",
2753
- "data-axis-index": j?.index ?? "",
2754
- "data-axis-selected-cells": j?.selectedCellCount ?? "",
2755
- "data-axis-visual-cells": j?.visualCellCount ?? "",
2756
- "data-axis-visual-size": j?.visualHeight ?? "",
2831
+ "data-axis-index": re?.index ?? "",
2832
+ "data-axis-selected-cells": re?.selectedCellCount ?? "",
2833
+ "data-axis-visual-cells": re?.visualCellCount ?? "",
2834
+ "data-axis-visual-size": re?.visualHeight ?? "",
2757
2835
  style: {
2758
- left: p.left,
2759
- top: p.top
2836
+ left: h.left,
2837
+ top: h.top,
2838
+ width: h.width,
2839
+ height: h.height
2840
+ },
2841
+ draggable: !0,
2842
+ onDragStart: (e) => ce("row", re?.index ?? 0, e),
2843
+ onDragEnd: () => {
2844
+ E.current = null, D.current = null;
2760
2845
  },
2761
- onMouseDown: (e) => e.preventDefault(),
2762
2846
  onClick: () => {
2763
- k("row", "row-edge");
2847
+ L("row", "row-edge");
2764
2848
  },
2765
- children: /* @__PURE__ */ Z("span", {
2849
+ children: /* @__PURE__ */ Z(pe, {
2766
2850
  "aria-hidden": "true",
2767
- children: "..."
2851
+ size: 14
2768
2852
  })
2769
2853
  }) : null,
2770
- h ? /* @__PURE__ */ Z("button", {
2854
+ _ ? /* @__PURE__ */ Z("button", {
2771
2855
  type: "button",
2772
- ref: w,
2856
+ ref: P,
2773
2857
  className: "markweave-table-edge-handle markweave-table-edge-handle--column",
2774
2858
  "aria-label": r.table.activeColumnActions,
2775
- "aria-expanded": s === "column" && l === "column-edge",
2859
+ "aria-expanded": s === "column" && d === "column-edge",
2776
2860
  "aria-haspopup": "menu",
2777
2861
  title: r.table.columnActions,
2778
2862
  "data-testid": "markweave-table-hover-column-handle",
2779
- "data-axis-index": M?.index ?? "",
2780
- "data-axis-selected-cells": M?.selectedCellCount ?? "",
2781
- "data-axis-visual-cells": M?.visualCellCount ?? "",
2782
- "data-axis-visual-size": M?.visualWidth ?? "",
2863
+ "data-axis-index": R?.index ?? "",
2864
+ "data-axis-selected-cells": R?.selectedCellCount ?? "",
2865
+ "data-axis-visual-cells": R?.visualCellCount ?? "",
2866
+ "data-axis-visual-size": R?.visualWidth ?? "",
2783
2867
  style: {
2784
- left: h.left,
2785
- top: h.top
2868
+ left: _.left,
2869
+ top: _.top,
2870
+ width: _.width,
2871
+ height: _.height
2872
+ },
2873
+ draggable: !0,
2874
+ onDragStart: (e) => ce("column", R?.index ?? 0, e),
2875
+ onDragEnd: () => {
2876
+ E.current = null, D.current = null;
2786
2877
  },
2787
- onMouseDown: (e) => e.preventDefault(),
2788
2878
  onClick: () => {
2789
- k("column", "column-edge");
2879
+ L("column", "column-edge");
2880
+ },
2881
+ children: /* @__PURE__ */ Z(pe, {
2882
+ "aria-hidden": "true",
2883
+ size: 14
2884
+ })
2885
+ }) : null,
2886
+ x ? /* @__PURE__ */ Z("button", {
2887
+ type: "button",
2888
+ className: "markweave-table-extend-button markweave-table-extend-button--row",
2889
+ "aria-label": r.table.addRow,
2890
+ title: r.table.addRow,
2891
+ "data-testid": "markweave-table-add-row",
2892
+ style: {
2893
+ left: x.left,
2894
+ top: x.top,
2895
+ width: x.width,
2896
+ height: x.height
2897
+ },
2898
+ onMouseDown: (e) => e.preventDefault(),
2899
+ onClick: () => se("row"),
2900
+ children: /* @__PURE__ */ Z(_e, {
2901
+ "aria-hidden": "true",
2902
+ size: 16
2903
+ })
2904
+ }) : null,
2905
+ C ? /* @__PURE__ */ Z("button", {
2906
+ type: "button",
2907
+ className: "markweave-table-extend-button markweave-table-extend-button--column",
2908
+ "aria-label": r.table.addColumn,
2909
+ title: r.table.addColumn,
2910
+ "data-testid": "markweave-table-add-column",
2911
+ style: {
2912
+ left: C.left,
2913
+ top: C.top,
2914
+ width: C.width,
2915
+ height: C.height
2790
2916
  },
2791
- children: /* @__PURE__ */ Z("span", {
2917
+ onMouseDown: (e) => e.preventDefault(),
2918
+ onClick: () => se("column"),
2919
+ children: /* @__PURE__ */ Z(_e, {
2792
2920
  "aria-hidden": "true",
2793
- children: "..."
2921
+ size: 16
2794
2922
  })
2795
2923
  }) : null,
2796
- ee && _ ? /* @__PURE__ */ Z("button", {
2924
+ ie && y ? /* @__PURE__ */ Z("button", {
2797
2925
  type: "button",
2798
- ref: T,
2926
+ ref: ee,
2799
2927
  className: "markweave-table-edge-handle markweave-table-edge-handle--selection",
2800
2928
  "aria-label": r.table.selectionActions,
2801
- "aria-expanded": s === "selection" && l === "selection-edge",
2929
+ "aria-expanded": s === "selection" && d === "selection-edge",
2802
2930
  "aria-haspopup": "menu",
2803
2931
  title: r.table.selectionActions,
2804
2932
  "data-testid": "markweave-table-cell-handle",
2805
2933
  style: {
2806
- left: _.left,
2807
- top: _.top
2934
+ left: y.left,
2935
+ top: y.top,
2936
+ width: y.width,
2937
+ height: y.height
2808
2938
  },
2809
2939
  onMouseDown: (e) => e.preventDefault(),
2810
- onClick: A,
2811
- children: /* @__PURE__ */ Z("span", {
2940
+ onClick: ne,
2941
+ children: /* @__PURE__ */ Z(pe, {
2812
2942
  "aria-hidden": "true",
2813
- children: "..."
2943
+ size: 14
2814
2944
  })
2815
2945
  }) : null,
2816
- s ? /* @__PURE__ */ Z("div", {
2817
- ref: S,
2946
+ s ? /* @__PURE__ */ Q("div", {
2947
+ ref: j,
2818
2948
  className: "markweave-table-menu",
2819
2949
  role: "menu",
2820
- "aria-label": hr(s, r),
2950
+ "aria-label": Wr(s, r),
2821
2951
  "data-testid": "markweave-table-menu",
2822
- "data-positioned": d ? "true" : "false",
2823
- style: d ? {
2824
- left: d.left,
2825
- top: d.top
2952
+ "data-positioned": p ? "true" : "false",
2953
+ "data-submenu": l ?? "none",
2954
+ style: p ? {
2955
+ left: p.left,
2956
+ top: p.top
2826
2957
  } : void 0,
2827
- children: N.map((e, n) => {
2828
- let i = cr(e), a = n === 0 ? i : cr(N[n - 1]), l = n > 0 && a !== i, u = e.commandId === null ? !!o : er(t, e.commandId), d = lr(e, r);
2829
- return /* @__PURE__ */ Z("button", {
2830
- type: "button",
2831
- role: "menuitem",
2832
- "aria-label": d,
2833
- "aria-disabled": !u,
2834
- disabled: !u,
2835
- "data-menu-group": i,
2836
- "data-starts-group": l ? "true" : "false",
2837
- "data-command-enabled": u ? "true" : "false",
2838
- "data-testid": e.commandId ? `markweave-table-menu-command-${e.commandId}` : "markweave-table-menu-command-edit-with-ai",
2839
- onMouseDown: (e) => e.preventDefault(),
2840
- onClick: () => {
2841
- if (u) {
2842
- if (e.commandId === null) {
2843
- F(s === "row" || s === "column" ? s : "selection");
2844
- return;
2958
+ onKeyDown: le,
2959
+ children: [
2960
+ z.map((e, n) => {
2961
+ let i = Pr(e), a = n === 0 ? i : Pr(z[n - 1]), d = n > 0 && a !== i, f = e.submenuId ? !0 : e.commandId === null ? !!o : Tr(t, e.commandId), p = Fr(e, r), m = ba[e.icon];
2962
+ return /* @__PURE__ */ Q("button", {
2963
+ type: "button",
2964
+ role: "menuitem",
2965
+ "aria-label": p,
2966
+ "aria-disabled": !f,
2967
+ "aria-haspopup": e.submenuId ? "menu" : void 0,
2968
+ "aria-expanded": e.submenuId ? l === e.submenuId : void 0,
2969
+ disabled: !f,
2970
+ "data-menu-group": i,
2971
+ "data-starts-group": d ? "true" : "false",
2972
+ "data-command-enabled": f ? "true" : "false",
2973
+ "data-submenu-trigger": e.submenuId ?? void 0,
2974
+ "data-testid": e.commandId ? `markweave-table-menu-command-${e.commandId}` : e.submenuId ? `markweave-table-menu-submenu-${e.submenuId}` : "markweave-table-menu-command-edit-with-ai",
2975
+ onMouseDown: (e) => e.preventDefault(),
2976
+ onMouseEnter: () => u(e.submenuId),
2977
+ onClick: () => {
2978
+ if (f) {
2979
+ if (e.submenuId) {
2980
+ u(e.submenuId);
2981
+ return;
2982
+ }
2983
+ if (e.commandId === null) {
2984
+ ae(s === "row" || s === "column" ? s : "selection");
2985
+ return;
2986
+ }
2987
+ B(e.commandId).finally(() => {
2988
+ c(null), u(null);
2989
+ });
2845
2990
  }
2846
- P(e.commandId).finally(() => c(null));
2847
- }
2848
- },
2849
- children: d
2850
- }, `${e.id}-${n}`);
2851
- })
2991
+ },
2992
+ children: [
2993
+ /* @__PURE__ */ Z("span", {
2994
+ className: "markweave-table-menu-item-icon",
2995
+ "aria-hidden": "true",
2996
+ children: /* @__PURE__ */ Z(m, {
2997
+ size: 18,
2998
+ strokeWidth: 1.8
2999
+ })
3000
+ }),
3001
+ /* @__PURE__ */ Z("span", {
3002
+ className: "markweave-table-menu-item-label",
3003
+ children: p
3004
+ }),
3005
+ e.submenuId ? /* @__PURE__ */ Z(M, {
3006
+ className: "markweave-table-menu-chevron",
3007
+ "aria-hidden": "true",
3008
+ size: 16
3009
+ }) : null
3010
+ ]
3011
+ }, `${e.id}-${n}`);
3012
+ }),
3013
+ l === "color" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
3014
+ className: "markweave-table-submenu markweave-table-color-menu",
3015
+ role: "menu",
3016
+ "aria-label": r.table.submenus.color,
3017
+ "data-testid": "markweave-table-color-menu",
3018
+ onKeyDown: le,
3019
+ children: [
3020
+ /* @__PURE__ */ Z("div", {
3021
+ className: "markweave-table-submenu-title",
3022
+ children: r.table.submenus.textColor
3023
+ }),
3024
+ Vr.map((e) => /* @__PURE__ */ Q("button", {
3025
+ type: "button",
3026
+ role: "menuitemradio",
3027
+ "aria-checked": V?.textColorId === e.id,
3028
+ "data-active": V?.textColorId === e.id ? "true" : "false",
3029
+ "data-testid": `markweave-table-text-color-${e.id}`,
3030
+ onMouseDown: (e) => e.preventDefault(),
3031
+ onClick: () => oe((n) => xr(t, n, e.id)),
3032
+ children: [/* @__PURE__ */ Z("span", {
3033
+ className: "markweave-table-color-swatch markweave-table-text-color-swatch",
3034
+ "aria-hidden": "true",
3035
+ style: { backgroundColor: e.textColor ?? "var(--markweave-text)" }
3036
+ }), /* @__PURE__ */ Z("span", { children: r.table.colors[e.id].text })]
3037
+ }, `text-${e.id}`)),
3038
+ /* @__PURE__ */ Z("div", { className: "markweave-table-submenu-separator" }),
3039
+ /* @__PURE__ */ Z("div", {
3040
+ className: "markweave-table-submenu-title",
3041
+ children: r.table.submenus.backgroundColor
3042
+ }),
3043
+ Vr.map((e) => /* @__PURE__ */ Q("button", {
3044
+ type: "button",
3045
+ role: "menuitemradio",
3046
+ "aria-checked": V?.backgroundColorId === e.id,
3047
+ "data-active": V?.backgroundColorId === e.id ? "true" : "false",
3048
+ "data-testid": `markweave-table-background-color-${e.id}`,
3049
+ onMouseDown: (e) => e.preventDefault(),
3050
+ onClick: () => oe((n) => br(t, n, e.id)),
3051
+ children: [/* @__PURE__ */ Z("span", {
3052
+ className: "markweave-table-color-swatch",
3053
+ "aria-hidden": "true",
3054
+ style: { backgroundColor: e.backgroundColor }
3055
+ }), /* @__PURE__ */ Z("span", { children: r.table.colors[e.id].background })]
3056
+ }, `background-${e.id}`))
3057
+ ]
3058
+ }) : null,
3059
+ l === "alignment" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
3060
+ className: "markweave-table-submenu markweave-table-alignment-menu",
3061
+ role: "menu",
3062
+ "aria-label": r.table.submenus.alignment,
3063
+ "data-testid": "markweave-table-alignment-menu",
3064
+ onKeyDown: le,
3065
+ children: [
3066
+ Ur.map((e) => {
3067
+ let n = xa[e], i = V?.textAlign === e;
3068
+ return /* @__PURE__ */ Q("button", {
3069
+ type: "button",
3070
+ role: "menuitemradio",
3071
+ "aria-checked": i,
3072
+ "data-active": i ? "true" : "false",
3073
+ "data-testid": `markweave-table-alignment-${e}`,
3074
+ onMouseDown: (e) => e.preventDefault(),
3075
+ onClick: () => oe((n) => yr(t, n, e)),
3076
+ children: [/* @__PURE__ */ Z(n, {
3077
+ "aria-hidden": "true",
3078
+ size: 18,
3079
+ strokeWidth: 1.8
3080
+ }), /* @__PURE__ */ Z("span", { children: r.table.alignments[e] })]
3081
+ }, e);
3082
+ }),
3083
+ /* @__PURE__ */ Z("div", { className: "markweave-table-submenu-separator" }),
3084
+ Gr.map((e) => {
3085
+ let n = xa[e], i = V?.verticalAlign === e;
3086
+ return /* @__PURE__ */ Q("button", {
3087
+ type: "button",
3088
+ role: "menuitemradio",
3089
+ "aria-checked": i,
3090
+ "data-active": i ? "true" : "false",
3091
+ "data-testid": `markweave-table-alignment-${e}`,
3092
+ onMouseDown: (e) => e.preventDefault(),
3093
+ onClick: () => oe((n) => yr(t, n, e)),
3094
+ children: [/* @__PURE__ */ Z(n, {
3095
+ "aria-hidden": "true",
3096
+ size: 18,
3097
+ strokeWidth: 1.8
3098
+ }), /* @__PURE__ */ Z("span", { children: r.table.alignments[e] })]
3099
+ }, e);
3100
+ })
3101
+ ]
3102
+ }) : null
3103
+ ]
2852
3104
  }) : null
2853
3105
  ]
2854
3106
  });
2855
3107
  }
2856
3108
  //#endregion
2857
3109
  //#region src/ui/table/TableSelectionOverlay.tsx
2858
- function Wi({ editor: e, focusState: t }) {
2859
- let [n, r] = K(null);
2860
- return ve(() => {
3110
+ function Ca({ editor: e, focusState: t }) {
3111
+ let [n, r] = J(null);
3112
+ return G(() => {
2861
3113
  if (t.mode !== "cell-selection") {
2862
3114
  r(null);
2863
3115
  return;
2864
3116
  }
2865
3117
  let n = () => {
2866
- r(fr(e, Zt(e.state)));
3118
+ r(Rr(e, bn(e.state)));
2867
3119
  };
2868
3120
  return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
2869
3121
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
@@ -2898,16 +3150,16 @@ function Wi({ editor: e, focusState: t }) {
2898
3150
  }
2899
3151
  //#endregion
2900
3152
  //#region src/ui/toc/MarkweaveInnerToc.tsx
2901
- function Gi(e, t) {
3153
+ function wa(e, t) {
2902
3154
  return `${e.toc.itemAriaLabel}: ${t.text}`;
2903
3155
  }
2904
- function Ki({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2905
- let a = G(null);
2906
- if (U(() => {
2907
- if (!(i !== "container" || !a.current)) return Sr(a.current);
3156
+ function Ta({ editor: e, state: t, messages: n, editable: r, placement: i }) {
3157
+ let a = q(null);
3158
+ if (W(() => {
3159
+ if (!(i !== "container" || !a.current)) return $r(a.current);
2908
3160
  }, [i]), !t.items.length) return null;
2909
3161
  let o = (t) => {
2910
- Cr(e, t, {
3162
+ ei(e, t, {
2911
3163
  behavior: "smooth",
2912
3164
  focus: r
2913
3165
  });
@@ -2934,7 +3186,7 @@ function Ki({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2934
3186
  "data-level": e.level,
2935
3187
  "data-active": e.active ? "true" : "false",
2936
3188
  "aria-current": e.active ? "location" : void 0,
2937
- "aria-label": Gi(n, e),
3189
+ "aria-label": wa(n, e),
2938
3190
  title: e.text,
2939
3191
  onClick: () => o(e),
2940
3192
  children: e.text
@@ -2945,7 +3197,7 @@ function Ki({ editor: e, state: t, messages: n, editable: r, placement: i }) {
2945
3197
  }
2946
3198
  //#endregion
2947
3199
  //#region src/MarkweaveEditor.tsx
2948
- var qi = {
3200
+ var Ea = {
2949
3201
  active: !1,
2950
3202
  mode: "outside",
2951
3203
  activeCellPos: null,
@@ -2953,21 +3205,21 @@ var qi = {
2953
3205
  selectedCellCount: 0,
2954
3206
  selectionFrom: 0,
2955
3207
  selectionTo: 0
2956
- }, Ji = {
3208
+ }, Da = {
2957
3209
  active: !1,
2958
- language: _t.defaultLanguage,
3210
+ language: Lt.defaultLanguage,
2959
3211
  mermaidPreviewMode: "code",
2960
3212
  pos: null,
2961
3213
  text: ""
2962
- }, Yi = Tt({
3214
+ }, Oa = Gt({
2963
3215
  active: !1,
2964
3216
  mode: "code",
2965
3217
  source: ""
2966
3218
  });
2967
- function Xi(e) {
2968
- return $t.getState(e.state) ?? Qt;
3219
+ function ka(e) {
3220
+ return Sn.getState(e.state) ?? xn;
2969
3221
  }
2970
- function Zi(e) {
3222
+ function Aa(e) {
2971
3223
  if (!e || typeof window > "u") return null;
2972
3224
  let t = e.parentElement;
2973
3225
  for (; t;) {
@@ -2977,95 +3229,100 @@ function Zi(e) {
2977
3229
  }
2978
3230
  return null;
2979
3231
  }
2980
- function Qi(e) {
3232
+ function ja(e) {
2981
3233
  return typeof window > "u" || typeof window.requestAnimationFrame != "function" ? globalThis.setTimeout(() => e(0), 0) : window.requestAnimationFrame(e);
2982
3234
  }
2983
- function $i(e) {
3235
+ function Ma(e) {
2984
3236
  if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
2985
3237
  window.cancelAnimationFrame(e);
2986
3238
  return;
2987
3239
  }
2988
3240
  globalThis.clearTimeout(e);
2989
3241
  }
2990
- function ea({ 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, canvasColor: _, onEditWithAi: v, onExtractToNote: y, onRewriteSelection: b, onRuntimeStateChange: x, onSearchControllerChange: S, onSlashCommandUpload: C, onTableCommandResult: w, onTableCopyPayload: T, onTocChange: E, onUpdate: D, linkCardResolver: O, resolveMediaSource: k } = {}) {
2991
- let A = Le(h), j = Tr(g), M = wr(_), ee = xr(p), N = A === "live" && d !== !1, P = $e(o === void 0 ? u : c), F = o ?? l, te = typeof F == "string" && F.length >= 2e5, I = o === void 0 && P === "markdown" && te && typeof F == "string", L = G(I ? F : null), [ne, re] = K(I), R = G({
3242
+ function Na({ 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, canvasColor: _, onEditWithAi: v, onExtractToNote: y, onRewriteSelection: b, onRuntimeStateChange: x, onSearchControllerChange: S, onSlashCommandUpload: C, onTableCommandResult: w, onTableCopyPayload: T, onTocChange: E, onUpdate: D, linkCardResolver: O, resolveMediaSource: k } = {}) {
3243
+ let A = et(h), j = ni(g), M = ti(_), N = Qr(p), P = A === "live" && d !== !1, ee = yt(o === void 0 ? u : c), F = o ?? l, te = typeof F == "string" && F.length >= 2e5, I = o === void 0 && ee === "markdown" && te && typeof F == "string", L = q(I ? F : null), [ne, re] = J(I), R = q({
2992
3244
  editorMode: A,
2993
- effectiveEditable: N
3245
+ effectiveEditable: P
2994
3246
  });
2995
3247
  R.current = {
2996
3248
  editorMode: A,
2997
- effectiveEditable: N
3249
+ effectiveEditable: P
2998
3250
  };
2999
- let ie = G(null);
3251
+ let ie = q(null);
3000
3252
  ie.current === null && (ie.current = r(m));
3001
- let ae = ie.current, z = W(() => n(ae), [ae]), oe = W(() => t(ae), [ae]), se = G(C);
3002
- se.current = C;
3003
- let ce = G(S);
3004
- ce.current = S;
3005
- let le = G(O);
3006
- le.current = O;
3007
- let ue = W(() => Xr({
3008
- lang: ae,
3253
+ let z = ie.current, B = K(() => n(z), [z]), ae = K(() => t(z), [z]), oe = q(C);
3254
+ oe.current = C;
3255
+ let se = q(S);
3256
+ se.current = S;
3257
+ let ce = q(O);
3258
+ ce.current = O;
3259
+ let le = K(() => Di({
3260
+ lang: z,
3009
3261
  onImageUpload: (e) => {
3010
- if (se.current) return se.current(e);
3011
- let t = xe(e);
3262
+ if (oe.current) return oe.current(e);
3263
+ let t = Re(e);
3012
3264
  if (!t) throw Error("File upload requires an upload handler.");
3013
3265
  return t;
3014
3266
  },
3015
3267
  onVideoUpload: (e) => {
3016
- if (se.current) return se.current(e);
3017
- let t = xe(e);
3268
+ if (oe.current) return oe.current(e);
3269
+ let t = Re(e);
3018
3270
  if (!t) throw Error("File upload requires an upload handler.");
3019
3271
  return t;
3020
3272
  },
3021
- linkCardResolver: (e) => le.current?.(e) ?? Promise.resolve(null),
3273
+ linkCardResolver: (e) => ce.current?.(e) ?? Promise.resolve(null),
3022
3274
  resolveMediaSource: k
3023
- }), [k, ae]), [de, fe] = K(null), [B, V] = K(Kt), [pe, me] = K(null), [he, ge] = K(null), [_e, ve] = K("code"), [ye, be] = K(null), [Se, Ce] = K(Qt), [we, Te] = K(null), [Ee, De] = K(0), Oe = G(!1), ke = G({
3275
+ }), [k, z]), [V, ue] = J(null), [de, H] = J(hn), [fe, pe] = J(null), [me, he] = J(null), [ge, _e] = J("code"), [ve, ye] = J(null), [be, xe] = J(xn), [Se, Ce] = J(null), [we, Te] = J(0), Ee = q(!1), De = q({
3024
3276
  content: o,
3025
- format: P
3026
- }), Ae = G(null), q = G(null), je = G({ onUpdate: D }), Me = W(() => Rt(B.query, oe), [oe, B.query]);
3027
- je.current = { onUpdate: D }, ke.current = {
3277
+ format: ee
3278
+ }), Oe = q(null), ke = q(null), Ae = q({ onUpdate: D }), je = K(() => an(de.query, ae), [ae, de.query]);
3279
+ Ae.current = { onUpdate: D }, De.current = {
3028
3280
  content: o,
3029
- format: P
3281
+ format: ee
3030
3282
  };
3031
- let Ne = H(() => {
3032
- q.current !== null && (window.clearTimeout(q.current), q.current = null), De((e) => e + 1);
3033
- }, []), Pe = H(() => {
3034
- q.current !== null && window.clearTimeout(q.current), q.current = window.setTimeout(() => {
3035
- q.current = null, De((e) => e + 1);
3036
- }, ut);
3283
+ let Me = U(() => {
3284
+ ke.current !== null && (window.clearTimeout(ke.current), ke.current = null), Te((e) => e + 1);
3285
+ }, []), Ne = U(() => {
3286
+ ke.current !== null && window.clearTimeout(ke.current), ke.current = window.setTimeout(() => {
3287
+ ke.current = null, Te((e) => e + 1);
3288
+ }, At);
3037
3289
  }, []);
3038
- U(() => () => {
3039
- q.current !== null && window.clearTimeout(q.current);
3290
+ W(() => () => {
3291
+ ke.current !== null && window.clearTimeout(ke.current);
3040
3292
  }, []);
3041
- let J = H(() => {
3042
- me(null), ge(null), V(Kt);
3043
- }, []), Fe = H((e) => {
3044
- let t = Gt(e.state);
3293
+ let Pe = U(() => {
3294
+ pe(null), he(null), H(hn);
3295
+ }, []), Fe = U((e) => {
3296
+ let t = pn(e.state);
3045
3297
  if (!t) {
3046
- V((e) => e.name === "idle" ? e : Kt), me(null), ge(null);
3298
+ H((e) => e.name === "idle" ? e : hn), pe(null), he(null);
3047
3299
  return;
3048
3300
  }
3049
3301
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3050
- me(Wt(n, {
3302
+ if (!mn(r, { frameRect: i })) {
3303
+ pe(null), he(null), H(hn);
3304
+ return;
3305
+ }
3306
+ let a = fn(n, {
3051
3307
  frameRect: i,
3052
3308
  triggerRect: r
3053
- })), V((e) => Ut(e, t));
3054
- }, []), Ie = H((e) => Fe(e.view), [Fe]), ze = H((e) => {
3055
- let t = st(e);
3056
- fe((e) => rt(e, t) ? e : t);
3057
- let n = Nt(e);
3058
- n && (Ft(e, n, !0), be(n));
3059
- let r = ht(e);
3060
- r.active && r.language === "mermaid" && ve(r.mermaidPreviewMode);
3061
- }, []), Be = H((e) => {
3062
- Ce(Xi(e));
3309
+ });
3310
+ pe((e) => ln(e, a) ? e : a), H((e) => dn(e, t));
3311
+ }, []), G = U((e) => Fe(e.view), [Fe]), Ie = U((e) => {
3312
+ let t = Dt(e);
3313
+ ue((e) => Ct(e, t) ? e : t);
3314
+ let n = $t(e);
3315
+ n && (tn(e, n, !0), ye(n));
3316
+ let r = Ft(e);
3317
+ r.active && r.language === "mermaid" && _e(r.mermaidPreviewMode);
3318
+ }, []), Le = U((e) => {
3319
+ xe(ka(e));
3063
3320
  }, []), Y = s({
3064
3321
  shouldRerenderOnTransaction: !1,
3065
- extensions: ue,
3322
+ extensions: le,
3066
3323
  content: I ? "" : F,
3067
- contentType: Xe(P),
3068
- editable: N,
3324
+ contentType: gt(ee),
3325
+ editable: P,
3069
3326
  autofocus: a,
3070
3327
  editorProps: {
3071
3328
  attributes: {
@@ -3077,36 +3334,36 @@ function ea({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a =
3077
3334
  spellcheck: "false",
3078
3335
  translate: "no"
3079
3336
  },
3080
- handleClick: (e, t, n) => R.current.effectiveEditable ? !1 : et(n),
3337
+ handleClick: (e, t, n) => R.current.effectiveEditable ? !1 : bt(n),
3081
3338
  handleDOMEvents: {
3082
- compositionstart: () => R.current.effectiveEditable ? (V((e) => qt(e, { type: "composition-start" })), me(null), !1) : !1,
3339
+ compositionstart: () => R.current.effectiveEditable ? (H((e) => gn(e, { type: "composition-start" })), pe(null), !1) : !1,
3083
3340
  compositionend: (e) => (R.current.effectiveEditable && window.setTimeout(() => Fe(e), 0), !1),
3084
3341
  click: (e, t) => {
3085
3342
  if (R.current.effectiveEditable) {
3086
- let n = Mt(e, t);
3087
- return n ? (t.preventDefault(), t.stopPropagation(), J(), It(e, n, !0), Lt(e, n), be(n), !0) : (be(null), !1);
3343
+ let n = Qt(e, t);
3344
+ return n ? (t.preventDefault(), t.stopPropagation(), Pe(), nn(e, n, !0), rn(e, n), ye(n), !0) : (ye(null), !1);
3088
3345
  }
3089
- return et(t);
3346
+ return bt(t);
3090
3347
  }
3091
3348
  }
3092
3349
  },
3093
3350
  onSelectionUpdate: ({ editor: e }) => {
3094
- ze(e);
3351
+ Ie(e);
3095
3352
  },
3096
3353
  onCreate: ({ editor: e }) => {
3097
- i && R.current.effectiveEditable && Yt(e), Be(e), ze(e), Ne();
3354
+ i && R.current.effectiveEditable && vn(e), Le(e), Ie(e), Me();
3098
3355
  },
3099
3356
  onTransaction: ({ editor: e, transaction: t }) => {
3100
- Be(e), (t.docChanged || xt(t)) && Pe(), t.docChanged && be((t) => {
3357
+ Le(e), (t.docChanged || Vt(t)) && Ne(), t.docChanged && ye((t) => {
3101
3358
  if (!t) return null;
3102
- let n = jt(e, t.pos);
3359
+ let n = Zt(e, t.pos);
3103
3360
  return n?.kind === t.kind ? n : null;
3104
3361
  });
3105
3362
  },
3106
3363
  onUpdate: ({ editor: e }) => {
3107
- ze(e), R.current.effectiveEditable && Ie(e), Oe.current || je.current.onUpdate?.(Ye(e, { onContentRead: (t, n) => {
3108
- let r = ke.current;
3109
- r.content !== void 0 && t === r.format && (Ae.current = {
3364
+ Ie(e), R.current.effectiveEditable && G(e), Ee.current || Ae.current.onUpdate?.(ht(e, { onContentRead: (t, n) => {
3365
+ let r = De.current;
3366
+ r.content !== void 0 && t === r.format && (Oe.current = {
3110
3367
  content: n,
3111
3368
  format: t,
3112
3369
  doc: e.state.doc
@@ -3114,15 +3371,15 @@ function ea({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a =
3114
3371
  } }));
3115
3372
  }
3116
3373
  });
3117
- U(() => {
3374
+ W(() => {
3118
3375
  let e = L.current;
3119
3376
  if (!Y || !e) return;
3120
3377
  let t = !1;
3121
3378
  return (async () => {
3122
- Oe.current = !0;
3379
+ Ee.current = !0;
3123
3380
  try {
3124
3381
  let n = !0;
3125
- for (let r of Er(e)) {
3382
+ for (let r of ri(e)) {
3126
3383
  if (await new Promise((e) => window.setTimeout(e, 0)), t) return;
3127
3384
  let e = Y.markdown?.parse(r);
3128
3385
  if (!e) throw Error("Markdown parser is unavailable.");
@@ -3130,9 +3387,9 @@ function ea({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a =
3130
3387
  Y.view.dispatch(a.setMeta("addToHistory", !1)), n = !1;
3131
3388
  }
3132
3389
  if (t) return;
3133
- ze(Y), Be(Y), Ne(), L.current = null, re(!1);
3390
+ Ie(Y), Le(Y), Me(), L.current = null, re(!1);
3134
3391
  } finally {
3135
- Oe.current = !1;
3392
+ Ee.current = !1;
3136
3393
  }
3137
3394
  })().catch(() => {
3138
3395
  t || (Y.commands.setContent(e, {
@@ -3144,208 +3401,222 @@ function ea({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a =
3144
3401
  };
3145
3402
  }, [
3146
3403
  Y,
3147
- Ne,
3148
- ze,
3149
- Be
3150
- ]), U(() => {
3151
- if (Y) return ce.current?.(Dr(Y)), () => {
3152
- ce.current?.(null);
3404
+ Me,
3405
+ Ie,
3406
+ Le
3407
+ ]), W(() => {
3408
+ if (Y) return se.current?.(ii(Y)), () => {
3409
+ se.current?.(null);
3153
3410
  };
3154
- }, [Y]), U(() => {
3411
+ }, [Y]), W(() => {
3155
3412
  if (!Y) return;
3156
- let e = N && !ne;
3157
- Y.setEditable(e), Re(Y, {
3413
+ let e = P && !ne;
3414
+ Y.setEditable(e), tt(Y, {
3158
3415
  mode: A,
3159
3416
  editable: e
3160
- }), Ct(Y, e ? "live" : "view"), Ne(), N || J();
3417
+ }), Ut(Y, e ? "live" : "view"), Me(), P || Pe();
3161
3418
  }, [
3162
- J,
3419
+ Pe,
3163
3420
  Y,
3164
3421
  A,
3165
- N,
3166
- Ne,
3422
+ P,
3423
+ Me,
3167
3424
  ne
3168
- ]), U(() => {
3169
- Y && St(Y, j);
3170
- }, [Y, j]), U(() => {
3171
- let e = $e(c);
3425
+ ]), W(() => {
3426
+ Y && Ht(Y, j);
3427
+ }, [Y, j]), W(() => {
3428
+ let e = yt(c);
3172
3429
  if (!(!Y || o === void 0)) {
3173
- if (Qe(Y, Ae.current, o, e)) {
3174
- Ae.current = null;
3430
+ if (vt(Y, Oe.current, o, e)) {
3431
+ Oe.current = null;
3175
3432
  return;
3176
3433
  }
3177
- Ae.current = null, !Ze(Y, o, e) && (Oe.current = !0, Y.commands.setContent(o, {
3178
- contentType: Xe(e),
3434
+ Oe.current = null, !_t(Y, o, e) && (Ee.current = !0, Y.commands.setContent(o, {
3435
+ contentType: gt(e),
3179
3436
  emitUpdate: !1
3180
- }), Oe.current = !1, ze(Y), N && Ie(Y), Be(Y), Ne());
3437
+ }), Ee.current = !1, Ie(Y), P && G(Y), Le(Y), Me());
3181
3438
  }
3182
3439
  }, [
3183
3440
  o,
3184
3441
  c,
3185
- N,
3442
+ P,
3186
3443
  Y,
3187
- Ne,
3188
- ze,
3444
+ Me,
3189
3445
  Ie,
3190
- Be
3191
- ]), U(() => {
3192
- if (!pe) return;
3446
+ G,
3447
+ Le
3448
+ ]), W(() => {
3449
+ if (!fe) return;
3193
3450
  let e = (e) => {
3194
3451
  let t = e.target;
3195
- t instanceof Element && (t.closest(".markweave-slash-menu") || t.closest(".markweave-slash-trigger") || J());
3452
+ t instanceof Element && (t.closest(".markweave-slash-menu") || t.closest(".markweave-slash-trigger") || Pe());
3196
3453
  };
3197
3454
  return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
3198
- }, [J, pe]);
3199
- let Ve = W(() => Y ? ht(Y) : Ji, [
3455
+ }, [Pe, fe]);
3456
+ let ze = fe !== null;
3457
+ W(() => {
3458
+ if (!Y || !ze) return;
3459
+ let e = mt(() => {
3460
+ Y.isDestroyed || Fe(Y.view);
3461
+ }), t = () => e.schedule();
3462
+ return window.addEventListener("resize", t), window.addEventListener("scroll", t, !0), t(), () => {
3463
+ e.cancel(), window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0);
3464
+ };
3465
+ }, [
3200
3466
  Y,
3201
- Ee,
3202
- de
3203
- ]), X = W(() => Y ? Xt(Y.state) : qi, [
3467
+ ze,
3468
+ Fe
3469
+ ]);
3470
+ let Be = K(() => Y ? Ft(Y) : Da, [
3204
3471
  Y,
3205
- Ee,
3206
- de,
3207
- Se
3208
- ]), Z = de?.currentNode === "codeBlock", Q = Z && Ve.language === "mermaid", He = W(() => Y ? Tt({
3209
- active: Q,
3210
- mode: _e,
3211
- source: Ve.text
3212
- }) : Yi, [
3213
- Ve.text,
3472
+ we,
3473
+ V
3474
+ ]), Ve = K(() => Y ? yn(Y.state) : Ea, [
3214
3475
  Y,
3215
- Q,
3216
- _e
3217
- ]), Ue = W(() => Y && x ? Jt(Y.state) : null, [
3476
+ we,
3477
+ V,
3478
+ be
3479
+ ]), He = V?.currentNode === "codeBlock", Ue = He && Be.language === "mermaid", We = K(() => Y ? Gt({
3480
+ active: Ue,
3481
+ mode: ge,
3482
+ source: Be.text
3483
+ }) : Oa, [
3484
+ Be.text,
3485
+ Y,
3486
+ Ue,
3487
+ ge
3488
+ ]), Ge = K(() => Y && x ? _n(Y.state) : null, [
3218
3489
  Y,
3219
3490
  x,
3220
- Ee
3221
- ]), We = W(() => Y ? yr(Y.state) : _r.items, [Y, Ee]), Ge = W(() => br(We, we), [we, We]), Ke = W(() => gr(We, Ge), [Ge, We]), qe = H(() => {
3222
- if (!Y || !We.length) {
3223
- Te(null);
3491
+ we
3492
+ ]), Ke = K(() => Y ? Xr(Y.state) : Jr.items, [Y, we]), qe = K(() => Zr(Ke, Se), [Se, Ke]), Je = K(() => qr(Ke, qe), [qe, Ke]), Ye = U(() => {
3493
+ if (!Y || !Ke.length) {
3494
+ Ce(null);
3224
3495
  return;
3225
3496
  }
3226
- let e = vr(Y, We);
3227
- Te((t) => t === e ? t : e);
3228
- }, [Y, We]);
3229
- U(() => {
3230
- Te((e) => {
3231
- let t = br(We, e);
3497
+ let e = Yr(Y, Ke);
3498
+ Ce((t) => t === e ? t : e);
3499
+ }, [Y, Ke]);
3500
+ W(() => {
3501
+ Ce((e) => {
3502
+ let t = Zr(Ke, e);
3232
3503
  return e === t ? e : t;
3233
3504
  });
3234
- }, [We]), U(() => {
3235
- if (!Y || !We.length || typeof window > "u") return;
3505
+ }, [Ke]), W(() => {
3506
+ if (!Y || !Ke.length || typeof window > "u") return;
3236
3507
  let e = null, t = () => {
3237
- e !== null && $i(e), e = Qi(() => {
3238
- e = null, qe();
3508
+ e !== null && Ma(e), e = ja(() => {
3509
+ e = null, Ye();
3239
3510
  });
3240
- }, n = Zi(Y.view.dom);
3511
+ }, n = Aa(Y.view.dom);
3241
3512
  return window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), () => {
3242
- window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null && $i(e);
3513
+ window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null && Ma(e);
3243
3514
  };
3244
3515
  }, [
3245
3516
  Y,
3246
- We.length,
3247
- qe
3517
+ Ke.length,
3518
+ Ye
3248
3519
  ]);
3249
- let nt = W(() => tt({
3250
- revision: Ee,
3520
+ let Xe = K(() => xt({
3521
+ revision: we,
3251
3522
  mode: A,
3252
- editable: N,
3253
- toc: Ke,
3254
- selection: de,
3255
- slash: B,
3256
- table: X,
3257
- tableInteraction: Se,
3258
- codeBlock: Ve,
3259
- mermaid: He,
3260
- tableDebugSnapshot: Ue
3523
+ editable: P,
3524
+ toc: Je,
3525
+ selection: V,
3526
+ slash: de,
3527
+ table: Ve,
3528
+ tableInteraction: be,
3529
+ codeBlock: Be,
3530
+ mermaid: We,
3531
+ tableDebugSnapshot: Ge
3261
3532
  }), [
3262
- Ve,
3533
+ Be,
3263
3534
  A,
3264
- N,
3265
- He,
3266
- Ee,
3535
+ P,
3536
+ We,
3537
+ we,
3538
+ V,
3267
3539
  de,
3268
- B,
3269
- Ue,
3270
- X,
3271
- Se,
3272
- Ke
3540
+ Ge,
3541
+ Ve,
3542
+ be,
3543
+ Je
3273
3544
  ]);
3274
- U(() => {
3275
- x?.(nt);
3276
- }, [x, nt]), U(() => {
3277
- E?.(Ke);
3278
- }, [E, Ke]);
3279
- let it = H((e, t) => {
3280
- if (!(!Y || !N) && zt(e)) {
3545
+ W(() => {
3546
+ x?.(Xe);
3547
+ }, [x, Xe]), W(() => {
3548
+ E?.(Je);
3549
+ }, [E, Je]);
3550
+ let Ze = U((e, t) => {
3551
+ if (!(!Y || !P) && on(e)) {
3281
3552
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3282
- ge(e);
3553
+ he(e);
3283
3554
  return;
3284
3555
  }
3285
- Ht(Y, B, e, t), V((e) => qt(e, { type: "execute" })), J();
3556
+ un(Y, de, e, t), H((e) => gn(e, { type: "execute" })), Pe();
3286
3557
  }
3287
3558
  }, [
3288
- J,
3289
- N,
3559
+ Pe,
3560
+ P,
3290
3561
  Y,
3291
- B
3292
- ]), at = H((e) => {
3293
- V((t) => qt(t, {
3562
+ de
3563
+ ]), X = U((e) => {
3564
+ H((t) => gn(t, {
3294
3565
  type: "set-active",
3295
3566
  index: e,
3296
- optionCount: Me.length
3567
+ optionCount: je.length
3297
3568
  }));
3298
- }, [Me.length]), ot = H((e) => {
3299
- if (!Y || he || !N) return;
3300
- let t = Bt(B, Me, e.key, { isComposing: e.nativeEvent.isComposing || Je(Y.state) });
3569
+ }, [je.length]), Qe = U((e) => {
3570
+ if (!Y || me || !P) return;
3571
+ let t = sn(de, je, e.key, { isComposing: e.nativeEvent.isComposing || pt(Y.state) });
3301
3572
  if (t.type !== "ignore") {
3302
3573
  if (t.type === "close") {
3303
- e.preventDefault(), V((e) => qt(e, { type: "escape" })), J();
3574
+ e.preventDefault(), H((e) => gn(e, { type: "escape" })), Pe();
3304
3575
  return;
3305
3576
  }
3306
3577
  if (t.type === "move-active") {
3307
- e.preventDefault(), V((e) => qt(e, {
3578
+ e.preventDefault(), H((e) => gn(e, {
3308
3579
  type: "move-active",
3309
3580
  delta: t.delta,
3310
3581
  optionCount: t.optionCount
3311
3582
  }));
3312
3583
  return;
3313
3584
  }
3314
- t.type === "execute-active" && (e.preventDefault(), it(t.command));
3585
+ t.type === "execute-active" && (e.preventDefault(), Ze(t.command));
3315
3586
  }
3316
3587
  }, [
3317
- J,
3318
- N,
3588
+ Pe,
3589
+ P,
3319
3590
  Y,
3320
- Me,
3321
- it,
3322
- he,
3323
- B
3324
- ]), ct = W(() => ({
3325
- closeSlashMenu: J,
3326
- focusFirstTableBodyCell: () => Y ? Yt(Y) : !1,
3591
+ je,
3592
+ Ze,
3593
+ me,
3594
+ de
3595
+ ]), $e = K(() => ({
3596
+ closeSlashMenu: Pe,
3597
+ focusFirstTableBodyCell: () => Y ? vn(Y) : !1,
3327
3598
  setContent: (e, t = {}) => {
3328
3599
  if (!Y) return !1;
3329
- let n = $e(t.format);
3600
+ let n = yt(t.format);
3330
3601
  return Y.commands.setContent(e, {
3331
- contentType: Xe(n),
3602
+ contentType: gt(n),
3332
3603
  emitUpdate: t.emitUpdate ?? !1
3333
- }), t.focusFirstTableBodyCell && Yt(Y), ze(Y), N && Ie(Y), Be(Y), Ne(), !0;
3604
+ }), t.focusFirstTableBodyCell && vn(Y), Ie(Y), P && G(Y), Le(Y), Me(), !0;
3334
3605
  }
3335
3606
  }), [
3336
- J,
3337
- N,
3607
+ Pe,
3608
+ P,
3338
3609
  Y,
3339
- Ne,
3340
- ze,
3610
+ Me,
3341
3611
  Ie,
3342
- Be
3612
+ G,
3613
+ Le
3343
3614
  ]);
3344
3615
  return {
3345
3616
  editor: Y,
3346
- frameProps: W(() => ({
3617
+ frameProps: K(() => ({
3347
3618
  className: "markweave-editor-frame",
3348
- "aria-label": e ?? z.common.editorAriaLabel,
3619
+ "aria-label": e ?? B.common.editorAriaLabel,
3349
3620
  "data-testid": "markweave-editor-frame",
3350
3621
  "data-markweave-mode": A,
3351
3622
  "aria-busy": ne,
@@ -3353,122 +3624,122 @@ function ea({ ariaLabel: e, autoFocusFirstTableBodyCell: i = !1, autofocus: a =
3353
3624
  "data-markweave-theme": j,
3354
3625
  style: M ? { "--markweave-canvas": M } : void 0,
3355
3626
  "data-markweave-inner-toc": f ? "true" : "false",
3356
- "data-markweave-inner-toc-placement": ee,
3357
- "data-mermaid-mode": He.mode,
3358
- "data-table-focus-mode": X.mode,
3359
- onKeyDownCapture: ot
3627
+ "data-markweave-inner-toc-placement": N,
3628
+ "data-mermaid-mode": We.mode,
3629
+ "data-table-focus-mode": Ve.mode,
3630
+ onKeyDownCapture: Qe
3360
3631
  }), [
3361
3632
  e,
3362
3633
  A,
3363
- ot,
3634
+ Qe,
3364
3635
  f,
3365
3636
  ne,
3366
- He.mode,
3367
- z.common.editorAriaLabel,
3637
+ We.mode,
3638
+ B.common.editorAriaLabel,
3368
3639
  M,
3369
- ee,
3640
+ N,
3370
3641
  j,
3371
- X.mode
3642
+ Ve.mode
3372
3643
  ]),
3373
- overlayProps: W(() => ({
3374
- floatingToolbar: Y && N ? {
3644
+ overlayProps: K(() => ({
3645
+ floatingToolbar: Y && P ? {
3375
3646
  editor: Y,
3376
- messages: z,
3377
- selectionSnapshot: de,
3647
+ messages: B,
3648
+ selectionSnapshot: V,
3378
3649
  onRewriteSelection: b,
3379
3650
  onExtractToNote: y
3380
3651
  } : null,
3381
- slashCommandMenu: Y && N ? {
3382
- commands: Me,
3383
- state: B,
3384
- position: pe,
3385
- inputCommand: he,
3386
- messages: z,
3387
- onActiveIndexChange: at,
3388
- onInputCommandChange: ge,
3389
- onSelect: it,
3652
+ slashCommandMenu: Y && P ? {
3653
+ commands: je,
3654
+ state: de,
3655
+ position: fe,
3656
+ inputCommand: me,
3657
+ messages: B,
3658
+ onActiveIndexChange: X,
3659
+ onInputCommandChange: he,
3660
+ onSelect: Ze,
3390
3661
  onUpload: C
3391
3662
  } : null,
3392
- tableControls: Y && N ? {
3663
+ tableControls: Y && P ? {
3393
3664
  editor: Y,
3394
- active: X.active,
3395
- interactionState: Se,
3396
- messages: z,
3665
+ active: Ve.active,
3666
+ interactionState: be,
3667
+ messages: B,
3397
3668
  onCopyPayload: T,
3398
3669
  onCommandResult: w,
3399
3670
  onEditWithAi: v
3400
3671
  } : null,
3401
- tableSelectionOverlay: Y && N ? {
3672
+ tableSelectionOverlay: Y && P ? {
3402
3673
  editor: Y,
3403
- focusState: X
3674
+ focusState: Ve
3404
3675
  } : null,
3405
3676
  codeBlockControls: Y ? {
3406
3677
  editor: Y,
3407
- active: N && Z,
3408
- mermaidMode: _e,
3409
- onMermaidModeChange: ve,
3410
- readOnly: !N
3678
+ active: P && He,
3679
+ mermaidMode: ge,
3680
+ onMermaidModeChange: _e,
3681
+ readOnly: !P
3411
3682
  } : null,
3412
- innerToc: Y && f && Ke.items.length ? {
3683
+ innerToc: Y && f && Je.items.length ? {
3413
3684
  editor: Y,
3414
- editable: N,
3415
- messages: z,
3416
- placement: ee,
3417
- state: Ke
3685
+ editable: P,
3686
+ messages: B,
3687
+ placement: N,
3688
+ state: Je
3418
3689
  } : null,
3419
- mathEditorPopover: Y && N && ye ? {
3690
+ mathEditorPopover: Y && P && ve ? {
3420
3691
  editor: Y,
3421
- messages: z,
3422
- target: ye,
3423
- onClose: () => be(null)
3692
+ messages: B,
3693
+ target: ve,
3694
+ onClose: () => ye(null)
3424
3695
  } : null
3425
3696
  }), [
3426
- N,
3697
+ P,
3427
3698
  Y,
3428
- Me,
3699
+ je,
3429
3700
  f,
3430
- Z,
3431
- _e,
3432
- z,
3433
- ye,
3701
+ He,
3702
+ ge,
3703
+ B,
3704
+ ve,
3434
3705
  v,
3435
3706
  y,
3436
3707
  b,
3437
3708
  C,
3438
3709
  w,
3439
3710
  T,
3440
- it,
3441
- de,
3442
- at,
3443
- he,
3444
- pe,
3445
- B,
3711
+ Ze,
3712
+ V,
3446
3713
  X,
3447
- Se,
3448
- Ke
3714
+ me,
3715
+ fe,
3716
+ de,
3717
+ Ve,
3718
+ be,
3719
+ Je
3449
3720
  ]),
3450
- runtimeSnapshot: nt,
3451
- actions: ct
3721
+ runtimeSnapshot: Xe,
3722
+ actions: $e
3452
3723
  };
3453
3724
  }
3454
- function ta({ className: e, ...t }) {
3455
- let n = ea(t);
3725
+ function Pa({ className: e, ...t }) {
3726
+ let n = Na(t);
3456
3727
  if (!n.editor) return null;
3457
3728
  let r = [n.frameProps.className, e].filter(Boolean).join(" ");
3458
3729
  return /* @__PURE__ */ Q("section", {
3459
3730
  ...n.frameProps,
3460
3731
  className: r,
3461
3732
  children: [
3462
- n.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(bi, { ...n.overlayProps.floatingToolbar }) : null,
3463
- n.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(Vi, { ...n.overlayProps.slashCommandMenu }) : null,
3464
- n.overlayProps.tableControls ? /* @__PURE__ */ Z(Ui, { ...n.overlayProps.tableControls }) : null,
3465
- n.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(Wi, { ...n.overlayProps.tableSelectionOverlay }) : null,
3466
- n.overlayProps.codeBlockControls ? /* @__PURE__ */ Z($r, { ...n.overlayProps.codeBlockControls }) : null,
3467
- n.overlayProps.innerToc ? /* @__PURE__ */ Z(Ki, { ...n.overlayProps.innerToc }) : null,
3468
- n.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(Mi, { ...n.overlayProps.mathEditorPopover }) : null,
3733
+ n.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(Zi, { ...n.overlayProps.floatingToolbar }) : null,
3734
+ n.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(va, { ...n.overlayProps.slashCommandMenu }) : null,
3735
+ n.overlayProps.tableControls ? /* @__PURE__ */ Z(Sa, { ...n.overlayProps.tableControls }) : null,
3736
+ n.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(Ca, { ...n.overlayProps.tableSelectionOverlay }) : null,
3737
+ n.overlayProps.codeBlockControls ? /* @__PURE__ */ Z(Ai, { ...n.overlayProps.codeBlockControls }) : null,
3738
+ n.overlayProps.innerToc ? /* @__PURE__ */ Z(Ta, { ...n.overlayProps.innerToc }) : null,
3739
+ n.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(la, { ...n.overlayProps.mathEditorPopover }) : null,
3469
3740
  /* @__PURE__ */ Z(i, { editor: n.editor })
3470
3741
  ]
3471
3742
  });
3472
3743
  }
3473
3744
  //#endregion
3474
- export { ta as MarkweaveEditor, Xr as createMarkweaveEditorExtensions, Xr as createMarkweaveReactEditorExtensions, ea as useMarkweaveEditorController };
3745
+ export { Pa as MarkweaveEditor, Di as createMarkweaveEditorExtensions, Di as createMarkweaveReactEditorExtensions, Na as useMarkweaveEditorController };