@vibe-tiptap/shadcn-ui 1.1.3 → 1.1.4

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
@@ -3,115 +3,117 @@
3
3
  import { PRESET_HIGHLIGHT_COLORS as e, PRESET_TEXT_COLORS as t, TOOLBAR_HEADING_PREVIEW_STYLES as n, resolveEditorPalette as r, toColorHex as i } from "@vibe-tiptap/editor-ui/editor-theme";
4
4
  import { TOOLBAR_MARKDOWN_IMPORT_ACCEPT as a, TOOLBAR_MARKDOWN_OPTIONS as o, TOOLBAR_MARKDOWN_OPTIONS as s, copyMarkdown as c, copyMarkdown as l, exportMarkdownFile as u, exportMarkdownFile as d, importMarkdownFile as f, importMarkdownFile as p, resolveMarkdownFileOptions as m } from "@vibe-tiptap/editor-ui/markdown-file";
5
5
  import { printEditorContent as h, printEditorContent as g } from "@vibe-tiptap/editor-ui/print-editor-content";
6
- import { DEFAULT_CODE_BLOCK_LANGUAGES as _, DEFAULT_HORIZONTAL_RULES as v, NAIVE_UI_DEFAULT_TOOLBAR as y, TOOLBAR_ALIGN_OPTIONS as b, TOOLBAR_ALIGN_OPTIONS as x, TOOLBAR_HEADING_OPTIONS as S, TOOLBAR_HEADING_OPTIONS as C, TOOLBAR_TABLE_GRID as w, normalizeToolbarConfig as T, normalizeToolbarConfig as E, resolveToolbarMenuOptions as ee } from "@vibe-tiptap/editor-ui/toolbar-config";
7
- import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitMention as te, exitSlashCommand as ne, formatFileSize as M, getActiveHeadingLevel as N, getActiveLinkRange as P, getActiveTextAlign as re, getMediaInsertionNodeType as ie, getMentionTarget as ae, getNativeMarkdownManager as oe, getSelectedFileAttachment as F, isFindReplaceOpenTransaction as I, isToolbarCommandActive as se, isToolbarCommandEnabled as L, normalizeHttpUrl as ce, normalizeSlashCommandInput as R, notifyAssetUploadFailure as le, resolveEditorBehaviorOptions as z, resolveMediaResourcePath as B, runSlashCommandItem as ue, runToolbarCommand as de, slashCommandPluginKey as V, startWhiteboardDrawing as fe, trackUploadRange as pe, useReactEditor as me, useReactEditorState as H, validateAssetFile as he } from "@vibe-tiptap/react-adapter";
8
- import { Fragment as ge, jsx as U, jsxs as W } from "react/jsx-runtime";
9
- import { getMarkRange as _e } from "@tiptap/core";
10
- import { cloneElement as ve, createContext as ye, createElement as be, forwardRef as xe, memo as Se, useCallback as Ce, useContext as we, useEffect as G, useId as Te, useLayoutEffect as K, useMemo as Ee, useRef as q, useState as J } from "react";
11
- import { NodeSelection as De, TextSelection as Oe } from "@tiptap/pm/state";
12
- import { AlignCenter as ke, AlignJustify as Ae, AlignLeft as je, AlignRight as Me, ArrowDown as Ne, ArrowLeft as Pe, ArrowRight as Fe, ArrowUp as Ie, Bold as Le, Captions as Re, CaseSensitive as ze, ChevronDown as Be, ChevronLeft as Ve, ChevronRight as He, ChevronUp as Ue, Code as We, CodeXml as Ge, Copy as Ke, Download as qe, Ellipsis as Je, EllipsisVertical as Ye, Eraser as Xe, ExternalLink as Ze, Eye as Qe, Film as $e, Heading1 as et, Heading2 as tt, Heading3 as nt, Heading4 as rt, Heading5 as it, Heading6 as at, Highlighter as ot, Image as st, ImagePlay as ct, ImagePlus as lt, ImageUp as ut, IndentDecrease as dt, IndentIncrease as ft, Italic as pt, Link as mt, List as ht, ListChecks as gt, ListOrdered as _t, LoaderCircle as vt, Maximize2 as yt, Minimize2 as bt, Minus as xt, Music as St, Palette as Ct, Paperclip as wt, Pencil as Tt, PencilRuler as Et, Pilcrow as Dt, Plus as Ot, Printer as kt, Quote as At, Redo2 as jt, Replace as Mt, ReplaceAll as Nt, RotateCcw as Pt, RotateCw as Ft, Search as It, Strikethrough as Lt, Subscript as Rt, Superscript as zt, Table as Bt, TableProperties as Vt, Trash2 as Ht, TvMinimalPlay as Ut, Underline as Wt, Undo2 as Gt, Unlink as Kt, Video as qt, Workflow as Jt, X as Yt, ZoomIn as Xt, ZoomOut as Zt } from "lucide-react";
13
- import { twMerge as Y } from "tailwind-merge";
14
- import { FIRST_LINE_INDENT_ICON as Qt, MARKDOWN_ACTION_ICON_PATHS as $t, MARKDOWN_ACTION_ICON_TRANSFORM as en, MARKDOWN_ICON as tn, TOOLBAR_ICON_VIEW_BOX as nn } from "@vibe-tiptap/editor-ui/custom-icons";
15
- import { TransformComponent as rn, TransformWrapper as an } from "react-zoom-pan-pinch";
16
- import { createPortal as on } from "react-dom";
17
- import { bindMentionHover as sn } from "@vibe-tiptap/editor-ui/mention-hover";
18
- import { TableMap as cn, cellAround as ln } from "@tiptap/pm/tables";
6
+ import { DEFAULT_CODE_BLOCK_LANGUAGES as _, DEFAULT_HORIZONTAL_RULES as v, NAIVE_UI_DEFAULT_TOOLBAR as y, TOOLBAR_ALIGN_OPTIONS as b, TOOLBAR_ALIGN_OPTIONS as x, TOOLBAR_HEADING_OPTIONS as S, TOOLBAR_HEADING_OPTIONS as C, TOOLBAR_TABLE_GRID as w, normalizeToolbarConfig as T, normalizeToolbarConfig as E, resolveToolbarMenuOptions as D } from "@vibe-tiptap/editor-ui/toolbar-config";
7
+ import { BubbleMenu as O, EditorContent as k, canSetMediaDisplay as A, createImageDropPasteHandlers as j, detectFileAttachmentType as M, exitMention as ee, exitSlashCommand as te, formatFileSize as N, getActiveHeadingLevel as P, getActiveLinkRange as F, getActiveTextAlign as ne, getMediaInsertionNodeType as re, getMentionTarget as ie, getNativeMarkdownManager as ae, getSelectedFileAttachment as I, isFindReplaceOpenTransaction as L, isToolbarCommandActive as oe, isToolbarCommandEnabled as R, normalizeHttpUrl as se, normalizeSlashCommandInput as z, notifyAssetUploadFailure as ce, resolveEditorBehaviorOptions as le, resolveMediaResourcePath as B, runSlashCommandItem as ue, runToolbarCommand as de, slashCommandPluginKey as V, startWhiteboardDrawing as fe, trackUploadRange as pe, useReactEditor as me, useReactEditorState as he, validateAssetFile as ge } from "@vibe-tiptap/react-adapter";
8
+ import { Fragment as _e, jsx as H, jsxs as U } from "react/jsx-runtime";
9
+ import { getMarkRange as ve } from "@tiptap/core";
10
+ import { cloneElement as ye, createContext as be, createElement as xe, forwardRef as Se, memo as Ce, useCallback as we, useContext as Te, useEffect as W, useId as Ee, useLayoutEffect as G, useMemo as De, useRef as K, useState as q } from "react";
11
+ import { NodeSelection as Oe, TextSelection as ke } from "@tiptap/pm/state";
12
+ import { AlignCenter as Ae, AlignJustify as je, AlignLeft as Me, AlignRight as Ne, ArrowDown as Pe, ArrowLeft as Fe, ArrowRight as Ie, ArrowUp as Le, Bold as Re, Captions as ze, CaseSensitive as Be, ChevronDown as Ve, ChevronLeft as He, ChevronRight as Ue, ChevronUp as We, Code as Ge, CodeXml as Ke, Columns2PlusLeft as qe, Columns2PlusRight as Je, Columns3 as Ye, Copy as Xe, Download as Ze, Eraser as Qe, ExternalLink as $e, Eye as et, Film as tt, Heading1 as nt, Heading2 as rt, Heading3 as it, Heading4 as at, Heading5 as ot, Heading6 as st, Highlighter as ct, Image as lt, ImagePlay as ut, ImagePlus as dt, ImageUp as ft, IndentDecrease as pt, IndentIncrease as mt, Italic as ht, Link as gt, List as _t, ListChecks as vt, ListOrdered as yt, LoaderCircle as bt, Maximize2 as xt, Minimize2 as St, Minus as Ct, Music as wt, Palette as Tt, Paperclip as Et, Pencil as Dt, PencilRuler as Ot, Pilcrow as kt, Printer as At, Quote as jt, Redo2 as Mt, Replace as Nt, ReplaceAll as Pt, RotateCcw as Ft, RotateCw as It, Rows2PlusBottom as Lt, Rows2PlusTop as Rt, Rows3 as zt, Search as Bt, Strikethrough as Vt, Subscript as Ht, Superscript as Ut, Table as Wt, Table2 as Gt, TableCellsMerge as Kt, TableCellsSplit as qt, TableProperties as Jt, Trash2 as Yt, TvMinimalPlay as Xt, Underline as Zt, Undo2 as Qt, Unlink as $t, Video as en, Workflow as tn, X as nn, ZoomIn as rn, ZoomOut as an } from "lucide-react";
13
+ import { twMerge as J } from "tailwind-merge";
14
+ import { FIRST_LINE_INDENT_ICON as on, MARKDOWN_ACTION_ICON_PATHS as sn, MARKDOWN_ACTION_ICON_TRANSFORM as cn, MARKDOWN_ICON as ln, TOOLBAR_ICON_VIEW_BOX as un } from "@vibe-tiptap/editor-ui/custom-icons";
15
+ import { TransformComponent as dn, TransformWrapper as fn } from "react-zoom-pan-pinch";
16
+ import { createPortal as pn } from "react-dom";
17
+ import { bindMentionHover as mn } from "@vibe-tiptap/editor-ui/mention-hover";
18
+ import { TableMap as hn } from "@tiptap/pm/tables";
19
+ import { isEditorContextMenuHandled as gn } from "@vibe-tiptap/core";
20
+ import { getTableGripCellStart as _n, getTableGripLayout as vn, getTableGripTarget as yn } from "@vibe-tiptap/editor-ui/table-grips";
19
21
  // src/editor-content.tsx
20
- function un({ context: e, className: t, ...n }) {
21
- return /* @__PURE__ */ U(O, {
22
+ function bn({ context: e, className: t, ...n }) {
23
+ return /* @__PURE__ */ H(k, {
22
24
  ...n,
23
25
  editor: e.editor,
24
26
  className: ["vibe-shadcn-tiptap__content", t].filter(Boolean).join(" ")
25
27
  });
26
28
  }
27
- function dn({ context: e }) {
28
- let t = H(e, (e) => e.wordCount.characters) ?? 0;
29
- return /* @__PURE__ */ U("div", {
29
+ function xn({ context: e }) {
30
+ let t = he(e, (e) => e.wordCount.characters) ?? 0;
31
+ return /* @__PURE__ */ H("div", {
30
32
  className: "vibe-shadcn-tiptap__status",
31
33
  "aria-live": "polite",
32
34
  children: e.t("wordCount.characters", { count: t })
33
35
  });
34
36
  }
35
37
  // src/components.ts
36
- var fn = ye(void 0), pn = fn.Provider;
37
- function X() {
38
- let e = we(fn);
38
+ var Sn = be(void 0), Cn = Sn.Provider;
39
+ function Y() {
40
+ let e = Te(Sn);
39
41
  if (!e) throw Error("ShadcnTiptap requires a components mapping.");
40
42
  return e;
41
43
  }
42
44
  // src/ui-styles.ts
43
- var Z = "flex flex-wrap items-center gap-1", mn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", hn = {
45
+ var X = "flex flex-wrap items-center gap-1", wn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", Tn = {
44
46
  default: void 0,
45
47
  outline: "border border-input bg-background dark:bg-background",
46
48
  ghost: "border-transparent bg-transparent shadow-none dark:bg-transparent"
47
- }, gn = ye(void 0), _n = gn.Provider;
48
- function vn(e) {
49
- let t = we(gn);
49
+ }, En = be(void 0), Z = En.Provider;
50
+ function Dn(e) {
51
+ let t = Te(En);
50
52
  return {
51
53
  size: e?.size ?? t?.size,
52
54
  variant: e?.variant ?? t?.variant,
53
- className: Y(t?.className, e?.className)
55
+ className: J(t?.className, e?.className)
54
56
  };
55
57
  }
56
- var Q = xe(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
57
- let { Button: s } = X(), c = vn(e);
58
- return /* @__PURE__ */ U(s, {
58
+ var Q = Se(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
59
+ let { Button: s } = Y(), c = Dn(e);
60
+ return /* @__PURE__ */ H(s, {
59
61
  ...a,
60
62
  ref: o,
61
63
  size: c.size ?? r,
62
64
  variant: c.variant ?? i,
63
- className: Y(t, c.size === void 0 && n, c.className)
65
+ className: J(t, c.size === void 0 && n, c.className)
64
66
  });
65
67
  });
66
- function yn({ appearance: e, children: t }) {
67
- let { className: n, size: r, variant: i } = vn(e);
68
- return r === void 0 && i === void 0 ? ve(t, { className: Y(t.props.className, n) }) : /* @__PURE__ */ U(Q, {
68
+ function On({ appearance: e, children: t }) {
69
+ let { className: n, size: r, variant: i } = Dn(e);
70
+ return r === void 0 && i === void 0 ? ye(t, { className: J(t.props.className, n) }) : /* @__PURE__ */ H(Q, {
69
71
  asChild: !0,
70
72
  appearance: e,
71
73
  children: t
72
74
  });
73
75
  }
74
- var $ = xe(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
75
- let { Tooltip: s } = X();
76
- return /* @__PURE__ */ W(s.Root, {
76
+ var $ = Se(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
77
+ let { Tooltip: s } = Y();
78
+ return /* @__PURE__ */ U(s.Root, {
77
79
  disableHoverableContent: !0,
78
- children: [/* @__PURE__ */ U(s.Trigger, {
80
+ children: [/* @__PURE__ */ H(s.Trigger, {
79
81
  asChild: !0,
80
- children: /* @__PURE__ */ U(Q, {
82
+ children: /* @__PURE__ */ H(Q, {
81
83
  type: "button",
82
84
  size: r,
83
85
  variant: i,
84
86
  ...a,
85
87
  ref: o,
86
88
  "aria-label": e,
87
- className: Y("vibe-shadcn-tiptap__button", n)
89
+ className: J("vibe-shadcn-tiptap__button", n)
88
90
  })
89
- }), t && /* @__PURE__ */ U(s.Content, {
91
+ }), t && /* @__PURE__ */ H(s.Content, {
90
92
  container: t,
91
93
  className: "vibe-shadcn-tiptap__tooltip",
92
94
  sideOffset: 5,
93
95
  children: e
94
96
  })]
95
97
  });
96
- }), bn = [
98
+ }), kn = [
97
99
  ["small", .25],
98
100
  ["medium", .5],
99
101
  ["large", .75],
100
102
  ["original", null]
101
- ], xn = {
102
- left: je,
103
- center: ke,
104
- right: Me
105
- }, Sn = [
103
+ ], An = {
104
+ left: Me,
105
+ center: Ae,
106
+ right: Ne
107
+ }, jn = [
106
108
  "left",
107
109
  "center",
108
110
  "right"
109
- ], Cn = {
110
- image: st,
111
- audio: St,
112
- video: $e
111
+ ], Mn = {
112
+ image: lt,
113
+ audio: wt,
114
+ video: tt
113
115
  };
114
- function wn(e, t) {
116
+ function Nn(e, t) {
115
117
  if (typeof e == "string" && e) try {
116
118
  let n = new URL(e, t);
117
119
  if ([
@@ -124,10 +126,10 @@ function wn(e, t) {
124
126
  return;
125
127
  }
126
128
  }
127
- function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhiteboardEdit: i, behaviorOptions: a, onCaptionFocus: o, onCopyUrl: s }) {
128
- let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = q(null), [h, g] = J(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x = wn(B(c, f, d.attrs), p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
129
+ function Pn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhiteboardEdit: i, behaviorOptions: a, onCaptionFocus: o, onCopyUrl: s }) {
130
+ let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = K(null), [h, g] = q(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x = Nn(B(c, f, d.attrs), p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
129
131
  function w(e, t, r, i) {
130
- return /* @__PURE__ */ U($, {
132
+ return /* @__PURE__ */ H($, {
131
133
  ...i,
132
134
  label: u(e),
133
135
  overlayTarget: n,
@@ -139,20 +141,20 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
139
141
  c.isEditable && c.chain().focus().deleteSelection().run();
140
142
  }
141
143
  if (f === "fileAttachment") {
142
- let t = F(c);
144
+ let t = I(c);
143
145
  if (!t) return null;
144
- let n = wn(t.href, p), r = j(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = U(i ? Ze : qe, {
146
+ let n = Nn(t.href, p), r = M(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = H(i ? $e : Ze, {
145
147
  size: 16,
146
148
  "aria-hidden": !0
147
- }), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && Cn[o];
148
- return /* @__PURE__ */ W("div", {
149
- className: Y("vibe-shadcn-tiptap__actions", Z),
149
+ }), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && Mn[o];
150
+ return /* @__PURE__ */ U("div", {
151
+ className: J("vibe-shadcn-tiptap__actions", X),
150
152
  children: [
151
- n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ U(Q, {
153
+ n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ H(Q, {
152
154
  asChild: !0,
153
155
  variant: "ghost",
154
156
  className: "vibe-shadcn-tiptap__button",
155
- children: /* @__PURE__ */ U("a", {
157
+ children: /* @__PURE__ */ H("a", {
156
158
  href: n,
157
159
  "aria-label": u(i ? "file.action.open" : "file.action.download"),
158
160
  download: i ? void 0 : t.attrs.name ? t.name : "",
@@ -161,15 +163,15 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
161
163
  children: a
162
164
  })
163
165
  }),
164
- n && w("file.action.copy", /* @__PURE__ */ U(Ke, {
166
+ n && w("file.action.copy", /* @__PURE__ */ H(Xe, {
165
167
  size: 16,
166
168
  "aria-hidden": !0
167
169
  }), () => s(n, !0)),
168
- o && d && k(c, o, "media") && w({
170
+ o && d && A(c, o, "media") && w({
169
171
  image: "file.action.showAsImage",
170
172
  audio: "file.action.showAsAudio",
171
173
  video: "file.action.showAsVideo"
172
- }[o], /* @__PURE__ */ U(d, {
174
+ }[o], /* @__PURE__ */ H(d, {
173
175
  size: 16,
174
176
  "aria-hidden": !0
175
177
  }), {
@@ -177,7 +179,7 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
177
179
  audio: () => l.setAudioDisplay("player"),
178
180
  video: () => l.setVideoDisplay("player")
179
181
  }[o]),
180
- w("file.action.delete", /* @__PURE__ */ U(Ht, {
182
+ w("file.action.delete", /* @__PURE__ */ H(Yt, {
181
183
  size: 16,
182
184
  "aria-hidden": !0
183
185
  }), T)
@@ -196,58 +198,58 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
196
198
  }).run();
197
199
  } else l.setMediaSize(e);
198
200
  }
199
- function ee(e) {
201
+ function D(e) {
200
202
  _ ? l.setImageAlign(e) : v ? c.chain().focus().updateAttributes("whiteboard", { align: e }).run() : y ? l.setAudioAlign(e) : l.setVideoAlign(e);
201
203
  }
202
- let D = y || b ? d.attrs.size : bn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
203
- return /* @__PURE__ */ W("div", {
204
- className: Y("vibe-shadcn-tiptap__actions", Z),
204
+ let O = y || b ? d.attrs.size : kn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
205
+ return /* @__PURE__ */ U("div", {
206
+ className: J("vibe-shadcn-tiptap__actions", X),
205
207
  children: [
206
- bn.map(([e, t]) => /* @__PURE__ */ U(Q, {
208
+ kn.map(([e, t]) => /* @__PURE__ */ H(Q, {
207
209
  type: "button",
208
210
  variant: "ghost",
209
211
  className: "vibe-shadcn-tiptap__button",
210
212
  title: u(`image.size.${e}Tooltip`),
211
- "aria-pressed": D === e,
213
+ "aria-pressed": O === e,
212
214
  onClick: () => E(e, t),
213
215
  children: u(`image.size.${e}`)
214
216
  }, e)),
215
- /* @__PURE__ */ U("span", {
217
+ /* @__PURE__ */ H("span", {
216
218
  className: "vibe-shadcn-tiptap__bubble-divider",
217
219
  "aria-hidden": "true"
218
220
  }),
219
- Sn.map((e) => {
220
- let t = xn[e];
221
- return /* @__PURE__ */ U($, {
221
+ jn.map((e) => {
222
+ let t = An[e];
223
+ return /* @__PURE__ */ H($, {
222
224
  label: u(`image.align.${e}`),
223
225
  "aria-pressed": (d.attrs.align ?? "center") === e,
224
226
  overlayTarget: n,
225
- onClick: () => ee(e),
226
- children: /* @__PURE__ */ U(t, {
227
+ onClick: () => D(e),
228
+ children: /* @__PURE__ */ H(t, {
227
229
  size: 16,
228
230
  "aria-hidden": !0
229
231
  })
230
232
  }, e);
231
233
  }),
232
- /* @__PURE__ */ U("span", {
234
+ /* @__PURE__ */ H("span", {
233
235
  className: "vibe-shadcn-tiptap__bubble-divider",
234
236
  "aria-hidden": "true"
235
237
  }),
236
- C && w("image.caption", /* @__PURE__ */ U(Re, {
238
+ C && w("image.caption", /* @__PURE__ */ H(ze, {
237
239
  size: 16,
238
240
  "aria-hidden": !0
239
241
  }), () => {
240
242
  C.readOnly || (C.hidden = !1, C.focus(), o());
241
243
  }),
242
- v && r && w("whiteboard.edit", /* @__PURE__ */ U(Et, {
244
+ v && r && w("whiteboard.edit", /* @__PURE__ */ H(Ot, {
243
245
  size: 16,
244
246
  "aria-hidden": !0
245
247
  }), i),
246
- _ && r && /* @__PURE__ */ W(ge, { children: [/* @__PURE__ */ U("input", {
248
+ _ && r && /* @__PURE__ */ U(_e, { children: [/* @__PURE__ */ H("input", {
247
249
  ref: m,
248
250
  type: "file",
249
251
  hidden: !0,
250
- accept: z(a).image.accept,
252
+ accept: le(a).image.accept,
251
253
  onChange: async (t) => {
252
254
  let n = t.currentTarget.files?.[0];
253
255
  if (t.currentTarget.value = "", n && !h) {
@@ -255,31 +257,31 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
255
257
  try {
256
258
  await l.uploadAndReplaceImage(n);
257
259
  } catch {
258
- c.isDestroyed || le(e.notify, u, "image");
260
+ c.isDestroyed || ce(e.notify, u, "image");
259
261
  } finally {
260
262
  g(!1);
261
263
  }
262
264
  }
263
265
  }
264
- }), w("image.replace", /* @__PURE__ */ U(ut, {
266
+ }), w("image.replace", /* @__PURE__ */ H(ft, {
265
267
  size: 16,
266
268
  "aria-hidden": !0
267
269
  }), () => m.current?.click(), { disabled: h })] }),
268
- x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(Ke, {
270
+ x && !v && w("toolbar.link.copy", /* @__PURE__ */ H(Xe, {
269
271
  size: 16,
270
272
  "aria-hidden": !0
271
273
  }), () => s(x)),
272
- x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(wt, {
274
+ x && !v && A(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ H(Et, {
273
275
  size: 16,
274
276
  "aria-hidden": !0
275
277
  }), () => {
276
278
  _ ? l.setImageDisplay("file") : y ? l.setAudioDisplay("file") : l.setVideoDisplay("file");
277
279
  }),
278
- (y || b) && x && /* @__PURE__ */ U("span", {
280
+ (y || b) && x && /* @__PURE__ */ H("span", {
279
281
  className: "vibe-shadcn-tiptap__bubble-divider",
280
282
  "aria-hidden": "true"
281
283
  }),
282
- w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(Ht, {
284
+ w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ H(Yt, {
283
285
  size: 16,
284
286
  "aria-hidden": !0
285
287
  }), _ ? l.removeImage : y ? l.removeAudio : b ? l.removeVideo : T)
@@ -287,50 +289,50 @@ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
287
289
  });
288
290
  }
289
291
  // src/color-picker.tsx
290
- var En = /^(#[\da-f]{6})ff$/;
291
- function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
292
- let { Popover: u } = X(), d = vn(), f = {
292
+ var Fn = /^(#[\da-f]{6})ff$/;
293
+ function In({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
294
+ let { Popover: u } = Y(), d = Dn(), f = {
293
295
  size: e?.button?.size ?? d?.size,
294
296
  variant: e?.button?.variant ?? d?.variant,
295
- className: Y(d?.className, e?.button?.className)
296
- }, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(En, "$1"), w = Ee(() => {
297
+ className: J(d?.className, e?.button?.className)
298
+ }, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(Fn, "$1"), w = De(() => {
297
299
  let e = /* @__PURE__ */ new Set();
298
300
  return n.flatMap((t) => {
299
- let n = i(t, g)?.replace(En, "$1"), r = n ?? t.trim();
301
+ let n = i(t, g)?.replace(Fn, "$1"), r = n ?? t.trim();
300
302
  return e.has(r) ? [] : (e.add(r), [{
301
303
  value: t,
302
304
  canonical: n
303
305
  }]);
304
306
  });
305
- }, [n, g]), T = r === "color" ? Ct : ot;
307
+ }, [n, g]), T = r === "color" ? Tt : ct;
306
308
  function E(e) {
307
- !o && L(t, r, e) && de(t, r, e);
309
+ !o && R(t, r, e) && de(t, r, e);
308
310
  }
309
- return /* @__PURE__ */ U(_n, {
311
+ return /* @__PURE__ */ H(Z, {
310
312
  value: f,
311
- children: /* @__PURE__ */ W(u.Root, {
313
+ children: /* @__PURE__ */ U(u.Root, {
312
314
  open: c,
313
315
  onOpenChange: l,
314
- children: [/* @__PURE__ */ U(u.Trigger, {
316
+ children: [/* @__PURE__ */ H(u.Trigger, {
315
317
  asChild: !0,
316
- children: /* @__PURE__ */ U($, {
318
+ children: /* @__PURE__ */ H($, {
317
319
  size: "icon",
318
320
  label: m(`command.${r}`),
319
321
  overlayTarget: a,
320
322
  "data-toolbar-key": s ? void 0 : r,
321
323
  disabled: o,
322
324
  onMouseDown: (e) => e.preventDefault(),
323
- children: /* @__PURE__ */ W("span", {
325
+ children: /* @__PURE__ */ U("span", {
324
326
  className: "vibe-shadcn-tiptap__color-icon",
325
- children: [/* @__PURE__ */ U(T, {
327
+ children: [/* @__PURE__ */ H(T, {
326
328
  size: 16,
327
329
  "aria-hidden": !0
328
- }), x && /* @__PURE__ */ U("span", { style: { backgroundColor: x } })]
330
+ }), x && /* @__PURE__ */ H("span", { style: { backgroundColor: x } })]
329
331
  })
330
332
  })
331
- }), a && /* @__PURE__ */ W(u.Content, {
333
+ }), a && /* @__PURE__ */ U(u.Content, {
332
334
  container: a,
333
- className: Y("z-3", e?.className),
335
+ className: J("z-3 vibe-shadcn-tiptap__popover", e?.className),
334
336
  align: "start",
335
337
  sideOffset: 4,
336
338
  "aria-label": m(`command.${r}`),
@@ -342,13 +344,13 @@ function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
342
344
  e.target === p.view.dom && e.preventDefault();
343
345
  },
344
346
  onMouseDown: (e) => e.preventDefault(),
345
- children: [/* @__PURE__ */ U("div", {
346
- className: Y("vibe-shadcn-tiptap__color-grid grid grid-cols-[repeat(8,max-content)] justify-between gap-1.5 px-2 py-2", e?.gridClassName),
347
- children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */ U(Q, {
347
+ children: [/* @__PURE__ */ H("div", {
348
+ className: J("vibe-shadcn-tiptap__color-grid grid grid-cols-[repeat(8,max-content)] justify-between gap-1.5 px-2 py-2", e?.gridClassName),
349
+ children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */ H(Q, {
348
350
  type: "button",
349
351
  appearance: {
350
352
  ...e?.swatch,
351
- className: Y(e?.swatchClassName, e?.swatch?.className)
353
+ className: J(e?.swatchClassName, e?.swatch?.className)
352
354
  },
353
355
  defaultSizeClassName: "size-5 p-0",
354
356
  className: "vibe-shadcn-tiptap__swatch rounded-sm border border-border aria-pressed:outline-2 aria-pressed:outline-solid aria-pressed:outline-ring",
@@ -358,9 +360,9 @@ function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
358
360
  "aria-pressed": x === t || C !== void 0 && C === n,
359
361
  onClick: () => E(t)
360
362
  }, t))
361
- }), /* @__PURE__ */ W("div", {
362
- className: Y("vibe-shadcn-tiptap__color-footer flex items-center justify-between gap-2 px-2 text-muted-foreground", e?.footerClassName),
363
- children: [S ? /* @__PURE__ */ W($, {
363
+ }), /* @__PURE__ */ U("div", {
364
+ className: J("vibe-shadcn-tiptap__color-footer flex items-center justify-between gap-2 px-2 text-muted-foreground", e?.footerClassName),
365
+ children: [S ? /* @__PURE__ */ U($, {
364
366
  size: "sm",
365
367
  label: m("toolbar.color.copyHex", { hex: S }),
366
368
  overlayTarget: a,
@@ -373,15 +375,15 @@ function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
373
375
  h(m("notify.clipboardUnavailable"), "warning");
374
376
  }
375
377
  },
376
- children: [/* @__PURE__ */ U(Ke, {
378
+ children: [/* @__PURE__ */ H(Xe, {
377
379
  size: 14,
378
380
  "aria-hidden": !0
379
381
  }), S]
380
- }) : /* @__PURE__ */ U("span", { children: m(r === "color" ? "toolbar.color.default" : "toolbar.highlight.none") }), /* @__PURE__ */ U(Q, {
382
+ }) : /* @__PURE__ */ H("span", { children: m(r === "color" ? "toolbar.color.default" : "toolbar.highlight.none") }), /* @__PURE__ */ H(Q, {
381
383
  type: "button",
382
384
  size: "sm",
383
385
  className: "vibe-shadcn-tiptap__button",
384
- disabled: o || !L(t, r, ""),
386
+ disabled: o || !R(t, r, ""),
385
387
  onClick: () => E(""),
386
388
  children: m(r === "color" ? "toolbar.color.clear" : "toolbar.highlight.clear")
387
389
  })]
@@ -391,20 +393,20 @@ function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
391
393
  });
392
394
  }
393
395
  // src/insertion-popover.tsx
394
- function On(e) {
395
- return /* @__PURE__ */ U(_n, {
396
+ function Ln(e) {
397
+ return /* @__PURE__ */ H(Z, {
396
398
  value: e.appearance?.button,
397
- children: e.request.kind === "link" ? /* @__PURE__ */ U(An, {
399
+ children: e.request.kind === "link" ? /* @__PURE__ */ H(zn, {
398
400
  ...e,
399
401
  request: e.request
400
- }) : /* @__PURE__ */ U(Nn, {
402
+ }) : /* @__PURE__ */ H(Hn, {
401
403
  ...e,
402
404
  request: e.request
403
405
  })
404
406
  });
405
407
  }
406
- function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
407
- let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u = Ee(() => ({ current: {
408
+ function Rn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
409
+ let { Popover: s } = Y(), { editor: c } = t, l = K(c.state.selection.from), u = De(() => ({ current: {
408
410
  contextElement: n ?? c.view.dom,
409
411
  getBoundingClientRect() {
410
412
  if (n) return n.getBoundingClientRect();
@@ -415,14 +417,14 @@ function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
415
417
  function d() {
416
418
  a(), (n ?? c.view.dom).focus({ preventScroll: !0 });
417
419
  }
418
- return /* @__PURE__ */ W(s.Root, {
420
+ return /* @__PURE__ */ U(s.Root, {
419
421
  open: !0,
420
422
  onOpenChange: (e) => {
421
423
  e || a();
422
424
  },
423
- children: [/* @__PURE__ */ U(s.Anchor, { virtualRef: u }), /* @__PURE__ */ U(s.Content, {
425
+ children: [/* @__PURE__ */ H(s.Anchor, { virtualRef: u }), /* @__PURE__ */ H(s.Content, {
424
426
  container: r,
425
- className: Y("z-3 vibe-shadcn-tiptap__insertion w-[min(22rem,calc(100vw-2rem))] p-3", e),
427
+ className: J("z-3 vibe-shadcn-tiptap__popover vibe-shadcn-tiptap__insertion w-[min(22rem,calc(100vw-2rem))] p-3", e),
426
428
  "aria-label": i,
427
429
  side: n ? "top" : "bottom",
428
430
  align: "start",
@@ -450,15 +452,15 @@ function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
450
452
  })]
451
453
  });
452
454
  }
453
- function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
454
- let { Input: a, Checkbox: o } = X(), s = Y(hn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = Te(), p = Te(), m = Te(), [h] = J(() => r.link ?? P(c)), [g] = J(() => h ? {
455
+ function zn({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
456
+ let { Input: a, Checkbox: o } = Y(), s = J(Tn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = Ee(), p = Ee(), m = Ee(), [h] = q(() => r.link ?? F(c)), [g] = q(() => h ? {
455
457
  from: h.from,
456
458
  to: h.to
457
459
  } : {
458
460
  from: c.state.selection.from,
459
461
  to: c.state.selection.to
460
- }), [_, v] = J(() => h?.text ?? c.state.doc.textBetween(g.from, g.to)), [y] = J(() => !!(h || _)), [b, x] = J(h?.href ?? ""), [S, C] = J((h ? h.target : t.defaultLinkTarget) !== "_self");
461
- K(() => {
462
+ }), [_, v] = q(() => h?.text ?? c.state.doc.textBetween(g.from, g.to)), [y] = q(() => !!(h || _)), [b, x] = q(h?.href ?? ""), [S, C] = q((h ? h.target : t.defaultLinkTarget) !== "_self");
463
+ G(() => {
462
464
  let e = ({ transaction: e, appendedTransactions: t }) => {
463
465
  (e.docChanged || t.some(({ docChanged: e }) => e)) && i();
464
466
  };
@@ -468,29 +470,29 @@ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
468
470
  }, [c, i]);
469
471
  function w() {
470
472
  if (!c.isEditable) return;
471
- let e = ce(b);
473
+ let e = se(b);
472
474
  e ? (l.insertLinkText(e, _, {
473
475
  target: S ? "_blank" : "_self",
474
476
  range: g
475
477
  }), i()) : d(u(b.trim() ? "notify.linkInvalid" : "notify.linkEmpty"), "warning");
476
478
  }
477
- return /* @__PURE__ */ U(kn, {
479
+ return /* @__PURE__ */ H(Rn, {
478
480
  className: e?.className,
479
481
  context: t,
480
482
  anchor: r.anchor,
481
483
  overlayTarget: n,
482
484
  title: u(y ? "command.link" : "toolbar.link.popoverLabel"),
483
485
  onClose: i,
484
- children: /* @__PURE__ */ W("form", {
486
+ children: /* @__PURE__ */ U("form", {
485
487
  className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
486
488
  onSubmit: (e) => {
487
489
  e.preventDefault(), w();
488
490
  },
489
491
  children: [
490
- /* @__PURE__ */ W("label", {
492
+ /* @__PURE__ */ U("label", {
491
493
  htmlFor: p,
492
494
  className: "grid gap-1.5",
493
- children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.textLabel") }), /* @__PURE__ */ U(a, {
495
+ children: [/* @__PURE__ */ H("span", { children: u("toolbar.link.textLabel") }), /* @__PURE__ */ H(a, {
494
496
  className: s,
495
497
  id: p,
496
498
  value: _,
@@ -498,10 +500,10 @@ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
498
500
  onChange: (e) => v(e.currentTarget.value)
499
501
  })]
500
502
  }),
501
- /* @__PURE__ */ W("label", {
503
+ /* @__PURE__ */ U("label", {
502
504
  htmlFor: m,
503
505
  className: "grid gap-1.5",
504
- children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.hrefLabel") }), /* @__PURE__ */ U(a, {
506
+ children: [/* @__PURE__ */ H("span", { children: u("toolbar.link.hrefLabel") }), /* @__PURE__ */ H(a, {
505
507
  className: s,
506
508
  id: m,
507
509
  "data-initial-focus": !0,
@@ -510,31 +512,31 @@ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
510
512
  onChange: (e) => x(e.currentTarget.value)
511
513
  })]
512
514
  }),
513
- /* @__PURE__ */ W("div", {
515
+ /* @__PURE__ */ U("div", {
514
516
  className: "vibe-shadcn-tiptap__checkbox-field flex items-center gap-1.5",
515
- children: [/* @__PURE__ */ U(yn, {
517
+ children: [/* @__PURE__ */ H(On, {
516
518
  appearance: e?.checkbox,
517
- children: /* @__PURE__ */ U(o, {
519
+ children: /* @__PURE__ */ H(o, {
518
520
  id: f,
519
521
  checked: S,
520
522
  onCheckedChange: (e) => C(e === !0)
521
523
  })
522
- }), /* @__PURE__ */ U("label", {
524
+ }), /* @__PURE__ */ H("label", {
523
525
  htmlFor: f,
524
526
  children: u("toolbar.link.openInNewWindow")
525
527
  })]
526
528
  }),
527
- /* @__PURE__ */ W("div", {
528
- className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions justify-end", Z),
529
+ /* @__PURE__ */ U("div", {
530
+ className: J("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions justify-end", X),
529
531
  children: [
530
- h && /* @__PURE__ */ U(Q, {
532
+ h && /* @__PURE__ */ H(Q, {
531
533
  type: "button",
532
534
  onClick: () => {
533
535
  c.isEditable && (l.setLink("", { range: g }), d(u("notify.linkRemoved"), "success"), i());
534
536
  },
535
537
  children: u("toolbar.link.remove")
536
538
  }),
537
- /* @__PURE__ */ U(Q, {
539
+ /* @__PURE__ */ H(Q, {
538
540
  type: "button",
539
541
  variant: "ghost",
540
542
  className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
@@ -543,7 +545,7 @@ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
543
545
  },
544
546
  children: u("toolbar.action.cancel")
545
547
  }),
546
- /* @__PURE__ */ U(Q, {
548
+ /* @__PURE__ */ H(Q, {
547
549
  type: "submit",
548
550
  children: u("toolbar.action.confirm")
549
551
  })
@@ -553,33 +555,33 @@ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
553
555
  })
554
556
  });
555
557
  }
556
- var jn = {
558
+ var Bn = {
557
559
  image: "notify.invalidImageUrl",
558
560
  video: "notify.invalidVideoUrl",
559
561
  audio: "notify.invalidAudioUrl",
560
562
  attachment: "notify.invalidFileUrl"
561
- }, Mn = {
562
- image: st,
563
- video: $e,
564
- audio: St,
565
- attachment: wt
563
+ }, Vn = {
564
+ image: lt,
565
+ video: tt,
566
+ audio: wt,
567
+ attachment: Et
566
568
  };
567
- function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
568
- let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = Mn[p], g = Te(), _ = p === "attachment" ? "file" : p, v = z(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[ie(_)], x = b && i, S = b && (p !== "image" || v.image.allowUrl), C = x || S, [w, T] = J(n.tab ?? (x ? "upload" : "url")), E = w === "upload" ? x ? "upload" : "url" : S ? "url" : "upload", [ee, D] = J(""), O = q(void 0), k = q(o);
569
- K(() => {
570
- k.current = o;
571
- }, [o]), K(() => {
569
+ function Hn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
570
+ let { Input: s, Tabs: c } = Y(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = Vn[p], g = Ee(), _ = p === "attachment" ? "file" : p, v = le(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[re(_)], x = b && i, S = b && (p !== "image" || v.image.allowUrl), C = x || S, [w, T] = q(n.tab ?? (x ? "upload" : "url")), E = w === "upload" ? x ? "upload" : "url" : S ? "url" : "upload", [D, O] = q(""), k = K(void 0), A = K(o);
571
+ G(() => {
572
+ A.current = o;
573
+ }, [o]), G(() => {
572
574
  if (!C) {
573
- k.current();
575
+ A.current();
574
576
  return;
575
577
  }
576
- let e = pe(l, () => k.current());
577
- return O.current = e, () => {
578
- e.dispose(), O.current = void 0;
578
+ let e = pe(l, () => A.current());
579
+ return k.current = e, () => {
580
+ e.dispose(), k.current = void 0;
579
581
  };
580
582
  }, [C, l]);
581
- function A(e) {
582
- let t = O.current?.range;
583
+ function j(e) {
584
+ let t = k.current?.range;
583
585
  if (!t || !l.isEditable || !x || e.length === 0) return;
584
586
  let n = {
585
587
  image: u.uploadAndInsertImage,
@@ -588,105 +590,105 @@ function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
588
590
  attachment: u.uploadAndInsertFile
589
591
  }[p];
590
592
  o(), n(y.multiple ? e : e.slice(0, 1), t).catch(() => {
591
- l.isDestroyed || le(f, d, _);
593
+ l.isDestroyed || ce(f, d, _);
592
594
  });
593
595
  }
594
- function j() {
595
- let e = O.current?.range;
596
+ function M() {
597
+ let e = k.current?.range;
596
598
  if (!e || !l.isEditable || !S) return;
597
- let t = ce(ee);
598
- if (!t) f(d(jn[p]), "warning");
599
+ let t = se(D);
600
+ if (!t) f(d(Bn[p]), "warning");
599
601
  else {
600
602
  if (p === "video" || p === "audio") {
601
603
  if (!(p === "video" ? u.insertVideoUrl : u.insertAudioUrl)(t, e)) {
602
- f(d(jn[p]), "warning");
604
+ f(d(Bn[p]), "warning");
603
605
  return;
604
606
  }
605
607
  } else l.commands.setTextSelection(e), p === "image" ? u.setImage(t) : u.insertFile(t);
606
608
  o();
607
609
  }
608
610
  }
609
- return C ? /* @__PURE__ */ W(kn, {
611
+ return C ? /* @__PURE__ */ U(Rn, {
610
612
  className: e?.className,
611
613
  context: t,
612
614
  anchor: m,
613
615
  overlayTarget: r,
614
616
  title: d(`toolbar.${p}.${E}`),
615
617
  onClose: o,
616
- children: [/* @__PURE__ */ W(c.Root, {
618
+ children: [/* @__PURE__ */ U(c.Root, {
617
619
  className: e?.tabs?.className,
618
620
  value: E,
619
621
  onValueChange: (e) => {
620
622
  (e === "upload" || e === "url") && T(e);
621
623
  },
622
624
  children: [
623
- x && S && /* @__PURE__ */ W(c.List, {
624
- className: Y("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
625
+ x && S && /* @__PURE__ */ U(c.List, {
626
+ className: J("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
625
627
  "aria-label": d(`command.${p}`),
626
- children: [/* @__PURE__ */ U(yn, {
628
+ children: [/* @__PURE__ */ H(On, {
627
629
  appearance: e?.tabs?.trigger,
628
- children: /* @__PURE__ */ U(c.Trigger, {
630
+ children: /* @__PURE__ */ H(c.Trigger, {
629
631
  value: "upload",
630
632
  children: d(`toolbar.${p}.upload`)
631
633
  })
632
- }), /* @__PURE__ */ U(yn, {
634
+ }), /* @__PURE__ */ H(On, {
633
635
  appearance: e?.tabs?.trigger,
634
- children: /* @__PURE__ */ U(c.Trigger, {
636
+ children: /* @__PURE__ */ H(c.Trigger, {
635
637
  value: "url",
636
638
  children: d(`toolbar.${p}.url`)
637
639
  })
638
640
  })]
639
641
  }),
640
- x && E === "upload" && /* @__PURE__ */ U(c.Content, {
642
+ x && E === "upload" && /* @__PURE__ */ H(c.Content, {
641
643
  value: "upload",
642
644
  className: e?.tabs?.contentClassName,
643
- children: /* @__PURE__ */ W("label", {
644
- className: Y("vibe-shadcn-tiptap__drop relative my-2 grid justify-items-center gap-2 rounded-md border-2 border-dashed border-muted-foreground bg-muted p-4 text-center text-foreground hover:border-primary hover:bg-accent has-[:focus-visible]:border-ring", e?.uploadClassName),
645
+ children: /* @__PURE__ */ U("label", {
646
+ className: J("vibe-shadcn-tiptap__drop relative my-2 grid justify-items-center gap-2 rounded-md border-2 border-dashed border-muted-foreground bg-muted p-4 text-center text-foreground hover:border-primary hover:bg-accent has-[:focus-visible]:border-ring", e?.uploadClassName),
645
647
  onDragOver: (e) => e.preventDefault(),
646
648
  onDrop: (e) => {
647
- e.preventDefault(), A(Array.from(e.dataTransfer.files));
649
+ e.preventDefault(), j(Array.from(e.dataTransfer.files));
648
650
  },
649
651
  children: [
650
- /* @__PURE__ */ U("input", {
652
+ /* @__PURE__ */ H("input", {
651
653
  className: "absolute inset-0 size-full cursor-pointer opacity-0",
652
654
  type: "file",
653
655
  "data-initial-focus": !0,
654
656
  accept: y.accept,
655
657
  multiple: y.multiple,
656
- onChange: (e) => A(Array.from(e.currentTarget.files ?? []))
658
+ onChange: (e) => j(Array.from(e.currentTarget.files ?? []))
657
659
  }),
658
- /* @__PURE__ */ U(h, {
660
+ /* @__PURE__ */ H(h, {
659
661
  size: 28,
660
662
  className: "text-muted-foreground",
661
663
  "aria-hidden": "true"
662
664
  }),
663
- /* @__PURE__ */ U("span", { children: d(`toolbar.${p}.dropHint`) })
665
+ /* @__PURE__ */ H("span", { children: d(`toolbar.${p}.dropHint`) })
664
666
  ]
665
667
  })
666
668
  }),
667
- S && E === "url" && /* @__PURE__ */ U(c.Content, {
669
+ S && E === "url" && /* @__PURE__ */ H(c.Content, {
668
670
  value: "url",
669
671
  className: e?.tabs?.contentClassName,
670
- children: /* @__PURE__ */ U("form", {
672
+ children: /* @__PURE__ */ H("form", {
671
673
  id: g,
672
674
  className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
673
675
  onSubmit: (e) => {
674
- e.preventDefault(), j();
676
+ e.preventDefault(), M();
675
677
  },
676
- children: /* @__PURE__ */ U(s, {
677
- className: Y(hn[e?.input?.variant ?? "default"], e?.input?.className),
678
+ children: /* @__PURE__ */ H(s, {
679
+ className: J(Tn[e?.input?.variant ?? "default"], e?.input?.className),
678
680
  "data-initial-focus": !0,
679
681
  "aria-label": d(`toolbar.${p}.url`),
680
682
  placeholder: d(`toolbar.${p}.urlPlaceholder`),
681
- value: ee,
682
- onChange: (e) => D(e.currentTarget.value)
683
+ value: D,
684
+ onChange: (e) => O(e.currentTarget.value)
683
685
  })
684
686
  })
685
687
  })
686
688
  ]
687
- }), /* @__PURE__ */ W("div", {
688
- className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", Z),
689
- children: [/* @__PURE__ */ U(Q, {
689
+ }), /* @__PURE__ */ U("div", {
690
+ className: J("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", X),
691
+ children: [/* @__PURE__ */ H(Q, {
690
692
  type: "button",
691
693
  variant: "ghost",
692
694
  className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
@@ -694,7 +696,7 @@ function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
694
696
  o(), (m ?? l.view.dom).focus({ preventScroll: !0 });
695
697
  },
696
698
  children: d("toolbar.action.cancel")
697
- }), E === "url" && /* @__PURE__ */ U(Q, {
699
+ }), E === "url" && /* @__PURE__ */ H(Q, {
698
700
  type: "submit",
699
701
  form: g,
700
702
  children: d("toolbar.action.confirm")
@@ -703,10 +705,10 @@ function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
703
705
  }) : null;
704
706
  }
705
707
  // src/table-picker.tsx
706
- var Pn = Se(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
707
- return /* @__PURE__ */ U("button", {
708
+ var Un = Ce(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
709
+ return /* @__PURE__ */ H("button", {
708
710
  type: "button",
709
- className: Y("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
711
+ className: J("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
710
712
  "aria-label": `${e} × ${t}`,
711
713
  "data-cell": `${e}-${t}`,
712
714
  "data-active": n || void 0,
@@ -720,12 +722,12 @@ var Pn = Se(function({ row: e, col: t, active: n, current: r, className: i, grid
720
722
  }
721
723
  });
722
724
  });
723
- function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
724
- let { Popover: o } = X(), { editor: s, commands: c, t: l } = t, [u, d] = J(!1), [f, p] = J({
725
+ function Wn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
726
+ let { Popover: o } = Y(), { editor: s, commands: c, t: l } = t, [u, d] = q(!1), [f, p] = q({
725
727
  row: 1,
726
728
  col: 1
727
- }), m = q(void 0), h = q(!1), g = q(null), { maxRows: _, maxCols: v } = i;
728
- K(() => {
729
+ }), m = K(void 0), h = K(!1), g = K(null), { maxRows: _, maxCols: v } = i;
730
+ G(() => {
729
731
  if (!u || a) return;
730
732
  let e = pe(s, () => d(!1));
731
733
  return m.current = e, () => {
@@ -736,12 +738,12 @@ function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
736
738
  s,
737
739
  u
738
740
  ]);
739
- let y = Ce((e, t) => {
741
+ let y = we((e, t) => {
740
742
  p((n) => n.row === e && n.col === t ? n : {
741
743
  row: e,
742
744
  col: t
743
745
  });
744
- }, []), b = Ce((e, t) => {
746
+ }, []), b = we((e, t) => {
745
747
  let n = m.current?.range;
746
748
  n && s.isEditable && !a && (h.current = !0, s.commands.setTextSelection(n), c.insertTable(e, t), d(!1));
747
749
  }, [
@@ -749,7 +751,7 @@ function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
749
751
  a,
750
752
  s
751
753
  ]);
752
- return /* @__PURE__ */ W(o.Root, {
754
+ return /* @__PURE__ */ U(o.Root, {
753
755
  open: u && !a,
754
756
  onOpenChange: (e) => {
755
757
  e && (h.current = !1, p({
@@ -757,32 +759,32 @@ function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
757
759
  col: 1
758
760
  })), d(e);
759
761
  },
760
- children: [/* @__PURE__ */ U(o.Trigger, {
762
+ children: [/* @__PURE__ */ H(o.Trigger, {
761
763
  asChild: !0,
762
764
  children: n
763
- }), r && /* @__PURE__ */ W(o.Content, {
765
+ }), r && /* @__PURE__ */ U(o.Content, {
764
766
  container: r,
765
- className: Y("z-3 box-border max-w-[calc(100dvw-1rem)]", e?.className),
767
+ className: J("z-3 vibe-shadcn-tiptap__popover box-border max-w-[calc(100dvw-1rem)]", e?.className),
766
768
  "aria-label": l("command.table"),
767
769
  align: "start",
768
770
  sideOffset: 4,
769
771
  onCloseAutoFocus: (e) => {
770
772
  h.current && e.preventDefault();
771
773
  },
772
- children: [/* @__PURE__ */ W("div", {
774
+ children: [/* @__PURE__ */ U("div", {
773
775
  "aria-live": "polite",
774
776
  children: [
775
777
  f.row,
776
778
  " × ",
777
779
  f.col
778
780
  ]
779
- }), /* @__PURE__ */ U("div", {
781
+ }), /* @__PURE__ */ H("div", {
780
782
  ref: g,
781
783
  className: "vibe-shadcn-tiptap__table-picker grid min-w-0 gap-1 overflow-x-auto p-1",
782
784
  style: { gridTemplateColumns: `repeat(${v}, max-content)` },
783
785
  children: Array.from({ length: _ * v }, (t, n) => {
784
786
  let r = Math.floor(n / v) + 1, i = n % v + 1;
785
- return /* @__PURE__ */ U(Pn, {
787
+ return /* @__PURE__ */ H(Un, {
786
788
  row: r,
787
789
  col: i,
788
790
  active: r <= f.row && i <= f.col,
@@ -798,8 +800,8 @@ function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
798
800
  });
799
801
  }
800
802
  // src/vibe-tiptap-provider.tsx
801
- var In = ye({});
802
- function Ln(e, t) {
803
+ var Gn = be({});
804
+ function Kn(e, t) {
803
805
  return {
804
806
  components: t.components ?? e.components,
805
807
  ui: t.ui ?? e.ui,
@@ -812,21 +814,21 @@ function Ln(e, t) {
812
814
  showWordCount: t.showWordCount ?? e.showWordCount
813
815
  };
814
816
  }
815
- function Rn({ children: e, mediaResources: t, ...n }) {
816
- let r = we(In), i = {
817
- ...Ln(r, n),
817
+ function qn({ children: e, mediaResources: t, ...n }) {
818
+ let r = Te(Gn), i = {
819
+ ...Kn(r, n),
818
820
  mediaResources: t ?? r.mediaResources
819
821
  };
820
- return /* @__PURE__ */ U(In.Provider, {
822
+ return /* @__PURE__ */ H(Gn.Provider, {
821
823
  value: i,
822
824
  children: e
823
825
  });
824
826
  }
825
- function zn() {
826
- return we(In).mediaResources;
827
+ function Jn() {
828
+ return Te(Gn).mediaResources;
827
829
  }
828
- function Bn(e) {
829
- let { components: t, ...n } = Ln(we(In), e);
830
+ function Yn(e) {
831
+ let { components: t, ...n } = Kn(Te(Gn), e);
830
832
  if (!t) throw Error("Pass a components mapping to VibeTiptapProvider or directly to the editor or toolbar.");
831
833
  return {
832
834
  components: t,
@@ -834,11 +836,11 @@ function Bn(e) {
834
836
  };
835
837
  }
836
838
  // src/whiteboard-dialog.tsx
837
- function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
838
- let { Dialog: o } = X(), { editor: s, t: c } = t, [l, u] = J(null), [d, f] = J(), [p, m] = J(!1), [h, g] = J(""), [_] = J(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs : void 0), v = _?.sceneData, y = _?.caption, b = typeof y == "string" && y.trim() || c("command.whiteboard"), x = q(void 0), S = q(a), C = q(!1), w = q(null), T = q(!1);
839
- K(() => {
839
+ function Xn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
840
+ let { Dialog: o } = Y(), { editor: s, t: c } = t, [l, u] = q(null), [d, f] = q(), [p, m] = q(!1), [h, g] = q(""), [_] = q(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs : void 0), v = _?.sceneData, y = _?.caption, b = typeof y == "string" && y.trim() || c("command.whiteboard"), x = K(void 0), S = K(a), C = K(!1), w = K(null), T = K(null), E = K(!1);
841
+ G(() => {
840
842
  S.current = a;
841
- }, [a]), G(() => {
843
+ }, [a]), W(() => {
842
844
  if (!l) return;
843
845
  let e = l, n = new AbortController(), r = /* @__PURE__ */ new Map(), a, o;
844
846
  async function u() {
@@ -879,7 +881,7 @@ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
879
881
  v,
880
882
  c
881
883
  ]);
882
- async function E() {
884
+ async function D() {
883
885
  let e = x.current;
884
886
  if (!e || !d || C.current || !s.isEditable) return;
885
887
  let { requests: { signal: r }, imageUrls: a, target: o, draft: l } = e, u = () => !r.aborted && !s.isDestroyed && s.isEditable && !!(i ? o?.range : l?.active);
@@ -889,11 +891,11 @@ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
889
891
  if (!u()) return;
890
892
  let f = s.view.dom.ownerDocument.baseURI, { sceneData: p, file: m } = await e(d, a, n, f, r);
891
893
  if (!u()) return;
892
- let h = he(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
894
+ let h = ge(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
893
895
  if (h?.reason === "too-large") {
894
896
  g(c("notify.assetFileTooLarge", {
895
- size: M(h.size),
896
- limit: M(h.maxSize)
897
+ size: N(h.size),
898
+ limit: N(h.maxSize)
897
899
  }));
898
900
  return;
899
901
  }
@@ -910,57 +912,59 @@ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
910
912
  src: y,
911
913
  sceneData: p
912
914
  })) throw Error();
913
- T.current = !0, S.current(), s.commands.focus();
915
+ E.current = !0, S.current(), s.commands.focus();
914
916
  } catch {
915
917
  r.aborted || g(c("whiteboard.saveFailed"));
916
918
  } finally {
917
919
  C.current = !1, r.aborted || m(!1);
918
920
  }
919
921
  }
920
- return /* @__PURE__ */ U(_n, {
922
+ return /* @__PURE__ */ H(Z, {
921
923
  value: e?.button,
922
- children: /* @__PURE__ */ U(o.Root, {
924
+ children: /* @__PURE__ */ H(o.Root, {
923
925
  open: !0,
924
926
  onOpenChange: (e) => {
925
927
  !e && !p && a();
926
928
  },
927
- children: /* @__PURE__ */ W(o.Content, {
929
+ children: /* @__PURE__ */ U(o.Content, {
928
930
  container: r,
929
931
  overlayClassName: "vibe-shadcn-tiptap__backdrop",
930
- className: Y("vibe-shadcn-tiptap__whiteboard", e?.className),
932
+ className: J("vibe-shadcn-tiptap__whiteboard", e?.className),
931
933
  "data-excalidraw-modal-root": !0,
932
934
  "aria-describedby": void 0,
933
935
  onInteractOutside: (e) => e.preventDefault(),
934
936
  onEscapeKeyDown: (e) => {
935
937
  p && e.preventDefault();
936
938
  },
937
- onOpenAutoFocus: () => {
938
- let e = r.ownerDocument.activeElement;
939
- e instanceof HTMLElement && (w.current = e);
939
+ onOpenAutoFocus: (e) => {
940
+ let t = r.ownerDocument.activeElement;
941
+ t instanceof HTMLElement && (w.current = t), e.preventDefault(), T.current?.focus({ preventScroll: !0 });
940
942
  },
941
943
  onCloseAutoFocus: (e) => {
942
- if (e.preventDefault(), !T.current && !s.isDestroyed) {
944
+ if (e.preventDefault(), !E.current && !s.isDestroyed) {
943
945
  let e = w.current;
944
946
  (e && r.parentElement?.contains(e) ? e : s.view.dom).focus();
945
947
  }
946
948
  },
947
- children: [/* @__PURE__ */ W("header", {
948
- className: Y("vibe-shadcn-tiptap__actions", Z),
949
+ children: [/* @__PURE__ */ U("header", {
950
+ ref: T,
951
+ tabIndex: -1,
952
+ className: J("vibe-shadcn-tiptap__actions", X),
949
953
  children: [
950
- /* @__PURE__ */ W(o.Title, {
954
+ /* @__PURE__ */ U(o.Title, {
951
955
  className: "vibe-shadcn-tiptap__whiteboard-title",
952
- children: [/* @__PURE__ */ U(Et, {
956
+ children: [/* @__PURE__ */ H(Ot, {
953
957
  size: 16,
954
958
  "aria-hidden": "true"
955
- }), /* @__PURE__ */ U("span", { children: b })]
959
+ }), /* @__PURE__ */ H("span", { children: b })]
956
960
  }),
957
- h && /* @__PURE__ */ U("span", {
961
+ h && /* @__PURE__ */ H("span", {
958
962
  role: "alert",
959
963
  children: h
960
964
  }),
961
- /* @__PURE__ */ U(o.Close, {
965
+ /* @__PURE__ */ H(o.Close, {
962
966
  asChild: !0,
963
- children: /* @__PURE__ */ U(Q, {
967
+ children: /* @__PURE__ */ H(Q, {
964
968
  type: "button",
965
969
  variant: "ghost",
966
970
  className: "vibe-shadcn-tiptap__button",
@@ -969,21 +973,21 @@ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
969
973
  children: c("toolbar.action.cancel")
970
974
  })
971
975
  }),
972
- /* @__PURE__ */ W(Q, {
976
+ /* @__PURE__ */ U(Q, {
973
977
  type: "button",
974
978
  variant: "default",
975
979
  className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__whiteboard-save",
976
980
  disabled: !d || p,
977
981
  "aria-busy": p || void 0,
978
- onClick: () => void E(),
979
- children: [p && /* @__PURE__ */ U(vt, {
982
+ onClick: () => void D(),
983
+ children: [p && /* @__PURE__ */ H(bt, {
980
984
  "aria-hidden": "true",
981
985
  className: "vibe-shadcn-tiptap__spinner",
982
986
  size: 16
983
987
  }), c("whiteboard.save")]
984
988
  })
985
989
  ]
986
- }), /* @__PURE__ */ U("div", {
990
+ }), /* @__PURE__ */ H("div", {
987
991
  ref: u,
988
992
  className: "vibe-shadcn-tiptap__whiteboard-canvas",
989
993
  inert: p
@@ -993,131 +997,131 @@ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
993
997
  });
994
998
  }
995
999
  // src/shadcn-tiptap-toolbar.tsx
996
- var Hn = {
997
- undo: Gt,
998
- redo: jt,
999
- bold: Le,
1000
- italic: pt,
1001
- underline: Wt,
1002
- strike: Lt,
1003
- code: We,
1004
- superscript: zt,
1005
- subscript: Rt,
1006
- color: Ct,
1007
- highlight: ot,
1008
- clearFormat: Xe,
1009
- align: je,
1010
- decreaseIndent: dt,
1011
- increaseIndent: ft,
1012
- firstLineIndent: Gn,
1013
- bulletList: ht,
1014
- orderedList: _t,
1015
- taskList: gt,
1016
- blockquote: At,
1017
- codeBlock: Ge,
1018
- link: mt,
1019
- image: st,
1020
- video: $e,
1021
- audio: St,
1022
- attachment: wt,
1023
- table: Bt,
1024
- whiteboard: Et,
1025
- hr: xt,
1026
- findReplace: It,
1027
- markdown: Kn,
1028
- print: kt,
1029
- preview: Qe,
1030
- fullscreen: yt
1031
- }, Un = {
1032
- left: je,
1033
- center: ke,
1034
- right: Me,
1035
- justify: Ae
1036
- }, Wn = {
1037
- 0: Dt,
1038
- 1: et,
1039
- 2: tt,
1040
- 3: nt,
1041
- 4: rt,
1042
- 5: it,
1043
- 6: at
1000
+ var Zn = {
1001
+ undo: Qt,
1002
+ redo: Mt,
1003
+ bold: Re,
1004
+ italic: ht,
1005
+ underline: Zt,
1006
+ strike: Vt,
1007
+ code: Ge,
1008
+ superscript: Ut,
1009
+ subscript: Ht,
1010
+ color: Tt,
1011
+ highlight: ct,
1012
+ clearFormat: Qe,
1013
+ align: Me,
1014
+ decreaseIndent: pt,
1015
+ increaseIndent: mt,
1016
+ firstLineIndent: er,
1017
+ bulletList: _t,
1018
+ orderedList: yt,
1019
+ taskList: vt,
1020
+ blockquote: jt,
1021
+ codeBlock: Ke,
1022
+ link: gt,
1023
+ image: lt,
1024
+ video: tt,
1025
+ audio: wt,
1026
+ attachment: Et,
1027
+ table: Wt,
1028
+ whiteboard: Ot,
1029
+ hr: Ct,
1030
+ findReplace: Bt,
1031
+ markdown: tr,
1032
+ print: At,
1033
+ preview: et,
1034
+ fullscreen: xt
1035
+ }, Qn = {
1036
+ left: Me,
1037
+ center: Ae,
1038
+ right: Ne,
1039
+ justify: je
1040
+ }, $n = {
1041
+ 0: kt,
1042
+ 1: nt,
1043
+ 2: rt,
1044
+ 3: it,
1045
+ 4: at,
1046
+ 5: ot,
1047
+ 6: st
1044
1048
  };
1045
- function Gn({ size: e }) {
1046
- return /* @__PURE__ */ U("svg", {
1049
+ function er({ size: e }) {
1050
+ return /* @__PURE__ */ H("svg", {
1047
1051
  width: e,
1048
1052
  height: e,
1049
- viewBox: nn,
1053
+ viewBox: un,
1050
1054
  fill: "none",
1051
1055
  stroke: "currentColor",
1052
- strokeWidth: Qt.strokeWidth,
1056
+ strokeWidth: on.strokeWidth,
1053
1057
  strokeLinecap: "round",
1054
1058
  strokeLinejoin: "round",
1055
1059
  "aria-hidden": "true",
1056
1060
  focusable: "false",
1057
- children: Qt.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
1061
+ children: on.paths.map((e) => /* @__PURE__ */ H("path", { d: e }, e))
1058
1062
  });
1059
1063
  }
1060
- function Kn({ size: e, action: t }) {
1061
- return /* @__PURE__ */ W("svg", {
1064
+ function tr({ size: e, action: t }) {
1065
+ return /* @__PURE__ */ U("svg", {
1062
1066
  width: e,
1063
1067
  height: e,
1064
- viewBox: nn,
1068
+ viewBox: un,
1065
1069
  fill: "none",
1066
1070
  stroke: "currentColor",
1067
- strokeWidth: tn.strokeWidth,
1071
+ strokeWidth: ln.strokeWidth,
1068
1072
  strokeLinecap: "round",
1069
1073
  strokeLinejoin: "round",
1070
1074
  "aria-hidden": "true",
1071
1075
  focusable: "false",
1072
- children: [/* @__PURE__ */ U("g", {
1073
- transform: t ? en : void 0,
1074
- children: tn.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
1075
- }), t && $t[t].map((e) => /* @__PURE__ */ U("path", { d: e }, e))]
1076
+ children: [/* @__PURE__ */ H("g", {
1077
+ transform: t ? cn : void 0,
1078
+ children: ln.paths.map((e) => /* @__PURE__ */ H("path", { d: e }, e))
1079
+ }), t && sn[t].map((e) => /* @__PURE__ */ H("path", { d: e }, e))]
1076
1080
  });
1077
1081
  }
1078
- function qn(e) {
1082
+ function nr(e) {
1079
1083
  let { components: t, showWordCount: n, ...r } = {
1080
1084
  ...e,
1081
- ...Bn(e)
1085
+ ...Yn(e)
1082
1086
  }, { Tooltip: i } = t;
1083
- return /* @__PURE__ */ U(pn, {
1087
+ return /* @__PURE__ */ H(Cn, {
1084
1088
  value: t,
1085
- children: /* @__PURE__ */ U(i.Provider, {
1089
+ children: /* @__PURE__ */ H(i.Provider, {
1086
1090
  delayDuration: 500,
1087
1091
  skipDelayDuration: 0,
1088
- children: /* @__PURE__ */ U(Jn, { ...r }, r.context.editor.instanceId)
1092
+ children: /* @__PURE__ */ H(rr, { ...r }, r.context.editor.instanceId)
1089
1093
  })
1090
1094
  });
1091
1095
  }
1092
- function Jn(e) {
1093
- let { DropdownMenu: t, Select: n } = X(), i = e.bubble ? void 0 : e.ui?.toolbar, { context: a, preview: o, fullscreen: c, uploadAsset: u } = e, { editor: f, commands: h, t: _ } = a;
1094
- H(a, (e) => e.getToolbarRevision());
1095
- let [v, y] = J(null), [b, S] = J(), [w, T] = J(!1), [D, O] = J(!1), k = q(null), A = e.overlayTarget ?? v ?? void 0, j = f.isEditable, te = z(e.editorBehaviorOptions), ne = ee(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), M = Ee(() => r(e.colors, e.highlights), [e.colors, e.highlights]), P = oe(f), ae = m(e.markdownOptions), F = /* @__PURE__ */ new Map(), I = E(e.toolbar).map((e) => {
1096
- let t = e.join(" "), n = F.get(t) ?? 0;
1097
- return F.set(t, n + 1), {
1096
+ function rr(e) {
1097
+ let { DropdownMenu: t, Select: n } = Y(), i = e.bubble ? void 0 : e.ui?.toolbar, { context: a, preview: o, fullscreen: c, uploadAsset: u } = e, { editor: f, commands: h, t: _ } = a;
1098
+ he(a, (e) => e.getToolbarRevision());
1099
+ let [v, y] = q(null), [b, S] = q(), [w, T] = q(!1), [O, k] = q(!1), A = K(null), j = e.overlayTarget ?? v ?? void 0, M = f.isEditable, ee = le(e.editorBehaviorOptions), te = D(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), N = De(() => r(e.colors, e.highlights), [e.colors, e.highlights]), F = ae(f), ie = m(e.markdownOptions), I = /* @__PURE__ */ new Map(), L = E(e.toolbar).map((e) => {
1100
+ let t = e.join(" "), n = I.get(t) ?? 0;
1101
+ return I.set(t, n + 1), {
1098
1102
  id: `${t}:${n}`,
1099
- buttons: e.filter(ce)
1103
+ buttons: e.filter(se)
1100
1104
  };
1101
1105
  }).filter(({ buttons: e }) => e.length > 0);
1102
- G(() => {
1103
- j || (S(void 0), O(!1));
1104
- }, [j]);
1105
- function ce(e) {
1106
- return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!P : e === "preview" ? o !== void 0 : e === "fullscreen" ? c !== void 0 : o ? e === "print" : e === "whiteboard" ? !!(u && f.schema.nodes.whiteboard) : e === "image" && !u && !te.image.allowUrl ? !1 : e === "image" || e === "video" || e === "audio" || e === "attachment" ? !!f.schema.nodes[ie(e === "attachment" ? "file" : e)] : !0;
1106
+ W(() => {
1107
+ M || (S(void 0), k(!1));
1108
+ }, [M]);
1109
+ function se(e) {
1110
+ return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!F : e === "preview" ? o !== void 0 : e === "fullscreen" ? c !== void 0 : o ? e === "print" : e === "whiteboard" ? !!(u && f.schema.nodes.whiteboard) : e === "image" && !u && !ee.image.allowUrl ? !1 : e === "image" || e === "video" || e === "audio" || e === "attachment" ? !!f.schema.nodes[re(e === "attachment" ? "file" : e)] : !0;
1107
1111
  }
1108
- function R(e, t) {
1109
- return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !L(a, e, t);
1112
+ function z(e, t) {
1113
+ return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !M : !M && e !== "findReplace" || e !== "whiteboard" && !R(a, e, t);
1110
1114
  }
1111
- function le(e, t) {
1115
+ function ce(e, t) {
1112
1116
  if (e === "preview") return o;
1113
1117
  if (e === "fullscreen") return c;
1114
- if (e !== "print" && e !== "markdown" && e !== "whiteboard") return se(a, e, t);
1118
+ if (e !== "print" && e !== "markdown" && e !== "whiteboard") return oe(a, e, t);
1115
1119
  }
1116
1120
  function B(t, n) {
1117
- R(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
1121
+ z(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
1118
1122
  ...e.printOptions,
1119
1123
  t: _
1120
- }) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : O(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" && de(a, t, n));
1124
+ }) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : k(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" && de(a, t, n));
1121
1125
  }
1122
1126
  function ue(t, n, r) {
1123
1127
  let i = {
@@ -1128,7 +1132,7 @@ function Jn(e) {
1128
1132
  attachment: void 0
1129
1133
  };
1130
1134
  if (t === "link" || t === "image" || t === "video" || t === "audio" || t === "attachment") {
1131
- if (R(t)) return;
1135
+ if (z(t)) return;
1132
1136
  let e = i[t];
1133
1137
  e ? e() : S((e) => e?.triggerId === r ? void 0 : {
1134
1138
  triggerId: r,
@@ -1141,58 +1145,58 @@ function Jn(e) {
1141
1145
  }
1142
1146
  function V(r, u) {
1143
1147
  let p = `${u}:${r}`;
1144
- if (r === "color" || r === "highlight") return /* @__PURE__ */ U(Dn, {
1148
+ if (r === "color" || r === "highlight") return /* @__PURE__ */ H(In, {
1145
1149
  appearance: e.ui?.colorPicker,
1146
1150
  context: a,
1147
1151
  kind: r,
1148
- disabled: R(r),
1149
- colors: r === "color" ? M.colors : M.highlights,
1150
- overlayTarget: A,
1152
+ disabled: z(r),
1153
+ colors: r === "color" ? N.colors : N.highlights,
1154
+ overlayTarget: j,
1151
1155
  bubble: e.bubble,
1152
1156
  open: e.bubble ? e.openPalette === r : void 0,
1153
1157
  onOpenChange: (t) => e.onPaletteOpenChange?.(r, t)
1154
1158
  }, r);
1155
1159
  if (r === "heading") {
1156
- let t = i?.heading, o = N(a), s = Wn[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ W("span", {
1157
- className: Y("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
1158
- children: [/* @__PURE__ */ U(s, {
1160
+ let t = i?.heading, o = P(a), s = $n[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ U("span", {
1161
+ className: J("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
1162
+ children: [/* @__PURE__ */ H(s, {
1159
1163
  size: 16,
1160
1164
  "aria-hidden": !0
1161
1165
  }), l(o)]
1162
1166
  });
1163
- return /* @__PURE__ */ W(n.Root, {
1167
+ return /* @__PURE__ */ U(n.Root, {
1164
1168
  value: c,
1165
- disabled: R(r),
1169
+ disabled: z(r),
1166
1170
  onValueChange: (e) => B(r, Number(e)),
1167
- children: [/* @__PURE__ */ U(n.Trigger, {
1171
+ children: [/* @__PURE__ */ H(n.Trigger, {
1168
1172
  asChild: !0,
1169
- children: /* @__PURE__ */ W(Q, {
1173
+ children: /* @__PURE__ */ U(Q, {
1170
1174
  appearance: t?.button,
1171
1175
  type: "button",
1172
1176
  className: "vibe-shadcn-tiptap__button",
1173
1177
  "aria-label": _("command.heading"),
1174
1178
  "data-toolbar-key": e.bubble ? void 0 : r,
1175
1179
  onMouseDown: (e) => e.preventDefault(),
1176
- children: [/* @__PURE__ */ U(n.Value, {
1180
+ children: [/* @__PURE__ */ H(n.Value, {
1177
1181
  placeholder: u,
1178
1182
  children: u
1179
- }), /* @__PURE__ */ U(Be, { size: 12 })]
1183
+ }), /* @__PURE__ */ H(Ve, { size: 12 })]
1180
1184
  })
1181
- }), A && /* @__PURE__ */ U(n.Content, {
1182
- container: A,
1185
+ }), j && /* @__PURE__ */ H(n.Content, {
1186
+ container: j,
1183
1187
  position: "item-aligned",
1184
- className: Y("z-3", t?.contentClassName),
1188
+ className: J("z-3", t?.contentClassName),
1185
1189
  onCloseAutoFocus: (e) => {
1186
1190
  f.isFocused && e.preventDefault();
1187
1191
  },
1188
1192
  children: C.map(({ level: e }) => {
1189
- let i = Wn[e], a = String(e) === c;
1190
- return /* @__PURE__ */ W(n.Item, {
1193
+ let i = $n[e], a = String(e) === c;
1194
+ return /* @__PURE__ */ U(n.Item, {
1191
1195
  value: String(e),
1192
- className: Y("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
1193
- disabled: !a && R(r, e),
1196
+ className: J("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
1197
+ disabled: !a && z(r, e),
1194
1198
  "data-active": a || void 0,
1195
- children: [/* @__PURE__ */ U(i, {
1199
+ children: [/* @__PURE__ */ H(i, {
1196
1200
  size: 16,
1197
1201
  "aria-hidden": !0
1198
1202
  }), l(e)]
@@ -1201,48 +1205,48 @@ function Jn(e) {
1201
1205
  })]
1202
1206
  }, r);
1203
1207
  }
1204
- let m = r === "preview" && o ? Tt : r === "fullscreen" && c ? bt : r === "align" ? Un[re(a)] : Hn[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ U($, {
1208
+ let m = r === "preview" && o ? Dt : r === "fullscreen" && c ? St : r === "align" ? Qn[ne(a)] : Zn[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ H($, {
1205
1209
  size: "icon",
1206
1210
  label: h,
1207
- overlayTarget: A,
1211
+ overlayTarget: j,
1208
1212
  "data-toolbar-key": e.bubble ? void 0 : r,
1209
- disabled: R(r),
1210
- "aria-pressed": r === "findReplace" ? void 0 : le(r),
1213
+ disabled: z(r),
1214
+ "aria-pressed": r === "findReplace" ? void 0 : ce(r),
1211
1215
  "aria-expanded": r === "findReplace" ? a.findReplaceState.open : r === "link" || r === "image" || r === "video" || r === "audio" || r === "attachment" ? b?.triggerId === p : void 0,
1212
1216
  onMouseDown: (e) => e.preventDefault(),
1213
- children: /* @__PURE__ */ U(m, {
1217
+ children: /* @__PURE__ */ H(m, {
1214
1218
  size: 16,
1215
1219
  "aria-hidden": !0
1216
1220
  })
1217
1221
  });
1218
- if (r === "table") return /* @__PURE__ */ U(Fn, {
1222
+ if (r === "table") return /* @__PURE__ */ H(Wn, {
1219
1223
  appearance: e.ui?.tablePicker,
1220
1224
  context: a,
1221
1225
  trigger: g,
1222
- overlayTarget: A,
1223
- options: ne.tableGrid,
1224
- disabled: R(r)
1226
+ overlayTarget: j,
1227
+ options: te.tableGrid,
1228
+ disabled: z(r)
1225
1229
  }, r);
1226
- if (r === "markdown") return /* @__PURE__ */ W(t.Root, {
1230
+ if (r === "markdown") return /* @__PURE__ */ U(t.Root, {
1227
1231
  modal: !1,
1228
- children: [/* @__PURE__ */ U(t.Trigger, {
1232
+ children: [/* @__PURE__ */ H(t.Trigger, {
1229
1233
  asChild: !0,
1230
1234
  children: g
1231
- }), A && /* @__PURE__ */ U(t.Content, {
1232
- container: A,
1235
+ }), j && /* @__PURE__ */ H(t.Content, {
1236
+ container: j,
1233
1237
  className: "z-3",
1234
1238
  sideOffset: 4,
1235
1239
  align: "start",
1236
- children: s.map(({ value: e }) => /* @__PURE__ */ W(t.Item, {
1240
+ children: s.map(({ value: e }) => /* @__PURE__ */ U(t.Item, {
1237
1241
  className: "vibe-shadcn-tiptap__menu-item",
1238
- disabled: e === "import" ? o || !j || w || !P?.parse : !P?.serialize,
1242
+ disabled: e === "import" ? o || !M || w || !F?.parse : !F?.serialize,
1239
1243
  onSelect: () => {
1240
- e === "import" ? k.current?.click() : e === "export" ? d(a, {
1241
- filename: ae.exportFilename,
1244
+ e === "import" ? A.current?.click() : e === "export" ? d(a, {
1245
+ filename: ie.exportFilename,
1242
1246
  t: _
1243
1247
  }) : l(a, { t: _ });
1244
1248
  },
1245
- children: [/* @__PURE__ */ U(Kn, {
1249
+ children: [/* @__PURE__ */ H(tr, {
1246
1250
  size: 16,
1247
1251
  action: e
1248
1252
  }), _(`toolbar.markdown.${e}`)]
@@ -1251,75 +1255,75 @@ function Jn(e) {
1251
1255
  }, r);
1252
1256
  let v = (() => {
1253
1257
  if (r === "align") return x.map(({ value: e }) => {
1254
- let t = Un[e];
1258
+ let t = Qn[e];
1255
1259
  return {
1256
1260
  value: e,
1257
1261
  label: _(`toolbar.align.${e}`),
1258
- icon: /* @__PURE__ */ U(t, {
1262
+ icon: /* @__PURE__ */ H(t, {
1259
1263
  size: 16,
1260
1264
  "aria-hidden": !0
1261
1265
  })
1262
1266
  };
1263
1267
  });
1264
- if (r === "codeBlock") return ne.codeBlockLanguages;
1265
- if (r === "hr") return ne.horizontalRules.map((e) => ({
1268
+ if (r === "codeBlock") return te.codeBlockLanguages;
1269
+ if (r === "hr") return te.horizontalRules.map((e) => ({
1266
1270
  ...e,
1267
- icon: /* @__PURE__ */ U("span", {
1271
+ icon: /* @__PURE__ */ H("span", {
1268
1272
  className: "vibe-shadcn-tiptap__divider-icon",
1269
1273
  "data-style": e.value,
1270
1274
  "aria-hidden": !0
1271
1275
  })
1272
1276
  }));
1273
1277
  })();
1274
- return v ? /* @__PURE__ */ W(t.Root, {
1278
+ return v ? /* @__PURE__ */ U(t.Root, {
1275
1279
  modal: !1,
1276
- children: [/* @__PURE__ */ U(t.Trigger, {
1280
+ children: [/* @__PURE__ */ H(t.Trigger, {
1277
1281
  asChild: !0,
1278
1282
  children: g
1279
- }), A && /* @__PURE__ */ U(t.Content, {
1280
- container: A,
1283
+ }), j && /* @__PURE__ */ H(t.Content, {
1284
+ container: j,
1281
1285
  align: "start",
1282
1286
  sideOffset: 4,
1283
1287
  className: "z-3",
1284
1288
  onCloseAutoFocus: (e) => {
1285
1289
  f.isFocused && e.preventDefault();
1286
1290
  },
1287
- children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ W(t.Item, {
1291
+ children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ U(t.Item, {
1288
1292
  className: "vibe-shadcn-tiptap__menu-item",
1289
- disabled: R(r, e),
1290
- "data-active": le(r, e) || void 0,
1293
+ disabled: z(r, e),
1294
+ "data-active": ce(r, e) || void 0,
1291
1295
  onSelect: () => B(r, e),
1292
1296
  children: [i, n]
1293
1297
  }, e))
1294
1298
  })]
1295
- }, r) : /* @__PURE__ */ be($, {
1299
+ }, r) : /* @__PURE__ */ xe($, {
1296
1300
  ...g.props,
1297
1301
  key: r,
1298
1302
  onClick: (e) => ue(r, e.currentTarget, p)
1299
1303
  });
1300
1304
  }
1301
- return /* @__PURE__ */ U(_n, {
1305
+ return /* @__PURE__ */ H(Z, {
1302
1306
  value: e.bubble ? e.ui?.bubble?.button : i?.button,
1303
- children: /* @__PURE__ */ W("div", {
1307
+ children: /* @__PURE__ */ U("div", {
1304
1308
  ref: y,
1305
- className: Y("vibe-shadcn-tiptap__toolbar", Z, !e.bubble && "border-b border-border p-1.5", i?.className),
1309
+ className: J("vibe-shadcn-tiptap__toolbar", X, !e.bubble && "border-b border-border p-1.5", i?.className),
1306
1310
  role: "toolbar",
1307
1311
  "aria-label": e.bubble ? void 0 : "Editor toolbar",
1308
1312
  children: [
1309
- P && !e.bubble && /* @__PURE__ */ U("input", {
1310
- ref: k,
1313
+ F && !e.bubble && /* @__PURE__ */ H("input", {
1314
+ ref: A,
1311
1315
  type: "file",
1312
1316
  hidden: !0,
1313
- accept: ae.importAccept,
1317
+ accept: ie.importAccept,
1314
1318
  onChange: async (e) => {
1315
1319
  let t = e.currentTarget, n = t.files?.[0];
1316
- if (t.value = "", n && j && P?.parse && !w) {
1320
+ if (t.value = "", n && M && F?.parse && !w) {
1317
1321
  T(!0);
1318
1322
  try {
1319
1323
  await p(a, n, {
1320
- strict: ae.importStrict,
1324
+ strict: ie.importStrict,
1321
1325
  t: _,
1322
- canImport: () => k.current === t && f.isEditable && !f.isDestroyed
1326
+ canImport: () => A.current === t && f.isEditable && !f.isDestroyed
1323
1327
  });
1324
1328
  } finally {
1325
1329
  T(!1);
@@ -1327,32 +1331,32 @@ function Jn(e) {
1327
1331
  }
1328
1332
  }
1329
1333
  }),
1330
- I.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ U("div", {
1331
- className: Y("vibe-shadcn-tiptap__toolbar-group", Z, n > 0 && "border-s border-border ps-1", i?.groupClassName),
1334
+ L.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ H("div", {
1335
+ className: J("vibe-shadcn-tiptap__toolbar-group", X, n > 0 && "border-s border-border ps-1", i?.groupClassName),
1332
1336
  children: t.map((t) => V(t, e))
1333
1337
  }, e)),
1334
- j && b && A && /* @__PURE__ */ U(On, {
1338
+ M && b && j && /* @__PURE__ */ H(Ln, {
1335
1339
  appearance: e.ui?.insertionPopover,
1336
1340
  context: a,
1337
1341
  request: b.request,
1338
- overlayTarget: A,
1342
+ overlayTarget: j,
1339
1343
  canUpload: !!u,
1340
1344
  behaviorOptions: e.editorBehaviorOptions,
1341
1345
  onClose: () => S(void 0)
1342
1346
  }, b.triggerId),
1343
- j && D && u && A && /* @__PURE__ */ U(Vn, {
1347
+ M && O && u && j && /* @__PURE__ */ H(Xn, {
1344
1348
  appearance: e.ui?.whiteboard,
1345
1349
  context: a,
1346
1350
  uploadAsset: u,
1347
- overlayTarget: A,
1348
- onClose: () => O(!1)
1351
+ overlayTarget: j,
1352
+ onClose: () => k(!1)
1349
1353
  })
1350
1354
  ]
1351
1355
  })
1352
1356
  });
1353
1357
  }
1354
1358
  // src/editor-bubble.tsx
1355
- var Yn = "vibeRadixBubble", Xn = 8, Zn = [
1359
+ var ir = "vibeRadixBubble", ar = 8, or = [
1356
1360
  "bold",
1357
1361
  "italic",
1358
1362
  "underline",
@@ -1361,19 +1365,19 @@ var Yn = "vibeRadixBubble", Xn = 8, Zn = [
1361
1365
  "color",
1362
1366
  "highlight",
1363
1367
  "clearFormat"
1364
- ], Qn = /* @__PURE__ */ new Set([
1368
+ ], sr = /* @__PURE__ */ new Set([
1365
1369
  "image",
1366
1370
  "video",
1367
1371
  "audio",
1368
1372
  "fileAttachment",
1369
1373
  "whiteboard"
1370
1374
  ]);
1371
- function $n(e) {
1375
+ function cr(e) {
1372
1376
  let { selection: t, schema: n, doc: r } = e.state, i = n.marks.link;
1373
- if (!(t instanceof Oe) || !i) return;
1377
+ if (!(t instanceof ke) || !i) return;
1374
1378
  let a = i.isInSet(t.$from.nodeAfter?.marks ?? []), o = a?.attrs.href, s = a?.attrs.target;
1375
1379
  if (!a || typeof o != "string" || !o) return;
1376
- let c = _e(t.$from, i, a.attrs);
1380
+ let c = ve(t.$from, i, a.attrs);
1377
1381
  if (!(!c || t.to > c.to || t.from < c.from)) return {
1378
1382
  ...c,
1379
1383
  href: o,
@@ -1381,16 +1385,16 @@ function $n(e) {
1381
1385
  target: typeof s == "string" ? s : void 0
1382
1386
  };
1383
1387
  }
1384
- function er({ editor: e, element: t }) {
1388
+ function lr({ editor: e, element: t }) {
1385
1389
  if (e.isDestroyed || !e.isEditable) return !1;
1386
1390
  let { view: n, state: { selection: r } } = e, i = n.dom.ownerDocument.activeElement;
1387
- return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof De ? Qn.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!$n(e) || tr(e);
1391
+ return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof Oe ? sr.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!cr(e) || ur(e);
1388
1392
  }
1389
- function tr(e) {
1393
+ function ur(e) {
1390
1394
  let { selection: t, doc: n } = e.state;
1391
- return t instanceof Oe && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
1395
+ return t instanceof ke && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
1392
1396
  }
1393
- async function nr(e, t, n = !1) {
1397
+ async function dr(e, t, n = !1) {
1394
1398
  let { editor: r, notify: i, t: a } = e;
1395
1399
  try {
1396
1400
  let e = r.view.dom.ownerDocument.defaultView?.navigator.clipboard;
@@ -1400,17 +1404,17 @@ async function nr(e, t, n = !1) {
1400
1404
  i(a("notify.clipboardUnavailable"), "warning");
1401
1405
  }
1402
1406
  }
1403
- function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
1407
+ function fr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
1404
1408
  let { editor: u, t: d, commands: f, notify: p } = t;
1405
- H(t, (e) => e.getToolbarRevision());
1406
- let [m, h] = J(), [g, _] = J(null), v = q(null);
1407
- K(() => {
1409
+ he(t, (e) => e.getToolbarRevision());
1410
+ let [m, h] = q(), [g, _] = q(null), v = K(null);
1411
+ G(() => {
1408
1412
  _(u.view.dom.parentElement);
1409
- }, [u]), K(() => {
1413
+ }, [u]), G(() => {
1410
1414
  let e = v.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
1411
1415
  if (!g || !e) return;
1412
1416
  let n = () => {
1413
- e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(Yn, "updatePosition"));
1417
+ e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(ir, "updatePosition"));
1414
1418
  }, r = t && new t(n);
1415
1419
  r?.observe(e), r?.observe(g);
1416
1420
  let i = g.ownerDocument, a = ({ target: e }) => {
@@ -1420,14 +1424,14 @@ function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1420
1424
  r?.disconnect(), i.removeEventListener("scroll", a, !0);
1421
1425
  };
1422
1426
  }, [u, g]);
1423
- let y = Ee(() => {
1427
+ let y = De(() => {
1424
1428
  if (!g) return;
1425
1429
  let e = {
1426
1430
  boundary: g,
1427
- padding: Xn
1431
+ padding: ar
1428
1432
  };
1429
1433
  return {
1430
- offset: Xn,
1434
+ offset: ar,
1431
1435
  flip: e,
1432
1436
  shift: {
1433
1437
  ...e,
@@ -1445,15 +1449,15 @@ function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1445
1449
  },
1446
1450
  scrollTarget: g
1447
1451
  };
1448
- }, [g, l]), { selection: b } = u.state, x = $n(u), S = !x && tr(u);
1449
- K(() => {
1452
+ }, [g, l]), { selection: b } = u.state, x = cr(u), S = !x && ur(u);
1453
+ G(() => {
1450
1454
  !S && m && (h(void 0), l(!1));
1451
1455
  }, [
1452
1456
  S,
1453
1457
  m,
1454
1458
  l
1455
1459
  ]);
1456
- let C = Zn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
1460
+ let C = or.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
1457
1461
  if (x) try {
1458
1462
  let e = new URL(x.href, u.view.dom.ownerDocument.baseURI);
1459
1463
  [
@@ -1466,85 +1470,85 @@ function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1466
1470
  } catch {
1467
1471
  w = void 0;
1468
1472
  }
1469
- return g ? /* @__PURE__ */ U(_n, {
1473
+ return g ? /* @__PURE__ */ H(Z, {
1470
1474
  value: e?.bubble?.button,
1471
- children: /* @__PURE__ */ U(D, {
1475
+ children: /* @__PURE__ */ H(O, {
1472
1476
  editor: u,
1473
- pluginKey: Yn,
1477
+ pluginKey: ir,
1474
1478
  appendTo: n,
1475
1479
  updateDelay: 0,
1476
1480
  resizeDelay: 0,
1477
1481
  options: y,
1478
- shouldShow: er,
1482
+ shouldShow: lr,
1479
1483
  className: "vibe-shadcn-tiptap__bubble-host",
1480
- children: /* @__PURE__ */ U("div", {
1484
+ children: /* @__PURE__ */ H("div", {
1481
1485
  ref: v,
1482
1486
  role: "toolbar",
1483
1487
  "aria-label": "Selection toolbar",
1484
- className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5", mn, e?.bubble?.className),
1488
+ className: J("z-3 vibe-shadcn-tiptap__bubble p-0.5", wn, e?.bubble?.className),
1485
1489
  onMouseDown: (e) => e.preventDefault(),
1486
- children: b instanceof De ? /* @__PURE__ */ U(Tn, {
1490
+ children: b instanceof Oe ? /* @__PURE__ */ H(Pn, {
1487
1491
  context: t,
1488
1492
  selection: b,
1489
1493
  overlayTarget: n,
1490
1494
  uploadAsset: a,
1491
1495
  behaviorOptions: o,
1492
- onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(Yn, "hide")),
1493
- onCopyUrl: (e, n) => void nr(t, e, n),
1496
+ onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(ir, "hide")),
1497
+ onCopyUrl: (e, n) => void dr(t, e, n),
1494
1498
  onWhiteboardEdit: c
1495
- }) : x ? /* @__PURE__ */ W("div", {
1496
- className: Y("vibe-shadcn-tiptap__actions", Z),
1499
+ }) : x ? /* @__PURE__ */ U("div", {
1500
+ className: J("vibe-shadcn-tiptap__actions", X),
1497
1501
  children: [
1498
- /* @__PURE__ */ U($, {
1502
+ /* @__PURE__ */ H($, {
1499
1503
  label: d("toolbar.link.edit"),
1500
1504
  overlayTarget: n,
1501
1505
  onClick: () => s({
1502
1506
  kind: "link",
1503
1507
  link: x
1504
1508
  }),
1505
- children: /* @__PURE__ */ U(Tt, {
1509
+ children: /* @__PURE__ */ H(Dt, {
1506
1510
  size: 16,
1507
1511
  "aria-hidden": !0
1508
1512
  })
1509
1513
  }),
1510
- /* @__PURE__ */ U(Q, {
1514
+ /* @__PURE__ */ H(Q, {
1511
1515
  asChild: !0,
1512
1516
  variant: "ghost",
1513
1517
  className: "vibe-shadcn-tiptap__button",
1514
- children: /* @__PURE__ */ U("a", {
1518
+ children: /* @__PURE__ */ H("a", {
1515
1519
  "aria-label": d("toolbar.link.open"),
1516
1520
  href: w,
1517
1521
  "aria-disabled": !w || void 0,
1518
1522
  target: x.target || "_blank",
1519
1523
  rel: "noopener noreferrer",
1520
- children: /* @__PURE__ */ U(Ze, {
1524
+ children: /* @__PURE__ */ H($e, {
1521
1525
  size: 16,
1522
1526
  "aria-hidden": !0
1523
1527
  })
1524
1528
  })
1525
1529
  }),
1526
- /* @__PURE__ */ U($, {
1530
+ /* @__PURE__ */ H($, {
1527
1531
  label: d("toolbar.link.copy"),
1528
1532
  overlayTarget: n,
1529
- onClick: () => void nr(t, x.href),
1530
- children: /* @__PURE__ */ U(Ke, {
1533
+ onClick: () => void dr(t, x.href),
1534
+ children: /* @__PURE__ */ H(Xe, {
1531
1535
  size: 16,
1532
1536
  "aria-hidden": !0
1533
1537
  })
1534
1538
  }),
1535
- /* @__PURE__ */ U($, {
1539
+ /* @__PURE__ */ H($, {
1536
1540
  label: d("toolbar.link.remove"),
1537
1541
  overlayTarget: n,
1538
1542
  onClick: () => {
1539
1543
  f.setLink("", { range: x }), p(d("notify.linkRemoved"), "success");
1540
1544
  },
1541
- children: /* @__PURE__ */ U(Kt, {
1545
+ children: /* @__PURE__ */ H($t, {
1542
1546
  size: 16,
1543
1547
  "aria-hidden": !0
1544
1548
  })
1545
1549
  })
1546
1550
  ]
1547
- }) : S ? /* @__PURE__ */ U(Jn, {
1551
+ }) : S ? /* @__PURE__ */ H(rr, {
1548
1552
  context: t,
1549
1553
  ui: e,
1550
1554
  toolbar: [C],
@@ -1563,16 +1567,16 @@ function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1563
1567
  }) : null;
1564
1568
  }
1565
1569
  // src/find-replace.tsx
1566
- function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1567
- let { InputGroup: i } = X(), { editor: a, commands: o, t: s } = t, c = H(t, (e) => e.findReplaceState), l = q(null), u = q(null), [d, f] = J(0);
1568
- if (G(() => {
1570
+ function pr({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1571
+ let { InputGroup: i } = Y(), { editor: a, commands: o, t: s } = t, c = he(t, (e) => e.findReplaceState), l = K(null), u = K(null), [d, f] = q(0);
1572
+ if (W(() => {
1569
1573
  let e = ({ transaction: e }) => {
1570
- I(e) && f((e) => e + 1);
1574
+ L(e) && f((e) => e + 1);
1571
1575
  };
1572
1576
  return a.on("transaction", e), () => {
1573
1577
  a.off("transaction", e);
1574
1578
  };
1575
- }, [a]), K(() => {
1579
+ }, [a]), G(() => {
1576
1580
  if (!c?.open) {
1577
1581
  u.current?.focus({ preventScroll: !0 }), u.current = null;
1578
1582
  return;
@@ -1583,28 +1587,28 @@ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1583
1587
  function p(e, t) {
1584
1588
  e ? o.findReplacePrevious() : o.findReplaceNext(), t.focus({ preventScroll: !0 });
1585
1589
  }
1586
- let m = c.matches.length > 0, h = Y("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", hn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = Y("h-full", e?.input?.className);
1587
- return /* @__PURE__ */ U(_n, {
1590
+ let m = c.matches.length > 0, h = J("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", Tn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = J("h-full", e?.input?.className);
1591
+ return /* @__PURE__ */ H(Z, {
1588
1592
  value: e?.button,
1589
- children: /* @__PURE__ */ W("div", {
1590
- className: Y("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5", mn, e?.className),
1593
+ children: /* @__PURE__ */ U("div", {
1594
+ className: J("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5", wn, e?.className),
1591
1595
  role: "search",
1592
1596
  "aria-label": s("command.findReplace"),
1593
1597
  onKeyDown: (e) => {
1594
1598
  !e.nativeEvent.isComposing && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), o.closeFindReplace());
1595
1599
  },
1596
- children: [/* @__PURE__ */ W("div", {
1597
- className: Y("vibe-shadcn-tiptap__find-row", Z),
1600
+ children: [/* @__PURE__ */ U("div", {
1601
+ className: J("vibe-shadcn-tiptap__find-row", X),
1598
1602
  children: [
1599
- /* @__PURE__ */ W(i.Root, {
1603
+ /* @__PURE__ */ U(i.Root, {
1600
1604
  className: h,
1601
1605
  children: [
1602
- /* @__PURE__ */ U(i.Addon, {
1606
+ /* @__PURE__ */ H(i.Addon, {
1603
1607
  align: "inline-start",
1604
1608
  "aria-hidden": !0,
1605
- children: /* @__PURE__ */ U(It, { size: 16 })
1609
+ children: /* @__PURE__ */ H(Bt, { size: 16 })
1606
1610
  }),
1607
- /* @__PURE__ */ U(i.Input, {
1611
+ /* @__PURE__ */ H(i.Input, {
1608
1612
  className: g,
1609
1613
  ref: l,
1610
1614
  "aria-label": s("findReplace.query"),
@@ -1615,15 +1619,15 @@ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1615
1619
  e.key !== "Enter" || e.nativeEvent.isComposing || (e.preventDefault(), m && p(e.shiftKey, e.currentTarget));
1616
1620
  }
1617
1621
  }),
1618
- /* @__PURE__ */ U(i.Addon, {
1622
+ /* @__PURE__ */ H(i.Addon, {
1619
1623
  align: "inline-end",
1620
- children: /* @__PURE__ */ U($, {
1624
+ children: /* @__PURE__ */ H($, {
1621
1625
  size: "icon-sm",
1622
1626
  label: s("findReplace.caseSensitive"),
1623
1627
  overlayTarget: r,
1624
1628
  "aria-pressed": c.caseSensitive,
1625
1629
  onClick: () => o.setFindReplaceCaseSensitive(!c.caseSensitive),
1626
- children: /* @__PURE__ */ U(ze, {
1630
+ children: /* @__PURE__ */ H(Be, {
1627
1631
  size: 16,
1628
1632
  "aria-hidden": !0
1629
1633
  })
@@ -1631,56 +1635,56 @@ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1631
1635
  })
1632
1636
  ]
1633
1637
  }),
1634
- /* @__PURE__ */ U("span", {
1638
+ /* @__PURE__ */ H("span", {
1635
1639
  role: "status",
1636
1640
  children: s("findReplace.count", {
1637
1641
  current: m ? c.activeIndex + 1 : 0,
1638
1642
  total: c.matches.length
1639
1643
  })
1640
1644
  }),
1641
- /* @__PURE__ */ U($, {
1645
+ /* @__PURE__ */ H($, {
1642
1646
  size: "icon-sm",
1643
1647
  label: s("findReplace.previous"),
1644
1648
  overlayTarget: r,
1645
1649
  disabled: !m,
1646
1650
  onClick: (e) => p(!0, e.currentTarget),
1647
- children: /* @__PURE__ */ U(Ue, {
1651
+ children: /* @__PURE__ */ H(We, {
1648
1652
  size: 16,
1649
1653
  "aria-hidden": !0
1650
1654
  })
1651
1655
  }),
1652
- /* @__PURE__ */ U($, {
1656
+ /* @__PURE__ */ H($, {
1653
1657
  size: "icon-sm",
1654
1658
  label: s("findReplace.next"),
1655
1659
  overlayTarget: r,
1656
1660
  disabled: !m,
1657
1661
  onClick: (e) => p(!1, e.currentTarget),
1658
- children: /* @__PURE__ */ U(Be, {
1662
+ children: /* @__PURE__ */ H(Ve, {
1659
1663
  size: 16,
1660
1664
  "aria-hidden": !0
1661
1665
  })
1662
1666
  }),
1663
- /* @__PURE__ */ U($, {
1667
+ /* @__PURE__ */ H($, {
1664
1668
  size: "icon-sm",
1665
1669
  label: s("findReplace.close"),
1666
1670
  overlayTarget: r,
1667
1671
  onClick: () => o.closeFindReplace(),
1668
- children: /* @__PURE__ */ U(Yt, {
1672
+ children: /* @__PURE__ */ H(nn, {
1669
1673
  size: 16,
1670
1674
  "aria-hidden": !0
1671
1675
  })
1672
1676
  })
1673
1677
  ]
1674
- }), n && /* @__PURE__ */ W("div", {
1675
- className: Y("vibe-shadcn-tiptap__find-row", "flex flex-wrap items-center gap-1"),
1678
+ }), n && /* @__PURE__ */ U("div", {
1679
+ className: J("vibe-shadcn-tiptap__find-row", "flex flex-wrap items-center gap-1"),
1676
1680
  children: [
1677
- /* @__PURE__ */ W(i.Root, {
1681
+ /* @__PURE__ */ U(i.Root, {
1678
1682
  className: h,
1679
- children: [/* @__PURE__ */ U(i.Addon, {
1683
+ children: [/* @__PURE__ */ H(i.Addon, {
1680
1684
  align: "inline-start",
1681
1685
  "aria-hidden": !0,
1682
- children: /* @__PURE__ */ U(Mt, { size: 16 })
1683
- }), /* @__PURE__ */ U(i.Input, {
1686
+ children: /* @__PURE__ */ H(Nt, { size: 16 })
1687
+ }), /* @__PURE__ */ H(i.Input, {
1684
1688
  className: g,
1685
1689
  "aria-label": s("findReplace.replacement"),
1686
1690
  placeholder: s("findReplace.replacement"),
@@ -1691,24 +1695,24 @@ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1691
1695
  }
1692
1696
  })]
1693
1697
  }),
1694
- /* @__PURE__ */ U($, {
1698
+ /* @__PURE__ */ H($, {
1695
1699
  size: "icon-sm",
1696
1700
  label: s("findReplace.replace"),
1697
1701
  overlayTarget: r,
1698
1702
  disabled: !m,
1699
1703
  onClick: () => o.replaceFindReplaceCurrent(),
1700
- children: /* @__PURE__ */ U(Mt, {
1704
+ children: /* @__PURE__ */ H(Nt, {
1701
1705
  size: 16,
1702
1706
  "aria-hidden": !0
1703
1707
  })
1704
1708
  }),
1705
- /* @__PURE__ */ U($, {
1709
+ /* @__PURE__ */ H($, {
1706
1710
  size: "icon-sm",
1707
1711
  label: s("findReplace.replaceAll"),
1708
1712
  overlayTarget: r,
1709
1713
  disabled: !m,
1710
1714
  onClick: () => o.replaceFindReplaceAll(),
1711
- children: /* @__PURE__ */ U(Nt, {
1715
+ children: /* @__PURE__ */ H(Pt, {
1712
1716
  size: 16,
1713
1717
  "aria-hidden": !0
1714
1718
  })
@@ -1719,7 +1723,7 @@ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1719
1723
  });
1720
1724
  }
1721
1725
  // src/image-preview-dialog.tsx
1722
- function ar(e, t) {
1726
+ function mr(e, t) {
1723
1727
  if (!e) return {};
1724
1728
  let n;
1725
1729
  try {
@@ -1740,22 +1744,22 @@ function ar(e, t) {
1740
1744
  name: i
1741
1745
  };
1742
1746
  }
1743
- function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
1744
- let { Dialog: o } = X(), { urls: s } = i, [c, l] = J(i.index), [u, d] = J(0), [f, p] = J(100), m = q(null), h = q(null), g = q(null), _ = q(null), v = s.length > 1, y = s[c], { href: b, name: x } = ar(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
1747
+ function hr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
1748
+ let { Dialog: o } = Y(), { urls: s } = i, [c, l] = q(i.index), [u, d] = q(0), [f, p] = q(100), m = K(null), h = K(null), g = K(null), _ = K(null), v = s.length > 1, y = s[c], { href: b, name: x } = mr(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
1745
1749
  function w(e) {
1746
1750
  v && (m.current = null, d(0), p(100), l((t) => (t + e + s.length) % s.length));
1747
1751
  }
1748
- return /* @__PURE__ */ U(o.Root, {
1752
+ return /* @__PURE__ */ H(o.Root, {
1749
1753
  open: !0,
1750
1754
  onOpenChange: (e) => !e && a(),
1751
- children: /* @__PURE__ */ W(o.Content, {
1755
+ children: /* @__PURE__ */ U(o.Content, {
1752
1756
  container: r,
1753
1757
  overlayClassName: "vibe-shadcn-tiptap__backdrop",
1754
- className: Y("vibe-shadcn-tiptap__image-preview", e?.className),
1758
+ className: J("vibe-shadcn-tiptap__image-preview", e?.className),
1755
1759
  "aria-describedby": void 0,
1756
1760
  onOpenAutoFocus: (e) => {
1757
1761
  let t = r.ownerDocument.activeElement;
1758
- t instanceof HTMLElement && t !== r.ownerDocument.body && (g.current = t), e.preventDefault(), _.current?.focus();
1762
+ t instanceof HTMLElement && t !== r.ownerDocument.body && (g.current = t), e.preventDefault(), _.current?.focus({ preventScroll: !0 });
1759
1763
  },
1760
1764
  onCloseAutoFocus: (e) => {
1761
1765
  if (e.preventDefault(), t.isDestroyed) return;
@@ -1765,150 +1769,153 @@ function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1765
1769
  onKeyDown: (e) => {
1766
1770
  (e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), w(e.key === "ArrowLeft" ? -1 : 1));
1767
1771
  },
1768
- children: [/* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", {
1769
- className: "vibe-shadcn-tiptap__image-title",
1770
- children: [/* @__PURE__ */ U(ct, {
1771
- size: 16,
1772
- "aria-hidden": "true"
1773
- }), /* @__PURE__ */ U(o.Title, {
1774
- title: C,
1775
- children: C
1776
- })]
1777
- }), /* @__PURE__ */ W("div", {
1778
- className: "vibe-shadcn-tiptap__image-controls",
1779
- children: [
1780
- v && /* @__PURE__ */ W("div", {
1781
- className: "vibe-shadcn-tiptap__image-controls-group",
1782
- children: [
1783
- /* @__PURE__ */ U($, {
1784
- appearance: e?.iconButton,
1785
- size: "icon",
1786
- label: n("image.preview.previous"),
1787
- overlayTarget: r,
1788
- onClick: () => w(-1),
1789
- children: /* @__PURE__ */ U(Ve, {
1790
- size: 16,
1791
- "aria-hidden": "true"
1792
- })
1793
- }),
1794
- /* @__PURE__ */ W("span", {
1795
- "aria-live": "polite",
1796
- children: [
1797
- c + 1,
1798
- " / ",
1799
- s.length
1800
- ]
1801
- }),
1802
- /* @__PURE__ */ U($, {
1803
- appearance: e?.iconButton,
1804
- size: "icon",
1805
- label: n("image.preview.next"),
1806
- overlayTarget: r,
1807
- onClick: () => w(1),
1808
- children: /* @__PURE__ */ U(He, {
1809
- size: 16,
1810
- "aria-hidden": "true"
1811
- })
1812
- })
1813
- ]
1814
- }),
1815
- /* @__PURE__ */ W("div", {
1816
- className: "vibe-shadcn-tiptap__image-controls-group",
1817
- children: [
1818
- /* @__PURE__ */ U($, {
1819
- appearance: e?.iconButton,
1820
- size: "icon",
1821
- label: n("image.preview.zoomOut"),
1822
- overlayTarget: r,
1823
- onClick: () => void h.current?.zoomOut(.1),
1824
- children: /* @__PURE__ */ U(Zt, {
1825
- size: 16,
1826
- "aria-hidden": "true"
1827
- })
1828
- }),
1829
- /* @__PURE__ */ W($, {
1830
- appearance: e?.button,
1831
- size: "sm",
1832
- label: `${f}% · ${n("image.preview.reset")}`,
1833
- overlayTarget: r,
1834
- className: "vibe-shadcn-tiptap__image-zoom-percent",
1835
- defaultSizeClassName: "min-w-11",
1836
- onClick: () => void h.current?.centerView(1),
1837
- children: [f, "%"]
1838
- }),
1839
- /* @__PURE__ */ U($, {
1840
- appearance: e?.iconButton,
1841
- size: "icon",
1842
- label: n("image.preview.zoomIn"),
1843
- overlayTarget: r,
1844
- onClick: () => void h.current?.zoomIn(.1),
1845
- children: /* @__PURE__ */ U(Xt, {
1846
- size: 16,
1847
- "aria-hidden": "true"
1848
- })
1849
- })
1850
- ]
1851
- }),
1852
- /* @__PURE__ */ W("div", {
1853
- className: "vibe-shadcn-tiptap__image-controls-group",
1854
- children: [
1855
- /* @__PURE__ */ U($, {
1856
- appearance: e?.iconButton,
1857
- size: "icon",
1858
- label: n("image.preview.rotateLeft"),
1859
- overlayTarget: r,
1860
- onClick: () => d((e) => (e - 90) % 360),
1861
- children: /* @__PURE__ */ U(Pt, {
1862
- size: 16,
1863
- "aria-hidden": "true"
1864
- })
1865
- }),
1866
- /* @__PURE__ */ U($, {
1867
- appearance: e?.iconButton,
1868
- size: "icon",
1869
- label: n("image.preview.rotateRight"),
1870
- overlayTarget: r,
1871
- onClick: () => d((e) => (e + 90) % 360),
1872
- children: /* @__PURE__ */ U(Ft, {
1873
- size: 16,
1874
- "aria-hidden": "true"
1772
+ children: [/* @__PURE__ */ U("header", {
1773
+ ref: _,
1774
+ tabIndex: -1,
1775
+ children: [/* @__PURE__ */ U("div", {
1776
+ className: "vibe-shadcn-tiptap__image-title",
1777
+ children: [/* @__PURE__ */ H(ut, {
1778
+ size: 16,
1779
+ "aria-hidden": "true"
1780
+ }), /* @__PURE__ */ H(o.Title, {
1781
+ title: C,
1782
+ children: C
1783
+ })]
1784
+ }), /* @__PURE__ */ U("div", {
1785
+ className: "vibe-shadcn-tiptap__image-controls",
1786
+ children: [
1787
+ v && /* @__PURE__ */ U("div", {
1788
+ className: "vibe-shadcn-tiptap__image-controls-group",
1789
+ children: [
1790
+ /* @__PURE__ */ H($, {
1791
+ appearance: e?.iconButton,
1792
+ size: "icon",
1793
+ label: n("image.preview.previous"),
1794
+ overlayTarget: r,
1795
+ onClick: () => w(-1),
1796
+ children: /* @__PURE__ */ H(He, {
1797
+ size: 16,
1798
+ "aria-hidden": "true"
1799
+ })
1800
+ }),
1801
+ /* @__PURE__ */ U("span", {
1802
+ "aria-live": "polite",
1803
+ children: [
1804
+ c + 1,
1805
+ " / ",
1806
+ s.length
1807
+ ]
1808
+ }),
1809
+ /* @__PURE__ */ H($, {
1810
+ appearance: e?.iconButton,
1811
+ size: "icon",
1812
+ label: n("image.preview.next"),
1813
+ overlayTarget: r,
1814
+ onClick: () => w(1),
1815
+ children: /* @__PURE__ */ H(Ue, {
1816
+ size: 16,
1817
+ "aria-hidden": "true"
1818
+ })
1875
1819
  })
1876
- }),
1877
- /* @__PURE__ */ U(Q, {
1878
- appearance: e?.button,
1879
- asChild: !0,
1880
- variant: "ghost",
1881
- className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__image-download",
1882
- children: /* @__PURE__ */ W("a", {
1883
- href: b,
1884
- download: S ?? "",
1885
- "aria-disabled": !b || void 0,
1886
- target: "_blank",
1887
- rel: "noreferrer",
1888
- children: [/* @__PURE__ */ U(qe, {
1820
+ ]
1821
+ }),
1822
+ /* @__PURE__ */ U("div", {
1823
+ className: "vibe-shadcn-tiptap__image-controls-group",
1824
+ children: [
1825
+ /* @__PURE__ */ H($, {
1826
+ appearance: e?.iconButton,
1827
+ size: "icon",
1828
+ label: n("image.preview.zoomOut"),
1829
+ overlayTarget: r,
1830
+ onClick: () => void h.current?.zoomOut(.1),
1831
+ children: /* @__PURE__ */ H(an, {
1832
+ size: 16,
1833
+ "aria-hidden": "true"
1834
+ })
1835
+ }),
1836
+ /* @__PURE__ */ U($, {
1837
+ appearance: e?.button,
1838
+ size: "sm",
1839
+ label: `${f}% · ${n("image.preview.reset")}`,
1840
+ overlayTarget: r,
1841
+ className: "vibe-shadcn-tiptap__image-zoom-percent",
1842
+ defaultSizeClassName: "min-w-11",
1843
+ onClick: () => void h.current?.centerView(1),
1844
+ children: [f, "%"]
1845
+ }),
1846
+ /* @__PURE__ */ H($, {
1847
+ appearance: e?.iconButton,
1848
+ size: "icon",
1849
+ label: n("image.preview.zoomIn"),
1850
+ overlayTarget: r,
1851
+ onClick: () => void h.current?.zoomIn(.1),
1852
+ children: /* @__PURE__ */ H(rn, {
1889
1853
  size: 16,
1890
1854
  "aria-hidden": "true"
1891
- }), n("image.preview.download")]
1855
+ })
1892
1856
  })
1893
- }),
1894
- /* @__PURE__ */ U(o.Close, {
1895
- asChild: !0,
1896
- children: /* @__PURE__ */ U($, {
1857
+ ]
1858
+ }),
1859
+ /* @__PURE__ */ U("div", {
1860
+ className: "vibe-shadcn-tiptap__image-controls-group",
1861
+ children: [
1862
+ /* @__PURE__ */ H($, {
1863
+ appearance: e?.iconButton,
1864
+ size: "icon",
1865
+ label: n("image.preview.rotateLeft"),
1866
+ overlayTarget: r,
1867
+ onClick: () => d((e) => (e - 90) % 360),
1868
+ children: /* @__PURE__ */ H(Ft, {
1869
+ size: 16,
1870
+ "aria-hidden": "true"
1871
+ })
1872
+ }),
1873
+ /* @__PURE__ */ H($, {
1897
1874
  appearance: e?.iconButton,
1898
- ref: _,
1899
1875
  size: "icon",
1900
- label: n("image.preview.close"),
1876
+ label: n("image.preview.rotateRight"),
1901
1877
  overlayTarget: r,
1902
- children: /* @__PURE__ */ U(Yt, {
1878
+ onClick: () => d((e) => (e + 90) % 360),
1879
+ children: /* @__PURE__ */ H(It, {
1903
1880
  size: 16,
1904
1881
  "aria-hidden": "true"
1905
1882
  })
1883
+ }),
1884
+ /* @__PURE__ */ H(Q, {
1885
+ appearance: e?.button,
1886
+ asChild: !0,
1887
+ variant: "ghost",
1888
+ className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__image-download",
1889
+ children: /* @__PURE__ */ U("a", {
1890
+ href: b,
1891
+ download: S ?? "",
1892
+ "aria-disabled": !b || void 0,
1893
+ target: "_blank",
1894
+ rel: "noreferrer",
1895
+ children: [/* @__PURE__ */ H(Ze, {
1896
+ size: 16,
1897
+ "aria-hidden": "true"
1898
+ }), n("image.preview.download")]
1899
+ })
1900
+ }),
1901
+ /* @__PURE__ */ H(o.Close, {
1902
+ asChild: !0,
1903
+ children: /* @__PURE__ */ H($, {
1904
+ appearance: e?.iconButton,
1905
+ size: "icon",
1906
+ label: n("image.preview.close"),
1907
+ overlayTarget: r,
1908
+ children: /* @__PURE__ */ H(nn, {
1909
+ size: 16,
1910
+ "aria-hidden": "true"
1911
+ })
1912
+ })
1906
1913
  })
1907
- })
1908
- ]
1909
- })
1910
- ]
1911
- })] }), /* @__PURE__ */ U("div", {
1914
+ ]
1915
+ })
1916
+ ]
1917
+ })]
1918
+ }), /* @__PURE__ */ H("div", {
1912
1919
  className: "vibe-shadcn-tiptap__image-stage",
1913
1920
  onPointerDown: (e) => {
1914
1921
  e.shiftKey && e.button === 0 && e.isPrimary && (m.current = {
@@ -1924,7 +1931,7 @@ function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1924
1931
  onLostPointerCapture: (e) => {
1925
1932
  m.current?.pointerId === e.pointerId && (m.current = null);
1926
1933
  },
1927
- children: /* @__PURE__ */ U(an, {
1934
+ children: /* @__PURE__ */ H(fn, {
1928
1935
  ref: h,
1929
1936
  centerOnInit: !0,
1930
1937
  centerZoomedOut: !0,
@@ -1939,10 +1946,10 @@ function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1939
1946
  activationKeys: (e) => !e.includes("Shift")
1940
1947
  },
1941
1948
  onTransform: (e, { scale: t }) => p(Math.round(t * 100)),
1942
- children: /* @__PURE__ */ U(rn, {
1949
+ children: /* @__PURE__ */ H(dn, {
1943
1950
  wrapperClass: "vibe-shadcn-tiptap__image-viewport",
1944
1951
  contentClass: "vibe-shadcn-tiptap__image-plane",
1945
- children: /* @__PURE__ */ U("img", {
1952
+ children: /* @__PURE__ */ H("img", {
1946
1953
  src: y,
1947
1954
  alt: S ?? "",
1948
1955
  draggable: !1,
@@ -1955,12 +1962,12 @@ function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1955
1962
  });
1956
1963
  }
1957
1964
  // src/mention-menu.tsx
1958
- function sr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
1959
- let { editor: a, items: o, groups: s, selectedIndex: c, mount: l, loading: u } = t, d = `vibe-tiptap-mention-${a.instanceId}`, f = q(null);
1960
- return K(() => {
1965
+ function gr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
1966
+ let { editor: a, items: o, groups: s, selectedIndex: c, mount: l, loading: u } = t, d = `vibe-tiptap-mention-${a.instanceId}`, f = K(null);
1967
+ return G(() => {
1961
1968
  let e = f.current;
1962
1969
  if (e) return l(e);
1963
- }, [l, n]), K(() => {
1970
+ }, [l, n]), G(() => {
1964
1971
  let e = a.view.dom, t = f.current;
1965
1972
  if (!o[c] || !t) return;
1966
1973
  let n = `${d}-${c}`, r = e.getAttribute("aria-activedescendant"), i = e.getAttribute("aria-controls");
@@ -1974,63 +1981,63 @@ function sr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
1974
1981
  d,
1975
1982
  o,
1976
1983
  c
1977
- ]), on(/* @__PURE__ */ U("div", {
1984
+ ]), pn(/* @__PURE__ */ H("div", {
1978
1985
  ref: f,
1979
- className: Y("z-3 vibe-shadcn-tiptap__mention", e?.className),
1980
- children: o.length ? /* @__PURE__ */ U("div", {
1986
+ className: J("z-3 vibe-shadcn-tiptap__mention", e?.className),
1987
+ children: o.length ? /* @__PURE__ */ H("div", {
1981
1988
  id: d,
1982
1989
  role: "listbox",
1983
1990
  "aria-label": r("mention.label"),
1984
- children: s.map(({ name: n, label: r, items: a, startIndex: o }) => /* @__PURE__ */ W("div", {
1991
+ children: s.map(({ name: n, label: r, items: a, startIndex: o }) => /* @__PURE__ */ U("div", {
1985
1992
  className: n === void 0 ? void 0 : e?.groupClassName,
1986
1993
  ...r ? {
1987
1994
  role: "group",
1988
1995
  "aria-label": r
1989
1996
  } : {},
1990
- children: [r && /* @__PURE__ */ U("div", {
1991
- className: Y("px-3 py-1 text-xs font-medium text-muted-foreground", e?.groupLabelClassName),
1997
+ children: [r && /* @__PURE__ */ H("div", {
1998
+ className: J("px-3 py-1 text-xs font-medium text-muted-foreground", e?.groupLabelClassName),
1992
1999
  children: r
1993
- }), a.map((n, r) => /* @__PURE__ */ U("button", {
2000
+ }), a.map((n, r) => /* @__PURE__ */ H("button", {
1994
2001
  id: `${d}-${o + r}`,
1995
2002
  type: "button",
1996
2003
  role: "option",
1997
2004
  tabIndex: -1,
1998
2005
  "aria-label": n.label,
1999
2006
  "aria-selected": o + r === c,
2000
- className: Y("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground", e?.button?.className),
2007
+ className: J("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground", e?.button?.className),
2001
2008
  onMouseDown: (e) => e.preventDefault(),
2002
2009
  onClick: () => t.command(n),
2003
- children: i ? i(n) : /* @__PURE__ */ W(ge, { children: [n.avatar && /* @__PURE__ */ U("img", {
2010
+ children: i ? i(n) : /* @__PURE__ */ U(_e, { children: [n.avatar && /* @__PURE__ */ H("img", {
2004
2011
  src: n.avatar,
2005
2012
  alt: "",
2006
2013
  className: "vibe-tiptap-mention-avatar"
2007
- }), /* @__PURE__ */ U("span", { children: n.label })] })
2014
+ }), /* @__PURE__ */ H("span", { children: n.label })] })
2008
2015
  }, n.id))]
2009
2016
  }, n === void 0 ? "ungrouped" : `group-${n}`))
2010
- }) : /* @__PURE__ */ U("div", {
2011
- className: Y("px-3 py-1 text-sm", e?.statusClassName),
2017
+ }) : /* @__PURE__ */ H("div", {
2018
+ className: J("px-3 py-1 text-sm", e?.statusClassName),
2012
2019
  role: "status",
2013
2020
  children: r(u ? "mention.loading" : "mention.empty")
2014
2021
  })
2015
2022
  }), n);
2016
2023
  }
2017
2024
  // src/mention-popover.tsx
2018
- function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
2019
- let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c = Ee(() => ({ current: {
2025
+ function _r({ editor: e, container: t, render: n, hoverDelay: r }) {
2026
+ let { Popover: i } = Y(), [a, o] = q(), s = K(void 0), c = De(() => ({ current: {
2020
2027
  contextElement: e,
2021
2028
  getBoundingClientRect: () => a?.element.getBoundingClientRect() ?? new DOMRect()
2022
2029
  } }), [e, a]);
2023
- return G(() => {
2024
- let t = sn(e, o, r);
2030
+ return W(() => {
2031
+ let t = mn(e, o, r);
2025
2032
  return s.current = t, () => {
2026
2033
  t.destroy(), s.current = void 0;
2027
2034
  };
2028
- }, [e, r]), /* @__PURE__ */ W(i.Root, {
2035
+ }, [e, r]), /* @__PURE__ */ U(i.Root, {
2029
2036
  open: !!a,
2030
2037
  onOpenChange: (e) => {
2031
2038
  e || s.current?.close();
2032
2039
  },
2033
- children: [/* @__PURE__ */ U(i.Anchor, { virtualRef: c }), /* @__PURE__ */ U(i.Content, {
2040
+ children: [/* @__PURE__ */ H(i.Anchor, { virtualRef: c }), /* @__PURE__ */ H(i.Content, {
2034
2041
  container: t ?? e.ownerDocument.body,
2035
2042
  side: "top",
2036
2043
  align: "center",
@@ -2041,7 +2048,7 @@ function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
2041
2048
  onCloseAutoFocus: (e) => e.preventDefault(),
2042
2049
  onFocusOutside: (e) => e.preventDefault(),
2043
2050
  onPointerDownOutside: (t) => {
2044
- ae(e, t.target) && t.preventDefault();
2051
+ ie(e, t.target) && t.preventDefault();
2045
2052
  },
2046
2053
  onMouseEnter: () => s.current?.keepOpen(),
2047
2054
  onMouseLeave: () => s.current?.leave(),
@@ -2050,32 +2057,32 @@ function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
2050
2057
  });
2051
2058
  }
2052
2059
  // src/slash-menu.tsx
2053
- var lr = {
2054
- heading1: et,
2055
- heading: tt,
2056
- heading3: nt,
2057
- heading4: rt,
2058
- todo: gt,
2059
- bulletList: ht,
2060
- orderedList: _t,
2061
- blockquote: At,
2062
- table: Bt,
2063
- image: ut,
2064
- imageUrl: lt,
2065
- whiteboard: Et,
2066
- video: qt,
2067
- videoUrl: Ut,
2068
- audio: St,
2069
- audioUrl: St,
2070
- upload: wt,
2071
- link: mt,
2072
- codeBlock: We,
2073
- mermaid: Jt,
2060
+ var vr = {
2061
+ heading1: nt,
2062
+ heading: rt,
2063
+ heading3: it,
2064
+ heading4: at,
2065
+ todo: vt,
2066
+ bulletList: _t,
2067
+ orderedList: yt,
2068
+ blockquote: jt,
2069
+ table: Wt,
2070
+ image: ft,
2071
+ imageUrl: dt,
2072
+ whiteboard: Ot,
2073
+ video: en,
2074
+ videoUrl: Xt,
2075
+ audio: wt,
2076
+ audioUrl: wt,
2077
+ upload: Et,
2078
+ link: gt,
2079
+ codeBlock: Ge,
2080
+ mermaid: tn,
2074
2081
  divider: "solid",
2075
2082
  dividerThick: "thick",
2076
2083
  dividerDashed: "dashed",
2077
2084
  dividerDotted: "dotted"
2078
- }, ur = {
2085
+ }, yr = {
2079
2086
  heading1: "slashCommand.group.headings",
2080
2087
  heading: "slashCommand.group.headings",
2081
2088
  heading3: "slashCommand.group.headings",
@@ -2101,9 +2108,9 @@ var lr = {
2101
2108
  dividerDashed: "slashCommand.group.dividers",
2102
2109
  dividerDotted: "slashCommand.group.dividers"
2103
2110
  };
2104
- function dr({ appearance: e, state: t, target: n, t: r }) {
2105
- let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u = q(null), d = a[s], f = d && !d.disabledReason ? `${l}-${d.id}` : void 0;
2106
- K(() => {
2111
+ function br({ appearance: e, state: t, target: n, t: r }) {
2112
+ let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u = K(null), d = a[s], f = d && !d.disabledReason ? `${l}-${d.id}` : void 0;
2113
+ G(() => {
2107
2114
  let e = u.current;
2108
2115
  if (e) return e.style.visibility = "hidden", c(e, { onPosition: ({ x: t, y: n, strategy: r }) => {
2109
2116
  Object.assign(e.style, {
@@ -2113,7 +2120,7 @@ function dr({ appearance: e, state: t, target: n, t: r }) {
2113
2120
  visibility: ""
2114
2121
  });
2115
2122
  } });
2116
- }, [c, n]), K(() => {
2123
+ }, [c, n]), G(() => {
2117
2124
  let e = i.view.dom;
2118
2125
  if (!f) return;
2119
2126
  let t = e.getAttribute("aria-activedescendant"), n = e.getAttribute("aria-controls");
@@ -2128,30 +2135,30 @@ function dr({ appearance: e, state: t, target: n, t: r }) {
2128
2135
  l
2129
2136
  ]);
2130
2137
  let p = [];
2131
- if (R(o)) p.push({ items: a });
2138
+ if (z(o)) p.push({ items: a });
2132
2139
  else for (let e of a) {
2133
- let t = e.disabledReason ? "slashCommand.group.unavailable" : ur[e.id], n = p.at(-1);
2140
+ let t = e.disabledReason ? "slashCommand.group.unavailable" : yr[e.id], n = p.at(-1);
2134
2141
  n?.label === t ? n.items.push(e) : p.push({
2135
2142
  label: t,
2136
2143
  items: [e]
2137
2144
  });
2138
2145
  }
2139
- return on(/* @__PURE__ */ U("div", {
2146
+ return pn(/* @__PURE__ */ H("div", {
2140
2147
  ref: u,
2141
- className: Y("z-3 vibe-shadcn-tiptap__slash", e?.className),
2142
- children: a.length ? /* @__PURE__ */ U("div", {
2148
+ className: J("z-3 vibe-shadcn-tiptap__popover vibe-shadcn-tiptap__slash", e?.className),
2149
+ children: a.length ? /* @__PURE__ */ H("div", {
2143
2150
  id: l,
2144
2151
  role: "listbox",
2145
2152
  "aria-label": r("slashCommand.label"),
2146
- children: p.map(({ label: n, items: i }) => /* @__PURE__ */ W("div", {
2153
+ children: p.map(({ label: n, items: i }) => /* @__PURE__ */ U("div", {
2147
2154
  ...n ? {
2148
2155
  role: "group",
2149
2156
  "aria-label": r(n)
2150
2157
  } : {},
2151
- children: [n && /* @__PURE__ */ U("div", {
2158
+ children: [n && /* @__PURE__ */ H("div", {
2152
2159
  className: "vibe-shadcn-tiptap__slash-label",
2153
2160
  children: r(n)
2154
- }), i.map((n) => /* @__PURE__ */ W("button", {
2161
+ }), i.map((n) => /* @__PURE__ */ U("button", {
2155
2162
  id: `${l}-${n.id}`,
2156
2163
  type: "button",
2157
2164
  role: "option",
@@ -2160,181 +2167,179 @@ function dr({ appearance: e, state: t, target: n, t: r }) {
2160
2167
  "aria-selected": n === d && !n.disabledReason,
2161
2168
  "aria-describedby": n.disabledReason || n.hint ? `${l}-${n.id}-hint` : void 0,
2162
2169
  disabled: !!n.disabledReason,
2163
- className: Y("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium whitespace-nowrap enabled:hover:bg-accent enabled:hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground disabled:opacity-40", e?.button?.className),
2170
+ className: J("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium whitespace-nowrap enabled:hover:bg-accent enabled:hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground disabled:opacity-40", e?.button?.className),
2164
2171
  onMouseDown: (e) => e.preventDefault(),
2165
2172
  onClick: () => t.command(n),
2166
2173
  children: [
2167
- /* @__PURE__ */ U(fr, { command: n.id }),
2174
+ /* @__PURE__ */ H(xr, { command: n.id }),
2168
2175
  n.label,
2169
- (n.disabledReason || n.hint) && /* @__PURE__ */ U("small", {
2176
+ (n.disabledReason || n.hint) && /* @__PURE__ */ H("small", {
2170
2177
  id: `${l}-${n.id}-hint`,
2171
2178
  children: n.disabledReason || n.hint
2172
2179
  })
2173
2180
  ]
2174
2181
  }, n.id))]
2175
2182
  }, i[0]?.id ?? "results"))
2176
- }) : !t.loading && /* @__PURE__ */ U("div", {
2183
+ }) : !t.loading && /* @__PURE__ */ H("div", {
2177
2184
  role: "status",
2178
2185
  children: r("slashCommand.empty")
2179
2186
  })
2180
2187
  }), n);
2181
2188
  }
2182
- function fr({ command: e }) {
2183
- let t = lr[e];
2184
- return /* @__PURE__ */ U("span", {
2189
+ function xr({ command: e }) {
2190
+ let t = vr[e];
2191
+ return /* @__PURE__ */ H("span", {
2185
2192
  className: "vibe-shadcn-tiptap__slash-icon",
2186
2193
  "aria-hidden": !0,
2187
- children: typeof t == "string" ? /* @__PURE__ */ U("span", {
2194
+ children: typeof t == "string" ? /* @__PURE__ */ H("span", {
2188
2195
  className: "vibe-shadcn-tiptap__divider-icon",
2189
2196
  "data-style": t
2190
- }) : /* @__PURE__ */ U(t, { size: 18 })
2197
+ }) : /* @__PURE__ */ H(t, { size: 18 })
2191
2198
  });
2192
2199
  }
2193
2200
  // src/table-grips.tsx
2194
- var pr = ["row", "column"], mr = {
2195
- row: [
2196
- [
2197
- "addRowBefore",
2198
- "table.insertAbove",
2199
- Ot
2200
- ],
2201
- [
2202
- "addRowAfter",
2203
- "table.insertBelow",
2204
- Ot
2205
- ],
2206
- [
2207
- "moveRowUp",
2208
- "table.moveUp",
2209
- Ie
2210
- ],
2211
- [
2212
- "moveRowDown",
2213
- "table.moveDown",
2214
- Ne
2215
- ]
2201
+ var Sr = ["row", "column"], Cr = [
2202
+ [
2203
+ "row",
2204
+ "addRowBefore",
2205
+ "table.insertAbove",
2206
+ Rt
2216
2207
  ],
2217
- column: [
2218
- [
2219
- "addColumnBefore",
2220
- "table.insertLeft",
2221
- Ot
2222
- ],
2223
- [
2224
- "addColumnAfter",
2225
- "table.insertRight",
2226
- Ot
2227
- ],
2228
- [
2229
- "moveColumnLeft",
2230
- "table.moveLeft",
2231
- Pe
2232
- ],
2233
- [
2234
- "moveColumnRight",
2235
- "table.moveRight",
2236
- Fe
2237
- ]
2208
+ [
2209
+ "row",
2210
+ "addRowAfter",
2211
+ "table.insertBelow",
2212
+ Lt
2213
+ ],
2214
+ [
2215
+ "column",
2216
+ "addColumnBefore",
2217
+ "table.insertLeft",
2218
+ qe
2219
+ ],
2220
+ [
2221
+ "column",
2222
+ "addColumnAfter",
2223
+ "table.insertRight",
2224
+ Je
2238
2225
  ]
2226
+ ], wr = [
2227
+ [
2228
+ "row",
2229
+ "moveRowUp",
2230
+ "table.moveUp",
2231
+ Le
2232
+ ],
2233
+ [
2234
+ "row",
2235
+ "moveRowDown",
2236
+ "table.moveDown",
2237
+ Pe
2238
+ ],
2239
+ [
2240
+ "column",
2241
+ "moveColumnLeft",
2242
+ "table.moveLeft",
2243
+ Fe
2244
+ ],
2245
+ [
2246
+ "column",
2247
+ "moveColumnRight",
2248
+ "table.moveRight",
2249
+ Ie
2250
+ ]
2251
+ ], Tr = {
2252
+ row: {
2253
+ set: "table.setHeaderRow",
2254
+ unset: "table.unsetHeaderRow"
2255
+ },
2256
+ column: {
2257
+ set: "table.setHeaderColumn",
2258
+ unset: "table.unsetHeaderColumn"
2259
+ }
2239
2260
  };
2240
- function hr({ appearance: e, context: t, overlayTarget: n }) {
2241
- let { DropdownMenu: r } = X(), { editor: i, commands: a, t: o } = t, s = H(t, (e) => e.getToolbarRevision()), [c, l] = J(), [u, d] = J(), [f, p] = J(), m = q(void 0), h = q(!1);
2242
- function g(e) {
2243
- let { view: t, state: n } = i;
2244
- if (t.dom.contains(e)) return ln(n.doc.resolve(t.posAtDOM(e, 0)));
2261
+ function Er({ appearance: e, context: t, overlayTarget: n }) {
2262
+ let { DropdownMenu: r } = Y(), { className: i } = Dn(e?.button), { editor: a, commands: o, t: s } = t, c = he(t, (e) => e.getToolbarRevision()), [l, u] = q(), [d, f] = q(), [p, m] = q(), [h, g] = q(), _ = K(void 0), v = K(void 0), y = K(!1);
2263
+ function b(e) {
2264
+ return _n(a, e);
2245
2265
  }
2246
- function _(e, t) {
2247
- let n = g(t.cell);
2248
- return !!(n && a.selectTableLineAt(e, n.pos, t[e]));
2266
+ function x(e, t) {
2267
+ let n = b(t.cell);
2268
+ return !!(n && o.selectTableLineAt(e, n.pos, t[e]));
2249
2269
  }
2250
- if (G(() => {
2251
- let e = i.view.dom.parentElement, t = e?.parentElement;
2270
+ W(() => {
2271
+ let e = a.view.dom.parentElement, t = e?.parentElement;
2252
2272
  if (!t) return;
2253
2273
  function n() {
2254
- clearTimeout(m.current), m.current = void 0;
2274
+ clearTimeout(v.current), v.current = void 0;
2255
2275
  }
2256
2276
  function r() {
2257
- u || m.current !== void 0 || (m.current = setTimeout(() => {
2258
- m.current = void 0, l(void 0);
2277
+ d || v.current !== void 0 || (v.current = setTimeout(() => {
2278
+ v.current = void 0, u(void 0);
2259
2279
  }, 200));
2260
2280
  }
2261
- function a(t) {
2262
- if (u || !(t.target instanceof Element)) return;
2263
- if (t.target.closest(".vibe-shadcn-tiptap__grip")) {
2281
+ function i(e) {
2282
+ if (!(e.target instanceof Element) || a.isDestroyed) return;
2283
+ let t = e.target.closest("td, th");
2284
+ if (t instanceof HTMLTableCellElement && a.view.dom.contains(t)) return yn(a, t, e.clientX);
2285
+ }
2286
+ function o(e) {
2287
+ if (d || p || !(e.target instanceof Element)) return;
2288
+ if (e.target.closest(".vibe-shadcn-tiptap__grip")) {
2264
2289
  n();
2265
2290
  return;
2266
2291
  }
2267
- let a = t.target.closest("td, th");
2268
- if (!(a instanceof HTMLTableCellElement)) {
2269
- r();
2270
- return;
2271
- }
2272
- let o = a.closest("table");
2273
- if (!o || !e?.contains(o) || i.isDestroyed) return;
2274
- let s = ln(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
2275
- if (!s) return;
2276
- n();
2277
- let { left: c, right: d, top: f } = cn.get(s.node(-1)).findCell(s.pos - s.start(-1)), p = o.querySelectorAll(":scope > colgroup > col"), m = a.getBoundingClientRect(), h = m.width > 0 ? (t.clientX - m.left) / m.width : 0, g = Math.min(d - 1, Math.max(c, c + Math.floor(h * (d - c))));
2278
- for (let e = c; e < d; e += 1) {
2279
- let n = p[e]?.getBoundingClientRect();
2280
- if (n && n.width > 0 && t.clientX < n.right) {
2281
- g = e;
2282
- break;
2283
- }
2284
- }
2285
- l((e) => e?.cell === a && e.row === f && e.column === g ? e : {
2286
- cell: a,
2287
- table: o,
2288
- row: f,
2289
- column: g
2290
- });
2292
+ let t = i(e);
2293
+ t ? (n(), u((e) => e?.cell === t.cell && e.row === t.row && e.column === t.column ? e : t)) : r();
2294
+ }
2295
+ function s(e) {
2296
+ let t = !gn(e) && a.isEditable && i(e);
2297
+ t ? (e.preventDefault(), n(), u(void 0), f(void 0), m({
2298
+ target: t,
2299
+ clientX: e.clientX,
2300
+ clientY: e.clientY
2301
+ })) : m(void 0);
2291
2302
  }
2292
- return t.addEventListener("pointermove", a), t.addEventListener("pointerleave", r), () => {
2293
- n(), t.removeEventListener("pointermove", a), t.removeEventListener("pointerleave", r);
2303
+ function c() {
2304
+ m(void 0), d && (y.current = !0, f(void 0));
2305
+ }
2306
+ return t.addEventListener("pointermove", o), t.addEventListener("pointerleave", r), t.addEventListener("contextmenu", s), e?.addEventListener("scroll", c, !0), () => {
2307
+ n(), t.removeEventListener("pointermove", o), t.removeEventListener("pointerleave", r), t.removeEventListener("contextmenu", s), e?.removeEventListener("scroll", c, !0);
2294
2308
  };
2295
- }, [u, i]), K(() => {
2296
- let e = i.view.dom.parentElement, t = e?.parentElement, n = t?.ownerDocument.defaultView;
2297
- if (!c || !t || !e || !n) {
2298
- p(void 0);
2309
+ }, [
2310
+ d,
2311
+ p,
2312
+ a
2313
+ ]);
2314
+ let S = h?.wrapper, C = l?.table;
2315
+ G(() => {
2316
+ if (!l) {
2317
+ g(void 0);
2299
2318
  return;
2300
2319
  }
2301
- let r = t, a = e, o = c;
2302
- function s() {
2303
- if (i.isDestroyed) return;
2304
- let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ? ln(i.state.doc.resolve(i.view.posAtDOM(e, 0))) : void 0;
2305
- if (!c || !u) {
2306
- l(void 0), d(void 0);
2307
- return;
2308
- }
2309
- let f = r.getBoundingClientRect(), m = a.getBoundingClientRect(), h = t.getBoundingClientRect();
2310
- if (h.bottom < m.top || h.top > m.bottom || h.right < m.left || h.left > m.right) {
2311
- l(void 0), d(void 0);
2312
- return;
2313
- }
2314
- let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } = cn.get(u.node(-1)).findCell(u.pos - u.start(-1)), x = _ && _.width > 0 ? _.left + _.width / 2 : v.left + (s - y + .5) * v.width / (b - y);
2315
- p({
2316
- row: {
2317
- left: Math.max(m.left + 11, h.left - 11) - f.left,
2318
- top: (g.top + g.bottom) / 2 - f.top
2319
- },
2320
- column: {
2321
- left: x - f.left,
2322
- top: Math.max(m.top + 11, h.top - 11) - f.top
2323
- }
2324
- });
2320
+ let e = l;
2321
+ function t() {
2322
+ if (a.isDestroyed) return;
2323
+ let t = vn(a, e);
2324
+ g(t), t || (u(void 0), f(void 0));
2325
2325
  }
2326
- return s(), e.addEventListener("scroll", s, { passive: !0 }), n.addEventListener("resize", s), () => {
2327
- e.removeEventListener("scroll", s), n.removeEventListener("resize", s);
2326
+ return _.current = t, t(), () => {
2327
+ _.current = void 0;
2328
2328
  };
2329
2329
  }, [
2330
- i,
2331
- s,
2332
- c
2333
- ]), !f || !c) return null;
2334
- function v(e, t) {
2335
- let n = g(t.cell);
2330
+ a,
2331
+ c,
2332
+ l
2333
+ ]), G(() => {
2334
+ let e = S?.ownerDocument.defaultView?.ResizeObserver;
2335
+ if (!S || C?.parentElement !== S || !e) return;
2336
+ let t = new e(() => _.current?.());
2337
+ return t.observe(S), t.observe(C), () => t.disconnect();
2338
+ }, [C, S]);
2339
+ function w(e, t) {
2340
+ let n = b(t.cell);
2336
2341
  if (!n) return !1;
2337
- let r = n.node(-1), i = cn.get(r);
2342
+ let r = n.node(-1), i = hn.get(r);
2338
2343
  return i.cellsInRect({
2339
2344
  left: 0,
2340
2345
  top: 0,
@@ -2342,83 +2347,185 @@ function hr({ appearance: e, context: t, overlayTarget: n }) {
2342
2347
  bottom: e === "column" ? i.height : 1
2343
2348
  }).every((e) => r.nodeAt(e)?.type.spec.tableRole === "header_cell");
2344
2349
  }
2345
- return pr.map((t) => {
2346
- let s = t === "row" ? Ye : Je, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
2347
- function m(e) {
2348
- c && i.isEditable && _(t, c) && (h.current = !0, e(), l(void 0), d(void 0));
2350
+ function T(e, t) {
2351
+ return e.map(([e, n, i, a]) => /* @__PURE__ */ U(r.Item, {
2352
+ className: "vibe-shadcn-tiptap__menu-item",
2353
+ onSelect: () => t(e, o[n]),
2354
+ children: [/* @__PURE__ */ H(a, {
2355
+ size: 15,
2356
+ "aria-hidden": !0
2357
+ }), s(i)]
2358
+ }, n));
2359
+ }
2360
+ function E(e, t, n, i) {
2361
+ return t[e] === 0 ? /* @__PURE__ */ U(r.Item, {
2362
+ className: "vibe-shadcn-tiptap__menu-item",
2363
+ onSelect: () => n(e === "row" ? o.toggleHeaderRow : o.toggleHeaderColumn),
2364
+ children: [/* @__PURE__ */ H(Jt, {
2365
+ size: 15,
2366
+ "aria-hidden": !0
2367
+ }), s(w(e, t) ? i.unset : i.set)]
2368
+ }) : null;
2369
+ }
2370
+ function D(e, t, n) {
2371
+ return /* @__PURE__ */ U(r.Item, {
2372
+ className: "vibe-shadcn-tiptap__menu-item",
2373
+ onSelect: () => n(() => e === "row" ? o.deleteRow(t.row) : o.deleteColumn(t.column)),
2374
+ children: [/* @__PURE__ */ H(Yt, {
2375
+ size: 15,
2376
+ "aria-hidden": !0
2377
+ }), s(e === "row" ? "table.deleteRow" : "table.deleteColumn")]
2378
+ });
2379
+ }
2380
+ if (p) {
2381
+ let { target: i, clientX: c, clientY: l } = p, { canMerge: u, canSplit: d } = t.tableState;
2382
+ function f(e, t) {
2383
+ x(e, i) && t();
2349
2384
  }
2350
- return /* @__PURE__ */ W(r.Root, {
2385
+ return /* @__PURE__ */ U(r.Root, {
2351
2386
  modal: !1,
2352
- open: u === t,
2353
- onOpenChange: (e) => {
2354
- e ? (h.current = !1, _(t, c) && d(t)) : d(void 0);
2355
- },
2356
- children: [/* @__PURE__ */ U(r.Trigger, {
2357
- asChild: !0,
2358
- children: /* @__PURE__ */ U($, {
2359
- label: p,
2360
- appearance: e?.button,
2361
- defaultSizeClassName: "size-5 p-0",
2362
- className: "vibe-shadcn-tiptap__grip absolute z-1 -translate-x-1/2 -translate-y-1/2 text-muted-foreground hover:bg-transparent hover:text-primary focus-visible:text-primary aria-expanded:text-primary",
2363
- style: f[t],
2364
- overlayTarget: n,
2365
- onMouseDown: (e) => e.preventDefault(),
2366
- children: /* @__PURE__ */ U(s, {
2367
- size: 16,
2368
- "aria-hidden": !0
2369
- })
2370
- })
2371
- }), /* @__PURE__ */ W(r.Content, {
2387
+ open: !0,
2388
+ onOpenChange: (e) => !e && m(void 0),
2389
+ children: [/* @__PURE__ */ H(r.Trigger, {
2390
+ "aria-hidden": !0,
2391
+ "aria-label": s("table.more"),
2392
+ tabIndex: -1,
2393
+ className: "pointer-events-none fixed size-px opacity-0",
2394
+ style: {
2395
+ left: c,
2396
+ top: l
2397
+ }
2398
+ }), /* @__PURE__ */ U(r.Content, {
2372
2399
  container: n,
2373
- className: Y("z-3", e?.className),
2374
- align: "start",
2375
- side: t === "row" ? "right" : "top",
2376
- onCloseAutoFocus: (e) => {
2377
- h.current && e.preventDefault();
2400
+ className: J("z-3 vibe-shadcn-tiptap__popover", e?.className),
2401
+ style: {
2402
+ maxHeight: "min(24rem, var(--radix-dropdown-menu-content-available-height, calc(100dvh - 16px)))",
2403
+ overflowY: "auto",
2404
+ overscrollBehavior: "contain"
2378
2405
  },
2406
+ "aria-label": s("table.more"),
2407
+ align: "start",
2408
+ onCloseAutoFocus: (e) => e.preventDefault(),
2409
+ onEscapeKeyDown: () => a.view.focus(),
2379
2410
  children: [
2380
- mr[t].map(([e, t, n]) => /* @__PURE__ */ W(r.Item, {
2411
+ /* @__PURE__ */ U(r.Item, {
2381
2412
  className: "vibe-shadcn-tiptap__menu-item",
2382
- onSelect: () => m(a[e]),
2383
- children: [/* @__PURE__ */ U(n, {
2413
+ onSelect: () => x("row", i),
2414
+ children: [/* @__PURE__ */ H(zt, {
2384
2415
  size: 15,
2385
2416
  "aria-hidden": !0
2386
- }), o(t)]
2387
- }, e)),
2388
- c[t] === 0 && /* @__PURE__ */ W(r.Item, {
2417
+ }), s("table.selectRow")]
2418
+ }),
2419
+ /* @__PURE__ */ U(r.Item, {
2389
2420
  className: "vibe-shadcn-tiptap__menu-item",
2390
- onSelect: () => m(t === "row" ? a.toggleHeaderRow : a.toggleHeaderColumn),
2391
- children: [/* @__PURE__ */ U(Vt, {
2421
+ onSelect: () => x("column", i),
2422
+ children: [/* @__PURE__ */ H(Ye, {
2392
2423
  size: 15,
2393
2424
  "aria-hidden": !0
2394
- }), o(v(t, c) ? "table.unsetHeader" : "table.setHeader")]
2425
+ }), s("table.selectColumn")]
2395
2426
  }),
2396
- /* @__PURE__ */ W(r.Item, {
2427
+ /* @__PURE__ */ U(r.Item, {
2397
2428
  className: "vibe-shadcn-tiptap__menu-item",
2398
- onSelect: () => m(() => t === "row" ? a.deleteRow(c.row) : a.deleteColumn(c.column)),
2399
- children: [/* @__PURE__ */ U(Ht, {
2429
+ onSelect: () => {
2430
+ let e = b(i.cell);
2431
+ e && a.isEditable && o.selectTable(e.pos);
2432
+ },
2433
+ children: [/* @__PURE__ */ H(Gt, {
2400
2434
  size: 15,
2401
2435
  "aria-hidden": !0
2402
- }), o("table.deleteLine")]
2403
- })
2436
+ }), s("table.selectTable")]
2437
+ }),
2438
+ /* @__PURE__ */ H("hr", { className: "my-1 border-border" }),
2439
+ /* @__PURE__ */ U(r.Item, {
2440
+ className: "vibe-shadcn-tiptap__menu-item",
2441
+ disabled: !a.isEditable || !u,
2442
+ onSelect: o.mergeCells,
2443
+ children: [/* @__PURE__ */ H(Kt, {
2444
+ size: 15,
2445
+ "aria-hidden": !0
2446
+ }), s("table.mergeCells")]
2447
+ }),
2448
+ /* @__PURE__ */ U(r.Item, {
2449
+ className: "vibe-shadcn-tiptap__menu-item",
2450
+ disabled: !a.isEditable || !d,
2451
+ onSelect: o.splitCell,
2452
+ children: [/* @__PURE__ */ H(qt, {
2453
+ size: 15,
2454
+ "aria-hidden": !0
2455
+ }), s("table.splitCell")]
2456
+ }),
2457
+ /* @__PURE__ */ H("hr", { className: "my-1 border-border" }),
2458
+ T(Cr, f),
2459
+ /* @__PURE__ */ H("hr", { className: "my-1 border-border" }),
2460
+ T(wr, f),
2461
+ (i.row === 0 || i.column === 0) && /* @__PURE__ */ U(_e, { children: [
2462
+ /* @__PURE__ */ H("hr", { className: "my-1 border-border" }),
2463
+ E("row", i, (e) => f("row", e), Tr.row),
2464
+ E("column", i, (e) => f("column", e), Tr.column)
2465
+ ] }),
2466
+ /* @__PURE__ */ H("hr", { className: "my-1 border-border" }),
2467
+ D("row", i, (e) => f("row", e)),
2468
+ D("column", i, (e) => f("column", e))
2469
+ ]
2470
+ })]
2471
+ });
2472
+ }
2473
+ if (!h || !l) return null;
2474
+ let O = Sr.map((t) => {
2475
+ let o = s(t === "row" ? "table.rowMenu" : "table.columnMenu");
2476
+ function c(e) {
2477
+ l && a.isEditable && x(t, l) && (y.current = !0, e(), u(void 0), f(void 0));
2478
+ }
2479
+ return /* @__PURE__ */ U(r.Root, {
2480
+ modal: !1,
2481
+ open: d === t,
2482
+ onOpenChange: (e) => {
2483
+ e ? (y.current = !1, x(t, l) && f(t)) : f(void 0);
2484
+ },
2485
+ children: [/* @__PURE__ */ H(r.Trigger, {
2486
+ asChild: !0,
2487
+ children: /* @__PURE__ */ H("button", {
2488
+ type: "button",
2489
+ contentEditable: !1,
2490
+ "aria-label": o,
2491
+ className: J("vibe-tiptap-table-grip", `vibe-tiptap-table-grip--${t}`, "vibe-shadcn-tiptap__grip", `vibe-shadcn-tiptap__grip--${t}`, i),
2492
+ style: h.positions[t],
2493
+ onMouseDown: (e) => e.preventDefault()
2494
+ })
2495
+ }), /* @__PURE__ */ U(r.Content, {
2496
+ container: n,
2497
+ className: J("z-3 vibe-shadcn-tiptap__popover", e?.className),
2498
+ align: "start",
2499
+ side: t === "row" ? "right" : "top",
2500
+ onCloseAutoFocus: (e) => {
2501
+ y.current && e.preventDefault();
2502
+ },
2503
+ children: [
2504
+ T([...Cr, ...wr].filter(([e]) => e === t), (e, t) => c(t)),
2505
+ E(t, l, c, {
2506
+ set: "table.setHeader",
2507
+ unset: "table.unsetHeader"
2508
+ }),
2509
+ D(t, l, c)
2404
2510
  ]
2405
2511
  })]
2406
2512
  }, t);
2407
2513
  });
2514
+ return pn(O, h.wrapper);
2408
2515
  }
2409
2516
  // src/use-vibe-tiptap.ts
2410
- var gr = Symbol();
2411
- function _r(e = {}) {
2412
- let t = zn(), [n] = J(() => ({
2517
+ var Dr = Symbol();
2518
+ function Or(e = {}) {
2519
+ let t = Jn(), [n] = q(() => ({
2413
2520
  ...e,
2414
2521
  mediaResources: e.mediaResources ?? t
2415
- })), [r, i] = J(!1), a = q(void 0), o = q(e), s = q(void 0), c = q(void 0), l = q(void 0), [u] = J(() => {
2522
+ })), [r, i] = q(!1), a = K(void 0), o = K(e), s = K(void 0), c = K(void 0), l = K(void 0), [u] = q(() => {
2416
2523
  function e() {
2417
2524
  let e = c.current;
2418
- c.current = void 0, a.current?.onSlash(void 0), e && !e.editor.isDestroyed && ne(e.editor.view, (n.slashCommand || void 0)?.pluginKey ?? V);
2525
+ c.current = void 0, a.current?.onSlash(void 0), e && !e.editor.isDestroyed && te(e.editor.view, (n.slashCommand || void 0)?.pluginKey ?? V);
2419
2526
  }
2420
2527
  function t() {
2421
- l.current && te(l.current.editor);
2528
+ l.current && ee(l.current.editor);
2422
2529
  }
2423
2530
  return {
2424
2531
  bind(n) {
@@ -2455,9 +2562,9 @@ function _r(e = {}) {
2455
2562
  };
2456
2563
  function g() {
2457
2564
  let e = s.current;
2458
- if (e?.editor.schema.nodes.image) return A(e, () => o.current.uploadAsset, () => o.current.editorBehaviorOptions);
2565
+ if (e?.editor.schema.nodes.image) return j(e, () => o.current.uploadAsset, () => o.current.editorBehaviorOptions);
2459
2566
  }
2460
- G(() => {
2567
+ W(() => {
2461
2568
  o.current = e;
2462
2569
  }, [e]);
2463
2570
  let _ = me({
@@ -2488,11 +2595,11 @@ function _r(e = {}) {
2488
2595
  (e.notify ?? a.current?.notify)?.(t, n);
2489
2596
  }
2490
2597
  }, n.slashCommand === !1 ? void 0 : d);
2491
- return G(() => (s.current = _, () => {
2598
+ return W(() => (s.current = _, () => {
2492
2599
  s.current = void 0;
2493
2600
  }), [_]), {
2494
2601
  context: _,
2495
- [gr]: {
2602
+ [Dr]: {
2496
2603
  bridge: u,
2497
2604
  preview: r,
2498
2605
  setPreview: i,
@@ -2506,90 +2613,90 @@ function _r(e = {}) {
2506
2613
  };
2507
2614
  }
2508
2615
  // src/shadcn-tiptap-editor.tsx
2509
- function vr(e) {
2510
- let t = Bn(e), { components: n, editor: r, showWordCount: i = !0, toolbar: a, toolbarOptions: o, colors: s, highlights: c, ui: l, markdownOptions: u, renderMentionItem: d, renderMentionPopover: f, printOptions: p, className: m, onKeyDown: h, ...g } = {
2616
+ function kr(e) {
2617
+ let t = Yn(e), { components: n, editor: r, showWordCount: i = !0, toolbar: a, toolbarOptions: o, colors: s, highlights: c, ui: l, markdownOptions: u, renderMentionItem: d, renderMentionPopover: f, printOptions: p, className: m, onKeyDown: h, ...g } = {
2511
2618
  ...e,
2512
2619
  ...t
2513
- }, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[gr], { Tooltip: ee } = n, [D, O] = J(null), [k, A] = J(null), [j, te] = J(!1), [ne, M] = J(), [N, P] = J(), [re, ie] = J(), [ae, oe] = J(!1), [F, I] = J(), [se, L] = J(), [ce, R] = J([]), le = q(0), z = q(/* @__PURE__ */ new Map()), B = q(!1), de = E(a).some((e) => e.includes("preview")), V = H(_, (e) => e.editor.isEditable) ?? v, fe = D?.ownerDocument.fullscreenEnabled && typeof D.requestFullscreen == "function";
2514
- G(() => {
2620
+ }, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[Dr], { Tooltip: D } = n, [O, k] = q(null), [A, j] = q(null), [M, ee] = q(!1), [te, N] = q(), [P, F] = q(), [ne, re] = q(), [ie, ae] = q(!1), [I, L] = q(), [oe, R] = q(), [se, z] = q([]), ce = K(0), le = K(/* @__PURE__ */ new Map()), B = K(!1), de = E(a).some((e) => e.includes("preview")), V = he(_, (e) => e.editor.isEditable) ?? v, fe = O?.ownerDocument.fullscreenEnabled && typeof O.requestFullscreen == "function";
2621
+ W(() => {
2515
2622
  let e = T.bind({
2516
- onSlash: P,
2517
- onMention: ie,
2623
+ onSlash: F,
2624
+ onMention: re,
2518
2625
  onExecute: ({ item: e }) => {
2519
2626
  _ && ue(_, e, {
2520
- onImage: () => I({
2627
+ onImage: () => L({
2521
2628
  kind: "image",
2522
2629
  tab: "upload"
2523
2630
  }),
2524
- onImageUrl: () => I({
2631
+ onImageUrl: () => L({
2525
2632
  kind: "image",
2526
2633
  tab: "url"
2527
2634
  }),
2528
- onVideo: () => I({
2635
+ onVideo: () => L({
2529
2636
  kind: "video",
2530
2637
  tab: "upload"
2531
2638
  }),
2532
- onVideoUrl: () => I({
2639
+ onVideoUrl: () => L({
2533
2640
  kind: "video",
2534
2641
  tab: "url"
2535
2642
  }),
2536
- onAudio: () => I({
2643
+ onAudio: () => L({
2537
2644
  kind: "audio",
2538
2645
  tab: "upload"
2539
2646
  }),
2540
- onAudioUrl: () => I({
2647
+ onAudioUrl: () => L({
2541
2648
  kind: "audio",
2542
2649
  tab: "url"
2543
2650
  }),
2544
- onUpload: () => I({
2651
+ onUpload: () => L({
2545
2652
  kind: "attachment",
2546
2653
  tab: "upload"
2547
2654
  }),
2548
- onLink: () => I({ kind: "link" }),
2549
- onWhiteboard: () => L("new")
2655
+ onLink: () => L({ kind: "link" }),
2656
+ onWhiteboard: () => R("new")
2550
2657
  });
2551
2658
  },
2552
2659
  onImagePreview(e) {
2553
- M({
2660
+ N({
2554
2661
  ...e,
2555
2662
  urls: [...e.urls],
2556
2663
  names: e.names?.slice()
2557
2664
  });
2558
2665
  },
2559
2666
  notify(e, t = "info") {
2560
- let n = ++le.current;
2561
- R((r) => [...r, {
2667
+ let n = ++ce.current;
2668
+ z((r) => [...r, {
2562
2669
  id: n,
2563
2670
  message: e,
2564
2671
  type: t
2565
- }]), z.current.set(n, setTimeout(() => {
2566
- z.current.delete(n), R((e) => e.filter((e) => e.id !== n));
2672
+ }]), le.current.set(n, setTimeout(() => {
2673
+ le.current.delete(n), z((e) => e.filter((e) => e.id !== n));
2567
2674
  }, 3e3));
2568
2675
  }
2569
- }), t = z.current;
2676
+ }), t = le.current;
2570
2677
  return () => {
2571
2678
  e();
2572
2679
  for (let e of t.values()) clearTimeout(e);
2573
- t.clear(), R([]), P(void 0), ie(void 0), M(void 0), I(void 0), L(void 0), oe(!1);
2680
+ t.clear(), z([]), F(void 0), re(void 0), N(void 0), L(void 0), R(void 0), ae(!1);
2574
2681
  };
2575
- }, [T, _]), G(() => {
2682
+ }, [T, _]), W(() => {
2576
2683
  de || b(!1);
2577
- }, [de, b]), G(() => {
2578
- if (!D) return;
2579
- let e = D.ownerDocument, t = () => te(e.fullscreenElement === D);
2684
+ }, [de, b]), W(() => {
2685
+ if (!O) return;
2686
+ let e = O.ownerDocument, t = () => ee(e.fullscreenElement === O);
2580
2687
  return e.addEventListener("fullscreenchange", t), () => e.removeEventListener("fullscreenchange", t);
2581
- }, [D]), G(() => {
2582
- V || (I(void 0), L(void 0), oe(!1)), !V && N && T.closeSlashMenu();
2688
+ }, [O]), W(() => {
2689
+ V || (L(void 0), R(void 0), ae(!1)), !V && P && T.closeSlashMenu();
2583
2690
  }, [
2584
2691
  T,
2585
2692
  V,
2586
- N
2693
+ P
2587
2694
  ]);
2588
2695
  async function pe(e) {
2589
- if (D && !B.current && e !== j) {
2696
+ if (O && !B.current && e !== M) {
2590
2697
  B.current = !0;
2591
2698
  try {
2592
- e ? await D.requestFullscreen() : await D.ownerDocument.exitFullscreen();
2699
+ e ? await O.requestFullscreen() : await O.ownerDocument.exitFullscreen();
2593
2700
  } catch {
2594
2701
  _ && !_.editor.isDestroyed && _.notify(_.t("notify.fullscreenFailed"), "warning");
2595
2702
  } finally {
@@ -2606,32 +2713,32 @@ function vr(e) {
2606
2713
  if (!o.nodeAfter?.isText) return;
2607
2714
  let s = a.isInSet(o.nodeAfter.marks);
2608
2715
  if (!s || s.attrs.href !== n.getAttribute("href")) return;
2609
- let c = _e(o, a, s.attrs);
2716
+ let c = ve(o, a, s.attrs);
2610
2717
  if (!c) return;
2611
2718
  e.preventDefault();
2612
2719
  let { from: l, to: u } = i.selection;
2613
2720
  (l < c.from || l >= c.to || u > c.to) && t.commands.setTextSelection(c), r.focus();
2614
2721
  }
2615
- return /* @__PURE__ */ U(pn, {
2722
+ return /* @__PURE__ */ H(Cn, {
2616
2723
  value: n,
2617
- children: /* @__PURE__ */ U(ee.Provider, {
2724
+ children: /* @__PURE__ */ H(D.Provider, {
2618
2725
  delayDuration: 500,
2619
2726
  skipDelayDuration: 0,
2620
- children: /* @__PURE__ */ W("div", {
2727
+ children: /* @__PURE__ */ U("div", {
2621
2728
  ...g,
2622
- ref: O,
2729
+ ref: k,
2623
2730
  className: ["vibe-shadcn-tiptap", m].filter(Boolean).join(" "),
2624
- "data-scroll-locked": V && !!(N || re || F || ae) || void 0,
2731
+ "data-scroll-locked": V && !!(P || ne || I || ie) || void 0,
2625
2732
  onKeyDown: (e) => {
2626
2733
  if (h?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.shiftKey || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "f" || typeof _?.editor.commands.openFindReplace != "function")) {
2627
2734
  if (e.preventDefault(), e.target instanceof Element && e.target.closest(".vibe-shadcn-tiptap__find")) {
2628
- let e = D?.querySelector(".vibe-shadcn-tiptap__find input");
2735
+ let e = O?.querySelector(".vibe-shadcn-tiptap__find input");
2629
2736
  e instanceof HTMLInputElement && (e.focus(), e.select());
2630
2737
  } else _.commands.openFindReplace();
2631
2738
  }
2632
2739
  },
2633
- children: [_ && /* @__PURE__ */ W(ge, { children: [
2634
- a !== !1 && /* @__PURE__ */ U(Jn, {
2740
+ children: [_ && /* @__PURE__ */ U(_e, { children: [
2741
+ a !== !1 && /* @__PURE__ */ H(rr, {
2635
2742
  context: _,
2636
2743
  toolbar: a,
2637
2744
  toolbarOptions: o,
@@ -2643,101 +2750,101 @@ function vr(e) {
2643
2750
  markdownOptions: u,
2644
2751
  printOptions: p,
2645
2752
  uploadAsset: C,
2646
- openWhiteboard: () => L("new"),
2753
+ openWhiteboard: () => R("new"),
2647
2754
  editorBehaviorOptions: w,
2648
2755
  preview: y,
2649
2756
  onPreviewChange: b,
2650
- fullscreen: fe || j ? j : void 0,
2757
+ fullscreen: fe || M ? M : void 0,
2651
2758
  onFullscreenChange: pe,
2652
- overlayTarget: k ?? void 0
2653
- }, _.editor.instanceId),
2654
- /* @__PURE__ */ W("div", {
2759
+ overlayTarget: A ?? void 0
2760
+ }, `toolbar-${_.editor.instanceId}`),
2761
+ /* @__PURE__ */ U("div", {
2655
2762
  className: "vibe-shadcn-tiptap__body",
2656
2763
  children: [
2657
- /* @__PURE__ */ U(ir, {
2764
+ /* @__PURE__ */ H(pr, {
2658
2765
  context: _,
2659
2766
  appearance: l?.findReplace,
2660
2767
  editable: V,
2661
- overlayTarget: k ?? void 0
2768
+ overlayTarget: A ?? void 0
2662
2769
  }),
2663
- /* @__PURE__ */ U(un, {
2770
+ /* @__PURE__ */ H(bn, {
2664
2771
  context: _,
2665
2772
  tabIndex: !V && typeof _.editor.commands.openFindReplace == "function" ? 0 : void 0,
2666
2773
  onClick: me,
2667
2774
  onBlur: (e) => {
2668
- !e.currentTarget.contains(e.relatedTarget) && N && !_.editor.isDestroyed && T.closeSlashMenu();
2775
+ !e.currentTarget.contains(e.relatedTarget) && P && !_.editor.isDestroyed && T.closeSlashMenu();
2669
2776
  }
2670
2777
  }),
2671
- V && k && /* @__PURE__ */ U(hr, {
2778
+ V && A && /* @__PURE__ */ H(Er, {
2672
2779
  appearance: l?.tableGrips,
2673
2780
  context: _,
2674
- overlayTarget: k
2781
+ overlayTarget: A
2675
2782
  })
2676
2783
  ]
2677
2784
  }),
2678
- i && /* @__PURE__ */ U(dn, { context: _ }),
2679
- V && k && /* @__PURE__ */ U(rr, {
2785
+ i && /* @__PURE__ */ H(xn, { context: _ }),
2786
+ V && A && /* @__PURE__ */ H(fr, {
2680
2787
  context: _,
2681
2788
  ui: l,
2682
- overlayTarget: k,
2789
+ overlayTarget: A,
2683
2790
  colors: s,
2684
2791
  highlights: c,
2685
2792
  uploadAsset: C,
2686
2793
  behaviorOptions: w,
2687
- onLink: I,
2688
- onWhiteboardEdit: () => L("edit"),
2689
- onPaletteOpenChange: oe
2794
+ onLink: L,
2795
+ onWhiteboardEdit: () => R("edit"),
2796
+ onPaletteOpenChange: ae
2690
2797
  }),
2691
- V && k && C && se && /* @__PURE__ */ U(Vn, {
2798
+ V && A && C && oe && /* @__PURE__ */ H(Xn, {
2692
2799
  appearance: l?.whiteboard,
2693
2800
  context: _,
2694
2801
  uploadAsset: C,
2695
- overlayTarget: k,
2696
- edit: se === "edit",
2697
- onClose: () => L(void 0)
2802
+ overlayTarget: A,
2803
+ edit: oe === "edit",
2804
+ onClose: () => R(void 0)
2698
2805
  }),
2699
- V && N && k && /* @__PURE__ */ U(dr, {
2806
+ V && P && A && /* @__PURE__ */ H(br, {
2700
2807
  appearance: l?.slashMenu,
2701
- state: N,
2702
- target: k,
2808
+ state: P,
2809
+ target: A,
2703
2810
  t: _.t
2704
2811
  }),
2705
- V && re && k && /* @__PURE__ */ U(sr, {
2812
+ V && ne && A && /* @__PURE__ */ H(gr, {
2706
2813
  appearance: l?.mentionMenu,
2707
- state: re,
2708
- target: k,
2814
+ state: ne,
2815
+ target: A,
2709
2816
  t: _.t,
2710
2817
  renderItem: d
2711
2818
  }),
2712
- f && k && /* @__PURE__ */ U(cr, {
2819
+ f && A && /* @__PURE__ */ H(_r, {
2713
2820
  editor: _.editor.view.dom,
2714
- container: k,
2715
- hoverDelay: r[gr].mentionHoverDelay,
2821
+ container: A,
2822
+ hoverDelay: r[Dr].mentionHoverDelay,
2716
2823
  render: f
2717
- }, _.editor.instanceId),
2718
- V && F && k && /* @__PURE__ */ U(On, {
2824
+ }, `bubble-${_.editor.instanceId}`),
2825
+ V && I && A && /* @__PURE__ */ H(Ln, {
2719
2826
  appearance: l?.insertionPopover,
2720
2827
  context: _,
2721
- request: F,
2722
- overlayTarget: k,
2828
+ request: I,
2829
+ overlayTarget: A,
2723
2830
  canUpload: !!C,
2724
2831
  behaviorOptions: w,
2725
- onClose: () => I(void 0)
2726
- }, F.kind),
2727
- k && ne && /* @__PURE__ */ U(or, {
2832
+ onClose: () => L(void 0)
2833
+ }, I.kind),
2834
+ A && te && /* @__PURE__ */ H(hr, {
2728
2835
  appearance: l?.imagePreview,
2729
2836
  context: _,
2730
- overlayTarget: k,
2731
- imagePreview: ne,
2732
- onClose: () => M(void 0)
2837
+ overlayTarget: A,
2838
+ imagePreview: te,
2839
+ onClose: () => N(void 0)
2733
2840
  })
2734
- ] }), /* @__PURE__ */ U("div", {
2735
- ref: A,
2841
+ ] }), /* @__PURE__ */ H("div", {
2842
+ ref: j,
2736
2843
  className: "vibe-shadcn-tiptap__overlays",
2737
- children: /* @__PURE__ */ U("div", {
2844
+ children: /* @__PURE__ */ H("div", {
2738
2845
  className: "vibe-shadcn-tiptap__notices",
2739
2846
  "aria-live": "polite",
2740
- children: ce.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ U("div", {
2847
+ children: se.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ H("div", {
2741
2848
  role: n === "error" ? "alert" : "status",
2742
2849
  "data-type": n,
2743
2850
  children: t
@@ -2748,4 +2855,4 @@ function vr(e) {
2748
2855
  })
2749
2856
  });
2750
2857
  }
2751
- export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR, un as ShadcnTiptapContent, vr as ShadcnTiptapEditor, vr as VibeTiptap, dn as ShadcnTiptapStatusBar, qn as ShadcnTiptapToolbar, b as TOOLBAR_ALIGN_OPTIONS, S as TOOLBAR_HEADING_OPTIONS, n as TOOLBAR_HEADING_PREVIEW_STYLES, a as TOOLBAR_MARKDOWN_IMPORT_ACCEPT, o as TOOLBAR_MARKDOWN_OPTIONS, w as TOOLBAR_TABLE_GRID, Rn as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, _r as useVibeTiptap };
2858
+ export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR, bn as ShadcnTiptapContent, kr as ShadcnTiptapEditor, kr as VibeTiptap, xn as ShadcnTiptapStatusBar, nr as ShadcnTiptapToolbar, b as TOOLBAR_ALIGN_OPTIONS, S as TOOLBAR_HEADING_OPTIONS, n as TOOLBAR_HEADING_PREVIEW_STYLES, a as TOOLBAR_MARKDOWN_IMPORT_ACCEPT, o as TOOLBAR_MARKDOWN_OPTIONS, w as TOOLBAR_TABLE_GRID, qn as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, Or as useVibeTiptap };