@pstdio/ui 0.5.2 → 0.6.0

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.
Files changed (45) hide show
  1. package/dist/{MermaidComponent-DDCxR-Gs.js → MermaidComponent-D7Baqkwx.js} +2 -2
  2. package/dist/{MermaidComponent-DDCxR-Gs.js.map → MermaidComponent-D7Baqkwx.js.map} +1 -1
  3. package/dist/chat-ui.js +11 -9
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/activity/activity-avatar.d.ts +9 -0
  6. package/dist/components/activity/activity-comment.d.ts +19 -0
  7. package/dist/components/activity/activity-composer.d.ts +18 -0
  8. package/dist/components/activity/activity-event.d.ts +12 -0
  9. package/dist/components/activity/activity-root.d.ts +15 -0
  10. package/dist/components/activity/activity-timeline.d.ts +6 -0
  11. package/dist/components/activity/activity.types.d.ts +5 -0
  12. package/dist/components/activity/index.d.ts +25 -0
  13. package/dist/components/chat-ui/components/ai-conversation.d.ts +4 -4
  14. package/dist/components/rich-text/shared/editor-config.d.ts +1 -0
  15. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/floating-toolbar-buttons.d.ts +16 -0
  16. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/commands.d.ts +2 -0
  17. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/index.d.ts +3 -0
  18. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/link-editor-content.d.ts +18 -0
  19. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/link-edit-state.d.ts +1 -0
  20. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/selection-link-url.d.ts +2 -0
  21. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.d.ts +1 -1
  22. package/dist/components/rich-text/shared/transformers/markdown-transformers-test-utils.d.ts +3 -0
  23. package/dist/components/rich-text/shared/transformers/markdown-transformers.d.ts +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.js +2047 -1786
  26. package/dist/index.js.map +1 -1
  27. package/dist/{rich-message-DeJwzVeV.js → rich-message-33DPxuWJ.js} +502 -464
  28. package/dist/rich-message-33DPxuWJ.js.map +1 -0
  29. package/dist/rich-text.js +738 -414
  30. package/dist/rich-text.js.map +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/theme/recipes/alert.d.ts +1 -1
  33. package/dist/theme/recipes/dialog.d.ts +1 -1
  34. package/dist/theme/recipes/drawer.d.ts +1 -1
  35. package/dist/theme/recipes/menu.d.ts +1 -1
  36. package/dist/theme/recipes/popover.d.ts +1 -1
  37. package/dist/theme/tokens/borders.d.ts +6 -24
  38. package/dist/theme/tokens/colors.d.ts +168 -168
  39. package/dist/theme/tokens/shadows.d.ts +5 -5
  40. package/dist/{theme-Dq4r3aRE.js → theme-0SQvHr1t.js} +140 -158
  41. package/dist/theme-0SQvHr1t.js.map +1 -0
  42. package/dist/theme.js +1 -1
  43. package/package.json +1 -1
  44. package/dist/rich-message-DeJwzVeV.js.map +0 -1
  45. package/dist/theme-Dq4r3aRE.js.map +0 -1
package/dist/rich-text.js CHANGED
@@ -1,146 +1,272 @@
1
- import { jsx as t, jsxs as ie } from "react/jsx-runtime";
2
- import { c as ee } from "react/compiler-runtime";
3
- import { e as he, a as ge, C as ve, I as Ce, E as be, b as xe, s as Fe, n as $e, c as fe, T as De, d as je } from "./rich-message-DeJwzVeV.js";
4
- import { D as vo, f as Co, R as bo, P as xo, R as Eo, g as To, h as yo } from "./rich-message-DeJwzVeV.js";
5
- import { IconButton as $, Stack as We, Text as Z, Box as Ee, Flex as de } from "@chakra-ui/react";
6
- import { LexicalCollaboration as Ue } from "@lexical/react/LexicalCollaborationContext";
7
- import { CollaborationPluginV2__EXPERIMENTAL as Ke } from "@lexical/react/LexicalCollaborationPlugin";
8
- import { LexicalComposer as Te } from "@lexical/react/LexicalComposer";
9
- import { LexicalErrorBoundary as ye } from "@lexical/react/LexicalErrorBoundary";
10
- import { HorizontalRulePlugin as _e } from "@lexical/react/LexicalHorizontalRulePlugin";
11
- import { LinkPlugin as Se } from "@lexical/react/LexicalLinkPlugin";
12
- import { ListPlugin as Re } from "@lexical/react/LexicalListPlugin";
13
- import { RichTextPlugin as we } from "@lexical/react/LexicalRichTextPlugin";
14
- import { TabIndentationPlugin as ke } from "@lexical/react/LexicalTabIndentationPlugin";
15
- import { useState as H, useRef as te, useEffect as G } from "react";
16
- import { WebsocketProvider as qe } from "y-websocket";
17
- import * as Ve from "yjs";
18
- import { $isCodeNode as le, $createCodeNode as Ge } from "@lexical/code";
19
- import { useLexicalComposerContext as Le } from "@lexical/react/LexicalComposerContext";
20
- import { mergeRegister as Ie, $findMatchingParent as me } from "@lexical/utils";
21
- import { SELECTION_CHANGE_COMMAND as Me, COMMAND_PRIORITY_CRITICAL as Ne, $getSelection as J, $isRangeSelection as Y, $isRootOrShadowRoot as Ye, CLICK_COMMAND as Xe, COMMAND_PRIORITY_HIGH as Qe, FORMAT_TEXT_COMMAND as re, $createParagraphNode as ue, $getRoot as Ze } from "lexical";
22
- import { Check as Je, Copy as et, Code2 as tt, List as ot, ListOrdered as nt, ListTodo as it } from "lucide-react";
23
- import { createPortal as Pe } from "react-dom";
24
- import { T as D } from "./get-file-type-icon-Bwqf1WXA.js";
25
- import { $isListNode as ae, REMOVE_LIST_COMMAND as lt, INSERT_CHECK_LIST_COMMAND as rt, INSERT_ORDERED_LIST_COMMAND as at, INSERT_UNORDERED_LIST_COMMAND as st } from "@lexical/list";
26
- import { $isHeadingNode as ct, $createHeadingNode as dt } from "@lexical/rich-text";
27
- import { $setBlocksType as ne } from "@lexical/selection";
28
- import { $convertFromMarkdownString as mt, $convertToMarkdownString as ft } from "@lexical/markdown";
29
- import { AutoFocusPlugin as ut } from "@lexical/react/LexicalAutoFocusPlugin";
30
- import { CheckListPlugin as pt } from "@lexical/react/LexicalCheckListPlugin";
31
- import { HistoryPlugin as ht } from "@lexical/react/LexicalHistoryPlugin";
32
- import { OnChangePlugin as gt } from "@lexical/react/LexicalOnChangePlugin";
33
- function se(o) {
34
- const e = J();
35
- if (!Y(e))
1
+ import { jsx as n, jsxs as ie, Fragment as ft } from "react/jsx-runtime";
2
+ import { c as te } from "react/compiler-runtime";
3
+ import { T as Ke, e as We, a as Ve, C as Ge, I as qe, E as Ye, b as Xe, s as mt, n as ut, c as He, d as pt, f as ht } from "./rich-message-33DPxuWJ.js";
4
+ import { D as co, g as fo, R as mo, P as uo, R as po, h as ho, i as go } from "./rich-message-33DPxuWJ.js";
5
+ import { IconButton as F, Text as me, Stack as Pe, Box as $e, Flex as Ae, Input as gt, Link as bt } from "@chakra-ui/react";
6
+ import { LexicalCollaboration as vt } from "@lexical/react/LexicalCollaborationContext";
7
+ import { CollaborationPluginV2__EXPERIMENTAL as Ct } from "@lexical/react/LexicalCollaborationPlugin";
8
+ import { LexicalComposer as Qe } from "@lexical/react/LexicalComposer";
9
+ import { LexicalErrorBoundary as Ze } from "@lexical/react/LexicalErrorBoundary";
10
+ import { HorizontalRulePlugin as Je } from "@lexical/react/LexicalHorizontalRulePlugin";
11
+ import { LinkPlugin as et } from "@lexical/react/LexicalLinkPlugin";
12
+ import { ListPlugin as tt } from "@lexical/react/LexicalListPlugin";
13
+ import { RichTextPlugin as nt } from "@lexical/react/LexicalRichTextPlugin";
14
+ import { TabIndentationPlugin as ot } from "@lexical/react/LexicalTabIndentationPlugin";
15
+ import { useState as B, useRef as oe, useEffect as q, useLayoutEffect as _t } from "react";
16
+ import { WebsocketProvider as Et } from "y-websocket";
17
+ import * as kt from "yjs";
18
+ import { $isCodeNode as Te, $createCodeNode as Lt } from "@lexical/code";
19
+ import { useLexicalComposerContext as De } from "@lexical/react/LexicalComposerContext";
20
+ import { mergeRegister as Le, $findMatchingParent as Z } from "@lexical/utils";
21
+ import { SELECTION_CHANGE_COMMAND as Se, COMMAND_PRIORITY_CRITICAL as Oe, $getSelection as ee, $isRangeSelection as Q, FORMAT_TEXT_COMMAND as Re, $isRootOrShadowRoot as St, CLICK_COMMAND as it, COMMAND_PRIORITY_HIGH as lt, $createParagraphNode as Fe, COMMAND_PRIORITY_LOW as Be, KEY_ESCAPE_COMMAND as yt, $isLineBreakNode as xt, $setSelection as Tt, $getRoot as Rt } from "lexical";
22
+ import { Check as rt, Copy as wt, Link as Nt, Code2 as It, List as Pt, ListOrdered as At, ListTodo as Bt, X as zt, Pencil as Mt, Trash2 as $t } from "lucide-react";
23
+ import { createPortal as Ue } from "react-dom";
24
+ import { T as j } from "./get-file-type-icon-Bwqf1WXA.js";
25
+ import { $isLinkNode as le, $isAutoLinkNode as pe, TOGGLE_LINK_COMMAND as ze, $createLinkNode as Dt } from "@lexical/link";
26
+ import { $isListNode as we, REMOVE_LIST_COMMAND as Ot, INSERT_CHECK_LIST_COMMAND as Ut, INSERT_ORDERED_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Ft } from "@lexical/list";
27
+ import { $isHeadingNode as jt, $createHeadingNode as Kt } from "@lexical/rich-text";
28
+ import { $isAtNodeEnd as je, $setBlocksType as _e } from "@lexical/selection";
29
+ import { $convertFromMarkdownString as Wt, $convertToMarkdownString as Vt } from "@lexical/markdown";
30
+ import { AutoFocusPlugin as Gt } from "@lexical/react/LexicalAutoFocusPlugin";
31
+ import { CheckListPlugin as qt } from "@lexical/react/LexicalCheckListPlugin";
32
+ import { HistoryPlugin as Yt } from "@lexical/react/LexicalHistoryPlugin";
33
+ import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
34
+ function Ne(t) {
35
+ const e = ee();
36
+ if (!Q(e))
36
37
  return null;
37
- const i = e.anchor.getNode(), n = le(i) ? i : me(i, (a) => le(a));
38
- if (!le(n))
38
+ const r = e.anchor.getNode(), o = Te(r) ? r : Z(r, (m) => Te(m));
39
+ if (!Te(o))
39
40
  return null;
40
- const s = o.getElementByKey(n.getKey());
41
- return s instanceof HTMLElement ? s : null;
41
+ const l = t.getElementByKey(o.getKey());
42
+ return l instanceof HTMLElement ? l : null;
42
43
  }
43
- function vt(o) {
44
- return o instanceof HTMLElement ? o.closest(".rich-text__code") : null;
44
+ function Qt(t) {
45
+ return t instanceof HTMLElement ? t.closest(".rich-text__code") : null;
45
46
  }
46
- function Ct(o, e) {
47
- const i = o.getBoundingClientRect(), n = e.getBoundingClientRect();
47
+ function Zt(t, e) {
48
+ const r = t.getBoundingClientRect(), o = e.getBoundingClientRect();
48
49
  return {
49
- top: n.top - i.top + 6,
50
- left: n.right - i.left - 30
50
+ top: o.top - r.top + 6,
51
+ left: o.right - r.left - 30
51
52
  };
52
53
  }
53
- function Be(o) {
54
- const e = ee(31), {
55
- anchorElem: i
56
- } = o, [n] = Le(), [s, a] = H(null), [m, d] = H(!1), c = te(null);
57
- let v, C;
58
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = () => () => {
59
- c.current !== null && window.clearTimeout(c.current);
60
- }, C = [], e[0] = v, e[1] = C) : (v = e[0], C = e[1]), G(v, C);
61
- let L, f;
62
- e[2] !== n ? (L = () => {
63
- const p = n.getRootElement();
64
- if (!p)
54
+ function st(t) {
55
+ const e = te(31), {
56
+ anchorElem: r
57
+ } = t, [o] = De(), [l, m] = B(null), [L, u] = B(!1), a = oe(null);
58
+ let p, E;
59
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = () => () => {
60
+ a.current !== null && window.clearTimeout(a.current);
61
+ }, E = [], e[0] = p, e[1] = E) : (p = e[0], E = e[1]), q(p, E);
62
+ let b, h;
63
+ e[2] !== o ? (b = () => {
64
+ const _ = o.getRootElement();
65
+ if (!_)
65
66
  return;
66
- const S = (N) => {
67
- const M = vt(N.target);
68
- a(M instanceof HTMLElement ? M : null);
69
- }, k = () => {
70
- n.getEditorState().read(() => {
71
- const N = se(n);
72
- a(N);
67
+ const k = (I) => {
68
+ const z = Qt(I.target);
69
+ m(z instanceof HTMLElement ? z : null);
70
+ }, N = () => {
71
+ o.getEditorState().read(() => {
72
+ const I = Ne(o);
73
+ m(I);
73
74
  });
74
75
  };
75
- return p.addEventListener("pointermove", S), p.addEventListener("pointerleave", k), () => {
76
- p.removeEventListener("pointermove", S), p.removeEventListener("pointerleave", k);
76
+ return _.addEventListener("pointermove", k), _.addEventListener("pointerleave", N), () => {
77
+ _.removeEventListener("pointermove", k), _.removeEventListener("pointerleave", N);
77
78
  };
78
- }, f = [n], e[2] = n, e[3] = L, e[4] = f) : (L = e[3], f = e[4]), G(L, f);
79
- let u, R;
80
- if (e[5] !== n ? (u = () => Ie(n.registerUpdateListener((p) => {
79
+ }, h = [o], e[2] = o, e[3] = b, e[4] = h) : (b = e[3], h = e[4]), q(b, h);
80
+ let C, R;
81
+ if (e[5] !== o ? (C = () => Le(o.registerUpdateListener((_) => {
81
82
  const {
82
- editorState: S
83
- } = p;
84
- S.read(() => {
85
- const k = se(n);
86
- k && a(k);
83
+ editorState: k
84
+ } = _;
85
+ k.read(() => {
86
+ const N = Ne(o);
87
+ N && m(N);
87
88
  });
88
- }), n.registerCommand(Me, () => (n.getEditorState().read(() => {
89
- const p = se(n);
90
- if (!p) {
91
- a(bt);
89
+ }), o.registerCommand(Se, () => (o.getEditorState().read(() => {
90
+ const _ = Ne(o);
91
+ if (!_) {
92
+ m(Jt);
92
93
  return;
93
94
  }
94
- a(p);
95
- }), !1), Ne)), R = [n], e[5] = n, e[6] = u, e[7] = R) : (u = e[6], R = e[7]), G(u, R), !i || !s)
95
+ m(_);
96
+ }), !1), Oe)), R = [o], e[5] = o, e[6] = C, e[7] = R) : (C = e[6], R = e[7]), q(C, R), !r || !l)
96
97
  return null;
97
- let T;
98
- e[8] !== s || e[9] !== i ? (T = Ct(i, s), e[8] = s, e[9] = i, e[10] = T) : T = e[10];
99
- const I = T;
100
- let E;
101
- e[11] !== I.left || e[12] !== I.top ? (E = {
98
+ let c;
99
+ e[8] !== l || e[9] !== r ? (c = Zt(r, l), e[8] = l, e[9] = r, e[10] = c) : c = e[10];
100
+ const w = c;
101
+ let v;
102
+ e[11] !== w.left || e[12] !== w.top ? (v = {
102
103
  position: "absolute",
103
- top: I.top,
104
- left: I.left
105
- }, e[11] = I.left, e[12] = I.top, e[13] = E) : E = e[13];
106
- const l = E, r = m ? "Copied" : "Copy code", y = m ? "Copied" : "Copy code";
107
- let b;
108
- e[14] !== s.textContent ? (b = async () => {
109
- const p = s.textContent ?? "";
104
+ top: w.top,
105
+ left: w.left
106
+ }, e[11] = w.left, e[12] = w.top, e[13] = v) : v = e[13];
107
+ const S = v, g = L ? "Copied" : "Copy code", d = L ? "Copied" : "Copy code";
108
+ let i;
109
+ e[14] !== l.textContent ? (i = async () => {
110
+ const _ = l.textContent ?? "";
110
111
  try {
111
- await navigator.clipboard.writeText(p), d(!0), c.current !== null && window.clearTimeout(c.current), c.current = window.setTimeout(() => {
112
- d(!1);
112
+ await navigator.clipboard.writeText(_), u(!0), a.current !== null && window.clearTimeout(a.current), a.current = window.setTimeout(() => {
113
+ u(!1);
113
114
  }, 1200);
114
115
  } catch {
115
- d(!1);
116
+ u(!1);
116
117
  }
117
- }, e[14] = s.textContent, e[15] = b) : b = e[15];
118
- let h;
119
- e[16] !== m ? (h = m ? /* @__PURE__ */ t(Je, { size: 14 }) : /* @__PURE__ */ t(et, { size: 14 }), e[16] = m, e[17] = h) : h = e[17];
120
- let g;
121
- e[18] !== y || e[19] !== b || e[20] !== h ? (g = /* @__PURE__ */ t($, { "aria-label": y, variant: "surface", size: "xs", onClick: b, children: h }), e[18] = y, e[19] = b, e[20] = h, e[21] = g) : g = e[21];
118
+ }, e[14] = l.textContent, e[15] = i) : i = e[15];
119
+ let s;
120
+ e[16] !== L ? (s = L ? /* @__PURE__ */ n(rt, { size: 14 }) : /* @__PURE__ */ n(wt, { size: 14 }), e[16] = L, e[17] = s) : s = e[17];
121
+ let f;
122
+ e[18] !== d || e[19] !== i || e[20] !== s ? (f = /* @__PURE__ */ n(F, { "aria-label": d, variant: "surface", size: "xs", onClick: i, children: s }), e[18] = d, e[19] = i, e[20] = s, e[21] = f) : f = e[21];
123
+ let y;
124
+ e[22] !== f || e[23] !== g ? (y = /* @__PURE__ */ n(j, { content: g, children: f }), e[22] = f, e[23] = g, e[24] = y) : y = e[24];
122
125
  let x;
123
- e[22] !== g || e[23] !== r ? (x = /* @__PURE__ */ t(D, { content: r, children: g }), e[22] = g, e[23] = r, e[24] = x) : x = e[24];
124
- let _;
125
- e[25] !== l || e[26] !== x ? (_ = /* @__PURE__ */ t("div", { className: "code-block-actions", style: l, children: x }), e[25] = l, e[26] = x, e[27] = _) : _ = e[27];
126
- let w;
127
- return e[28] !== i || e[29] !== _ ? (w = Pe(_, i), e[28] = i, e[29] = _, e[30] = w) : w = e[30], w;
126
+ e[25] !== S || e[26] !== y ? (x = /* @__PURE__ */ n("div", { className: "code-block-actions", style: S, children: y }), e[25] = S, e[26] = y, e[27] = x) : x = e[27];
127
+ let T;
128
+ return e[28] !== r || e[29] !== x ? (T = Ue(x, r), e[28] = r, e[29] = x, e[30] = T) : T = e[30], T;
128
129
  }
129
- function bt(o) {
130
- return o?.matches(":hover") ? o : null;
130
+ function Jt(t) {
131
+ return t?.matches(":hover") ? t : null;
131
132
  }
132
- const xt = 10, Et = 5;
133
- function pe(o, e, i, n = xt, s = Et) {
134
- const a = i.parentElement;
135
- if (o === null || !a) {
133
+ function he(t) {
134
+ const e = t.anchor, r = t.focus, o = t.anchor.getNode(), l = t.focus.getNode();
135
+ return o === l ? o : t.isBackward() ? je(r) ? o : l : je(e) ? o : l;
136
+ }
137
+ const en = 10, tn = 5;
138
+ function ke(t, e, r, o = en, l = tn, m = "legacy") {
139
+ const L = r.parentElement;
140
+ if (t === null || !L) {
136
141
  e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
137
142
  return;
138
143
  }
139
- const m = e.getBoundingClientRect(), d = i.getBoundingClientRect(), c = a.getBoundingClientRect();
140
- let v = o.top - n, C = o.left - s;
141
- v < c.top && (v += m.height + o.height + n * 2), C + m.width > c.right && (C = c.right - m.width - s), v -= d.top, C -= d.left, e.style.opacity = "1", e.style.transform = `translate(${C}px, ${v}px)`;
144
+ const u = e.getBoundingClientRect(), a = r.getBoundingClientRect(), p = L.getBoundingClientRect();
145
+ let E = m === "above" ? t.top - u.height - o : t.top - o, b = t.left - l;
146
+ E < p.top && (E = m === "above" ? t.bottom + o : E + u.height + t.height + o * 2), b + u.width > p.right && (b = p.right - u.width - l), E -= a.top, b -= a.left, e.style.opacity = "1", e.style.transform = `translate(${b}px, ${E}px)`;
147
+ }
148
+ function Ie() {
149
+ const t = te(1);
150
+ let e;
151
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("span", { style: {
152
+ display: "inline-flex",
153
+ height: "1rem",
154
+ margin: "0 0.25rem",
155
+ borderLeft: "1px solid var(--chakra-colors-border-muted)"
156
+ } }), t[0] = e) : e = t[0], e;
157
+ }
158
+ function nn(t) {
159
+ const e = te(81), {
160
+ editor: r,
161
+ blockType: o,
162
+ isBold: l,
163
+ isItalic: m,
164
+ isUnderline: L,
165
+ isLink: u,
166
+ formatHeading: a,
167
+ formatList: p,
168
+ formatCodeBlock: E,
169
+ insertLink: b
170
+ } = t, h = l || void 0;
171
+ let C;
172
+ e[0] !== r ? (C = () => r.dispatchCommand(Re, "bold"), e[0] = r, e[1] = C) : C = e[1];
173
+ let R;
174
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(me, { fontWeight: "bold", fontSize: ".75rem", children: "B" }), e[2] = R) : R = e[2];
175
+ let c;
176
+ e[3] !== h || e[4] !== C ? (c = /* @__PURE__ */ n(j, { content: "Bold", children: /* @__PURE__ */ n(F, { "data-active": h, onClick: C, variant: "ghost", "aria-label": "Bold", size: "xs", children: R }) }), e[3] = h, e[4] = C, e[5] = c) : c = e[5];
177
+ const w = m || void 0;
178
+ let v;
179
+ e[6] !== r ? (v = () => r.dispatchCommand(Re, "italic"), e[6] = r, e[7] = v) : v = e[7];
180
+ let S;
181
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(me, { fontStyle: "italic", fontSize: ".75rem", children: "I" }), e[8] = S) : S = e[8];
182
+ let g;
183
+ e[9] !== w || e[10] !== v ? (g = /* @__PURE__ */ n(j, { content: "Italic", children: /* @__PURE__ */ n(F, { "data-active": w, onClick: v, variant: "ghost", "aria-label": "Italic", size: "xs", children: S }) }), e[9] = w, e[10] = v, e[11] = g) : g = e[11];
184
+ const d = L || void 0;
185
+ let i;
186
+ e[12] !== r ? (i = () => r.dispatchCommand(Re, "underline"), e[12] = r, e[13] = i) : i = e[13];
187
+ let s;
188
+ e[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(me, { textDecoration: "underline", fontSize: ".75rem", children: "U" }), e[14] = s) : s = e[14];
189
+ let f;
190
+ e[15] !== d || e[16] !== i ? (f = /* @__PURE__ */ n(j, { content: "Underline", children: /* @__PURE__ */ n(F, { "data-active": d, onClick: i, variant: "ghost", "aria-label": "Underline", size: "xs", children: s }) }), e[15] = d, e[16] = i, e[17] = f) : f = e[17];
191
+ const y = u ? "Remove Link" : "Insert Link", x = u || void 0, T = u ? "Remove Link" : "Insert Link";
192
+ let _;
193
+ e[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(Nt, { size: 14 }), e[18] = _) : _ = e[18];
194
+ let k;
195
+ e[19] !== b || e[20] !== x || e[21] !== T ? (k = /* @__PURE__ */ n(F, { "data-active": x, variant: "ghost", "aria-label": T, size: "xs", onClick: b, children: _ }), e[19] = b, e[20] = x, e[21] = T, e[22] = k) : k = e[22];
196
+ let N;
197
+ e[23] !== y || e[24] !== k ? (N = /* @__PURE__ */ n(j, { content: y, children: k }), e[23] = y, e[24] = k, e[25] = N) : N = e[25];
198
+ let I;
199
+ e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ n(Ie, {}), e[26] = I) : I = e[26];
200
+ const z = o === "h1" || void 0;
201
+ let D;
202
+ e[27] !== a ? (D = () => a("h1"), e[27] = a, e[28] = D) : D = e[28];
203
+ let W;
204
+ e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }), e[29] = W) : W = e[29];
205
+ let O;
206
+ e[30] !== z || e[31] !== D ? (O = /* @__PURE__ */ n(j, { content: "Heading 1", children: /* @__PURE__ */ n(F, { "data-active": z, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: D, children: W }) }), e[30] = z, e[31] = D, e[32] = O) : O = e[32];
207
+ const K = o === "h2" || void 0;
208
+ let M;
209
+ e[33] !== a ? (M = () => a("h2"), e[33] = a, e[34] = M) : M = e[34];
210
+ let V;
211
+ e[35] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }), e[35] = V) : V = e[35];
212
+ let P;
213
+ e[36] !== K || e[37] !== M ? (P = /* @__PURE__ */ n(j, { content: "Heading 2", children: /* @__PURE__ */ n(F, { "data-active": K, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: M, children: V }) }), e[36] = K, e[37] = M, e[38] = P) : P = e[38];
214
+ const $ = o === "h3" || void 0;
215
+ let A;
216
+ e[39] !== a ? (A = () => a("h3"), e[39] = a, e[40] = A) : A = e[40];
217
+ let U;
218
+ e[41] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ n(me, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }), e[41] = U) : U = e[41];
219
+ let H;
220
+ e[42] !== $ || e[43] !== A ? (H = /* @__PURE__ */ n(j, { content: "Heading 3", children: /* @__PURE__ */ n(F, { "data-active": $, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: A, children: U }) }), e[42] = $, e[43] = A, e[44] = H) : H = e[44];
221
+ let G;
222
+ e[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ n(Ie, {}), e[45] = G) : G = e[45];
223
+ const J = o === "code" || void 0;
224
+ let Y;
225
+ e[46] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Y = /* @__PURE__ */ n(It, { size: 14 }), e[46] = Y) : Y = e[46];
226
+ let X;
227
+ e[47] !== E || e[48] !== J ? (X = /* @__PURE__ */ n(j, { content: "Code Block", children: /* @__PURE__ */ n(F, { "data-active": J, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: E, children: Y }) }), e[47] = E, e[48] = J, e[49] = X) : X = e[49];
228
+ let re;
229
+ e[50] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (re = /* @__PURE__ */ n(Ie, {}), e[50] = re) : re = e[50];
230
+ const ue = o === "bullet" || void 0;
231
+ let ne;
232
+ e[51] !== p ? (ne = () => p("bullet"), e[51] = p, e[52] = ne) : ne = e[52];
233
+ let ge;
234
+ e[53] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ge = /* @__PURE__ */ n(Pt, { size: 14 }), e[53] = ge) : ge = e[53];
235
+ let se;
236
+ e[54] !== ue || e[55] !== ne ? (se = /* @__PURE__ */ n(j, { content: "Bulleted List", children: /* @__PURE__ */ n(F, { "data-active": ue, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: ne, children: ge }) }), e[54] = ue, e[55] = ne, e[56] = se) : se = e[56];
237
+ const ye = o === "number" || void 0;
238
+ let ae;
239
+ e[57] !== p ? (ae = () => p("number"), e[57] = p, e[58] = ae) : ae = e[58];
240
+ let be;
241
+ e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = /* @__PURE__ */ n(At, { size: 14 }), e[59] = be) : be = e[59];
242
+ let ce;
243
+ e[60] !== ye || e[61] !== ae ? (ce = /* @__PURE__ */ n(j, { content: "Numbered List", children: /* @__PURE__ */ n(F, { "data-active": ye, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: ae, children: be }) }), e[60] = ye, e[61] = ae, e[62] = ce) : ce = e[62];
244
+ const xe = o === "check" || void 0;
245
+ let de;
246
+ e[63] !== p ? (de = () => p("check"), e[63] = p, e[64] = de) : de = e[64];
247
+ let ve;
248
+ e[65] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ve = /* @__PURE__ */ n(Bt, { size: 14 }), e[65] = ve) : ve = e[65];
249
+ let fe;
250
+ e[66] !== xe || e[67] !== de ? (fe = /* @__PURE__ */ n(j, { content: "Check List", children: /* @__PURE__ */ n(F, { "data-active": xe, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: de, children: ve }) }), e[66] = xe, e[67] = de, e[68] = fe) : fe = e[68];
251
+ let Ce;
252
+ return e[69] !== f || e[70] !== N || e[71] !== O || e[72] !== P || e[73] !== c || e[74] !== H || e[75] !== X || e[76] !== se || e[77] !== ce || e[78] !== fe || e[79] !== g ? (Ce = /* @__PURE__ */ ie(Pe, { direction: "row", gap: "0.5", alignItems: "center", children: [
253
+ c,
254
+ g,
255
+ f,
256
+ N,
257
+ I,
258
+ O,
259
+ P,
260
+ H,
261
+ G,
262
+ X,
263
+ re,
264
+ se,
265
+ ce,
266
+ fe
267
+ ] }), e[69] = f, e[70] = N, e[71] = O, e[72] = P, e[73] = c, e[74] = H, e[75] = X, e[76] = se, e[77] = ce, e[78] = fe, e[79] = g, e[80] = Ce) : Ce = e[80], Ce;
142
268
  }
143
- const Tt = {
269
+ const on = {
144
270
  bullet: "Bulleted List",
145
271
  check: "Check List",
146
272
  code: "Code Block",
@@ -153,171 +279,143 @@ const Tt = {
153
279
  number: "Numbered List",
154
280
  paragraph: "Normal",
155
281
  quote: "Quote"
156
- }, yt = (o) => o in Tt ? o : null, _t = (o) => (o.getKey() === "root" ? o : me(o, (i) => {
157
- const n = i.getParent();
158
- return n !== null && Ye(n);
159
- })) ?? o.getTopLevelElementOrThrow(), St = (o) => {
160
- const e = _t(o);
161
- if (ae(e))
282
+ }, ln = (t) => t in on ? t : null, rn = (t) => (t.getKey() === "root" ? t : Z(t, (r) => {
283
+ const o = r.getParent();
284
+ return o !== null && St(o);
285
+ })) ?? t.getTopLevelElementOrThrow(), sn = (t) => {
286
+ const e = rn(t);
287
+ if (we(e))
162
288
  return e.getListType();
163
- const i = me(o, (s) => ae(s));
164
- if (i !== null && ae(i))
165
- return i.getListType();
166
- const n = ct(e) ? e.getTag() : e.getType();
167
- return yt(n);
289
+ const r = Z(t, (l) => we(l));
290
+ if (r !== null && we(r))
291
+ return r.getListType();
292
+ const o = jt(e) ? e.getTag() : e.getType();
293
+ return ln(o);
168
294
  };
169
- function Rt(o) {
295
+ function an(t) {
170
296
  const {
171
297
  hasSelection: e,
172
- isRangeSelection: i,
173
- isCollapsed: n,
174
- hasNativeSelection: s,
175
- hasNativeRange: a,
176
- isAnchorInsideEditor: m,
177
- isEditorEditable: d
178
- } = o;
179
- return e && i && !n && s && a && m && d;
180
- }
181
- const wt = -4;
182
- function ce() {
183
- const o = ee(1);
184
- let e;
185
- return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("span", { style: {
186
- display: "inline-flex",
187
- height: "1rem",
188
- margin: "0 0.25rem",
189
- borderLeft: "1px solid var(--chakra-colors-border-muted)"
190
- } }), o[0] = e) : e = o[0], e;
298
+ isRangeSelection: r,
299
+ isCollapsed: o,
300
+ hasNativeSelection: l,
301
+ hasNativeRange: m,
302
+ isAnchorInsideEditor: L,
303
+ isEditorEditable: u
304
+ } = t;
305
+ return e && r && !o && l && m && L && u;
191
306
  }
192
- function kt({
193
- editor: o,
307
+ const cn = -4;
308
+ function dn({
309
+ editor: t,
194
310
  anchorElem: e,
195
- isToolbarActive: i,
196
- setIsToolbarActive: n
311
+ isToolbarActive: r,
312
+ setIsToolbarActive: o
197
313
  }) {
198
- const s = te(null), [a, m] = H("paragraph"), [d, c] = H(!1), [v, C] = H(!1), [L, f] = H(!1), u = te(() => {
199
- }), R = (l) => {
200
- o.update(() => {
201
- const r = J();
202
- if (Y(r)) {
203
- if (a === l) {
204
- ne(r, ue);
314
+ const l = oe(null), [m, L] = B("paragraph"), [u, a] = B(!1), [p, E] = B(!1), [b, h] = B(!1), [C, R] = B(!1), c = oe(() => {
315
+ }), w = (i) => {
316
+ t.update(() => {
317
+ const s = ee();
318
+ if (Q(s)) {
319
+ if (m === i) {
320
+ _e(s, Fe);
205
321
  return;
206
322
  }
207
- ne(r, () => dt(l));
323
+ _e(s, () => Kt(i));
208
324
  }
209
325
  });
210
- }, T = (l) => {
211
- if (a === l) {
212
- o.dispatchCommand(lt, void 0);
326
+ }, v = (i) => {
327
+ if (m === i) {
328
+ t.dispatchCommand(Ot, void 0);
213
329
  return;
214
330
  }
215
- const r = {
216
- bullet: st,
217
- number: at,
218
- check: rt
219
- }[l];
220
- o.dispatchCommand(r, void 0);
221
- }, I = () => {
222
- o.update(() => {
223
- const l = J();
224
- if (Y(l)) {
225
- if (a === "code") {
226
- ne(l, ue);
331
+ const s = {
332
+ bullet: Ft,
333
+ number: Ht,
334
+ check: Ut
335
+ }[i];
336
+ t.dispatchCommand(s, void 0);
337
+ }, S = () => {
338
+ t.update(() => {
339
+ const i = ee();
340
+ if (Q(i)) {
341
+ if (m === "code") {
342
+ _e(i, Fe);
227
343
  return;
228
344
  }
229
- ne(l, () => Ge());
345
+ _e(i, () => Lt());
230
346
  }
231
347
  });
232
- }, E = () => {
233
- const l = J();
234
- if (!Y(l)) return;
235
- c(l.hasFormat("bold")), C(l.hasFormat("italic")), f(l.hasFormat("underline"));
236
- const r = St(l.anchor.getNode());
237
- r && m(r);
348
+ }, g = () => {
349
+ if (C) {
350
+ t.dispatchCommand(ze, null);
351
+ return;
352
+ }
353
+ t.dispatchCommand(Ke, !0);
354
+ }, d = () => {
355
+ const i = ee();
356
+ if (!Q(i)) return;
357
+ a(i.hasFormat("bold")), E(i.hasFormat("italic")), h(i.hasFormat("underline"));
358
+ const s = he(i), f = Z(s, le), y = Z(s, pe);
359
+ R(f !== null || y !== null);
360
+ const x = sn(i.anchor.getNode());
361
+ x && L(x);
238
362
  };
239
- return u.current = () => {
240
- const l = J(), r = s.current, y = window.getSelection();
241
- if (r === null)
363
+ return c.current = () => {
364
+ const i = ee(), s = l.current, f = window.getSelection();
365
+ if (s === null)
242
366
  return;
243
- const b = o.getRootElement(), h = y !== null, g = h && y.rangeCount > 0, x = !!b?.contains(h ? y.anchorNode : null);
244
- if (Rt({
245
- hasSelection: l !== null,
246
- isRangeSelection: Y(l),
247
- isCollapsed: Y(l) ? l.isCollapsed() : !1,
248
- hasNativeSelection: h,
249
- hasNativeRange: g,
250
- isAnchorInsideEditor: x,
251
- isEditorEditable: o.isEditable()
252
- }) && y) {
253
- const _ = y.getRangeAt(0).getBoundingClientRect();
254
- if (_) {
255
- const w = new DOMRect(_.left, _.bottom, 0, 0);
256
- pe(w, r, e, wt);
367
+ const y = t.getRootElement(), x = f !== null, T = x && f.rangeCount > 0, _ = !!y?.contains(x ? f.anchorNode : null);
368
+ if (an({
369
+ hasSelection: i !== null,
370
+ isRangeSelection: Q(i),
371
+ isCollapsed: Q(i) ? i.isCollapsed() : !1,
372
+ hasNativeSelection: x,
373
+ hasNativeRange: T,
374
+ isAnchorInsideEditor: _,
375
+ isEditorEditable: t.isEditable()
376
+ }) && f) {
377
+ const k = f.getRangeAt(0).getBoundingClientRect();
378
+ if (k) {
379
+ const N = new DOMRect(k.left, k.bottom, 0, 0);
380
+ ke(N, s, e, cn);
257
381
  }
258
- n(!0);
382
+ o(!0);
259
383
  } else
260
- b !== null && pe(null, r, e), n(!1);
261
- return E(), !0;
262
- }, G(() => {
263
- const l = e.parentElement, r = () => {
264
- o.getEditorState().read(() => {
265
- u.current();
384
+ y !== null && ke(null, s, e), o(!1);
385
+ return d(), !0;
386
+ }, q(() => {
387
+ const i = e.parentElement, s = () => {
388
+ t.getEditorState().read(() => {
389
+ c.current();
266
390
  });
267
391
  };
268
- return window.addEventListener("resize", r), l && l.addEventListener("scroll", r), () => {
269
- window.removeEventListener("resize", r), l && l.removeEventListener("scroll", r);
392
+ return window.addEventListener("resize", s), i && i.addEventListener("scroll", s), () => {
393
+ window.removeEventListener("resize", s), i && i.removeEventListener("scroll", s);
270
394
  };
271
- }, [e, o]), G(() => Ie(o.registerUpdateListener(({
272
- editorState: l
395
+ }, [e, t]), q(() => Le(t.registerUpdateListener(({
396
+ editorState: i
273
397
  }) => {
274
- l.read(() => {
275
- u.current();
398
+ i.read(() => {
399
+ c.current();
276
400
  });
277
- }), o.registerCommand(Me, (l) => (u.current(), !1), Ne), o.registerCommand(Xe, (l) => {
278
- const r = J();
279
- return Y(r) && u.current(), !1;
280
- }, Qe)), [o]), /* @__PURE__ */ t("div", { ref: s, className: `floating-text-format-toolbar ${i ? "active" : ""}`, children: /* @__PURE__ */ ie(We, { direction: "row", gap: "0.5", alignItems: "center", children: [
281
- /* @__PURE__ */ t(D, { content: "Bold", children: /* @__PURE__ */ t($, { "data-active": d || void 0, onClick: () => {
282
- o.dispatchCommand(re, "bold");
283
- }, variant: "ghost", "aria-label": "Bold", size: "xs", children: /* @__PURE__ */ t(Z, { fontWeight: "bold", fontSize: ".75rem", children: "B" }) }) }),
284
- /* @__PURE__ */ t(D, { content: "Italic", children: /* @__PURE__ */ t($, { "data-active": v || void 0, onClick: () => {
285
- o.dispatchCommand(re, "italic");
286
- }, variant: "ghost", "aria-label": "Italic", size: "xs", children: /* @__PURE__ */ t(Z, { fontStyle: "italic", fontSize: ".75rem", children: "I" }) }) }),
287
- /* @__PURE__ */ t(D, { content: "Underline", children: /* @__PURE__ */ t($, { "data-active": L || void 0, onClick: () => {
288
- o.dispatchCommand(re, "underline");
289
- }, variant: "ghost", "aria-label": "Underline", size: "xs", children: /* @__PURE__ */ t(Z, { textDecoration: "underline", fontSize: ".75rem", children: "U" }) }) }),
290
- /* @__PURE__ */ t(ce, {}),
291
- /* @__PURE__ */ t(D, { content: "Heading 1", children: /* @__PURE__ */ t($, { "data-active": a === "h1" || void 0, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: () => {
292
- R("h1");
293
- }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }) }) }),
294
- /* @__PURE__ */ t(D, { content: "Heading 2", children: /* @__PURE__ */ t($, { "data-active": a === "h2" || void 0, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: () => {
295
- R("h2");
296
- }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }) }) }),
297
- /* @__PURE__ */ t(D, { content: "Heading 3", children: /* @__PURE__ */ t($, { "data-active": a === "h3" || void 0, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: () => {
298
- R("h3");
299
- }, children: /* @__PURE__ */ t(Z, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }) }) }),
300
- /* @__PURE__ */ t(ce, {}),
301
- /* @__PURE__ */ t(D, { content: "Code Block", children: /* @__PURE__ */ t($, { "data-active": a === "code" || void 0, variant: "ghost", "aria-label": "Code Block", size: "xs", onClick: I, children: /* @__PURE__ */ t(tt, { size: 14 }) }) }),
302
- /* @__PURE__ */ t(ce, {}),
303
- /* @__PURE__ */ t(D, { content: "Bulleted List", children: /* @__PURE__ */ t($, { "data-active": a === "bullet" || void 0, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: () => T("bullet"), children: /* @__PURE__ */ t(ot, { size: 14 }) }) }),
304
- /* @__PURE__ */ t(D, { content: "Numbered List", children: /* @__PURE__ */ t($, { "data-active": a === "number" || void 0, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: () => T("number"), children: /* @__PURE__ */ t(nt, { size: 14 }) }) }),
305
- /* @__PURE__ */ t(D, { content: "Check List", children: /* @__PURE__ */ t($, { "data-active": a === "check" || void 0, variant: "ghost", "aria-label": "Check List", size: "xs", onClick: () => T("check"), children: /* @__PURE__ */ t(it, { size: 14 }) }) })
306
- ] }) });
307
- }
308
- function Ae(o) {
309
- const e = ee(7), {
310
- anchorElem: i
311
- } = o, n = i === void 0 ? document.body : i, [s] = Le(), [a, m] = H(!1);
312
- let d;
313
- e[0] !== n || e[1] !== s || e[2] !== a ? (d = /* @__PURE__ */ t(kt, { editor: s, anchorElem: n, isToolbarActive: a, setIsToolbarActive: m }), e[0] = n, e[1] = s, e[2] = a, e[3] = d) : d = e[3];
314
- let c;
315
- return e[4] !== n || e[5] !== d ? (c = Pe(d, n), e[4] = n, e[5] = d, e[6] = c) : c = e[6], c;
401
+ }), t.registerCommand(Se, (i) => (c.current(), !1), Oe), t.registerCommand(it, (i) => {
402
+ const s = ee();
403
+ return Q(s) && c.current(), !1;
404
+ }, lt)), [t]), /* @__PURE__ */ n("div", { ref: l, className: `floating-text-format-toolbar ${r ? "active" : ""}`, children: /* @__PURE__ */ n(nn, { editor: t, blockType: m, isBold: u, isItalic: p, isUnderline: b, isLink: C, formatHeading: w, formatList: v, formatCodeBlock: S, insertLink: g }) });
316
405
  }
317
- function Lt() {
318
- const o = ee(1);
406
+ function at(t) {
407
+ const e = te(7), {
408
+ anchorElem: r
409
+ } = t, o = r === void 0 ? document.body : r, [l] = De(), [m, L] = B(!1);
410
+ let u;
411
+ e[0] !== o || e[1] !== l || e[2] !== m ? (u = /* @__PURE__ */ n(dn, { editor: l, anchorElem: o, isToolbarActive: m, setIsToolbarActive: L }), e[0] = o, e[1] = l, e[2] = m, e[3] = u) : u = e[3];
412
+ let a;
413
+ return e[4] !== o || e[5] !== u ? (a = Ue(u, o), e[4] = o, e[5] = u, e[6] = a) : a = e[6], a;
414
+ }
415
+ function fn() {
416
+ const t = te(1);
319
417
  let e;
320
- return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("style", { children: `
418
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n("style", { children: `
321
419
  .collaboration-cursor-container {
322
420
  position: relative;
323
421
  display: inline;
@@ -351,185 +449,411 @@ function Lt() {
351
449
  pointer-events: none;
352
450
  opacity: 0.25;
353
451
  }
354
- ` }), o[0] = e) : e = o[0], e;
355
- }
356
- function mo(o) {
357
- const e = ee(42), {
358
- roomId: i,
359
- wsUrl: n,
360
- wsParams: s,
361
- userName: a,
362
- userColor: m,
363
- placeholder: d
364
- } = o;
365
- let c;
366
- e[0] !== s ? (c = s === void 0 ? {} : s, e[0] = s, e[1] = c) : c = e[1];
367
- const v = c, C = a === void 0 ? "Anonymous" : a, L = m === void 0 ? "#30bced" : m, f = te(null), [u, R] = H(null), [T, I] = H(!1), [E] = H(Mt);
368
- let l;
369
- e[2] !== E || e[3] !== i || e[4] !== v || e[5] !== n ? (l = () => {
370
- const q = new qe(n, i, E, {
371
- params: v,
452
+ ` }), t[0] = e) : e = t[0], e;
453
+ }
454
+ function oo(t) {
455
+ const e = te(42), {
456
+ roomId: r,
457
+ wsUrl: o,
458
+ wsParams: l,
459
+ userName: m,
460
+ userColor: L,
461
+ placeholder: u
462
+ } = t;
463
+ let a;
464
+ e[0] !== l ? (a = l === void 0 ? {} : l, e[0] = l, e[1] = a) : a = e[1];
465
+ const p = a, E = m === void 0 ? "Anonymous" : m, b = L === void 0 ? "#30bced" : L, h = oe(null), [C, R] = B(null), [c, w] = B(!1), [v] = B(un);
466
+ let S;
467
+ e[2] !== v || e[3] !== r || e[4] !== p || e[5] !== o ? (S = () => {
468
+ const H = new Et(o, r, v, {
469
+ params: p,
372
470
  connect: !1
373
471
  });
374
- return q.on("sync", (V) => {
375
- V && I(!0);
376
- }), q;
377
- }, e[2] = E, e[3] = i, e[4] = v, e[5] = n, e[6] = l) : l = e[6];
378
- const [r] = H(l);
379
- let y, b;
380
- e[7] !== r ? (y = () => (r.connect(), () => {
381
- r.disconnect();
382
- }), b = [r], e[7] = r, e[8] = y, e[9] = b) : (y = e[8], b = e[9]), G(y, b);
383
- let h, g;
384
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => {
385
- R(f.current);
386
- }, g = [], e[10] = h, e[11] = g) : (h = e[10], g = e[11]), G(h, g);
387
- let x;
388
- e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = {
472
+ return H.on("sync", (G) => {
473
+ G && w(!0);
474
+ }), H;
475
+ }, e[2] = v, e[3] = r, e[4] = p, e[5] = o, e[6] = S) : S = e[6];
476
+ const [g] = B(S);
477
+ let d, i;
478
+ e[7] !== g ? (d = () => (g.connect(), () => {
479
+ g.disconnect();
480
+ }), i = [g], e[7] = g, e[8] = d, e[9] = i) : (d = e[8], i = e[9]), q(d, i);
481
+ let s, f;
482
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = () => {
483
+ R(h.current);
484
+ }, f = [], e[10] = s, e[11] = f) : (s = e[10], f = e[11]), q(s, f);
485
+ let y;
486
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
389
487
  namespace: "COLLABORATIVE_EDITOR",
390
- nodes: ge,
488
+ nodes: Ve,
391
489
  editorState: null,
392
- onError: It,
490
+ onError: mn,
393
491
  editable: !0,
394
- theme: he
395
- }, e[12] = x) : x = e[12];
396
- const _ = x;
397
- let w;
398
- e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ t(Lt, {}), e[13] = w) : w = e[13];
399
- const p = r;
400
- let S;
401
- e[14] !== E || e[15] !== i || e[16] !== p || e[17] !== L || e[18] !== C ? (S = /* @__PURE__ */ t(Ke, { id: i, doc: E, provider: p, __shouldBootstrapUnsafe: !1, username: C, cursorColor: L }), e[14] = E, e[15] = i, e[16] = p, e[17] = L, e[18] = C, e[19] = S) : S = e[19];
402
- let k, N, M, j, W, U;
403
- e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ t(Se, {}), N = /* @__PURE__ */ t(Re, {}), M = /* @__PURE__ */ t(ke, { maxIndent: 7 }), j = /* @__PURE__ */ t(_e, {}), W = /* @__PURE__ */ t(ve, {}), U = /* @__PURE__ */ t(Ce, {}), e[20] = k, e[21] = N, e[22] = M, e[23] = j, e[24] = W, e[25] = U) : (k = e[20], N = e[21], M = e[22], j = e[23], W = e[24], U = e[25]);
404
- let z;
405
- e[26] !== u ? (z = /* @__PURE__ */ t(Be, { anchorElem: u }), e[26] = u, e[27] = z) : z = e[27];
406
- let O;
407
- e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ t(be, {}), e[28] = O) : O = e[28];
492
+ theme: We
493
+ }, e[12] = y) : y = e[12];
494
+ const x = y;
495
+ let T;
496
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(fn, {}), e[13] = T) : T = e[13];
497
+ const _ = g;
498
+ let k;
499
+ e[14] !== v || e[15] !== r || e[16] !== _ || e[17] !== b || e[18] !== E ? (k = /* @__PURE__ */ n(Ct, { id: r, doc: v, provider: _, __shouldBootstrapUnsafe: !1, username: E, cursorColor: b }), e[14] = v, e[15] = r, e[16] = _, e[17] = b, e[18] = E, e[19] = k) : k = e[19];
500
+ let N, I, z, D, W, O;
501
+ e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(et, {}), I = /* @__PURE__ */ n(tt, {}), z = /* @__PURE__ */ n(ot, { maxIndent: 7 }), D = /* @__PURE__ */ n(Je, {}), W = /* @__PURE__ */ n(Ge, {}), O = /* @__PURE__ */ n(qe, {}), e[20] = N, e[21] = I, e[22] = z, e[23] = D, e[24] = W, e[25] = O) : (N = e[20], I = e[21], z = e[22], D = e[23], W = e[24], O = e[25]);
408
502
  let K;
409
- e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(xe, { fullWidth: !1 }), e[29] = K) : K = e[29];
503
+ e[26] !== C ? (K = /* @__PURE__ */ n(st, { anchorElem: C }), e[26] = C, e[27] = K) : K = e[27];
504
+ let M;
505
+ e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(Ye, {}), e[28] = M) : M = e[28];
506
+ let V;
507
+ e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(Xe, { fullWidth: !1 }), e[29] = V) : V = e[29];
410
508
  let P;
411
- e[30] !== d || e[31] !== T ? (P = T && d ? /* @__PURE__ */ t(Ee, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: d }) : null, e[30] = d, e[31] = T, e[32] = P) : P = e[32];
412
- let B;
413
- e[33] !== P ? (B = /* @__PURE__ */ t(we, { contentEditable: K, placeholder: P, ErrorBoundary: ye }), e[33] = P, e[34] = B) : B = e[34];
509
+ e[30] !== u || e[31] !== c ? (P = c && u ? /* @__PURE__ */ n($e, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: u }) : null, e[30] = u, e[31] = c, e[32] = P) : P = e[32];
510
+ let $;
511
+ e[33] !== P ? ($ = /* @__PURE__ */ n(nt, { contentEditable: V, placeholder: P, ErrorBoundary: Ze }), e[33] = P, e[34] = $) : $ = e[34];
414
512
  let A;
415
- e[35] !== u ? (A = u ? /* @__PURE__ */ t(Ae, { anchorElem: u }) : null, e[35] = u, e[36] = A) : A = e[36];
416
- let F;
417
- return e[37] !== S || e[38] !== z || e[39] !== B || e[40] !== A ? (F = /* @__PURE__ */ ie(de, { ref: f, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
418
- w,
419
- /* @__PURE__ */ t(Te, { initialConfig: _, children: /* @__PURE__ */ ie(Ue, { children: [
420
- S,
513
+ e[35] !== C ? (A = C ? /* @__PURE__ */ n(at, { anchorElem: C }) : null, e[35] = C, e[36] = A) : A = e[36];
514
+ let U;
515
+ return e[37] !== k || e[38] !== K || e[39] !== $ || e[40] !== A ? (U = /* @__PURE__ */ ie(Ae, { ref: h, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
516
+ T,
517
+ /* @__PURE__ */ n(Qe, { initialConfig: x, children: /* @__PURE__ */ ie(vt, { children: [
421
518
  k,
422
519
  N,
423
- M,
424
- j,
425
- W,
426
- U,
520
+ I,
427
521
  z,
522
+ D,
523
+ W,
428
524
  O,
429
- B,
525
+ K,
526
+ M,
527
+ $,
430
528
  A
431
529
  ] }) })
432
- ] }), e[37] = S, e[38] = z, e[39] = B, e[40] = A, e[41] = F) : F = e[41], F;
433
- }
434
- function It(o) {
435
- return console.error(o);
436
- }
437
- function Mt() {
438
- return new Ve.Doc();
439
- }
440
- function fo(o) {
441
- const e = ee(54), {
442
- autoFocus: i,
443
- debug: n,
444
- defaultState: s,
445
- isEditable: a,
446
- placeholder: m,
447
- scrollable: d,
448
- onChange: c
449
- } = o, v = i === void 0 ? !1 : i, C = n === void 0 ? !1 : n, L = s === void 0 ? "" : s, f = a === void 0 ? !1 : a, u = d === void 0 ? !0 : d;
530
+ ] }), e[37] = k, e[38] = K, e[39] = $, e[40] = A, e[41] = U) : U = e[41], U;
531
+ }
532
+ function mn(t) {
533
+ return console.error(t);
534
+ }
535
+ function un() {
536
+ return new kt.Doc();
537
+ }
538
+ function pn(t) {
539
+ const e = te(32), {
540
+ isActive: r,
541
+ isLinkEditMode: o,
542
+ editedLinkUrl: l,
543
+ editedLinkUrlIsValid: m,
544
+ linkUrl: L,
545
+ href: u,
546
+ inputRef: a,
547
+ onEditedLinkUrlChange: p,
548
+ onInputKeyDown: E,
549
+ onClose: b,
550
+ onSubmit: h,
551
+ onEdit: C,
552
+ onRemove: R
553
+ } = t;
554
+ if (!r)
555
+ return null;
556
+ if (o) {
557
+ const i = !m;
558
+ let s;
559
+ e[0] !== p ? (s = (I) => {
560
+ p(I.target.value);
561
+ }, e[0] = p, e[1] = s) : s = e[1];
562
+ let f;
563
+ e[2] !== l || e[3] !== a || e[4] !== E || e[5] !== i || e[6] !== s ? (f = /* @__PURE__ */ n(gt, { ref: a, className: "link-editor-url-field", size: "sm", fontSize: "sm", value: l, placeholder: "https://", "aria-label": "Link URL", "aria-invalid": i, onChange: s, onKeyDown: E }), e[2] = l, e[3] = a, e[4] = E, e[5] = i, e[6] = s, e[7] = f) : f = e[7];
564
+ let y;
565
+ e[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(zt, { size: 14 }), e[8] = y) : y = e[8];
566
+ let x;
567
+ e[9] !== b ? (x = /* @__PURE__ */ n(j, { content: "Cancel", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Cancel link edit", onMouseDown: Ee, onClick: b, children: y }) }), e[9] = b, e[10] = x) : x = e[10];
568
+ const T = !m;
569
+ let _;
570
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(rt, { size: 14 }), e[11] = _) : _ = e[11];
571
+ let k;
572
+ e[12] !== h || e[13] !== T ? (k = /* @__PURE__ */ n(j, { content: "Confirm", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Confirm link edit", disabled: T, onMouseDown: Ee, onClick: h, children: _ }) }), e[12] = h, e[13] = T, e[14] = k) : k = e[14];
573
+ let N;
574
+ return e[15] !== f || e[16] !== x || e[17] !== k ? (N = /* @__PURE__ */ ie(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
575
+ f,
576
+ x,
577
+ k
578
+ ] }), e[15] = f, e[16] = x, e[17] = k, e[18] = N) : N = e[18], N;
579
+ }
580
+ let c;
581
+ e[19] !== u || e[20] !== L ? (c = /* @__PURE__ */ n(bt, { href: u, target: "_blank", rel: "noopener noreferrer", className: "link-editor-url-field", fontSize: "sm", textDecoration: "underline", px: "2", truncate: !0, children: L }), e[19] = u, e[20] = L, e[21] = c) : c = e[21];
582
+ let w;
583
+ e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(Mt, { size: 14 }), e[22] = w) : w = e[22];
584
+ let v;
585
+ e[23] !== C ? (v = /* @__PURE__ */ n(j, { content: "Edit link", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Edit link", onMouseDown: Ee, onClick: C, children: w }) }), e[23] = C, e[24] = v) : v = e[24];
586
+ let S;
587
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n($t, { size: 14 }), e[25] = S) : S = e[25];
588
+ let g;
589
+ e[26] !== R ? (g = /* @__PURE__ */ n(j, { content: "Remove link", children: /* @__PURE__ */ n(F, { variant: "ghost", size: "xs", "aria-label": "Remove link", onMouseDown: Ee, onClick: R, children: S }) }), e[26] = R, e[27] = g) : g = e[27];
590
+ let d;
591
+ return e[28] !== c || e[29] !== v || e[30] !== g ? (d = /* @__PURE__ */ ie(Pe, { className: "link-editor-content", direction: "row", gap: "1", alignItems: "center", p: "1", children: [
592
+ c,
593
+ v,
594
+ g
595
+ ] }), e[28] = c, e[29] = v, e[30] = g, e[31] = d) : d = e[31], d;
596
+ }
597
+ function Ee(t) {
598
+ t.preventDefault();
599
+ }
600
+ function hn(t, e, r) {
601
+ return t && e && r === "";
602
+ }
603
+ function gn(t) {
604
+ const e = he(t), r = Z(e, le);
605
+ return r ? r.getURL() : le(e) ? e.getURL() : "";
606
+ }
607
+ const ct = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
608
+ function Me(t) {
609
+ try {
610
+ const e = new URL(t);
611
+ if (!ct.has(e.protocol))
612
+ return "about:blank";
613
+ } catch {
614
+ return t;
615
+ }
616
+ return t;
617
+ }
618
+ function dt(t) {
619
+ try {
620
+ const e = new URL(t);
621
+ return ct.has(e.protocol) ? e.protocol === "http:" || e.protocol === "https:" ? e.hostname !== "" : e.pathname.trim() !== "" : !1;
622
+ } catch {
623
+ return !1;
624
+ }
625
+ }
626
+ const bn = 8;
627
+ function vn({
628
+ editor: t,
629
+ isLink: e,
630
+ setIsLink: r,
631
+ anchorElem: o,
632
+ isLinkEditMode: l,
633
+ setIsLinkEditMode: m
634
+ }) {
635
+ const L = oe(null), u = oe(null), a = oe(() => {
636
+ }), [p, E] = B(""), [b, h] = B("https://"), [C, R] = B(null), c = e || l, w = dt(b);
637
+ a.current = () => {
638
+ const d = ee();
639
+ if (Q(d)) {
640
+ const T = gn(d);
641
+ E(T), hn(l, e, T) && S(), l && T !== "" && h(T);
642
+ }
643
+ const i = L.current, s = window.getSelection(), f = document.activeElement;
644
+ if (i === null)
645
+ return;
646
+ const y = t.getRootElement(), x = s !== null && s.rangeCount > 0;
647
+ if (d !== null && s !== null && x && y?.contains(s.anchorNode) && t.isEditable()) {
648
+ const T = s.getRangeAt(0).getBoundingClientRect(), _ = new DOMRect(T.left, T.top, 0, T.height);
649
+ ke(_, i, o, bn, void 0, "above"), R(d);
650
+ } else i.contains(f) || (y !== null && ke(null, i, o), R(null), m(!1), E(""));
651
+ }, q(() => {
652
+ const d = o.parentElement, i = () => {
653
+ t.getEditorState().read(() => {
654
+ a.current();
655
+ });
656
+ };
657
+ return window.addEventListener("resize", i), d && d.addEventListener("scroll", i), () => {
658
+ window.removeEventListener("resize", i), d && d.removeEventListener("scroll", i);
659
+ };
660
+ }, [o.parentElement, t]), q(() => Le(t.registerUpdateListener(({
661
+ editorState: d
662
+ }) => {
663
+ d.read(() => {
664
+ a.current();
665
+ });
666
+ }), t.registerCommand(Se, () => (a.current(), !0), Be), t.registerCommand(yt, () => e ? (r(!1), !0) : !1, lt)), [t, r, e]), q(() => {
667
+ t.getEditorState().read(() => {
668
+ a.current();
669
+ });
670
+ }, [t]), _t(() => {
671
+ c && t.getEditorState().read(() => {
672
+ a.current();
673
+ });
674
+ }, [t, c]), q(() => {
675
+ l && u.current && u.current.focus();
676
+ }, [l]);
677
+ const v = (d) => {
678
+ d.key === "Enter" ? (d.preventDefault(), g()) : d.key === "Escape" && (d.preventDefault(), S());
679
+ }, S = () => {
680
+ h("https://"), m(!1);
681
+ }, g = () => {
682
+ C === null || !w || (t.update(() => {
683
+ Tt(C);
684
+ }), t.dispatchCommand(ze, Me(b)), t.update(() => {
685
+ const d = ee();
686
+ if (Q(d)) {
687
+ const i = he(d).getParent();
688
+ if (pe(i)) {
689
+ const s = Dt(i.getURL(), {
690
+ rel: i.__rel,
691
+ target: i.__target,
692
+ title: i.__title
693
+ });
694
+ i.replace(s, !0);
695
+ }
696
+ }
697
+ }), S());
698
+ };
699
+ return /* @__PURE__ */ n($e, { ref: L, className: `link-editor ${c ? "active" : ""}`, children: /* @__PURE__ */ n(pn, { isActive: c, isLinkEditMode: l, editedLinkUrl: b, editedLinkUrlIsValid: w, linkUrl: p, href: Me(p), inputRef: u, onEditedLinkUrlChange: h, onInputKeyDown: v, onClose: S, onSubmit: g, onEdit: () => {
700
+ h(p), m(!0);
701
+ }, onRemove: () => {
702
+ t.dispatchCommand(ze, null);
703
+ } }) });
704
+ }
705
+ function Cn(t, e, r, o) {
706
+ const l = te(13), [m, L] = B(t), [u, a] = B(!1);
707
+ let p, E;
708
+ l[0] !== t || l[1] !== o ? (p = () => {
709
+ const C = function() {
710
+ const c = ee();
711
+ if (Q(c)) {
712
+ const w = he(c), v = Z(w, le), S = Z(w, pe);
713
+ if (!(v || S)) {
714
+ a(!1);
715
+ return;
716
+ }
717
+ const g = c.getNodes().filter(En).find((d) => {
718
+ const i = Z(d, le), s = Z(d, pe), f = pe(s) && s.getIsUnlinked();
719
+ return v && !v.is(i) || i && !i.is(v) || S && !S.is(s) || s && (!s.is(S) || f);
720
+ });
721
+ a(!g);
722
+ }
723
+ };
724
+ return Le(t.registerUpdateListener((R) => {
725
+ const {
726
+ editorState: c
727
+ } = R;
728
+ c.read(() => {
729
+ C();
730
+ });
731
+ }), t.registerCommand(Se, (R, c) => (C(), L(c), !1), Oe), t.registerCommand(it, _n, Be), t.registerCommand(Ke, (R) => (o(R), !0), Be));
732
+ }, E = [t, o], l[0] = t, l[1] = o, l[2] = p, l[3] = E) : (p = l[2], E = l[3]), q(p, E);
733
+ let b;
734
+ l[4] !== m || l[5] !== e || l[6] !== u || l[7] !== r || l[8] !== o ? (b = /* @__PURE__ */ n(vn, { editor: m, isLink: u, anchorElem: e, setIsLink: a, isLinkEditMode: r, setIsLinkEditMode: o }), l[4] = m, l[5] = e, l[6] = u, l[7] = r, l[8] = o, l[9] = b) : b = l[9];
735
+ let h;
736
+ return l[10] !== e || l[11] !== b ? (h = Ue(b, e), l[10] = e, l[11] = b, l[12] = h) : h = l[12], h;
737
+ }
738
+ function _n(t) {
739
+ const e = ee();
740
+ if (Q(e)) {
741
+ const r = he(e), o = Z(r, le);
742
+ if (le(o) && (t.metaKey || t.ctrlKey))
743
+ return window.open(Me(o.getURL()), "_blank", "noopener,noreferrer"), !0;
744
+ }
745
+ return !1;
746
+ }
747
+ function En(t) {
748
+ return !xt(t);
749
+ }
750
+ function kn(t) {
751
+ const {
752
+ anchorElem: e
753
+ } = t, r = e === void 0 ? document.body : e, [o, l] = B(!1), [m] = De();
754
+ return Cn(m, r, o, l);
755
+ }
756
+ function Ln() {
757
+ const t = te(1);
758
+ let e;
759
+ return t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(et, { validateUrl: dt }), t[0] = e) : e = t[0], e;
760
+ }
761
+ function io(t) {
762
+ const e = te(54), {
763
+ autoFocus: r,
764
+ debug: o,
765
+ defaultState: l,
766
+ isEditable: m,
767
+ placeholder: L,
768
+ scrollable: u,
769
+ onChange: a
770
+ } = t, p = r === void 0 ? !1 : r, E = o === void 0 ? !1 : o, b = l === void 0 ? "" : l, h = m === void 0 ? !1 : m, C = u === void 0 ? !0 : u;
450
771
  let R;
451
- e[0] !== L ? (R = Fe(L), e[0] = L, e[1] = R) : R = e[1];
772
+ e[0] !== b ? (R = mt(b), e[0] = b, e[1] = R) : R = e[1];
452
773
  const {
453
- frontmatter: T,
454
- body: I
455
- } = R, E = f && !!c, l = te(null), [r, y] = H(null);
456
- let b, h;
457
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = () => {
458
- y(l.current);
459
- }, h = [], e[2] = b, e[3] = h) : (b = e[2], h = e[3]), G(b, h);
460
- let g;
461
- e[4] !== I ? (g = () => mt($e(I), fe, void 0, !1), e[4] = I, e[5] = g) : g = e[5];
462
- let x;
463
- e[6] !== f || e[7] !== g ? (x = {
774
+ frontmatter: c,
775
+ body: w
776
+ } = R, v = h && !!a, S = oe(null), [g, d] = B(null);
777
+ let i, s;
778
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = () => {
779
+ d(S.current);
780
+ }, s = [], e[2] = i, e[3] = s) : (i = e[2], s = e[3]), q(i, s);
781
+ let f;
782
+ e[4] !== w ? (f = () => Wt(ut(w), He, void 0, !1), e[4] = w, e[5] = f) : f = e[5];
783
+ let y;
784
+ e[6] !== h || e[7] !== f ? (y = {
464
785
  namespace: "MARKDOWN_EDITOR",
465
- nodes: ge,
466
- editorState: g,
467
- onError: Nt,
468
- editable: f,
469
- theme: he
470
- }, e[6] = f, e[7] = g, e[8] = x) : x = e[8];
471
- const _ = x, w = u ? "100%" : "auto";
472
- let p;
473
- e[9] !== v ? (p = v ? /* @__PURE__ */ t(ut, {}) : null, e[9] = v, e[10] = p) : p = e[10];
474
- let S, k, N;
475
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ t(ht, {}), k = /* @__PURE__ */ t(Se, {}), N = /* @__PURE__ */ t(Re, {}), e[11] = S, e[12] = k, e[13] = N) : (S = e[11], k = e[12], N = e[13]);
786
+ nodes: Ve,
787
+ editorState: f,
788
+ onError: Sn,
789
+ editable: h,
790
+ theme: We
791
+ }, e[6] = h, e[7] = f, e[8] = y) : y = e[8];
792
+ const x = y, T = C ? "100%" : "auto";
793
+ let _;
794
+ e[9] !== p ? (_ = p ? /* @__PURE__ */ n(Gt, {}) : null, e[9] = p, e[10] = _) : _ = e[10];
795
+ let k, N, I;
796
+ e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(Yt, {}), N = /* @__PURE__ */ n(Ln, {}), I = /* @__PURE__ */ n(tt, {}), e[11] = k, e[12] = N, e[13] = I) : (k = e[11], N = e[12], I = e[13]);
797
+ let z;
798
+ e[14] !== h ? (z = h ? /* @__PURE__ */ n(ot, { maxIndent: 7 }) : null, e[14] = h, e[15] = z) : z = e[15];
799
+ let D, W, O, K;
800
+ e[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ n(qt, {}), W = /* @__PURE__ */ n(Je, {}), O = /* @__PURE__ */ n(Ge, {}), K = /* @__PURE__ */ n(qe, {}), e[16] = D, e[17] = W, e[18] = O, e[19] = K) : (D = e[16], W = e[17], O = e[18], K = e[19]);
476
801
  let M;
477
- e[14] !== f ? (M = f ? /* @__PURE__ */ t(ke, { maxIndent: 7 }) : null, e[14] = f, e[15] = M) : M = e[15];
478
- let j, W, U, z;
479
- e[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ t(pt, {}), W = /* @__PURE__ */ t(_e, {}), U = /* @__PURE__ */ t(ve, {}), z = /* @__PURE__ */ t(Ce, {}), e[16] = j, e[17] = W, e[18] = U, e[19] = z) : (j = e[16], W = e[17], U = e[18], z = e[19]);
480
- let O;
481
- e[20] !== r ? (O = /* @__PURE__ */ t(Be, { anchorElem: r }), e[20] = r, e[21] = O) : O = e[21];
482
- let K;
483
- e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(be, {}), e[22] = K) : K = e[22];
802
+ e[20] !== g ? (M = /* @__PURE__ */ n(st, { anchorElem: g }), e[20] = g, e[21] = M) : M = e[21];
803
+ let V;
804
+ e[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(Ye, {}), e[22] = V) : V = e[22];
484
805
  let P;
485
- e[23] !== u ? (P = /* @__PURE__ */ t(xe, { fullWidth: !1, padding: "sm", scrollable: u }), e[23] = u, e[24] = P) : P = e[24];
486
- let B;
487
- e[25] !== m ? (B = m ? /* @__PURE__ */ t(de, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ t(Ee, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: m }) }) : null, e[25] = m, e[26] = B) : B = e[26];
806
+ e[23] !== C ? (P = /* @__PURE__ */ n(Xe, { fullWidth: !1, padding: "sm", scrollable: C }), e[23] = C, e[24] = P) : P = e[24];
807
+ let $;
808
+ e[25] !== L ? ($ = L ? /* @__PURE__ */ n(Ae, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ n($e, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: L }) }) : null, e[25] = L, e[26] = $) : $ = e[26];
488
809
  let A;
489
- e[27] !== P || e[28] !== B ? (A = /* @__PURE__ */ t(we, { contentEditable: P, placeholder: B, ErrorBoundary: ye }), e[27] = P, e[28] = B, e[29] = A) : A = e[29];
490
- let F;
491
- e[30] !== r || e[31] !== f ? (F = f && r ? /* @__PURE__ */ t(Ae, { anchorElem: r }) : null, e[30] = r, e[31] = f, e[32] = F) : F = e[32];
492
- let q;
493
- e[33] !== T || e[34] !== c || e[35] !== E ? (q = E ? /* @__PURE__ */ t(gt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (He) => {
494
- He.read(() => {
495
- const ze = Ze(), Oe = ft(fe, ze);
496
- c?.(T + Oe);
810
+ e[27] !== P || e[28] !== $ ? (A = /* @__PURE__ */ n(nt, { contentEditable: P, placeholder: $, ErrorBoundary: Ze }), e[27] = P, e[28] = $, e[29] = A) : A = e[29];
811
+ let U;
812
+ e[30] !== g || e[31] !== h ? (U = h && g ? /* @__PURE__ */ ie(ft, { children: [
813
+ /* @__PURE__ */ n(at, { anchorElem: g }),
814
+ /* @__PURE__ */ n(kn, { anchorElem: g })
815
+ ] }) : null, e[30] = g, e[31] = h, e[32] = U) : U = e[32];
816
+ let H;
817
+ e[33] !== c || e[34] !== a || e[35] !== v ? (H = v ? /* @__PURE__ */ n(Xt, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (re) => {
818
+ re.read(() => {
819
+ const ue = Rt(), ne = Vt(He, ue);
820
+ a?.(c + ne);
497
821
  });
498
- } }) : null, e[33] = T, e[34] = c, e[35] = E, e[36] = q) : q = e[36];
499
- let V;
500
- e[37] !== f ? (V = /* @__PURE__ */ t(De, { isEditable: f }), e[37] = f, e[38] = V) : V = e[38];
501
- let X;
502
- e[39] !== C ? (X = C && /* @__PURE__ */ t(je, {}), e[39] = C, e[40] = X) : X = e[40];
503
- let Q;
504
- e[41] !== _ || e[42] !== p || e[43] !== M || e[44] !== O || e[45] !== A || e[46] !== F || e[47] !== q || e[48] !== V || e[49] !== X ? (Q = /* @__PURE__ */ ie(Te, { initialConfig: _, children: [
505
- p,
506
- S,
822
+ } }) : null, e[33] = c, e[34] = a, e[35] = v, e[36] = H) : H = e[36];
823
+ let G;
824
+ e[37] !== h ? (G = /* @__PURE__ */ n(pt, { isEditable: h }), e[37] = h, e[38] = G) : G = e[38];
825
+ let J;
826
+ e[39] !== E ? (J = E && /* @__PURE__ */ n(ht, {}), e[39] = E, e[40] = J) : J = e[40];
827
+ let Y;
828
+ e[41] !== x || e[42] !== _ || e[43] !== z || e[44] !== M || e[45] !== A || e[46] !== U || e[47] !== H || e[48] !== G || e[49] !== J ? (Y = /* @__PURE__ */ ie(Qe, { initialConfig: x, children: [
829
+ _,
507
830
  k,
508
831
  N,
509
- M,
510
- j,
511
- W,
512
- U,
832
+ I,
513
833
  z,
834
+ D,
835
+ W,
514
836
  O,
515
837
  K,
516
- A,
517
- F,
518
- q,
838
+ M,
519
839
  V,
520
- X
521
- ] }), e[41] = _, e[42] = p, e[43] = M, e[44] = O, e[45] = A, e[46] = F, e[47] = q, e[48] = V, e[49] = X, e[50] = Q) : Q = e[50];
522
- let oe;
523
- return e[51] !== w || e[52] !== Q ? (oe = /* @__PURE__ */ t(de, { ref: l, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: w, position: "relative", direction: "column", overflow: "visible", children: Q }), e[51] = w, e[52] = Q, e[53] = oe) : oe = e[53], oe;
840
+ A,
841
+ U,
842
+ H,
843
+ G,
844
+ J
845
+ ] }), e[41] = x, e[42] = _, e[43] = z, e[44] = M, e[45] = A, e[46] = U, e[47] = H, e[48] = G, e[49] = J, e[50] = Y) : Y = e[50];
846
+ let X;
847
+ return e[51] !== T || e[52] !== Y ? (X = /* @__PURE__ */ n(Ae, { ref: S, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: T, position: "relative", direction: "column", overflow: "visible", children: Y }), e[51] = T, e[52] = Y, e[53] = X) : X = e[53], X;
524
848
  }
525
- function Nt(o) {
526
- return console.error(o);
849
+ function Sn(t) {
850
+ return console.error(t);
527
851
  }
528
- function uo(o) {
529
- const e = o.toLowerCase().trim();
852
+ function lo(t) {
853
+ const e = t.toLowerCase().trim();
530
854
  return e ? e.startsWith("image/") ? "image" : e === "application/pdf" ? "pdf" : e === "text/markdown" ? "markdown" : e === "text/csv" || e === "text/tab-separated-values" ? "table" : e === "application/json" ? "json" : (e.startsWith("text/") || e.startsWith("application/"), "text") : "text";
531
855
  }
532
- const Pt = {
856
+ const yn = {
533
857
  csv: "text/csv",
534
858
  tsv: "text/tab-separated-values",
535
859
  json: "application/json",
@@ -553,21 +877,21 @@ const Pt = {
553
877
  yml: "text/yaml",
554
878
  yaml: "text/yaml"
555
879
  };
556
- function po(o) {
557
- const i = (o.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
558
- return i ? Pt[i] ?? null : null;
880
+ function ro(t) {
881
+ const r = (t.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
882
+ return r ? yn[r] ?? null : null;
559
883
  }
560
884
  export {
561
- mo as CollaborativeMarkdownEditor,
562
- vo as DefaultRichTextCodeEditor,
563
- Co as DefaultRichTextDataTable,
564
- fo as MarkdownEditor,
565
- bo as MarkdownPreview,
566
- xo as PromptEditor,
567
- Eo as RichMessage,
568
- To as generateEditorStateFromString,
569
- yo as getTextFromSerializedEditorState,
570
- uo as inferResourceTypeFromMediaType,
571
- po as mediaTypeFromPath
885
+ oo as CollaborativeMarkdownEditor,
886
+ co as DefaultRichTextCodeEditor,
887
+ fo as DefaultRichTextDataTable,
888
+ io as MarkdownEditor,
889
+ mo as MarkdownPreview,
890
+ uo as PromptEditor,
891
+ po as RichMessage,
892
+ ho as generateEditorStateFromString,
893
+ go as getTextFromSerializedEditorState,
894
+ lo as inferResourceTypeFromMediaType,
895
+ ro as mediaTypeFromPath
572
896
  };
573
897
  //# sourceMappingURL=rich-text.js.map