@pstdio/ui 0.3.1 → 0.5.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 (162) hide show
  1. package/dist/MermaidComponent-DwEDwpo2.js +124 -0
  2. package/dist/MermaidComponent-DwEDwpo2.js.map +1 -0
  3. package/dist/chat-ui.js +610 -505
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/attached-panel.d.ts +9 -0
  6. package/dist/components/attached-panel.utils.d.ts +6 -0
  7. package/dist/components/bubble-button.d.ts +10 -0
  8. package/dist/components/bubble-panel.d.ts +18 -0
  9. package/dist/components/chat-ui/components/chat-input-actions.d.ts +10 -0
  10. package/dist/components/chat-ui/components/chat-panel-sticky-user-message.d.ts +1 -1
  11. package/dist/components/chat-ui/components/chat-panel.d.ts +1 -0
  12. package/dist/components/chat-ui/tool-rendering/apply-patch-renderer.d.ts +2 -0
  13. package/dist/components/chat-ui/tool-rendering/default-renderers.d.ts +8 -7
  14. package/dist/components/chat-ui/tool-rendering/edit-renderer.d.ts +2 -0
  15. package/dist/components/chat-ui/tool-rendering/shared.d.ts +52 -0
  16. package/dist/components/chat-ui/tool-rendering/standard-renderers.d.ts +6 -0
  17. package/dist/components/chat-ui/tool-rendering/todo-write-renderer.d.ts +2 -0
  18. package/dist/components/diff-card.d.ts +3 -0
  19. package/dist/components/diff-drawer.d.ts +1 -0
  20. package/dist/components/layout.d.ts +1 -2
  21. package/dist/components/menu-item.d.ts +2 -1
  22. package/dist/components/panel-header.constants.d.ts +1 -0
  23. package/dist/components/resource-context-menu.d.ts +20 -0
  24. package/dist/components/rich-text/markdown-editor/markdown-editor.d.ts +1 -0
  25. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +2 -1
  26. package/dist/components/rich-text/shared/components/content-editable.d.ts +2 -1
  27. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockActionsPlugin.d.ts +4 -0
  28. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeBlockPlugin.d.ts +2 -0
  29. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeHighlightingPlugin.d.ts +1 -0
  30. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/resolve-block-type.d.ts +17 -0
  31. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/should-show-floating-toolbar.d.ts +11 -0
  32. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidComponent.d.ts +6 -0
  33. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +23 -0
  34. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +1 -0
  35. package/dist/components/rich-text/shared/transformers/markdown-transformers.d.ts +1 -0
  36. package/dist/components/rich-text/utils/markdown.d.ts +1 -0
  37. package/dist/components/searchable-menu.d.ts +35 -2
  38. package/dist/components/session-indicator.d.ts +2 -2
  39. package/dist/components/sidebar/sidebar-footer.d.ts +6 -0
  40. package/dist/components/sidebar/sidebar-header.d.ts +7 -0
  41. package/dist/components/sidebar/sidebar-project-menu.d.ts +10 -0
  42. package/dist/components/sidebar/sidebar.d.ts +2 -0
  43. package/dist/components/sidebar/sidebar.store.d.ts +47 -0
  44. package/dist/components/{sidebar-next/sidebar-next.types.d.ts → sidebar/sidebar.types.d.ts} +3 -2
  45. package/dist/components/sidebar-tree/sidebar-node-content.d.ts +9 -0
  46. package/dist/components/sidebar-tree/sidebar-tree.d.ts +1 -1
  47. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +15 -3
  48. package/dist/components/tickets/tag-badge.d.ts +10 -0
  49. package/dist/components/tickets/tag-option-icon.d.ts +2 -0
  50. package/dist/components/tickets/ticket-board.d.ts +2 -0
  51. package/dist/components/tickets/ticket-card.d.ts +12 -7
  52. package/dist/components/tickets/ticket-grouping.d.ts +2 -2
  53. package/dist/components/tickets/ticket-list.d.ts +6 -1
  54. package/dist/components/tickets/tickets-workspace.d.ts +9 -3
  55. package/dist/components/tickets/types.d.ts +22 -5
  56. package/dist/components/tickets/workspace-helpers.d.ts +13 -0
  57. package/dist/components/workspace-badge.d.ts +22 -0
  58. package/dist/get-file-type-icon-Bwqf1WXA.js +101 -0
  59. package/dist/get-file-type-icon-Bwqf1WXA.js.map +1 -0
  60. package/dist/index.d.ts +22 -21
  61. package/dist/index.js +2303 -1963
  62. package/dist/index.js.map +1 -1
  63. package/dist/rich-message-BVRk9BSD.js +1503 -0
  64. package/dist/rich-message-BVRk9BSD.js.map +1 -0
  65. package/dist/rich-text.js +442 -279
  66. package/dist/rich-text.js.map +1 -1
  67. package/dist/style.css +1 -1
  68. package/dist/test-utils/local-storage.d.ts +1 -0
  69. package/dist/theme/global.d.ts +3 -0
  70. package/dist/theme/primitives/colors.d.ts +116 -0
  71. package/dist/theme/recipes/button.d.ts +13 -13
  72. package/dist/theme/recipes/dialog.d.ts +1 -1
  73. package/dist/theme/recipes/drawer.d.ts +1 -1
  74. package/dist/theme/recipes/menu.d.ts +1 -1
  75. package/dist/theme/recipes/popover.d.ts +1 -1
  76. package/dist/theme/recipes/tooltip.d.ts +1 -1
  77. package/dist/theme/tokens/colors.d.ts +162 -8
  78. package/dist/{theme-BFV2Q048.js → theme-D0VvFB1Y.js} +292 -154
  79. package/dist/theme-D0VvFB1Y.js.map +1 -0
  80. package/dist/theme.js +1 -1
  81. package/package.json +4 -2
  82. package/dist/components/breadcrumb.stories.d.ts +0 -25
  83. package/dist/components/button.stories.d.ts +0 -18
  84. package/dist/components/chat-ui/components/ai-conversation.stories.d.ts +0 -6
  85. package/dist/components/chat-ui/components/ai-conversation.test.d.ts +0 -1
  86. package/dist/components/chat-ui/components/ai-message.stories.d.ts +0 -6
  87. package/dist/components/chat-ui/components/ai-response.stories.d.ts +0 -7
  88. package/dist/components/chat-ui/components/attachment-list.stories.d.ts +0 -6
  89. package/dist/components/chat-ui/components/chat-input.stories.d.ts +0 -7
  90. package/dist/components/chat-ui/components/chat-panel-alerts.stories.d.ts +0 -9
  91. package/dist/components/chat-ui/components/chat-panel.sticky-user-message.test.d.ts +0 -1
  92. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +0 -10
  93. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +0 -9
  94. package/dist/components/chat-ui/components/model-swap-separator.stories.d.ts +0 -6
  95. package/dist/components/chat-ui/components/tool-invocation-timeline.stories.d.ts +0 -6
  96. package/dist/components/chat-ui/components/workspace-hub.stories.d.ts +0 -6
  97. package/dist/components/checkbox.stories.d.ts +0 -15
  98. package/dist/components/column-file-browser.stories.d.ts +0 -15
  99. package/dist/components/data-table/data-table.stories.d.ts +0 -33
  100. package/dist/components/delete-confirmation-modal.stories.d.ts +0 -11
  101. package/dist/components/diff-bubble.stories.d.ts +0 -13
  102. package/dist/components/diff-drawer.stories.d.ts +0 -8
  103. package/dist/components/diff-view-adapter.test.d.ts +0 -1
  104. package/dist/components/documentation/docs-changelog.d.ts +0 -20
  105. package/dist/components/documentation/docs-changelog.stories.d.ts +0 -15
  106. package/dist/components/documentation/docs-outline.d.ts +0 -13
  107. package/dist/components/documentation/docs-outline.stories.d.ts +0 -16
  108. package/dist/components/documentation/docs-pagination.d.ts +0 -10
  109. package/dist/components/documentation/docs-pagination.stories.d.ts +0 -14
  110. package/dist/components/documentation/docs-sidebar.d.ts +0 -14
  111. package/dist/components/documentation/docs-sidebar.stories.d.ts +0 -7
  112. package/dist/components/drawer-inline.stories.d.ts +0 -8
  113. package/dist/components/empty-state.stories.d.ts +0 -34
  114. package/dist/components/file-selector.stories.d.ts +0 -17
  115. package/dist/components/folder-picker-dialog.stories.d.ts +0 -11
  116. package/dist/components/info-card.stories.d.ts +0 -41
  117. package/dist/components/item-section.stories.d.ts +0 -17
  118. package/dist/components/layout.stories.d.ts +0 -11
  119. package/dist/components/menu-item.stories.d.ts +0 -72
  120. package/dist/components/open-source-notices-screen.stories.d.ts +0 -12
  121. package/dist/components/panel-menu.d.ts +0 -9
  122. package/dist/components/panel-menu.stories.d.ts +0 -8
  123. package/dist/components/param-editor-horizontal.stories.d.ts +0 -19
  124. package/dist/components/param-editor.stories.d.ts +0 -24
  125. package/dist/components/properties.stories.d.ts +0 -17
  126. package/dist/components/resource-badge.stories.d.ts +0 -7
  127. package/dist/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.stories.d.ts +0 -9
  128. package/dist/components/rich-text/markdown-editor/markdown-editor.stories.d.ts +0 -7
  129. package/dist/components/rich-text/prompt-input/prompt-input.stories.d.ts +0 -8
  130. package/dist/components/rich-text/rich-message/rich-message.stories.d.ts +0 -6
  131. package/dist/components/rich-text/shared/nodes/DataTableNode.stories.d.ts +0 -7
  132. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +0 -21
  133. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +0 -1
  134. package/dist/components/scroll-area.stories.d.ts +0 -7
  135. package/dist/components/searchable-menu.stories.d.ts +0 -6
  136. package/dist/components/searchable-menu.test.d.ts +0 -1
  137. package/dist/components/session-indicator.stories.d.ts +0 -11
  138. package/dist/components/sidebar-next/sidebar-next-footer.d.ts +0 -6
  139. package/dist/components/sidebar-next/sidebar-next-header.d.ts +0 -7
  140. package/dist/components/sidebar-next/sidebar-next.d.ts +0 -2
  141. package/dist/components/sidebar-next/sidebar-next.store.d.ts +0 -47
  142. package/dist/components/sidebar-next/sidebar-next.store.test.d.ts +0 -1
  143. package/dist/components/sidebar-next/sidebar-next.stories.d.ts +0 -10
  144. package/dist/components/sidebar-tree/sidebar-tree-searchable-action-menu.stories.d.ts +0 -6
  145. package/dist/components/sidebar-tree/sidebar-tree.stories.d.ts +0 -13
  146. package/dist/components/slider.stories.d.ts +0 -15
  147. package/dist/components/style-guide.stories.d.ts +0 -28
  148. package/dist/components/switch.stories.d.ts +0 -16
  149. package/dist/components/tickets/display-menu.stories.d.ts +0 -6
  150. package/dist/components/tickets/filter-menu.stories.d.ts +0 -6
  151. package/dist/components/tickets/ticket-board.stories.d.ts +0 -5
  152. package/dist/components/tickets/ticket-card.stories.d.ts +0 -18
  153. package/dist/components/tickets/ticket-grouping.test.d.ts +0 -1
  154. package/dist/components/tickets/ticket-list.stories.d.ts +0 -10
  155. package/dist/components/tickets/tickets-workspace.stories.d.ts +0 -10
  156. package/dist/components/tickets/use-workspace-store.test.d.ts +0 -1
  157. package/dist/components/toaster.stories.d.ts +0 -11
  158. package/dist/rich-message-ZT2CEiwt.js +0 -1406
  159. package/dist/rich-message-ZT2CEiwt.js.map +0 -1
  160. package/dist/theme-BFV2Q048.js.map +0 -1
  161. package/dist/tooltip-Dze4WXVl.js +0 -86
  162. package/dist/tooltip-Dze4WXVl.js.map +0 -1
package/dist/rich-text.js CHANGED
@@ -1,44 +1,146 @@
1
- import { jsx as t, jsxs as K } from "react/jsx-runtime";
2
- import { c as Y } from "react/compiler-runtime";
3
- import { e as le, a as ae, I as se, E as ce, C as de, s as Te, b as oe, T as ye, c as Ee } from "./rich-message-ZT2CEiwt.js";
4
- import { D as jt, d as Wt, R as Ut, P as qt, R as Vt, g as Kt, f as Gt } from "./rich-message-ZT2CEiwt.js";
5
- import { Stack as Q, IconButton as D, Text as W, Box as me, Flex as te } from "@chakra-ui/react";
6
- import { LexicalCollaboration as _e } from "@lexical/react/LexicalCollaborationContext";
7
- import { CollaborationPluginV2__EXPERIMENTAL as Se } from "@lexical/react/LexicalCollaborationPlugin";
8
- import { LexicalComposer as fe } from "@lexical/react/LexicalComposer";
9
- import { LexicalErrorBoundary as ue } from "@lexical/react/LexicalErrorBoundary";
10
- import { HorizontalRulePlugin as pe } from "@lexical/react/LexicalHorizontalRulePlugin";
11
- import { LinkPlugin as he } from "@lexical/react/LexicalLinkPlugin";
12
- import { ListPlugin as ge } from "@lexical/react/LexicalListPlugin";
13
- import { RichTextPlugin as be } from "@lexical/react/LexicalRichTextPlugin";
14
- import { useState as k, useRef as G, useEffect as q } from "react";
15
- import { WebsocketProvider as we } from "y-websocket";
16
- import * as Re from "yjs";
17
- import { INSERT_UNORDERED_LIST_COMMAND as Le, REMOVE_LIST_COMMAND as ne, INSERT_ORDERED_LIST_COMMAND as ke, $isListNode as Z } from "@lexical/list";
18
- import { useLexicalComposerContext as Me } from "@lexical/react/LexicalComposerContext";
19
- import { $createHeadingNode as Ie, $isHeadingNode as Pe } from "@lexical/rich-text";
20
- import { $setBlocksType as ie } from "@lexical/selection";
21
- import { mergeRegister as Be, $findMatchingParent as ve } from "@lexical/utils";
22
- import { $getSelection as U, $isRangeSelection as J, SELECTION_CHANGE_COMMAND as Ne, COMMAND_PRIORITY_CRITICAL as Ae, CLICK_COMMAND as Oe, COMMAND_PRIORITY_HIGH as Fe, FORMAT_TEXT_COMMAND as ee, $createParagraphNode as He, $isRootOrShadowRoot as De, $getRoot as ze } from "lexical";
23
- import { List as $e, ListOrdered as je } from "lucide-react";
24
- import { createPortal as We } from "react-dom";
25
- import { T as z } from "./tooltip-Dze4WXVl.js";
26
- import { $convertFromMarkdownString as Ue, $convertToMarkdownString as qe } from "@lexical/markdown";
27
- import { AutoFocusPlugin as Ve } from "@lexical/react/LexicalAutoFocusPlugin";
28
- import { HistoryPlugin as Ke } from "@lexical/react/LexicalHistoryPlugin";
29
- import { OnChangePlugin as Ge } from "@lexical/react/LexicalOnChangePlugin";
30
- const Ye = 10, Xe = 5;
31
- function re(o, e, n, a = Ye, c = Xe) {
32
- const l = n.parentElement;
33
- if (o === null || !l) {
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-BVRk9BSD.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-BVRk9BSD.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))
36
+ return null;
37
+ const i = e.anchor.getNode(), n = le(i) ? i : me(i, (a) => le(a));
38
+ if (!le(n))
39
+ return null;
40
+ const s = o.getElementByKey(n.getKey());
41
+ return s instanceof HTMLElement ? s : null;
42
+ }
43
+ function vt(o) {
44
+ return o instanceof HTMLElement ? o.closest(".rich-text__code") : null;
45
+ }
46
+ function Ct(o, e) {
47
+ const i = o.getBoundingClientRect(), n = e.getBoundingClientRect();
48
+ return {
49
+ top: n.top - i.top + 6,
50
+ left: n.right - i.left - 30
51
+ };
52
+ }
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)
65
+ 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);
73
+ });
74
+ };
75
+ return p.addEventListener("pointermove", S), p.addEventListener("pointerleave", k), () => {
76
+ p.removeEventListener("pointermove", S), p.removeEventListener("pointerleave", k);
77
+ };
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) => {
81
+ const {
82
+ editorState: S
83
+ } = p;
84
+ S.read(() => {
85
+ const k = se(n);
86
+ k && a(k);
87
+ });
88
+ }), n.registerCommand(Me, () => (n.getEditorState().read(() => {
89
+ const p = se(n);
90
+ if (!p) {
91
+ a(bt);
92
+ return;
93
+ }
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)
96
+ 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 = {
102
+ 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 ?? "";
110
+ try {
111
+ await navigator.clipboard.writeText(p), d(!0), c.current !== null && window.clearTimeout(c.current), c.current = window.setTimeout(() => {
112
+ d(!1);
113
+ }, 1200);
114
+ } catch {
115
+ d(!1);
116
+ }
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];
122
+ 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;
128
+ }
129
+ function bt(o) {
130
+ return o?.matches(":hover") ? o : null;
131
+ }
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) {
34
136
  e.style.opacity = "0", e.style.transform = "translate(-10000px, -10000px)";
35
137
  return;
36
138
  }
37
- const s = e.getBoundingClientRect(), m = n.getBoundingClientRect(), f = l.getBoundingClientRect();
38
- let u = o.top - a, p = o.left - c;
39
- u < f.top && (u += s.height + o.height + a * 2), p + s.width > f.right && (p = f.right - s.width - c), u -= m.top, p -= m.left, e.style.opacity = "1", e.style.transform = `translate(${p}px, ${u}px)`;
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)`;
40
142
  }
41
- const Qe = -4, Ze = {
143
+ const Tt = {
42
144
  bullet: "Bulleted List",
43
145
  check: "Check List",
44
146
  code: "Code Block",
@@ -51,130 +153,169 @@ const Qe = -4, Ze = {
51
153
  number: "Numbered List",
52
154
  paragraph: "Normal",
53
155
  quote: "Quote"
54
- }, Je = (o) => o in Ze ? o : null, et = (o) => (o.getKey() === "root" ? o : ve(o, (n) => {
55
- const a = n.getParent();
56
- return a !== null && De(a);
57
- })) ?? o.getTopLevelElementOrThrow(), tt = (o) => {
58
- const e = et(o);
59
- if (Z(e))
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))
60
162
  return e.getListType();
61
- const n = ve(o, (c) => Z(c));
62
- if (n !== null && Z(n))
63
- return n.getListType();
64
- const a = Pe(e) ? e.getTag() : e.getType();
65
- return Je(a);
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);
66
168
  };
67
- function ot({
169
+ function Rt(o) {
170
+ const {
171
+ 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;
191
+ }
192
+ function kt({
68
193
  editor: o,
69
194
  anchorElem: e,
70
- isToolbarActive: n,
71
- setIsToolbarActive: a
195
+ isToolbarActive: i,
196
+ setIsToolbarActive: n
72
197
  }) {
73
- const c = G(null), [l, s] = k("paragraph"), [m, f] = k(!1), [u, p] = k(!1), [d, M] = k(!1), h = G(() => {
74
- }), I = (r) => {
75
- if (l !== r) {
76
- o.update(() => {
77
- const i = U();
78
- ie(i, () => Ie(r));
79
- });
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);
205
+ return;
206
+ }
207
+ ne(r, () => dt(l));
208
+ }
209
+ });
210
+ }, T = (l) => {
211
+ if (a === l) {
212
+ o.dispatchCommand(lt, void 0);
80
213
  return;
81
214
  }
215
+ const r = {
216
+ bullet: st,
217
+ number: at,
218
+ check: rt
219
+ }[l];
220
+ o.dispatchCommand(r, void 0);
221
+ }, I = () => {
82
222
  o.update(() => {
83
- const i = U();
84
- ie(i, () => He());
223
+ const l = J();
224
+ if (Y(l)) {
225
+ if (a === "code") {
226
+ ne(l, ue);
227
+ return;
228
+ }
229
+ ne(l, () => Ge());
230
+ }
85
231
  });
86
- }, P = () => {
87
- l !== "bullet" ? o.dispatchCommand(Le, void 0) : o.dispatchCommand(ne, void 0);
88
- }, $ = () => {
89
- l !== "number" ? o.dispatchCommand(ke, void 0) : o.dispatchCommand(ne, void 0);
90
- }, v = () => {
91
- const r = U();
92
- if (!J(r)) return;
93
- f(r.hasFormat("bold")), p(r.hasFormat("italic")), M(r.hasFormat("underline"));
94
- const i = tt(r.anchor.getNode());
95
- i && s(i);
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);
96
238
  };
97
- return h.current = () => {
98
- const r = U(), i = c.current, g = window.getSelection();
99
- if (i === null)
239
+ return u.current = () => {
240
+ const l = J(), r = s.current, y = window.getSelection();
241
+ if (r === null)
100
242
  return;
101
- const b = o.getRootElement();
102
- if (r !== null && J(r) && !r.isCollapsed() && g !== null && !g.isCollapsed && b?.contains(g.anchorNode) && o.isEditable()) {
103
- const x = g.getRangeAt(0).getBoundingClientRect();
104
- if (x) {
105
- const L = new DOMRect(x.left, x.bottom, 0, 0);
106
- re(L, i, e, Qe);
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);
107
257
  }
108
- a(!0);
258
+ n(!0);
109
259
  } else
110
- b !== null && re(null, i, e), a(!1);
111
- return v(), !0;
112
- }, q(() => {
113
- const r = e.parentElement, i = () => {
260
+ b !== null && pe(null, r, e), n(!1);
261
+ return E(), !0;
262
+ }, G(() => {
263
+ const l = e.parentElement, r = () => {
114
264
  o.getEditorState().read(() => {
115
- h.current();
265
+ u.current();
116
266
  });
117
267
  };
118
- return window.addEventListener("resize", i), r && r.addEventListener("scroll", i), () => {
119
- window.removeEventListener("resize", i), r && r.removeEventListener("scroll", i);
268
+ return window.addEventListener("resize", r), l && l.addEventListener("scroll", r), () => {
269
+ window.removeEventListener("resize", r), l && l.removeEventListener("scroll", r);
120
270
  };
121
- }, [e, o]), q(() => Be(o.registerUpdateListener(({
122
- editorState: r
271
+ }, [e, o]), G(() => Ie(o.registerUpdateListener(({
272
+ editorState: l
123
273
  }) => {
124
- r.read(() => {
125
- h.current();
274
+ l.read(() => {
275
+ u.current();
126
276
  });
127
- }), o.registerCommand(Ne, (r) => (h.current(), !1), Ae), o.registerCommand(Oe, (r) => {
128
- const i = U();
129
- return J(i) && h.current(), !1;
130
- }, Fe)), [o]), /* @__PURE__ */ t("div", { ref: c, className: `floating-text-format-toolbar ${n ? "active" : ""}`, children: /* @__PURE__ */ K(Q, { direction: "row", gap: "0.5", alignItems: "center", children: [
131
- /* @__PURE__ */ t(z, { content: "Bold", children: /* @__PURE__ */ t(D, { "data-active": m || void 0, onClick: () => {
132
- o.dispatchCommand(ee, "bold");
133
- }, variant: "ghost", "aria-label": "Bold", size: "xs", children: /* @__PURE__ */ t(W, { fontWeight: "bold", fontSize: ".75rem", children: "B" }) }) }),
134
- /* @__PURE__ */ t(z, { content: "Italic", children: /* @__PURE__ */ t(D, { "data-active": u || void 0, onClick: () => {
135
- o.dispatchCommand(ee, "italic");
136
- }, variant: "ghost", "aria-label": "Italic", size: "xs", children: /* @__PURE__ */ t(W, { fontStyle: "italic", fontSize: ".75rem", children: "I" }) }) }),
137
- /* @__PURE__ */ t(z, { content: "Underline", children: /* @__PURE__ */ t(D, { "data-active": d || void 0, onClick: () => {
138
- o.dispatchCommand(ee, "underline");
139
- }, variant: "ghost", "aria-label": "Underline", size: "xs", children: /* @__PURE__ */ t(W, { textDecoration: "underline", fontSize: ".75rem", children: "U" }) }) }),
140
- /* @__PURE__ */ t(Q, { as: "span", height: "1rem", mx: "0.5", children: /* @__PURE__ */ t("span", { style: {
141
- borderLeft: "1px solid",
142
- height: "100%",
143
- borderColor: "var(--chakra-colors-border-muted)"
144
- } }) }),
145
- /* @__PURE__ */ t(z, { content: "Heading 1", children: /* @__PURE__ */ t(D, { "data-active": l === "h1" || void 0, variant: "ghost", "aria-label": "Heading 1", size: "xs", onClick: () => {
146
- I("h1");
147
- }, children: /* @__PURE__ */ t(W, { fontWeight: "thin", fontSize: ".8rem", children: "H1" }) }) }),
148
- /* @__PURE__ */ t(z, { content: "Heading 2", children: /* @__PURE__ */ t(D, { "data-active": l === "h2" || void 0, variant: "ghost", "aria-label": "Heading 2", size: "xs", onClick: () => {
149
- I("h2");
150
- }, children: /* @__PURE__ */ t(W, { fontWeight: "thin", fontSize: ".8rem", children: "H2" }) }) }),
151
- /* @__PURE__ */ t(z, { content: "Heading 3", children: /* @__PURE__ */ t(D, { "data-active": l === "h3" || void 0, variant: "ghost", "aria-label": "Heading 3", size: "xs", onClick: () => {
152
- I("h3");
153
- }, children: /* @__PURE__ */ t(W, { fontWeight: "thin", fontSize: ".8rem", children: "H3" }) }) }),
154
- /* @__PURE__ */ t(Q, { as: "span", height: "1rem", mx: "0.5", children: /* @__PURE__ */ t("span", { style: {
155
- borderLeft: "1px solid",
156
- height: "100%",
157
- borderColor: "var(--chakra-colors-border-muted)"
158
- } }) }),
159
- /* @__PURE__ */ t(z, { content: "Bulleted List", children: /* @__PURE__ */ t(D, { "data-active": l === "bullet" || void 0, variant: "ghost", "aria-label": "Bulleted List", size: "xs", onClick: P, children: /* @__PURE__ */ t($e, { size: 14 }) }) }),
160
- /* @__PURE__ */ t(z, { content: "Numbered List", children: /* @__PURE__ */ t(D, { "data-active": l === "number" || void 0, variant: "ghost", "aria-label": "Numbered List", size: "xs", onClick: $, children: /* @__PURE__ */ t(je, { size: 14 }) }) })
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 }) }) })
161
306
  ] }) });
162
307
  }
163
- function nt(o, e) {
164
- const n = Y(7), [a, c] = k(!1);
165
- let l;
166
- n[0] !== e || n[1] !== o || n[2] !== a ? (l = /* @__PURE__ */ t(ot, { editor: o, anchorElem: e, isToolbarActive: a, setIsToolbarActive: c }), n[0] = e, n[1] = o, n[2] = a, n[3] = l) : l = n[3];
167
- let s;
168
- return n[4] !== e || n[5] !== l ? (s = We(l, e), n[4] = e, n[5] = l, n[6] = s) : s = n[6], s;
169
- }
170
- function xe(o) {
171
- const {
172
- anchorElem: e
173
- } = o, n = e === void 0 ? document.body : e, [a] = Me();
174
- return nt(a, n);
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;
175
316
  }
176
- function it() {
177
- const o = Y(1);
317
+ function Lt() {
318
+ const o = ee(1);
178
319
  let e;
179
320
  return o[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ t("style", { children: `
180
321
  .collaboration-cursor-container {
@@ -212,161 +353,183 @@ function it() {
212
353
  }
213
354
  ` }), o[0] = e) : e = o[0], e;
214
355
  }
215
- function Ot(o) {
216
- const e = Y(37), {
217
- roomId: n,
218
- wsUrl: a,
219
- wsParams: c,
220
- userName: l,
221
- userColor: s,
222
- placeholder: m
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
223
364
  } = o;
224
- let f;
225
- e[0] !== c ? (f = c === void 0 ? {} : c, e[0] = c, e[1] = f) : f = e[1];
226
- const u = f, p = l === void 0 ? "Anonymous" : l, d = s === void 0 ? "#30bced" : s, M = G(null), [h, I] = k(null), [P, $] = k(!1), [v] = k(lt);
227
- let r;
228
- e[2] !== v || e[3] !== n || e[4] !== u || e[5] !== a ? (r = () => {
229
- const V = new we(a, n, v, {
230
- params: u,
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,
231
372
  connect: !1
232
373
  });
233
- return V.on("sync", (X) => {
234
- X && $(!0);
235
- }), V;
236
- }, e[2] = v, e[3] = n, e[4] = u, e[5] = a, e[6] = r) : r = e[6];
237
- const [i] = k(r);
238
- let g, b;
239
- e[7] !== i ? (g = () => (i.connect(), () => {
240
- i.disconnect();
241
- }), b = [i], e[7] = i, e[8] = g, e[9] = b) : (g = e[8], b = e[9]), q(g, b);
242
- let x, L;
243
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = () => {
244
- I(M.current);
245
- }, L = [], e[10] = x, e[11] = L) : (x = e[10], L = e[11]), q(x, L);
246
- let E;
247
- e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (E = {
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 = {
248
389
  namespace: "COLLABORATIVE_EDITOR",
249
- nodes: ae,
390
+ nodes: ge,
250
391
  editorState: null,
251
- onError: rt,
392
+ onError: It,
252
393
  editable: !0,
253
- theme: le
254
- }, e[12] = E) : E = e[12];
255
- const j = E;
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];
408
+ let K;
409
+ e[29] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = /* @__PURE__ */ t(xe, { fullWidth: !1 }), e[29] = K) : K = e[29];
410
+ 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];
256
412
  let B;
257
- e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (B = /* @__PURE__ */ t(it, {}), e[13] = B) : B = e[13];
258
- const H = i;
259
- let _;
260
- e[14] !== v || e[15] !== n || e[16] !== H || e[17] !== d || e[18] !== p ? (_ = /* @__PURE__ */ t(Se, { id: n, doc: v, provider: H, __shouldBootstrapUnsafe: !1, username: p, cursorColor: d }), e[14] = v, e[15] = n, e[16] = H, e[17] = d, e[18] = p, e[19] = _) : _ = e[19];
261
- let N, A, O, S, w;
262
- e[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ t(he, {}), A = /* @__PURE__ */ t(ge, {}), O = /* @__PURE__ */ t(pe, {}), S = /* @__PURE__ */ t(se, {}), w = /* @__PURE__ */ t(ce, {}), e[20] = N, e[21] = A, e[22] = O, e[23] = S, e[24] = w) : (N = e[20], A = e[21], O = e[22], S = e[23], w = e[24]);
263
- let R;
264
- e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ t(de, { fullWidth: !1 }), e[25] = R) : R = e[25];
265
- let C;
266
- e[26] !== m || e[27] !== P ? (C = P && m ? /* @__PURE__ */ t(me, { position: "absolute", top: "0", color: "fg.muted", pointerEvents: "none", userSelect: "none", textStyle: "paragraph/M/regular", children: m }) : null, e[26] = m, e[27] = P, e[28] = C) : C = e[28];
267
- let T;
268
- e[29] !== C ? (T = /* @__PURE__ */ t(be, { contentEditable: R, placeholder: C, ErrorBoundary: ue }), e[29] = C, e[30] = T) : T = e[30];
269
- let y;
270
- e[31] !== h ? (y = h ? /* @__PURE__ */ t(xe, { anchorElem: h }) : null, e[31] = h, e[32] = y) : y = e[32];
413
+ e[33] !== P ? (B = /* @__PURE__ */ t(we, { contentEditable: K, placeholder: P, ErrorBoundary: ye }), e[33] = P, e[34] = B) : B = e[34];
414
+ let A;
415
+ e[35] !== u ? (A = u ? /* @__PURE__ */ t(Ae, { anchorElem: u }) : null, e[35] = u, e[36] = A) : A = e[36];
271
416
  let F;
272
- return e[33] !== _ || e[34] !== T || e[35] !== y ? (F = /* @__PURE__ */ K(te, { ref: M, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: [
273
- B,
274
- /* @__PURE__ */ t(fe, { initialConfig: j, children: /* @__PURE__ */ K(_e, { children: [
275
- _,
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,
421
+ k,
276
422
  N,
277
- A,
423
+ M,
424
+ j,
425
+ W,
426
+ U,
427
+ z,
278
428
  O,
279
- S,
280
- w,
281
- T,
282
- y
429
+ B,
430
+ A
283
431
  ] }) })
284
- ] }), e[33] = _, e[34] = T, e[35] = y, e[36] = F) : F = e[36], F;
432
+ ] }), e[37] = S, e[38] = z, e[39] = B, e[40] = A, e[41] = F) : F = e[41], F;
285
433
  }
286
- function rt(o) {
434
+ function It(o) {
287
435
  return console.error(o);
288
436
  }
289
- function lt() {
290
- return new Re.Doc();
437
+ function Mt() {
438
+ return new Ve.Doc();
291
439
  }
292
- function Ft(o) {
293
- const e = Y(41), {
294
- autoFocus: n,
295
- debug: a,
296
- defaultState: c,
297
- isEditable: l,
298
- placeholder: s,
299
- onChange: m
300
- } = o, f = n === void 0 ? !1 : n, u = a === void 0 ? !1 : a, p = c === void 0 ? "" : c, d = l === void 0 ? !1 : l;
301
- let M;
302
- e[0] !== p ? (M = Te(p), e[0] = p, e[1] = M) : M = e[1];
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;
450
+ let R;
451
+ e[0] !== L ? (R = Fe(L), e[0] = L, e[1] = R) : R = e[1];
303
452
  const {
304
- frontmatter: h,
453
+ frontmatter: T,
305
454
  body: I
306
- } = M, P = d && !!m, $ = G(null), [v, r] = k(null);
307
- let i, g;
308
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = () => {
309
- r($.current);
310
- }, g = [], e[2] = i, e[3] = g) : (i = e[2], g = e[3]), q(i, g);
311
- let b;
312
- e[4] !== I ? (b = () => Ue(I, oe, void 0, !1), e[4] = I, e[5] = b) : b = e[5];
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];
313
462
  let x;
314
- e[6] !== d || e[7] !== b ? (x = {
463
+ e[6] !== f || e[7] !== g ? (x = {
315
464
  namespace: "MARKDOWN_EDITOR",
316
- nodes: ae,
317
- editorState: b,
318
- onError: at,
319
- editable: d,
320
- theme: le
321
- }, e[6] = d, e[7] = b, e[8] = x) : x = e[8];
322
- const L = x;
323
- let E;
324
- e[9] !== f ? (E = f ? /* @__PURE__ */ t(Ve, {}) : null, e[9] = f, e[10] = E) : E = e[10];
325
- let j, B, H, _, N, A;
326
- e[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ t(Ke, {}), B = /* @__PURE__ */ t(he, {}), H = /* @__PURE__ */ t(ge, {}), _ = /* @__PURE__ */ t(pe, {}), N = /* @__PURE__ */ t(se, {}), A = /* @__PURE__ */ t(ce, {}), e[11] = j, e[12] = B, e[13] = H, e[14] = _, e[15] = N, e[16] = A) : (j = e[11], B = e[12], H = e[13], _ = e[14], N = e[15], A = e[16]);
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]);
476
+ 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]);
327
480
  let O;
328
- e[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ t(de, { fullWidth: !1, padding: "sm" }), e[17] = O) : O = e[17];
329
- let S;
330
- e[18] !== s ? (S = s ? /* @__PURE__ */ t(te, { position: "absolute", padding: "sm", top: "0", left: "0", right: "0", pointerEvents: "none", userSelect: "none", justifyContent: "center", children: /* @__PURE__ */ t(me, { width: "100%", maxWidth: "720px", color: "fg.muted", textStyle: "paragraph/M/regular", children: s }) }) : null, e[18] = s, e[19] = S) : S = e[19];
331
- let w;
332
- e[20] !== S ? (w = /* @__PURE__ */ t(be, { contentEditable: O, placeholder: S, ErrorBoundary: ue }), e[20] = S, e[21] = w) : w = e[21];
333
- let R;
334
- e[22] !== v || e[23] !== d ? (R = d && v ? /* @__PURE__ */ t(xe, { anchorElem: v }) : null, e[22] = v, e[23] = d, e[24] = R) : R = e[24];
335
- let C;
336
- e[25] !== h || e[26] !== m || e[27] !== P ? (C = P ? /* @__PURE__ */ t(Ge, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (V) => {
337
- V.read(() => {
338
- const X = ze(), Ce = qe(oe, X);
339
- m?.(h + Ce);
340
- });
341
- } }) : null, e[25] = h, e[26] = m, e[27] = P, e[28] = C) : C = e[28];
342
- let T;
343
- e[29] !== d ? (T = /* @__PURE__ */ t(ye, { isEditable: d }), e[29] = d, e[30] = T) : T = e[30];
344
- let y;
345
- e[31] !== u ? (y = u && /* @__PURE__ */ t(Ee, {}), e[31] = u, e[32] = y) : y = e[32];
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];
484
+ 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];
488
+ 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];
346
490
  let F;
347
- return e[33] !== L || e[34] !== w || e[35] !== R || e[36] !== C || e[37] !== T || e[38] !== y || e[39] !== E ? (F = /* @__PURE__ */ t(te, { ref: $, className: "rich-text", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "visible", children: /* @__PURE__ */ K(fe, { initialConfig: L, children: [
348
- E,
349
- j,
350
- B,
351
- H,
352
- _,
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);
497
+ });
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,
507
+ k,
353
508
  N,
509
+ M,
510
+ j,
511
+ W,
512
+ U,
513
+ z,
514
+ O,
515
+ K,
354
516
  A,
355
- w,
356
- R,
357
- C,
358
- T,
359
- y
360
- ] }) }), e[33] = L, e[34] = w, e[35] = R, e[36] = C, e[37] = T, e[38] = y, e[39] = E, e[40] = F) : F = e[40], F;
517
+ F,
518
+ q,
519
+ 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;
361
524
  }
362
- function at(o) {
525
+ function Nt(o) {
363
526
  return console.error(o);
364
527
  }
365
- function Ht(o) {
528
+ function uo(o) {
366
529
  const e = o.toLowerCase().trim();
367
530
  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";
368
531
  }
369
- const st = {
532
+ const Pt = {
370
533
  csv: "text/csv",
371
534
  tsv: "text/tab-separated-values",
372
535
  json: "application/json",
@@ -390,21 +553,21 @@ const st = {
390
553
  yml: "text/yaml",
391
554
  yaml: "text/yaml"
392
555
  };
393
- function Dt(o) {
394
- const n = (o.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
395
- return n ? st[n] ?? null : null;
556
+ function po(o) {
557
+ const i = (o.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
558
+ return i ? Pt[i] ?? null : null;
396
559
  }
397
560
  export {
398
- Ot as CollaborativeMarkdownEditor,
399
- jt as DefaultRichTextCodeEditor,
400
- Wt as DefaultRichTextDataTable,
401
- Ft as MarkdownEditor,
402
- Ut as MarkdownPreview,
403
- qt as PromptEditor,
404
- Vt as RichMessage,
405
- Kt as generateEditorStateFromString,
406
- Gt as getTextFromSerializedEditorState,
407
- Ht as inferResourceTypeFromMediaType,
408
- Dt as mediaTypeFromPath
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
409
572
  };
410
573
  //# sourceMappingURL=rich-text.js.map