@markweave/vue2 0.3.1 → 0.3.2

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
@@ -8,54 +8,51 @@ import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/lin
8
8
  import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
9
9
  import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
10
10
  import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
11
- import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
12
- import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
13
- import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as N, normalizeMarkweaveVideoEmbedUrl as P, numberAttribute as F, stringAttribute as I } from "markweave/internal/plugins/media/core-media-nodes";
14
- import { detectUploadSource as L, getDirectUploadResult as ee, resolveMarkweaveUploadResult as R } from "markweave/internal/plugins/slash-command/upload";
15
- import { BubbleMenu as z } from "@tiptap/vue-2/menus";
16
- import { isEditorComposing as te } from "markweave/internal/editor-core/composition-guard";
17
- import { saveMarkweaveBrowserFile as ne } from "markweave/internal/core/browser-file-save";
18
- import { createMarkweaveFrameScheduler as B } from "markweave/internal/editor-core/frame-scheduler";
19
- import { createMarkweaveEditorUpdatePayload as V, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
20
- import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as ue, getFloatingToolbarTurnIntoOptions as de, runFloatingToolbarMoreAction as fe, setFloatingToolbarTurnInto as pe } from "markweave/internal/editor-core/floating-toolbar-model";
21
- import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
22
- import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
23
- import { areEditorSelectionSnapshotsEquivalent as ge, calculateFloatingToolbarPopoverPlacement as _e, createSelectionSnapshot as ve, markweaveRuntimeProjectionDelayMs as ye, shouldShowFloatingToolbar as be } from "markweave/internal/editor-core/selection-state";
24
- import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
25
- import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te, getMarkweaveTocItemsFromState as Ee, getValidMarkweaveTocActiveId as De, normalizeMarkweaveInnerTocPlacement as Oe, observeMarkweaveInnerTocContainerPosition as ke, scrollToMarkweaveTocItem as Ae } from "markweave/internal/core/toc-state";
26
- import { codeBlockCollapsePluginKey as je, copyActiveCodeBlock as Me, getActiveCodeBlockState as Ne, getCodeBlockCopyFeedbackSnapshot as Pe, markweaveCodeBlockBehavior as Fe, setCodeBlockCollapsedAtPosition as Ie, setCodeBlockLanguageAtPosition as Le, setCodeBlockMermaidPreviewModeAtPosition as Re } from "markweave/internal/plugins/codeblock/codeblock-behavior";
27
- import { calculateCodeBlockLanguageMenuPosition as ze, clampFullscreenScale as Be, codeBlockCopyFeedbackTimeoutMs as Ve, copyCodeBlockText as He, createCodeBlockLanguageMenuDomId as Ue, createCodeBlockOverlayPosition as We, createMermaidFullscreenViewerState as Ge, createMermaidTabPosition as Ke, focusCodeBlockTarget as qe, formatCodeBlockLanguageLabel as Je, formatFullscreenZoom as Ye, getActiveCodeBlockElement as Xe, getAnchoredRect as Ze, getCodeBlockLanguageItems as Qe, getCodeBlockLanguageOptionDomId as $e, getCodeBlockPositionFromEventTarget as et, getCodeBlockStateAtPosition as tt, getFrameElement as nt, getInitialCodeBlockLanguageItemIndex as rt, getMermaidCodeBlockTargets as it, getMermaidSvgMarkup as at, isCodeBlockTargetCollapsed as ot, mergeStableMermaidTabPositions as st, mermaidFullscreenZoomStep as ct, moveCodeBlockLanguageItemIndex as lt, moveMermaidFullscreenViewer as ut, scrollCodeBlockLanguageItemIntoView as dt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
28
- import { normalizeMarkdownLinkHref as ft } from "markweave/internal/plugins/markdown/markdown-input";
29
- import { applyMarkweaveMathLatex as pt, calculateMarkweaveMathPopoverPosition as mt, getMarkweaveMathAnchorRect as ht, getMarkweaveMathBlockIndex as gt, getMarkweaveMathRenderedHtml as _t, getMarkweaveMathTargetAtPos as vt, getMarkweaveMathTargetFromDomEvent as yt, getMarkweaveMathTargetFromSelection as bt, renderMarkweaveMathPreview as xt, setMarkweaveMathEditingDomState as St, setMarkweaveMathEditingDomStateInView as Ct, setMarkweaveMathSelectionInView as wt } from "markweave/internal/plugins/math/math-ui-model";
30
- import { isMermaidInlinePreviewTransaction as Tt, setMarkweaveMermaidTheme as Et, setMermaidInlinePreviewEditorMode as Dt, setReadonlyMermaidPreviewMode as Ot } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
31
- import { getMermaidPreviewState as kt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
32
- import { filterSlashCommands as At, isExecutableSlashCommand as jt } from "markweave/internal/plugins/slash-command/command-spec";
33
- import { getSlashCommandKeyboardAction as Mt } from "markweave/internal/plugins/slash-command/slash-keyboard";
34
- import { executeSlashCommand as Nt, getNextSlashCommandState as Pt, getSlashCommandAnchoredMenuPosition as Ft, getSlashCommandContext as It } from "markweave/internal/plugins/slash-command/slash-runtime";
35
- import { initialSlashCommandState as Lt, reduceSlashCommandState as Rt } from "markweave/internal/plugins/slash-command/slash-state";
36
- import { setMarkweaveTableMenuAxisTarget as zt } from "markweave/internal/plugins/table/table-clipboard";
37
- import { getFirstTableDebugSnapshot as Bt } from "markweave/internal/plugins/table/table-debug-snapshot";
38
- import { focusFirstTableBodyCell as Vt } from "markweave/internal/plugins/table/table-focus-position";
39
- import { getTableFocusState as Ht } from "markweave/internal/plugins/table/table-focus-state";
40
- import { getTableSelectionOverlayState as Ut, initialTableInteractionState as Wt, tableInteractionPluginKey as Gt } from "markweave/internal/plugins/table/table-interaction-layer";
41
- import { calculateAnchoredTableMenuPosition as Kt, calculateTableEdgeHandlePosition as qt, canRunTableCommand as Jt, executeTableMenuCommand as Yt, formatTableCopyFeedback as Xt, getActiveTableElement as Zt, getAvailableCellMenuCommandSpecs as Qt, getTableAxisTargetRect as $t, getTableControlAxisSelectionModel as en, getTableEditWithAiRequest as tn, getTableMenuItemGroup as nn, getTableMenuItemLabel as rn, getTableMenuItems as an, getTableSelectionTargetRect as on, measureTableSelectionOverlay as sn, selectTableAxisFromCell as cn, tableCopyFeedbackTimeoutMs as ln, tableMenuLabel as un } from "markweave/internal/plugins/table/table-ui-model";
11
+ import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
12
+ import { detectUploadSource as P, getDirectUploadResult as F, resolveMarkweaveUploadResult as I } from "markweave/internal/plugins/slash-command/upload";
13
+ import { BubbleMenu as te } from "@tiptap/vue-2/menus";
14
+ import { isEditorComposing as L } from "markweave/internal/editor-core/composition-guard";
15
+ import { createMarkweaveFrameScheduler as R } from "markweave/internal/editor-core/frame-scheduler";
16
+ import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
17
+ import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as z, getFloatingToolbarTurnIntoOptions as ue, runFloatingToolbarMoreAction as de, setFloatingToolbarTurnInto as fe } from "markweave/internal/editor-core/floating-toolbar-model";
18
+ import { openMarkweaveReadonlyLinkFromEvent as pe } from "markweave/internal/editor-core/readonly-link";
19
+ import { createMarkweaveEditorRuntimeSnapshot as me } from "markweave/internal/editor-core/runtime-snapshot";
20
+ import { areEditorSelectionSnapshotsEquivalent as he, calculateFloatingToolbarPopoverPlacement as ge, createSelectionSnapshot as _e, markweaveRuntimeProjectionDelayMs as ve, shouldShowFloatingToolbar as ye } from "markweave/internal/editor-core/selection-state";
21
+ import { normalizeMarkweaveCanvasColor as be, normalizeMarkweaveTheme as xe } from "markweave/internal/core/theme";
22
+ import { createMarkweaveTocState as Se, emptyMarkweaveTocState as Ce, getActiveMarkweaveTocId as we, getMarkweaveTocItems as Te, getValidMarkweaveTocActiveId as Ee, normalizeMarkweaveInnerTocPlacement as De, observeMarkweaveInnerTocContainerPosition as Oe, scrollToMarkweaveTocItem as ke } from "markweave/internal/core/toc-state";
23
+ import { codeBlockCollapsePluginKey as Ae, copyActiveCodeBlock as je, getActiveCodeBlockState as Me, getCodeBlockCopyFeedbackSnapshot as Ne, markweaveCodeBlockBehavior as Pe, setCodeBlockCollapsedAtPosition as Fe, setCodeBlockLanguageAtPosition as Ie, setCodeBlockMermaidPreviewModeAtPosition as Le } from "markweave/internal/plugins/codeblock/codeblock-behavior";
24
+ import { calculateCodeBlockLanguageMenuPosition as Re, clampFullscreenScale as ze, codeBlockCopyFeedbackTimeoutMs as Be, copyCodeBlockText as Ve, createCodeBlockOverlayPosition as He, createMermaidFullscreenViewerState as Ue, createMermaidTabPosition as We, focusCodeBlockTarget as Ge, formatCodeBlockLanguageLabel as Ke, formatFullscreenZoom as qe, getActiveCodeBlockElement as Je, getAnchoredRect as Ye, getCodeBlockLanguageItems as Xe, getCodeBlockPositionFromEventTarget as Ze, getCodeBlockStateAtPosition as Qe, getFrameElement as $e, getMermaidCodeBlockTargets as et, getMermaidSvgMarkup as tt, isCodeBlockTargetCollapsed as nt, mergeStableMermaidTabPositions as rt, mermaidFullscreenZoomStep as it, moveMermaidFullscreenViewer as at } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
25
+ import { normalizeMarkdownLinkHref as ot } from "markweave/internal/plugins/markdown/markdown-input";
26
+ import { applyMarkweaveMathLatex as st, calculateMarkweaveMathPopoverPosition as ct, getMarkweaveMathAnchorRect as lt, getMarkweaveMathBlockIndex as ut, getMarkweaveMathRenderedHtml as dt, getMarkweaveMathTargetAtPos as ft, getMarkweaveMathTargetFromDomEvent as pt, getMarkweaveMathTargetFromSelection as mt, renderMarkweaveMathPreview as ht, setMarkweaveMathEditingDomState as gt, setMarkweaveMathEditingDomStateInView as _t, setMarkweaveMathSelectionInView as vt } from "markweave/internal/plugins/math/math-ui-model";
27
+ import { isMermaidInlinePreviewTransaction as yt, setMarkweaveMermaidTheme as bt, setMermaidInlinePreviewEditorMode as xt, setReadonlyMermaidPreviewMode as St } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
28
+ import { getMermaidPreviewState as Ct } from "markweave/internal/plugins/mermaid/mermaid-renderer";
29
+ import { filterSlashCommands as wt, isExecutableSlashCommand as Tt } from "markweave/internal/plugins/slash-command/command-spec";
30
+ import { getSlashCommandKeyboardAction as Et } from "markweave/internal/plugins/slash-command/slash-keyboard";
31
+ import { executeSlashCommand as Dt, getNextSlashCommandState as Ot, getSlashCommandAnchoredMenuPosition as kt, getSlashCommandContext as At } from "markweave/internal/plugins/slash-command/slash-runtime";
32
+ import { initialSlashCommandState as jt, reduceSlashCommandState as Mt } from "markweave/internal/plugins/slash-command/slash-state";
33
+ import { setMarkweaveTableMenuAxisTarget as Nt } from "markweave/internal/plugins/table/table-clipboard";
34
+ import { getFirstTableDebugSnapshot as Pt } from "markweave/internal/plugins/table/table-debug-snapshot";
35
+ import { focusFirstTableBodyCell as Ft } from "markweave/internal/plugins/table/table-focus-position";
36
+ import { getTableFocusState as It } from "markweave/internal/plugins/table/table-focus-state";
37
+ import { getTableSelectionOverlayState as Lt, initialTableInteractionState as Rt, tableInteractionPluginKey as zt } from "markweave/internal/plugins/table/table-interaction-layer";
38
+ import { calculateAnchoredTableMenuPosition as Bt, calculateTableEdgeHandlePosition as Vt, canRunTableCommand as Ht, executeTableMenuCommand as Ut, formatTableCopyFeedback as Wt, getActiveTableElement as Gt, getAvailableCellMenuCommandSpecs as Kt, getTableAxisTargetRect as qt, getTableControlAxisSelectionModel as Jt, getTableEditWithAiRequest as Yt, getTableMenuItemGroup as Xt, getTableMenuItemLabel as Zt, getTableMenuItems as Qt, getTableSelectionTargetRect as $t, measureTableSelectionOverlay as en, selectTableAxisFromCell as tn, tableCopyFeedbackTimeoutMs as nn, tableMenuLabel as rn } from "markweave/internal/plugins/table/table-ui-model";
42
39
  //#region src/vue2-compat.ts
43
- var dn = l.default ?? l, fn = null, pn = null, mn = null;
44
- function hn(e) {
40
+ var an = l.default ?? l, on = null, sn = null, cn = null;
41
+ function ln(e) {
45
42
  return !!(e && typeof e == "object" && "value" in e);
46
43
  }
47
- function gn(e) {
44
+ function un(e) {
48
45
  let t = e.slice(2);
49
46
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
50
47
  }
51
- function _n(e) {
48
+ function dn(e) {
52
49
  let t = {}, n = {}, r = {}, i = {}, a = {};
53
50
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
54
51
  if (o === "class" || o === "style" || o === "key") {
55
52
  t[o] = s;
56
53
  continue;
57
54
  }
58
- if (o === "ref" && hn(s)) {
55
+ if (o === "ref" && ln(s)) {
59
56
  a.insert = (e) => {
60
57
  s.value = e.elm;
61
58
  }, a.destroy = () => {
@@ -64,7 +61,7 @@ function _n(e) {
64
61
  continue;
65
62
  }
66
63
  if (/^on[A-Z]/.test(o)) {
67
- i[gn(o)] = s;
64
+ i[un(o)] = s;
68
65
  continue;
69
66
  }
70
67
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -75,14 +72,14 @@ function _n(e) {
75
72
  }
76
73
  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;
77
74
  }
78
- function vn(e) {
75
+ function fn(e) {
79
76
  let t = {}, n = {}, r = {}, i = {};
80
77
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
81
78
  if (a === "class" || a === "style" || a === "key") {
82
79
  t[a] = o;
83
80
  continue;
84
81
  }
85
- if (a === "ref" && hn(o)) {
82
+ if (a === "ref" && ln(o)) {
86
83
  i.insert = (e) => {
87
84
  o.value = e.componentInstance ?? e.elm;
88
85
  }, i.destroy = () => {
@@ -98,47 +95,47 @@ function vn(e) {
98
95
  }
99
96
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
100
97
  }
101
- function yn(e) {
98
+ function pn(e) {
102
99
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
103
100
  }
104
- function bn(e) {
101
+ function mn(e) {
105
102
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
106
103
  }
107
- function xn(e) {
104
+ function hn(e) {
108
105
  return e == null || Array.isArray(e) ? e : [e];
109
106
  }
110
- function Sn(e) {
111
- return typeof e == "function" ? xn(e()) : yn(e) ? xn(e.default()) : bn(e) ? [e] : e;
107
+ function gn(e) {
108
+ return typeof e == "function" ? hn(e()) : pn(e) ? hn(e.default()) : mn(e) ? [e] : e;
112
109
  }
113
- function H(e, t, n) {
114
- if (!mn) throw Error("Vue 2 render context is not available.");
115
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? _n(r) : vn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Sn(n);
116
- return mn(e, i, a);
110
+ function B(e, t, n) {
111
+ if (!cn) throw Error("Vue 2 render context is not available.");
112
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? dn(r) : fn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : gn(n);
113
+ return cn(e, i, a);
117
114
  }
118
- function U(e) {
119
- return dn.observable({ value: e });
115
+ function V(e) {
116
+ return an.observable({ value: e });
120
117
  }
121
- var W = U;
122
- function G(e) {
118
+ var H = V;
119
+ function U(e) {
123
120
  return { get value() {
124
121
  return e();
125
122
  } };
126
123
  }
127
- function K(e, t, n) {
124
+ function W(e, t, n) {
128
125
  let r = typeof e == "function" ? e : () => e.value;
129
- return fn?.$watch ? fn.$watch(r, t, n) : () => void 0;
126
+ return on?.$watch ? on.$watch(r, t, n) : () => void 0;
130
127
  }
131
- function Cn(e) {
132
- pn?.mounted.push(e);
128
+ function G(e) {
129
+ sn?.mounted.push(e);
130
+ }
131
+ function K(e) {
132
+ sn?.beforeUnmount.push(e);
133
133
  }
134
134
  function q(e) {
135
- pn?.beforeUnmount.push(e);
135
+ return an.nextTick(e);
136
136
  }
137
137
  function J(e) {
138
- return dn.nextTick(e);
139
- }
140
- function Y(e) {
141
- return dn.extend({
138
+ return an.extend({
142
139
  name: e.name,
143
140
  props: e.props,
144
141
  created() {
@@ -146,12 +143,12 @@ function Y(e) {
146
143
  mounted: [],
147
144
  beforeUnmount: []
148
145
  };
149
- fn = this, pn = t;
146
+ on = this, sn = t;
150
147
  try {
151
148
  let n = e.setup?.(this.$props ?? this) ?? null;
152
149
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
153
150
  } finally {
154
- fn = null, pn = null;
151
+ on = null, sn = null;
155
152
  }
156
153
  },
157
154
  mounted() {
@@ -161,19 +158,19 @@ function Y(e) {
161
158
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
162
159
  },
163
160
  render(t) {
164
- mn = t;
161
+ cn = t;
165
162
  try {
166
163
  let n = this.__markweaveVue2Render;
167
164
  return n ? n() : e.render?.(t) ?? null;
168
165
  } finally {
169
- mn = null;
166
+ cn = null;
170
167
  }
171
168
  }
172
169
  });
173
170
  }
174
171
  //#endregion
175
172
  //#region src/vue2-icons.ts
176
- var wn = {
173
+ var _n = {
177
174
  AlignCenter: {
178
175
  iconName: "text-align-center",
179
176
  node: [
@@ -1038,11 +1035,11 @@ var wn = {
1038
1035
  }]]
1039
1036
  }
1040
1037
  };
1041
- function Tn(e) {
1042
- return e.map(([e, t]) => H(e, t));
1038
+ function vn(e) {
1039
+ return e.map(([e, t]) => B(e, t));
1043
1040
  }
1044
- function X(e) {
1045
- return Y({
1041
+ function Y(e) {
1042
+ return J({
1046
1043
  name: `MarkweaveVue2Icon${e}`,
1047
1044
  props: {
1048
1045
  size: {
@@ -1059,8 +1056,8 @@ function X(e) {
1059
1056
  }
1060
1057
  },
1061
1058
  setup(t) {
1062
- let n = wn[e];
1063
- return () => H("svg", {
1059
+ let n = _n[e];
1060
+ return () => B("svg", {
1064
1061
  class: `lucide lucide-${n.iconName}`,
1065
1062
  viewBox: "0 0 24 24",
1066
1063
  width: t.size,
@@ -1072,12 +1069,12 @@ function X(e) {
1072
1069
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1073
1070
  "aria-hidden": "true",
1074
1071
  focusable: "false"
1075
- }, Tn(n.node));
1072
+ }, vn(n.node));
1076
1073
  }
1077
1074
  });
1078
1075
  }
1079
- var En = X("AlignCenter"), Dn = X("AlignJustify"), On = X("AlignLeft"), kn = X("AlignRight"), An = X("AlertTriangle"), jn = X("Bold"), Mn = X("Braces"), Nn = X("Captions"), Pn = X("CheckCircle2"), Fn = X("ChevronDown"), In = X("ChevronUp"), Ln = X("CircleX"), Rn = X("Code2"), zn = X("CornerDownLeft"), Bn = X("Download"), Vn = X("Eye"), Hn = X("ExternalLink"), Un = X("Heading1"), Wn = X("Heading2"), Gn = X("Heading3"), Kn = X("Image"), qn = X("ImageUp"), Jn = X("IndentDecrease"), Yn = X("IndentIncrease"), Xn = X("Info"), Zn = X("Italic"), Qn = X("Lightbulb"), $n = X("Link2"), er = X("List"), tr = X("ListChecks"), nr = X("ListOrdered"), rr = X("Minus"), ir = X("MoreVertical"), ar = X("Paperclip"), or = X("PencilLine"), sr = X("Quote"), cr = X("Replace"), lr = X("Sigma"), ur = X("SmilePlus"), dr = X("Strikethrough"), fr = X("Subscript"), pr = X("Superscript"), mr = X("Table2"), hr = X("Text"), gr = X("Trash2"), _r = X("Type"), vr = X("Underline"), yr = X("Upload"), br = X("Video"), xr = N;
1080
- function Sr(e) {
1076
+ var yn = Y("AlignCenter"), bn = Y("AlignJustify"), xn = Y("AlignLeft"), Sn = Y("AlignRight"), Cn = Y("AlertTriangle"), wn = Y("Bold"), Tn = Y("Braces"), En = Y("Captions"), Dn = Y("CheckCircle2"), On = Y("ChevronDown"), kn = Y("ChevronUp"), An = Y("CircleX"), jn = Y("Code2"), Mn = Y("CornerDownLeft"), Nn = Y("Download"), Pn = Y("Eye"), Fn = Y("ExternalLink"), In = Y("Heading1"), Ln = Y("Heading2"), Rn = Y("Heading3"), zn = Y("Image"), Bn = Y("ImageUp"), Vn = Y("IndentDecrease"), Hn = Y("IndentIncrease"), Un = Y("Info"), Wn = Y("Italic"), Gn = Y("Lightbulb"), Kn = Y("Link2"), qn = Y("List"), Jn = Y("ListChecks"), Yn = Y("ListOrdered"), Xn = Y("Minus"), Zn = Y("MoreVertical"), Qn = Y("Paperclip"), $n = Y("PencilLine"), er = Y("Quote"), tr = Y("Replace"), nr = Y("Sigma"), rr = Y("SmilePlus"), ir = Y("Strikethrough"), ar = Y("Subscript"), or = Y("Superscript"), sr = Y("Table2"), cr = Y("Text"), lr = Y("Trash2"), ur = Y("Type"), dr = Y("Underline"), fr = Y("Upload"), pr = Y("Video"), mr = A;
1077
+ function hr(e) {
1081
1078
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1082
1079
  let n = t?.getAttribute("data-markweave-mode");
1083
1080
  return n === "view" ? {
@@ -1087,7 +1084,7 @@ function Sr(e) {
1087
1084
  mode: "live",
1088
1085
  editable: e.isEditable
1089
1086
  } : u(e);
1090
- }, r = U(n()), i = m(e, () => {
1087
+ }, r = V(n()), i = m(e, () => {
1091
1088
  r.value = n();
1092
1089
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1093
1090
  r.value = n();
@@ -1095,28 +1092,28 @@ function Sr(e) {
1095
1092
  return a && t && a.observe(t, {
1096
1093
  attributes: !0,
1097
1094
  attributeFilter: ["data-markweave-mode"]
1098
- }), q(() => {
1095
+ }), K(() => {
1099
1096
  i(), a?.disconnect();
1100
1097
  }), r;
1101
1098
  }
1102
- function Cr(e) {
1099
+ function gr(e) {
1103
1100
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1104
1101
  }
1105
- function wr(e) {
1102
+ function _r(e) {
1106
1103
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1107
1104
  }
1108
- function Tr(e) {
1105
+ function vr(e) {
1109
1106
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1110
1107
  }
1111
- function Er(e, t) {
1112
- return H(e, {
1108
+ function yr(e, t) {
1109
+ return B(e, {
1113
1110
  size: 18,
1114
1111
  strokeWidth: 1.8,
1115
1112
  "aria-hidden": "true"
1116
1113
  }, { default: () => t });
1117
1114
  }
1118
- function Dr(e) {
1119
- return H("button", {
1115
+ function X(e) {
1116
+ return B("button", {
1120
1117
  type: "button",
1121
1118
  "aria-label": e.label,
1122
1119
  title: e.label,
@@ -1124,14 +1121,14 @@ function Dr(e) {
1124
1121
  "data-active": e.active ? "true" : "false",
1125
1122
  onMousedown: (e) => e.preventDefault(),
1126
1123
  onClick: e.onClick
1127
- }, [Er(e.icon, e.label), H("span", {
1124
+ }, [yr(e.icon, e.label), B("span", {
1128
1125
  class: "markweave-image-tooltip",
1129
1126
  role: "tooltip"
1130
1127
  }, e.label)]);
1131
1128
  }
1132
- function Or(e) {
1133
- let t = U(null), n = e.messages.image;
1134
- return H("section", {
1129
+ function br(e) {
1130
+ let t = V(null), n = e.messages.image;
1131
+ return B("section", {
1135
1132
  class: "markweave-image-upload-placeholder",
1136
1133
  "data-testid": "markweave-image-upload-placeholder",
1137
1134
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1149,7 +1146,7 @@ function Or(e) {
1149
1146
  n && e.onFile(n);
1150
1147
  }
1151
1148
  }, [
1152
- H("input", {
1149
+ B("input", {
1153
1150
  ref: t,
1154
1151
  "data-testid": "markweave-image-file-input",
1155
1152
  type: "file",
@@ -1160,20 +1157,20 @@ function Or(e) {
1160
1157
  r && e.onFile(r), n.value = "";
1161
1158
  }
1162
1159
  }),
1163
- H("div", {
1160
+ B("div", {
1164
1161
  class: "markweave-image-upload-icon",
1165
1162
  "aria-hidden": "true"
1166
- }, [H(qn, {
1163
+ }, [B(Bn, {
1167
1164
  size: 46,
1168
1165
  strokeWidth: 1.6
1169
1166
  })]),
1170
- H("div", { class: "markweave-image-upload-copy" }, [H("button", {
1167
+ B("div", { class: "markweave-image-upload-copy" }, [B("button", {
1171
1168
  type: "button",
1172
1169
  onClick: () => t.value?.click()
1173
- }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1174
- H("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1175
- H("div", { class: "markweave-image-upload-row" }, [
1176
- H("input", {
1170
+ }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1171
+ B("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1172
+ B("div", { class: "markweave-image-upload-row" }, [
1173
+ B("input", {
1177
1174
  "data-testid": "markweave-image-url-input",
1178
1175
  value: e.inputValue,
1179
1176
  placeholder: n.uploadInputPlaceholder,
@@ -1183,30 +1180,30 @@ function Or(e) {
1183
1180
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1184
1181
  }
1185
1182
  }),
1186
- H("button", {
1183
+ B("button", {
1187
1184
  type: "button",
1188
1185
  "data-testid": "markweave-image-upload-submit",
1189
1186
  disabled: e.isSubmitting || !e.inputValue.trim(),
1190
1187
  onClick: e.onSubmit
1191
- }, [H(qn, {
1188
+ }, [B(Bn, {
1192
1189
  size: 16,
1193
1190
  strokeWidth: 1.8
1194
1191
  }), e.messages.common.insert]),
1195
- H("button", {
1192
+ B("button", {
1196
1193
  type: "button",
1197
1194
  "data-testid": "markweave-image-upload-cancel",
1198
1195
  onClick: e.onCancel
1199
1196
  }, e.messages.common.cancel)
1200
1197
  ]),
1201
- e.error ? H("div", {
1198
+ e.error ? B("div", {
1202
1199
  class: "markweave-image-upload-error",
1203
1200
  role: "alert"
1204
1201
  }, e.error) : null
1205
1202
  ]);
1206
1203
  }
1207
- function kr(e) {
1208
- let t = U(null), n = e.messages.video;
1209
- return H("section", {
1204
+ function xr(e) {
1205
+ let t = V(null), n = e.messages.video;
1206
+ return B("section", {
1210
1207
  class: "markweave-video-upload-placeholder",
1211
1208
  "data-testid": "markweave-video-upload-placeholder",
1212
1209
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1224,7 +1221,7 @@ function kr(e) {
1224
1221
  n && e.onFile(n);
1225
1222
  }
1226
1223
  }, [
1227
- H("input", {
1224
+ B("input", {
1228
1225
  ref: t,
1229
1226
  "data-testid": "markweave-video-file-input",
1230
1227
  type: "file",
@@ -1235,20 +1232,20 @@ function kr(e) {
1235
1232
  r && e.onFile(r), n.value = "";
1236
1233
  }
1237
1234
  }),
1238
- H("div", {
1235
+ B("div", {
1239
1236
  class: "markweave-video-upload-icon",
1240
1237
  "aria-hidden": "true"
1241
- }, [H(br, {
1238
+ }, [B(pr, {
1242
1239
  size: 46,
1243
1240
  strokeWidth: 1.6
1244
1241
  })]),
1245
- H("div", { class: "markweave-video-upload-copy" }, [H("button", {
1242
+ B("div", { class: "markweave-video-upload-copy" }, [B("button", {
1246
1243
  type: "button",
1247
1244
  onClick: () => t.value?.click()
1248
- }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1249
- H("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1250
- H("div", { class: "markweave-video-upload-row" }, [
1251
- H("input", {
1245
+ }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1246
+ B("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1247
+ B("div", { class: "markweave-video-upload-row" }, [
1248
+ B("input", {
1252
1249
  "data-testid": "markweave-video-url-input",
1253
1250
  value: e.inputValue,
1254
1251
  placeholder: n.uploadInputPlaceholder,
@@ -1258,28 +1255,28 @@ function kr(e) {
1258
1255
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1259
1256
  }
1260
1257
  }),
1261
- H("button", {
1258
+ B("button", {
1262
1259
  type: "button",
1263
1260
  "data-testid": "markweave-video-upload-submit",
1264
1261
  disabled: e.isSubmitting || !e.inputValue.trim(),
1265
1262
  onClick: e.onSubmit
1266
- }, [H(yr, {
1263
+ }, [B(fr, {
1267
1264
  size: 16,
1268
1265
  strokeWidth: 1.8
1269
1266
  }), e.messages.common.insert]),
1270
- H("button", {
1267
+ B("button", {
1271
1268
  type: "button",
1272
1269
  "data-testid": "markweave-video-upload-cancel",
1273
1270
  onClick: e.onCancel
1274
1271
  }, e.messages.common.cancel)
1275
1272
  ]),
1276
- e.error ? H("div", {
1273
+ e.error ? B("div", {
1277
1274
  class: "markweave-video-upload-error",
1278
1275
  role: "alert"
1279
1276
  }, e.error) : null
1280
1277
  ]);
1281
1278
  }
1282
- var Ar = Y({
1279
+ var Sr = J({
1283
1280
  name: "MarkweaveVueImageNodeView",
1284
1281
  props: {
1285
1282
  editor: {
@@ -1312,31 +1309,10 @@ var Ar = Y({
1312
1309
  }
1313
1310
  },
1314
1311
  setup(e) {
1315
- let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = Sr(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
1316
- K(v, (t) => {
1317
- if (C?.abort(), C = null, !t) {
1318
- x.value = null;
1319
- return;
1320
- }
1321
- let n = y.value;
1322
- if (!n) {
1323
- x.value = { src: t };
1324
- return;
1325
- }
1326
- let r = new AbortController();
1327
- C = r, S(n, {
1328
- kind: "image",
1329
- priority: e.selected ? "visible" : "nearby",
1330
- signal: r.signal,
1331
- src: t
1332
- }).then((e) => {
1333
- r.signal.aborted || (x.value = e);
1334
- });
1335
- }, { immediate: !0 }), q(() => C?.abort());
1336
- let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => xr(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
1337
- w.value && b({
1338
- src: w.value,
1339
- alt: I(u.value.alt) ?? "",
1312
+ let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m = hr(e.editor), h = U(() => d(m.value)), g = U(() => e.extension.options?.messages ?? n("zh")), _ = U(() => g.value.image), v = U(() => N(u.value.src)), y = U(() => mr(u.value.align)), x = U(() => M(u.value.width)), S = U(() => N(u.value.caption)), w = U(() => h.value && (!v.value || i.value)), T = () => {
1313
+ v.value && b({
1314
+ src: v.value,
1315
+ alt: N(u.value.alt) ?? "",
1340
1316
  messages: {
1341
1317
  dialogAriaLabel: _.value.previewDialogAriaLabel,
1342
1318
  zoomOut: _.value.previewZoomOut,
@@ -1346,67 +1322,67 @@ var Ar = Y({
1346
1322
  }
1347
1323
  });
1348
1324
  };
1349
- K(A, (e) => {
1325
+ W(S, (e) => {
1350
1326
  f.value || (p.value = e ?? "");
1351
1327
  });
1352
- let P = () => {
1328
+ let D = () => {
1353
1329
  if (!h.value) return;
1354
1330
  let t = e.getPos();
1355
1331
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1356
- }, ee = () => {
1332
+ }, k = () => {
1357
1333
  if (o.value = "", c.value = null, a.value = !1, v.value) {
1358
1334
  i.value = !1;
1359
1335
  return;
1360
1336
  }
1361
1337
  e.deleteNode();
1362
- }, z = async (t) => {
1338
+ }, A = async (t) => {
1363
1339
  if (!h.value) return;
1364
1340
  let n = e.extension.options;
1365
1341
  l.value = !0, c.value = null;
1366
1342
  try {
1367
- let r = await R(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1368
- e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
1343
+ let r = await I(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1344
+ e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
1369
1345
  } catch (e) {
1370
1346
  c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
1371
1347
  } finally {
1372
1348
  l.value = !1, a.value = !1;
1373
1349
  }
1374
- }, te = () => {
1350
+ }, j = () => {
1375
1351
  if (!o.value.trim()) {
1376
1352
  c.value = _.value.uploadRequiredError;
1377
1353
  return;
1378
1354
  }
1379
- z(L(o.value));
1380
- }, ne = (e) => {
1381
- z({
1355
+ A(P(o.value));
1356
+ }, F = (e) => {
1357
+ A({
1382
1358
  type: "file",
1383
1359
  file: e,
1384
1360
  mimeType: e.type || "image/*"
1385
1361
  });
1386
- }, B = () => {
1387
- f.value = !f.value, f.value && (p.value = A.value ?? "");
1388
- }, V = (n, r) => {
1362
+ }, te = () => {
1363
+ f.value = !f.value, f.value && (p.value = S.value ?? "");
1364
+ }, L = (n, r) => {
1389
1365
  if (!h.value || !v.value) return;
1390
- r.preventDefault(), r.stopPropagation(), P();
1366
+ r.preventDefault(), r.stopPropagation(), D();
1391
1367
  let i = t.value;
1392
1368
  if (!i) return;
1393
- let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1369
+ let a = r.clientX, o = i.getBoundingClientRect().width || x.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1394
1370
  let r = n === "right" ? t.clientX - a : a - t.clientX;
1395
- e.updateAttributes({ width: O(o + r, s) });
1371
+ e.updateAttributes({ width: E(o + r, s) });
1396
1372
  }, l = () => {
1397
1373
  window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
1398
1374
  };
1399
1375
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1400
1376
  };
1401
- return () => M.value ? H(s, {
1377
+ return () => w.value ? B(s, {
1402
1378
  as: "figure",
1403
1379
  class: "markweave-image-node",
1404
1380
  "data-testid": "markweave-image-node",
1405
- "data-align": E.value,
1381
+ "data-align": y.value,
1406
1382
  "data-selected": "false",
1407
1383
  "data-hovered": "false",
1408
1384
  "data-empty": "true"
1409
- }, () => Or({
1385
+ }, () => br({
1410
1386
  messages: g.value,
1411
1387
  inputValue: o.value,
1412
1388
  error: c.value,
@@ -1415,17 +1391,17 @@ var Ar = Y({
1415
1391
  onInputValue: (e) => {
1416
1392
  o.value = e;
1417
1393
  },
1418
- onFile: ne,
1419
- onSubmit: te,
1420
- onCancel: ee,
1394
+ onFile: F,
1395
+ onSubmit: j,
1396
+ onCancel: k,
1421
1397
  onDragActive: (e) => {
1422
1398
  a.value = e;
1423
1399
  }
1424
- })) : H(s, {
1400
+ })) : B(s, {
1425
1401
  as: "figure",
1426
1402
  class: "markweave-image-node",
1427
1403
  "data-testid": "markweave-image-node",
1428
- "data-align": E.value,
1404
+ "data-align": y.value,
1429
1405
  "data-selected": h.value && e.selected ? "true" : "false",
1430
1406
  "data-hovered": r.value ? "true" : "false",
1431
1407
  "data-empty": "false",
@@ -1436,104 +1412,97 @@ var Ar = Y({
1436
1412
  r.value = !1;
1437
1413
  },
1438
1414
  onMousedown: (e) => {
1439
- h.value && !Cr(e.target) && P();
1415
+ h.value && !gr(e.target) && D();
1440
1416
  }
1441
1417
  }, () => [
1442
- h.value ? H("div", {
1418
+ h.value ? B("div", {
1443
1419
  class: "markweave-image-toolbar",
1444
1420
  "data-testid": "markweave-image-toolbar",
1445
1421
  "data-markweave-image-ui": "true",
1446
1422
  "aria-label": _.value.toolsAriaLabel
1447
1423
  }, [
1448
- Dr({
1424
+ X({
1449
1425
  testId: "markweave-image-align-left",
1450
1426
  label: _.value.alignLeft,
1451
- icon: On,
1452
- active: E.value === "left",
1427
+ icon: xn,
1428
+ active: y.value === "left",
1453
1429
  onClick: () => e.updateAttributes({ align: "left" })
1454
1430
  }),
1455
- Dr({
1431
+ X({
1456
1432
  testId: "markweave-image-align-center",
1457
1433
  label: _.value.alignCenter,
1458
- icon: En,
1459
- active: E.value === "center",
1434
+ icon: yn,
1435
+ active: y.value === "center",
1460
1436
  onClick: () => e.updateAttributes({ align: "center" })
1461
1437
  }),
1462
- Dr({
1438
+ X({
1463
1439
  testId: "markweave-image-align-right",
1464
1440
  label: _.value.alignRight,
1465
- icon: kn,
1466
- active: E.value === "right",
1441
+ icon: Sn,
1442
+ active: y.value === "right",
1467
1443
  onClick: () => e.updateAttributes({ align: "right" })
1468
1444
  }),
1469
- H("span", {
1445
+ B("span", {
1470
1446
  class: "markweave-image-toolbar-divider",
1471
1447
  "aria-hidden": "true"
1472
1448
  }),
1473
- Dr({
1449
+ X({
1474
1450
  testId: "markweave-image-caption",
1475
1451
  label: _.value.caption,
1476
- icon: Nn,
1477
- active: f.value || !!A.value,
1478
- onClick: B
1452
+ icon: En,
1453
+ active: f.value || !!S.value,
1454
+ onClick: te
1479
1455
  }),
1480
- Dr({
1456
+ X({
1481
1457
  testId: "markweave-image-preview",
1482
1458
  label: _.value.preview,
1483
- icon: Vn,
1484
- onClick: N
1459
+ icon: Pn,
1460
+ onClick: T
1485
1461
  }),
1486
- Dr({
1462
+ X({
1487
1463
  testId: "markweave-image-download",
1488
1464
  label: _.value.download,
1489
- icon: Bn,
1465
+ icon: Nn,
1490
1466
  onClick: () => {
1491
- w.value && j(w.value);
1467
+ v.value && O(v.value);
1492
1468
  }
1493
1469
  }),
1494
- Dr({
1470
+ X({
1495
1471
  testId: "markweave-image-replace",
1496
1472
  label: _.value.replace,
1497
- icon: cr,
1473
+ icon: tr,
1498
1474
  onClick: () => {
1499
1475
  o.value = "", c.value = null, i.value = !0;
1500
1476
  }
1501
1477
  }),
1502
- H("span", {
1478
+ B("span", {
1503
1479
  class: "markweave-image-toolbar-divider",
1504
1480
  "aria-hidden": "true"
1505
1481
  }),
1506
- Dr({
1482
+ X({
1507
1483
  testId: "markweave-image-delete",
1508
1484
  label: _.value.delete,
1509
- icon: gr,
1485
+ icon: lr,
1510
1486
  onClick: () => e.deleteNode()
1511
1487
  })
1512
1488
  ]) : null,
1513
- H("div", {
1489
+ B("div", {
1514
1490
  ref: t,
1515
1491
  class: "markweave-image-box",
1516
- style: {
1517
- ...D.value ? { width: `${Math.round(D.value)}px` } : {},
1518
- ...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
1519
- }
1492
+ style: x.value ? { width: `${Math.round(x.value)}px` } : void 0
1520
1493
  }, [
1521
- w.value ? H("img", {
1494
+ v.value ? B("img", {
1522
1495
  class: "markweave-image",
1523
- src: w.value,
1524
- alt: I(u.value.alt) ?? "",
1525
- title: I(u.value.title) ?? void 0,
1526
- draggable: !1,
1527
- loading: "lazy",
1528
- decoding: "async",
1529
- width: x.value?.width,
1530
- height: x.value?.height
1531
- }) : H("div", {
1496
+ src: v.value,
1497
+ alt: N(u.value.alt) ?? "",
1498
+ title: N(u.value.title) ?? void 0,
1499
+ draggable: !1
1500
+ }) : B("div", {
1532
1501
  class: "markweave-image-readonly-empty",
1533
1502
  "data-testid": "markweave-image-readonly-empty",
1534
1503
  "aria-hidden": "true"
1535
1504
  }),
1536
- !h.value && w.value ? H("button", {
1505
+ !h.value && v.value ? B("button", {
1537
1506
  type: "button",
1538
1507
  class: "markweave-image-preview-trigger",
1539
1508
  "data-testid": "markweave-image-preview",
@@ -1541,34 +1510,34 @@ var Ar = Y({
1541
1510
  "aria-label": _.value.preview,
1542
1511
  title: _.value.preview,
1543
1512
  onMousedown: (e) => e.preventDefault(),
1544
- onClick: N
1545
- }, [H(Vn, {
1513
+ onClick: T
1514
+ }, [B(Pn, {
1546
1515
  size: 16,
1547
1516
  strokeWidth: 1.8
1548
- }), H("span", {
1517
+ }), B("span", {
1549
1518
  class: "markweave-image-tooltip",
1550
1519
  role: "tooltip"
1551
1520
  }, _.value.preview)]) : null,
1552
- h.value ? H("button", {
1521
+ h.value ? B("button", {
1553
1522
  type: "button",
1554
1523
  class: "markweave-image-resize-handle",
1555
1524
  "data-testid": "markweave-image-resize-left",
1556
1525
  "data-side": "left",
1557
1526
  "aria-label": _.value.resizeLeft,
1558
1527
  "data-markweave-image-ui": "true",
1559
- onPointerdown: (e) => V("left", e)
1528
+ onPointerdown: (e) => L("left", e)
1560
1529
  }) : null,
1561
- h.value ? H("button", {
1530
+ h.value ? B("button", {
1562
1531
  type: "button",
1563
1532
  class: "markweave-image-resize-handle",
1564
1533
  "data-testid": "markweave-image-resize-right",
1565
1534
  "data-side": "right",
1566
1535
  "aria-label": _.value.resizeRight,
1567
1536
  "data-markweave-image-ui": "true",
1568
- onPointerdown: (e) => V("right", e)
1537
+ onPointerdown: (e) => L("right", e)
1569
1538
  }) : null
1570
1539
  ]),
1571
- h.value && (f.value || A.value) ? H("input", {
1540
+ h.value && (f.value || S.value) ? B("input", {
1572
1541
  class: "markweave-image-caption-input",
1573
1542
  "data-testid": "markweave-image-caption-input",
1574
1543
  "data-markweave-image-ui": "true",
@@ -1581,13 +1550,13 @@ var Ar = Y({
1581
1550
  onKeydown: (e) => {
1582
1551
  e.key === "Escape" && (e.preventDefault(), f.value = !1);
1583
1552
  }
1584
- }) : A.value ? H("figcaption", {
1553
+ }) : S.value ? B("figcaption", {
1585
1554
  class: "markweave-image-caption",
1586
1555
  "data-testid": "markweave-image-caption"
1587
- }, A.value) : null
1556
+ }, S.value) : null
1588
1557
  ]);
1589
1558
  }
1590
- }), jr = Y({
1559
+ }), Cr = J({
1591
1560
  name: "MarkweaveVueVideoNodeView",
1592
1561
  props: {
1593
1562
  editor: {
@@ -1620,15 +1589,15 @@ var Ar = Y({
1620
1589
  }
1621
1590
  },
1622
1591
  setup(e) {
1623
- let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Sr(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
1592
+ let t = V(!1), r = V(""), i = V(null), a = V(!1), o = hr(e.editor), c = U(() => d(o.value)), l = U(() => e.extension.options?.messages ?? n("zh")), u = U(() => l.value.video), f = U(() => e.node.attrs), p = U(() => N(f.value.src)), m = U(() => N(f.value.embedUrl)), h = U(() => N(f.value.provider)), g = U(() => m.value ? j(m.value, h.value) : null), _ = U(() => N(f.value.mimeType)), v = U(() => N(f.value.title)), y = () => {
1624
1593
  p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
1625
1594
  }, b = async (n) => {
1626
1595
  if (!c.value) return;
1627
1596
  let o = e.extension.options;
1628
1597
  a.value = !0, i.value = null;
1629
1598
  try {
1630
- let t = await R(A(n), o?.onUpload);
1631
- e.updateAttributes(E(t)), r.value = "";
1599
+ let t = await I(D(n), o?.onUpload);
1600
+ e.updateAttributes(w(t)), r.value = "";
1632
1601
  } catch (e) {
1633
1602
  i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
1634
1603
  } finally {
@@ -1636,7 +1605,7 @@ var Ar = Y({
1636
1605
  }
1637
1606
  }, x = () => {
1638
1607
  if (!c.value) return;
1639
- let t = D(r.value);
1608
+ let t = T(r.value);
1640
1609
  if (!t) {
1641
1610
  i.value = u.value.unsupportedUrlError;
1642
1611
  return;
@@ -1652,16 +1621,16 @@ var Ar = Y({
1652
1621
  if (!c.value) return;
1653
1622
  let t = e.getPos();
1654
1623
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1655
- }, w = (t) => {
1624
+ }, E = (t) => {
1656
1625
  c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
1657
1626
  };
1658
- return () => c.value && !p.value ? H(s, {
1627
+ return () => c.value && !p.value ? B(s, {
1659
1628
  as: "figure",
1660
1629
  class: "markweave-video-node",
1661
1630
  "data-testid": "markweave-video-node",
1662
1631
  "data-empty": "true",
1663
1632
  "data-selected": "false"
1664
- }, () => kr({
1633
+ }, () => xr({
1665
1634
  messages: l.value,
1666
1635
  inputValue: r.value,
1667
1636
  error: i.value,
@@ -1676,7 +1645,7 @@ var Ar = Y({
1676
1645
  onDragActive: (e) => {
1677
1646
  t.value = e;
1678
1647
  }
1679
- })) : H(s, {
1648
+ })) : B(s, {
1680
1649
  as: "figure",
1681
1650
  class: "markweave-video-node",
1682
1651
  "data-testid": "markweave-video-node",
@@ -1686,27 +1655,27 @@ var Ar = Y({
1686
1655
  "aria-label": u.value.nodeAriaLabel,
1687
1656
  tabindex: c.value ? 0 : void 0,
1688
1657
  onFocus: C,
1689
- onKeydown: w,
1658
+ onKeydown: E,
1690
1659
  onMousedown: (e) => {
1691
- c.value && !wr(e.target) && (e.preventDefault(), C());
1660
+ c.value && !_r(e.target) && (e.preventDefault(), C());
1692
1661
  }
1693
- }, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
1662
+ }, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
1694
1663
  class: "markweave-video-iframe",
1695
1664
  src: g.value,
1696
1665
  title: v.value ?? `${h.value ?? "Video"} embed`,
1697
1666
  "data-markweave-video-embed": "true",
1698
1667
  "data-markweave-video-provider": h.value ?? void 0,
1699
1668
  "data-markweave-video-src": p.value ?? void 0,
1700
- allow: M,
1669
+ allow: k,
1701
1670
  loading: "lazy",
1702
1671
  allowfullscreen: "true"
1703
- }), c.value ? H("button", {
1672
+ }), c.value ? B("button", {
1704
1673
  type: "button",
1705
1674
  class: "markweave-video-selection-layer",
1706
1675
  "data-testid": "markweave-video-selection-layer",
1707
1676
  tabindex: -1,
1708
1677
  "aria-label": u.value.selectAriaLabel
1709
- }) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
1678
+ }) : null]) : p.value ? B("div", { class: "markweave-video-box" }, [B("video", {
1710
1679
  class: "markweave-video",
1711
1680
  src: p.value,
1712
1681
  title: v.value ?? void 0,
@@ -1714,51 +1683,41 @@ var Ar = Y({
1714
1683
  controls: !0,
1715
1684
  "data-markweave-video": "true",
1716
1685
  "data-markweave-mime-type": _.value ?? void 0
1717
- }), c.value ? H("button", {
1686
+ }), c.value ? B("button", {
1718
1687
  type: "button",
1719
1688
  class: "markweave-video-selection-layer",
1720
1689
  "data-testid": "markweave-video-selection-layer",
1721
1690
  tabindex: -1,
1722
1691
  "aria-label": u.value.selectAriaLabel
1723
- }) : null]) : H("div", {
1692
+ }) : null]) : B("div", {
1724
1693
  class: "markweave-video-readonly-empty",
1725
1694
  "data-testid": "markweave-video-readonly-empty",
1726
1695
  "aria-hidden": "true"
1727
1696
  })]);
1728
1697
  }
1729
- }), Mr = C.extend({
1698
+ }), wr = x.extend({
1730
1699
  addOptions() {
1731
1700
  return {
1732
1701
  ...this.parent?.(),
1733
1702
  messages: n("zh"),
1734
- onUpload: void 0,
1735
- resolveMediaSource: void 0
1703
+ onUpload: void 0
1736
1704
  };
1737
1705
  },
1738
1706
  addNodeView() {
1739
- if (typeof document > "u") return null;
1740
- let e = c(Ar, { stopEvent: ({ event: e }) => Cr(e.target) }), t = this.options.resolveMediaSource;
1741
- if (!t) return e;
1742
- let r = x({
1743
- messages: this.options.messages ?? n("zh"),
1744
- onUpload: this.options.onUpload,
1745
- resolveMediaSource: t
1746
- });
1747
- return (t) => I(t.node.attrs.src) ? r(t) : e(t);
1707
+ return typeof document > "u" ? null : c(Sr, { stopEvent: ({ event: e }) => gr(e.target) });
1748
1708
  }
1749
- }), Nr = w.extend({
1709
+ }), Tr = S.extend({
1750
1710
  addOptions() {
1751
1711
  return {
1752
1712
  ...this.parent?.(),
1753
1713
  messages: n("zh"),
1754
- onUpload: void 0,
1755
- resolveMediaSource: void 0
1714
+ onUpload: void 0
1756
1715
  };
1757
1716
  },
1758
1717
  addNodeView() {
1759
- return typeof document > "u" ? null : c(jr, { stopEvent: ({ event: e }) => wr(e.target) });
1718
+ return typeof document > "u" ? null : c(Cr, { stopEvent: ({ event: e }) => _r(e.target) });
1760
1719
  }
1761
- }), Pr = Y({
1720
+ }), Er = J({
1762
1721
  name: "MarkweaveVueLinkCardNodeView",
1763
1722
  props: {
1764
1723
  editor: {
@@ -1791,11 +1750,11 @@ var Ar = Y({
1791
1750
  }
1792
1751
  },
1793
1752
  setup(e) {
1794
- let t = e.extension.options, r = t.messages ?? n("zh"), i = Sr(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
1795
- K(l, (e) => {
1753
+ let t = e.extension.options, r = t.messages ?? n("zh"), i = hr(e.editor), a = V(!1), o = V(!1), c = V(!1), l = U(() => _(e.node.attrs ?? {})), u = V(l.value?.title ?? ""), f = V(l.value?.href ?? "");
1754
+ W(l, (e) => {
1796
1755
  u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
1797
1756
  });
1798
- let p = G(() => d(i.value)), m = G(() => {
1757
+ let p = U(() => d(i.value)), m = U(() => {
1799
1758
  try {
1800
1759
  return new URL(l.value?.href ?? "").host;
1801
1760
  } catch {
@@ -1819,18 +1778,18 @@ var Ar = Y({
1819
1778
  ...r,
1820
1779
  ...i
1821
1780
  }) ?? r);
1822
- }, C = (e, t, n, r) => H("button", {
1781
+ }, C = (e, t, n, r) => B("button", {
1823
1782
  type: "button",
1824
1783
  title: e,
1825
1784
  "aria-label": e,
1826
1785
  "data-testid": n,
1827
1786
  onMousedown: h,
1828
1787
  onClick: r
1829
- }, [Er(t, e), H("span", { role: "tooltip" }, e)]);
1788
+ }, [yr(t, e), B("span", { role: "tooltip" }, e)]);
1830
1789
  return () => {
1831
1790
  let n = l.value;
1832
1791
  if (!n) return null;
1833
- let i = !c.value && n.imageUrl ? H("img", {
1792
+ let i = !c.value && n.imageUrl ? B("img", {
1834
1793
  src: n.imageUrl,
1835
1794
  alt: "",
1836
1795
  loading: "lazy",
@@ -1838,7 +1797,7 @@ var Ar = Y({
1838
1797
  onError: () => {
1839
1798
  c.value = !0;
1840
1799
  }
1841
- }) : !c.value && n.faviconUrl ? H("img", {
1800
+ }) : !c.value && n.faviconUrl ? B("img", {
1842
1801
  class: "markweave-link-card-favicon",
1843
1802
  src: n.faviconUrl,
1844
1803
  alt: "",
@@ -1847,8 +1806,8 @@ var Ar = Y({
1847
1806
  onError: () => {
1848
1807
  c.value = !0;
1849
1808
  }
1850
- }) : H("b", null, m.value.slice(0, 1).toUpperCase());
1851
- return H(s, {
1809
+ }) : B("b", null, m.value.slice(0, 1).toUpperCase());
1810
+ return B(s, {
1852
1811
  as: "article",
1853
1812
  class: "markweave-link-card",
1854
1813
  "data-testid": "markweave-link-card",
@@ -1862,32 +1821,32 @@ var Ar = Y({
1862
1821
  a.value = !1;
1863
1822
  },
1864
1823
  onMousedown: (e) => {
1865
- Tr(e.target) || e.preventDefault();
1824
+ vr(e.target) || e.preventDefault();
1866
1825
  },
1867
1826
  onClick: (e) => {
1868
- Tr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
1827
+ vr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
1869
1828
  }
1870
1829
  }, () => [
1871
- H("a", {
1830
+ B("a", {
1872
1831
  class: "markweave-link-card-main",
1873
1832
  href: n.href,
1874
1833
  "aria-label": r.linkCard.open
1875
- }, [H("span", { class: "markweave-link-card-copy" }, [
1876
- H("strong", null, n.title),
1877
- n.description ? H("span", null, n.description) : null,
1878
- H("small", null, n.siteName ?? m.value)
1879
- ]), H("span", {
1834
+ }, [B("span", { class: "markweave-link-card-copy" }, [
1835
+ B("strong", null, n.title),
1836
+ n.description ? B("span", null, n.description) : null,
1837
+ B("small", null, n.siteName ?? m.value)
1838
+ ]), B("span", {
1880
1839
  class: "markweave-link-card-media",
1881
1840
  "aria-hidden": "true"
1882
1841
  }, [i])]),
1883
- p.value && a.value ? H("div", {
1842
+ p.value && a.value ? B("div", {
1884
1843
  class: "markweave-link-card-tools",
1885
1844
  "data-markweave-link-card-ui": "true",
1886
1845
  "aria-label": r.linkCard.toolsAriaLabel
1887
1846
  }, [
1888
- C(r.linkCard.convertToLink, $n, "markweave-link-card-convert", x),
1889
- C(r.linkCard.copyAddress, Bn, "markweave-link-card-copy", () => b(n.href)),
1890
- C(r.linkCard.edit, or, "markweave-link-card-edit", (i) => g({
1847
+ C(r.linkCard.convertToLink, Kn, "markweave-link-card-convert", x),
1848
+ C(r.linkCard.copyAddress, Nn, "markweave-link-card-copy", () => b(n.href)),
1849
+ C(r.linkCard.edit, $n, "markweave-link-card-edit", (i) => g({
1891
1850
  anchor: i.currentTarget,
1892
1851
  editor: e.editor,
1893
1852
  messages: r,
@@ -1897,15 +1856,15 @@ var Ar = Y({
1897
1856
  attrs: n
1898
1857
  }
1899
1858
  })),
1900
- C(r.linkCard.delete, gr, "markweave-link-card-delete", () => e.deleteNode())
1859
+ C(r.linkCard.delete, lr, "markweave-link-card-delete", () => e.deleteNode())
1901
1860
  ]) : null,
1902
- p.value && o.value ? H("form", {
1861
+ p.value && o.value ? B("form", {
1903
1862
  class: "markweave-link-card-editor",
1904
1863
  "data-markweave-link-card-ui": "true",
1905
1864
  "data-testid": "markweave-link-card-editor",
1906
1865
  onSubmit: S
1907
1866
  }, [
1908
- H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
1867
+ B("label", null, [B("span", null, r.linkCard.titleLabel), B("input", {
1909
1868
  value: u.value,
1910
1869
  placeholder: r.linkCard.titlePlaceholder,
1911
1870
  "aria-label": r.linkCard.titleLabel,
@@ -1913,7 +1872,7 @@ var Ar = Y({
1913
1872
  u.value = e.target.value;
1914
1873
  }
1915
1874
  })]),
1916
- H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
1875
+ B("label", null, [B("span", null, r.linkCard.addressLabel), B("input", {
1917
1876
  value: f.value,
1918
1877
  placeholder: r.linkCard.addressPlaceholder,
1919
1878
  "aria-label": r.linkCard.addressLabel,
@@ -1921,16 +1880,16 @@ var Ar = Y({
1921
1880
  f.value = e.target.value;
1922
1881
  }
1923
1882
  })]),
1924
- H("button", {
1883
+ B("button", {
1925
1884
  type: "submit",
1926
1885
  disabled: !v(f.value),
1927
1886
  "aria-label": r.linkCard.edit
1928
- }, [Er($n, r.linkCard.edit)])
1887
+ }, [yr(Kn, r.linkCard.edit)])
1929
1888
  ]) : null
1930
1889
  ]);
1931
1890
  };
1932
1891
  }
1933
- }), Fr = h.extend({
1892
+ }), Dr = h.extend({
1934
1893
  addOptions() {
1935
1894
  return {
1936
1895
  ...this.parent?.(),
@@ -1939,33 +1898,32 @@ var Ar = Y({
1939
1898
  };
1940
1899
  },
1941
1900
  addNodeView() {
1942
- return typeof document > "u" ? null : c(Pr, { stopEvent: ({ event: e }) => Tr(e.target) });
1901
+ return typeof document > "u" ? null : c(Er, { stopEvent: ({ event: e }) => vr(e.target) });
1943
1902
  }
1944
1903
  });
1945
1904
  //#endregion
1946
1905
  //#region src/create-editor-extensions.ts
1947
- function Ir(t = {}) {
1906
+ function Or(t = {}) {
1948
1907
  return e({
1949
1908
  lang: t.lang,
1950
1909
  onImageUpload: t.onImageUpload,
1951
- linkCardExtension: Fr.configure({
1910
+ linkCardExtension: Dr.configure({
1952
1911
  lang: t.lang,
1953
1912
  messages: n(t.lang),
1954
1913
  resolver: t.linkCardResolver
1955
1914
  }),
1956
1915
  mediaExtensions: i({
1957
- image: Mr,
1958
- video: Nr,
1916
+ image: wr,
1917
+ video: Tr,
1959
1918
  lang: t.lang,
1960
1919
  onImageUpload: t.onImageUpload,
1961
- onVideoUpload: t.onVideoUpload,
1962
- resolveMediaSource: t.resolveMediaSource
1920
+ onVideoUpload: t.onVideoUpload
1963
1921
  })
1964
1922
  });
1965
1923
  }
1966
1924
  //#endregion
1967
1925
  //#region src/MarkweaveEditor.ts
1968
- var Lr = {
1926
+ var kr = {
1969
1927
  active: !1,
1970
1928
  mode: "outside",
1971
1929
  activeCellPos: null,
@@ -1973,17 +1931,17 @@ var Lr = {
1973
1931
  selectedCellCount: 0,
1974
1932
  selectionFrom: 0,
1975
1933
  selectionTo: 0
1976
- }, Rr = {
1934
+ }, Ar = {
1977
1935
  active: !1,
1978
- language: Fe.defaultLanguage,
1936
+ language: Pe.defaultLanguage,
1979
1937
  mermaidPreviewMode: "code",
1980
1938
  pos: null,
1981
1939
  text: ""
1982
1940
  };
1983
- function zr(e) {
1984
- return Gt.getState(e.state) ?? Wt;
1941
+ function jr(e) {
1942
+ return zt.getState(e.state) ?? Rt;
1985
1943
  }
1986
- function Br(e) {
1944
+ function Mr(e) {
1987
1945
  if (!e || typeof window > "u") return null;
1988
1946
  let t = e.parentElement;
1989
1947
  for (; t;) {
@@ -1994,133 +1952,133 @@ function Br(e) {
1994
1952
  return null;
1995
1953
  }
1996
1954
  function Z(e, t, n = 18, r = 1.8) {
1997
- return H(e, {
1955
+ return B(e, {
1998
1956
  size: n,
1999
1957
  strokeWidth: r,
2000
1958
  "aria-hidden": "true"
2001
1959
  }, { default: () => t });
2002
1960
  }
2003
- function Vr(e) {
2004
- 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", {
1961
+ function Nr(e) {
1962
+ return e === "clipboard" ? [B("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" }), B("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" ? [B("circle", {
2005
1963
  cx: "10",
2006
1964
  cy: "10",
2007
1965
  r: "5.5"
2008
- }), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2009
- H("path", { d: "M8 4H4v4" }),
2010
- H("path", { d: "M4 4l5 5" }),
2011
- H("path", { d: "M16 4h4v4" }),
2012
- H("path", { d: "m20 4-5 5" }),
2013
- H("path", { d: "M8 20H4v-4" }),
2014
- H("path", { d: "m4 20 5-5" }),
2015
- H("path", { d: "M16 20h4v-4" }),
2016
- H("path", { d: "m20 20-5-5" })
1966
+ }), B("path", { d: "m14 14 4 4" })] : e === "check" ? [B("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
1967
+ B("path", { d: "M8 4H4v4" }),
1968
+ B("path", { d: "M4 4l5 5" }),
1969
+ B("path", { d: "M16 4h4v4" }),
1970
+ B("path", { d: "m20 4-5 5" }),
1971
+ B("path", { d: "M8 20H4v-4" }),
1972
+ B("path", { d: "m4 20 5-5" }),
1973
+ B("path", { d: "M16 20h4v-4" }),
1974
+ B("path", { d: "m20 20-5-5" })
2017
1975
  ] : e === "download" ? [
2018
- H("path", { d: "M12 4v10" }),
2019
- H("path", { d: "m8 10 4 4 4-4" }),
2020
- H("path", { d: "M5 19h14" })
2021
- ] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2022
- H("circle", {
1976
+ B("path", { d: "M12 4v10" }),
1977
+ B("path", { d: "m8 10 4 4 4-4" }),
1978
+ B("path", { d: "M5 19h14" })
1979
+ ] : e === "close" ? [B("path", { d: "M6 6l12 12" }), B("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
1980
+ B("circle", {
2023
1981
  cx: "10",
2024
1982
  cy: "10",
2025
1983
  r: "5.25"
2026
1984
  }),
2027
- H("path", { d: "M7.5 10h5" }),
2028
- H("path", { d: "m14 14 4 4" })
1985
+ B("path", { d: "M7.5 10h5" }),
1986
+ B("path", { d: "m14 14 4 4" })
2029
1987
  ] : e === "zoomIn" ? [
2030
- H("circle", {
1988
+ B("circle", {
2031
1989
  cx: "10",
2032
1990
  cy: "10",
2033
1991
  r: "5.25"
2034
1992
  }),
2035
- H("path", { d: "M7.5 10h5" }),
2036
- H("path", { d: "M10 7.5v5" }),
2037
- H("path", { d: "m14 14 4 4" })
2038
- ] : 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" })];
1993
+ B("path", { d: "M7.5 10h5" }),
1994
+ B("path", { d: "M10 7.5v5" }),
1995
+ B("path", { d: "m14 14 4 4" })
1996
+ ] : e === "reset" ? [B("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), B("path", { d: "M6.5 8.5H3.5v-3" })] : [B("path", { d: "m6 9 6 6 6-6" })];
2039
1997
  }
2040
1998
  function Q(e) {
2041
- return H("svg", {
1999
+ return B("svg", {
2042
2000
  viewBox: "0 0 24 24",
2043
2001
  "aria-hidden": "true",
2044
2002
  focusable: "false"
2045
- }, H("g", {
2003
+ }, B("g", {
2046
2004
  fill: "none",
2047
2005
  stroke: "currentColor",
2048
2006
  "stroke-linecap": "round",
2049
2007
  "stroke-linejoin": "round",
2050
2008
  "stroke-width": "1.8"
2051
- }, Vr(e)));
2009
+ }, Nr(e)));
2052
2010
  }
2053
2011
  function $(e) {
2054
2012
  e.preventDefault();
2055
2013
  }
2056
- function Hr(e) {
2057
- let t = ft(e);
2014
+ function Pr(e) {
2015
+ let t = ot(e);
2058
2016
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
2059
2017
  }
2060
- var Ur = {
2061
- bold: jn,
2062
- italic: Zn,
2063
- underline: vr,
2064
- strike: dr,
2065
- "inline-code": Rn,
2066
- link: $n,
2067
- more: ir,
2068
- superscript: pr,
2069
- subscript: fr,
2070
- "inline-math": lr,
2071
- "align-left": On,
2072
- "align-center": En,
2073
- "align-right": kn,
2074
- "align-justify": Dn,
2075
- "decrease-indent": Jn,
2076
- "increase-indent": Yn
2077
- }, Wr = {
2078
- type: hr,
2079
- "heading-1": Un,
2080
- "heading-2": Wn,
2081
- "heading-3": Gn,
2082
- "bullet-list": er,
2083
- "ordered-list": nr,
2084
- "task-list": tr,
2085
- blockquote: sr,
2086
- "code-block": Mn,
2087
- info: Xn,
2088
- tip: Qn,
2089
- warning: An,
2090
- error: Ln,
2091
- success: Pn,
2092
- emoji: ur,
2093
- math: lr,
2094
- table: mr,
2095
- separator: rr,
2096
- image: Kn,
2097
- video: br,
2098
- attachment: ar
2018
+ var Fr = {
2019
+ bold: wn,
2020
+ italic: Wn,
2021
+ underline: dr,
2022
+ strike: ir,
2023
+ "inline-code": jn,
2024
+ link: Kn,
2025
+ more: Zn,
2026
+ superscript: or,
2027
+ subscript: ar,
2028
+ "inline-math": nr,
2029
+ "align-left": xn,
2030
+ "align-center": yn,
2031
+ "align-right": Sn,
2032
+ "align-justify": bn,
2033
+ "decrease-indent": Vn,
2034
+ "increase-indent": Hn
2035
+ }, Ir = {
2036
+ type: cr,
2037
+ "heading-1": In,
2038
+ "heading-2": Ln,
2039
+ "heading-3": Rn,
2040
+ "bullet-list": qn,
2041
+ "ordered-list": Yn,
2042
+ "task-list": Jn,
2043
+ blockquote: er,
2044
+ "code-block": Tn,
2045
+ info: Un,
2046
+ tip: Gn,
2047
+ warning: Cn,
2048
+ error: An,
2049
+ success: Dn,
2050
+ emoji: rr,
2051
+ math: nr,
2052
+ table: sr,
2053
+ separator: Xn,
2054
+ image: zn,
2055
+ video: pr,
2056
+ attachment: Qn
2099
2057
  };
2100
- function Gr(e) {
2101
- let t = Wr[e];
2102
- return H(t, {
2058
+ function Lr(e) {
2059
+ let t = Ir[e];
2060
+ return B(t, {
2103
2061
  size: 18,
2104
2062
  strokeWidth: 1.6,
2105
2063
  absoluteStrokeWidth: !0,
2106
2064
  "aria-hidden": "true"
2107
2065
  });
2108
2066
  }
2109
- var Kr = {
2110
- paragraph: _r,
2111
- "heading-1": Un,
2112
- "heading-2": Wn,
2113
- "heading-3": Gn,
2114
- "bullet-list": er,
2115
- "numbered-list": nr,
2116
- "todo-list": tr,
2117
- quote: sr,
2118
- "code-block": Mn
2067
+ var Rr = {
2068
+ paragraph: ur,
2069
+ "heading-1": In,
2070
+ "heading-2": Ln,
2071
+ "heading-3": Rn,
2072
+ "bullet-list": qn,
2073
+ "numbered-list": Yn,
2074
+ "todo-list": Jn,
2075
+ quote: er,
2076
+ "code-block": Tn
2119
2077
  };
2120
- function qr(e, t) {
2078
+ function zr(e, t) {
2121
2079
  return se(e, t).label;
2122
2080
  }
2123
- var Jr = Y({
2081
+ var Br = J({
2124
2082
  name: "MarkweaveVueFloatingToolbar",
2125
2083
  props: {
2126
2084
  editor: {
@@ -2137,28 +2095,28 @@ var Jr = Y({
2137
2095
  }
2138
2096
  },
2139
2097
  setup(e) {
2140
- let t = U(null), n = U(""), r = U(null), i = U(null), a = U("bottom"), o = U(null), s = U(null), c = U(null), l = G(() => ft(n.value.trim())), u = G(() => e.messages.floatingToolbar), d = G(() => de(e.messages).map((e) => [
2098
+ let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => ot(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => ue(e.messages).map((e) => [
2141
2099
  e.id,
2142
2100
  e.label,
2143
- Kr[e.id]
2144
- ])), f = G(() => ue(e.messages).map((e) => [
2101
+ Rr[e.id]
2102
+ ])), f = U(() => z(e.messages).map((e) => [
2145
2103
  e.id,
2146
2104
  e.value,
2147
2105
  e.label
2148
- ])), p = G(() => ce(e.messages).map((e) => [
2106
+ ])), p = U(() => ce(e.messages).map((e) => [
2149
2107
  e.id,
2150
2108
  e.value,
2151
2109
  e.label
2152
- ])), m = G(() => le(e.messages).map((e) => e.id)), h = () => {
2110
+ ])), m = U(() => le(e.messages).map((e) => e.id)), h = () => {
2153
2111
  l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
2154
2112
  }, g = () => {
2155
2113
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
2156
2114
  }, _ = (r) => {
2157
2115
  t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
2158
- }, v = B(() => {
2116
+ }, v = R(() => {
2159
2117
  let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
2160
2118
  if (!t.value || !n || !r) return;
2161
- let s = _e({
2119
+ let s = ge({
2162
2120
  toolbarRect: n.getBoundingClientRect(),
2163
2121
  popoverSize: r.getBoundingClientRect(),
2164
2122
  viewport: {
@@ -2170,11 +2128,11 @@ var Jr = Y({
2170
2128
  });
2171
2129
  a.value = s.placement;
2172
2130
  });
2173
- K(t, (e) => {
2174
- e && J(v.schedule);
2175
- }), Cn(() => {
2131
+ W(t, (e) => {
2132
+ e && q(v.schedule);
2133
+ }), G(() => {
2176
2134
  window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
2177
- }), q(() => {
2135
+ }), K(() => {
2178
2136
  v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
2179
2137
  });
2180
2138
  let y = (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, b = (e, t) => {
@@ -2188,7 +2146,7 @@ var Jr = Y({
2188
2146
  let e = r.value;
2189
2147
  if (!e || t.value !== null) return null;
2190
2148
  let n = u.value.buttons[e];
2191
- return n ? H("div", {
2149
+ return n ? B("div", {
2192
2150
  class: "markweave-floating-toolbar-tooltip",
2193
2151
  role: "tooltip",
2194
2152
  "data-testid": "markweave-floating-toolbar-tooltip",
@@ -2196,7 +2154,7 @@ var Jr = Y({
2196
2154
  "data-active": y(e),
2197
2155
  style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
2198
2156
  }, n) : null;
2199
- }, S = (n, i, a, o, s = !1, c) => H("button", {
2157
+ }, S = (n, i, a, o, s = !1, c) => B("button", {
2200
2158
  type: "button",
2201
2159
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
2202
2160
  "aria-label": i,
@@ -2215,13 +2173,13 @@ var Jr = Y({
2215
2173
  onMouseenter: (e) => b(n, e.currentTarget),
2216
2174
  onMouseleave: () => b(null),
2217
2175
  onClick: o
2218
- }, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, qr(e.editor, e.messages)), Z(t.value === "block-type" ? In : Fn, i)])] : 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" ? In : Fn, i)])] : [Z(a, i)]), C = () => H("span", {
2176
+ }, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, zr(e.editor, e.messages)), Z(t.value === "block-type" ? kn : On, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? kn : On, i)])] : [Z(a, i)]), C = () => B("span", {
2219
2177
  class: "markweave-floating-toolbar-divider",
2220
2178
  "aria-hidden": "true"
2221
- }), w = (n, r, i) => H("section", {
2179
+ }), w = (n, r, i) => B("section", {
2222
2180
  class: "markweave-floating-toolbar-color-section",
2223
2181
  "aria-label": n
2224
- }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
2182
+ }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, n), B("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => B("button", {
2225
2183
  key: `${r}-${n}`,
2226
2184
  type: "button",
2227
2185
  "aria-label": a,
@@ -2230,33 +2188,33 @@ var Jr = Y({
2230
2188
  onClick: () => {
2231
2189
  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;
2232
2190
  }
2233
- }, r === "text" ? [H("span", {
2191
+ }, r === "text" ? [B("span", {
2234
2192
  class: "markweave-floating-toolbar-text-swatch",
2235
2193
  style: { color: i ?? "#646970" }
2236
- }, "A")] : [H("span", {
2194
+ }, "A")] : [B("span", {
2237
2195
  class: "markweave-floating-toolbar-highlight-swatch",
2238
2196
  style: { backgroundColor: i ?? "#ffffff" },
2239
2197
  "aria-hidden": "true"
2240
- })])))]), T = () => t.value === "block-type" ? H("div", {
2198
+ })])))]), T = () => t.value === "block-type" ? B("div", {
2241
2199
  ref: c,
2242
2200
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
2243
2201
  "data-testid": "markweave-floating-toolbar-turn-menu"
2244
- }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => H("button", {
2202
+ }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => B("button", {
2245
2203
  key: n,
2246
2204
  type: "button",
2247
2205
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
2248
2206
  onMousedown: $,
2249
2207
  onClick: () => {
2250
- pe(e.editor, n), t.value = null;
2208
+ fe(e.editor, n), t.value = null;
2251
2209
  }
2252
- }, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
2210
+ }, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
2253
2211
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
2254
2212
  ref: c,
2255
2213
  "data-testid": "markweave-floating-toolbar-link-popover",
2256
2214
  onSubmit: (e) => {
2257
2215
  e.preventDefault(), h();
2258
2216
  }
2259
- }, [H("input", {
2217
+ }, [B("input", {
2260
2218
  value: n.value,
2261
2219
  placeholder: u.value.linkPlaceholder,
2262
2220
  "aria-label": u.value.linkUrlLabel,
@@ -2264,45 +2222,45 @@ var Jr = Y({
2264
2222
  onInput: (e) => {
2265
2223
  n.value = e.target.value;
2266
2224
  }
2267
- }), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
2268
- H("button", {
2225
+ }), B("span", { class: "markweave-floating-toolbar-link-actions" }, [
2226
+ B("button", {
2269
2227
  type: "submit",
2270
2228
  disabled: !l.value,
2271
2229
  "aria-label": u.value.applyLink,
2272
2230
  "data-testid": "markweave-floating-toolbar-link-apply",
2273
2231
  onMousedown: $
2274
- }, [Z(zn, u.value.applyLink)]),
2275
- H("span", {
2232
+ }, [Z(Mn, u.value.applyLink)]),
2233
+ B("span", {
2276
2234
  class: "markweave-floating-toolbar-link-divider",
2277
2235
  "aria-hidden": "true"
2278
2236
  }),
2279
- H("button", {
2237
+ B("button", {
2280
2238
  type: "button",
2281
2239
  disabled: !l.value,
2282
2240
  "aria-label": u.value.openLink,
2283
2241
  "data-testid": "markweave-floating-toolbar-link-open",
2284
2242
  onMousedown: $,
2285
- onClick: () => Hr(n.value)
2286
- }, [Z(Hn, u.value.openLink)]),
2287
- H("button", {
2243
+ onClick: () => Pr(n.value)
2244
+ }, [Z(Fn, u.value.openLink)]),
2245
+ B("button", {
2288
2246
  type: "button",
2289
2247
  "aria-label": u.value.removeLink,
2290
2248
  "data-testid": "markweave-floating-toolbar-link-remove",
2291
2249
  onMousedown: $,
2292
2250
  onClick: g
2293
- }, [Z(gr, u.value.removeLink)])
2294
- ])]) : t.value === "color" ? H("div", {
2251
+ }, [Z(lr, u.value.removeLink)])
2252
+ ])]) : t.value === "color" ? B("div", {
2295
2253
  ref: c,
2296
2254
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
2297
2255
  "data-testid": "markweave-floating-toolbar-color-menu"
2298
- }, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? H("div", {
2256
+ }, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? B("div", {
2299
2257
  ref: c,
2300
2258
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
2301
2259
  "data-testid": "markweave-floating-toolbar-more-menu"
2302
- }, m.value.map((n) => H("span", {
2260
+ }, m.value.map((n) => B("span", {
2303
2261
  key: n,
2304
2262
  class: "markweave-floating-toolbar-more-item"
2305
- }, [H("button", {
2263
+ }, [B("button", {
2306
2264
  type: "button",
2307
2265
  "aria-label": u.value.moreActions[n],
2308
2266
  "data-testid": `markweave-floating-toolbar-more-${n}`,
@@ -2315,43 +2273,43 @@ var Jr = Y({
2315
2273
  r.value = null;
2316
2274
  },
2317
2275
  onClick: () => {
2318
- fe(e.editor, n), t.value = null;
2276
+ de(e.editor, n), t.value = null;
2319
2277
  }
2320
- }, [Z(Ur[n], u.value.moreActions[n])]), r.value === n ? H("div", {
2278
+ }, [Z(Fr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
2321
2279
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2322
2280
  role: "tooltip"
2323
2281
  }, u.value.moreActions[n]) : null]))) : null;
2324
- return () => H(z, {
2282
+ return () => B(te, {
2325
2283
  editor: e.editor,
2326
- shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
2284
+ shouldShow: ({ editor: e }) => e.isEditable && ye(_e(e)),
2327
2285
  options: { placement: "top" }
2328
- }, { default: () => H("div", {
2286
+ }, { default: () => B("div", {
2329
2287
  ref: o,
2330
2288
  class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
2331
2289
  "data-popover-placement": t.value ? a.value : void 0,
2332
2290
  "data-testid": "markweave-floating-toolbar"
2333
- }, [H("div", {
2291
+ }, [B("div", {
2334
2292
  ref: s,
2335
2293
  class: "markweave-floating-toolbar-content",
2336
2294
  "data-menu": t.value ?? "none"
2337
2295
  }, [
2338
- S("block-type", u.value.buttons["block-type"], _r, () => _("block-type"), t.value === "block-type"),
2296
+ S("block-type", u.value.buttons["block-type"], ur, () => _("block-type"), t.value === "block-type"),
2339
2297
  C(),
2340
- S("bold", u.value.buttons.bold, jn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2341
- S("italic", u.value.buttons.italic, Zn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2342
- S("underline", u.value.buttons.underline, vr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2343
- S("strike", u.value.buttons.strike, dr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2344
- S("inline-code", u.value.buttons["inline-code"], Rn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2298
+ S("bold", u.value.buttons.bold, wn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2299
+ S("italic", u.value.buttons.italic, Wn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2300
+ S("underline", u.value.buttons.underline, dr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2301
+ S("strike", u.value.buttons.strike, ir, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2302
+ S("inline-code", u.value.buttons["inline-code"], jn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2345
2303
  C(),
2346
- S("link", u.value.buttons.link, $n, () => _("link"), e.editor.isActive("link")),
2347
- S("color", u.value.buttons.color, _r, () => _("color"), t.value === "color"),
2304
+ S("link", u.value.buttons.link, Kn, () => _("link"), e.editor.isActive("link")),
2305
+ S("color", u.value.buttons.color, ur, () => _("color"), t.value === "color"),
2348
2306
  C(),
2349
- S("more", u.value.buttons.more, ir, () => _("more"), t.value === "more"),
2307
+ S("more", u.value.buttons.more, Zn, () => _("more"), t.value === "more"),
2350
2308
  T(),
2351
2309
  x()
2352
2310
  ])]) });
2353
2311
  }
2354
- }), Yr = Y({
2312
+ }), Vr = J({
2355
2313
  name: "MarkweaveVueMathEditorPopover",
2356
2314
  props: {
2357
2315
  editor: {
@@ -2372,17 +2330,17 @@ var Jr = Y({
2372
2330
  }
2373
2331
  },
2374
2332
  setup(e) {
2375
- let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(_t(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
2333
+ let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(dt(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
2376
2334
  html: a.value,
2377
2335
  error: !1
2378
- } : xt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => gt(e.editor, e.target) ?? 1), u = () => {
2336
+ } : ht(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => ut(e.editor, e.target) ?? 1), u = () => {
2379
2337
  if (typeof window > "u") return;
2380
- let r = ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2338
+ let r = lt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2381
2339
  if (!r || !i) {
2382
2340
  e.onClose();
2383
2341
  return;
2384
2342
  }
2385
- n.value = mt({
2343
+ n.value = ct({
2386
2344
  anchorRect: r,
2387
2345
  frameRect: i,
2388
2346
  kind: e.target.kind,
@@ -2391,7 +2349,7 @@ var Jr = Y({
2391
2349
  viewportWidth: window.innerWidth
2392
2350
  });
2393
2351
  }, d = () => {
2394
- s.value && pt(e.editor, e.target, t.value) && e.onClose();
2352
+ s.value && st(e.editor, e.target, t.value) && e.onClose();
2395
2353
  }, f = (t) => {
2396
2354
  if (t.key === "Escape") {
2397
2355
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -2402,14 +2360,14 @@ var Jr = Y({
2402
2360
  let n = t.target;
2403
2361
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
2404
2362
  };
2405
- return K(() => [e.target.pos, e.target.latex], () => {
2406
- t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
2407
- }), Cn(() => {
2408
- St(e.editor, e.target, !0), u(), J(() => {
2363
+ return W(() => [e.target.pos, e.target.latex], () => {
2364
+ t.value = e.target.latex, a.value = dt(e.editor, e.target), q(u);
2365
+ }), G(() => {
2366
+ gt(e.editor, e.target, !0), u(), q(() => {
2409
2367
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
2410
2368
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
2411
- }), q(() => {
2412
- St(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2369
+ }), K(() => {
2370
+ gt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2413
2371
  }), () => {
2414
2372
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
2415
2373
  ref: i,
@@ -2422,7 +2380,7 @@ var Jr = Y({
2422
2380
  },
2423
2381
  onKeydown: f
2424
2382
  };
2425
- return e.target.kind === "inline" ? H("form", {
2383
+ return e.target.kind === "inline" ? B("form", {
2426
2384
  ref: r,
2427
2385
  class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
2428
2386
  "aria-label": a,
@@ -2437,22 +2395,22 @@ var Jr = Y({
2437
2395
  onSubmit: (e) => {
2438
2396
  e.preventDefault(), d();
2439
2397
  }
2440
- }, [H("label", {
2398
+ }, [B("label", {
2441
2399
  class: "markweave-math-inline-source",
2442
2400
  "data-testid": "markweave-math-inline-source"
2443
2401
  }, [
2444
- H("span", { attrs: { "aria-hidden": "true" } }, "$"),
2445
- H("input", {
2402
+ B("span", { attrs: { "aria-hidden": "true" } }, "$"),
2403
+ B("input", {
2446
2404
  ...u,
2447
2405
  "aria-label": c.value.latexLabel,
2448
2406
  size: Math.max(t.value.length, 1)
2449
2407
  }),
2450
- H("span", { attrs: { "aria-hidden": "true" } }, "$")
2451
- ]), H("div", {
2408
+ B("span", { attrs: { "aria-hidden": "true" } }, "$")
2409
+ ]), B("div", {
2452
2410
  class: "markweave-math-inline-preview",
2453
2411
  "data-error": o.value.error ? "true" : "false",
2454
2412
  "data-testid": "markweave-math-editor-preview"
2455
- }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
2413
+ }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])]) : B("form", {
2456
2414
  ref: r,
2457
2415
  class: "markweave-math-editor-popover markweave-math-editor-popover--block",
2458
2416
  "aria-label": a,
@@ -2468,39 +2426,39 @@ var Jr = Y({
2468
2426
  e.preventDefault(), d();
2469
2427
  }
2470
2428
  }, [
2471
- H("div", { class: "markweave-math-block-toolbar" }, [
2472
- H("span", null, c.value.label),
2473
- Z(Rn, c.value.label, 15, 1.75),
2474
- H("button", {
2429
+ B("div", { class: "markweave-math-block-toolbar" }, [
2430
+ B("span", null, c.value.label),
2431
+ Z(jn, c.value.label, 15, 1.75),
2432
+ B("button", {
2475
2433
  type: "submit",
2476
2434
  title: c.value.apply,
2477
2435
  "aria-label": c.value.apply,
2478
2436
  disabled: !s.value,
2479
2437
  "data-testid": "markweave-math-editor-apply"
2480
- }, [Z(Pn, c.value.apply, 16, 2)])
2438
+ }, [Z(Dn, c.value.apply, 16, 2)])
2481
2439
  ]),
2482
- H("label", {
2440
+ B("label", {
2483
2441
  class: "markweave-math-block-source",
2484
2442
  "data-testid": "markweave-math-block-source"
2485
2443
  }, [
2486
- H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2487
- H("textarea", {
2444
+ B("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2445
+ B("textarea", {
2488
2446
  ...u,
2489
2447
  "aria-label": c.value.latexLabel,
2490
2448
  rows: 3
2491
2449
  }),
2492
- H("span", { attrs: { "aria-hidden": "true" } }, "$$")
2450
+ B("span", { attrs: { "aria-hidden": "true" } }, "$$")
2493
2451
  ]),
2494
- H("div", {
2452
+ B("div", {
2495
2453
  class: "markweave-math-block-preview",
2496
2454
  "data-error": o.value.error ? "true" : "false",
2497
2455
  "data-math-number": String(l.value),
2498
2456
  "data-testid": "markweave-math-editor-preview"
2499
- }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
2457
+ }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])
2500
2458
  ]);
2501
2459
  };
2502
2460
  }
2503
- }), Xr = Y({
2461
+ }), Hr = J({
2504
2462
  name: "MarkweaveVueSlashCommandMenu",
2505
2463
  props: {
2506
2464
  commands: {
@@ -2537,7 +2495,7 @@ var Jr = Y({
2537
2495
  }
2538
2496
  },
2539
2497
  setup(e) {
2540
- let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = G(() => {
2498
+ let t = V(""), n = V(null), r = V(null), i = V(!1), a = V(""), o = V(0), s = U(() => {
2541
2499
  let t = a.value.trim().toLowerCase();
2542
2500
  return (t ? e.messages.slash.emojiItems.filter((e) => [
2543
2501
  e.emoji,
@@ -2559,13 +2517,13 @@ var Jr = Y({
2559
2517
  } : {
2560
2518
  kind: e.inputCommand.uploadKind ?? "attachment",
2561
2519
  trigger: "slash-command",
2562
- source: L(t.value)
2520
+ source: P(t.value)
2563
2521
  };
2564
2522
  if (!n.value && !t.value.trim()) {
2565
2523
  r.value = e.messages.slash.uploadRequiredError;
2566
2524
  return;
2567
2525
  }
2568
- let a = await R(i, e.onUpload);
2526
+ let a = await I(i, e.onUpload);
2569
2527
  e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
2570
2528
  } catch (t) {
2571
2529
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -2592,32 +2550,32 @@ var Jr = Y({
2592
2550
  group: t,
2593
2551
  commands: e.commands.filter((e) => e.group === t)
2594
2552
  })).filter((e) => e.commands.length);
2595
- return H("div", {
2553
+ return B("div", {
2596
2554
  class: "markweave-slash-layer",
2597
2555
  style: { display: "contents" },
2598
2556
  "data-testid": "markweave-slash-layer"
2599
- }, [H("div", {
2557
+ }, [B("div", {
2600
2558
  class: "markweave-slash-trigger",
2601
2559
  style: d,
2602
2560
  "aria-hidden": "true",
2603
2561
  "data-testid": "markweave-slash-trigger"
2604
- }, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), H("div", {
2562
+ }, [B("span", null, "/"), B("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), B("div", {
2605
2563
  class: "markweave-slash-menu",
2606
2564
  style: u,
2607
2565
  role: "listbox",
2608
2566
  "aria-label": e.messages.slash.ariaLabel,
2609
2567
  "data-placement": e.position.placement,
2610
2568
  "data-testid": "markweave-slash-menu"
2611
- }, [e.inputCommand?.inputKind === "emoji" ? H("div", {
2569
+ }, [e.inputCommand?.inputKind === "emoji" ? B("div", {
2612
2570
  class: "markweave-slash-subpanel",
2613
2571
  "data-testid": "markweave-slash-emoji-picker"
2614
2572
  }, [
2615
- H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
2573
+ B("div", { class: "markweave-slash-subpanel-header" }, [B("button", {
2616
2574
  type: "button",
2617
2575
  onMousedown: $,
2618
2576
  onClick: () => e.onInputCommandChange(null)
2619
- }, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
2620
- H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
2577
+ }, e.messages.common.back), B("span", null, e.messages.slash.emojiTitle)]),
2578
+ B("label", { class: "markweave-slash-input" }, [B("span", null, "/"), B("input", {
2621
2579
  autofocus: !0,
2622
2580
  value: a.value,
2623
2581
  placeholder: e.messages.slash.emojiSearchPlaceholder,
@@ -2628,11 +2586,11 @@ var Jr = Y({
2628
2586
  t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = s.value.length ? (o.value + 1) % s.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = s.value.length ? (o.value - 1 + s.value.length) % s.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), l(o.value));
2629
2587
  }
2630
2588
  })]),
2631
- H("div", {
2589
+ B("div", {
2632
2590
  class: "markweave-slash-emoji-grid",
2633
2591
  role: "listbox",
2634
2592
  "aria-label": e.messages.slash.emojiTitle
2635
- }, s.value.map((e, t) => H("button", {
2593
+ }, s.value.map((e, t) => B("button", {
2636
2594
  key: `${e.emoji}-${e.label}`,
2637
2595
  type: "button",
2638
2596
  role: "option",
@@ -2641,17 +2599,17 @@ var Jr = Y({
2641
2599
  onMouseenter: () => o.value = t,
2642
2600
  onMousedown: $,
2643
2601
  onClick: () => l(t)
2644
- }, [H("span", null, e.emoji), H("small", null, e.label)])))
2645
- ]) : e.inputCommand?.inputKind === "upload" ? H("div", {
2602
+ }, [B("span", null, e.emoji), B("small", null, e.label)])))
2603
+ ]) : e.inputCommand?.inputKind === "upload" ? B("div", {
2646
2604
  class: "markweave-slash-subpanel",
2647
2605
  "data-testid": "markweave-slash-upload-panel"
2648
2606
  }, [
2649
- H("div", { class: "markweave-slash-upload-header" }, [H("button", {
2607
+ B("div", { class: "markweave-slash-upload-header" }, [B("button", {
2650
2608
  type: "button",
2651
2609
  onMousedown: $,
2652
2610
  onClick: () => e.onInputCommandChange(null)
2653
- }, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
2654
- H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
2611
+ }, e.messages.common.back), B("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
2612
+ B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.slash.uploadValueLabel), B("input", {
2655
2613
  autofocus: !0,
2656
2614
  value: t.value,
2657
2615
  placeholder: e.messages.slash.uploadValuePlaceholder,
@@ -2662,32 +2620,32 @@ var Jr = Y({
2662
2620
  e.key === "Enter" && (e.preventDefault(), c());
2663
2621
  }
2664
2622
  })]),
2665
- H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
2623
+ B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.common.file), B("input", {
2666
2624
  type: "file",
2667
2625
  onChange: (e) => n.value = e.target.files?.[0] ?? null
2668
2626
  })]),
2669
- r.value ? H("div", {
2627
+ r.value ? B("div", {
2670
2628
  class: "markweave-slash-upload-error",
2671
2629
  role: "alert"
2672
2630
  }, r.value) : null,
2673
- H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
2631
+ B("div", { class: "markweave-slash-upload-actions" }, [B("button", {
2674
2632
  type: "button",
2675
2633
  onMousedown: $,
2676
2634
  onClick: () => e.onInputCommandChange(null)
2677
- }, e.messages.common.cancel), H("button", {
2635
+ }, e.messages.common.cancel), B("button", {
2678
2636
  type: "button",
2679
2637
  "data-primary": "true",
2680
2638
  disabled: i.value,
2681
2639
  onMousedown: $,
2682
2640
  onClick: c
2683
2641
  }, e.messages.common.insert)])
2684
- ]) : e.commands.length ? H("div", { class: "markweave-slash-command-list" }, f.map((t) => H("section", {
2642
+ ]) : e.commands.length ? B("div", { class: "markweave-slash-command-list" }, f.map((t) => B("section", {
2685
2643
  key: t.group,
2686
2644
  class: "markweave-slash-group",
2687
2645
  "aria-label": t.group
2688
- }, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2689
- let n = e.commands.indexOf(t) === e.state.activeIndex, r = jt(t);
2690
- return H("button", {
2646
+ }, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2647
+ let n = e.commands.indexOf(t) === e.state.activeIndex, r = Tt(t);
2648
+ return B("button", {
2691
2649
  key: t.id,
2692
2650
  type: "button",
2693
2651
  role: "option",
@@ -2709,18 +2667,18 @@ var Jr = Y({
2709
2667
  }
2710
2668
  }
2711
2669
  }, [
2712
- Gr(t.icon),
2713
- H("span", null, t.label),
2714
- t.disabledReason ? H("small", null, t.disabledReason) : null
2670
+ Lr(t.icon),
2671
+ B("span", null, t.label),
2672
+ t.disabledReason ? B("small", null, t.disabledReason) : null
2715
2673
  ]);
2716
- })]))) : H("div", {
2674
+ })]))) : B("div", {
2717
2675
  class: "markweave-slash-menu__empty",
2718
2676
  role: "option",
2719
2677
  "aria-disabled": "true"
2720
2678
  }, e.messages.slash.noResults)])]);
2721
2679
  };
2722
2680
  }
2723
- }), Zr = Y({
2681
+ }), Ur = J({
2724
2682
  name: "MarkweaveVueTableControls",
2725
2683
  props: {
2726
2684
  editor: {
@@ -2753,12 +2711,12 @@ var Jr = Y({
2753
2711
  }
2754
2712
  },
2755
2713
  setup(e) {
2756
- let t = U(null), n = U("row-edge"), r = U(null), 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(null), p = null, m = G(() => e.active ? Ht(e.editor.state) : Lr), h = G(() => en(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = G(() => en(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = G(() => Qt(e.editor)), v = G(() => _.value.length > 0), y = G(() => t.value ? an(e.editor, t.value) : []), b = () => {
2714
+ let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? It(e.editor.state) : kr), h = U(() => Jt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Jt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Kt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Qt(e.editor, t.value) : []), b = () => {
2757
2715
  p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
2758
2716
  }, x = (e) => {
2759
2717
  b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
2760
2718
  s.value = null, p = null;
2761
- }, ln));
2719
+ }, nn));
2762
2720
  }, S = () => {
2763
2721
  if (!e.active) {
2764
2722
  r.value = null, i.value = null, a.value = null, x(null);
@@ -2769,16 +2727,16 @@ var Jr = Y({
2769
2727
  r.value = null, i.value = null, a.value = null;
2770
2728
  return;
2771
2729
  }
2772
- let s = o.getBoundingClientRect(), c = h.value ? $t(e.editor, h.value) : null, l = g.value ? $t(e.editor, g.value) : null, u = v.value ? on(e.editor) : null;
2773
- c ? r.value = qt({
2730
+ let s = o.getBoundingClientRect(), c = h.value ? qt(e.editor, h.value) : null, l = g.value ? qt(e.editor, g.value) : null, u = v.value ? $t(e.editor) : null;
2731
+ c ? r.value = Vt({
2774
2732
  targetRect: c,
2775
2733
  frameRect: s,
2776
2734
  kind: "row"
2777
- }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = qt({
2735
+ }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Vt({
2778
2736
  targetRect: l,
2779
2737
  frameRect: s,
2780
2738
  kind: "column"
2781
- }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = qt({
2739
+ }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Vt({
2782
2740
  targetRect: u,
2783
2741
  frameRect: s,
2784
2742
  kind: "selection"
@@ -2793,13 +2751,13 @@ var Jr = Y({
2793
2751
  o.value = null;
2794
2752
  return;
2795
2753
  }
2796
- let a = i.getBoundingClientRect(), s = t.value === "row" ? Zt(e.editor)?.getBoundingClientRect() : null, c = s ? {
2754
+ let a = i.getBoundingClientRect(), s = t.value === "row" ? Gt(e.editor)?.getBoundingClientRect() : null, c = s ? {
2797
2755
  left: a.left,
2798
2756
  top: s.top,
2799
2757
  width: a.width,
2800
2758
  height: a.height
2801
2759
  } : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
2802
- o.value = Kt({
2760
+ o.value = Bt({
2803
2761
  anchorRect: c,
2804
2762
  frameRect: p,
2805
2763
  menuSize: {
@@ -2811,40 +2769,40 @@ var Jr = Y({
2811
2769
  }, w = () => {
2812
2770
  S(), C();
2813
2771
  }, T = () => {
2814
- J(w);
2772
+ q(w);
2815
2773
  }, E = (e, r) => {
2816
2774
  let i = t.value === e && n.value === r;
2817
2775
  n.value = r, t.value = i ? null : e, T();
2818
- }, D = () => {
2819
- e.editor.view.dispatch(zt(e.editor.state.tr, null));
2820
- }, O = (t, n) => {
2776
+ }, ee = () => {
2777
+ e.editor.view.dispatch(Nt(e.editor.state.tr, null));
2778
+ }, D = (t, n) => {
2821
2779
  let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
2822
- r !== null && cn(e.editor, r, t, { visualIndex: i }), E(t, n);
2823
- }, k = () => {
2824
- D(), E("selection", "selection-edge");
2825
- }, A = (n = !1) => {
2780
+ r !== null && tn(e.editor, r, t, { visualIndex: i }), E(t, n);
2781
+ }, O = () => {
2782
+ ee(), E("selection", "selection-edge");
2783
+ }, k = (n = !1) => {
2826
2784
  t.value = null, o.value = null, n && e.editor.view.focus();
2827
- }, j = async (n, r) => {
2828
- let i = await Yt({
2785
+ }, A = async (n, r) => {
2786
+ let i = await Ut({
2829
2787
  editor: e.editor,
2830
2788
  commandId: n,
2831
2789
  menu: r ?? t.value ?? "selection",
2832
2790
  messages: e.messages
2833
2791
  });
2834
2792
  return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
2835
- }, M = (t) => {
2836
- let n = tn(e.editor, t);
2837
- n && e.onEditWithAi?.(n), A(!0);
2793
+ }, j = (t) => {
2794
+ let n = Yt(e.editor, t);
2795
+ n && e.onEditWithAi?.(n), k(!0);
2796
+ }, M = (e) => {
2797
+ !t.value || e.key !== "Escape" || k(!0);
2838
2798
  }, N = (e) => {
2839
- !t.value || e.key !== "Escape" || A(!0);
2840
- }, P = (e) => {
2841
- t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
2799
+ t.value && (e.target instanceof Node && c.value?.contains(e.target) || k());
2842
2800
  };
2843
- Cn(() => {
2844
- w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", P);
2845
- }), q(() => {
2846
- b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", P);
2847
- }), K(() => [
2801
+ G(() => {
2802
+ w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", N);
2803
+ }), K(() => {
2804
+ b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", N);
2805
+ }), W(() => [
2848
2806
  e.active,
2849
2807
  m.value.activeCellPos,
2850
2808
  m.value.selectionFrom,
@@ -2855,11 +2813,11 @@ var Jr = Y({
2855
2813
  t.value,
2856
2814
  n.value
2857
2815
  ], T, { flush: "post" });
2858
- let F = () => t.value ? H("div", {
2816
+ let P = () => t.value ? B("div", {
2859
2817
  ref: f,
2860
2818
  class: "markweave-table-menu",
2861
2819
  role: "menu",
2862
- "aria-label": un(t.value, e.messages),
2820
+ "aria-label": rn(t.value, e.messages),
2863
2821
  "data-testid": "markweave-table-menu",
2864
2822
  "data-positioned": o.value ? "true" : "false",
2865
2823
  style: o.value ? {
@@ -2867,8 +2825,8 @@ var Jr = Y({
2867
2825
  top: `${o.value.top}px`
2868
2826
  } : void 0
2869
2827
  }, y.value.map((n, r) => {
2870
- let i = nn(n), a = r === 0 ? i : nn(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Jt(e.editor, n.commandId), c = rn(n, e.messages);
2871
- return H("button", {
2828
+ let i = Xt(n), a = r === 0 ? i : Xt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Ht(e.editor, n.commandId), c = Zt(n, e.messages);
2829
+ return B("button", {
2872
2830
  key: `${n.id}-${r}`,
2873
2831
  type: "button",
2874
2832
  role: "menuitem",
@@ -2883,15 +2841,15 @@ var Jr = Y({
2883
2841
  onClick: () => {
2884
2842
  if (s) {
2885
2843
  if (n.commandId === null) {
2886
- M(t.value === "row" || t.value === "column" ? t.value : "selection");
2844
+ j(t.value === "row" || t.value === "column" ? t.value : "selection");
2887
2845
  return;
2888
2846
  }
2889
- j(n.commandId).finally(() => A());
2847
+ A(n.commandId).finally(() => k());
2890
2848
  }
2891
2849
  }
2892
2850
  }, c);
2893
2851
  })) : null;
2894
- return () => e.active ? H("div", {
2852
+ return () => e.active ? B("div", {
2895
2853
  ref: c,
2896
2854
  class: "markweave-table-controls",
2897
2855
  "data-testid": "markweave-table-controls",
@@ -2899,7 +2857,7 @@ var Jr = Y({
2899
2857
  "data-open-menu": t.value ?? "none",
2900
2858
  "data-positioned": r.value || i.value || a.value ? "true" : "false"
2901
2859
  }, [
2902
- s.value ? H("div", {
2860
+ s.value ? B("div", {
2903
2861
  class: "markweave-table-copy-feedback",
2904
2862
  role: "status",
2905
2863
  "aria-live": "polite",
@@ -2907,8 +2865,8 @@ var Jr = Y({
2907
2865
  "data-copy-kind": s.value.kind,
2908
2866
  "data-text-length": s.value.textLength,
2909
2867
  "data-html-length": s.value.htmlLength
2910
- }, Xt(s.value)) : null,
2911
- r.value ? H("button", {
2868
+ }, Wt(s.value)) : null,
2869
+ r.value ? B("button", {
2912
2870
  ref: l,
2913
2871
  type: "button",
2914
2872
  class: "markweave-table-edge-handle markweave-table-edge-handle--row",
@@ -2926,9 +2884,9 @@ var Jr = Y({
2926
2884
  top: `${r.value.top}px`
2927
2885
  },
2928
2886
  onMousedown: $,
2929
- onClick: () => O("row", "row-edge")
2930
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2931
- i.value ? H("button", {
2887
+ onClick: () => D("row", "row-edge")
2888
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2889
+ i.value ? B("button", {
2932
2890
  ref: u,
2933
2891
  type: "button",
2934
2892
  class: "markweave-table-edge-handle markweave-table-edge-handle--column",
@@ -2946,9 +2904,9 @@ var Jr = Y({
2946
2904
  top: `${i.value.top}px`
2947
2905
  },
2948
2906
  onMousedown: $,
2949
- onClick: () => O("column", "column-edge")
2950
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2951
- v.value && a.value ? H("button", {
2907
+ onClick: () => D("column", "column-edge")
2908
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2909
+ v.value && a.value ? B("button", {
2952
2910
  ref: d,
2953
2911
  type: "button",
2954
2912
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
@@ -2962,12 +2920,12 @@ var Jr = Y({
2962
2920
  top: `${a.value.top}px`
2963
2921
  },
2964
2922
  onMousedown: $,
2965
- onClick: k
2966
- }, [H("span", { "aria-hidden": "true" }, "...")]) : null,
2967
- F()
2923
+ onClick: O
2924
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2925
+ P()
2968
2926
  ]) : null;
2969
2927
  }
2970
- }), Qr = Y({
2928
+ }), Wr = J({
2971
2929
  name: "MarkweaveVueTableSelectionOverlay",
2972
2930
  props: {
2973
2931
  editor: {
@@ -2980,18 +2938,18 @@ var Jr = Y({
2980
2938
  }
2981
2939
  },
2982
2940
  setup(e) {
2983
- let t = U(null), n = () => {
2941
+ let t = V(null), n = () => {
2984
2942
  if (e.focusState.mode !== "cell-selection") {
2985
2943
  t.value = null;
2986
2944
  return;
2987
2945
  }
2988
- t.value = sn(e.editor, Ut(e.editor.state));
2946
+ t.value = en(e.editor, Lt(e.editor.state));
2989
2947
  };
2990
- return Cn(() => {
2948
+ return G(() => {
2991
2949
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
2992
- }), q(() => {
2950
+ }), K(() => {
2993
2951
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
2994
- }), K(() => [
2952
+ }), W(() => [
2995
2953
  e.focusState.activeCellPos,
2996
2954
  e.focusState.anchorCellPos,
2997
2955
  e.focusState.mode,
@@ -2999,10 +2957,10 @@ var Jr = Y({
2999
2957
  e.focusState.selectionFrom,
3000
2958
  e.focusState.selectionTo
3001
2959
  ], () => {
3002
- J(n);
2960
+ q(n);
3003
2961
  }, { flush: "post" }), () => {
3004
2962
  let e = t.value;
3005
- return e ? H("div", {
2963
+ return e ? B("div", {
3006
2964
  "aria-hidden": "true",
3007
2965
  class: "markweave-table-selection-overlay",
3008
2966
  "data-anchor-cell-pos": e.anchorCellPos ?? "",
@@ -3023,7 +2981,7 @@ var Jr = Y({
3023
2981
  }) : null;
3024
2982
  };
3025
2983
  }
3026
- }), $r = Y({
2984
+ }), Gr = J({
3027
2985
  name: "MarkweaveVueCodeBlockControls",
3028
2986
  props: {
3029
2987
  editor: {
@@ -3052,234 +3010,200 @@ var Jr = Y({
3052
3010
  }
3053
3011
  },
3054
3012
  setup(e) {
3055
- let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U([]), l = U(null), u = U(!1), d = U(""), f = U(-1), p = U(null), m = U(!1), h = U(null), g = U(null), _ = U(!1), v = U({
3013
+ let t = V(null), n = V(null), r = V(null), i = V(null), a = V(null), o = V([]), s = V(null), c = V(!1), l = V(""), u = V(null), d = V(!1), f = V(null), p = V(null), m = V(!1), h = V({
3056
3014
  active: !1,
3057
3015
  lastX: 0,
3058
3016
  lastY: 0
3059
- }), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value, tt(e.editor, o.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3017
+ }), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Qe(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3060
3018
  ...e.state,
3061
3019
  pos: e.state.pos,
3062
3020
  active: !0
3063
- } : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => ot(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), j = G(() => T.value ? Je(T.value.language) : Je("text")), M = G(() => p.value?.status ?? "idle"), N = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => D.value && N.value === "preview"), F = G(() => (x.value, y.value, b.value, it(e.editor))), I = G(() => `${b.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => Qe(d.value)), ee = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), R = () => {
3064
- S !== null && (window.clearTimeout(S), S = null);
3065
- }, z = (e) => {
3066
- R(), p.value = e, e && (S = window.setTimeout(() => {
3067
- p.value = null, S = null;
3068
- }, Ve));
3021
+ } : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => nt(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Ke(S.value.language) : Ke("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, et(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), N = U(() => Xe(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), F = () => {
3022
+ y !== null && (window.clearTimeout(y), y = null);
3023
+ }, I = (e) => {
3024
+ F(), u.value = e, e && (y = window.setTimeout(() => {
3025
+ u.value = null, y = null;
3026
+ }, Be));
3069
3027
  }, te = () => {
3070
- h.value = null, g.value = null, _.value = !1, v.value = {
3028
+ f.value = null, p.value = null, m.value = !1, h.value = {
3071
3029
  active: !1,
3072
3030
  lastX: 0,
3073
3031
  lastY: 0
3074
3032
  }, e.editor.view.focus();
3075
- }, B = () => {
3033
+ }, L = () => {
3076
3034
  let n = t.value;
3077
3035
  if (!n) return;
3078
- if (!nt(n) || F.value.length === 0) {
3079
- c.value = [];
3036
+ if (!$e(n) || j.value.length === 0) {
3037
+ o.value = [];
3080
3038
  return;
3081
3039
  }
3082
- let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
3083
- let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
3084
- return n ? [Ke(t, n, r)] : [];
3040
+ let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
3041
+ let n = Ye(Je(e.editor, t.pos, t.mermaidPreviewMode), r);
3042
+ return n ? [We(t, n, r)] : [];
3085
3043
  });
3086
- c.value = st(c.value, i, F.value.map((e) => e.pos));
3087
- }, V = () => {
3088
- if (!k.value || !T.value) {
3089
- s.value = null, l.value = null;
3044
+ o.value = rt(o.value, i, j.value.map((e) => e.pos));
3045
+ }, R = () => {
3046
+ if (!E.value || !S.value) {
3047
+ a.value = null, s.value = null;
3090
3048
  return;
3091
3049
  }
3092
3050
  let r = t.value;
3093
3051
  if (!r) return;
3094
- let i = Xe(e.editor, T.value.pos, N.value), a = r.getBoundingClientRect(), o = Ze(i, a);
3095
- if (!o) {
3096
- s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
3052
+ let i = Je(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Ye(i, o);
3053
+ if (!l) {
3054
+ a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
3097
3055
  return;
3098
3056
  }
3099
- if (s.value = We(T.value.pos, o, a), u.value && n.value) {
3057
+ if (a.value = He(S.value.pos, l, o), c.value && n.value) {
3100
3058
  let e = n.value.getBoundingClientRect();
3101
- l.value = ze({
3102
- overlayRect: a,
3059
+ s.value = Re({
3060
+ overlayRect: o,
3103
3061
  buttonRect: e,
3104
3062
  windowWidth: window.innerWidth,
3105
3063
  windowHeight: window.innerHeight
3106
3064
  });
3107
3065
  }
3108
- }, re = async () => {
3066
+ }, ne = async () => {
3109
3067
  if (e.readOnly) {
3110
- if (!T.value) return;
3111
- let e = await He(T.value.text);
3112
- z(Pe(T.value, e ? "copied" : "failed"));
3068
+ if (!S.value) return;
3069
+ let e = await Ve(S.value.text);
3070
+ I(Ne(S.value, e ? "copied" : "failed"));
3113
3071
  return;
3114
3072
  }
3115
- if (!qe(e.editor, T.value)) return;
3116
- let t = await Me(e.editor);
3117
- z(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
3118
- }, ie = (t, n) => {
3073
+ if (!Ge(e.editor, S.value)) return;
3074
+ let t = await je(e.editor);
3075
+ I(Ne(Me(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
3076
+ }, re = (t, n) => {
3119
3077
  if (e.readOnly) {
3120
- Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
3078
+ St(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
3121
3079
  return;
3122
3080
  }
3123
3081
  let r = e.state.active && e.state.pos === t.pos;
3124
- Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
3125
- }, ae = (t) => {
3126
- if (e.readOnly || !T.value) return;
3127
- let n = e.state.active && e.state.pos === T.value.pos;
3128
- Le(e.editor, T.value.pos, t) && (t === "mermaid" && Re(e.editor, T.value.pos, "preview") && e.onMermaidModeChange("preview"), u.value = !1, d.value = "", f.value = -1, x.value += 1, n && e.editor.view.focus());
3082
+ Le(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
3083
+ }, ie = (t) => {
3084
+ if (e.readOnly || !S.value) return;
3085
+ let n = e.state.active && e.state.pos === S.value.pos;
3086
+ Ie(e.editor, S.value.pos, t) && (t === "mermaid" && Le(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
3087
+ }, ae = () => {
3088
+ e.readOnly || !S.value || Fe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
3129
3089
  }, oe = () => {
3130
- u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(L.value, T.value?.language ?? null) : -1;
3131
- }, se = (e) => {
3132
- let t = Qe(e);
3133
- d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
3134
- }, ce = (t) => {
3135
- if (!t.isComposing) {
3136
- if (t.key === "ArrowDown" || t.key === "ArrowUp") {
3137
- t.preventDefault(), f.value = lt(f.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
3138
- return;
3139
- }
3140
- if (t.key === "Enter") {
3141
- let e = L.value[f.value];
3142
- e && (t.preventDefault(), ae(e.language));
3143
- return;
3144
- }
3145
- t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
3146
- }
3147
- }, le = () => {
3148
- e.readOnly || !T.value || Ie(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
3149
- }, ue = () => {
3150
- if (!T.value) return;
3151
- let t = at(e.editor, T.value.pos);
3152
- t && ne({
3153
- data: new Blob([t], { type: "image/svg+xml" }),
3154
- fileName: "markweave-mermaid.svg",
3155
- onSettled: () => e.editor.view.focus(),
3156
- ownerDocument: document
3157
- });
3158
- }, de = () => {
3159
- if (!T.value) return;
3160
- let t = at(e.editor, T.value.pos);
3161
- t && (h.value = Ge(t), g.value = null, _.value = !1, v.value = {
3090
+ if (!S.value) return;
3091
+ let t = tt(e.editor, S.value.pos);
3092
+ if (!t) return;
3093
+ let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
3094
+ i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
3095
+ }, se = () => {
3096
+ if (!S.value) return;
3097
+ let t = tt(e.editor, S.value.pos);
3098
+ t && (f.value = Ue(t), p.value = null, m.value = !1, h.value = {
3162
3099
  active: !1,
3163
3100
  lastX: 0,
3164
3101
  lastY: 0
3165
3102
  });
3166
- }, fe = (e) => {
3167
- h.value = h.value ? {
3168
- ...h.value,
3169
- scale: Be(h.value.scale + e)
3103
+ }, ce = (e) => {
3104
+ f.value = f.value ? {
3105
+ ...f.value,
3106
+ scale: ze(f.value.scale + e)
3170
3107
  } : null;
3171
- }, pe = () => {
3172
- h.value = h.value ? Ge(h.value.svg) : null, v.value = {
3108
+ }, le = () => {
3109
+ f.value = f.value ? Ue(f.value.svg) : null, h.value = {
3173
3110
  active: !1,
3174
3111
  lastX: 0,
3175
3112
  lastY: 0
3176
- }, _.value = !1;
3177
- }, me = (e) => {
3178
- e.preventDefault(), fe(e.deltaY < 0 ? ct : -ct);
3179
- }, he = (e) => {
3180
- e.button === 0 && (e.preventDefault(), v.value = {
3113
+ }, m.value = !1;
3114
+ }, z = (e) => {
3115
+ e.preventDefault(), ce(e.deltaY < 0 ? it : -it);
3116
+ }, ue = (e) => {
3117
+ e.button === 0 && (e.preventDefault(), h.value = {
3181
3118
  active: !0,
3182
3119
  lastX: e.clientX,
3183
3120
  lastY: e.clientY
3184
- }, _.value = !0);
3185
- }, ge = (e) => {
3186
- let t = v.value;
3121
+ }, m.value = !0);
3122
+ }, de = (e) => {
3123
+ let t = h.value;
3187
3124
  if (!t.active) return;
3188
3125
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
3189
- v.value = {
3126
+ h.value = {
3190
3127
  active: !0,
3191
3128
  lastX: e.clientX,
3192
3129
  lastY: e.clientY
3193
- }, h.value = ut(h.value, n, r);
3194
- }, _e = () => {
3195
- v.value = {
3130
+ }, f.value = at(f.value, n, r);
3131
+ }, fe = () => {
3132
+ h.value = {
3196
3133
  active: !1,
3197
3134
  lastX: 0,
3198
3135
  lastY: 0
3199
- }, _.value = !1;
3136
+ }, m.value = !1;
3200
3137
  };
3201
- K(() => e.readOnly, (e) => {
3202
- e && (u.value = !1, d.value = "");
3203
- }), K(ee, () => {
3204
- z(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
3205
- }), K(u, async (e) => {
3206
- if (!e) {
3207
- f.value = -1;
3208
- return;
3209
- }
3210
- await J(), V(), r.value?.focus({ preventScroll: !0 });
3211
- }), K(() => [
3212
- u.value,
3213
- d.value,
3214
- f.value
3138
+ W(() => e.readOnly, (e) => {
3139
+ e && (c.value = !1, l.value = "");
3140
+ }), W(P, () => {
3141
+ I(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
3142
+ }), W(c, async (e) => {
3143
+ e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
3144
+ }), W(() => [
3145
+ E.value,
3146
+ g.value,
3147
+ S.value?.pos ?? null,
3148
+ c.value,
3149
+ k.value
3215
3150
  ], async () => {
3216
- if (!u.value || f.value < 0) return;
3217
- await J();
3218
- let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
3219
- e && t && dt(e, t);
3220
- }, { flush: "post" }), K(() => [
3221
- k.value,
3222
- y.value,
3223
- T.value?.pos ?? null,
3224
- u.value,
3225
- N.value
3226
- ], async () => {
3227
- await J(), V();
3151
+ await q(), R();
3228
3152
  }, {
3229
3153
  flush: "post",
3230
3154
  immediate: !0
3231
- }), K(I, async () => {
3232
- await J(), B(), window.requestAnimationFrame(B);
3155
+ }), W(M, async () => {
3156
+ await q(), L(), window.requestAnimationFrame(L);
3233
3157
  }, {
3234
3158
  flush: "post",
3235
3159
  immediate: !0
3236
3160
  });
3237
- let ve = null;
3238
- return Cn(() => {
3239
- J(() => {
3161
+ let pe = null;
3162
+ return G(() => {
3163
+ q(() => {
3240
3164
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
3241
- if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
3242
- let r = et(e.editor, n.target), i = tt(e.editor, r), a = i && !ot(e.editor, i) ? i.pos : null;
3243
- o.value = o.value === a ? o.value : a;
3244
- }, i = () => {
3245
- u.value || (o.value = null);
3246
- }, a = (t) => {
3165
+ if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
3166
+ let r = Ze(e.editor, n.target), a = Qe(e.editor, r), o = a && !nt(e.editor, a) ? a.pos : null;
3167
+ i.value = i.value === o ? i.value : o;
3168
+ }, a = () => {
3169
+ c.value || (i.value = null);
3170
+ }, o = (t) => {
3247
3171
  if (t.key === "Escape") {
3248
- if (h.value) {
3172
+ if (f.value) {
3249
3173
  te();
3250
3174
  return;
3251
3175
  }
3252
- u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
3176
+ c.value && (c.value = !1, e.editor.view.focus());
3253
3177
  }
3254
3178
  }, s = (e) => {
3255
- u.value && (e.target instanceof Node && t.value?.contains(e.target) || (u.value = !1, f.value = -1));
3256
- }, c = ({ transaction: e }) => {
3257
- e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
3179
+ c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
3180
+ }, l = ({ transaction: e }) => {
3181
+ e.getMeta(Ae) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ae) || yt(e)) && (v.value += 1);
3258
3182
  };
3259
- 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", s), e.editor.on("transaction", c), ve = () => {
3260
- 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", s), e.editor.off("transaction", c), R();
3183
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
3184
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), F();
3261
3185
  };
3262
3186
  });
3263
- }), q(() => {
3264
- ve?.(), ve = null, R();
3187
+ }), K(() => {
3188
+ pe?.(), pe = null, F();
3265
3189
  }), () => {
3266
- if (!k.value && F.value.length === 0 && !h.value) return null;
3267
- let o = s.value ? {
3268
- top: `${s.value.top}px`,
3269
- right: `${s.value.right}px`
3270
- } : void 0, p = l.value ? {
3271
- left: `${l.value.left}px`,
3272
- top: `${l.value.top}px`
3190
+ if (!E.value && j.value.length === 0 && !f.value) return null;
3191
+ let i = a.value ? {
3192
+ top: `${a.value.top}px`,
3193
+ right: `${a.value.right}px`
3194
+ } : void 0, u = s.value ? {
3195
+ left: `${s.value.left}px`,
3196
+ top: `${s.value.top}px`
3273
3197
  } : void 0;
3274
- return H("div", {
3198
+ return B("div", {
3275
3199
  ref: t,
3276
3200
  class: "markweave-codeblock-overlay",
3277
3201
  "data-testid": "markweave-codeblock-overlay",
3278
3202
  "data-read-only": e.readOnly ? "true" : "false"
3279
3203
  }, [
3280
- ...F.value.map((e) => {
3281
- let t = c.value.find((t) => t.pos === e.pos);
3282
- return H("div", {
3204
+ ...j.value.map((e) => {
3205
+ let t = o.value.find((t) => t.pos === e.pos);
3206
+ return B("div", {
3283
3207
  key: e.pos,
3284
3208
  class: "markweave-mermaid-tabs",
3285
3209
  "data-testid": "markweave-mermaid-tabs",
@@ -3289,253 +3213,241 @@ var Jr = Y({
3289
3213
  top: `${t.top}px`,
3290
3214
  left: `${t.left}px`
3291
3215
  } : void 0
3292
- }, ["code", "preview"].map((t) => H("button", {
3216
+ }, ["code", "preview"].map((t) => B("button", {
3293
3217
  key: t,
3294
3218
  type: "button",
3295
3219
  "data-testid": `markweave-mermaid-mode-${t}`,
3296
3220
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
3297
3221
  onMousedown: $,
3298
- onClick: () => ie(e, t)
3222
+ onClick: () => re(e, t)
3299
3223
  }, t === "code" ? "Code" : "Preview")));
3300
3224
  }),
3301
- k.value && T.value ? H("div", {
3225
+ E.value && S.value ? B("div", {
3302
3226
  class: "markweave-codeblock-controls",
3303
3227
  "data-testid": "markweave-codeblock-controls",
3304
- "data-positioned": s.value ? "true" : "false",
3305
- "data-collapsed": O.value ? "true" : "false",
3228
+ "data-positioned": a.value ? "true" : "false",
3229
+ "data-collapsed": T.value ? "true" : "false",
3306
3230
  "data-read-only": e.readOnly ? "true" : "false",
3307
3231
  "aria-label": "Code block controls",
3308
- style: o
3232
+ style: i
3309
3233
  }, [
3310
- e.readOnly ? H("span", {
3234
+ e.readOnly ? B("span", {
3311
3235
  class: "markweave-codeblock-language-button markweave-codeblock-language-label",
3312
3236
  "aria-label": "Code block language",
3313
3237
  "data-testid": "markweave-codeblock-language"
3314
- }, [H("span", null, j.value)]) : H("button", {
3238
+ }, [B("span", null, D.value)]) : B("button", {
3315
3239
  ref: n,
3316
3240
  type: "button",
3317
3241
  class: "markweave-codeblock-language-button",
3318
3242
  "aria-label": "Code block language",
3319
- "aria-expanded": u.value ? "true" : "false",
3243
+ "aria-expanded": c.value ? "true" : "false",
3320
3244
  "aria-haspopup": "listbox",
3321
3245
  "data-testid": "markweave-codeblock-language",
3322
3246
  onMousedown: $,
3323
- onClick: oe
3324
- }, [H("span", null, j.value), Q("chevron")]),
3325
- A.value ? H("button", {
3247
+ onClick: () => {
3248
+ c.value = !c.value;
3249
+ }
3250
+ }, [B("span", null, D.value), Q("chevron")]),
3251
+ ee.value ? B("button", {
3326
3252
  type: "button",
3327
3253
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
3328
- "aria-label": O.value ? "Expand code block" : "Collapse code block",
3329
- title: O.value ? "Expand code block" : "Collapse code block",
3254
+ "aria-label": T.value ? "Expand code block" : "Collapse code block",
3255
+ title: T.value ? "Expand code block" : "Collapse code block",
3330
3256
  "data-testid": "markweave-codeblock-collapse",
3331
- "data-collapsed": O.value ? "true" : "false",
3257
+ "data-collapsed": T.value ? "true" : "false",
3332
3258
  onMousedown: $,
3333
- onClick: le
3259
+ onClick: ae
3334
3260
  }, [Q("chevron")]) : null,
3335
- H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
3261
+ B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
3336
3262
  type: "button",
3337
3263
  class: "markweave-codeblock-icon-button",
3338
3264
  "aria-label": "Copy to clipboard",
3339
3265
  "data-testid": "markweave-codeblock-copy",
3340
- "data-copy-state": M.value,
3266
+ "data-copy-state": O.value,
3341
3267
  onMousedown: $,
3342
3268
  onMouseenter: () => {
3343
- m.value = !0;
3269
+ d.value = !0;
3344
3270
  },
3345
3271
  onMouseleave: () => {
3346
- m.value = !1;
3272
+ d.value = !1;
3347
3273
  },
3348
3274
  onFocus: () => {
3349
- m.value = !0;
3275
+ d.value = !0;
3350
3276
  },
3351
3277
  onBlur: () => {
3352
- m.value = !1;
3278
+ d.value = !1;
3353
3279
  },
3354
3280
  onClick: () => {
3355
- re();
3281
+ ne();
3356
3282
  }
3357
- }, [Q(M.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
3283
+ }, [Q(O.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
3358
3284
  class: "markweave-codeblock-tooltip",
3359
3285
  role: "tooltip",
3360
3286
  "data-testid": "markweave-codeblock-copy-tooltip"
3361
3287
  }, "Copy to clipboard") : null]),
3362
- D.value && N.value === "preview" ? H("div", {
3288
+ w.value && k.value === "preview" ? B("div", {
3363
3289
  class: "markweave-mermaid-preview-actions",
3364
3290
  "data-testid": "markweave-mermaid-preview-actions"
3365
- }, [H("button", {
3291
+ }, [B("button", {
3366
3292
  type: "button",
3367
3293
  class: "markweave-codeblock-icon-button",
3368
3294
  "aria-label": "Fullscreen Mermaid preview",
3369
3295
  "data-testid": "markweave-mermaid-fullscreen",
3370
- disabled: !P.value,
3296
+ disabled: !A.value,
3371
3297
  onMousedown: $,
3372
- onClick: de
3373
- }, [Q("expand")]), H("button", {
3298
+ onClick: se
3299
+ }, [Q("expand")]), B("button", {
3374
3300
  type: "button",
3375
3301
  class: "markweave-codeblock-icon-button",
3376
3302
  "aria-label": "Download Mermaid SVG",
3377
3303
  "data-testid": "markweave-mermaid-download",
3378
- disabled: !P.value,
3304
+ disabled: !A.value,
3379
3305
  onMousedown: $,
3380
- onClick: ue
3306
+ onClick: oe
3381
3307
  }, [Q("download")])]) : null
3382
3308
  ]) : null,
3383
- A.value && k.value && u.value && T.value ? H("div", {
3309
+ ee.value && E.value && c.value && S.value ? B("div", {
3384
3310
  class: "markweave-codeblock-language-menu",
3311
+ role: "listbox",
3312
+ "aria-label": "Code block languages",
3385
3313
  "data-testid": "markweave-codeblock-language-menu",
3386
- "data-positioned": l.value ? "true" : "false",
3387
- style: p
3388
- }, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
3314
+ "data-positioned": s.value ? "true" : "false",
3315
+ style: u
3316
+ }, [B("label", { class: "markweave-codeblock-language-search" }, [B("input", {
3389
3317
  ref: r,
3390
- role: "combobox",
3391
- "aria-autocomplete": "list",
3392
- "aria-controls": a.value ?? void 0,
3393
- "aria-expanded": "true",
3394
- "aria-activedescendant": a.value && L.value[f.value] ? $e(a.value, L.value[f.value].language) : void 0,
3395
- "aria-label": "Search code block languages",
3396
- value: d.value,
3318
+ value: l.value,
3397
3319
  placeholder: "Search...",
3398
3320
  "data-testid": "markweave-codeblock-language-search",
3399
3321
  onInput: (e) => {
3400
- se(e.target.value);
3322
+ l.value = e.target.value;
3401
3323
  },
3402
- onKeydown: ce
3403
- }), Q("search")]), H("div", {
3404
- ref: i,
3405
- id: a.value ?? void 0,
3406
- class: "markweave-codeblock-language-list",
3407
- role: "listbox",
3408
- "aria-label": "Code block languages"
3409
- }, L.value.map((e, t) => {
3410
- let n = T.value?.language === e.language, r = t === f.value;
3411
- return H("button", {
3324
+ onKeydown: (t) => {
3325
+ t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
3326
+ }
3327
+ }), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, N.value.map((e) => {
3328
+ let t = S.value?.language === e.language;
3329
+ return B("button", {
3412
3330
  key: e.language,
3413
- id: a.value ? $e(a.value, e.language) : void 0,
3414
3331
  type: "button",
3415
3332
  role: "option",
3416
- "aria-selected": n ? "true" : "false",
3333
+ "aria-selected": t ? "true" : "false",
3417
3334
  "data-testid": `markweave-codeblock-language-option-${e.language}`,
3418
- "data-active": n ? "true" : "false",
3419
- "data-highlighted": r ? "true" : "false",
3420
- "data-language-index": t,
3335
+ "data-active": t ? "true" : "false",
3421
3336
  onMousedown: $,
3422
- onMouseenter: () => {
3423
- f.value = t;
3424
- },
3425
- onClick: () => ae(e.language)
3426
- }, [H("span", null, e.label), n ? Q("check") : null]);
3337
+ onClick: () => ie(e.language)
3338
+ }, [B("span", null, e.label), t ? Q("check") : null]);
3427
3339
  }))]) : null,
3428
- h.value ? H("div", {
3340
+ f.value ? B("div", {
3429
3341
  class: "markweave-mermaid-fullscreen-layer",
3430
3342
  role: "dialog",
3431
3343
  "aria-modal": "true",
3432
3344
  "aria-label": "Mermaid preview",
3433
3345
  "data-testid": "markweave-mermaid-fullscreen-layer"
3434
3346
  }, [
3435
- H("div", {
3347
+ B("div", {
3436
3348
  class: "markweave-mermaid-fullscreen-toolbar",
3437
3349
  "data-testid": "markweave-mermaid-fullscreen-toolbar"
3438
3350
  }, [
3439
- H("button", {
3351
+ B("button", {
3440
3352
  type: "button",
3441
3353
  class: "markweave-mermaid-fullscreen-control",
3442
3354
  "aria-label": "Zoom out",
3443
3355
  "data-testid": "markweave-mermaid-fullscreen-zoom-out",
3444
3356
  onMouseenter: () => {
3445
- g.value = "zoom-out";
3357
+ p.value = "zoom-out";
3446
3358
  },
3447
3359
  onMouseleave: () => {
3448
- g.value = null;
3360
+ p.value = null;
3449
3361
  },
3450
3362
  onFocus: () => {
3451
- g.value = "zoom-out";
3363
+ p.value = "zoom-out";
3452
3364
  },
3453
3365
  onBlur: () => {
3454
- g.value = null;
3366
+ p.value = null;
3455
3367
  },
3456
- onClick: () => fe(-ct)
3368
+ onClick: () => ce(-it)
3457
3369
  }, [Q("zoomOut")]),
3458
- H("span", {
3370
+ B("span", {
3459
3371
  class: "markweave-mermaid-fullscreen-zoom-label",
3460
3372
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
3461
- }, Ye(h.value.scale)),
3462
- H("button", {
3373
+ }, qe(f.value.scale)),
3374
+ B("button", {
3463
3375
  type: "button",
3464
3376
  class: "markweave-mermaid-fullscreen-control",
3465
3377
  "aria-label": "Zoom in",
3466
3378
  "data-testid": "markweave-mermaid-fullscreen-zoom-in",
3467
3379
  onMouseenter: () => {
3468
- g.value = "zoom-in";
3380
+ p.value = "zoom-in";
3469
3381
  },
3470
3382
  onMouseleave: () => {
3471
- g.value = null;
3383
+ p.value = null;
3472
3384
  },
3473
3385
  onFocus: () => {
3474
- g.value = "zoom-in";
3386
+ p.value = "zoom-in";
3475
3387
  },
3476
3388
  onBlur: () => {
3477
- g.value = null;
3389
+ p.value = null;
3478
3390
  },
3479
- onClick: () => fe(ct)
3391
+ onClick: () => ce(it)
3480
3392
  }, [Q("zoomIn")]),
3481
- H("button", {
3393
+ B("button", {
3482
3394
  type: "button",
3483
3395
  class: "markweave-mermaid-fullscreen-control",
3484
3396
  "aria-label": "Reset zoom",
3485
3397
  "data-testid": "markweave-mermaid-fullscreen-reset",
3486
3398
  onMouseenter: () => {
3487
- g.value = "reset";
3399
+ p.value = "reset";
3488
3400
  },
3489
3401
  onMouseleave: () => {
3490
- g.value = null;
3402
+ p.value = null;
3491
3403
  },
3492
3404
  onFocus: () => {
3493
- g.value = "reset";
3405
+ p.value = "reset";
3494
3406
  },
3495
3407
  onBlur: () => {
3496
- g.value = null;
3408
+ p.value = null;
3497
3409
  },
3498
- onClick: pe
3410
+ onClick: le
3499
3411
  }, [Q("reset")]),
3500
- g.value ? H("span", {
3412
+ p.value ? B("span", {
3501
3413
  class: "markweave-mermaid-fullscreen-tooltip",
3502
3414
  role: "tooltip",
3503
3415
  "data-testid": "markweave-mermaid-fullscreen-tooltip"
3504
- }, g.value === "zoom-out" ? "Zoom out" : g.value === "zoom-in" ? "Zoom in" : "Reset") : null
3416
+ }, p.value === "zoom-out" ? "Zoom out" : p.value === "zoom-in" ? "Zoom in" : "Reset") : null
3505
3417
  ]),
3506
- H("button", {
3418
+ B("button", {
3507
3419
  type: "button",
3508
3420
  class: "markweave-mermaid-fullscreen-close",
3509
3421
  "aria-label": "Close fullscreen Mermaid preview",
3510
3422
  "data-testid": "markweave-mermaid-fullscreen-close",
3511
3423
  onClick: te
3512
3424
  }, [Q("close")]),
3513
- H("div", {
3425
+ B("div", {
3514
3426
  class: "markweave-mermaid-fullscreen-viewport",
3515
3427
  "data-testid": "markweave-mermaid-fullscreen-viewport",
3516
- "data-dragging": _.value ? "true" : "false",
3517
- onWheel: me,
3518
- onMousedown: he,
3519
- onMousemove: ge,
3520
- onMouseup: _e,
3521
- onMouseleave: _e
3522
- }, [H("div", {
3428
+ "data-dragging": m.value ? "true" : "false",
3429
+ onWheel: z,
3430
+ onMousedown: ue,
3431
+ onMousemove: de,
3432
+ onMouseup: fe,
3433
+ onMouseleave: fe
3434
+ }, [B("div", {
3523
3435
  class: "markweave-mermaid-fullscreen-content",
3524
3436
  "data-testid": "markweave-mermaid-fullscreen-content",
3525
- "data-scale-percent": Math.round(h.value.scale * 100),
3526
- "data-translate": `${Math.round(h.value.translateX)},${Math.round(h.value.translateY)}`,
3437
+ "data-scale-percent": Math.round(f.value.scale * 100),
3438
+ "data-translate": `${Math.round(f.value.translateX)},${Math.round(f.value.translateY)}`,
3527
3439
  style: {
3528
- width: `${h.value.width}px`,
3529
- height: `${h.value.height}px`,
3530
- transform: `translate(${h.value.translateX}px, ${h.value.translateY}px) scale(${h.value.scale})`
3440
+ width: `${f.value.width}px`,
3441
+ height: `${f.value.height}px`,
3442
+ transform: `translate(${f.value.translateX}px, ${f.value.translateY}px) scale(${f.value.scale})`
3531
3443
  },
3532
- innerHTML: h.value.svg
3444
+ innerHTML: f.value.svg
3533
3445
  })])
3534
3446
  ]) : null
3535
3447
  ]);
3536
3448
  };
3537
3449
  }
3538
- }), ei = Y({
3450
+ }), Kr = J({
3539
3451
  name: "MarkweaveVueInnerToc",
3540
3452
  props: {
3541
3453
  editor: {
@@ -3560,22 +3472,22 @@ var Jr = Y({
3560
3472
  }
3561
3473
  },
3562
3474
  setup(e) {
3563
- let t = U(null), n, r = () => {
3564
- n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
3475
+ let t = V(null), n, r = () => {
3476
+ n?.(), n = e.placement === "container" && t.value ? Oe(t.value) : void 0;
3565
3477
  };
3566
- return Cn(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
3478
+ return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
3567
3479
  ref: t,
3568
3480
  class: "markweave-inner-toc",
3569
3481
  "data-testid": "markweave-inner-toc",
3570
3482
  "aria-label": e.messages.toc.ariaLabel
3571
- }, [H("div", {
3483
+ }, [B("div", {
3572
3484
  class: "markweave-inner-toc-rail",
3573
3485
  "aria-hidden": "true"
3574
- }, e.state.items.map((e) => H("span", {
3486
+ }, e.state.items.map((e) => B("span", {
3575
3487
  key: e.id,
3576
3488
  "data-level": e.level,
3577
3489
  "data-active": e.active ? "true" : "false"
3578
- }))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
3490
+ }))), B("div", { class: "markweave-inner-toc-panel" }, [B("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => B("button", {
3579
3491
  key: t.id,
3580
3492
  type: "button",
3581
3493
  class: "markweave-inner-toc-item",
@@ -3584,33 +3496,32 @@ var Jr = Y({
3584
3496
  "aria-current": t.active ? "location" : void 0,
3585
3497
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
3586
3498
  title: t.text,
3587
- onClick: () => Ae(e.editor, t, {
3499
+ onClick: () => ke(e.editor, t, {
3588
3500
  behavior: "smooth",
3589
3501
  focus: e.editable
3590
3502
  })
3591
3503
  }, t.text)))])]) : null;
3592
3504
  }
3593
3505
  });
3594
- function ti(e = {}) {
3595
- let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(Lt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Wt), x = U(null), S = U(!1), C = W(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
3596
- function O() {
3597
- D !== null && (window.clearTimeout(D), D = null), d.value += 1;
3506
+ function qr(e = {}) {
3507
+ let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() => xe(e.theme)), u = U(() => c.value === "live" && e.editable !== !1), d = V(0), m = H(null), h = V(jt), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Rt), x = V(null), S = V(!1), C = H(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
3508
+ function E() {
3509
+ T !== null && (window.clearTimeout(T), T = null), d.value += 1;
3598
3510
  }
3599
- function k() {
3600
- D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
3601
- D = null, d.value += 1;
3602
- }, ye);
3511
+ function ee() {
3512
+ T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
3513
+ T = null, d.value += 1;
3514
+ }, ve);
3603
3515
  }
3604
- let A = e.onSlashCommandUpload, j = W(null);
3605
- j.value = new a({
3606
- extensions: Ir({
3516
+ let D = e.onSlashCommandUpload, O = H(null);
3517
+ O.value = new a({
3518
+ extensions: Or({
3607
3519
  lang: i,
3608
3520
  linkCardResolver: e.linkCardResolver,
3609
- onImageUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3610
- onVideoUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3611
- resolveMediaSource: e.resolveMediaSource
3521
+ onImageUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3522
+ onVideoUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
3612
3523
  }),
3613
- content: T,
3524
+ content: e.content ?? e.defaultContent ?? "",
3614
3525
  contentType: re(w),
3615
3526
  editable: u.value,
3616
3527
  autofocus: e.autofocus,
@@ -3618,42 +3529,41 @@ function ti(e = {}) {
3618
3529
  attributes: {
3619
3530
  class: "markweave-editor-surface",
3620
3531
  "data-testid": "markweave-editor-surface",
3621
- "data-markweave-large-document": E ? "true" : "false",
3622
3532
  autocapitalize: "off",
3623
3533
  autocorrect: "off",
3624
3534
  spellcheck: "false",
3625
3535
  translate: "no"
3626
3536
  },
3627
3537
  handleClick: (e, t, n) => {
3628
- if (!u.value) return me(n);
3629
- let r = yt(e, n);
3630
- return r ? (n.preventDefault(), n.stopPropagation(), N(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
3538
+ if (!u.value) return pe(n);
3539
+ let r = pt(e, n);
3540
+ return r ? (n.preventDefault(), n.stopPropagation(), A(), _t(e, r, !0), vt(e, r), y.value = r, !0) : (y.value = null, !1);
3631
3541
  },
3632
3542
  handleDOMEvents: {
3633
- compositionstart: () => u.value ? (h.value = Rt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3634
- compositionend: (e) => (u.value && window.setTimeout(() => P(e), 0), !1),
3543
+ compositionstart: () => u.value ? (h.value = Mt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3544
+ compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
3635
3545
  click: (e, t) => {
3636
- if (!u.value) return me(t);
3637
- let n = yt(e, t);
3638
- return n ? (t.preventDefault(), t.stopPropagation(), N(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
3546
+ if (!u.value) return pe(t);
3547
+ let n = pt(e, t);
3548
+ return n ? (t.preventDefault(), t.stopPropagation(), A(), _t(e, n, !0), vt(e, n), y.value = n, !0) : (y.value = null, !1);
3639
3549
  }
3640
3550
  }
3641
3551
  },
3642
- onSelectionUpdate: ({ editor: e }) => I(e),
3552
+ onSelectionUpdate: ({ editor: e }) => N(e),
3643
3553
  onCreate: ({ editor: t }) => {
3644
3554
  p(t, {
3645
3555
  mode: c.value,
3646
3556
  editable: u.value
3647
- }), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Vt(t), L(t), I(t), O();
3557
+ }), bt(t, l.value), xt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ft(t), P(t), N(t), E();
3648
3558
  },
3649
3559
  onTransaction: ({ editor: e, transaction: t }) => {
3650
- if (L(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
3651
- let t = vt(e, y.value.pos);
3560
+ if (P(e), (t.docChanged || yt(t)) && ee(), t.docChanged && y.value) {
3561
+ let t = ft(e, y.value.pos);
3652
3562
  y.value = t?.kind === y.value.kind ? t : null;
3653
3563
  }
3654
3564
  },
3655
3565
  onUpdate: ({ editor: t }) => {
3656
- I(t), u.value && F(t), S.value || e.onUpdate?.(V(t, { onContentRead: (n, r) => {
3566
+ N(t), u.value && M(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
3657
3567
  let i = oe(e.contentFormat);
3658
3568
  e.content !== void 0 && n === i && (C.value = {
3659
3569
  content: r,
@@ -3663,87 +3573,87 @@ function ti(e = {}) {
3663
3573
  } }));
3664
3574
  }
3665
3575
  });
3666
- let M = G(() => j.value ?? null);
3667
- function N() {
3668
- g.value = null, _.value = null, h.value = Lt;
3576
+ let k = U(() => O.value ?? null);
3577
+ function A() {
3578
+ g.value = null, _.value = null, h.value = jt;
3669
3579
  }
3670
- function P(e) {
3671
- let t = It(e.state);
3580
+ function j(e) {
3581
+ let t = At(e.state);
3672
3582
  if (!t) {
3673
- h.value = h.value.name === "idle" ? h.value : Lt, g.value = null, _.value = null;
3583
+ h.value = h.value.name === "idle" ? h.value : jt, g.value = null, _.value = null;
3674
3584
  return;
3675
3585
  }
3676
3586
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3677
- g.value = Ft(n, {
3587
+ g.value = kt(n, {
3678
3588
  frameRect: i,
3679
3589
  triggerRect: r
3680
- }), h.value = Pt(h.value, t);
3590
+ }), h.value = Ot(h.value, t);
3681
3591
  }
3682
- function F(e) {
3683
- P(e.view);
3592
+ function M(e) {
3593
+ j(e.view);
3684
3594
  }
3685
- function I(e) {
3686
- let t = ve(e);
3687
- ge(m.value, t) || (m.value = t);
3688
- let n = bt(e);
3689
- n && (St(e, n, !0), y.value = n);
3690
- let r = Ne(e);
3595
+ function N(e) {
3596
+ let t = _e(e);
3597
+ he(m.value, t) || (m.value = t);
3598
+ let n = mt(e);
3599
+ n && (gt(e, n, !0), y.value = n);
3600
+ let r = Me(e);
3691
3601
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
3692
3602
  }
3693
- function L(e) {
3694
- b.value = zr(e);
3603
+ function P(e) {
3604
+ b.value = jr(e);
3695
3605
  }
3696
- let R = G(() => M.value ? Ne(M.value) : Rr), z = G(() => M.value ? Ht(M.value.state) : Lr), ne = G(() => m.value?.currentNode === "codeBlock"), B = G(() => ne.value && R.value.language === "mermaid"), se = G(() => M.value ? kt({
3697
- active: B.value,
3606
+ let I = U(() => k.value ? Me(k.value) : Ar), te = U(() => k.value ? It(k.value.state) : kr), R = U(() => m.value?.currentNode === "codeBlock"), se = U(() => R.value && I.value.language === "mermaid"), ce = U(() => k.value ? Ct({
3607
+ active: se.value,
3698
3608
  mode: v.value,
3699
- source: R.value.text
3700
- }) : kt({
3609
+ source: I.value.text
3610
+ }) : Ct({
3701
3611
  active: !1,
3702
3612
  mode: "code",
3703
3613
  source: ""
3704
- })), ce = G(() => M.value && e.onRuntimeStateChange ? Bt(M.value.state) : null), le = G(() => M.value ? Ee(M.value.state) : we.items), ue = G(() => De(le.value, x.value)), de = G(() => Ce(le.value, ue.value)), fe = G(() => At(h.value.query, s)), pe = G(() => he({
3614
+ })), le = U(() => k.value ? Pt(k.value.state) : null), z = U(() => k.value ? Te(k.value.state.doc) : Ce.items), ue = U(() => Ee(z.value, x.value)), de = U(() => Se(z.value, ue.value)), fe = U(() => wt(h.value.query, s)), ge = U(() => me({
3705
3615
  revision: d.value,
3706
3616
  mode: c.value,
3707
3617
  editable: u.value,
3708
3618
  toc: de.value,
3709
3619
  selection: m.value,
3710
3620
  slash: h.value,
3711
- table: z.value,
3621
+ table: te.value,
3712
3622
  tableInteraction: b.value,
3713
- codeBlock: R.value,
3714
- mermaid: se.value,
3715
- tableDebugSnapshot: ce.value
3716
- })), _e = {
3717
- closeSlashMenu: N,
3718
- focusFirstTableBodyCell: () => M.value ? Vt(M.value) : !1,
3623
+ codeBlock: I.value,
3624
+ mermaid: ce.value,
3625
+ tableDebugSnapshot: le.value
3626
+ })), ye = {
3627
+ closeSlashMenu: A,
3628
+ focusFirstTableBodyCell: () => k.value ? Ft(k.value) : !1,
3719
3629
  setContent: (e, t = {}) => {
3720
- if (!M.value) return !1;
3630
+ if (!k.value) return !1;
3721
3631
  let n = oe(t.format);
3722
- return M.value.commands.setContent(e, {
3632
+ return k.value.commands.setContent(e, {
3723
3633
  contentType: re(n),
3724
3634
  emitUpdate: t.emitUpdate ?? !1
3725
- }), t.focusFirstTableBodyCell && Vt(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
3635
+ }), t.focusFirstTableBodyCell && Ft(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
3726
3636
  }
3727
3637
  };
3728
3638
  function be(e, t) {
3729
- if (!(!M.value || !u.value || !jt(e))) {
3639
+ if (!(!k.value || !u.value || !Tt(e))) {
3730
3640
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3731
3641
  _.value = e;
3732
3642
  return;
3733
3643
  }
3734
- Nt(M.value, h.value, e, t), h.value = Rt(h.value, { type: "execute" }), N();
3644
+ Dt(k.value, h.value, e, t), h.value = Mt(h.value, { type: "execute" }), A();
3735
3645
  }
3736
3646
  }
3737
- function xe(e) {
3738
- if (!M.value || _.value || !u.value) return;
3739
- let t = Mt(h.value, fe.value, e.key, { isComposing: e.isComposing || te(M.value.state) });
3647
+ function De(e) {
3648
+ if (!k.value || _.value || !u.value) return;
3649
+ let t = Et(h.value, fe.value, e.key, { isComposing: e.isComposing || L(k.value.state) });
3740
3650
  if (t.type !== "ignore") {
3741
3651
  if (e.preventDefault(), t.type === "close") {
3742
- h.value = Rt(h.value, { type: "escape" }), N();
3652
+ h.value = Mt(h.value, { type: "escape" }), A();
3743
3653
  return;
3744
3654
  }
3745
3655
  if (t.type === "move-active") {
3746
- h.value = Rt(h.value, {
3656
+ h.value = Mt(h.value, {
3747
3657
  type: "move-active",
3748
3658
  delta: t.delta,
3749
3659
  optionCount: t.optionCount
@@ -3753,64 +3663,64 @@ function ti(e = {}) {
3753
3663
  be(t.command);
3754
3664
  }
3755
3665
  }
3756
- K(() => [e.mode, e.editable], () => {
3757
- c.value = f(e.mode), M.value && (M.value.setEditable(u.value), p(M.value, {
3666
+ W(() => [e.mode, e.editable], () => {
3667
+ c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
3758
3668
  mode: c.value,
3759
3669
  editable: u.value
3760
- }), Dt(M.value, u.value ? "live" : "view"), O(), u.value || N());
3761
- }, { immediate: !0 }), K(() => e.theme, () => {
3762
- M.value && Et(M.value, l.value);
3763
- }, { immediate: !0 }), K(() => e.content, (t) => {
3670
+ }), xt(k.value, u.value ? "live" : "view"), E(), u.value || A());
3671
+ }, { immediate: !0 }), W(() => e.theme, () => {
3672
+ k.value && bt(k.value, l.value);
3673
+ }, { immediate: !0 }), W(() => e.content, (t) => {
3764
3674
  let n = oe(e.contentFormat);
3765
- if (!(!M.value || t === void 0)) {
3766
- if (ae(M.value, C.value, t, n)) {
3675
+ if (!(!k.value || t === void 0)) {
3676
+ if (ae(k.value, C.value, t, n)) {
3767
3677
  C.value = null;
3768
3678
  return;
3769
3679
  }
3770
- C.value = null, !ie(M.value, t, n) && (S.value = !0, M.value.commands.setContent(t, {
3680
+ C.value = null, !ie(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
3771
3681
  contentType: re(n),
3772
3682
  emitUpdate: !1
3773
- }), S.value = !1, I(M.value), u.value && F(M.value), L(M.value), O());
3683
+ }), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
3774
3684
  }
3775
- }), K(pe, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(de, (t) => e.onTocChange?.(t), { immediate: !0 }), K(le, (e) => {
3776
- let t = De(e, x.value);
3685
+ }), W(ge, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(de, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
3686
+ let t = Ee(e, x.value);
3777
3687
  x.value !== t && (x.value = t);
3778
3688
  });
3779
3689
  let Oe = null;
3780
- return q(() => {
3781
- D !== null && window.clearTimeout(D);
3782
- }), Cn(() => {
3690
+ return K(() => {
3691
+ T !== null && window.clearTimeout(T);
3692
+ }), G(() => {
3783
3693
  let e = () => {
3784
- if (!M.value || !le.value.length) {
3694
+ if (!k.value || !z.value.length) {
3785
3695
  x.value = null;
3786
3696
  return;
3787
3697
  }
3788
3698
  let e = null;
3789
3699
  try {
3790
- e = Te(M.value, le.value);
3700
+ e = we(k.value, z.value);
3791
3701
  } catch {
3792
3702
  return;
3793
3703
  }
3794
3704
  x.value !== e && (x.value = e);
3795
- }, t = () => window.requestAnimationFrame(e), n = Br(M.value?.view.dom ?? null);
3705
+ }, t = () => window.requestAnimationFrame(e), n = Mr(k.value?.view.dom ?? null);
3796
3706
  window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
3797
3707
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
3798
3708
  };
3799
- }), q(() => {
3709
+ }), K(() => {
3800
3710
  Oe?.();
3801
- let e = j.value;
3802
- j.value = null, J(() => e?.destroy());
3711
+ let e = O.value;
3712
+ O.value = null, q(() => e?.destroy());
3803
3713
  }), {
3804
- editor: M,
3805
- runtimeSnapshot: pe,
3806
- actions: _e,
3714
+ editor: k,
3715
+ runtimeSnapshot: ge,
3716
+ actions: ye,
3807
3717
  __render: {
3808
3718
  messages: o,
3809
3719
  effectiveEditable: u,
3810
- tableFocusState: z,
3720
+ tableFocusState: te,
3811
3721
  tableInteractionState: b,
3812
- codeBlockState: R,
3813
- isCodeBlockActive: ne,
3722
+ codeBlockState: I,
3723
+ isCodeBlockActive: R,
3814
3724
  mermaidMode: v,
3815
3725
  mathTarget: y,
3816
3726
  setMermaidMode: (e) => {
@@ -3822,14 +3732,14 @@ function ti(e = {}) {
3822
3732
  slashMenuPosition: g,
3823
3733
  slashInputCommand: _,
3824
3734
  runSlashCommand: be,
3825
- handleEditorKeyDown: xe,
3735
+ handleEditorKeyDown: De,
3826
3736
  setSlashInputCommand: (e) => {
3827
3737
  _.value = e;
3828
3738
  }
3829
3739
  }
3830
3740
  };
3831
3741
  }
3832
- var ni = Y({
3742
+ var Jr = J({
3833
3743
  name: "MarkweaveEditor",
3834
3744
  props: {
3835
3745
  defaultContent: {
@@ -3892,10 +3802,6 @@ var ni = Y({
3892
3802
  type: Function,
3893
3803
  default: void 0
3894
3804
  },
3895
- resolveMediaSource: {
3896
- type: Function,
3897
- default: void 0
3898
- },
3899
3805
  className: {
3900
3806
  type: String,
3901
3807
  default: void 0
@@ -3938,29 +3844,29 @@ var ni = Y({
3938
3844
  }
3939
3845
  },
3940
3846
  setup(e) {
3941
- let t = ti(e);
3847
+ let t = qr(e);
3942
3848
  return () => {
3943
3849
  let n = t.editor.value;
3944
3850
  if (!n) return null;
3945
- let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = xe(e.canvasColor);
3946
- return H("section", {
3851
+ let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = be(e.canvasColor);
3852
+ return B("section", {
3947
3853
  class: i,
3948
3854
  "aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
3949
3855
  "data-testid": "markweave-editor-frame",
3950
3856
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
3951
- "data-markweave-theme": Se(e.theme),
3857
+ "data-markweave-theme": xe(e.theme),
3952
3858
  style: a ? { "--markweave-canvas": a } : void 0,
3953
3859
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
3954
- "data-markweave-inner-toc-placement": Oe(e.innerTocPlacement),
3860
+ "data-markweave-inner-toc-placement": De(e.innerTocPlacement),
3955
3861
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
3956
3862
  "data-table-focus-mode": r.tableFocusState.value.mode,
3957
3863
  onKeydownCapture: r.handleEditorKeyDown
3958
3864
  }, [
3959
- r.effectiveEditable.value ? H(Jr, {
3865
+ r.effectiveEditable.value ? B(Br, {
3960
3866
  editor: n,
3961
3867
  messages: r.messages
3962
3868
  }) : null,
3963
- r.effectiveEditable.value ? H(Xr, {
3869
+ r.effectiveEditable.value ? B(Hr, {
3964
3870
  commands: r.filteredSlashCommands.value,
3965
3871
  state: r.slashState.value,
3966
3872
  position: r.slashMenuPosition.value,
@@ -3970,7 +3876,7 @@ var ni = Y({
3970
3876
  onInputCommandChange: r.setSlashInputCommand,
3971
3877
  onUpload: e.onSlashCommandUpload
3972
3878
  }) : null,
3973
- r.effectiveEditable.value ? H(Zr, {
3879
+ r.effectiveEditable.value ? B(Ur, {
3974
3880
  editor: n,
3975
3881
  active: r.tableFocusState.value.active,
3976
3882
  interactionState: r.tableInteractionState.value,
@@ -3979,11 +3885,11 @@ var ni = Y({
3979
3885
  onCommandResult: e.onTableCommandResult,
3980
3886
  onEditWithAi: e.onEditWithAi
3981
3887
  }) : null,
3982
- r.effectiveEditable.value ? H(Qr, {
3888
+ r.effectiveEditable.value ? B(Wr, {
3983
3889
  editor: n,
3984
3890
  focusState: r.tableFocusState.value
3985
3891
  }) : null,
3986
- H($r, {
3892
+ B(Gr, {
3987
3893
  editor: n,
3988
3894
  state: r.codeBlockState.value,
3989
3895
  active: r.effectiveEditable.value && r.isCodeBlockActive.value,
@@ -3991,23 +3897,23 @@ var ni = Y({
3991
3897
  onMermaidModeChange: r.setMermaidMode,
3992
3898
  readOnly: !r.effectiveEditable.value
3993
3899
  }),
3994
- e.innerToc && r.tocState.value.items.length ? H(ei, {
3900
+ e.innerToc && r.tocState.value.items.length ? B(Kr, {
3995
3901
  editor: n,
3996
3902
  state: r.tocState.value,
3997
3903
  messages: r.messages,
3998
3904
  editable: r.effectiveEditable.value,
3999
- placement: Oe(e.innerTocPlacement)
3905
+ placement: De(e.innerTocPlacement)
4000
3906
  }) : null,
4001
- r.effectiveEditable.value && r.mathTarget.value ? H(Yr, {
3907
+ r.effectiveEditable.value && r.mathTarget.value ? B(Vr, {
4002
3908
  editor: n,
4003
3909
  messages: r.messages,
4004
3910
  target: r.mathTarget.value,
4005
3911
  onClose: () => r.mathTarget.value = null
4006
3912
  }) : null,
4007
- H(o, { editor: n })
3913
+ B(o, { editor: n })
4008
3914
  ]);
4009
3915
  };
4010
3916
  }
4011
3917
  });
4012
3918
  //#endregion
4013
- export { ni as MarkweaveEditor, Ir as createMarkweaveEditorExtensions, Ir as createMarkweaveVue2EditorExtensions, ti as useMarkweaveEditorController };
3919
+ export { Jr as MarkweaveEditor, Or as createMarkweaveEditorExtensions, Or as createMarkweaveVue2EditorExtensions, qr as useMarkweaveEditorController };