@markweave/vue2 0.6.0 → 0.7.1

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
@@ -10,60 +10,61 @@ import { normalizeMarkweaveLinkCardAttrs as g, normalizeMarkweaveLinkCardHref as
10
10
  import { openMarkweaveImagePreview as y } from "markweave/internal/plugins/media/image-preview";
11
11
  import { createMarkweaveLightweightImageNodeViewRenderer as b } from "markweave/internal/plugins/media/lightweight-image-node-view";
12
12
  import { resolveMarkweaveMediaSource as x } from "markweave/internal/plugins/media/media-source";
13
- import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as w, attrsFromMarkweaveVideoUploadResult as T, attrsFromMarkweaveVideoUrl as E, clampMarkweaveImageWidth as D, createMarkweaveImageUploadRequest as O, createMarkweaveVideoUploadRequest as k, downloadMarkweaveImage as A, markweaveVideoIframeAllow as j, normalizeMarkweaveCoreImageAlign as M, normalizeMarkweaveVideoEmbedUrl as ee, numberAttribute as N, stringAttribute as P } from "markweave/internal/plugins/media/core-media-nodes";
14
- import { activateMarkweaveAttachmentDownload as F, attrsFromMarkweaveAttachmentUploadResult as te, createMarkweaveAttachmentRefFromAttrs as I, createMarkweaveAttachmentUploadRequest as L, formatMarkweaveAttachmentSize as R } from "markweave/internal/plugins/media/attachment-download";
15
- import { MarkweaveAttachment as z } from "markweave/internal/plugins/media/media-nodes";
16
- import { detectUploadSource as B, getDirectUploadResult as V, resolveMarkweaveUploadResult as H } from "markweave/internal/plugins/slash-command/upload";
17
- import { createMarkweaveAiEditController as ne } from "markweave";
18
- import { BubbleMenu as re } from "@tiptap/vue-2/menus";
19
- import { isEditorComposing as ie } from "markweave/internal/editor-core/composition-guard";
20
- import { saveMarkweaveBrowserFile as ae } from "markweave/internal/core/browser-file-save";
21
- import { createMarkweaveFrameScheduler as oe } from "markweave/internal/editor-core/frame-scheduler";
22
- import { createMarkweaveEditorUpdatePayload as se, getMarkweaveContentType as ce, isEditorContentCurrent as le, isMarkweaveControlledContentEchoCurrent as ue, normalizeMarkweaveContentFormat as de } from "markweave/internal/editor-core/editor-content";
23
- import { getCurrentFloatingToolbarBlockType as fe, getFloatingToolbarHighlightColorOptions as pe, getFloatingToolbarMoreActions as me, getFloatingToolbarTextColorOptions as he, getFloatingToolbarTurnIntoOptions as ge, runFloatingToolbarMoreAction as _e, setFloatingToolbarTurnInto as ve } from "markweave/internal/editor-core/floating-toolbar-model";
24
- import { openMarkweaveReadonlyLinkFromEvent as ye } from "markweave/internal/editor-core/readonly-link";
25
- import { createMarkweaveEditorRuntimeSnapshot as be } from "markweave/internal/editor-core/runtime-snapshot";
26
- import { areEditorSelectionSnapshotsEquivalent as xe, calculateFloatingToolbarPopoverPlacement as Se, createSelectionSnapshot as Ce, markweaveRuntimeProjectionDelayMs as we, shouldShowFloatingToolbarForAiState as Te } from "markweave/internal/editor-core/selection-state";
27
- import { normalizeMarkweaveCanvasColor as Ee, normalizeMarkweaveTheme as De } from "markweave/internal/core/theme";
28
- import { createMarkweaveAiEditController as Oe } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
29
- import { MarkweaveAskAiError as ke, acceptMarkweaveAskAiResult as Ae, calculateMarkweaveAskAiPanelPosition as je, canStartMarkweaveAskAiTableTarget as Me, clearMarkweaveAskAiPreview as Ne, clearMarkweaveAskAiTarget as Pe, createMarkweaveAskAiRequest as Fe, getMappedMarkweaveAskAiSelection as Ie, getMarkweaveAskAiSurfaceRect as Le, getMarkweaveAskAiTarget as Re, getMarkweaveAskAiTargetRect as ze, hasMarkweaveAskAiPreview as Be, isMarkweaveAskAiSelectionEligible as Ve, restoreMarkweaveAskAiTargetSelection as He, runMarkweaveAskAiHandler as Ue, setMarkweaveAskAiPreview as We, startMarkweaveAskAiTableTarget as Ge, startMarkweaveAskAiTarget as Ke } from "markweave/internal/plugins/ask-ai/ask-ai-session";
30
- import { createMarkweaveTocState as qe, emptyMarkweaveTocState as Je, getActiveMarkweaveTocId as Ye, getMarkweaveInnerTocRailHeight as Xe, getMarkweaveTocItemsFromState as Ze, getValidMarkweaveTocActiveId as Qe, normalizeMarkweaveInnerTocPlacement as $e, observeMarkweaveInnerTocContainerPosition as et, observeMarkweaveInnerTocRailOverflow as tt, scrollToMarkweaveTocItem as nt } from "markweave/internal/core/toc-state";
31
- import { codeBlockCollapsePluginKey as rt, copyActiveCodeBlock as it, getActiveCodeBlockState as at, getCodeBlockCopyFeedbackSnapshot as ot, markweaveCodeBlockBehavior as st, setCodeBlockCollapsedAtPosition as ct, setCodeBlockLanguageAtPosition as lt, setCodeBlockMermaidPreviewModeAtPosition as ut } from "markweave/internal/plugins/codeblock/codeblock-behavior";
32
- import { calculateCodeBlockLanguageMenuPosition as dt, clampFullscreenScale as ft, codeBlockCopyFeedbackTimeoutMs as pt, copyCodeBlockText as mt, createCodeBlockLanguageMenuDomId as ht, createCodeBlockOverlayPosition as gt, createMermaidFullscreenViewerState as _t, createMermaidTabPosition as vt, focusCodeBlockTarget as yt, formatCodeBlockLanguageLabel as bt, formatFullscreenZoom as xt, getActiveCodeBlockElement as St, getAnchoredRect as Ct, getCodeBlockLanguageItems as wt, getCodeBlockLanguageOptionDomId as Tt, getCodeBlockPositionFromEventTarget as Et, getCodeBlockStateAtPosition as Dt, getFrameElement as Ot, getInitialCodeBlockLanguageItemIndex as kt, getMermaidCodeBlockTargets as At, getMermaidSvgMarkup as jt, isCodeBlockTargetCollapsed as Mt, mergeStableMermaidTabPositions as Nt, mermaidFullscreenZoomStep as Pt, moveCodeBlockLanguageItemIndex as Ft, moveMermaidFullscreenViewer as It, scrollCodeBlockLanguageItemIntoView as Lt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
33
- import { normalizeMarkdownLinkHref as Rt } from "markweave/internal/plugins/markdown/markdown-input";
34
- import { applyMarkweaveMathLatex as zt, calculateMarkweaveMathPopoverPosition as Bt, getMarkweaveMathAnchorRect as Vt, getMarkweaveMathBlockIndex as Ht, getMarkweaveMathRenderedHtml as Ut, getMarkweaveMathTargetAtPos as Wt, getMarkweaveMathTargetFromDomEvent as Gt, getMarkweaveMathTargetFromSelection as Kt, renderMarkweaveMathPreview as qt, setMarkweaveMathEditingDomState as Jt, setMarkweaveMathEditingDomStateInView as Yt, setMarkweaveMathSelectionInView as Xt } from "markweave/internal/plugins/math/math-ui-model";
35
- import { isMermaidInlinePreviewTransaction as Zt, setMarkweaveMermaidTheme as Qt, setMermaidInlinePreviewEditorMode as $t, setReadonlyMermaidPreviewMode as en } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
36
- import { getMermaidPreviewState as tn } from "markweave/internal/plugins/mermaid/mermaid-renderer";
37
- import { createResolvedSlashCommandSpecs as nn, isExecutableSlashCommand as rn } from "markweave/internal/plugins/slash-command/command-spec";
38
- import { getSlashCommandKeyboardAction as an } from "markweave/internal/plugins/slash-command/slash-keyboard";
39
- import { scrollSlashCommandItemIntoView as on } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
40
- import { areSlashCommandMenuPositionsEquivalent as sn, getNextSlashCommandState as cn, getSlashCommandAnchoredMenuPosition as ln, getSlashCommandContext as un, isMarkweaveSlashMenuScrollTarget as dn, isSlashCommandAnchorVisible as fn } from "markweave/internal/plugins/slash-command/slash-runtime";
41
- import { createMarkweaveCommandController as pn, executeMarkweaveSlashCommand as mn, setMarkweaveCommandContentFormat as hn, setMarkweaveCommandRegistry as gn } from "markweave/internal/commands/command-runtime";
42
- import { createMarkweaveCommandRegistry as _n } from "markweave/internal/commands/command-registry";
43
- import { initialSlashCommandState as vn, reduceSlashCommandState as yn } from "markweave/internal/plugins/slash-command/slash-state";
44
- import { setMarkweaveTableMenuAxisTarget as bn } from "markweave/internal/plugins/table/table-clipboard";
45
- import { getFirstTableDebugSnapshot as xn } from "markweave/internal/plugins/table/table-debug-snapshot";
46
- import { focusFirstTableBodyCell as Sn } from "markweave/internal/plugins/table/table-focus-position";
47
- import { getTableFocusState as Cn } from "markweave/internal/plugins/table/table-focus-state";
48
- import { getTableSelectionOverlayState as wn, initialTableInteractionState as Tn, tableInteractionPluginKey as En } from "markweave/internal/plugins/table/table-interaction-layer";
49
- import { applyTableAxisAlignment as Dn, applyTableAxisBackgroundColor as On, applyTableAxisTextColor as kn, calculateAnchoredTableMenuPosition as An, calculateAnchoredTableSubmenuPosition as jn, calculateTableAxisHandleLayout as Mn, calculateTableExtendButtonLayout as Nn, canRunTableCommand as Pn, executeTableMenuCommand as Fn, formatTableCopyFeedback as In, getActiveTableElement as Ln, getAvailableCellMenuCommandSpecs as Rn, getTableAxisDropIndexAtPoint as zn, getTableAxisFormattingState as Bn, getTableAxisTargetRect as Vn, getTableControlAxisSelectionModel as Hn, getTableMenuBoundaryRect as Un, getTableMenuItemGroup as Wn, getTableMenuItemLabel as Gn, getTableMenuItems as Kn, getTableSelectionTargetRect as qn, measureTableSelectionOverlay as Jn, moveTargetedTableAxis as Yn, selectTableAxisFromCell as Xn, tableColorOptions as Zn, tableCopyFeedbackTimeoutMs as Qn, tableHorizontalAlignmentOptions as $n, tableMenuLabel as er, tableVerticalAlignmentOptions as tr, targetTableAxisFromCell as nr } from "markweave/internal/plugins/table/table-ui-model";
13
+ import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as ee, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as D, createMarkweaveVideoUploadRequest as O, downloadMarkweaveImage as k, markweaveVideoIframeAllow as A, normalizeMarkweaveCoreImageAlign as j, normalizeMarkweaveVideoEmbedUrl as te, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
14
+ import { activateMarkweaveAttachmentDownload as P, attrsFromMarkweaveAttachmentUploadResult as ne, createMarkweaveAttachmentRefFromAttrs as F, createMarkweaveAttachmentUploadRequest as I, formatMarkweaveAttachmentSize as L } from "markweave/internal/plugins/media/attachment-download";
15
+ import { MarkweaveAttachment as R } from "markweave/internal/plugins/media/media-nodes";
16
+ import { detectUploadSource as z, getDirectUploadResult as B, resolveMarkweaveUploadResult as V } from "markweave/internal/plugins/slash-command/upload";
17
+ import { createMarkweaveAiEditController as re } from "markweave";
18
+ import { BubbleMenu as ie } from "@tiptap/vue-2/menus";
19
+ import { isEditorComposing as ae } from "markweave/internal/editor-core/composition-guard";
20
+ import { saveMarkweaveBrowserFile as oe } from "markweave/internal/core/browser-file-save";
21
+ import { createMarkweaveFrameScheduler as se } from "markweave/internal/editor-core/frame-scheduler";
22
+ import { createMarkweaveEditorUpdatePayload as ce, getMarkweaveContentType as le, isEditorContentCurrent as ue, isMarkweaveControlledContentEchoCurrent as de, normalizeMarkweaveContentFormat as fe } from "markweave/internal/editor-core/editor-content";
23
+ import { getCurrentFloatingToolbarBlockType as pe, getFloatingToolbarHighlightColorOptions as me, getFloatingToolbarMoreActions as he, getFloatingToolbarTextColorOptions as ge, getFloatingToolbarTurnIntoOptions as _e, runFloatingToolbarMoreAction as ve, setFloatingToolbarTurnInto as ye } from "markweave/internal/editor-core/floating-toolbar-model";
24
+ import { openMarkweaveReadonlyLinkFromEvent as be } from "markweave/internal/editor-core/readonly-link";
25
+ import { createMarkweaveEditorRuntimeSnapshot as xe } from "markweave/internal/editor-core/runtime-snapshot";
26
+ import { areEditorSelectionSnapshotsEquivalent as Se, calculateFloatingToolbarPopoverPlacement as Ce, createSelectionSnapshot as we, markweaveRuntimeProjectionDelayMs as Te, shouldShowFloatingToolbarForAiState as Ee } from "markweave/internal/editor-core/selection-state";
27
+ import { normalizeMarkweaveCanvasColor as De, normalizeMarkweaveTheme as Oe } from "markweave/internal/core/theme";
28
+ import { createMarkweaveAiEditController as ke } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
29
+ import { MarkweaveAskAiError as Ae, acceptMarkweaveAskAiResult as je, calculateMarkweaveAskAiPanelPosition as Me, canStartMarkweaveAskAiTableTarget as Ne, clearMarkweaveAskAiPreview as Pe, clearMarkweaveAskAiTarget as Fe, createMarkweaveAskAiRequest as Ie, getMappedMarkweaveAskAiSelection as Le, getMarkweaveAskAiSurfaceRect as Re, getMarkweaveAskAiTarget as ze, getMarkweaveAskAiTargetRect as Be, hasMarkweaveAskAiPreview as Ve, isMarkweaveAskAiSelectionEligible as He, restoreMarkweaveAskAiTargetSelection as Ue, runMarkweaveAskAiHandler as We, setMarkweaveAskAiPreview as Ge, startMarkweaveAskAiTableTarget as Ke, startMarkweaveAskAiTarget as qe } from "markweave/internal/plugins/ask-ai/ask-ai-session";
30
+ import { createMarkweaveTocState as Je, emptyMarkweaveTocState as Ye, getActiveMarkweaveTocId as Xe, getMarkweaveInnerTocRailHeight as Ze, getMarkweaveTocItemsFromState as Qe, getValidMarkweaveTocActiveId as $e, normalizeMarkweaveInnerTocPlacement as et, observeMarkweaveInnerTocContainerPosition as tt, observeMarkweaveInnerTocRailOverflow as nt, scrollToMarkweaveTocItem as rt } from "markweave/internal/core/toc-state";
31
+ import { codeBlockCollapsePluginKey as it, copyActiveCodeBlock as at, getActiveCodeBlockState as ot, getCodeBlockCopyFeedbackSnapshot as st, markweaveCodeBlockBehavior as ct, setCodeBlockCollapsedAtPosition as lt, setCodeBlockLanguageAtPosition as ut, setCodeBlockMermaidPreviewModeAtPosition as dt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
32
+ import { calculateCodeBlockLanguageMenuPosition as ft, clampFullscreenScale as pt, codeBlockCopyFeedbackTimeoutMs as mt, copyCodeBlockText as ht, createCodeBlockLanguageMenuDomId as gt, createCodeBlockOverlayPosition as _t, createMermaidFullscreenViewerState as vt, createMermaidTabPosition as yt, focusCodeBlockTarget as bt, formatCodeBlockLanguageLabel as xt, formatFullscreenZoom as St, getActiveCodeBlockElement as Ct, getAnchoredRect as wt, getCodeBlockLanguageItems as Tt, getCodeBlockLanguageOptionDomId as Et, getCodeBlockPositionFromEventTarget as Dt, getCodeBlockStateAtPosition as Ot, getFrameElement as kt, getInitialCodeBlockLanguageItemIndex as At, getMermaidCodeBlockTargets as jt, getMermaidSvgMarkup as Mt, isCodeBlockTargetCollapsed as Nt, mergeStableMermaidTabPositions as Pt, mermaidFullscreenZoomStep as Ft, moveCodeBlockLanguageItemIndex as It, moveMermaidFullscreenViewer as Lt, scrollCodeBlockLanguageItemIntoView as Rt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
33
+ import { normalizeMarkdownLinkHref as zt } from "markweave/internal/plugins/markdown/markdown-input";
34
+ import { applyMarkweaveMathLatex as Bt, calculateMarkweaveMathPopoverPosition as Vt, getMarkweaveMathAnchorRect as Ht, getMarkweaveMathBlockIndex as Ut, getMarkweaveMathRenderedHtml as Wt, getMarkweaveMathTargetAtPos as Gt, getMarkweaveMathTargetFromDomEvent as Kt, getMarkweaveMathTargetFromSelection as qt, renderMarkweaveMathPreview as Jt, setMarkweaveMathEditingDomState as Yt, setMarkweaveMathEditingDomStateInView as Xt, setMarkweaveMathSelectionInView as Zt } from "markweave/internal/plugins/math/math-ui-model";
35
+ import { isMermaidInlinePreviewTransaction as Qt, setMarkweaveMermaidTheme as $t, setMermaidInlinePreviewEditorMode as en, setReadonlyMermaidPreviewMode as tn } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
36
+ import { getMermaidPreviewState as nn } from "markweave/internal/plugins/mermaid/mermaid-renderer";
37
+ import { createResolvedSlashCommandSpecs as rn, getSlashCommandTextIconLength as an, isExecutableSlashCommand as on } from "markweave/internal/plugins/slash-command/command-spec";
38
+ import { getSlashCommandKeyboardAction as sn } from "markweave/internal/plugins/slash-command/slash-keyboard";
39
+ import { scrollSlashCommandItemIntoView as cn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
40
+ import { areSlashCommandMenuPositionsEquivalent as ln, getNextSlashCommandState as un, getSlashCommandAnchoredMenuPosition as dn, getSlashCommandContext as fn, isMarkweaveSlashMenuScrollTarget as pn, isSlashCommandAnchorVisible as mn } from "markweave/internal/plugins/slash-command/slash-runtime";
41
+ import { createMarkweaveCommandController as hn, executeMarkweaveSlashCommand as gn, setMarkweaveCommandContentFormat as _n, setMarkweaveCommandRegistry as vn } from "markweave/internal/commands/command-runtime";
42
+ import { createMarkweaveCommandRegistry as yn } from "markweave/internal/commands/command-registry";
43
+ import { initialSlashCommandState as bn, reduceSlashCommandState as xn } from "markweave/internal/plugins/slash-command/slash-state";
44
+ import { setMarkweaveTableMenuAxisTarget as Sn } from "markweave/internal/plugins/table/table-clipboard";
45
+ import { isMarkweaveTableCapabilityAllowed as Cn } from "markweave/internal/plugins/table/table-capabilities";
46
+ import { getFirstTableDebugSnapshot as wn } from "markweave/internal/plugins/table/table-debug-snapshot";
47
+ import { focusFirstTableBodyCell as Tn } from "markweave/internal/plugins/table/table-focus-position";
48
+ import { getTableFocusState as En } from "markweave/internal/plugins/table/table-focus-state";
49
+ import { getTableSelectionOverlayState as Dn, initialTableInteractionState as On, tableInteractionPluginKey as kn } from "markweave/internal/plugins/table/table-interaction-layer";
50
+ import { applyTableAxisAlignment as An, applyTableAxisBackgroundColor as jn, applyTableAxisTextColor as Mn, calculateAnchoredTableMenuPosition as Nn, calculateAnchoredTableSubmenuPosition as Pn, calculateTableAxisHandleLayout as Fn, calculateTableExtendButtonLayout as In, canRunTableCommand as Ln, executeTableMenuCommand as Rn, formatTableCopyFeedback as zn, getActiveTableElement as Bn, getAvailableCellMenuCommandSpecs as Vn, getTableAxisDropIndexAtPoint as Hn, getTableAxisFormattingState as Un, getTableAxisTargetRect as Wn, getTableControlAxisSelectionModel as Gn, getTableMenuBoundaryRect as Kn, getTableMenuItemGroup as qn, getTableMenuItemLabel as Jn, getTableMenuItems as Yn, getTableSelectionTargetRect as Xn, measureTableSelectionOverlay as Zn, moveTargetedTableAxis as Qn, selectTableAxisFromCell as $n, tableColorOptions as er, tableCopyFeedbackTimeoutMs as tr, tableHorizontalAlignmentOptions as nr, tableMenuLabel as rr, tableVerticalAlignmentOptions as ir, targetTableAxisFromCell as ar } from "markweave/internal/plugins/table/table-ui-model";
50
51
  //#region src/vue2-compat.ts
51
- var rr = c.default ?? c, ir = null, ar = null, or = null;
52
- function sr(e) {
52
+ var or = c.default ?? c, sr = null, cr = null, lr = null;
53
+ function ur(e) {
53
54
  return !!(e && typeof e == "object" && "value" in e);
54
55
  }
55
- function cr(e) {
56
+ function dr(e) {
56
57
  let t = e.slice(2);
57
58
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
58
59
  }
59
- function lr(e) {
60
+ function fr(e) {
60
61
  let t = {}, n = {}, r = {}, i = {}, a = {};
61
62
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
62
63
  if (o === "class" || o === "style" || o === "key") {
63
64
  t[o] = s;
64
65
  continue;
65
66
  }
66
- if (o === "ref" && sr(s)) {
67
+ if (o === "ref" && ur(s)) {
67
68
  a.insert = (e) => {
68
69
  s.value = e.elm;
69
70
  }, a.destroy = () => {
@@ -72,7 +73,7 @@ function lr(e) {
72
73
  continue;
73
74
  }
74
75
  if (/^on[A-Z]/.test(o)) {
75
- i[cr(o)] = s;
76
+ i[dr(o)] = s;
76
77
  continue;
77
78
  }
78
79
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -83,14 +84,14 @@ function lr(e) {
83
84
  }
84
85
  return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
85
86
  }
86
- function ur(e) {
87
+ function pr(e) {
87
88
  let t = {}, n = {}, r = {}, i = {};
88
89
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
89
90
  if (a === "class" || a === "style" || a === "key") {
90
91
  t[a] = o;
91
92
  continue;
92
93
  }
93
- if (a === "ref" && sr(o)) {
94
+ if (a === "ref" && ur(o)) {
94
95
  i.insert = (e) => {
95
96
  o.value = e.componentInstance ?? e.elm;
96
97
  }, i.destroy = () => {
@@ -106,47 +107,47 @@ function ur(e) {
106
107
  }
107
108
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
108
109
  }
109
- function dr(e) {
110
+ function mr(e) {
110
111
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
111
112
  }
112
- function fr(e) {
113
+ function hr(e) {
113
114
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
114
115
  }
115
- function pr(e) {
116
+ function gr(e) {
116
117
  return e == null || Array.isArray(e) ? e : [e];
117
118
  }
118
- function mr(e) {
119
- return typeof e == "function" ? pr(e()) : dr(e) ? pr(e.default()) : fr(e) ? [e] : e;
119
+ function _r(e) {
120
+ return typeof e == "function" ? gr(e()) : mr(e) ? gr(e.default()) : hr(e) ? [e] : e;
120
121
  }
121
- function U(e, t, n) {
122
- if (!or) throw Error("Vue 2 render context is not available.");
123
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? lr(r) : ur(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : mr(n);
124
- return or(e, i, a);
122
+ function H(e, t, n) {
123
+ if (!lr) throw Error("Vue 2 render context is not available.");
124
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? fr(r) : pr(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : _r(n);
125
+ return lr(e, i, a);
125
126
  }
126
- function W(e) {
127
- return rr.observable({ value: e });
127
+ function U(e) {
128
+ return or.observable({ value: e });
128
129
  }
129
- var G = W;
130
- function K(e) {
130
+ var W = U;
131
+ function G(e) {
131
132
  return { get value() {
132
133
  return e();
133
134
  } };
134
135
  }
135
- function q(e, t, n) {
136
+ function K(e, t, n) {
136
137
  let r = typeof e == "function" ? e : () => e.value;
137
- return ir?.$watch ? ir.$watch(r, t, n) : () => void 0;
138
+ return sr?.$watch ? sr.$watch(r, t, n) : () => void 0;
138
139
  }
139
- function hr(e) {
140
- ar?.mounted.push(e);
140
+ function vr(e) {
141
+ cr?.mounted.push(e);
142
+ }
143
+ function q(e) {
144
+ cr?.beforeUnmount.push(e);
141
145
  }
142
146
  function J(e) {
143
- ar?.beforeUnmount.push(e);
147
+ return or.nextTick(e);
144
148
  }
145
149
  function Y(e) {
146
- return rr.nextTick(e);
147
- }
148
- function X(e) {
149
- return rr.extend({
150
+ return or.extend({
150
151
  name: e.name,
151
152
  props: e.props,
152
153
  created() {
@@ -154,12 +155,12 @@ function X(e) {
154
155
  mounted: [],
155
156
  beforeUnmount: []
156
157
  };
157
- ir = this, ar = t;
158
+ sr = this, cr = t;
158
159
  try {
159
160
  let n = e.setup?.(this.$props ?? this) ?? null;
160
161
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
161
162
  } finally {
162
- ir = null, ar = null;
163
+ sr = null, cr = null;
163
164
  }
164
165
  },
165
166
  mounted() {
@@ -169,19 +170,19 @@ function X(e) {
169
170
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
170
171
  },
171
172
  render(t) {
172
- or = t;
173
+ lr = t;
173
174
  try {
174
175
  let n = this.__markweaveVue2Render;
175
176
  return n ? n() : e.render?.(t) ?? null;
176
177
  } finally {
177
- or = null;
178
+ lr = null;
178
179
  }
179
180
  }
180
181
  });
181
182
  }
182
183
  //#endregion
183
184
  //#region src/vue2-icons.ts
184
- var gr = {
185
+ var yr = {
185
186
  AlignVerticalJustifyCenter: {
186
187
  iconName: "align-vertical-justify-center",
187
188
  node: [
@@ -1503,11 +1504,11 @@ var gr = {
1503
1504
  }]]
1504
1505
  }
1505
1506
  };
1506
- function _r(e) {
1507
- return e.map(([e, t]) => U(e, t));
1507
+ function br(e) {
1508
+ return e.map(([e, t]) => H(e, t));
1508
1509
  }
1509
- function Z(e) {
1510
- return X({
1510
+ function X(e) {
1511
+ return Y({
1511
1512
  name: `MarkweaveVue2Icon${e}`,
1512
1513
  props: {
1513
1514
  size: {
@@ -1524,8 +1525,8 @@ function Z(e) {
1524
1525
  }
1525
1526
  },
1526
1527
  setup(t) {
1527
- let n = gr[e];
1528
- return () => U("svg", {
1528
+ let n = yr[e];
1529
+ return () => H("svg", {
1529
1530
  class: `lucide lucide-${n.iconName}`,
1530
1531
  viewBox: "0 0 24 24",
1531
1532
  width: t.size,
@@ -1537,12 +1538,12 @@ function Z(e) {
1537
1538
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1538
1539
  "aria-hidden": "true",
1539
1540
  focusable: "false"
1540
- }, _r(n.node));
1541
+ }, br(n.node));
1541
1542
  }
1542
1543
  });
1543
1544
  }
1544
- var vr = Z("AlignCenter"), yr = Z("AlignJustify"), br = Z("AlignLeft"), xr = Z("AlignRight"), Sr = Z("AlignVerticalJustifyCenter"), Cr = Z("AlignVerticalJustifyEnd"), wr = Z("AlignVerticalJustifyStart"), Tr = Z("AlertTriangle"), Er = Z("ArrowDown"), Dr = Z("ArrowDownAZ"), Or = Z("ArrowLeft"), kr = Z("ArrowRight"), Ar = Z("ArrowUp"), jr = Z("ArrowUpZA"), Mr = Z("BetweenHorizontalEnd"), Nr = Z("BetweenHorizontalStart"), Pr = Z("BetweenVerticalEnd"), Fr = Z("BetweenVerticalStart"), Ir = Z("Bold"), Lr = Z("Braces"), Rr = Z("Captions"), zr = Z("Check"), Br = Z("CheckCircle2"), Vr = Z("ChevronDown"), Hr = Z("ChevronRight"), Ur = Z("ChevronUp"), Wr = Z("CircleX"), Gr = Z("Code2"), Kr = Z("CornerDownLeft"), qr = Z("Copy"), Jr = Z("Download"), Yr = Z("Eye"), Xr = Z("ExternalLink"), Zr = Z("Heading1"), Qr = Z("Heading2"), $r = Z("Heading3"), ei = Z("Image"), ti = Z("ImageUp"), ni = Z("IndentDecrease"), ri = Z("IndentIncrease"), ii = Z("Info"), ai = Z("Italic"), oi = Z("Lightbulb"), si = Z("Link2"), ci = Z("List"), li = Z("ListChecks"), ui = Z("ListOrdered"), di = Z("Minus"), fi = Z("MoreVertical"), pi = Z("PaintBucket"), mi = Z("Paperclip"), hi = Z("PencilLine"), gi = Z("Plus"), _i = Z("Quote"), vi = Z("Replace"), yi = Z("RotateCcw"), bi = Z("Sigma"), xi = Z("SmilePlus"), Si = Z("Sparkles"), Ci = Z("Square"), wi = Z("SquareX"), Ti = Z("Strikethrough"), Ei = Z("Subscript"), Di = Z("Superscript"), Oi = Z("Table2"), ki = Z("TableCellsMerge"), Ai = Z("TableCellsSplit"), ji = Z("Text"), Mi = Z("Trash2"), Ni = Z("Type"), Pi = Z("Underline"), Fi = Z("Upload"), Ii = Z("Video"), Li = Z("X"), Ri = M;
1545
- function zi(e) {
1545
+ var xr = X("AlignCenter"), Sr = X("AlignJustify"), Cr = X("AlignLeft"), wr = X("AlignRight"), Tr = X("AlignVerticalJustifyCenter"), Er = X("AlignVerticalJustifyEnd"), Dr = X("AlignVerticalJustifyStart"), Or = X("AlertTriangle"), kr = X("ArrowDown"), Ar = X("ArrowDownAZ"), jr = X("ArrowLeft"), Mr = X("ArrowRight"), Nr = X("ArrowUp"), Pr = X("ArrowUpZA"), Fr = X("BetweenHorizontalEnd"), Ir = X("BetweenHorizontalStart"), Lr = X("BetweenVerticalEnd"), Rr = X("BetweenVerticalStart"), zr = X("Bold"), Br = X("Braces"), Vr = X("Captions"), Hr = X("Check"), Ur = X("CheckCircle2"), Wr = X("ChevronDown"), Gr = X("ChevronRight"), Kr = X("ChevronUp"), qr = X("CircleX"), Jr = X("Code2"), Yr = X("CornerDownLeft"), Xr = X("Copy"), Zr = X("Download"), Qr = X("Eye"), $r = X("ExternalLink"), ei = X("Heading1"), ti = X("Heading2"), ni = X("Heading3"), ri = X("Image"), ii = X("ImageUp"), ai = X("IndentDecrease"), oi = X("IndentIncrease"), si = X("Info"), ci = X("Italic"), li = X("Lightbulb"), ui = X("Link2"), di = X("List"), fi = X("ListChecks"), pi = X("ListOrdered"), mi = X("Minus"), hi = X("MoreVertical"), gi = X("PaintBucket"), _i = X("Paperclip"), vi = X("PencilLine"), yi = X("Plus"), bi = X("Quote"), xi = X("Replace"), Si = X("RotateCcw"), Ci = X("Sigma"), wi = X("SmilePlus"), Ti = X("Sparkles"), Ei = X("Square"), Di = X("SquareX"), Oi = X("Strikethrough"), ki = X("Subscript"), Ai = X("Superscript"), ji = X("Table2"), Mi = X("TableCellsMerge"), Ni = X("TableCellsSplit"), Pi = X("Text"), Fi = X("Trash2"), Ii = X("Type"), Li = X("Underline"), Ri = X("Upload"), zi = X("Video"), Bi = X("X"), Vi = j;
1546
+ function Hi(e) {
1546
1547
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1547
1548
  let n = t?.getAttribute("data-markweave-mode");
1548
1549
  return n === "view" ? {
@@ -1552,7 +1553,7 @@ function zi(e) {
1552
1553
  mode: "live",
1553
1554
  editable: e.isEditable
1554
1555
  } : l(e);
1555
- }, r = W(n()), i = p(e, () => {
1556
+ }, r = U(n()), i = p(e, () => {
1556
1557
  r.value = n();
1557
1558
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1558
1559
  r.value = n();
@@ -1560,28 +1561,28 @@ function zi(e) {
1560
1561
  return a && t && a.observe(t, {
1561
1562
  attributes: !0,
1562
1563
  attributeFilter: ["data-markweave-mode"]
1563
- }), J(() => {
1564
+ }), q(() => {
1564
1565
  i(), a?.disconnect();
1565
1566
  }), r;
1566
1567
  }
1567
- function Bi(e) {
1568
+ function Ui(e) {
1568
1569
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1569
1570
  }
1570
- function Vi(e) {
1571
+ function Wi(e) {
1571
1572
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1572
1573
  }
1573
- function Hi(e) {
1574
+ function Gi(e) {
1574
1575
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1575
1576
  }
1576
- function Ui(e, t) {
1577
- return U(e, {
1577
+ function Ki(e, t) {
1578
+ return H(e, {
1578
1579
  size: 18,
1579
1580
  strokeWidth: 1.8,
1580
1581
  "aria-hidden": "true"
1581
1582
  }, { default: () => t });
1582
1583
  }
1583
- function Wi(e) {
1584
- return U("button", {
1584
+ function qi(e) {
1585
+ return H("button", {
1585
1586
  type: "button",
1586
1587
  "aria-label": e.label,
1587
1588
  title: e.label,
@@ -1589,14 +1590,14 @@ function Wi(e) {
1589
1590
  "data-active": e.active ? "true" : "false",
1590
1591
  onMousedown: (e) => e.preventDefault(),
1591
1592
  onClick: e.onClick
1592
- }, [Ui(e.icon, e.label), U("span", {
1593
+ }, [Ki(e.icon, e.label), H("span", {
1593
1594
  class: "markweave-image-tooltip",
1594
1595
  role: "tooltip"
1595
1596
  }, e.label)]);
1596
1597
  }
1597
- function Gi(e) {
1598
- let t = W(null), n = e.messages.image;
1599
- return U("section", {
1598
+ function Ji(e) {
1599
+ let t = U(null), n = e.messages.image;
1600
+ return H("section", {
1600
1601
  class: "markweave-image-upload-placeholder",
1601
1602
  "data-testid": "markweave-image-upload-placeholder",
1602
1603
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1614,7 +1615,7 @@ function Gi(e) {
1614
1615
  n && e.onFile(n);
1615
1616
  }
1616
1617
  }, [
1617
- U("input", {
1618
+ H("input", {
1618
1619
  ref: t,
1619
1620
  "data-testid": "markweave-image-file-input",
1620
1621
  type: "file",
@@ -1625,7 +1626,7 @@ function Gi(e) {
1625
1626
  r && e.onFile(r), n.value = "";
1626
1627
  }
1627
1628
  }),
1628
- U("button", {
1629
+ H("button", {
1629
1630
  type: "button",
1630
1631
  class: "markweave-image-upload-trigger",
1631
1632
  "data-testid": "markweave-image-upload-trigger",
@@ -1633,21 +1634,21 @@ function Gi(e) {
1633
1634
  onMousedown: (e) => e.preventDefault(),
1634
1635
  onClick: () => t.value?.click()
1635
1636
  }, [
1636
- U("span", {
1637
+ H("span", {
1637
1638
  class: "markweave-image-upload-icon",
1638
1639
  "aria-hidden": "true"
1639
- }, [U(ti, {
1640
+ }, [H(ii, {
1640
1641
  size: 16,
1641
1642
  strokeWidth: 1.8
1642
1643
  })]),
1643
- U("span", { class: "markweave-image-upload-label" }, n.uploadLabel),
1644
- U("span", {
1644
+ H("span", { class: "markweave-image-upload-label" }, n.uploadLabel),
1645
+ H("span", {
1645
1646
  class: "markweave-image-upload-tooltip",
1646
1647
  role: "tooltip"
1647
1648
  }, `${n.clickToUpload}${n.dragAndDrop}. ${n.uploadNote}`)
1648
1649
  ]),
1649
- U("div", { class: "markweave-image-upload-row" }, [
1650
- U("input", {
1650
+ H("div", { class: "markweave-image-upload-row" }, [
1651
+ H("input", {
1651
1652
  "data-testid": "markweave-image-url-input",
1652
1653
  value: e.inputValue,
1653
1654
  placeholder: n.uploadInputPlaceholder,
@@ -1657,30 +1658,30 @@ function Gi(e) {
1657
1658
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1658
1659
  }
1659
1660
  }),
1660
- U("button", {
1661
+ H("button", {
1661
1662
  type: "button",
1662
1663
  "data-testid": "markweave-image-upload-submit",
1663
1664
  disabled: e.isSubmitting || !e.inputValue.trim(),
1664
1665
  onClick: e.onSubmit
1665
- }, [U(ti, {
1666
+ }, [H(ii, {
1666
1667
  size: 16,
1667
1668
  strokeWidth: 1.8
1668
1669
  }), e.messages.common.insert]),
1669
- U("button", {
1670
+ H("button", {
1670
1671
  type: "button",
1671
1672
  "data-testid": "markweave-image-upload-cancel",
1672
1673
  onClick: e.onCancel
1673
1674
  }, e.messages.common.cancel)
1674
1675
  ]),
1675
- e.error ? U("div", {
1676
+ e.error ? H("div", {
1676
1677
  class: "markweave-image-upload-error",
1677
1678
  role: "alert"
1678
1679
  }, e.error) : null
1679
1680
  ]);
1680
1681
  }
1681
- function Ki(e) {
1682
- let t = W(null), n = e.messages.video;
1683
- return U("section", {
1682
+ function Yi(e) {
1683
+ let t = U(null), n = e.messages.video;
1684
+ return H("section", {
1684
1685
  class: "markweave-video-upload-placeholder",
1685
1686
  "data-testid": "markweave-video-upload-placeholder",
1686
1687
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1698,7 +1699,7 @@ function Ki(e) {
1698
1699
  n && e.onFile(n);
1699
1700
  }
1700
1701
  }, [
1701
- U("input", {
1702
+ H("input", {
1702
1703
  ref: t,
1703
1704
  "data-testid": "markweave-video-file-input",
1704
1705
  type: "file",
@@ -1709,7 +1710,7 @@ function Ki(e) {
1709
1710
  r && e.onFile(r), n.value = "";
1710
1711
  }
1711
1712
  }),
1712
- U("button", {
1713
+ H("button", {
1713
1714
  type: "button",
1714
1715
  class: "markweave-video-upload-trigger",
1715
1716
  "data-testid": "markweave-video-upload-trigger",
@@ -1717,21 +1718,21 @@ function Ki(e) {
1717
1718
  onMousedown: (e) => e.preventDefault(),
1718
1719
  onClick: () => t.value?.click()
1719
1720
  }, [
1720
- U("span", {
1721
+ H("span", {
1721
1722
  class: "markweave-video-upload-icon",
1722
1723
  "aria-hidden": "true"
1723
- }, [U(Ii, {
1724
+ }, [H(zi, {
1724
1725
  size: 16,
1725
1726
  strokeWidth: 1.8
1726
1727
  })]),
1727
- U("span", { class: "markweave-video-upload-label" }, n.uploadLabel),
1728
- U("span", {
1728
+ H("span", { class: "markweave-video-upload-label" }, n.uploadLabel),
1729
+ H("span", {
1729
1730
  class: "markweave-video-upload-tooltip",
1730
1731
  role: "tooltip"
1731
1732
  }, `${n.clickToUpload}${n.dragAndDrop}. ${n.uploadNote}`)
1732
1733
  ]),
1733
- U("div", { class: "markweave-video-upload-row" }, [
1734
- U("input", {
1734
+ H("div", { class: "markweave-video-upload-row" }, [
1735
+ H("input", {
1735
1736
  "data-testid": "markweave-video-url-input",
1736
1737
  value: e.inputValue,
1737
1738
  placeholder: n.uploadInputPlaceholder,
@@ -1741,28 +1742,28 @@ function Ki(e) {
1741
1742
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1742
1743
  }
1743
1744
  }),
1744
- U("button", {
1745
+ H("button", {
1745
1746
  type: "button",
1746
1747
  "data-testid": "markweave-video-upload-submit",
1747
1748
  disabled: e.isSubmitting || !e.inputValue.trim(),
1748
1749
  onClick: e.onSubmit
1749
- }, [U(Fi, {
1750
+ }, [H(Ri, {
1750
1751
  size: 16,
1751
1752
  strokeWidth: 1.8
1752
1753
  }), e.messages.common.insert]),
1753
- U("button", {
1754
+ H("button", {
1754
1755
  type: "button",
1755
1756
  "data-testid": "markweave-video-upload-cancel",
1756
1757
  onClick: e.onCancel
1757
1758
  }, e.messages.common.cancel)
1758
1759
  ]),
1759
- e.error ? U("div", {
1760
+ e.error ? H("div", {
1760
1761
  class: "markweave-video-upload-error",
1761
1762
  role: "alert"
1762
1763
  }, e.error) : null
1763
1764
  ]);
1764
1765
  }
1765
- var qi = X({
1766
+ var Xi = Y({
1766
1767
  name: "MarkweaveVueImageNodeView",
1767
1768
  props: {
1768
1769
  editor: {
@@ -1795,8 +1796,8 @@ var qi = X({
1795
1796
  }
1796
1797
  },
1797
1798
  setup(e) {
1798
- let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = K(() => e.node.attrs), f = W(!!P(d.value.caption)), p = W(P(d.value.caption) ?? ""), m = zi(e.editor), h = K(() => u(m.value)), g = K(() => e.extension.options?.messages ?? t("zh")), _ = K(() => g.value.image), v = K(() => P(d.value.src)), b = K(() => e.extension.options?.resolveMediaSource), S = W(null), C = null;
1799
- q(v, (t) => {
1799
+ let n = U(null), r = U(!1), i = U(!1), a = U(!1), s = U(""), c = U(null), l = U(!1), d = G(() => e.node.attrs), f = U(!!N(d.value.caption)), p = U(N(d.value.caption) ?? ""), m = Hi(e.editor), h = G(() => u(m.value)), g = G(() => e.extension.options?.messages ?? t("zh")), _ = G(() => g.value.image), v = G(() => N(d.value.src)), b = G(() => e.extension.options?.resolveMediaSource), S = U(null), C = null;
1800
+ K(v, (t) => {
1800
1801
  if (C?.abort(), C = null, !t) {
1801
1802
  S.value = null;
1802
1803
  return;
@@ -1815,11 +1816,11 @@ var qi = X({
1815
1816
  }).then((e) => {
1816
1817
  r.signal.aborted || (S.value = e);
1817
1818
  });
1818
- }, { immediate: !0 }), J(() => C?.abort());
1819
- let T = K(() => S.value?.src ?? (b.value ? null : v.value)), E = K(() => Ri(d.value.align)), k = K(() => N(d.value.width)), j = K(() => P(d.value.caption)), M = K(() => h.value && (!v.value || i.value)), ee = () => {
1820
- T.value && y({
1821
- src: T.value,
1822
- alt: P(d.value.alt) ?? "",
1819
+ }, { immediate: !0 }), q(() => C?.abort());
1820
+ let w = G(() => S.value?.src ?? (b.value ? null : v.value)), T = G(() => Vi(d.value.align)), O = G(() => M(d.value.width)), A = G(() => N(d.value.caption)), j = G(() => h.value && (!v.value || i.value)), te = () => {
1821
+ w.value && y({
1822
+ src: w.value,
1823
+ alt: N(d.value.alt) ?? "",
1823
1824
  messages: {
1824
1825
  dialogAriaLabel: _.value.previewDialogAriaLabel,
1825
1826
  zoomOut: _.value.previewZoomOut,
@@ -1829,67 +1830,67 @@ var qi = X({
1829
1830
  }
1830
1831
  });
1831
1832
  };
1832
- q(j, (e) => {
1833
+ K(A, (e) => {
1833
1834
  f.value || (p.value = e ?? "");
1834
1835
  });
1835
- let F = () => {
1836
+ let P = () => {
1836
1837
  if (!h.value) return;
1837
1838
  let t = e.getPos();
1838
1839
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1839
- }, te = () => {
1840
+ }, ne = () => {
1840
1841
  if (s.value = "", c.value = null, a.value = !1, v.value) {
1841
1842
  i.value = !1;
1842
1843
  return;
1843
1844
  }
1844
1845
  e.deleteNode();
1845
- }, I = async (t) => {
1846
+ }, F = async (t) => {
1846
1847
  if (!h.value) return;
1847
1848
  let n = e.extension.options;
1848
1849
  l.value = !0, c.value = null;
1849
1850
  try {
1850
- let r = await H(O(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1851
- e.updateAttributes(w(d.value, r)), s.value = "", i.value = !1;
1851
+ let r = await V(D(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1852
+ e.updateAttributes(ee(d.value, r)), s.value = "", i.value = !1;
1852
1853
  } catch (e) {
1853
1854
  c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
1854
1855
  } finally {
1855
1856
  l.value = !1, a.value = !1;
1856
1857
  }
1857
- }, L = () => {
1858
+ }, I = () => {
1858
1859
  if (!s.value.trim()) {
1859
1860
  c.value = _.value.uploadRequiredError;
1860
1861
  return;
1861
1862
  }
1862
- I(B(s.value));
1863
- }, R = (e) => {
1864
- I({
1863
+ F(z(s.value));
1864
+ }, L = (e) => {
1865
+ F({
1865
1866
  type: "file",
1866
1867
  file: e,
1867
1868
  mimeType: e.type || "image/*"
1868
1869
  });
1869
- }, z = () => {
1870
- f.value = !f.value, f.value && (p.value = j.value ?? "");
1871
- }, V = (t, r) => {
1870
+ }, R = () => {
1871
+ f.value = !f.value, f.value && (p.value = A.value ?? "");
1872
+ }, B = (t, r) => {
1872
1873
  if (!h.value || !v.value) return;
1873
- r.preventDefault(), r.stopPropagation(), F();
1874
+ r.preventDefault(), r.stopPropagation(), P();
1874
1875
  let i = n.value;
1875
1876
  if (!i) return;
1876
- let a = r.clientX, o = i.getBoundingClientRect().width || k.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (n) => {
1877
+ let a = r.clientX, o = i.getBoundingClientRect().width || O.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (n) => {
1877
1878
  let r = t === "right" ? n.clientX - a : a - n.clientX;
1878
- e.updateAttributes({ width: D(o + r, s) });
1879
+ e.updateAttributes({ width: E(o + r, s) });
1879
1880
  }, l = () => {
1880
1881
  window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
1881
1882
  };
1882
1883
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1883
1884
  };
1884
- return () => M.value ? U(o, {
1885
+ return () => j.value ? H(o, {
1885
1886
  as: "figure",
1886
1887
  class: "markweave-image-node",
1887
1888
  "data-testid": "markweave-image-node",
1888
- "data-align": E.value,
1889
+ "data-align": T.value,
1889
1890
  "data-selected": "false",
1890
1891
  "data-hovered": "false",
1891
1892
  "data-empty": "true"
1892
- }, () => Gi({
1893
+ }, () => Ji({
1893
1894
  messages: g.value,
1894
1895
  inputValue: s.value,
1895
1896
  error: c.value,
@@ -1898,17 +1899,17 @@ var qi = X({
1898
1899
  onInputValue: (e) => {
1899
1900
  s.value = e;
1900
1901
  },
1901
- onFile: R,
1902
- onSubmit: L,
1903
- onCancel: te,
1902
+ onFile: L,
1903
+ onSubmit: I,
1904
+ onCancel: ne,
1904
1905
  onDragActive: (e) => {
1905
1906
  a.value = e;
1906
1907
  }
1907
- })) : U(o, {
1908
+ })) : H(o, {
1908
1909
  as: "figure",
1909
1910
  class: "markweave-image-node",
1910
1911
  "data-testid": "markweave-image-node",
1911
- "data-align": E.value,
1912
+ "data-align": T.value,
1912
1913
  "data-selected": h.value && e.selected ? "true" : "false",
1913
1914
  "data-hovered": r.value ? "true" : "false",
1914
1915
  "data-empty": "false",
@@ -1919,104 +1920,104 @@ var qi = X({
1919
1920
  r.value = !1;
1920
1921
  },
1921
1922
  onMousedown: (e) => {
1922
- h.value && !Bi(e.target) && F();
1923
+ h.value && !Ui(e.target) && P();
1923
1924
  }
1924
1925
  }, () => [
1925
- h.value ? U("div", {
1926
+ h.value ? H("div", {
1926
1927
  class: "markweave-image-toolbar",
1927
1928
  "data-testid": "markweave-image-toolbar",
1928
1929
  "data-markweave-image-ui": "true",
1929
1930
  "aria-label": _.value.toolsAriaLabel
1930
1931
  }, [
1931
- Wi({
1932
+ qi({
1932
1933
  testId: "markweave-image-align-left",
1933
1934
  label: _.value.alignLeft,
1934
- icon: br,
1935
- active: E.value === "left",
1935
+ icon: Cr,
1936
+ active: T.value === "left",
1936
1937
  onClick: () => e.updateAttributes({ align: "left" })
1937
1938
  }),
1938
- Wi({
1939
+ qi({
1939
1940
  testId: "markweave-image-align-center",
1940
1941
  label: _.value.alignCenter,
1941
- icon: vr,
1942
- active: E.value === "center",
1942
+ icon: xr,
1943
+ active: T.value === "center",
1943
1944
  onClick: () => e.updateAttributes({ align: "center" })
1944
1945
  }),
1945
- Wi({
1946
+ qi({
1946
1947
  testId: "markweave-image-align-right",
1947
1948
  label: _.value.alignRight,
1948
- icon: xr,
1949
- active: E.value === "right",
1949
+ icon: wr,
1950
+ active: T.value === "right",
1950
1951
  onClick: () => e.updateAttributes({ align: "right" })
1951
1952
  }),
1952
- U("span", {
1953
+ H("span", {
1953
1954
  class: "markweave-image-toolbar-divider",
1954
1955
  "aria-hidden": "true"
1955
1956
  }),
1956
- Wi({
1957
+ qi({
1957
1958
  testId: "markweave-image-caption",
1958
1959
  label: _.value.caption,
1959
- icon: Rr,
1960
- active: f.value || !!j.value,
1961
- onClick: z
1960
+ icon: Vr,
1961
+ active: f.value || !!A.value,
1962
+ onClick: R
1962
1963
  }),
1963
- Wi({
1964
+ qi({
1964
1965
  testId: "markweave-image-preview",
1965
1966
  label: _.value.preview,
1966
- icon: Yr,
1967
- onClick: ee
1967
+ icon: Qr,
1968
+ onClick: te
1968
1969
  }),
1969
- Wi({
1970
+ qi({
1970
1971
  testId: "markweave-image-download",
1971
1972
  label: _.value.download,
1972
- icon: Jr,
1973
+ icon: Zr,
1973
1974
  onClick: () => {
1974
- T.value && A(T.value);
1975
+ w.value && k(w.value);
1975
1976
  }
1976
1977
  }),
1977
- Wi({
1978
+ qi({
1978
1979
  testId: "markweave-image-replace",
1979
1980
  label: _.value.replace,
1980
- icon: vi,
1981
+ icon: xi,
1981
1982
  onClick: () => {
1982
1983
  s.value = "", c.value = null, i.value = !0;
1983
1984
  }
1984
1985
  }),
1985
- U("span", {
1986
+ H("span", {
1986
1987
  class: "markweave-image-toolbar-divider",
1987
1988
  "aria-hidden": "true"
1988
1989
  }),
1989
- Wi({
1990
+ qi({
1990
1991
  testId: "markweave-image-delete",
1991
1992
  label: _.value.delete,
1992
- icon: Mi,
1993
+ icon: Fi,
1993
1994
  onClick: () => e.deleteNode()
1994
1995
  })
1995
1996
  ]) : null,
1996
- U("div", {
1997
+ H("div", {
1997
1998
  ref: n,
1998
1999
  class: "markweave-image-box",
1999
2000
  style: {
2000
- ...k.value ? { width: `${Math.round(k.value)}px` } : {},
2001
+ ...O.value ? { width: `${Math.round(O.value)}px` } : {},
2001
2002
  ...S.value?.width && S.value.height ? { aspectRatio: `${S.value.width} / ${S.value.height}` } : {}
2002
2003
  }
2003
2004
  }, [
2004
- T.value ? U("img", {
2005
+ w.value ? H("img", {
2005
2006
  class: "markweave-image",
2006
- src: T.value,
2007
- alt: P(d.value.alt) ?? "",
2008
- title: P(d.value.title) ?? void 0,
2007
+ src: w.value,
2008
+ alt: N(d.value.alt) ?? "",
2009
+ title: N(d.value.title) ?? void 0,
2009
2010
  draggable: !1,
2010
2011
  loading: "lazy",
2011
2012
  decoding: "async",
2012
2013
  width: S.value?.width,
2013
2014
  height: S.value?.height
2014
- }) : U("div", {
2015
+ }) : H("div", {
2015
2016
  class: "markweave-image-readonly-empty",
2016
2017
  "data-testid": "markweave-image-readonly-empty",
2017
2018
  "aria-hidden": "true"
2018
2019
  }),
2019
- !h.value && T.value ? U("button", {
2020
+ !h.value && w.value ? H("button", {
2020
2021
  type: "button",
2021
2022
  class: "markweave-image-preview-trigger",
2022
2023
  "data-testid": "markweave-image-preview",
@@ -2024,34 +2025,34 @@ var qi = X({
2024
2025
  "aria-label": _.value.preview,
2025
2026
  title: _.value.preview,
2026
2027
  onMousedown: (e) => e.preventDefault(),
2027
- onClick: ee
2028
- }, [U(Yr, {
2028
+ onClick: te
2029
+ }, [H(Qr, {
2029
2030
  size: 16,
2030
2031
  strokeWidth: 1.8
2031
- }), U("span", {
2032
+ }), H("span", {
2032
2033
  class: "markweave-image-tooltip",
2033
2034
  role: "tooltip"
2034
2035
  }, _.value.preview)]) : null,
2035
- h.value ? U("button", {
2036
+ h.value ? H("button", {
2036
2037
  type: "button",
2037
2038
  class: "markweave-image-resize-handle",
2038
2039
  "data-testid": "markweave-image-resize-left",
2039
2040
  "data-side": "left",
2040
2041
  "aria-label": _.value.resizeLeft,
2041
2042
  "data-markweave-image-ui": "true",
2042
- onPointerdown: (e) => V("left", e)
2043
+ onPointerdown: (e) => B("left", e)
2043
2044
  }) : null,
2044
- h.value ? U("button", {
2045
+ h.value ? H("button", {
2045
2046
  type: "button",
2046
2047
  class: "markweave-image-resize-handle",
2047
2048
  "data-testid": "markweave-image-resize-right",
2048
2049
  "data-side": "right",
2049
2050
  "aria-label": _.value.resizeRight,
2050
2051
  "data-markweave-image-ui": "true",
2051
- onPointerdown: (e) => V("right", e)
2052
+ onPointerdown: (e) => B("right", e)
2052
2053
  }) : null
2053
2054
  ]),
2054
- h.value && (f.value || j.value) ? U("input", {
2055
+ h.value && (f.value || A.value) ? H("input", {
2055
2056
  class: "markweave-image-caption-input",
2056
2057
  "data-testid": "markweave-image-caption-input",
2057
2058
  "data-markweave-image-ui": "true",
@@ -2064,13 +2065,13 @@ var qi = X({
2064
2065
  onKeydown: (e) => {
2065
2066
  e.key === "Escape" && (e.preventDefault(), f.value = !1);
2066
2067
  }
2067
- }) : j.value ? U("figcaption", {
2068
+ }) : A.value ? H("figcaption", {
2068
2069
  class: "markweave-image-caption",
2069
2070
  "data-testid": "markweave-image-caption"
2070
- }, j.value) : null
2071
+ }, A.value) : null
2071
2072
  ]);
2072
2073
  }
2073
- }), Ji = X({
2074
+ }), Zi = Y({
2074
2075
  name: "MarkweaveVueVideoNodeView",
2075
2076
  props: {
2076
2077
  editor: {
@@ -2103,15 +2104,15 @@ var qi = X({
2103
2104
  }
2104
2105
  },
2105
2106
  setup(e) {
2106
- let n = W(!1), r = W(""), i = W(null), a = W(!1), s = zi(e.editor), c = K(() => u(s.value)), l = K(() => e.extension.options?.messages ?? t("zh")), d = K(() => l.value.video), f = K(() => e.node.attrs), p = K(() => P(f.value.src)), m = K(() => P(f.value.embedUrl)), h = K(() => P(f.value.provider)), g = K(() => m.value ? ee(m.value, h.value) : null), _ = K(() => P(f.value.mimeType)), v = K(() => P(f.value.title)), y = () => {
2107
+ let n = U(!1), r = U(""), i = U(null), a = U(!1), s = Hi(e.editor), c = G(() => u(s.value)), l = G(() => e.extension.options?.messages ?? t("zh")), d = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => N(f.value.src)), m = G(() => N(f.value.embedUrl)), h = G(() => N(f.value.provider)), g = G(() => m.value ? te(m.value, h.value) : null), _ = G(() => N(f.value.mimeType)), v = G(() => N(f.value.title)), y = () => {
2107
2108
  p.value || e.deleteNode(), r.value = "", i.value = null, n.value = !1;
2108
2109
  }, b = async (t) => {
2109
2110
  if (!c.value) return;
2110
2111
  let o = e.extension.options;
2111
2112
  a.value = !0, i.value = null;
2112
2113
  try {
2113
- let n = await H(k(t), o?.onUpload);
2114
- e.updateAttributes(T(n)), r.value = "";
2114
+ let n = await V(O(t), o?.onUpload);
2115
+ e.updateAttributes(w(n)), r.value = "";
2115
2116
  } catch (e) {
2116
2117
  i.value = e instanceof Error ? e.message : d.value.uploadFailedError;
2117
2118
  } finally {
@@ -2119,7 +2120,7 @@ var qi = X({
2119
2120
  }
2120
2121
  }, x = () => {
2121
2122
  if (!c.value) return;
2122
- let t = E(r.value);
2123
+ let t = T(r.value);
2123
2124
  if (!t) {
2124
2125
  i.value = d.value.unsupportedUrlError;
2125
2126
  return;
@@ -2135,16 +2136,16 @@ var qi = X({
2135
2136
  if (!c.value) return;
2136
2137
  let t = e.getPos();
2137
2138
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
2138
- }, w = (t) => {
2139
+ }, ee = (t) => {
2139
2140
  c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
2140
2141
  };
2141
- return () => c.value && !p.value ? U(o, {
2142
+ return () => c.value && !p.value ? H(o, {
2142
2143
  as: "figure",
2143
2144
  class: "markweave-video-node",
2144
2145
  "data-testid": "markweave-video-node",
2145
2146
  "data-empty": "true",
2146
2147
  "data-selected": "false"
2147
- }, () => Ki({
2148
+ }, () => Yi({
2148
2149
  messages: l.value,
2149
2150
  inputValue: r.value,
2150
2151
  error: i.value,
@@ -2159,7 +2160,7 @@ var qi = X({
2159
2160
  onDragActive: (e) => {
2160
2161
  n.value = e;
2161
2162
  }
2162
- })) : U(o, {
2163
+ })) : H(o, {
2163
2164
  as: "figure",
2164
2165
  class: "markweave-video-node",
2165
2166
  "data-testid": "markweave-video-node",
@@ -2169,27 +2170,27 @@ var qi = X({
2169
2170
  "aria-label": d.value.nodeAriaLabel,
2170
2171
  tabindex: c.value ? 0 : void 0,
2171
2172
  onFocus: C,
2172
- onKeydown: w,
2173
+ onKeydown: ee,
2173
2174
  onMousedown: (e) => {
2174
- c.value && !Vi(e.target) && (e.preventDefault(), C());
2175
+ c.value && !Wi(e.target) && (e.preventDefault(), C());
2175
2176
  }
2176
- }, () => [g.value ? U("div", { class: "markweave-video-embed" }, [U("iframe", {
2177
+ }, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
2177
2178
  class: "markweave-video-iframe",
2178
2179
  src: g.value,
2179
2180
  title: v.value ?? `${h.value ?? "Video"} embed`,
2180
2181
  "data-markweave-video-embed": "true",
2181
2182
  "data-markweave-video-provider": h.value ?? void 0,
2182
2183
  "data-markweave-video-src": p.value ?? void 0,
2183
- allow: j,
2184
+ allow: A,
2184
2185
  loading: "lazy",
2185
2186
  allowfullscreen: "true"
2186
- }), c.value ? U("button", {
2187
+ }), c.value ? H("button", {
2187
2188
  type: "button",
2188
2189
  class: "markweave-video-selection-layer",
2189
2190
  "data-testid": "markweave-video-selection-layer",
2190
2191
  tabindex: -1,
2191
2192
  "aria-label": d.value.selectAriaLabel
2192
- }) : null]) : p.value ? U("div", { class: "markweave-video-box" }, [U("video", {
2193
+ }) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
2193
2194
  class: "markweave-video",
2194
2195
  src: p.value,
2195
2196
  title: v.value ?? void 0,
@@ -2197,19 +2198,19 @@ var qi = X({
2197
2198
  controls: !0,
2198
2199
  "data-markweave-video": "true",
2199
2200
  "data-markweave-mime-type": _.value ?? void 0
2200
- }), c.value ? U("button", {
2201
+ }), c.value ? H("button", {
2201
2202
  type: "button",
2202
2203
  class: "markweave-video-selection-layer",
2203
2204
  "data-testid": "markweave-video-selection-layer",
2204
2205
  tabindex: -1,
2205
2206
  "aria-label": d.value.selectAriaLabel
2206
- }) : null]) : U("div", {
2207
+ }) : null]) : H("div", {
2207
2208
  class: "markweave-video-readonly-empty",
2208
2209
  "data-testid": "markweave-video-readonly-empty",
2209
2210
  "aria-hidden": "true"
2210
2211
  })]);
2211
2212
  }
2212
- }), Yi = S.extend({
2213
+ }), Qi = S.extend({
2213
2214
  addOptions() {
2214
2215
  return {
2215
2216
  ...this.parent?.(),
@@ -2220,16 +2221,16 @@ var qi = X({
2220
2221
  },
2221
2222
  addNodeView() {
2222
2223
  if (typeof document > "u") return null;
2223
- let e = s(qi, { stopEvent: ({ event: e }) => Bi(e.target) }), n = this.options.resolveMediaSource;
2224
+ let e = s(Xi, { stopEvent: ({ event: e }) => Ui(e.target) }), n = this.options.resolveMediaSource;
2224
2225
  if (!n) return e;
2225
2226
  let r = b({
2226
2227
  messages: this.options.messages ?? t("zh"),
2227
2228
  onUpload: this.options.onUpload,
2228
2229
  resolveMediaSource: n
2229
2230
  });
2230
- return (t) => P(t.node.attrs.src) ? r(t) : e(t);
2231
+ return (t) => N(t.node.attrs.src) ? r(t) : e(t);
2231
2232
  }
2232
- }), Xi = C.extend({
2233
+ }), $i = C.extend({
2233
2234
  addOptions() {
2234
2235
  return {
2235
2236
  ...this.parent?.(),
@@ -2239,16 +2240,16 @@ var qi = X({
2239
2240
  };
2240
2241
  },
2241
2242
  addNodeView() {
2242
- return typeof document > "u" ? null : s(Ji, { stopEvent: ({ event: e }) => Vi(e.target) });
2243
+ return typeof document > "u" ? null : s(Zi, { stopEvent: ({ event: e }) => Wi(e.target) });
2243
2244
  }
2244
2245
  });
2245
- function Zi(e) {
2246
+ function ea(e) {
2246
2247
  return e instanceof Element && !!e.closest("[data-markweave-attachment-ui=\"true\"], .markweave-attachment-upload-placeholder, .markweave-attachment-uploading");
2247
2248
  }
2248
- function Qi(e, t) {
2249
+ function ta(e, t) {
2249
2250
  return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : Math.max(0, Math.min(100, Math.round(e / t * 100)));
2250
2251
  }
2251
- var $i = X({
2252
+ var na = Y({
2252
2253
  name: "MarkweaveVueAttachmentNodeView",
2253
2254
  props: {
2254
2255
  editor: {
@@ -2281,7 +2282,7 @@ var $i = X({
2281
2282
  }
2282
2283
  },
2283
2284
  setup(e) {
2284
- let n = K(() => e.extension.options), r = K(() => n.value?.messages ?? t("zh")), i = zi(e.editor), a = K(() => u(i.value)), s = K(() => I(e.node.attrs ?? {})), c = K(() => s.value?.name ?? P(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = K(() => [P(e.node.attrs?.mimeType), R(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = W(null), p = W(!1), m = W(!1), h = W(null), g = W(null), _ = W(null), v = W(null), y = () => {
2285
+ let n = G(() => e.extension.options), r = G(() => n.value?.messages ?? t("zh")), i = Hi(e.editor), a = G(() => u(i.value)), s = G(() => F(e.node.attrs ?? {})), c = G(() => s.value?.name ?? N(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = G(() => [N(e.node.attrs?.mimeType), L(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = U(null), p = U(!1), m = U(!1), h = U(null), g = U(null), _ = U(null), v = U(null), y = () => {
2285
2286
  if (!a.value) return;
2286
2287
  let t = e.getPos();
2287
2288
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
@@ -2291,17 +2292,17 @@ var $i = X({
2291
2292
  if (!(!a.value || !t || m.value)) {
2292
2293
  h.value = null, m.value = !0, g.value = t.name, _.value = t.size, v.value = null;
2293
2294
  try {
2294
- let r = await H({
2295
- ...L({
2295
+ let r = await V({
2296
+ ...I({
2296
2297
  type: "file",
2297
2298
  file: t,
2298
2299
  mimeType: t.type || void 0
2299
2300
  }),
2300
2301
  onProgress: (e) => {
2301
- v.value = Qi(e.loaded, e.total);
2302
+ v.value = ta(e.loaded, e.total);
2302
2303
  }
2303
2304
  }, n.value?.onUpload);
2304
- e.updateAttributes(te(r));
2305
+ e.updateAttributes(ne(r));
2305
2306
  } catch (e) {
2306
2307
  h.value = e instanceof Error ? e.message : r.value.attachment.uploadFailedError;
2307
2308
  } finally {
@@ -2309,16 +2310,16 @@ var $i = X({
2309
2310
  }
2310
2311
  }
2311
2312
  }, S = (t) => {
2312
- t.preventDefault(), t.stopPropagation(), s.value && F(s.value, {
2313
+ t.preventDefault(), t.stopPropagation(), s.value && P(s.value, {
2313
2314
  mode: l(e.editor).mode,
2314
2315
  event: t
2315
2316
  }, n.value?.onDownload);
2316
2317
  }, C = (e) => {
2317
- Zi(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
2318
+ ea(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
2318
2319
  };
2319
2320
  return () => {
2320
- let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [R(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
2321
- return n ? U(o, {
2321
+ let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [L(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
2322
+ return n ? H(o, {
2322
2323
  as: "div",
2323
2324
  class: "markweave-attachment markweave-attachment-upload-placeholder",
2324
2325
  "data-markweave-attachment": "true",
@@ -2330,7 +2331,7 @@ var $i = X({
2330
2331
  onKeydown: (t) => {
2331
2332
  a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
2332
2333
  }
2333
- }, [U("input", {
2334
+ }, [H("input", {
2334
2335
  ref: f,
2335
2336
  type: "file",
2336
2337
  hidden: !0,
@@ -2338,7 +2339,7 @@ var $i = X({
2338
2339
  onChange: (e) => {
2339
2340
  x(e.target.files?.[0] ?? null);
2340
2341
  }
2341
- }), U("button", {
2342
+ }), H("button", {
2342
2343
  type: "button",
2343
2344
  class: "markweave-attachment-upload-trigger",
2344
2345
  "data-markweave-attachment-ui": "true",
@@ -2347,13 +2348,13 @@ var $i = X({
2347
2348
  onMousedown: (e) => e.preventDefault(),
2348
2349
  onClick: () => b()
2349
2350
  }, [
2350
- U("span", {
2351
+ H("span", {
2351
2352
  class: "markweave-attachment-icon",
2352
2353
  "aria-hidden": "true"
2353
- }, [Ui(Fi, t.uploadLabel)]),
2354
- U("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
2355
- h.value ? U("span", { class: "markweave-attachment-upload-error" }, h.value) : null
2356
- ])]) : i ? U(o, {
2354
+ }, [Ki(Ri, t.uploadLabel)]),
2355
+ H("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
2356
+ h.value ? H("span", { class: "markweave-attachment-upload-error" }, h.value) : null
2357
+ ])]) : i ? H(o, {
2357
2358
  as: "div",
2358
2359
  class: "markweave-attachment markweave-attachment-uploading",
2359
2360
  "data-markweave-attachment": "true",
@@ -2369,13 +2370,13 @@ var $i = X({
2369
2370
  onKeydown: (t) => {
2370
2371
  a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
2371
2372
  }
2372
- }, [U("span", {
2373
+ }, [H("span", {
2373
2374
  class: "markweave-attachment-icon",
2374
2375
  "aria-hidden": "true"
2375
- }, [Ui(Fi, t.uploading)]), U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), U("span", { class: "markweave-attachment-meta" }, [U("span", {
2376
+ }, [Ki(Ri, t.uploading)]), H("span", { class: "markweave-attachment-body" }, [H("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), H("span", { class: "markweave-attachment-meta" }, [H("span", {
2376
2377
  class: "markweave-attachment-spinner",
2377
2378
  "aria-hidden": "true"
2378
- }), u || t.uploading])])]) : U(o, {
2379
+ }), u || t.uploading])])]) : H(o, {
2379
2380
  as: "div",
2380
2381
  class: "markweave-attachment",
2381
2382
  "data-markweave-attachment": "true",
@@ -2391,22 +2392,22 @@ var $i = X({
2391
2392
  p.value = !1;
2392
2393
  },
2393
2394
  onMousedown: (e) => {
2394
- !a.value || Zi(e.target) || (e.preventDefault(), y());
2395
+ !a.value || ea(e.target) || (e.preventDefault(), y());
2395
2396
  },
2396
2397
  onKeydown: (t) => {
2397
2398
  a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
2398
2399
  },
2399
2400
  onClick: C
2400
2401
  }, [
2401
- U("span", {
2402
+ H("span", {
2402
2403
  class: "markweave-attachment-icon",
2403
2404
  "aria-hidden": "true"
2404
- }, [Ui(mi, t.nodeAriaLabel)]),
2405
- U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, c.value), d.value ? U("span", { class: "markweave-attachment-meta" }, d.value) : null]),
2406
- l ? U("span", {
2405
+ }, [Ki(_i, t.nodeAriaLabel)]),
2406
+ H("span", { class: "markweave-attachment-body" }, [H("span", { class: "markweave-attachment-name" }, c.value), d.value ? H("span", { class: "markweave-attachment-meta" }, d.value) : null]),
2407
+ l ? H("span", {
2407
2408
  class: "markweave-attachment-actions",
2408
2409
  "data-markweave-attachment-ui": "true"
2409
- }, [U("button", {
2410
+ }, [H("button", {
2410
2411
  type: "button",
2411
2412
  class: "markweave-attachment-download",
2412
2413
  "data-markweave-attachment-ui": "true",
@@ -2414,10 +2415,10 @@ var $i = X({
2414
2415
  "aria-label": t.downloadAriaLabel,
2415
2416
  onMousedown: (e) => e.preventDefault(),
2416
2417
  onClick: S
2417
- }, [Ui(Jr, t.download), U("span", {
2418
+ }, [Ki(Zr, t.download), H("span", {
2418
2419
  class: "markweave-attachment-tooltip",
2419
2420
  role: "tooltip"
2420
- }, t.download)]), a.value ? U("button", {
2421
+ }, t.download)]), a.value ? H("button", {
2421
2422
  type: "button",
2422
2423
  class: "markweave-attachment-delete",
2423
2424
  "data-markweave-attachment-ui": "true",
@@ -2427,14 +2428,14 @@ var $i = X({
2427
2428
  onClick: (t) => {
2428
2429
  t.preventDefault(), t.stopPropagation(), e.deleteNode();
2429
2430
  }
2430
- }, [Ui(Mi, t.delete), U("span", {
2431
+ }, [Ki(Fi, t.delete), H("span", {
2431
2432
  class: "markweave-attachment-tooltip",
2432
2433
  role: "tooltip"
2433
2434
  }, t.delete)]) : null]) : null
2434
2435
  ]);
2435
2436
  };
2436
2437
  }
2437
- }), ea = z.extend({
2438
+ }), ra = R.extend({
2438
2439
  addOptions() {
2439
2440
  return {
2440
2441
  ...this.parent?.(),
@@ -2445,9 +2446,9 @@ var $i = X({
2445
2446
  };
2446
2447
  },
2447
2448
  addNodeView() {
2448
- return typeof document > "u" ? null : s($i, { stopEvent: ({ event: e }) => Zi(e.target) });
2449
+ return typeof document > "u" ? null : s(na, { stopEvent: ({ event: e }) => ea(e.target) });
2449
2450
  }
2450
- }), ta = X({
2451
+ }), ia = Y({
2451
2452
  name: "MarkweaveVueLinkCardNodeView",
2452
2453
  props: {
2453
2454
  editor: {
@@ -2480,11 +2481,11 @@ var $i = X({
2480
2481
  }
2481
2482
  },
2482
2483
  setup(e) {
2483
- let n = e.extension.options, r = n.messages ?? t("zh"), i = zi(e.editor), a = W(!1), s = W(!1), c = W(!1), l = K(() => g(e.node.attrs ?? {})), d = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
2484
- q(l, (e) => {
2484
+ let n = e.extension.options, r = n.messages ?? t("zh"), i = Hi(e.editor), a = U(!1), s = U(!1), c = U(!1), l = G(() => g(e.node.attrs ?? {})), d = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
2485
+ K(l, (e) => {
2485
2486
  d.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
2486
2487
  });
2487
- let p = K(() => u(i.value)), m = K(() => {
2488
+ let p = G(() => u(i.value)), m = G(() => {
2488
2489
  try {
2489
2490
  return new URL(l.value?.href ?? "").host;
2490
2491
  } catch {
@@ -2508,18 +2509,18 @@ var $i = X({
2508
2509
  ...r,
2509
2510
  ...i
2510
2511
  }) ?? r);
2511
- }, C = (e, t, n, r) => U("button", {
2512
+ }, C = (e, t, n, r) => H("button", {
2512
2513
  type: "button",
2513
2514
  title: e,
2514
2515
  "aria-label": e,
2515
2516
  "data-testid": n,
2516
2517
  onMousedown: y,
2517
2518
  onClick: r
2518
- }, [Ui(t, e), U("span", { role: "tooltip" }, e)]);
2519
+ }, [Ki(t, e), H("span", { role: "tooltip" }, e)]);
2519
2520
  return () => {
2520
2521
  let t = l.value;
2521
2522
  if (!t) return null;
2522
- let i = !c.value && t.imageUrl ? U("img", {
2523
+ let i = !c.value && t.imageUrl ? H("img", {
2523
2524
  src: t.imageUrl,
2524
2525
  alt: "",
2525
2526
  loading: "lazy",
@@ -2527,7 +2528,7 @@ var $i = X({
2527
2528
  onError: () => {
2528
2529
  c.value = !0;
2529
2530
  }
2530
- }) : !c.value && t.faviconUrl ? U("img", {
2531
+ }) : !c.value && t.faviconUrl ? H("img", {
2531
2532
  class: "markweave-link-card-favicon",
2532
2533
  src: t.faviconUrl,
2533
2534
  alt: "",
@@ -2536,8 +2537,8 @@ var $i = X({
2536
2537
  onError: () => {
2537
2538
  c.value = !0;
2538
2539
  }
2539
- }) : U("b", null, m.value.slice(0, 1).toUpperCase());
2540
- return U(o, {
2540
+ }) : H("b", null, m.value.slice(0, 1).toUpperCase());
2541
+ return H(o, {
2541
2542
  as: "article",
2542
2543
  class: "markweave-link-card",
2543
2544
  "data-testid": "markweave-link-card",
@@ -2551,32 +2552,32 @@ var $i = X({
2551
2552
  a.value = !1;
2552
2553
  },
2553
2554
  onMousedown: (e) => {
2554
- Hi(e.target) || e.preventDefault();
2555
+ Gi(e.target) || e.preventDefault();
2555
2556
  },
2556
2557
  onClick: (e) => {
2557
- Hi(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
2558
+ Gi(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
2558
2559
  }
2559
2560
  }, () => [
2560
- U("a", {
2561
+ H("a", {
2561
2562
  class: "markweave-link-card-main",
2562
2563
  href: t.href,
2563
2564
  "aria-label": r.linkCard.open
2564
- }, [U("span", { class: "markweave-link-card-copy" }, [
2565
- U("strong", null, t.title),
2566
- t.description ? U("span", null, t.description) : null,
2567
- U("small", null, t.siteName ?? m.value)
2568
- ]), U("span", {
2565
+ }, [H("span", { class: "markweave-link-card-copy" }, [
2566
+ H("strong", null, t.title),
2567
+ t.description ? H("span", null, t.description) : null,
2568
+ H("small", null, t.siteName ?? m.value)
2569
+ ]), H("span", {
2569
2570
  class: "markweave-link-card-media",
2570
2571
  "aria-hidden": "true"
2571
2572
  }, [i])]),
2572
- p.value ? U("div", {
2573
+ p.value ? H("div", {
2573
2574
  class: "markweave-link-card-tools",
2574
2575
  "data-markweave-link-card-ui": "true",
2575
2576
  "aria-label": r.linkCard.toolsAriaLabel
2576
2577
  }, [
2577
- C(r.linkCard.convertToLink, si, "markweave-link-card-convert", x),
2578
- C(r.linkCard.copyAddress, Jr, "markweave-link-card-copy", () => b(t.href)),
2579
- C(r.linkCard.edit, hi, "markweave-link-card-edit", (i) => h({
2578
+ C(r.linkCard.convertToLink, ui, "markweave-link-card-convert", x),
2579
+ C(r.linkCard.copyAddress, Zr, "markweave-link-card-copy", () => b(t.href)),
2580
+ C(r.linkCard.edit, vi, "markweave-link-card-edit", (i) => h({
2580
2581
  anchor: i.currentTarget,
2581
2582
  editor: e.editor,
2582
2583
  messages: r,
@@ -2586,15 +2587,15 @@ var $i = X({
2586
2587
  attrs: t
2587
2588
  }
2588
2589
  })),
2589
- C(r.linkCard.delete, Mi, "markweave-link-card-delete", () => e.deleteNode())
2590
+ C(r.linkCard.delete, Fi, "markweave-link-card-delete", () => e.deleteNode())
2590
2591
  ]) : null,
2591
- p.value && s.value ? U("form", {
2592
+ p.value && s.value ? H("form", {
2592
2593
  class: "markweave-link-card-editor",
2593
2594
  "data-markweave-link-card-ui": "true",
2594
2595
  "data-testid": "markweave-link-card-editor",
2595
2596
  onSubmit: S
2596
2597
  }, [
2597
- U("label", null, [U("span", null, r.linkCard.titleLabel), U("input", {
2598
+ H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
2598
2599
  value: d.value,
2599
2600
  placeholder: r.linkCard.titlePlaceholder,
2600
2601
  "aria-label": r.linkCard.titleLabel,
@@ -2602,7 +2603,7 @@ var $i = X({
2602
2603
  d.value = e.target.value;
2603
2604
  }
2604
2605
  })]),
2605
- U("label", null, [U("span", null, r.linkCard.addressLabel), U("input", {
2606
+ H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
2606
2607
  value: f.value,
2607
2608
  placeholder: r.linkCard.addressPlaceholder,
2608
2609
  "aria-label": r.linkCard.addressLabel,
@@ -2610,16 +2611,16 @@ var $i = X({
2610
2611
  f.value = e.target.value;
2611
2612
  }
2612
2613
  })]),
2613
- U("button", {
2614
+ H("button", {
2614
2615
  type: "submit",
2615
2616
  disabled: !_(f.value),
2616
2617
  "aria-label": r.linkCard.edit
2617
- }, [Ui(si, r.linkCard.edit)])
2618
+ }, [Ki(ui, r.linkCard.edit)])
2618
2619
  ]) : null
2619
2620
  ]);
2620
2621
  };
2621
2622
  }
2622
- }), na = m.extend({
2623
+ }), aa = m.extend({
2623
2624
  addOptions() {
2624
2625
  return {
2625
2626
  ...this.parent?.(),
@@ -2628,24 +2629,25 @@ var $i = X({
2628
2629
  };
2629
2630
  },
2630
2631
  addNodeView() {
2631
- return typeof document > "u" ? null : s(ta, { stopEvent: ({ event: e }) => Hi(e.target) });
2632
+ return typeof document > "u" ? null : s(ia, { stopEvent: ({ event: e }) => Gi(e.target) });
2632
2633
  }
2633
2634
  });
2634
2635
  //#endregion
2635
2636
  //#region src/create-editor-extensions.ts
2636
- function ra(n = {}) {
2637
+ function oa(n = {}) {
2637
2638
  return e({
2638
2639
  lang: n.lang,
2639
2640
  onImageUpload: n.onImageUpload,
2640
- linkCardExtension: na.configure({
2641
+ tableCapabilities: n.tableCapabilities,
2642
+ linkCardExtension: aa.configure({
2641
2643
  lang: n.lang,
2642
2644
  messages: t(n.lang),
2643
2645
  resolver: n.linkCardResolver
2644
2646
  }),
2645
2647
  mediaExtensions: r({
2646
- image: Yi,
2647
- video: Xi,
2648
- attachment: ea,
2648
+ image: Qi,
2649
+ video: $i,
2650
+ attachment: ra,
2649
2651
  lang: n.lang,
2650
2652
  onImageUpload: n.onImageUpload,
2651
2653
  onVideoUpload: n.onVideoUpload,
@@ -2658,7 +2660,7 @@ function ra(n = {}) {
2658
2660
  }
2659
2661
  //#endregion
2660
2662
  //#region src/MarkweaveEditor.ts
2661
- var ia = {
2663
+ var sa = {
2662
2664
  active: !1,
2663
2665
  mode: "outside",
2664
2666
  activeCellPos: null,
@@ -2666,17 +2668,17 @@ var ia = {
2666
2668
  selectedCellCount: 0,
2667
2669
  selectionFrom: 0,
2668
2670
  selectionTo: 0
2669
- }, aa = {
2671
+ }, ca = {
2670
2672
  active: !1,
2671
- language: st.defaultLanguage,
2673
+ language: ct.defaultLanguage,
2672
2674
  mermaidPreviewMode: "code",
2673
2675
  pos: null,
2674
2676
  text: ""
2675
2677
  };
2676
- function oa(e) {
2677
- return En.getState(e.state) ?? Tn;
2678
+ function la(e) {
2679
+ return kn.getState(e.state) ?? On;
2678
2680
  }
2679
- function sa(e) {
2681
+ function ua(e) {
2680
2682
  if (!e || typeof window > "u") return null;
2681
2683
  let t = e.parentElement;
2682
2684
  for (; t;) {
@@ -2686,141 +2688,142 @@ function sa(e) {
2686
2688
  }
2687
2689
  return null;
2688
2690
  }
2689
- function Q(e, t, n = 18, r = 1.8) {
2690
- return U(e, {
2691
+ function Z(e, t, n = 18, r = 1.8) {
2692
+ return H(e, {
2691
2693
  size: n,
2692
2694
  strokeWidth: r,
2693
2695
  "aria-hidden": "true"
2694
2696
  }, { default: () => t });
2695
2697
  }
2696
- function ca(e) {
2697
- return e === "clipboard" ? [U("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" }), U("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" ? [U("circle", {
2698
+ function da(e) {
2699
+ return e === "clipboard" ? [H("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" }), H("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" ? [H("circle", {
2698
2700
  cx: "10",
2699
2701
  cy: "10",
2700
2702
  r: "5.5"
2701
- }), U("path", { d: "m14 14 4 4" })] : e === "check" ? [U("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2702
- U("path", { d: "M8 4H4v4" }),
2703
- U("path", { d: "M4 4l5 5" }),
2704
- U("path", { d: "M16 4h4v4" }),
2705
- U("path", { d: "m20 4-5 5" }),
2706
- U("path", { d: "M8 20H4v-4" }),
2707
- U("path", { d: "m4 20 5-5" }),
2708
- U("path", { d: "M16 20h4v-4" }),
2709
- U("path", { d: "m20 20-5-5" })
2703
+ }), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2704
+ H("path", { d: "M8 4H4v4" }),
2705
+ H("path", { d: "M4 4l5 5" }),
2706
+ H("path", { d: "M16 4h4v4" }),
2707
+ H("path", { d: "m20 4-5 5" }),
2708
+ H("path", { d: "M8 20H4v-4" }),
2709
+ H("path", { d: "m4 20 5-5" }),
2710
+ H("path", { d: "M16 20h4v-4" }),
2711
+ H("path", { d: "m20 20-5-5" })
2710
2712
  ] : e === "download" ? [
2711
- U("path", { d: "M12 4v10" }),
2712
- U("path", { d: "m8 10 4 4 4-4" }),
2713
- U("path", { d: "M5 19h14" })
2714
- ] : e === "close" ? [U("path", { d: "M6 6l12 12" }), U("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2715
- U("circle", {
2713
+ H("path", { d: "M12 4v10" }),
2714
+ H("path", { d: "m8 10 4 4 4-4" }),
2715
+ H("path", { d: "M5 19h14" })
2716
+ ] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2717
+ H("circle", {
2716
2718
  cx: "10",
2717
2719
  cy: "10",
2718
2720
  r: "5.25"
2719
2721
  }),
2720
- U("path", { d: "M7.5 10h5" }),
2721
- U("path", { d: "m14 14 4 4" })
2722
+ H("path", { d: "M7.5 10h5" }),
2723
+ H("path", { d: "m14 14 4 4" })
2722
2724
  ] : e === "zoomIn" ? [
2723
- U("circle", {
2725
+ H("circle", {
2724
2726
  cx: "10",
2725
2727
  cy: "10",
2726
2728
  r: "5.25"
2727
2729
  }),
2728
- U("path", { d: "M7.5 10h5" }),
2729
- U("path", { d: "M10 7.5v5" }),
2730
- U("path", { d: "m14 14 4 4" })
2731
- ] : e === "reset" ? [U("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), U("path", { d: "M6.5 8.5H3.5v-3" })] : [U("path", { d: "m6 9 6 6 6-6" })];
2730
+ H("path", { d: "M7.5 10h5" }),
2731
+ H("path", { d: "M10 7.5v5" }),
2732
+ H("path", { d: "m14 14 4 4" })
2733
+ ] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
2732
2734
  }
2733
- function la(e) {
2734
- return U("svg", {
2735
+ function Q(e) {
2736
+ return H("svg", {
2735
2737
  viewBox: "0 0 24 24",
2736
2738
  "aria-hidden": "true",
2737
2739
  focusable: "false"
2738
- }, U("g", {
2740
+ }, H("g", {
2739
2741
  fill: "none",
2740
2742
  stroke: "currentColor",
2741
2743
  "stroke-linecap": "round",
2742
2744
  "stroke-linejoin": "round",
2743
2745
  "stroke-width": "1.8"
2744
- }, ca(e)));
2746
+ }, da(e)));
2745
2747
  }
2746
2748
  function $(e) {
2747
2749
  e.preventDefault();
2748
2750
  }
2749
- function ua(e) {
2750
- let t = Rt(e);
2751
+ function fa(e) {
2752
+ let t = zt(e);
2751
2753
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
2752
2754
  }
2753
- var da = {
2754
- bold: Ir,
2755
- italic: ai,
2756
- underline: Pi,
2757
- strike: Ti,
2758
- "inline-code": Gr,
2759
- link: si,
2760
- more: fi,
2761
- superscript: Di,
2762
- subscript: Ei,
2763
- "inline-math": bi,
2764
- "align-left": br,
2765
- "align-center": vr,
2766
- "align-right": xr,
2767
- "align-justify": yr,
2768
- "decrease-indent": ni,
2769
- "increase-indent": ri
2770
- }, fa = {
2771
- type: ji,
2772
- "heading-1": Zr,
2773
- "heading-2": Qr,
2774
- "heading-3": $r,
2775
- "bullet-list": ci,
2776
- "ordered-list": ui,
2777
- "task-list": li,
2778
- blockquote: _i,
2779
- "code-block": Lr,
2780
- info: ii,
2781
- tip: oi,
2782
- warning: Tr,
2783
- error: Wr,
2784
- success: Br,
2785
- emoji: xi,
2786
- math: bi,
2787
- table: Oi,
2788
- separator: di,
2789
- image: ei,
2790
- video: Ii,
2791
- attachment: mi
2755
+ var pa = {
2756
+ bold: zr,
2757
+ italic: ci,
2758
+ underline: Li,
2759
+ strike: Oi,
2760
+ "inline-code": Jr,
2761
+ link: ui,
2762
+ more: hi,
2763
+ superscript: Ai,
2764
+ subscript: ki,
2765
+ "inline-math": Ci,
2766
+ "align-left": Cr,
2767
+ "align-center": xr,
2768
+ "align-right": wr,
2769
+ "align-justify": Sr,
2770
+ "decrease-indent": ai,
2771
+ "increase-indent": oi
2772
+ }, ma = {
2773
+ type: Pi,
2774
+ "heading-1": ei,
2775
+ "heading-2": ti,
2776
+ "heading-3": ni,
2777
+ "bullet-list": di,
2778
+ "ordered-list": pi,
2779
+ "task-list": fi,
2780
+ blockquote: bi,
2781
+ "code-block": Br,
2782
+ info: si,
2783
+ tip: li,
2784
+ warning: Or,
2785
+ error: qr,
2786
+ success: Ur,
2787
+ emoji: wi,
2788
+ math: Ci,
2789
+ table: ji,
2790
+ separator: mi,
2791
+ image: ri,
2792
+ video: zi,
2793
+ attachment: _i
2792
2794
  };
2793
- function pa(e) {
2795
+ function ha(e) {
2794
2796
  if (typeof e != "string") {
2795
- if (e.kind === "text") return U("span", {
2797
+ if (e.kind === "text") return H("span", {
2796
2798
  class: "markweave-slash-command-text-icon",
2799
+ "data-icon-length": an(e),
2797
2800
  "aria-hidden": "true"
2798
2801
  }, e.text);
2799
2802
  e = e.name;
2800
2803
  }
2801
- let t = fa[e];
2802
- return U(t, {
2804
+ let t = ma[e];
2805
+ return H(t, {
2803
2806
  size: 18,
2804
2807
  strokeWidth: 1.6,
2805
2808
  absoluteStrokeWidth: !0,
2806
2809
  "aria-hidden": "true"
2807
2810
  });
2808
2811
  }
2809
- var ma = {
2810
- paragraph: Ni,
2811
- "heading-1": Zr,
2812
- "heading-2": Qr,
2813
- "heading-3": $r,
2814
- "bullet-list": ci,
2815
- "numbered-list": ui,
2816
- "todo-list": li,
2817
- quote: _i,
2818
- "code-block": Lr
2812
+ var ga = {
2813
+ paragraph: Ii,
2814
+ "heading-1": ei,
2815
+ "heading-2": ti,
2816
+ "heading-3": ni,
2817
+ "bullet-list": di,
2818
+ "numbered-list": pi,
2819
+ "todo-list": fi,
2820
+ quote: bi,
2821
+ "code-block": Br
2819
2822
  };
2820
- function ha(e, t) {
2821
- return fe(e, t).label;
2823
+ function _a(e, t) {
2824
+ return pe(e, t).label;
2822
2825
  }
2823
- var ga = X({
2826
+ var va = Y({
2824
2827
  name: "MarkweaveVueFloatingToolbar",
2825
2828
  props: {
2826
2829
  editor: {
@@ -2845,73 +2848,73 @@ var ga = X({
2845
2848
  }
2846
2849
  },
2847
2850
  setup(e) {
2848
- let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s = G(null), c = G(null), l = W(null), u = W(null), d = "", f = K(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = W(""), m = W(null), h = W(null), g = W("bottom"), _ = W(null), v = W(null), y = W(null), b = K(() => Rt(p.value.trim())), x = K(() => e.messages.floatingToolbar), S = K(() => ge(e.messages).map((e) => [
2851
+ let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() => zt(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => _e(e.messages).map((e) => [
2849
2852
  e.id,
2850
2853
  e.label,
2851
- ma[e.id]
2852
- ])), C = K(() => he(e.messages).map((e) => [
2854
+ ga[e.id]
2855
+ ])), C = G(() => ge(e.messages).map((e) => [
2853
2856
  e.id,
2854
2857
  e.value,
2855
2858
  e.label
2856
- ])), w = K(() => pe(e.messages).map((e) => [
2859
+ ])), ee = G(() => me(e.messages).map((e) => [
2857
2860
  e.id,
2858
2861
  e.value,
2859
2862
  e.label
2860
- ])), T = K(() => me(e.messages).map((e) => e.id)), E = () => {
2863
+ ])), w = G(() => he(e.messages).map((e) => e.id)), T = () => {
2861
2864
  b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
2862
- }, D = () => {
2865
+ }, E = () => {
2863
2866
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
2864
- }, O = (n) => {
2867
+ }, D = (n) => {
2865
2868
  t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
2866
- }, k = oe(() => {
2867
- We(e.editor, d), a.value = d;
2868
- }), A = (n = !0) => {
2869
- c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && He(e.editor), Pe(e.editor), t.value = null, n && e.editor.commands.focus();
2870
- }, j = () => {
2869
+ }, O = se(() => {
2870
+ Ge(e.editor, d), a.value = d;
2871
+ }), k = (n = !0) => {
2872
+ c.value?.abort(), O.cancel(), d = "", c.value = null, l.value = null, n && Ue(e.editor), Fe(e.editor), t.value = null, n && e.editor.commands.focus();
2873
+ }, A = () => {
2871
2874
  if (!f.value) return;
2872
- let r = Ke(e.editor);
2873
- r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus()));
2874
- }, M = async (t) => {
2875
+ let r = qe(e.editor);
2876
+ r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
2877
+ }, j = async (t) => {
2875
2878
  if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
2876
2879
  let u = (t ?? r.value).trim();
2877
2880
  if (!u) {
2878
2881
  o.value = e.messages.askAi.emptyPrompt, n.value = "error";
2879
2882
  return;
2880
2883
  }
2881
- let p = Ie(e.editor, s.value);
2884
+ let p = Le(e.editor, s.value);
2882
2885
  if (!p) {
2883
2886
  n.value = "conflict";
2884
2887
  return;
2885
2888
  }
2886
- s.value = p, c.value?.abort(), Ne(e.editor);
2887
- let m = new AbortController(), h = Fe(p, u, e.lang, m.signal, void 0, Re(e.editor)?.target);
2888
- c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
2889
+ s.value = p, c.value?.abort(), Pe(e.editor);
2890
+ let m = new AbortController(), h = Ie(p, u, e.lang, m.signal, void 0, ze(e.editor)?.target);
2891
+ c.value = m, l.value = h.id, i.value = u, O.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
2889
2892
  try {
2890
- let t = await Ue(e.askAi.handler, h, (e) => {
2891
- l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
2893
+ let t = await We(e.askAi.handler, h, (e) => {
2894
+ l.value === h.id && !m.signal.aborted && (d = e, O.schedule());
2892
2895
  });
2893
2896
  if (l.value !== h.id || m.signal.aborted) return;
2894
- if (k.cancel(), d = t, !We(e.editor, t)) throw new ke("invalid-output", "Ask AI output is incompatible with the selected content.");
2895
- a.value = t, r.value = "", n.value = Re(e.editor)?.status === "target" ? "result" : "conflict";
2897
+ if (O.cancel(), d = t, !Ge(e.editor, t)) throw new Ae("invalid-output", "Ask AI output is incompatible with the selected content.");
2898
+ a.value = t, r.value = "", n.value = ze(e.editor)?.status === "target" ? "result" : "conflict";
2896
2899
  } catch (t) {
2897
2900
  if (l.value !== h.id) return;
2898
- if (k.cancel(), m.signal.aborted) {
2899
- Ne(e.editor), n.value = Re(e.editor)?.status === "conflict" ? "conflict" : "input";
2901
+ if (O.cancel(), m.signal.aborted) {
2902
+ Pe(e.editor), n.value = ze(e.editor)?.status === "conflict" ? "conflict" : "input";
2900
2903
  return;
2901
2904
  }
2902
- Ne(e.editor), o.value = t instanceof ke ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
2905
+ Pe(e.editor), o.value = t instanceof Ae ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
2903
2906
  }
2904
- }, ee = () => {
2905
- if (!Ae(e.editor, a.value)) {
2906
- n.value = Re(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
2907
+ }, te = () => {
2908
+ if (!je(e.editor, a.value)) {
2909
+ n.value = ze(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
2907
2910
  return;
2908
2911
  }
2909
- t.value = null, window.setTimeout(() => Pe(e.editor), 560), e.editor.commands.focus();
2910
- }, N = oe(() => {
2912
+ t.value = null, window.setTimeout(() => Fe(e.editor), 560), e.editor.commands.focus();
2913
+ }, M = se(() => {
2911
2914
  let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
2912
2915
  if (!t.value || !n || !r) return;
2913
2916
  if (t.value === "ask-ai") {
2914
- let t = ze(e.editor), n = v.value?.getBoundingClientRect();
2917
+ let t = Be(e.editor), n = v.value?.getBoundingClientRect();
2915
2918
  if (!t || !n) return;
2916
2919
  let a = {
2917
2920
  anchorRect: n,
@@ -2921,18 +2924,18 @@ var ga = X({
2921
2924
  height: window.innerHeight
2922
2925
  },
2923
2926
  frameRect: i?.getBoundingClientRect() ?? null,
2924
- surfaceRect: Le(e.editor.view.dom)
2925
- }, o = je({
2927
+ surfaceRect: Re(e.editor.view.dom)
2928
+ }, o = Me({
2926
2929
  ...a,
2927
2930
  panelSize: r.getBoundingClientRect()
2928
2931
  }), s = `${o.width}px`;
2929
- r.style.width !== s && (r.style.width = s, o = je({
2932
+ r.style.width !== s && (r.style.width = s, o = Me({
2930
2933
  ...a,
2931
2934
  panelSize: r.getBoundingClientRect()
2932
2935
  })), r.style.left = `${o.left}px`, r.style.top = `${o.top}px`, r.style.bottom = "auto", r.style.maxWidth = `${o.maxWidth}px`, r.style.maxHeight = `${Math.max(0, o.maxHeight)}px`, r.dataset.positioned = "true", g.value = o.placement;
2933
2936
  return;
2934
2937
  }
2935
- let a = Se({
2938
+ let a = Ce({
2936
2939
  toolbarRect: n.getBoundingClientRect(),
2937
2940
  popoverSize: r.getBoundingClientRect(),
2938
2941
  viewport: {
@@ -2943,56 +2946,56 @@ var ga = X({
2943
2946
  gap: t.value === "more" ? 8 : 6
2944
2947
  });
2945
2948
  g.value = a.placement;
2946
- }), P = () => {
2947
- let l = Re(e.editor);
2949
+ }), N = () => {
2950
+ let l = ze(e.editor);
2948
2951
  if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
2949
- s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus());
2952
+ s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
2950
2953
  return;
2951
2954
  }
2952
- t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
2953
- }, F = (e) => {
2954
- e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
2955
- }, te = (e) => {
2955
+ t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), O.cancel(), n.value = "conflict");
2956
+ }, P = (e) => {
2957
+ e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), O.cancel(), n.value = "input") : k(!0));
2958
+ }, ne = (e) => {
2956
2959
  if (!(!t.value || v.value?.contains(e.target))) {
2957
2960
  if (t.value === "ask-ai") {
2958
- A(!0);
2961
+ k(!0);
2959
2962
  return;
2960
2963
  }
2961
2964
  t.value = null;
2962
2965
  }
2963
2966
  };
2964
- q(() => [
2967
+ K(() => [
2965
2968
  t.value,
2966
2969
  n.value,
2967
2970
  a.value,
2968
2971
  o.value
2969
2972
  ], ([e]) => {
2970
- e && Y(N.schedule);
2971
- }), hr(() => {
2972
- window.addEventListener("resize", N.schedule), window.addEventListener("scroll", N.schedule, !0), e.editor.on("transaction", P), document.addEventListener("pointerdown", te, !0), document.addEventListener("keydown", F, !0);
2973
- }), J(() => {
2974
- N.cancel(), k.cancel(), window.removeEventListener("resize", N.schedule), window.removeEventListener("scroll", N.schedule, !0), e.editor.off("transaction", P), document.removeEventListener("pointerdown", te, !0), document.removeEventListener("keydown", F, !0), c.value?.abort(), Pe(e.editor);
2973
+ e && J(M.schedule);
2974
+ }), vr(() => {
2975
+ window.addEventListener("resize", M.schedule), window.addEventListener("scroll", M.schedule, !0), e.editor.on("transaction", N), document.addEventListener("pointerdown", ne, !0), document.addEventListener("keydown", P, !0);
2976
+ }), q(() => {
2977
+ M.cancel(), O.cancel(), window.removeEventListener("resize", M.schedule), window.removeEventListener("scroll", M.schedule, !0), e.editor.off("transaction", N), document.removeEventListener("pointerdown", ne, !0), document.removeEventListener("keydown", P, !0), c.value?.abort(), Fe(e.editor);
2975
2978
  });
2976
- let I = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, L = (e, t) => {
2979
+ let F = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, I = (e, t) => {
2977
2980
  if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
2978
2981
  h.value = null;
2979
2982
  return;
2980
2983
  }
2981
2984
  let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
2982
2985
  h.value = n.left + n.width / 2 - r.left;
2983
- }, R = () => {
2986
+ }, L = () => {
2984
2987
  let e = m.value;
2985
2988
  if (!e || t.value !== null) return null;
2986
2989
  let n = x.value.buttons[e];
2987
- return n ? U("div", {
2990
+ return n ? H("div", {
2988
2991
  class: "markweave-floating-toolbar-tooltip",
2989
2992
  role: "tooltip",
2990
2993
  "data-testid": "markweave-floating-toolbar-tooltip",
2991
2994
  "data-button-id": e,
2992
- "data-active": I(e),
2995
+ "data-active": F(e),
2993
2996
  style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
2994
2997
  }, n) : null;
2995
- }, z = (n, r, i, a, o = !1, s) => U("button", {
2998
+ }, R = (n, r, i, a, o = !1, s) => H("button", {
2996
2999
  type: "button",
2997
3000
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
2998
3001
  "aria-label": r,
@@ -3006,19 +3009,19 @@ var ga = X({
3006
3009
  "data-active": o || t.value === n,
3007
3010
  "data-tooltip-active": m.value === n ? "true" : "false",
3008
3011
  "data-testid": `markweave-floating-toolbar-button-${n}`,
3009
- onBlur: () => L(null),
3010
- onFocus: (e) => L(n, e.currentTarget),
3012
+ onBlur: () => I(null),
3013
+ onFocus: (e) => I(n, e.currentTarget),
3011
3014
  onMousedown: $,
3012
- onMouseenter: (e) => L(n, e.currentTarget),
3013
- onMouseleave: () => L(null),
3015
+ onMouseenter: (e) => I(n, e.currentTarget),
3016
+ onMouseleave: () => I(null),
3014
3017
  onClick: a
3015
- }, n === "ask-ai" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [Q(i, r), U("span", null, s ?? r)])] : n === "block-type" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [U("span", { class: "markweave-floating-toolbar-block-label" }, ha(e.editor, e.messages)), Q(t.value === "block-type" ? Ur : Vr, r)])] : n === "color" ? [U("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [U("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Q(t.value === "color" ? Ur : Vr, r)])] : [Q(i, r)]), B = () => U("span", {
3018
+ }, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, _a(e.editor, e.messages)), Z(t.value === "block-type" ? Kr : Wr, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Kr : Wr, r)])] : [Z(i, r)]), z = () => H("span", {
3016
3019
  class: "markweave-floating-toolbar-divider",
3017
3020
  "aria-hidden": "true"
3018
- }), V = (n, r, i) => U("section", {
3021
+ }), B = (n, r, i) => H("section", {
3019
3022
  class: "markweave-floating-toolbar-color-section",
3020
3023
  "aria-label": n
3021
- }, [U("div", { class: "markweave-floating-toolbar-menu-title" }, n), U("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => U("button", {
3024
+ }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
3022
3025
  key: `${r}-${n}`,
3023
3026
  type: "button",
3024
3027
  "aria-label": a,
@@ -3027,24 +3030,24 @@ var ga = X({
3027
3030
  onClick: () => {
3028
3031
  r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
3029
3032
  }
3030
- }, r === "text" ? [U("span", {
3033
+ }, r === "text" ? [H("span", {
3031
3034
  class: "markweave-floating-toolbar-text-swatch",
3032
3035
  style: { color: i ?? "#646970" }
3033
- }, "A")] : [U("span", {
3036
+ }, "A")] : [H("span", {
3034
3037
  class: "markweave-floating-toolbar-highlight-swatch",
3035
3038
  style: { backgroundColor: i ?? "#ffffff" },
3036
3039
  "aria-hidden": "true"
3037
- })])))]), H = () => {
3040
+ })])))]), V = () => {
3038
3041
  if (t.value === "ask-ai") {
3039
- let t = (e, t, n, r) => U("button", {
3042
+ let t = (e, t, n, r) => H("button", {
3040
3043
  type: "button",
3041
3044
  class: n,
3042
3045
  onMousedown: $,
3043
3046
  onClick: t
3044
- }, r ? [Q(r, e), U("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? U("div", {
3047
+ }, r ? [Z(r, e), H("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? H("div", {
3045
3048
  class: "markweave-ask-ai-composer",
3046
3049
  "data-variant": n.value === "result" ? "follow-up" : "prompt"
3047
- }, [U("textarea", {
3050
+ }, [H("textarea", {
3048
3051
  ref: u,
3049
3052
  class: "markweave-ask-ai-input",
3050
3053
  rows: 2,
@@ -3055,19 +3058,19 @@ var ga = X({
3055
3058
  r.value = e.target.value;
3056
3059
  },
3057
3060
  onKeydown: (e) => {
3058
- e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), M());
3061
+ e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), j());
3059
3062
  }
3060
- }), U("button", {
3063
+ }), H("button", {
3061
3064
  type: "button",
3062
3065
  class: "markweave-ask-ai-send",
3063
3066
  "aria-label": e.messages.askAi.send,
3064
3067
  disabled: !r.value.trim(),
3065
3068
  onMousedown: $,
3066
3069
  onClick: () => {
3067
- M();
3070
+ j();
3068
3071
  }
3069
- }, [Q(Ar, e.messages.askAi.send)])]) : null;
3070
- return U("section", {
3072
+ }, [Z(Nr, e.messages.askAi.send)])]) : null;
3073
+ return H("section", {
3071
3074
  ref: y,
3072
3075
  class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
3073
3076
  "aria-label": e.messages.askAi.ariaLabel,
@@ -3075,65 +3078,65 @@ var ga = X({
3075
3078
  "data-testid": "markweave-ask-ai-popover"
3076
3079
  }, [
3077
3080
  s,
3078
- n.value === "generating" ? U("div", {
3081
+ n.value === "generating" ? H("div", {
3079
3082
  class: "markweave-ask-ai-progress markweave-ask-ai-generating",
3080
3083
  role: "status"
3081
3084
  }, [
3082
- U("span", {
3085
+ H("span", {
3083
3086
  class: "markweave-ask-ai-sparkles",
3084
3087
  "aria-hidden": "true"
3085
- }, [Q(Si, "")]),
3086
- U("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
3087
- U("button", {
3088
+ }, [Z(Ti, "")]),
3089
+ H("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
3090
+ H("button", {
3088
3091
  type: "button",
3089
3092
  class: "markweave-ask-ai-stop",
3090
3093
  "aria-label": e.messages.askAi.stop,
3091
3094
  onMousedown: $,
3092
3095
  onClick: () => {
3093
- c.value?.abort(), k.cancel(), Ne(e.editor), n.value = "input";
3096
+ c.value?.abort(), O.cancel(), Pe(e.editor), n.value = "input";
3094
3097
  }
3095
- }, [Q(Ci, e.messages.askAi.stop)])
3098
+ }, [Z(Ei, e.messages.askAi.stop)])
3096
3099
  ]) : null,
3097
- n.value === "result" ? U("div", { class: "markweave-ask-ai-action-bar" }, [
3100
+ n.value === "result" ? H("div", { class: "markweave-ask-ai-action-bar" }, [
3098
3101
  t(e.messages.askAi.retry, () => {
3099
- M(i.value);
3100
- }, "markweave-ask-ai-retry", yi),
3101
- U("span", { class: "markweave-ask-ai-action-spacer" }),
3102
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Li),
3103
- t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", zr)
3102
+ j(i.value);
3103
+ }, "markweave-ask-ai-retry", Si),
3104
+ H("span", { class: "markweave-ask-ai-action-spacer" }),
3105
+ t(e.messages.askAi.discard, () => k(!0), "markweave-ask-ai-discard", Bi),
3106
+ t(e.messages.askAi.accept, te, "markweave-ask-ai-accept", Hr)
3104
3107
  ]) : null,
3105
- n.value === "error" || n.value === "conflict" ? U("div", {
3108
+ n.value === "error" || n.value === "conflict" ? H("div", {
3106
3109
  class: "markweave-ask-ai-error",
3107
3110
  role: "alert"
3108
- }, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, U("div", { class: "markweave-ask-ai-action-bar" }, [
3111
+ }, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, H("div", { class: "markweave-ask-ai-action-bar" }, [
3109
3112
  n.value === "error" ? t(e.messages.askAi.retry, () => {
3110
- M(i.value);
3111
- }, "markweave-ask-ai-retry", yi) : null,
3112
- U("span", { class: "markweave-ask-ai-action-spacer" }),
3113
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Li)
3113
+ j(i.value);
3114
+ }, "markweave-ask-ai-retry", Si) : null,
3115
+ H("span", { class: "markweave-ask-ai-action-spacer" }),
3116
+ t(e.messages.askAi.discard, () => k(!0), "markweave-ask-ai-discard", Bi)
3114
3117
  ])]) : null
3115
3118
  ]);
3116
3119
  }
3117
- return t.value === "block-type" ? U("div", {
3120
+ return t.value === "block-type" ? H("div", {
3118
3121
  ref: y,
3119
3122
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
3120
3123
  "data-testid": "markweave-floating-toolbar-turn-menu"
3121
- }, [U("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => U("button", {
3124
+ }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => H("button", {
3122
3125
  key: n,
3123
3126
  type: "button",
3124
3127
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
3125
3128
  onMousedown: $,
3126
3129
  onClick: () => {
3127
- ve(e.editor, n), t.value = null;
3130
+ ye(e.editor, n), t.value = null;
3128
3131
  }
3129
- }, [U("span", { class: "markweave-floating-toolbar-menu-icon" }, [Q(i, r)]), U("span", null, r)]))]) : t.value === "link" ? U("form", {
3132
+ }, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
3130
3133
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
3131
3134
  ref: y,
3132
3135
  "data-testid": "markweave-floating-toolbar-link-popover",
3133
3136
  onSubmit: (e) => {
3134
- e.preventDefault(), E();
3137
+ e.preventDefault(), T();
3135
3138
  }
3136
- }, [U("input", {
3139
+ }, [H("input", {
3137
3140
  value: p.value,
3138
3141
  placeholder: x.value.linkPlaceholder,
3139
3142
  "aria-label": x.value.linkUrlLabel,
@@ -3141,45 +3144,45 @@ var ga = X({
3141
3144
  onInput: (e) => {
3142
3145
  p.value = e.target.value;
3143
3146
  }
3144
- }), U("span", { class: "markweave-floating-toolbar-link-actions" }, [
3145
- U("button", {
3147
+ }), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
3148
+ H("button", {
3146
3149
  type: "submit",
3147
3150
  disabled: !b.value,
3148
3151
  "aria-label": x.value.applyLink,
3149
3152
  "data-testid": "markweave-floating-toolbar-link-apply",
3150
3153
  onMousedown: $
3151
- }, [Q(Kr, x.value.applyLink)]),
3152
- U("span", {
3154
+ }, [Z(Yr, x.value.applyLink)]),
3155
+ H("span", {
3153
3156
  class: "markweave-floating-toolbar-link-divider",
3154
3157
  "aria-hidden": "true"
3155
3158
  }),
3156
- U("button", {
3159
+ H("button", {
3157
3160
  type: "button",
3158
3161
  disabled: !b.value,
3159
3162
  "aria-label": x.value.openLink,
3160
3163
  "data-testid": "markweave-floating-toolbar-link-open",
3161
3164
  onMousedown: $,
3162
- onClick: () => ua(p.value)
3163
- }, [Q(Xr, x.value.openLink)]),
3164
- U("button", {
3165
+ onClick: () => fa(p.value)
3166
+ }, [Z($r, x.value.openLink)]),
3167
+ H("button", {
3165
3168
  type: "button",
3166
3169
  "aria-label": x.value.removeLink,
3167
3170
  "data-testid": "markweave-floating-toolbar-link-remove",
3168
3171
  onMousedown: $,
3169
- onClick: D
3170
- }, [Q(Mi, x.value.removeLink)])
3171
- ])]) : t.value === "color" ? U("div", {
3172
+ onClick: E
3173
+ }, [Z(Fi, x.value.removeLink)])
3174
+ ])]) : t.value === "color" ? H("div", {
3172
3175
  ref: y,
3173
3176
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
3174
3177
  "data-testid": "markweave-floating-toolbar-color-menu"
3175
- }, [V(x.value.textColorTitle, "text", C.value), V(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? U("div", {
3178
+ }, [B(x.value.textColorTitle, "text", C.value), B(x.value.highlightColorTitle, "highlight", ee.value)]) : t.value === "more" ? H("div", {
3176
3179
  ref: y,
3177
3180
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
3178
3181
  "data-testid": "markweave-floating-toolbar-more-menu"
3179
- }, T.value.map((n) => U("span", {
3182
+ }, w.value.map((n) => H("span", {
3180
3183
  key: n,
3181
3184
  class: "markweave-floating-toolbar-more-item"
3182
- }, [U("button", {
3185
+ }, [H("button", {
3183
3186
  type: "button",
3184
3187
  "aria-label": x.value.moreActions[n],
3185
3188
  "data-testid": `markweave-floating-toolbar-more-${n}`,
@@ -3192,61 +3195,61 @@ var ga = X({
3192
3195
  m.value = null;
3193
3196
  },
3194
3197
  onClick: () => {
3195
- _e(e.editor, n), t.value = null;
3198
+ ve(e.editor, n), t.value = null;
3196
3199
  }
3197
- }, [Q(da[n], x.value.moreActions[n])]), m.value === n ? U("div", {
3200
+ }, [Z(pa[n], x.value.moreActions[n])]), m.value === n ? H("div", {
3198
3201
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
3199
3202
  role: "tooltip"
3200
3203
  }, x.value.moreActions[n]) : null]))) : null;
3201
3204
  };
3202
- return () => U(re, {
3205
+ return () => H(ie, {
3203
3206
  editor: e.editor,
3204
3207
  shouldShow: ({ editor: e }) => {
3205
- let t = Re(e);
3206
- return Te(Ce(e), {
3208
+ let t = ze(e);
3209
+ return Ee(we(e), {
3207
3210
  editable: e.isEditable,
3208
- hasAskAiPreview: Be(e.state),
3211
+ hasAskAiPreview: Ve(e.state),
3209
3212
  hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
3210
3213
  });
3211
3214
  },
3212
3215
  getReferencedVirtualElement: () => {
3213
- let t = Re(e.editor)?.target.kind === "table" ? ze(e.editor) : null;
3216
+ let t = ze(e.editor)?.target.kind === "table" ? Be(e.editor) : null;
3214
3217
  return t ? {
3215
3218
  getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
3216
3219
  getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
3217
3220
  } : null;
3218
3221
  },
3219
3222
  options: { placement: "top" }
3220
- }, { default: () => U("div", {
3223
+ }, { default: () => H("div", {
3221
3224
  ref: _,
3222
3225
  class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
3223
3226
  "data-popover-placement": t.value ? g.value : void 0,
3224
3227
  "data-ask-ai-session": t.value === "ask-ai" ? "open" : "closed",
3225
3228
  "data-testid": "markweave-floating-toolbar"
3226
- }, [U("div", {
3229
+ }, [H("div", {
3227
3230
  ref: v,
3228
3231
  class: "markweave-floating-toolbar-content",
3229
3232
  "data-menu": t.value ?? "none"
3230
3233
  }, [
3231
- f.value && Ve(e.editor) ? z("ask-ai", x.value.buttons["ask-ai"], Si, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
3232
- f.value && Ve(e.editor) ? B() : null,
3233
- z("block-type", x.value.buttons["block-type"], Ni, () => O("block-type"), t.value === "block-type"),
3234
- B(),
3235
- z("bold", x.value.buttons.bold, Ir, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
3236
- z("italic", x.value.buttons.italic, ai, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
3237
- z("underline", x.value.buttons.underline, Pi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
3238
- z("strike", x.value.buttons.strike, Ti, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
3239
- z("inline-code", x.value.buttons["inline-code"], Gr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
3240
- B(),
3241
- z("link", x.value.buttons.link, si, () => O("link"), e.editor.isActive("link")),
3242
- z("color", x.value.buttons.color, Ni, () => O("color"), t.value === "color"),
3243
- B(),
3244
- z("more", x.value.buttons.more, fi, () => O("more"), t.value === "more"),
3245
- H(),
3246
- R()
3234
+ f.value && He(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], Ti, A, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
3235
+ f.value && He(e.editor) ? z() : null,
3236
+ R("block-type", x.value.buttons["block-type"], Ii, () => D("block-type"), t.value === "block-type"),
3237
+ z(),
3238
+ R("bold", x.value.buttons.bold, zr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
3239
+ R("italic", x.value.buttons.italic, ci, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
3240
+ R("underline", x.value.buttons.underline, Li, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
3241
+ R("strike", x.value.buttons.strike, Oi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
3242
+ R("inline-code", x.value.buttons["inline-code"], Jr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
3243
+ z(),
3244
+ R("link", x.value.buttons.link, ui, () => D("link"), e.editor.isActive("link")),
3245
+ R("color", x.value.buttons.color, Ii, () => D("color"), t.value === "color"),
3246
+ z(),
3247
+ R("more", x.value.buttons.more, hi, () => D("more"), t.value === "more"),
3248
+ V(),
3249
+ L()
3247
3250
  ])]) });
3248
3251
  }
3249
- }), _a = X({
3252
+ }), ya = Y({
3250
3253
  name: "MarkweaveVueMathEditorPopover",
3251
3254
  props: {
3252
3255
  editor: {
@@ -3267,17 +3270,17 @@ var ga = X({
3267
3270
  }
3268
3271
  },
3269
3272
  setup(e) {
3270
- let t = W(e.target.latex), n = G(null), r = W(null), i = W(null), a = G(Ut(e.editor, e.target)), o = K(() => t.value === e.target.latex && a.value ? {
3273
+ let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(Wt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
3271
3274
  html: a.value,
3272
3275
  error: !1
3273
- } : qt(t.value, e.target.kind, e.editor)), s = K(() => t.value.trim().length > 0), c = K(() => e.messages.math), l = K(() => Ht(e.editor, e.target) ?? 1), u = () => {
3276
+ } : Jt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => Ut(e.editor, e.target) ?? 1), u = () => {
3274
3277
  if (typeof window > "u") return;
3275
- let r = Vt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3278
+ let r = Ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3276
3279
  if (!r || !i) {
3277
3280
  e.onClose();
3278
3281
  return;
3279
3282
  }
3280
- n.value = Bt({
3283
+ n.value = Vt({
3281
3284
  anchorRect: r,
3282
3285
  frameRect: i,
3283
3286
  kind: e.target.kind,
@@ -3286,7 +3289,7 @@ var ga = X({
3286
3289
  viewportWidth: window.innerWidth
3287
3290
  });
3288
3291
  }, d = () => {
3289
- s.value && zt(e.editor, e.target, t.value) && e.onClose();
3292
+ s.value && Bt(e.editor, e.target, t.value) && e.onClose();
3290
3293
  }, f = (t) => {
3291
3294
  if (t.key === "Escape") {
3292
3295
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -3297,14 +3300,14 @@ var ga = X({
3297
3300
  let n = t.target;
3298
3301
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
3299
3302
  };
3300
- return q(() => [e.target.pos, e.target.latex], () => {
3301
- t.value = e.target.latex, a.value = Ut(e.editor, e.target), Y(u);
3302
- }), hr(() => {
3303
- Jt(e.editor, e.target, !0), u(), Y(() => {
3303
+ return K(() => [e.target.pos, e.target.latex], () => {
3304
+ t.value = e.target.latex, a.value = Wt(e.editor, e.target), J(u);
3305
+ }), vr(() => {
3306
+ Yt(e.editor, e.target, !0), u(), J(() => {
3304
3307
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
3305
3308
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
3306
- }), J(() => {
3307
- Jt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
3309
+ }), q(() => {
3310
+ Yt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
3308
3311
  }), () => {
3309
3312
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
3310
3313
  ref: i,
@@ -3317,7 +3320,7 @@ var ga = X({
3317
3320
  },
3318
3321
  onKeydown: f
3319
3322
  };
3320
- return e.target.kind === "inline" ? U("form", {
3323
+ return e.target.kind === "inline" ? H("form", {
3321
3324
  ref: r,
3322
3325
  class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
3323
3326
  "aria-label": a,
@@ -3332,22 +3335,22 @@ var ga = X({
3332
3335
  onSubmit: (e) => {
3333
3336
  e.preventDefault(), d();
3334
3337
  }
3335
- }, [U("label", {
3338
+ }, [H("label", {
3336
3339
  class: "markweave-math-inline-source",
3337
3340
  "data-testid": "markweave-math-inline-source"
3338
3341
  }, [
3339
- U("span", { attrs: { "aria-hidden": "true" } }, "$"),
3340
- U("input", {
3342
+ H("span", { attrs: { "aria-hidden": "true" } }, "$"),
3343
+ H("input", {
3341
3344
  ...u,
3342
3345
  "aria-label": c.value.latexLabel,
3343
3346
  size: Math.max(t.value.length, 1)
3344
3347
  }),
3345
- U("span", { attrs: { "aria-hidden": "true" } }, "$")
3346
- ]), U("div", {
3348
+ H("span", { attrs: { "aria-hidden": "true" } }, "$")
3349
+ ]), H("div", {
3347
3350
  class: "markweave-math-inline-preview",
3348
3351
  "data-error": o.value.error ? "true" : "false",
3349
3352
  "data-testid": "markweave-math-editor-preview"
3350
- }, [U("div", { innerHTML: o.value.html || "&nbsp;" }), o.value.error ? U("small", null, c.value.invalidPreview) : null])]) : U("form", {
3353
+ }, [H("div", { innerHTML: o.value.html || "&nbsp;" }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
3351
3354
  ref: r,
3352
3355
  class: "markweave-math-editor-popover markweave-math-editor-popover--block",
3353
3356
  "aria-label": a,
@@ -3363,39 +3366,39 @@ var ga = X({
3363
3366
  e.preventDefault(), d();
3364
3367
  }
3365
3368
  }, [
3366
- U("div", { class: "markweave-math-block-toolbar" }, [
3367
- U("span", null, c.value.label),
3368
- Q(Gr, c.value.label, 15, 1.75),
3369
- U("button", {
3369
+ H("div", { class: "markweave-math-block-toolbar" }, [
3370
+ H("span", null, c.value.label),
3371
+ Z(Jr, c.value.label, 15, 1.75),
3372
+ H("button", {
3370
3373
  type: "submit",
3371
3374
  title: c.value.apply,
3372
3375
  "aria-label": c.value.apply,
3373
3376
  disabled: !s.value,
3374
3377
  "data-testid": "markweave-math-editor-apply"
3375
- }, [Q(Br, c.value.apply, 16, 2)])
3378
+ }, [Z(Ur, c.value.apply, 16, 2)])
3376
3379
  ]),
3377
- U("label", {
3380
+ H("label", {
3378
3381
  class: "markweave-math-block-source",
3379
3382
  "data-testid": "markweave-math-block-source"
3380
3383
  }, [
3381
- U("span", { attrs: { "aria-hidden": "true" } }, "$$"),
3382
- U("textarea", {
3384
+ H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
3385
+ H("textarea", {
3383
3386
  ...u,
3384
3387
  "aria-label": c.value.latexLabel,
3385
3388
  rows: 3
3386
3389
  }),
3387
- U("span", { attrs: { "aria-hidden": "true" } }, "$$")
3390
+ H("span", { attrs: { "aria-hidden": "true" } }, "$$")
3388
3391
  ]),
3389
- U("div", {
3392
+ H("div", {
3390
3393
  class: "markweave-math-block-preview",
3391
3394
  "data-error": o.value.error ? "true" : "false",
3392
3395
  "data-math-number": String(l.value),
3393
3396
  "data-testid": "markweave-math-editor-preview"
3394
- }, [U("div", { innerHTML: o.value.html || "&nbsp;" }), o.value.error ? U("small", null, c.value.invalidPreview) : null])
3397
+ }, [H("div", { innerHTML: o.value.html || "&nbsp;" }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
3395
3398
  ]);
3396
3399
  };
3397
3400
  }
3398
- }), va = X({
3401
+ }), ba = Y({
3399
3402
  name: "MarkweaveVueSlashCommandMenu",
3400
3403
  props: {
3401
3404
  commands: {
@@ -3436,7 +3439,7 @@ var ga = X({
3436
3439
  }
3437
3440
  },
3438
3441
  setup(e) {
3439
- let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = W(null), c = K(() => {
3442
+ let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = U(null), c = G(() => {
3440
3443
  let t = a.value.trim().toLowerCase();
3441
3444
  return (t ? e.messages.slash.emojiItems.filter((e) => [
3442
3445
  e.emoji,
@@ -3444,16 +3447,16 @@ var ga = X({
3444
3447
  ...e.terms
3445
3448
  ].join(" ").toLowerCase().includes(t)) : e.messages.slash.emojiItems).slice(0, 12);
3446
3449
  });
3447
- q(() => [
3450
+ K(() => [
3448
3451
  e.state.name,
3449
3452
  e.state.activeIndex,
3450
3453
  e.commands.length,
3451
3454
  e.inputCommand?.id ?? null
3452
3455
  ], async () => {
3453
3456
  if (e.state.name !== "keyboard-selecting" || e.inputCommand || !e.commands.length) return;
3454
- await Y();
3457
+ await J();
3455
3458
  let t = s.value, n = t?.querySelector("[data-active=\"true\"]");
3456
- t && n && on(t, n);
3459
+ t && n && cn(t, n);
3457
3460
  }, { flush: "post" });
3458
3461
  let l = async () => {
3459
3462
  if (e.inputCommand) {
@@ -3470,13 +3473,13 @@ var ga = X({
3470
3473
  } : {
3471
3474
  kind: i,
3472
3475
  trigger: i === "attachment" ? "attachment-insert" : "slash-command",
3473
- source: B(t.value)
3476
+ source: z(t.value)
3474
3477
  };
3475
3478
  if (!n.value && !t.value.trim()) {
3476
3479
  r.value = e.messages.slash.uploadRequiredError;
3477
3480
  return;
3478
3481
  }
3479
- let o = await H(a, e.onUpload);
3482
+ let o = await V(a, e.onUpload);
3480
3483
  e.onSelect(e.inputCommand, { uploadResult: o }), e.onInputCommandChange(null), t.value = "", n.value = null;
3481
3484
  } catch (t) {
3482
3485
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -3506,18 +3509,18 @@ var ga = X({
3506
3509
  group: e,
3507
3510
  commands: t
3508
3511
  }));
3509
- return U("div", {
3512
+ return H("div", {
3510
3513
  class: "markweave-slash-layer",
3511
3514
  style: { display: "contents" },
3512
3515
  "data-testid": "markweave-slash-layer"
3513
3516
  }, [
3514
- U("div", {
3517
+ H("div", {
3515
3518
  class: "markweave-slash-trigger",
3516
3519
  style: f,
3517
3520
  "aria-hidden": "true",
3518
3521
  "data-testid": "markweave-slash-trigger"
3519
- }, [U("span", null, "/"), U("em", null, e.state.query || e.messages.slash.filterPlaceholder)]),
3520
- U("div", {
3522
+ }, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]),
3523
+ H("div", {
3521
3524
  id: "markweave-slash-command-listbox",
3522
3525
  class: "markweave-slash-menu",
3523
3526
  style: d,
@@ -3526,16 +3529,16 @@ var ga = X({
3526
3529
  "aria-busy": !1,
3527
3530
  "data-placement": e.position.placement,
3528
3531
  "data-testid": "markweave-slash-menu"
3529
- }, [e.inputCommand?.inputKind === "emoji" ? U("div", {
3532
+ }, [e.inputCommand?.inputKind === "emoji" ? H("div", {
3530
3533
  class: "markweave-slash-subpanel",
3531
3534
  "data-testid": "markweave-slash-emoji-picker"
3532
3535
  }, [
3533
- U("div", { class: "markweave-slash-subpanel-header" }, [U("button", {
3536
+ H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
3534
3537
  type: "button",
3535
3538
  onMousedown: $,
3536
3539
  onClick: () => e.onInputCommandChange(null)
3537
- }, e.messages.common.back), U("span", null, e.messages.slash.emojiTitle)]),
3538
- U("label", { class: "markweave-slash-input" }, [U("span", null, "/"), U("input", {
3540
+ }, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
3541
+ H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
3539
3542
  autofocus: !0,
3540
3543
  value: a.value,
3541
3544
  placeholder: e.messages.slash.emojiSearchPlaceholder,
@@ -3546,11 +3549,11 @@ var ga = X({
3546
3549
  t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = c.value.length ? (o.value + 1) % c.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = c.value.length ? (o.value - 1 + c.value.length) % c.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), u(o.value));
3547
3550
  }
3548
3551
  })]),
3549
- U("div", {
3552
+ H("div", {
3550
3553
  class: "markweave-slash-emoji-grid",
3551
3554
  role: "listbox",
3552
3555
  "aria-label": e.messages.slash.emojiTitle
3553
- }, c.value.map((e, t) => U("button", {
3556
+ }, c.value.map((e, t) => H("button", {
3554
3557
  key: `${e.emoji}-${e.label}`,
3555
3558
  type: "button",
3556
3559
  role: "option",
@@ -3559,17 +3562,17 @@ var ga = X({
3559
3562
  onMouseenter: () => o.value = t,
3560
3563
  onMousedown: $,
3561
3564
  onClick: () => u(t)
3562
- }, [U("span", null, e.emoji), U("small", null, e.label)])))
3563
- ]) : e.inputCommand?.inputKind === "upload" ? U("div", {
3565
+ }, [H("span", null, e.emoji), H("small", null, e.label)])))
3566
+ ]) : e.inputCommand?.inputKind === "upload" ? H("div", {
3564
3567
  class: "markweave-slash-subpanel",
3565
3568
  "data-testid": "markweave-slash-upload-panel"
3566
3569
  }, [
3567
- U("div", { class: "markweave-slash-upload-header" }, [U("button", {
3570
+ H("div", { class: "markweave-slash-upload-header" }, [H("button", {
3568
3571
  type: "button",
3569
3572
  onMousedown: $,
3570
3573
  onClick: () => e.onInputCommandChange(null)
3571
- }, e.messages.common.back), U("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
3572
- U("label", { class: "markweave-slash-upload-field" }, [U("span", null, e.messages.slash.uploadValueLabel), U("input", {
3574
+ }, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
3575
+ H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
3573
3576
  autofocus: !0,
3574
3577
  value: t.value,
3575
3578
  placeholder: e.messages.slash.uploadValuePlaceholder,
@@ -3580,35 +3583,35 @@ var ga = X({
3580
3583
  e.key === "Enter" && (e.preventDefault(), l());
3581
3584
  }
3582
3585
  })]),
3583
- U("label", { class: "markweave-slash-upload-field" }, [U("span", null, e.messages.common.file), U("input", {
3586
+ H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
3584
3587
  type: "file",
3585
3588
  onChange: (e) => n.value = e.target.files?.[0] ?? null
3586
3589
  })]),
3587
- r.value ? U("div", {
3590
+ r.value ? H("div", {
3588
3591
  class: "markweave-slash-upload-error",
3589
3592
  role: "alert"
3590
3593
  }, r.value) : null,
3591
- U("div", { class: "markweave-slash-upload-actions" }, [U("button", {
3594
+ H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
3592
3595
  type: "button",
3593
3596
  onMousedown: $,
3594
3597
  onClick: () => e.onInputCommandChange(null)
3595
- }, e.messages.common.cancel), U("button", {
3598
+ }, e.messages.common.cancel), H("button", {
3596
3599
  type: "button",
3597
3600
  "data-primary": "true",
3598
3601
  disabled: i.value,
3599
3602
  onMousedown: $,
3600
3603
  onClick: l
3601
3604
  }, e.messages.common.insert)])
3602
- ]) : e.commands.length ? U("div", {
3605
+ ]) : e.commands.length ? H("div", {
3603
3606
  ref: s,
3604
3607
  class: "markweave-slash-command-list"
3605
- }, p.map((t) => U("section", {
3608
+ }, p.map((t) => H("section", {
3606
3609
  key: t.group,
3607
3610
  class: "markweave-slash-group",
3608
3611
  "aria-label": t.group
3609
- }, [U("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
3610
- let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = rn(t);
3611
- return U("button", {
3612
+ }, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
3613
+ let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = on(t);
3614
+ return H("button", {
3612
3615
  key: t.id,
3613
3616
  id: `markweave-slash-command-option-${n}`,
3614
3617
  type: "button",
@@ -3618,6 +3621,7 @@ var ga = X({
3618
3621
  "data-active": r,
3619
3622
  "data-disabled": t.disabled ? "true" : "false",
3620
3623
  "data-execution-kind": t.executionKind,
3624
+ "data-text-icon-length": an(t.icon) ?? void 0,
3621
3625
  "data-testid": `markweave-slash-command-${t.id}`,
3622
3626
  title: t.disabledReason,
3623
3627
  onMousedown: $,
@@ -3631,16 +3635,16 @@ var ga = X({
3631
3635
  }
3632
3636
  }
3633
3637
  }, [
3634
- pa(t.icon),
3635
- U("span", null, t.label),
3636
- t.disabledReason ? U("small", null, t.disabledReason) : null
3638
+ ha(t.icon),
3639
+ H("span", null, t.label),
3640
+ t.disabledReason ? H("small", null, t.disabledReason) : null
3637
3641
  ]);
3638
- })]))) : U("div", {
3642
+ })]))) : H("div", {
3639
3643
  class: "markweave-slash-menu__empty",
3640
3644
  role: "option",
3641
3645
  "aria-disabled": "true"
3642
3646
  }, e.messages.slash.noResults)]),
3643
- U("div", {
3647
+ H("div", {
3644
3648
  class: "markweave-slash-command-live-region",
3645
3649
  role: "status",
3646
3650
  "aria-live": "polite",
@@ -3649,34 +3653,34 @@ var ga = X({
3649
3653
  ]);
3650
3654
  };
3651
3655
  }
3652
- }), ya = {
3653
- "ask-ai": Si,
3654
- "move-left": Or,
3655
- "move-right": kr,
3656
- "move-up": Ar,
3657
- "move-down": Er,
3658
- "insert-left": Fr,
3659
- "insert-right": Pr,
3660
- "insert-above": Nr,
3661
- "insert-below": Mr,
3662
- "sort-asc": Dr,
3663
- "sort-desc": jr,
3664
- color: pi,
3665
- alignment: br,
3666
- clear: wi,
3667
- duplicate: qr,
3668
- copy: qr,
3669
- merge: ki,
3670
- split: Ai,
3671
- delete: Mi
3672
- }, ba = {
3673
- left: br,
3674
- center: vr,
3675
- right: xr,
3676
- top: wr,
3677
- middle: Sr,
3678
- bottom: Cr
3679
- }, xa = X({
3656
+ }), xa = {
3657
+ "ask-ai": Ti,
3658
+ "move-left": jr,
3659
+ "move-right": Mr,
3660
+ "move-up": Nr,
3661
+ "move-down": kr,
3662
+ "insert-left": Rr,
3663
+ "insert-right": Lr,
3664
+ "insert-above": Ir,
3665
+ "insert-below": Fr,
3666
+ "sort-asc": Ar,
3667
+ "sort-desc": Pr,
3668
+ color: gi,
3669
+ alignment: Cr,
3670
+ clear: Di,
3671
+ duplicate: Xr,
3672
+ copy: Xr,
3673
+ merge: Mi,
3674
+ split: Ni,
3675
+ delete: Fi
3676
+ }, Sa = {
3677
+ left: Cr,
3678
+ center: xr,
3679
+ right: wr,
3680
+ top: Dr,
3681
+ middle: Tr,
3682
+ bottom: Er
3683
+ }, Ca = Y({
3680
3684
  name: "MarkweaveVueTableControls",
3681
3685
  props: {
3682
3686
  editor: {
@@ -3713,13 +3717,13 @@ var ga = X({
3713
3717
  }
3714
3718
  },
3715
3719
  setup(e) {
3716
- let t = W(null), n = W(null), r = W("row-edge"), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W(null), u = W(null), d = W(null), f = W(0), p = W(null), m = W(null), h = W(null), g = W(null), _ = W(null), v = W(null), y = W(null), b = null, x = null, S = null, C = K(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = K(() => e.active ? Cn(e.editor.state) : ia), T = K(() => Hn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = K(() => Hn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = K(() => Rn(e.editor)), O = K(() => (D.value, w.value.active && Kn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = K(() => t.value ? Kn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
3720
+ let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), ee = () => Cn(e.editor.state, "structure"), w = G(() => e.active ? En(e.editor.state) : sa), T = G(() => Gn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = G(() => Gn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = G(() => Vn(e.editor)), O = G(() => (D.value, w.value.active && Yn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = G(() => t.value ? Yn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
3717
3721
  b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
3718
3722
  }, j = (e) => {
3719
3723
  A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
3720
3724
  d.value = null, b = null;
3721
- }, Qn));
3722
- }, M = () => {
3725
+ }, tr));
3726
+ }, te = () => {
3723
3727
  if (!e.active) {
3724
3728
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
3725
3729
  return;
@@ -3729,31 +3733,31 @@ var ga = X({
3729
3733
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
3730
3734
  return;
3731
3735
  }
3732
- let l = n.getBoundingClientRect(), u = T.value ? Vn(e.editor, T.value) : null, d = E.value ? Vn(e.editor, E.value) : null, f = O.value ? qn(e.editor) : null, p = Ln(e.editor)?.getBoundingClientRect() ?? null;
3733
- u ? i.value = Mn({
3736
+ let l = n.getBoundingClientRect(), u = T.value ? Wn(e.editor, T.value) : null, d = E.value ? Wn(e.editor, E.value) : null, f = O.value ? Xn(e.editor) : null, p = Bn(e.editor)?.getBoundingClientRect() ?? null;
3737
+ u ? i.value = Fn({
3734
3738
  targetRect: u,
3735
3739
  frameRect: l,
3736
3740
  kind: "row"
3737
- }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Mn({
3741
+ }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Fn({
3738
3742
  targetRect: d,
3739
3743
  frameRect: l,
3740
3744
  kind: "column"
3741
- }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Mn({
3745
+ }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Fn({
3742
3746
  targetRect: f,
3743
3747
  frameRect: l,
3744
3748
  kind: "selection"
3745
3749
  }) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
3746
3750
  let m = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualWidth - 1);
3747
- s.value = p && m ? Nn({
3751
+ s.value = p && m ? In({
3748
3752
  tableRect: p,
3749
3753
  frameRect: l,
3750
3754
  kind: "row"
3751
- }) : null, c.value = p && h ? Nn({
3755
+ }) : null, c.value = p && h ? In({
3752
3756
  tableRect: p,
3753
3757
  frameRect: l,
3754
3758
  kind: "column"
3755
3759
  }) : null;
3756
- }, ee = () => {
3760
+ }, M = () => {
3757
3761
  if (!e.active || !t.value) {
3758
3762
  l.value = null;
3759
3763
  return;
@@ -3763,16 +3767,16 @@ var ga = X({
3763
3767
  l.value = null;
3764
3768
  return;
3765
3769
  }
3766
- let a = i.getBoundingClientRect(), o = t.value === "row" ? Ln(e.editor)?.getBoundingClientRect() : null, s = o ? {
3770
+ let a = i.getBoundingClientRect(), o = t.value === "row" ? Bn(e.editor)?.getBoundingClientRect() : null, s = o ? {
3767
3771
  left: a.left,
3768
3772
  top: o.top,
3769
3773
  width: a.width,
3770
3774
  height: a.height
3771
3775
  } : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
3772
- l.value = An({
3776
+ l.value = Nn({
3773
3777
  anchorRect: s,
3774
3778
  frameRect: c,
3775
- boundaryRect: Un(n),
3779
+ boundaryRect: Kn(n),
3776
3780
  menuSize: {
3777
3781
  width: u.width || 254,
3778
3782
  height: f || u.height || 410
@@ -3790,33 +3794,33 @@ var ga = X({
3790
3794
  return;
3791
3795
  }
3792
3796
  let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
3793
- u.value = jn({
3797
+ u.value = Pn({
3794
3798
  triggerRect: i.getBoundingClientRect(),
3795
3799
  parentMenuRect: _.value.getBoundingClientRect(),
3796
- boundaryRect: Un(r),
3800
+ boundaryRect: Kn(r),
3797
3801
  submenuSize: {
3798
3802
  width: a.width || 238,
3799
3803
  height: o || 410
3800
3804
  }
3801
3805
  });
3802
3806
  }, P = () => {
3803
- M(), ee(), N();
3804
- }, F = () => {
3805
- Y(P);
3806
- }, te = (e, i) => {
3807
+ te(), M(), N();
3808
+ }, ne = () => {
3809
+ J(P);
3810
+ }, F = (e, i) => {
3807
3811
  let a = t.value === e && r.value === i;
3808
- r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
3812
+ r.value = i, t.value = a ? null : e, n.value = null, u.value = null, ne();
3809
3813
  }, I = () => {
3810
- e.editor.view.dispatch(bn(e.editor.state.tr, null));
3814
+ e.editor.view.dispatch(Sn(e.editor.state.tr, null));
3811
3815
  }, L = (t, n) => {
3812
3816
  let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
3813
- r !== null && Xn(e.editor, r, t, { visualIndex: i }), te(t, n);
3817
+ r !== null && $n(e.editor, r, t, { visualIndex: i }), F(t, n);
3814
3818
  }, R = () => {
3815
- I(), te("selection", "selection-edge");
3819
+ I(), F("selection", "selection-edge");
3816
3820
  }, z = (r = !1) => {
3817
3821
  t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
3818
3822
  }, B = async (n, r) => {
3819
- let i = await Fn({
3823
+ let i = await Rn({
3820
3824
  editor: e.editor,
3821
3825
  commandId: n,
3822
3826
  menu: r ?? t.value ?? "selection",
@@ -3824,27 +3828,31 @@ var ga = X({
3824
3828
  });
3825
3829
  return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
3826
3830
  }, V = (t) => {
3827
- C.value && (Ge(e.editor, t), z(!1));
3828
- }, H = (e) => {
3829
- t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
3830
- }, ne = (t) => {
3831
+ C.value && (Ke(e.editor, t), z(!1));
3832
+ }, re = (e) => {
3833
+ t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, ne());
3834
+ }, ie = (t) => {
3831
3835
  let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
3832
- !n || r === null || nr(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
3833
- }, re = (e, t, n) => {
3836
+ !n || r === null || ar(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
3837
+ }, ae = (e, t, n) => {
3838
+ if (!ee()) {
3839
+ n.preventDefault();
3840
+ return;
3841
+ }
3834
3842
  x = {
3835
3843
  axis: e,
3836
3844
  index: t
3837
3845
  }, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
3838
- }, ie = (t) => {
3846
+ }, oe = (t) => {
3839
3847
  if (!x) return;
3840
- let n = zn(e.editor, x.axis, t.clientX, t.clientY);
3848
+ let n = Hn(e.editor, x.axis, t.clientX, t.clientY);
3841
3849
  n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
3842
- }, ae = (t) => {
3850
+ }, se = (t) => {
3843
3851
  let n = x;
3844
3852
  if (!n) return;
3845
- let r = zn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
3846
- t.preventDefault(), x = null, S = null, r !== null && Yn(e.editor, n.axis, n.index, r);
3847
- }, oe = K(() => (f.value, t.value === "row" || t.value === "column" ? Bn(e.editor, t.value) : null)), se = (e) => {
3853
+ let r = Hn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
3854
+ t.preventDefault(), x = null, S = null, r !== null && Qn(e.editor, n.axis, n.index, r);
3855
+ }, ce = G(() => (f.value, t.value === "row" || t.value === "column" ? Un(e.editor, t.value) : null)), le = (e) => {
3848
3856
  if (!(!t.value || e.key !== "Escape")) {
3849
3857
  if (n.value) {
3850
3858
  n.value = null;
@@ -3852,20 +3860,20 @@ var ga = X({
3852
3860
  }
3853
3861
  z(!0);
3854
3862
  }
3855
- }, ce = (e) => {
3863
+ }, ue = (e) => {
3856
3864
  if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
3857
3865
  let t = e.currentTarget;
3858
3866
  if (!(t instanceof HTMLElement)) return;
3859
3867
  let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
3860
3868
  e.preventDefault(), e.stopPropagation(), r[o]?.focus();
3861
- }, le = (e) => {
3869
+ }, de = (e) => {
3862
3870
  t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
3863
3871
  };
3864
- hr(() => {
3865
- P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", se), document.addEventListener("mousedown", le), document.addEventListener("dragover", ie), document.addEventListener("drop", ae);
3866
- }), J(() => {
3867
- A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", se), document.removeEventListener("mousedown", le), document.removeEventListener("dragover", ie), document.removeEventListener("drop", ae);
3868
- }), q(() => [
3872
+ vr(() => {
3873
+ P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", le), document.addEventListener("mousedown", de), document.addEventListener("dragover", oe), document.addEventListener("drop", se);
3874
+ }), q(() => {
3875
+ A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", le), document.removeEventListener("mousedown", de), document.removeEventListener("dragover", oe), document.removeEventListener("drop", se);
3876
+ }), K(() => [
3869
3877
  e.active,
3870
3878
  w.value.activeCellPos,
3871
3879
  w.value.selectionFrom,
@@ -3876,12 +3884,12 @@ var ga = X({
3876
3884
  t.value,
3877
3885
  n.value,
3878
3886
  r.value
3879
- ], F, { flush: "post" });
3880
- let ue = () => {
3887
+ ], ne, { flush: "post" });
3888
+ let fe = () => {
3881
3889
  if (!t.value) return null;
3882
3890
  let r = k.value.map((r, i) => {
3883
- let a = Wn(r), o = i === 0 ? a : Wn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Me(e.editor, c) : Pn(e.editor, r.commandId), u = Gn(r, e.messages), d = ya[r.icon];
3884
- return U("button", {
3891
+ let a = qn(r), o = i === 0 ? a : qn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Ne(e.editor, c) : Ln(e.editor, r.commandId), u = Jn(r, e.messages), d = xa[r.icon];
3892
+ return H("button", {
3885
3893
  key: `${r.id}-${i}`,
3886
3894
  type: "button",
3887
3895
  role: "menuitem",
@@ -3916,26 +3924,26 @@ var ga = X({
3916
3924
  }
3917
3925
  }
3918
3926
  }, [
3919
- U("span", {
3927
+ H("span", {
3920
3928
  class: "markweave-table-menu-item-icon",
3921
3929
  "aria-hidden": "true"
3922
- }, [U(d, {
3930
+ }, [H(d, {
3923
3931
  size: 18,
3924
3932
  strokeWidth: 1.8
3925
3933
  })]),
3926
- U("span", { class: "markweave-table-menu-item-label" }, u),
3927
- r.submenuId ? U(Hr, {
3934
+ H("span", { class: "markweave-table-menu-item-label" }, u),
3935
+ r.submenuId ? H(Gr, {
3928
3936
  class: "markweave-table-menu-chevron",
3929
3937
  size: 16,
3930
3938
  "aria-hidden": "true"
3931
3939
  }) : null
3932
3940
  ]);
3933
- }), i = [U("div", {
3941
+ }), i = [H("div", {
3934
3942
  ref: v,
3935
3943
  class: "markweave-table-menu-scroll",
3936
3944
  style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
3937
3945
  }, r)];
3938
- if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(U("div", {
3946
+ if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(H("div", {
3939
3947
  ref: y,
3940
3948
  class: "markweave-table-submenu markweave-table-color-menu",
3941
3949
  role: "menu",
@@ -3948,43 +3956,43 @@ var ga = X({
3948
3956
  top: `${u.value.top}px`,
3949
3957
  maxHeight: `${u.value.maxHeight}px`
3950
3958
  } : void 0,
3951
- onKeydown: ce
3959
+ onKeydown: ue
3952
3960
  }, [
3953
- U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3954
- ...Zn.map((t) => U("button", {
3961
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3962
+ ...er.map((t) => H("button", {
3955
3963
  key: `text-${t.id}`,
3956
3964
  type: "button",
3957
3965
  role: "menuitemradio",
3958
- "aria-checked": oe.value?.textColorId === t.id,
3959
- "data-active": oe.value?.textColorId === t.id ? "true" : "false",
3966
+ "aria-checked": ce.value?.textColorId === t.id,
3967
+ "data-active": ce.value?.textColorId === t.id ? "true" : "false",
3960
3968
  "data-testid": `markweave-table-text-color-${t.id}`,
3961
3969
  onMousedown: $,
3962
- onClick: () => H((n) => kn(e.editor, n, t.id))
3963
- }, [U("span", {
3970
+ onClick: () => re((n) => Mn(e.editor, n, t.id))
3971
+ }, [H("span", {
3964
3972
  class: "markweave-table-color-swatch markweave-table-text-color-swatch",
3965
3973
  "aria-hidden": "true",
3966
3974
  style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
3967
- }), U("span", null, e.messages.table.colors[t.id].text)])),
3968
- U("div", { class: "markweave-table-submenu-separator" }),
3969
- U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3970
- ...Zn.map((t) => U("button", {
3975
+ }), H("span", null, e.messages.table.colors[t.id].text)])),
3976
+ H("div", { class: "markweave-table-submenu-separator" }),
3977
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3978
+ ...er.map((t) => H("button", {
3971
3979
  key: `background-${t.id}`,
3972
3980
  type: "button",
3973
3981
  role: "menuitemradio",
3974
- "aria-checked": oe.value?.backgroundColorId === t.id,
3975
- "data-active": oe.value?.backgroundColorId === t.id ? "true" : "false",
3982
+ "aria-checked": ce.value?.backgroundColorId === t.id,
3983
+ "data-active": ce.value?.backgroundColorId === t.id ? "true" : "false",
3976
3984
  "data-testid": `markweave-table-background-color-${t.id}`,
3977
3985
  onMousedown: $,
3978
- onClick: () => H((n) => On(e.editor, n, t.id))
3979
- }, [U("span", {
3986
+ onClick: () => re((n) => jn(e.editor, n, t.id))
3987
+ }, [H("span", {
3980
3988
  class: "markweave-table-color-swatch",
3981
3989
  "aria-hidden": "true",
3982
3990
  style: { backgroundColor: t.backgroundColor }
3983
- }), U("span", null, e.messages.table.colors[t.id].background)]))
3991
+ }), H("span", null, e.messages.table.colors[t.id].background)]))
3984
3992
  ])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
3985
3993
  let t = (t, n) => {
3986
- let r = ba[t];
3987
- return U("button", {
3994
+ let r = Sa[t];
3995
+ return H("button", {
3988
3996
  key: t,
3989
3997
  type: "button",
3990
3998
  role: "menuitemradio",
@@ -3992,14 +4000,14 @@ var ga = X({
3992
4000
  "data-active": n ? "true" : "false",
3993
4001
  "data-testid": `markweave-table-alignment-${t}`,
3994
4002
  onMousedown: $,
3995
- onClick: () => H((n) => Dn(e.editor, n, t))
3996
- }, [U(r, {
4003
+ onClick: () => re((n) => An(e.editor, n, t))
4004
+ }, [H(r, {
3997
4005
  size: 18,
3998
4006
  strokeWidth: 1.8,
3999
4007
  "aria-hidden": "true"
4000
- }), U("span", null, e.messages.table.alignments[t])]);
4008
+ }), H("span", null, e.messages.table.alignments[t])]);
4001
4009
  };
4002
- i.push(U("div", {
4010
+ i.push(H("div", {
4003
4011
  ref: y,
4004
4012
  class: "markweave-table-submenu markweave-table-alignment-menu",
4005
4013
  role: "menu",
@@ -4012,18 +4020,18 @@ var ga = X({
4012
4020
  top: `${u.value.top}px`,
4013
4021
  maxHeight: `${u.value.maxHeight}px`
4014
4022
  } : void 0,
4015
- onKeydown: ce
4023
+ onKeydown: ue
4016
4024
  }, [
4017
- ...$n.map((e) => t(e, oe.value?.textAlign === e)),
4018
- U("div", { class: "markweave-table-submenu-separator" }),
4019
- ...tr.map((e) => t(e, oe.value?.verticalAlign === e))
4025
+ ...nr.map((e) => t(e, ce.value?.textAlign === e)),
4026
+ H("div", { class: "markweave-table-submenu-separator" }),
4027
+ ...ir.map((e) => t(e, ce.value?.verticalAlign === e))
4020
4028
  ]));
4021
4029
  }
4022
- return U("div", {
4030
+ return H("div", {
4023
4031
  ref: _,
4024
4032
  class: "markweave-table-menu",
4025
4033
  role: "menu",
4026
- "aria-label": er(t.value, e.messages),
4034
+ "aria-label": rr(t.value, e.messages),
4027
4035
  "data-testid": "markweave-table-menu",
4028
4036
  "data-positioned": l.value ? "true" : "false",
4029
4037
  "data-placement": l.value?.placement,
@@ -4032,19 +4040,19 @@ var ga = X({
4032
4040
  left: `${l.value.left}px`,
4033
4041
  top: `${l.value.top}px`
4034
4042
  } : void 0,
4035
- onKeydown: ce
4043
+ onKeydown: ue
4036
4044
  }, i);
4037
4045
  };
4038
- return () => e.active ? U("div", {
4046
+ return () => e.active ? H("div", {
4039
4047
  ref: p,
4040
4048
  class: "markweave-table-controls",
4041
4049
  "data-testid": "markweave-table-controls",
4042
4050
  "aria-label": e.messages.table.controlsAriaLabel,
4043
4051
  "data-open-menu": t.value ?? "none",
4044
4052
  "data-positioned": i.value || a.value || o.value ? "true" : "false",
4045
- onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(En, { type: "clear-hover" }))
4053
+ onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(kn, { type: "clear-hover" }))
4046
4054
  }, [
4047
- d.value ? U("div", {
4055
+ d.value ? H("div", {
4048
4056
  class: "markweave-table-copy-feedback",
4049
4057
  role: "status",
4050
4058
  "aria-live": "polite",
@@ -4052,8 +4060,8 @@ var ga = X({
4052
4060
  "data-copy-kind": d.value.kind,
4053
4061
  "data-text-length": d.value.textLength,
4054
4062
  "data-html-length": d.value.htmlLength
4055
- }, In(d.value)) : null,
4056
- i.value ? U("button", {
4063
+ }, zn(d.value)) : null,
4064
+ i.value ? H("button", {
4057
4065
  ref: m,
4058
4066
  type: "button",
4059
4067
  draggable: !0,
@@ -4075,15 +4083,15 @@ var ga = X({
4075
4083
  },
4076
4084
  onMousedown: $,
4077
4085
  onClick: () => L("row", "row-edge"),
4078
- onDragstart: (e) => re("row", T.value?.index ?? 0, e),
4086
+ onDragstart: (e) => ae("row", T.value?.index ?? 0, e),
4079
4087
  onDragend: () => {
4080
4088
  x = null, S = null;
4081
4089
  }
4082
- }, [U(fi, {
4090
+ }, [H(hi, {
4083
4091
  size: 14,
4084
4092
  "aria-hidden": "true"
4085
4093
  })]) : null,
4086
- a.value ? U("button", {
4094
+ a.value ? H("button", {
4087
4095
  ref: h,
4088
4096
  type: "button",
4089
4097
  draggable: !0,
@@ -4105,15 +4113,15 @@ var ga = X({
4105
4113
  },
4106
4114
  onMousedown: $,
4107
4115
  onClick: () => L("column", "column-edge"),
4108
- onDragstart: (e) => re("column", E.value?.index ?? 0, e),
4116
+ onDragstart: (e) => ae("column", E.value?.index ?? 0, e),
4109
4117
  onDragend: () => {
4110
4118
  x = null, S = null;
4111
4119
  }
4112
- }, [U(fi, {
4120
+ }, [H(hi, {
4113
4121
  size: 14,
4114
4122
  "aria-hidden": "true"
4115
4123
  })]) : null,
4116
- O.value && o.value ? U("button", {
4124
+ O.value && o.value ? H("button", {
4117
4125
  ref: g,
4118
4126
  type: "button",
4119
4127
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
@@ -4130,11 +4138,11 @@ var ga = X({
4130
4138
  },
4131
4139
  onMousedown: $,
4132
4140
  onClick: R
4133
- }, [U(fi, {
4141
+ }, [H(hi, {
4134
4142
  size: 14,
4135
4143
  "aria-hidden": "true"
4136
4144
  })]) : null,
4137
- s.value ? U("button", {
4145
+ ee() && s.value ? H("button", {
4138
4146
  type: "button",
4139
4147
  class: "markweave-table-extend-button markweave-table-extend-button--row",
4140
4148
  "aria-label": e.messages.table.addRow,
@@ -4147,12 +4155,12 @@ var ga = X({
4147
4155
  height: `${s.value.height}px`
4148
4156
  },
4149
4157
  onMousedown: $,
4150
- onClick: () => ne("row")
4151
- }, [U(gi, {
4158
+ onClick: () => ie("row")
4159
+ }, [H(yi, {
4152
4160
  size: 14,
4153
4161
  "aria-hidden": "true"
4154
4162
  })]) : null,
4155
- c.value ? U("button", {
4163
+ ee() && c.value ? H("button", {
4156
4164
  type: "button",
4157
4165
  class: "markweave-table-extend-button markweave-table-extend-button--column",
4158
4166
  "aria-label": e.messages.table.addColumn,
@@ -4165,15 +4173,15 @@ var ga = X({
4165
4173
  height: `${c.value.height}px`
4166
4174
  },
4167
4175
  onMousedown: $,
4168
- onClick: () => ne("column")
4169
- }, [U(gi, {
4176
+ onClick: () => ie("column")
4177
+ }, [H(yi, {
4170
4178
  size: 14,
4171
4179
  "aria-hidden": "true"
4172
4180
  })]) : null,
4173
- ue()
4181
+ fe()
4174
4182
  ]) : null;
4175
4183
  }
4176
- }), Sa = X({
4184
+ }), wa = Y({
4177
4185
  name: "MarkweaveVueTableSelectionOverlay",
4178
4186
  props: {
4179
4187
  editor: {
@@ -4186,18 +4194,18 @@ var ga = X({
4186
4194
  }
4187
4195
  },
4188
4196
  setup(e) {
4189
- let t = W(null), n = () => {
4197
+ let t = U(null), n = () => {
4190
4198
  if (e.focusState.mode !== "cell-selection") {
4191
4199
  t.value = null;
4192
4200
  return;
4193
4201
  }
4194
- t.value = Jn(e.editor, wn(e.editor.state));
4202
+ t.value = Zn(e.editor, Dn(e.editor.state));
4195
4203
  };
4196
- return hr(() => {
4204
+ return vr(() => {
4197
4205
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
4198
- }), J(() => {
4206
+ }), q(() => {
4199
4207
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
4200
- }), q(() => [
4208
+ }), K(() => [
4201
4209
  e.focusState.activeCellPos,
4202
4210
  e.focusState.anchorCellPos,
4203
4211
  e.focusState.mode,
@@ -4205,10 +4213,10 @@ var ga = X({
4205
4213
  e.focusState.selectionFrom,
4206
4214
  e.focusState.selectionTo
4207
4215
  ], () => {
4208
- Y(n);
4216
+ J(n);
4209
4217
  }, { flush: "post" }), () => {
4210
4218
  let e = t.value;
4211
- return e ? U("div", {
4219
+ return e ? H("div", {
4212
4220
  "aria-hidden": "true",
4213
4221
  class: "markweave-table-selection-overlay",
4214
4222
  "data-axis-target": e.axisTarget ?? "none",
@@ -4230,7 +4238,7 @@ var ga = X({
4230
4238
  }) : null;
4231
4239
  };
4232
4240
  }
4233
- }), Ca = X({
4241
+ }), Ta = Y({
4234
4242
  name: "MarkweaveVueCodeBlockControls",
4235
4243
  props: {
4236
4244
  editor: {
@@ -4259,53 +4267,53 @@ var ga = X({
4259
4267
  }
4260
4268
  },
4261
4269
  setup(e) {
4262
- let t = W(null), n = W(null), r = W(null), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W([]), u = W(null), d = W(!1), f = W(""), p = W(-1), m = W(null), h = W(!1), g = W(null), _ = W(null), v = W(!1), y = W({
4270
+ let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U([]), u = U(null), d = U(!1), f = U(""), p = U(-1), m = U(null), h = U(!1), g = U(null), _ = U(null), v = U(!1), y = U({
4263
4271
  active: !1,
4264
4272
  lastX: 0,
4265
4273
  lastY: 0
4266
- }), b = W(0), x = W(0), S = W(0), C = null, w = K(() => (S.value, Dt(e.editor, s.value))), T = K(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
4274
+ }), b = U(0), x = U(0), S = U(0), C = null, ee = G(() => (S.value, Ot(e.editor, s.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
4267
4275
  ...e.state,
4268
4276
  pos: e.state.pos,
4269
4277
  active: !0
4270
- } : null), E = K(() => w.value ?? T.value), D = K(() => E.value !== null), O = K(() => E.value?.language === "mermaid"), k = K(() => Mt(e.editor, E.value)), A = K(() => D.value && E.value !== null && !k.value), j = K(() => !e.readOnly), M = K(() => E.value ? bt(E.value.language) : bt("text")), ee = K(() => m.value?.status ?? "idle"), N = K(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), P = K(() => O.value && N.value === "preview"), F = K(() => (S.value, b.value, x.value, At(e.editor))), te = K(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), I = K(() => wt(f.value)), L = K(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), R = () => {
4278
+ } : null), T = G(() => ee.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => Nt(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), j = G(() => T.value ? xt(T.value.language) : xt("text")), te = G(() => m.value?.status ?? "idle"), M = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), N = G(() => D.value && M.value === "preview"), P = G(() => (S.value, b.value, x.value, jt(e.editor))), ne = G(() => `${x.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), F = G(() => Tt(f.value)), I = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), L = () => {
4271
4279
  C !== null && (window.clearTimeout(C), C = null);
4272
- }, z = (e) => {
4273
- R(), m.value = e, e && (C = window.setTimeout(() => {
4280
+ }, R = (e) => {
4281
+ L(), m.value = e, e && (C = window.setTimeout(() => {
4274
4282
  m.value = null, C = null;
4275
- }, pt));
4276
- }, B = () => {
4283
+ }, mt));
4284
+ }, z = () => {
4277
4285
  g.value = null, _.value = null, v.value = !1, y.value = {
4278
4286
  active: !1,
4279
4287
  lastX: 0,
4280
4288
  lastY: 0
4281
4289
  }, e.editor.view.focus();
4282
- }, V = () => {
4290
+ }, B = () => {
4283
4291
  let n = t.value;
4284
4292
  if (!n) return;
4285
- if (!Ot(n) || F.value.length === 0) {
4293
+ if (!kt(n) || P.value.length === 0) {
4286
4294
  l.value = [];
4287
4295
  return;
4288
4296
  }
4289
- let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
4290
- let n = Ct(St(e.editor, t.pos, t.mermaidPreviewMode), r);
4291
- return n ? [vt(t, n, r)] : [];
4297
+ let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
4298
+ let n = wt(Ct(e.editor, t.pos, t.mermaidPreviewMode), r);
4299
+ return n ? [yt(t, n, r)] : [];
4292
4300
  });
4293
- l.value = Nt(l.value, i, F.value.map((e) => e.pos));
4294
- }, H = () => {
4295
- if (!A.value || !E.value) {
4301
+ l.value = Pt(l.value, i, P.value.map((e) => e.pos));
4302
+ }, V = () => {
4303
+ if (!k.value || !T.value) {
4296
4304
  c.value = null, u.value = null;
4297
4305
  return;
4298
4306
  }
4299
4307
  let i = t.value;
4300
4308
  if (!i) return;
4301
- let a = St(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = Ct(a, o);
4309
+ let a = Ct(e.editor, T.value.pos, M.value), o = i.getBoundingClientRect(), s = wt(a, o);
4302
4310
  if (!s) {
4303
- c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
4311
+ c.value = c.value?.pos === T.value.pos ? c.value : null, u.value = d.value ? u.value : null;
4304
4312
  return;
4305
4313
  }
4306
- if (c.value = gt(E.value.pos, s, o), d.value && n.value) {
4314
+ if (c.value = _t(T.value.pos, s, o), d.value && n.value) {
4307
4315
  let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
4308
- u.value = dt({
4316
+ u.value = ft({
4309
4317
  overlayRect: o,
4310
4318
  buttonRect: e,
4311
4319
  menuHeight: t,
@@ -4313,84 +4321,84 @@ var ga = X({
4313
4321
  windowHeight: window.innerHeight
4314
4322
  });
4315
4323
  }
4316
- }, ne = async () => {
4324
+ }, re = async () => {
4317
4325
  if (e.readOnly) {
4318
- if (!E.value) return;
4319
- let e = await mt(E.value.text);
4320
- z(ot(E.value, e ? "copied" : "failed"));
4326
+ if (!T.value) return;
4327
+ let e = await ht(T.value.text);
4328
+ R(st(T.value, e ? "copied" : "failed"));
4321
4329
  return;
4322
4330
  }
4323
- if (!yt(e.editor, E.value)) return;
4324
- let t = await it(e.editor);
4325
- z(ot(at(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
4326
- }, re = (t, n) => {
4331
+ if (!bt(e.editor, T.value)) return;
4332
+ let t = await at(e.editor);
4333
+ R(st(ot(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
4334
+ }, ie = (t, n) => {
4327
4335
  if (e.readOnly) {
4328
- en(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
4336
+ tn(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
4329
4337
  return;
4330
4338
  }
4331
4339
  let r = e.state.active && e.state.pos === t.pos;
4332
- ut(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
4333
- }, ie = (t) => {
4334
- if (e.readOnly || !E.value) return;
4335
- let n = e.state.active && e.state.pos === E.value.pos;
4336
- lt(e.editor, E.value.pos, t) && (t === "mermaid" && ut(e.editor, E.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
4337
- }, oe = () => {
4338
- d.value = !d.value, d.value && o.value === null && (o.value = ht()), p.value = d.value ? kt(I.value, E.value?.language ?? null) : -1;
4339
- }, se = (e) => {
4340
- let t = wt(e);
4341
- f.value = e, p.value = kt(t, e.trim() ? null : E.value?.language ?? null);
4342
- }, ce = (t) => {
4340
+ dt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
4341
+ }, ae = (t) => {
4342
+ if (e.readOnly || !T.value) return;
4343
+ let n = e.state.active && e.state.pos === T.value.pos;
4344
+ ut(e.editor, T.value.pos, t) && (t === "mermaid" && dt(e.editor, T.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
4345
+ }, se = () => {
4346
+ d.value = !d.value, d.value && o.value === null && (o.value = gt()), p.value = d.value ? At(F.value, T.value?.language ?? null) : -1;
4347
+ }, ce = (e) => {
4348
+ let t = Tt(e);
4349
+ f.value = e, p.value = At(t, e.trim() ? null : T.value?.language ?? null);
4350
+ }, le = (t) => {
4343
4351
  if (!t.isComposing) {
4344
4352
  if (t.key === "ArrowDown" || t.key === "ArrowUp") {
4345
- t.preventDefault(), p.value = Ft(p.value, I.value.length, t.key === "ArrowUp" ? "previous" : "next");
4353
+ t.preventDefault(), p.value = It(p.value, F.value.length, t.key === "ArrowUp" ? "previous" : "next");
4346
4354
  return;
4347
4355
  }
4348
4356
  if (t.key === "Enter") {
4349
- let e = I.value[p.value];
4350
- e && (t.preventDefault(), ie(e.language));
4357
+ let e = F.value[p.value];
4358
+ e && (t.preventDefault(), ae(e.language));
4351
4359
  return;
4352
4360
  }
4353
4361
  t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
4354
4362
  }
4355
- }, le = () => {
4356
- e.readOnly || !E.value || ct(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
4357
4363
  }, ue = () => {
4358
- if (!E.value) return;
4359
- let t = jt(e.editor, E.value.pos);
4360
- t && ae({
4364
+ e.readOnly || !T.value || lt(e.editor, T.value.pos, !O.value) && (b.value += 1, S.value += 1, s.value = null);
4365
+ }, de = () => {
4366
+ if (!T.value) return;
4367
+ let t = Mt(e.editor, T.value.pos);
4368
+ t && oe({
4361
4369
  data: new Blob([t], { type: "image/svg+xml" }),
4362
4370
  fileName: "markweave-mermaid.svg",
4363
4371
  onSettled: () => e.editor.view.focus(),
4364
4372
  ownerDocument: document
4365
4373
  });
4366
- }, de = () => {
4367
- if (!E.value) return;
4368
- let t = jt(e.editor, E.value.pos);
4369
- t && (g.value = _t(t), _.value = null, v.value = !1, y.value = {
4374
+ }, fe = () => {
4375
+ if (!T.value) return;
4376
+ let t = Mt(e.editor, T.value.pos);
4377
+ t && (g.value = vt(t), _.value = null, v.value = !1, y.value = {
4370
4378
  active: !1,
4371
4379
  lastX: 0,
4372
4380
  lastY: 0
4373
4381
  });
4374
- }, fe = (e) => {
4382
+ }, pe = (e) => {
4375
4383
  g.value = g.value ? {
4376
4384
  ...g.value,
4377
- scale: ft(g.value.scale + e)
4385
+ scale: pt(g.value.scale + e)
4378
4386
  } : null;
4379
- }, pe = () => {
4380
- g.value = g.value ? _t(g.value.svg) : null, y.value = {
4387
+ }, me = () => {
4388
+ g.value = g.value ? vt(g.value.svg) : null, y.value = {
4381
4389
  active: !1,
4382
4390
  lastX: 0,
4383
4391
  lastY: 0
4384
4392
  }, v.value = !1;
4385
- }, me = (e) => {
4386
- e.preventDefault(), fe(e.deltaY < 0 ? Pt : -Pt);
4387
4393
  }, he = (e) => {
4394
+ e.preventDefault(), pe(e.deltaY < 0 ? Ft : -Ft);
4395
+ }, ge = (e) => {
4388
4396
  e.button === 0 && (e.preventDefault(), y.value = {
4389
4397
  active: !0,
4390
4398
  lastX: e.clientX,
4391
4399
  lastY: e.clientY
4392
4400
  }, v.value = !0);
4393
- }, ge = (e) => {
4401
+ }, _e = (e) => {
4394
4402
  let t = y.value;
4395
4403
  if (!t.active) return;
4396
4404
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -4398,64 +4406,64 @@ var ga = X({
4398
4406
  active: !0,
4399
4407
  lastX: e.clientX,
4400
4408
  lastY: e.clientY
4401
- }, g.value = It(g.value, n, r);
4402
- }, _e = () => {
4409
+ }, g.value = Lt(g.value, n, r);
4410
+ }, ve = () => {
4403
4411
  y.value = {
4404
4412
  active: !1,
4405
4413
  lastX: 0,
4406
4414
  lastY: 0
4407
4415
  }, v.value = !1;
4408
4416
  };
4409
- q(() => e.readOnly, (e) => {
4417
+ K(() => e.readOnly, (e) => {
4410
4418
  e && (d.value = !1, f.value = "");
4411
- }), q(L, () => {
4412
- z(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
4413
- }), q(d, async (e) => {
4419
+ }), K(I, () => {
4420
+ R(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
4421
+ }), K(d, async (e) => {
4414
4422
  if (!e) {
4415
4423
  p.value = -1;
4416
4424
  return;
4417
4425
  }
4418
- await Y(), H(), i.value?.focus({ preventScroll: !0 });
4419
- }), q(() => [
4426
+ await J(), V(), i.value?.focus({ preventScroll: !0 });
4427
+ }), K(() => [
4420
4428
  d.value,
4421
4429
  f.value,
4422
4430
  p.value
4423
4431
  ], async () => {
4424
4432
  if (!d.value || p.value < 0) return;
4425
- await Y();
4433
+ await J();
4426
4434
  let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
4427
- e && t && Lt(e, t);
4428
- }, { flush: "post" }), q(() => [
4429
- A.value,
4435
+ e && t && Rt(e, t);
4436
+ }, { flush: "post" }), K(() => [
4437
+ k.value,
4430
4438
  b.value,
4431
- E.value?.pos ?? null,
4432
- I.value.length,
4439
+ T.value?.pos ?? null,
4440
+ F.value.length,
4433
4441
  d.value,
4434
- N.value
4442
+ M.value
4435
4443
  ], async () => {
4436
- await Y(), H();
4444
+ await J(), V();
4437
4445
  }, {
4438
4446
  flush: "post",
4439
4447
  immediate: !0
4440
- }), q(te, async () => {
4441
- await Y(), V(), window.requestAnimationFrame(V);
4448
+ }), K(ne, async () => {
4449
+ await J(), B(), window.requestAnimationFrame(B);
4442
4450
  }, {
4443
4451
  flush: "post",
4444
4452
  immediate: !0
4445
4453
  });
4446
- let ve = null;
4447
- return hr(() => {
4448
- Y(() => {
4454
+ let ye = null;
4455
+ return vr(() => {
4456
+ J(() => {
4449
4457
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
4450
4458
  if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
4451
- let r = Et(e.editor, n.target), i = Dt(e.editor, r), a = i && !Mt(e.editor, i) ? i.pos : null;
4459
+ let r = Dt(e.editor, n.target), i = Ot(e.editor, r), a = i && !Nt(e.editor, i) ? i.pos : null;
4452
4460
  s.value = s.value === a ? s.value : a;
4453
4461
  }, i = () => {
4454
4462
  d.value || (s.value = null);
4455
4463
  }, a = (t) => {
4456
4464
  if (t.key === "Escape") {
4457
4465
  if (g.value) {
4458
- B();
4466
+ z();
4459
4467
  return;
4460
4468
  }
4461
4469
  d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
@@ -4463,16 +4471,16 @@ var ga = X({
4463
4471
  }, o = (e) => {
4464
4472
  d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
4465
4473
  }, c = ({ transaction: e }) => {
4466
- e.getMeta(rt) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(rt) || Zt(e)) && (S.value += 1);
4474
+ e.getMeta(it) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(it) || Qt(e)) && (S.value += 1);
4467
4475
  };
4468
- n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", H), window.addEventListener("scroll", H, !0), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
4469
- n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", H), window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), R();
4476
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ye = () => {
4477
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), L();
4470
4478
  };
4471
4479
  });
4472
- }), J(() => {
4473
- ve?.(), ve = null, R();
4480
+ }), q(() => {
4481
+ ye?.(), ye = null, L();
4474
4482
  }), () => {
4475
- if (!A.value && F.value.length === 0 && !g.value) return null;
4483
+ if (!k.value && P.value.length === 0 && !g.value) return null;
4476
4484
  let s = c.value ? {
4477
4485
  top: `${c.value.top}px`,
4478
4486
  right: `${c.value.right}px`
@@ -4480,15 +4488,15 @@ var ga = X({
4480
4488
  left: `${u.value.left}px`,
4481
4489
  top: `${u.value.top}px`
4482
4490
  } : void 0;
4483
- return U("div", {
4491
+ return H("div", {
4484
4492
  ref: t,
4485
4493
  class: "markweave-codeblock-overlay",
4486
4494
  "data-testid": "markweave-codeblock-overlay",
4487
4495
  "data-read-only": e.readOnly ? "true" : "false"
4488
4496
  }, [
4489
- ...F.value.map((e) => {
4497
+ ...P.value.map((e) => {
4490
4498
  let t = l.value.find((t) => t.pos === e.pos);
4491
- return U("div", {
4499
+ return H("div", {
4492
4500
  key: e.pos,
4493
4501
  class: "markweave-mermaid-tabs",
4494
4502
  "data-testid": "markweave-mermaid-tabs",
@@ -4498,29 +4506,29 @@ var ga = X({
4498
4506
  top: `${t.top}px`,
4499
4507
  left: `${t.left}px`
4500
4508
  } : void 0
4501
- }, ["code", "preview"].map((t) => U("button", {
4509
+ }, ["code", "preview"].map((t) => H("button", {
4502
4510
  key: t,
4503
4511
  type: "button",
4504
4512
  "data-testid": `markweave-mermaid-mode-${t}`,
4505
4513
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
4506
4514
  onMousedown: $,
4507
- onClick: () => re(e, t)
4515
+ onClick: () => ie(e, t)
4508
4516
  }, t === "code" ? "Code" : "Preview")));
4509
4517
  }),
4510
- A.value && E.value ? U("div", {
4518
+ k.value && T.value ? H("div", {
4511
4519
  class: "markweave-codeblock-controls",
4512
4520
  "data-testid": "markweave-codeblock-controls",
4513
4521
  "data-positioned": c.value ? "true" : "false",
4514
- "data-collapsed": k.value ? "true" : "false",
4522
+ "data-collapsed": O.value ? "true" : "false",
4515
4523
  "data-read-only": e.readOnly ? "true" : "false",
4516
4524
  "aria-label": "Code block controls",
4517
4525
  style: s
4518
4526
  }, [
4519
- e.readOnly ? U("span", {
4527
+ e.readOnly ? H("span", {
4520
4528
  class: "markweave-codeblock-language-button markweave-codeblock-language-label",
4521
4529
  "aria-label": "Code block language",
4522
4530
  "data-testid": "markweave-codeblock-language"
4523
- }, [U("span", null, M.value)]) : U("button", {
4531
+ }, [H("span", null, j.value)]) : H("button", {
4524
4532
  ref: n,
4525
4533
  type: "button",
4526
4534
  class: "markweave-codeblock-language-button",
@@ -4529,24 +4537,24 @@ var ga = X({
4529
4537
  "aria-haspopup": "listbox",
4530
4538
  "data-testid": "markweave-codeblock-language",
4531
4539
  onMousedown: $,
4532
- onClick: oe
4533
- }, [U("span", null, M.value), la("chevron")]),
4534
- j.value ? U("button", {
4540
+ onClick: se
4541
+ }, [H("span", null, j.value), Q("chevron")]),
4542
+ A.value ? H("button", {
4535
4543
  type: "button",
4536
4544
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
4537
- "aria-label": k.value ? "Expand code block" : "Collapse code block",
4538
- title: k.value ? "Expand code block" : "Collapse code block",
4545
+ "aria-label": O.value ? "Expand code block" : "Collapse code block",
4546
+ title: O.value ? "Expand code block" : "Collapse code block",
4539
4547
  "data-testid": "markweave-codeblock-collapse",
4540
- "data-collapsed": k.value ? "true" : "false",
4548
+ "data-collapsed": O.value ? "true" : "false",
4541
4549
  onMousedown: $,
4542
- onClick: le
4543
- }, [la("chevron")]) : null,
4544
- U("span", { class: "markweave-codeblock-copy-wrap" }, [U("button", {
4550
+ onClick: ue
4551
+ }, [Q("chevron")]) : null,
4552
+ H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
4545
4553
  type: "button",
4546
4554
  class: "markweave-codeblock-icon-button",
4547
4555
  "aria-label": "Copy to clipboard",
4548
4556
  "data-testid": "markweave-codeblock-copy",
4549
- "data-copy-state": ee.value,
4557
+ "data-copy-state": te.value,
4550
4558
  onMousedown: $,
4551
4559
  onMouseenter: () => {
4552
4560
  h.value = !0;
@@ -4561,66 +4569,66 @@ var ga = X({
4561
4569
  h.value = !1;
4562
4570
  },
4563
4571
  onClick: () => {
4564
- ne();
4572
+ re();
4565
4573
  }
4566
- }, [la(ee.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
4574
+ }, [Q(te.value === "copied" ? "check" : "clipboard")]), h.value ? H("span", {
4567
4575
  class: "markweave-codeblock-tooltip",
4568
4576
  role: "tooltip",
4569
4577
  "data-testid": "markweave-codeblock-copy-tooltip"
4570
4578
  }, "Copy to clipboard") : null]),
4571
- O.value && N.value === "preview" ? U("div", {
4579
+ D.value && M.value === "preview" ? H("div", {
4572
4580
  class: "markweave-mermaid-preview-actions",
4573
4581
  "data-testid": "markweave-mermaid-preview-actions"
4574
- }, [U("button", {
4582
+ }, [H("button", {
4575
4583
  type: "button",
4576
4584
  class: "markweave-codeblock-icon-button",
4577
4585
  "aria-label": "Fullscreen Mermaid preview",
4578
4586
  "data-testid": "markweave-mermaid-fullscreen",
4579
- disabled: !P.value,
4587
+ disabled: !N.value,
4580
4588
  onMousedown: $,
4581
- onClick: de
4582
- }, [la("expand")]), U("button", {
4589
+ onClick: fe
4590
+ }, [Q("expand")]), H("button", {
4583
4591
  type: "button",
4584
4592
  class: "markweave-codeblock-icon-button",
4585
4593
  "aria-label": "Download Mermaid SVG",
4586
4594
  "data-testid": "markweave-mermaid-download",
4587
- disabled: !P.value,
4595
+ disabled: !N.value,
4588
4596
  onMousedown: $,
4589
- onClick: ue
4590
- }, [la("download")])]) : null
4597
+ onClick: de
4598
+ }, [Q("download")])]) : null
4591
4599
  ]) : null,
4592
- j.value && A.value && d.value && E.value ? U("div", {
4600
+ A.value && k.value && d.value && T.value ? H("div", {
4593
4601
  ref: r,
4594
4602
  class: "markweave-codeblock-language-menu",
4595
4603
  "data-testid": "markweave-codeblock-language-menu",
4596
4604
  "data-positioned": u.value ? "true" : "false",
4597
4605
  style: m
4598
- }, [U("label", { class: "markweave-codeblock-language-search" }, [U("input", {
4606
+ }, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
4599
4607
  ref: i,
4600
4608
  role: "combobox",
4601
4609
  "aria-autocomplete": "list",
4602
4610
  "aria-controls": o.value ?? void 0,
4603
4611
  "aria-expanded": "true",
4604
- "aria-activedescendant": o.value && I.value[p.value] ? Tt(o.value, I.value[p.value].language) : void 0,
4612
+ "aria-activedescendant": o.value && F.value[p.value] ? Et(o.value, F.value[p.value].language) : void 0,
4605
4613
  "aria-label": "Search code block languages",
4606
4614
  value: f.value,
4607
4615
  placeholder: "Search...",
4608
4616
  "data-testid": "markweave-codeblock-language-search",
4609
4617
  onInput: (e) => {
4610
- se(e.target.value);
4618
+ ce(e.target.value);
4611
4619
  },
4612
- onKeydown: ce
4613
- }), la("search")]), U("div", {
4620
+ onKeydown: le
4621
+ }), Q("search")]), H("div", {
4614
4622
  ref: a,
4615
4623
  id: o.value ?? void 0,
4616
4624
  class: "markweave-codeblock-language-list",
4617
4625
  role: "listbox",
4618
4626
  "aria-label": "Code block languages"
4619
- }, I.value.map((e, t) => {
4620
- let n = E.value?.language === e.language, r = t === p.value;
4621
- return U("button", {
4627
+ }, F.value.map((e, t) => {
4628
+ let n = T.value?.language === e.language, r = t === p.value;
4629
+ return H("button", {
4622
4630
  key: e.language,
4623
- id: o.value ? Tt(o.value, e.language) : void 0,
4631
+ id: o.value ? Et(o.value, e.language) : void 0,
4624
4632
  type: "button",
4625
4633
  role: "option",
4626
4634
  "aria-selected": n ? "true" : "false",
@@ -4632,21 +4640,21 @@ var ga = X({
4632
4640
  onMouseenter: () => {
4633
4641
  p.value = t;
4634
4642
  },
4635
- onClick: () => ie(e.language)
4636
- }, [U("span", null, e.label), n ? la("check") : null]);
4643
+ onClick: () => ae(e.language)
4644
+ }, [H("span", null, e.label), n ? Q("check") : null]);
4637
4645
  }))]) : null,
4638
- g.value ? U("div", {
4646
+ g.value ? H("div", {
4639
4647
  class: "markweave-mermaid-fullscreen-layer",
4640
4648
  role: "dialog",
4641
4649
  "aria-modal": "true",
4642
4650
  "aria-label": "Mermaid preview",
4643
4651
  "data-testid": "markweave-mermaid-fullscreen-layer"
4644
4652
  }, [
4645
- U("div", {
4653
+ H("div", {
4646
4654
  class: "markweave-mermaid-fullscreen-toolbar",
4647
4655
  "data-testid": "markweave-mermaid-fullscreen-toolbar"
4648
4656
  }, [
4649
- U("button", {
4657
+ H("button", {
4650
4658
  type: "button",
4651
4659
  class: "markweave-mermaid-fullscreen-control",
4652
4660
  "aria-label": "Zoom out",
@@ -4663,13 +4671,13 @@ var ga = X({
4663
4671
  onBlur: () => {
4664
4672
  _.value = null;
4665
4673
  },
4666
- onClick: () => fe(-Pt)
4667
- }, [la("zoomOut")]),
4668
- U("span", {
4674
+ onClick: () => pe(-Ft)
4675
+ }, [Q("zoomOut")]),
4676
+ H("span", {
4669
4677
  class: "markweave-mermaid-fullscreen-zoom-label",
4670
4678
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
4671
- }, xt(g.value.scale)),
4672
- U("button", {
4679
+ }, St(g.value.scale)),
4680
+ H("button", {
4673
4681
  type: "button",
4674
4682
  class: "markweave-mermaid-fullscreen-control",
4675
4683
  "aria-label": "Zoom in",
@@ -4686,9 +4694,9 @@ var ga = X({
4686
4694
  onBlur: () => {
4687
4695
  _.value = null;
4688
4696
  },
4689
- onClick: () => fe(Pt)
4690
- }, [la("zoomIn")]),
4691
- U("button", {
4697
+ onClick: () => pe(Ft)
4698
+ }, [Q("zoomIn")]),
4699
+ H("button", {
4692
4700
  type: "button",
4693
4701
  class: "markweave-mermaid-fullscreen-control",
4694
4702
  "aria-label": "Reset zoom",
@@ -4705,31 +4713,31 @@ var ga = X({
4705
4713
  onBlur: () => {
4706
4714
  _.value = null;
4707
4715
  },
4708
- onClick: pe
4709
- }, [la("reset")]),
4710
- _.value ? U("span", {
4716
+ onClick: me
4717
+ }, [Q("reset")]),
4718
+ _.value ? H("span", {
4711
4719
  class: "markweave-mermaid-fullscreen-tooltip",
4712
4720
  role: "tooltip",
4713
4721
  "data-testid": "markweave-mermaid-fullscreen-tooltip"
4714
4722
  }, _.value === "zoom-out" ? "Zoom out" : _.value === "zoom-in" ? "Zoom in" : "Reset") : null
4715
4723
  ]),
4716
- U("button", {
4724
+ H("button", {
4717
4725
  type: "button",
4718
4726
  class: "markweave-mermaid-fullscreen-close",
4719
4727
  "aria-label": "Close fullscreen Mermaid preview",
4720
4728
  "data-testid": "markweave-mermaid-fullscreen-close",
4721
- onClick: B
4722
- }, [la("close")]),
4723
- U("div", {
4729
+ onClick: z
4730
+ }, [Q("close")]),
4731
+ H("div", {
4724
4732
  class: "markweave-mermaid-fullscreen-viewport",
4725
4733
  "data-testid": "markweave-mermaid-fullscreen-viewport",
4726
4734
  "data-dragging": v.value ? "true" : "false",
4727
- onWheel: me,
4728
- onMousedown: he,
4729
- onMousemove: ge,
4730
- onMouseup: _e,
4731
- onMouseleave: _e
4732
- }, [U("div", {
4735
+ onWheel: he,
4736
+ onMousedown: ge,
4737
+ onMousemove: _e,
4738
+ onMouseup: ve,
4739
+ onMouseleave: ve
4740
+ }, [H("div", {
4733
4741
  class: "markweave-mermaid-fullscreen-content",
4734
4742
  "data-testid": "markweave-mermaid-fullscreen-content",
4735
4743
  "data-scale-percent": Math.round(g.value.scale * 100),
@@ -4745,7 +4753,7 @@ var ga = X({
4745
4753
  ]);
4746
4754
  };
4747
4755
  }
4748
- }), wa = X({
4756
+ }), Ea = Y({
4749
4757
  name: "MarkweaveVueInnerToc",
4750
4758
  props: {
4751
4759
  editor: {
@@ -4770,29 +4778,29 @@ var ga = X({
4770
4778
  }
4771
4779
  },
4772
4780
  setup(e) {
4773
- let t = W(null), n, r, i = () => {
4774
- n?.(), n = e.placement === "container" && t.value ? et(t.value) : void 0;
4781
+ let t = U(null), n, r, i = () => {
4782
+ n?.(), n = e.placement === "container" && t.value ? tt(t.value) : void 0;
4775
4783
  }, a = () => {
4776
- r?.(), r = t.value && e.state.items.length ? tt(t.value, e.state.items.length) : void 0;
4784
+ r?.(), r = t.value && e.state.items.length ? nt(t.value, e.state.items.length) : void 0;
4777
4785
  };
4778
- return hr(() => {
4786
+ return vr(() => {
4779
4787
  i(), a();
4780
- }), J(() => {
4788
+ }), q(() => {
4781
4789
  n?.(), r?.();
4782
- }), q(() => e.placement, i), q(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? U("nav", {
4790
+ }), K(() => e.placement, i), K(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? H("nav", {
4783
4791
  ref: t,
4784
4792
  class: "markweave-inner-toc",
4785
4793
  "data-testid": "markweave-inner-toc",
4786
4794
  "aria-label": e.messages.toc.ariaLabel,
4787
- style: { "--markweave-inner-toc-rail-height": Xe(e.state.items.length) }
4788
- }, [U("div", {
4795
+ style: { "--markweave-inner-toc-rail-height": Ze(e.state.items.length) }
4796
+ }, [H("div", {
4789
4797
  class: "markweave-inner-toc-rail",
4790
4798
  "aria-hidden": "true"
4791
- }, e.state.items.map((e) => U("span", {
4799
+ }, e.state.items.map((e) => H("span", {
4792
4800
  key: e.id,
4793
4801
  "data-level": e.level,
4794
4802
  "data-active": e.active ? "true" : "false"
4795
- }))), U("div", { class: "markweave-inner-toc-panel" }, [U("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => U("button", {
4803
+ }))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
4796
4804
  key: t.id,
4797
4805
  type: "button",
4798
4806
  class: "markweave-inner-toc-item",
@@ -4801,87 +4809,88 @@ var ga = X({
4801
4809
  "aria-current": t.active ? "location" : void 0,
4802
4810
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
4803
4811
  title: t.text,
4804
- onClick: () => nt(e.editor, t, {
4812
+ onClick: () => rt(e.editor, t, {
4805
4813
  behavior: "smooth",
4806
4814
  focus: e.editable
4807
4815
  })
4808
4816
  }, t.text)))])]) : null;
4809
4817
  }
4810
4818
  });
4811
- function Ta(e = {}) {
4812
- let r = n(e.lang), a = t(r), o = K(() => _n({
4819
+ function Da(e = {}) {
4820
+ let r = n(e.lang), a = t(r), o = G(() => yn({
4813
4821
  lang: r,
4814
4822
  commandGroups: e.commandGroups,
4815
4823
  commands: e.commands,
4816
4824
  builtinCommands: e.builtinCommands
4817
- })), s = W(d(e.mode)), c = K(() => De(e.theme)), l = K(() => s.value === "live" && e.editable !== !1), u = W(0), p = G(null), m = W(vn), h = G(null), g = G(null), _ = W(null), v = W("code"), y = G(null), b = G(Tn), x = W(null), S = W(!1), C = G(null), w = de(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
4818
- function O() {
4819
- D !== null && (window.clearTimeout(D), D = null), u.value += 1;
4825
+ })), s = U(d(e.mode)), c = G(() => Oe(e.theme)), l = G(() => s.value === "live" && e.editable !== !1), u = U(0), p = W(null), m = U(bn), h = W(null), g = W(null), _ = U(null), v = U("code"), y = W(null), b = W(On), x = U(null), S = U(!1), C = W(null), ee = fe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), w = e.content ?? e.defaultContent ?? "", T = typeof w == "string" && w.length >= 2e5, E = null;
4826
+ function D() {
4827
+ E !== null && (window.clearTimeout(E), E = null), u.value += 1;
4820
4828
  }
4821
- function k() {
4822
- D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
4823
- D = null, u.value += 1;
4824
- }, we);
4829
+ function O() {
4830
+ E !== null && window.clearTimeout(E), E = window.setTimeout(() => {
4831
+ E = null, u.value += 1;
4832
+ }, Te);
4825
4833
  }
4826
- let A = e.onSlashCommandUpload, j = G(null), M = !1;
4827
- j.value = new i({
4828
- extensions: ra({
4834
+ let k = e.onSlashCommandUpload, A = W(null), j = !1;
4835
+ A.value = new i({
4836
+ extensions: oa({
4829
4837
  lang: r,
4830
4838
  linkCardResolver: e.linkCardResolver,
4831
- onImageUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4832
- onVideoUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4833
- onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? V(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4839
+ onImageUpload: (e) => k?.(e) ?? B(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4840
+ onVideoUpload: (e) => k?.(e) ?? B(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4841
+ onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? B(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4834
4842
  onAttachmentDownload: (t, n) => e.onAttachmentDownload?.(t, n),
4835
4843
  resolveMediaSource: e.resolveMediaSource,
4844
+ tableCapabilities: (t) => e.tableCapabilities?.(t),
4836
4845
  editorExtensions: e.editorExtensions
4837
4846
  }),
4838
- content: T,
4839
- contentType: ce(w),
4847
+ content: w,
4848
+ contentType: le(ee),
4840
4849
  editable: l.value,
4841
4850
  autofocus: e.autofocus,
4842
4851
  editorProps: {
4843
4852
  attributes: {
4844
4853
  class: "markweave-editor-surface",
4845
4854
  "data-testid": "markweave-editor-surface",
4846
- "data-markweave-large-document": E ? "true" : "false",
4855
+ "data-markweave-large-document": T ? "true" : "false",
4847
4856
  autocapitalize: "off",
4848
4857
  autocorrect: "off",
4849
4858
  spellcheck: "false",
4850
4859
  translate: "no"
4851
4860
  },
4852
4861
  handleClick: (e, t, n) => {
4853
- if (!l.value) return ye(n);
4854
- let r = Gt(e, n);
4855
- return r ? (n.preventDefault(), n.stopPropagation(), L(), Yt(e, r, !0), Xt(e, r), y.value = r, !0) : (y.value = null, !1);
4862
+ if (!l.value) return be(n);
4863
+ let r = Kt(e, n);
4864
+ return r ? (n.preventDefault(), n.stopPropagation(), I(), Xt(e, r, !0), Zt(e, r), y.value = r, !0) : (y.value = null, !1);
4856
4865
  },
4857
4866
  handleDOMEvents: {
4858
- compositionstart: () => l.value ? (m.value = yn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
4859
- compositionend: (e) => (l.value && window.setTimeout(() => R(e), 0), !1),
4867
+ compositionstart: () => l.value ? (m.value = xn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
4868
+ compositionend: (e) => (l.value && window.setTimeout(() => L(e), 0), !1),
4860
4869
  click: (e, t) => {
4861
- if (!l.value) return ye(t);
4862
- let n = Gt(e, t);
4863
- return n ? (t.preventDefault(), t.stopPropagation(), L(), Yt(e, n, !0), Xt(e, n), y.value = n, !0) : (y.value = null, !1);
4870
+ if (!l.value) return be(t);
4871
+ let n = Kt(e, t);
4872
+ return n ? (t.preventDefault(), t.stopPropagation(), I(), Xt(e, n, !0), Zt(e, n), y.value = n, !0) : (y.value = null, !1);
4864
4873
  }
4865
4874
  }
4866
4875
  },
4867
- onSelectionUpdate: ({ editor: e }) => B(e),
4876
+ onSelectionUpdate: ({ editor: e }) => z(e),
4868
4877
  onCreate: ({ editor: t }) => {
4869
- gn(t, o.value, (t) => {
4878
+ vn(t, o.value, (t) => {
4870
4879
  _.value = t.message, e.onCommandError?.(t);
4871
- }), hn(t, w), M = !0, e.onCommandControllerChange?.(pn(t)), f(t, {
4880
+ }), _n(t, ee), j = !0, e.onCommandControllerChange?.(hn(t)), f(t, {
4872
4881
  mode: s.value,
4873
4882
  editable: l.value
4874
- }), Qt(t, c.value), $t(t, l.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && l.value && Sn(t), H(t), B(t), O();
4883
+ }), $t(t, c.value), en(t, l.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && l.value && Tn(t), V(t), z(t), D();
4875
4884
  },
4876
4885
  onTransaction: ({ editor: e, transaction: t }) => {
4877
- if (H(e), (t.docChanged || Zt(t)) && k(), t.docChanged && y.value) {
4878
- let t = Wt(e, y.value.pos);
4886
+ if (V(e), (t.docChanged || Qt(t)) && O(), t.docChanged && y.value) {
4887
+ let t = Gt(e, y.value.pos);
4879
4888
  y.value = t?.kind === y.value.kind ? t : null;
4880
4889
  }
4881
4890
  },
4882
4891
  onUpdate: ({ editor: t }) => {
4883
- B(t), l.value && z(t), S.value || e.onUpdate?.(se(t, { onContentRead: (n, r) => {
4884
- let i = de(e.contentFormat);
4892
+ z(t), l.value && R(t), S.value || e.onUpdate?.(ce(t, { onContentRead: (n, r) => {
4893
+ let i = fe(e.contentFormat);
4885
4894
  e.content !== void 0 && n === i && (C.value = {
4886
4895
  content: r,
4887
4896
  format: n,
@@ -4890,126 +4899,126 @@ function Ta(e = {}) {
4890
4899
  } }));
4891
4900
  }
4892
4901
  });
4893
- let ee = j.value;
4894
- gn(ee, o.value, (t) => {
4902
+ let te = A.value;
4903
+ vn(te, o.value, (t) => {
4895
4904
  _.value = t.message, e.onCommandError?.(t);
4896
- }), hn(ee, w), q(o, (t) => {
4897
- j.value && gn(j.value, t, (t) => {
4905
+ }), _n(te, ee), K(o, (t) => {
4906
+ A.value && vn(A.value, t, (t) => {
4898
4907
  _.value = t.message, e.onCommandError?.(t);
4899
4908
  });
4900
- }), q(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
4901
- j.value && hn(j.value, de(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
4909
+ }), K(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
4910
+ A.value && _n(A.value, fe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
4902
4911
  });
4903
- let N = j.value, P = Oe(N), F = !1, te = !1;
4904
- Y(() => {
4905
- F || j.value !== N || (te = !0, e.onAiEditControllerChange?.(P));
4912
+ let M = A.value, N = ke(M), P = !1, ne = !1;
4913
+ J(() => {
4914
+ P || A.value !== M || (ne = !0, e.onAiEditControllerChange?.(N));
4906
4915
  });
4907
- let I = K(() => j.value ?? null);
4908
- function L() {
4909
- h.value = null, g.value = null, m.value = vn;
4916
+ let F = G(() => A.value ?? null);
4917
+ function I() {
4918
+ h.value = null, g.value = null, m.value = bn;
4910
4919
  }
4911
- function R(e) {
4912
- let t = un(e.state);
4920
+ function L(e) {
4921
+ let t = fn(e.state);
4913
4922
  if (!t) {
4914
- m.value = m.value.name === "idle" ? m.value : vn, h.value = null, g.value = null;
4923
+ m.value = m.value.name === "idle" ? m.value : bn, h.value = null, g.value = null;
4915
4924
  return;
4916
4925
  }
4917
4926
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
4918
- if (!fn(r, { frameRect: i })) {
4919
- L();
4927
+ if (!mn(r, { frameRect: i })) {
4928
+ I();
4920
4929
  return;
4921
4930
  }
4922
- let a = ln(n, {
4931
+ let a = dn(n, {
4923
4932
  frameRect: i,
4924
4933
  triggerRect: r
4925
4934
  });
4926
- sn(h.value, a) || (h.value = a), m.value = cn(m.value, t);
4935
+ ln(h.value, a) || (h.value = a), m.value = un(m.value, t);
4927
4936
  }
4928
- function z(e) {
4929
- R(e.view);
4937
+ function R(e) {
4938
+ L(e.view);
4930
4939
  }
4931
- function B(e) {
4932
- let t = Ce(e);
4933
- xe(p.value, t) || (p.value = t);
4934
- let n = Kt(e);
4935
- n && (Jt(e, n, !0), y.value = n);
4936
- let r = at(e);
4940
+ function z(e) {
4941
+ let t = we(e);
4942
+ Se(p.value, t) || (p.value = t);
4943
+ let n = qt(e);
4944
+ n && (Yt(e, n, !0), y.value = n);
4945
+ let r = ot(e);
4937
4946
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
4938
4947
  }
4939
- function H(e) {
4940
- b.value = oa(e);
4948
+ function V(e) {
4949
+ b.value = la(e);
4941
4950
  }
4942
- let ne = K(() => I.value ? at(I.value) : aa), re = K(() => I.value ? Cn(I.value.state) : ia), ae = K(() => p.value?.currentNode === "codeBlock"), fe = K(() => ae.value && ne.value.language === "mermaid"), pe = K(() => I.value ? tn({
4943
- active: fe.value,
4951
+ let re = G(() => F.value ? ot(F.value) : ca), ie = G(() => F.value ? En(F.value.state) : sa), oe = G(() => p.value?.currentNode === "codeBlock"), pe = G(() => oe.value && re.value.language === "mermaid"), me = G(() => F.value ? nn({
4952
+ active: pe.value,
4944
4953
  mode: v.value,
4945
- source: ne.value.text
4946
- }) : tn({
4954
+ source: re.value.text
4955
+ }) : nn({
4947
4956
  active: !1,
4948
4957
  mode: "code",
4949
4958
  source: ""
4950
- })), me = K(() => I.value && e.onRuntimeStateChange ? xn(I.value.state) : null), he = K(() => I.value ? Ze(I.value.state) : Je.items), ge = K(() => Qe(he.value, x.value)), _e = K(() => qe(he.value, ge.value)), ve = K(() => {
4959
+ })), he = G(() => F.value && e.onRuntimeStateChange ? wn(F.value.state) : null), ge = G(() => F.value ? Qe(F.value.state) : Ye.items), _e = G(() => $e(ge.value, x.value)), ve = G(() => Je(ge.value, _e.value)), ye = G(() => {
4951
4960
  u.value, p.value, l.value;
4952
- let e = I.value;
4953
- return nn(e ? pn(e).getCommands({
4961
+ let e = F.value;
4962
+ return rn(e ? hn(e).getCommands({
4954
4963
  surface: "slash",
4955
4964
  query: m.value.query
4956
4965
  }) : o.value.commands, r);
4957
- }), Se = K(() => be({
4966
+ }), Ce = G(() => xe({
4958
4967
  revision: u.value,
4959
4968
  mode: s.value,
4960
4969
  editable: l.value,
4961
- toc: _e.value,
4970
+ toc: ve.value,
4962
4971
  selection: p.value,
4963
4972
  slash: m.value,
4964
- table: re.value,
4973
+ table: ie.value,
4965
4974
  tableInteraction: b.value,
4966
- codeBlock: ne.value,
4967
- mermaid: pe.value,
4968
- tableDebugSnapshot: me.value
4969
- })), Te = {
4970
- closeSlashMenu: L,
4971
- focusFirstTableBodyCell: () => I.value ? Sn(I.value) : !1,
4975
+ codeBlock: re.value,
4976
+ mermaid: me.value,
4977
+ tableDebugSnapshot: he.value
4978
+ })), Ee = {
4979
+ closeSlashMenu: I,
4980
+ focusFirstTableBodyCell: () => F.value ? Tn(F.value) : !1,
4972
4981
  setContent: (e, t = {}) => {
4973
- if (!I.value) return !1;
4974
- let n = de(t.format);
4975
- return I.value.commands.setContent(e, {
4976
- contentType: ce(n),
4982
+ if (!F.value) return !1;
4983
+ let n = fe(t.format);
4984
+ return F.value.commands.setContent(e, {
4985
+ contentType: le(n),
4977
4986
  emitUpdate: t.emitUpdate ?? !1
4978
- }), t.focusFirstTableBodyCell && Sn(I.value), B(I.value), l.value && z(I.value), H(I.value), O(), !0;
4987
+ }), t.focusFirstTableBodyCell && Tn(F.value), z(F.value), l.value && R(F.value), V(F.value), D(), !0;
4979
4988
  }
4980
4989
  };
4981
- function Ee(e, t) {
4982
- if (!I.value || !l.value || !rn(e)) return;
4990
+ function De(e, t) {
4991
+ if (!F.value || !l.value || !on(e)) return;
4983
4992
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
4984
4993
  g.value = e;
4985
4994
  return;
4986
4995
  }
4987
- let n = un(I.value.state);
4996
+ let n = fn(F.value.state);
4988
4997
  if (!n) return;
4989
- _.value = null, m.value = yn(m.value, { type: "execute" }), g.value = null;
4990
- let r = I.value;
4991
- mn(r, e.id, n, t).then((e) => {
4998
+ _.value = null, m.value = xn(m.value, { type: "execute" }), g.value = null;
4999
+ let r = F.value;
5000
+ gn(r, e.id, n, t).then((e) => {
4992
5001
  if (e.ok && e.outcome === "applied") {
4993
- L();
5002
+ I();
4994
5003
  return;
4995
5004
  }
4996
- e.ok || (_.value = e.message), z(r), r.commands.focus();
5005
+ e.ok || (_.value = e.message), R(r), r.commands.focus();
4997
5006
  });
4998
5007
  }
4999
- function ke(e) {
5000
- if (!I.value || g.value || !l.value) return;
5008
+ function Ae(e) {
5009
+ if (!F.value || g.value || !l.value) return;
5001
5010
  if (m.value.name === "executing" && e.key === "Escape") {
5002
- e.preventDefault(), pn(I.value).cancel(), L();
5011
+ e.preventDefault(), hn(F.value).cancel(), I();
5003
5012
  return;
5004
5013
  }
5005
- let t = an(m.value, ve.value, e.key, { isComposing: e.isComposing || ie(I.value.state) });
5014
+ let t = sn(m.value, ye.value, e.key, { isComposing: e.isComposing || ae(F.value.state) });
5006
5015
  if (t.type !== "ignore") {
5007
5016
  if (e.preventDefault(), t.type === "close") {
5008
- pn(I.value).cancel(), m.value = yn(m.value, { type: "escape" }), L();
5017
+ hn(F.value).cancel(), m.value = xn(m.value, { type: "escape" }), I();
5009
5018
  return;
5010
5019
  }
5011
5020
  if (t.type === "move-active") {
5012
- m.value = yn(m.value, {
5021
+ m.value = xn(m.value, {
5013
5022
  type: "move-active",
5014
5023
  delta: t.delta,
5015
5024
  optionCount: t.optionCount
@@ -5017,102 +5026,102 @@ function Ta(e = {}) {
5017
5026
  return;
5018
5027
  }
5019
5028
  if (t.type === "set-active") {
5020
- m.value = yn(m.value, t);
5029
+ m.value = xn(m.value, t);
5021
5030
  return;
5022
5031
  }
5023
- Ee(t.command);
5032
+ De(t.command);
5024
5033
  }
5025
5034
  }
5026
- q(() => [e.mode, e.editable], () => {
5027
- s.value = d(e.mode), I.value && (I.value.setEditable(l.value), f(I.value, {
5035
+ K(() => [e.mode, e.editable], () => {
5036
+ s.value = d(e.mode), F.value && (F.value.setEditable(l.value), f(F.value, {
5028
5037
  mode: s.value,
5029
5038
  editable: l.value
5030
- }), $t(I.value, l.value ? "live" : "view"), O(), l.value || L());
5031
- }, { immediate: !0 }), q(() => e.theme, () => {
5032
- I.value && Qt(I.value, c.value);
5033
- }, { immediate: !0 }), q(() => e.content, (t) => {
5034
- let n = de(e.contentFormat);
5035
- if (!(!I.value || t === void 0)) {
5036
- if (ue(I.value, C.value, t, n)) {
5039
+ }), en(F.value, l.value ? "live" : "view"), D(), l.value || I());
5040
+ }, { immediate: !0 }), K(() => e.theme, () => {
5041
+ F.value && $t(F.value, c.value);
5042
+ }, { immediate: !0 }), K(() => e.content, (t) => {
5043
+ let n = fe(e.contentFormat);
5044
+ if (!(!F.value || t === void 0)) {
5045
+ if (de(F.value, C.value, t, n)) {
5037
5046
  C.value = null;
5038
5047
  return;
5039
5048
  }
5040
- C.value = null, !le(I.value, t, n) && (S.value = !0, I.value.commands.setContent(t, {
5041
- contentType: ce(n),
5049
+ C.value = null, !ue(F.value, t, n) && (S.value = !0, F.value.commands.setContent(t, {
5050
+ contentType: le(n),
5042
5051
  emitUpdate: !1
5043
- }), S.value = !1, B(I.value), l.value && z(I.value), H(I.value), O());
5052
+ }), S.value = !1, z(F.value), l.value && R(F.value), V(F.value), D());
5044
5053
  }
5045
- }), q(Se, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), q(_e, (t) => e.onTocChange?.(t), { immediate: !0 }), q(he, (e) => {
5046
- let t = Qe(e, x.value);
5054
+ }), K(Ce, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(ve, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ge, (e) => {
5055
+ let t = $e(e, x.value);
5047
5056
  x.value !== t && (x.value = t);
5048
5057
  });
5049
- let Ae = oe(() => {
5050
- I.value && h.value && R(I.value.view);
5051
- }), je = (e) => {
5052
- e?.type === "scroll" && dn(e.target) || h.value && Ae.schedule();
5058
+ let je = se(() => {
5059
+ F.value && h.value && L(F.value.view);
5060
+ }), Me = (e) => {
5061
+ e?.type === "scroll" && pn(e.target) || h.value && je.schedule();
5053
5062
  };
5054
- q(h, (e) => {
5055
- e ? je() : Ae.cancel();
5056
- }), hr(() => {
5057
- window.addEventListener("resize", je), window.addEventListener("scroll", je, !0);
5058
- }), J(() => {
5059
- Ae.cancel(), window.removeEventListener("resize", je), window.removeEventListener("scroll", je, !0);
5063
+ K(h, (e) => {
5064
+ e ? Me() : je.cancel();
5065
+ }), vr(() => {
5066
+ window.addEventListener("resize", Me), window.addEventListener("scroll", Me, !0);
5067
+ }), q(() => {
5068
+ je.cancel(), window.removeEventListener("resize", Me), window.removeEventListener("scroll", Me, !0);
5060
5069
  });
5061
- let Me = null;
5062
- return J(() => {
5063
- D !== null && window.clearTimeout(D);
5064
- }), hr(() => {
5070
+ let Ne = null;
5071
+ return q(() => {
5072
+ E !== null && window.clearTimeout(E);
5073
+ }), vr(() => {
5065
5074
  let e = () => {
5066
- if (!I.value || !he.value.length) {
5075
+ if (!F.value || !ge.value.length) {
5067
5076
  x.value = null;
5068
5077
  return;
5069
5078
  }
5070
5079
  let e = null;
5071
5080
  try {
5072
- e = Ye(I.value, he.value);
5081
+ e = Xe(F.value, ge.value);
5073
5082
  } catch {
5074
5083
  return;
5075
5084
  }
5076
5085
  x.value !== e && (x.value = e);
5077
- }, t = () => window.requestAnimationFrame(e), n = sa(I.value?.view.dom ?? null);
5078
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Me = () => {
5086
+ }, t = () => window.requestAnimationFrame(e), n = ua(F.value?.view.dom ?? null);
5087
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Ne = () => {
5079
5088
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
5080
5089
  };
5081
- }), J(() => {
5082
- Me?.(), F = !0, te && e.onAiEditControllerChange?.(null), M && e.onCommandControllerChange?.(null);
5083
- let t = j.value;
5084
- j.value = null, Y(() => t?.destroy());
5090
+ }), q(() => {
5091
+ Ne?.(), P = !0, ne && e.onAiEditControllerChange?.(null), j && e.onCommandControllerChange?.(null);
5092
+ let t = A.value;
5093
+ A.value = null, J(() => t?.destroy());
5085
5094
  }), {
5086
- editor: I,
5087
- runtimeSnapshot: Se,
5088
- actions: Te,
5095
+ editor: F,
5096
+ runtimeSnapshot: Ce,
5097
+ actions: Ee,
5089
5098
  __render: {
5090
5099
  messages: a,
5091
5100
  effectiveEditable: l,
5092
- tableFocusState: re,
5101
+ tableFocusState: ie,
5093
5102
  tableInteractionState: b,
5094
- codeBlockState: ne,
5095
- isCodeBlockActive: ae,
5103
+ codeBlockState: re,
5104
+ isCodeBlockActive: oe,
5096
5105
  mermaidMode: v,
5097
5106
  mathTarget: y,
5098
5107
  setMermaidMode: (e) => {
5099
5108
  v.value = e;
5100
5109
  },
5101
- tocState: _e,
5102
- filteredSlashCommands: ve,
5110
+ tocState: ve,
5111
+ filteredSlashCommands: ye,
5103
5112
  slashState: m,
5104
5113
  slashMenuPosition: h,
5105
5114
  slashInputCommand: g,
5106
5115
  slashCommandError: _,
5107
- runSlashCommand: Ee,
5108
- handleEditorKeyDown: ke,
5116
+ runSlashCommand: De,
5117
+ handleEditorKeyDown: Ae,
5109
5118
  setSlashInputCommand: (e) => {
5110
5119
  g.value = e;
5111
5120
  }
5112
5121
  }
5113
5122
  };
5114
5123
  }
5115
- var Ea = X({
5124
+ var Oa = Y({
5116
5125
  name: "MarkweaveEditor",
5117
5126
  props: {
5118
5127
  defaultContent: {
@@ -5219,6 +5228,10 @@ var Ea = X({
5219
5228
  type: Function,
5220
5229
  default: void 0
5221
5230
  },
5231
+ tableCapabilities: {
5232
+ type: Function,
5233
+ default: void 0
5234
+ },
5222
5235
  onRuntimeStateChange: {
5223
5236
  type: Function,
5224
5237
  default: void 0
@@ -5257,12 +5270,12 @@ var Ea = X({
5257
5270
  }
5258
5271
  },
5259
5272
  setup(e) {
5260
- let t = Ta(e);
5273
+ let t = Da(e);
5261
5274
  return () => {
5262
5275
  let r = t.editor.value;
5263
5276
  if (!r) return null;
5264
- let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = Ee(e.canvasColor);
5265
- return U("section", {
5277
+ let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = De(e.canvasColor);
5278
+ return H("section", {
5266
5279
  class: o,
5267
5280
  role: "combobox",
5268
5281
  "aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
@@ -5272,21 +5285,21 @@ var Ea = X({
5272
5285
  "aria-busy": i.slashState.value.name === "executing",
5273
5286
  "data-testid": "markweave-editor-frame",
5274
5287
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
5275
- "data-markweave-theme": De(e.theme),
5288
+ "data-markweave-theme": Oe(e.theme),
5276
5289
  style: s ? { "--markweave-canvas": s } : void 0,
5277
5290
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
5278
- "data-markweave-inner-toc-placement": $e(e.innerTocPlacement),
5291
+ "data-markweave-inner-toc-placement": et(e.innerTocPlacement),
5279
5292
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
5280
5293
  "data-table-focus-mode": i.tableFocusState.value.mode,
5281
5294
  onKeydownCapture: i.handleEditorKeyDown
5282
5295
  }, [
5283
- i.effectiveEditable.value ? U(ga, {
5296
+ i.effectiveEditable.value ? H(va, {
5284
5297
  editor: r,
5285
5298
  lang: n(e.lang),
5286
5299
  messages: i.messages,
5287
5300
  askAi: e.askAi
5288
5301
  }) : null,
5289
- i.effectiveEditable.value ? U(va, {
5302
+ i.effectiveEditable.value ? H(ba, {
5290
5303
  commands: i.filteredSlashCommands.value,
5291
5304
  state: i.slashState.value,
5292
5305
  position: i.slashMenuPosition.value,
@@ -5297,7 +5310,7 @@ var Ea = X({
5297
5310
  onInputCommandChange: i.setSlashInputCommand,
5298
5311
  onUpload: e.onSlashCommandUpload
5299
5312
  }) : null,
5300
- i.effectiveEditable.value ? U(xa, {
5313
+ i.effectiveEditable.value ? H(Ca, {
5301
5314
  editor: r,
5302
5315
  active: i.tableFocusState.value.active,
5303
5316
  interactionState: i.tableInteractionState.value,
@@ -5307,11 +5320,11 @@ var Ea = X({
5307
5320
  onCommandResult: e.onTableCommandResult,
5308
5321
  onEditWithAi: e.onEditWithAi
5309
5322
  }) : null,
5310
- i.effectiveEditable.value ? U(Sa, {
5323
+ i.effectiveEditable.value ? H(wa, {
5311
5324
  editor: r,
5312
5325
  focusState: i.tableFocusState.value
5313
5326
  }) : null,
5314
- U(Ca, {
5327
+ H(Ta, {
5315
5328
  editor: r,
5316
5329
  state: i.codeBlockState.value,
5317
5330
  active: i.effectiveEditable.value && i.isCodeBlockActive.value,
@@ -5319,23 +5332,23 @@ var Ea = X({
5319
5332
  onMermaidModeChange: i.setMermaidMode,
5320
5333
  readOnly: !i.effectiveEditable.value
5321
5334
  }),
5322
- e.innerToc && i.tocState.value.items.length ? U(wa, {
5335
+ e.innerToc && i.tocState.value.items.length ? H(Ea, {
5323
5336
  editor: r,
5324
5337
  state: i.tocState.value,
5325
5338
  messages: i.messages,
5326
5339
  editable: i.effectiveEditable.value,
5327
- placement: $e(e.innerTocPlacement)
5340
+ placement: et(e.innerTocPlacement)
5328
5341
  }) : null,
5329
- i.effectiveEditable.value && i.mathTarget.value ? U(_a, {
5342
+ i.effectiveEditable.value && i.mathTarget.value ? H(ya, {
5330
5343
  editor: r,
5331
5344
  messages: i.messages,
5332
5345
  target: i.mathTarget.value,
5333
5346
  onClose: () => i.mathTarget.value = null
5334
5347
  }) : null,
5335
- U(a, { editor: r })
5348
+ H(a, { editor: r })
5336
5349
  ]);
5337
5350
  };
5338
5351
  }
5339
5352
  });
5340
5353
  //#endregion
5341
- export { Ea as MarkweaveEditor, ne as createMarkweaveAiEditController, ra as createMarkweaveEditorExtensions, ra as createMarkweaveVue2EditorExtensions, Ta as useMarkweaveEditorController };
5354
+ export { Oa as MarkweaveEditor, re as createMarkweaveAiEditController, oa as createMarkweaveEditorExtensions, oa as createMarkweaveVue2EditorExtensions, Da as useMarkweaveEditorController };