@pstdio/ui 0.2.1 → 0.2.3

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 (48) hide show
  1. package/dist/chat-ui.js +679 -623
  2. package/dist/chat-ui.js.map +1 -1
  3. package/dist/components/chat-ui/agent-types.d.ts +1 -0
  4. package/dist/components/chat-ui/components/ai-conversation.d.ts +21 -579
  5. package/dist/components/chat-ui/components/ai-conversation.test.d.ts +1 -0
  6. package/dist/components/chat-ui/components/ai-message.d.ts +8 -8
  7. package/dist/components/chat-ui/components/chat-panel-sticky-user-message.d.ts +4 -0
  8. package/dist/components/chat-ui/components/chat-panel.sticky-user-message.test.d.ts +1 -0
  9. package/dist/components/chat-ui/components/chat-panel.stories.d.ts +1 -0
  10. package/dist/components/chat-ui/components/message-parts-renderer.stories.d.ts +1 -0
  11. package/dist/components/chat-ui/components/message-types.d.ts +8 -0
  12. package/dist/components/menu-item.d.ts +3 -1
  13. package/dist/components/menu-item.stories.d.ts +1 -1
  14. package/dist/components/rich-text/rich-message/rich-message.d.ts +1 -0
  15. package/dist/components/rich-text/shared/components/content-editable.d.ts +2 -1
  16. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.d.ts +2 -0
  17. package/dist/components/rich-text/shared/plugins/CodePlugin/CodeNode.test.d.ts +1 -0
  18. package/dist/components/scroll-area.d.ts +1 -0
  19. package/dist/components/sidebar-next/sidebar-next.types.d.ts +2 -1
  20. package/dist/components/sidebar-tree/sidebar-tree.d.ts +2 -1
  21. package/dist/components/sidebar-tree/sidebar-tree.types.d.ts +9 -1
  22. package/dist/components/tickets/display-menu.d.ts +15 -0
  23. package/dist/components/tickets/display-menu.stories.d.ts +6 -0
  24. package/dist/components/tickets/filter-menu.d.ts +11 -0
  25. package/dist/components/tickets/filter-menu.stories.d.ts +6 -0
  26. package/dist/components/tickets/ticket-board.d.ts +7 -0
  27. package/dist/components/tickets/ticket-grouping.d.ts +22 -0
  28. package/dist/components/tickets/ticket-grouping.test.d.ts +1 -0
  29. package/dist/components/tickets/tickets-workspace.d.ts +29 -0
  30. package/dist/components/tickets/tickets-workspace.stories.d.ts +10 -0
  31. package/dist/components/tickets/types.d.ts +49 -0
  32. package/dist/components/tickets/use-workspace-store.d.ts +51 -0
  33. package/dist/components/tickets/use-workspace-store.test.d.ts +1 -0
  34. package/dist/index.d.ts +7 -1
  35. package/dist/index.js +2073 -1209
  36. package/dist/index.js.map +1 -1
  37. package/dist/rich-message-ZT2CEiwt.js +1406 -0
  38. package/dist/rich-message-ZT2CEiwt.js.map +1 -0
  39. package/dist/rich-text.js +5 -5
  40. package/dist/rich-text.js.map +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/tooltip-Dze4WXVl.js +86 -0
  43. package/dist/tooltip-Dze4WXVl.js.map +1 -0
  44. package/package.json +3 -3
  45. package/dist/rich-message-B2gxL8oy.js +0 -1382
  46. package/dist/rich-message-B2gxL8oy.js.map +0 -1
  47. package/dist/tooltip-Gm7PLwZG.js +0 -51
  48. package/dist/tooltip-Gm7PLwZG.js.map +0 -1
@@ -1,1382 +0,0 @@
1
- import { CodeNode as ae } from "@lexical/code";
2
- import { LinkNode as Se } from "@lexical/link";
3
- import { ListNode as Te, ListItemNode as Re } from "@lexical/list";
4
- import { TRANSFORMERS as Ne, $convertFromMarkdownString as Ce, $convertToMarkdownString as nt } from "@lexical/markdown";
5
- import { QuoteNode as Oe, HeadingNode as ke } from "@lexical/rich-text";
6
- import { jsx as s, jsxs as P, Fragment as pe } from "react/jsx-runtime";
7
- import { chakra as ie, Flex as V, Text as I, Spacer as rt, IconButton as ot, Box as v, Table as A, Textarea as it, Tooltip as Z, Kbd as st } from "@chakra-ui/react";
8
- import { DecoratorNode as G, $applyNodeReplacement as lt, ElementNode as $e, TextNode as ee, $createTextNode as Ie, $nodesOfType as ct, createCommand as k, isHTMLElement as at, $createParagraphNode as se, COMMAND_PRIORITY_LOW as ve, $getSelection as dt, $isRangeSelection as ut, $isElementNode as mt, KEY_DOWN_COMMAND as ft, COMMAND_PRIORITY_HIGH as pt, $getRoot as we } from "lexical";
9
- import { c as C } from "react/compiler-runtime";
10
- import { MarkNode as _t } from "@lexical/mark";
11
- import { LexicalComposer as Pe } from "@lexical/react/LexicalComposer";
12
- import { LexicalErrorBoundary as Le } from "@lexical/react/LexicalErrorBoundary";
13
- import { HistoryPlugin as ht } from "@lexical/react/LexicalHistoryPlugin";
14
- import { OnChangePlugin as Me } from "@lexical/react/LexicalOnChangePlugin";
15
- import { RichTextPlugin as De } from "@lexical/react/LexicalRichTextPlugin";
16
- import * as gt from "react";
17
- import { Suspense as xt, useEffect as F, useImperativeHandle as Et, useState as bt, forwardRef as yt, useRef as St } from "react";
18
- import { useLexicalComposerContext as L } from "@lexical/react/LexicalComposerContext";
19
- import { $setBlocksType as Tt } from "@lexical/selection";
20
- import { addClassNamesToElement as Ae, mergeRegister as de } from "@lexical/utils";
21
- import { LexicalTypeaheadMenuPlugin as Rt } from "@lexical/react/LexicalTypeaheadMenuPlugin";
22
- import * as Nt from "react-dom";
23
- import { HorizontalRulePlugin as Ct } from "@lexical/react/LexicalHorizontalRulePlugin";
24
- import { LinkPlugin as Ot } from "@lexical/react/LexicalLinkPlugin";
25
- import { ListPlugin as kt } from "@lexical/react/LexicalListPlugin";
26
- import { ContentEditable as $t } from "@lexical/react/LexicalContentEditable";
27
- import It from "katex";
28
- import { TreeView as vt } from "@lexical/react/LexicalTreeView";
29
- import { FileSpreadsheet as wt, FileCode as Pt, FileChartLine as Lt, FileJson as Mt, FileText as Dt, FileCog as At, FileImage as Ft, FileArchive as qt, File as Ht, X as jt } from "lucide-react";
30
- import { T as Bt } from "./tooltip-Gm7PLwZG.js";
31
- const Ut = ie($t);
32
- function Fe(n) {
33
- const e = C(7), {
34
- onRef: t,
35
- fullWidth: r,
36
- padding: o
37
- } = n, i = r === void 0 ? !1 : r, l = i ? "flex-start" : "center", a = i ? "100%" : "720px";
38
- let c;
39
- e[0] !== a ? (c = /* @__PURE__ */ s(Ut, { height: "fit-content", minH: "100%", width: "100%", maxWidth: a, textStyle: "paragraph/M/regular", position: "relative", outline: "none" }), e[0] = a, e[1] = c) : c = e[1];
40
- let d;
41
- return e[2] !== t || e[3] !== o || e[4] !== l || e[5] !== c ? (d = /* @__PURE__ */ s(V, { className: "rich-text", height: "100%", overflow: "auto", position: "relative", children: /* @__PURE__ */ s(V, { ref: t, width: "100%", padding: o, justifyContent: l, children: c }) }), e[2] = t, e[3] = o, e[4] = l, e[5] = c, e[6] = d) : d = e[6], d;
42
- }
43
- const Jt = (n) => {
44
- const e = n.split(".").pop()?.toLowerCase() ?? "";
45
- return ["csv", "tsv", "xlsx", "xls", "parquet"].includes(e) ? wt : ["sql", "py", "js", "ts", "jsx", "tsx", "java", "cpp", "c", "h", "css", "scss", "sass", "php", "rb", "go", "rs", "kt", "swift"].includes(e) ? Pt : ["json", "jsonl", "ndjson"].includes(e) ? n.includes("/visualizations/") ? Lt : Mt : ["md", "txt", "rst", "org", "pdf", "doc", "docx", "rtf"].includes(e) ? Dt : ["yaml", "yml", "toml", "ini", "conf", "config"].includes(e) ? At : ["png", "jpg", "jpeg", "gif", "svg", "webp", "ico"].includes(e) ? Ft : ["zip", "tar", "gz", "rar", "7z"].includes(e) ? qt : Ht;
46
- }, Wt = {
47
- sm: {
48
- container: {
49
- height: "20px",
50
- lineHeight: {
51
- base: "20px"
52
- },
53
- px: "2xs"
54
- },
55
- iconSize: 12,
56
- textStyle: "xs"
57
- },
58
- md: {
59
- container: {
60
- height: "24px",
61
- lineHeight: {
62
- base: "24px"
63
- },
64
- px: "xs"
65
- },
66
- iconSize: 14,
67
- textStyle: "sm"
68
- }
69
- }, zt = {
70
- neutral: {
71
- color: "color.primary",
72
- bg: "bg.muted",
73
- _hover: {
74
- bg: "bg.emphasized"
75
- }
76
- },
77
- accent: {
78
- color: "var(--schub-foreground-accent)",
79
- bg: "var(--schub-accent-subtle)",
80
- _hover: {
81
- bg: "var(--schub-accent-subtle)"
82
- }
83
- }
84
- }, Kt = "md", Vt = "neutral", qe = (n) => {
85
- const e = C(39);
86
- let t, r, o, i, l, a, c;
87
- e[0] !== n ? ({
88
- fileName: t,
89
- onSelect: i,
90
- onRemove: o,
91
- size: a,
92
- tone: c,
93
- icon: r,
94
- ...l
95
- } = n, e[0] = n, e[1] = t, e[2] = r, e[3] = o, e[4] = i, e[5] = l, e[6] = a, e[7] = c) : (t = e[1], r = e[2], o = e[3], i = e[4], l = e[5], a = e[6], c = e[7]);
96
- const d = a === void 0 ? Kt : a, h = c === void 0 ? Vt : c;
97
- let f;
98
- e[8] !== t ? (f = Jt(t), e[8] = t, e[9] = f) : f = e[9];
99
- const _ = f, u = Wt[d], m = zt[h], g = i ? "pointer" : "default";
100
- let y;
101
- e[10] !== t || e[11] !== i ? (y = (O) => {
102
- O.stopPropagation(), i?.(t);
103
- }, e[10] = t, e[11] = i, e[12] = y) : y = e[12];
104
- let E;
105
- e[13] !== _ || e[14] !== r || e[15] !== u.iconSize ? (E = r ?? /* @__PURE__ */ s(_, { size: u.iconSize }), e[13] = _, e[14] = r, e[15] = u.iconSize, e[16] = E) : E = e[16];
106
- let R;
107
- e[17] !== E ? (R = /* @__PURE__ */ s(ie.span, { mr: "xs", display: "inline-flex", children: E }), e[17] = E, e[18] = R) : R = e[18];
108
- let S;
109
- e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = {
110
- base: "14rem"
111
- }, e[19] = S) : S = e[19];
112
- let T;
113
- e[20] !== t || e[21] !== u.textStyle ? (T = /* @__PURE__ */ s(I, { maxW: S, textOverflow: "ellipsis", whiteSpace: "nowrap", overflow: "hidden", textStyle: u.textStyle, children: t }), e[20] = t, e[21] = u.textStyle, e[22] = T) : T = e[22];
114
- let x;
115
- e[23] !== t || e[24] !== T ? (x = /* @__PURE__ */ s(Bt, { content: t, children: T }), e[23] = t, e[24] = T, e[25] = x) : x = e[25];
116
- let N;
117
- e[26] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ s(rt, {}), e[26] = N) : N = e[26];
118
- let b;
119
- e[27] !== t || e[28] !== o ? (b = o && /* @__PURE__ */ s(ot, { "aria-label": "Remove reference", size: "2xs", ml: "xs", variant: "ghost", _hover: {
120
- bg: "transparent"
121
- }, onClick: (O) => {
122
- O.stopPropagation(), o?.(t);
123
- }, children: /* @__PURE__ */ s(jt, { size: 12 }) }), e[27] = t, e[28] = o, e[29] = b) : b = e[29];
124
- let p;
125
- return e[30] !== l || e[31] !== u.container || e[32] !== b || e[33] !== g || e[34] !== y || e[35] !== R || e[36] !== x || e[37] !== m ? (p = /* @__PURE__ */ P(ie.span, { display: "flex", flexDirection: "row", alignItems: "center", borderRadius: "xs", gap: "2xs", cursor: g, ...m, ...u.container, onClick: y, ...l, children: [
126
- R,
127
- x,
128
- N,
129
- b
130
- ] }), e[30] = l, e[31] = u.container, e[32] = b, e[33] = g, e[34] = y, e[35] = R, e[36] = x, e[37] = m, e[38] = p) : p = e[38], p;
131
- };
132
- let ne = class le extends G {
133
- __href;
134
- __label;
135
- static getType() {
136
- return "reference-link";
137
- }
138
- static clone(e) {
139
- return new le(e.__href, e.__label, e.__key);
140
- }
141
- constructor(e, t, r) {
142
- super(r), this.__href = e, this.__label = t;
143
- }
144
- createDOM(e, t) {
145
- return document.createElement("span");
146
- }
147
- updateDOM(e, t, r) {
148
- return !1;
149
- }
150
- getTextContent() {
151
- return `{{link('${this.__label ?? this.__href}')}}`;
152
- }
153
- exportJSON() {
154
- return {
155
- type: le.getType(),
156
- version: 1,
157
- href: this.__href,
158
- label: this.__label
159
- };
160
- }
161
- static importJSON(e) {
162
- return He(e.href, e.label);
163
- }
164
- decorate(e, t) {
165
- const r = this.__href, i = r.split("/").pop() || "unknown", l = /^https?:\/\//i.test(r), a = /^#?\$PROJECT\//i.test(r);
166
- return /* @__PURE__ */ s(v, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ s(qe, { fileName: i, onSelect: () => {
167
- if (l)
168
- window.open(r, "_blank", "noopener,noreferrer");
169
- else if (a) {
170
- const c = r.replace(/^#?\$PROJECT\//i, ""), d = new CustomEvent("ui:open-project-file", {
171
- detail: c
172
- });
173
- window.dispatchEvent(d);
174
- } else
175
- window.location.assign(r);
176
- } }) });
177
- }
178
- };
179
- function He(n, e) {
180
- return new ne(n, e);
181
- }
182
- function Xt(n) {
183
- return n instanceof ne;
184
- }
185
- const _e = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, Gt = {
186
- dependencies: [ne],
187
- export: (n) => {
188
- if (Xt(n)) {
189
- const e = n.__href, t = n.__label ?? e;
190
- return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
191
- }
192
- return null;
193
- },
194
- regExp: _e,
195
- importRegExp: _e,
196
- replace: (n, e) => {
197
- const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
198
- n.replace(He(o, i));
199
- },
200
- type: "text-match"
201
- }, ue = {
202
- code: "rich-text__code",
203
- codeHighlight: {
204
- atrule: "rich-text__tokenAttr",
205
- attr: "rich-text__tokenAttr",
206
- boolean: "rich-text__tokenProperty",
207
- builtin: "rich-text__tokenSelector",
208
- cdata: "rich-text__tokenComment",
209
- char: "rich-text__tokenSelector",
210
- class: "rich-text__tokenFunction",
211
- "class-name": "rich-text__tokenFunction",
212
- comment: "rich-text__tokenComment",
213
- constant: "rich-text__tokenProperty",
214
- deleted: "rich-text__tokenProperty",
215
- doctype: "rich-text__tokenComment",
216
- entity: "rich-text__tokenOperator",
217
- function: "rich-text__tokenFunction",
218
- important: "rich-text__tokenVariable",
219
- inserted: "rich-text__tokenSelector",
220
- keyword: "rich-text__tokenAttr",
221
- namespace: "rich-text__tokenVariable",
222
- number: "rich-text__tokenProperty",
223
- operator: "rich-text__tokenOperator",
224
- prolog: "rich-text__tokenComment",
225
- property: "rich-text__tokenProperty",
226
- punctuation: "rich-text__tokenPunctuation",
227
- regex: "rich-text__tokenVariable",
228
- selector: "rich-text__tokenSelector",
229
- string: "rich-text__tokenSelector",
230
- symbol: "rich-text__tokenProperty",
231
- tag: "rich-text__tokenProperty",
232
- url: "rich-text__tokenOperator",
233
- variable: "rich-text__tokenVariable"
234
- },
235
- embedBlock: {
236
- base: "rich-text__embedBlock",
237
- focus: "rich-text__embedBlockFocus"
238
- },
239
- list: {
240
- checklist: "rich-text__checklist",
241
- listitem: "rich-text__listItem",
242
- listitemChecked: "rich-text__listItemChecked",
243
- listitemUnchecked: "rich-text__listItemUnchecked",
244
- nested: {
245
- listitem: "rich-text__nestedListItem"
246
- },
247
- olDepth: ["rich-text__ol1", "rich-text__ol2", "rich-text__ol3", "rich-text__ol4", "rich-text__ol5"],
248
- ol: "rich-text__ol",
249
- ul: "rich-text__ul"
250
- },
251
- heading: {
252
- h1: "rich-text__h1",
253
- h2: "rich-text__h2",
254
- h3: "rich-text__h3"
255
- },
256
- paragraph: "rich-text__p",
257
- text: {
258
- underline: "rich-text__textUnderline",
259
- italic: "rich-text__textItalic",
260
- code: "rich-text__textCode"
261
- },
262
- link: "rich-text__link",
263
- quote: "rich-text__quote",
264
- reference: "rich-text__reference",
265
- table: "rich-text__table",
266
- tableCell: "rich-text__tableCell",
267
- tableRow: "rich-text__tableRow",
268
- tableCellHeader: "rich-text__tableCellHeader",
269
- layoutContainer: "rich-text__layoutContainer",
270
- layoutItem: "rich-text__layoutItem",
271
- draggableBlockDemo: {
272
- row: "rich-text__row",
273
- content: "rich-text__content"
274
- }
275
- }, Yt = (n) => n == null ? "-" : typeof n == "string" ? n.length ? n : "-" : typeof n == "number" || typeof n == "boolean" ? String(n).toUpperCase() : n instanceof Date ? n.toISOString() : JSON.stringify(n), Qt = (n) => {
276
- const e = C(6), {
277
- defaultCode: t,
278
- isEditable: r,
279
- showLineNumbers: o,
280
- disableScroll: i
281
- } = n, l = t === void 0 ? "" : t, a = r === void 0 ? !1 : r, c = o === void 0 ? !1 : o, d = i === void 0 ? !1 : i;
282
- if (a) {
283
- let f;
284
- return e[0] !== l ? (f = /* @__PURE__ */ s(it, { defaultValue: l, fontFamily: "mono", fontSize: "sm", resize: "vertical", minHeight: "100%" }), e[0] = l, e[1] = f) : f = e[1], f;
285
- }
286
- let h;
287
- if (e[2] !== l || e[3] !== d || e[4] !== c) {
288
- const f = c ? l.split(`
289
- `) : [l];
290
- h = /* @__PURE__ */ s(v, { as: "pre", margin: 0, padding: "sm", fontFamily: "mono", fontSize: "sm", lineHeight: "1.5", overflowY: d ? "hidden" : "auto", background: "bg.muted", borderRadius: "md", width: "100%", children: c ? /* @__PURE__ */ s(v, { as: "code", display: "grid", gridTemplateColumns: "auto 1fr", columnGap: "sm", children: f.map(en) }) : /* @__PURE__ */ s(v, { as: "code", children: l }) }), e[2] = l, e[3] = d, e[4] = c, e[5] = h;
291
- } else
292
- h = e[5];
293
- return h;
294
- }, Zt = (n) => {
295
- const e = C(26), {
296
- data: t,
297
- fullWidth: r,
298
- noBorder: o,
299
- hiddenColumns: i
300
- } = n, l = r === void 0 ? !1 : r, a = o === void 0 ? !1 : o;
301
- let c;
302
- e[0] !== i ? (c = i === void 0 ? [] : i, e[0] = i, e[1] = c) : c = e[1];
303
- const d = c;
304
- if (!t.length) {
305
- const x = a ? "0" : "1px";
306
- let N;
307
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ s(I, { textStyle: "label/S/regular", color: "fg.muted", children: "No data" }), e[2] = N) : N = e[2];
308
- let b;
309
- return e[3] !== x ? (b = /* @__PURE__ */ s(v, { padding: "sm", borderWidth: x, borderColor: "border.muted", children: N }), e[3] = x, e[4] = b) : b = e[4], b;
310
- }
311
- let h;
312
- e[5] !== d ? (h = new Set(d), e[5] = d, e[6] = h) : h = e[6];
313
- const f = h;
314
- let _;
315
- e[7] !== t[0] ? (_ = Object.keys(t[0] ?? {}), e[7] = t[0], e[8] = _) : _ = e[8];
316
- let u;
317
- e[9] !== f || e[10] !== _ ? (u = _.filter((x) => !f.has(x)), e[9] = f, e[10] = _, e[11] = u) : u = e[11];
318
- const m = u, g = l ? "100%" : "fit-content", y = a ? "0" : "1px";
319
- let E;
320
- e[12] !== m ? (E = /* @__PURE__ */ s(A.Header, { children: /* @__PURE__ */ s(A.Row, { background: "bg.muted", children: m.map(tn) }) }), e[12] = m, e[13] = E) : E = e[13];
321
- let R;
322
- if (e[14] !== m || e[15] !== t) {
323
- let x;
324
- e[17] !== m ? (x = (N, b) => /* @__PURE__ */ s(A.Row, { children: m.map((p) => /* @__PURE__ */ s(A.Cell, { paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ s(I, { textStyle: "paragraph/S/regular", children: Yt(N[p]) }) }, `${b}-${p}`)) }, `${b}-${m.join("-")}`), e[17] = m, e[18] = x) : x = e[18], R = t.map(x), e[14] = m, e[15] = t, e[16] = R;
325
- } else
326
- R = e[16];
327
- let S;
328
- e[19] !== R ? (S = /* @__PURE__ */ s(A.Body, { children: R }), e[19] = R, e[20] = S) : S = e[20];
329
- let T;
330
- return e[21] !== S || e[22] !== g || e[23] !== y || e[24] !== E ? (T = /* @__PURE__ */ s(A.ScrollArea, { overflowX: "auto", maxWidth: "100%", children: /* @__PURE__ */ P(A.Root, { size: "sm", width: g, borderWidth: y, borderColor: "border.muted", children: [
331
- E,
332
- S
333
- ] }) }), e[21] = S, e[22] = g, e[23] = y, e[24] = E, e[25] = T) : T = e[25], T;
334
- };
335
- function en(n, e) {
336
- return /* @__PURE__ */ P(v, { as: "span", display: "contents", children: [
337
- /* @__PURE__ */ s(I, { as: "span", color: "fg.muted", textAlign: "right", children: e + 1 }),
338
- /* @__PURE__ */ s(I, { as: "span", children: n.length ? n : " " })
339
- ] }, `${e}-${n}`);
340
- }
341
- function tn(n) {
342
- return /* @__PURE__ */ s(A.ColumnHeader, { textTransform: "none", paddingX: "xs", paddingY: "2xs", children: /* @__PURE__ */ s(I, { textStyle: "label/S/medium", children: n }) }, n);
343
- }
344
- class H extends G {
345
- __data;
346
- static getType() {
347
- return "data_table";
348
- }
349
- static clone(e) {
350
- return new H(e.__data, e.__key);
351
- }
352
- constructor(e, t) {
353
- super(t), this.__data = e;
354
- }
355
- getData() {
356
- return this.__data;
357
- }
358
- createDOM() {
359
- return document.createElement("div");
360
- }
361
- updateDOM() {
362
- return !1;
363
- }
364
- decorate() {
365
- return /* @__PURE__ */ s(Zt, { fullWidth: !0, isReadOnly: !0, data: this.__data });
366
- }
367
- exportJSON() {
368
- return {
369
- type: "data_table",
370
- version: 1,
371
- data: this.__data
372
- };
373
- }
374
- static importJSON(e) {
375
- return new H(e.data);
376
- }
377
- getTextContent() {
378
- if (!this.__data.length) return "";
379
- const e = Object.keys(this.__data[0]), t = e.join(" | "), r = e.map(() => "---").join(" | "), o = this.__data.map((i) => e.map((l) => String(i[l] || "")).join(" | "));
380
- return [t, r, ...o].join(`
381
- `);
382
- }
383
- }
384
- function he(n) {
385
- return new H(n);
386
- }
387
- function ge(n) {
388
- return n instanceof H;
389
- }
390
- class K extends G {
391
- __language;
392
- __code;
393
- static getType() {
394
- return "codeblock";
395
- }
396
- static clone(e) {
397
- return new K(e.__language, e.__code, e.__key);
398
- }
399
- constructor(e, t, r) {
400
- super(r), this.__language = e, this.__code = t;
401
- }
402
- createDOM() {
403
- return document.createElement("div");
404
- }
405
- updateDOM() {
406
- return !1;
407
- }
408
- static importJSON(e) {
409
- const {
410
- language: t,
411
- code: r
412
- } = e;
413
- return new K(t, r);
414
- }
415
- decorate() {
416
- return /* @__PURE__ */ s(v, { borderRadius: "md", overflow: "hidden", children: /* @__PURE__ */ s(Qt, { language: this.__language || "plaintext", defaultCode: this.__code, isEditable: !1, showLineNumbers: !0, disableScroll: !0 }) });
417
- }
418
- }
419
- const nn = gt.lazy(() => import("./EquationComponent-DeDYHvqY.js"));
420
- function xe(n) {
421
- let e = n.getAttribute("data-lexical-equation");
422
- const t = n.getAttribute("data-lexical-inline") === "true";
423
- return e = atob(e || ""), e ? {
424
- node: re(e, t)
425
- } : null;
426
- }
427
- class q extends G {
428
- __equation;
429
- __inline;
430
- static getType() {
431
- return "equation";
432
- }
433
- static clone(e) {
434
- return new q(e.__equation, e.__inline, e.__key);
435
- }
436
- constructor(e, t, r) {
437
- super(r), this.__equation = e, this.__inline = t ?? !1;
438
- }
439
- static importJSON(e) {
440
- return re(e.equation, e.inline);
441
- }
442
- exportJSON() {
443
- return {
444
- equation: this.getEquation(),
445
- inline: this.__inline,
446
- type: "equation",
447
- version: 1
448
- };
449
- }
450
- createDOM(e) {
451
- const t = document.createElement(this.__inline ? "span" : "div");
452
- return t.className = "editor-equation", t;
453
- }
454
- exportDOM() {
455
- const e = document.createElement(this.__inline ? "span" : "div"), t = btoa(this.__equation);
456
- return e.setAttribute("data-lexical-equation", t), e.setAttribute("data-lexical-inline", `${this.__inline}`), It.render(this.__equation, e, {
457
- displayMode: !this.__inline,
458
- // true === block display //
459
- errorColor: "#cc0000",
460
- output: "html",
461
- strict: "warn",
462
- throwOnError: !1,
463
- trust: !1
464
- }), {
465
- element: e
466
- };
467
- }
468
- static importDOM() {
469
- return {
470
- div: (e) => e.hasAttribute("data-lexical-equation") ? {
471
- conversion: xe,
472
- priority: 2
473
- } : null,
474
- span: (e) => e.hasAttribute("data-lexical-equation") ? {
475
- conversion: xe,
476
- priority: 1
477
- } : null
478
- };
479
- }
480
- updateDOM(e) {
481
- return this.__inline !== e.__inline;
482
- }
483
- getTextContent() {
484
- return this.__equation;
485
- }
486
- getEquation() {
487
- return this.__equation;
488
- }
489
- setEquation(e) {
490
- const t = this.getWritable();
491
- t.__equation = e;
492
- }
493
- isInline() {
494
- return this.__inline;
495
- }
496
- decorate() {
497
- return /* @__PURE__ */ s(xt, { fallback: null, children: /* @__PURE__ */ s(nn, { equation: this.__equation, inline: this.__inline }) });
498
- }
499
- }
500
- function re(n = "", e = !1) {
501
- const t = new q(n, e);
502
- return lt(t);
503
- }
504
- function je(n) {
505
- return n instanceof q;
506
- }
507
- const Be = {
508
- dependencies: [q],
509
- export: (n) => je(n) && n.isInline() ? `\\( ${n.getEquation().trim()} \\)` : null,
510
- importRegExp: /\\\((.*?)\\\)/,
511
- regExp: /\\\((.*?)\\\)/,
512
- replace: (n, e) => {
513
- const t = re(e[1].trim(), !0);
514
- n.replace(t);
515
- },
516
- type: "text-match"
517
- }, Ue = {
518
- dependencies: [q],
519
- regExpStart: /\\\[/,
520
- regExpEnd: /\\]/,
521
- export: (n) => je(n) && !n.isInline() ? `\\[ ${n.getEquation().trim()} \\]` : null,
522
- replace: (n, e, t, r, o) => o ? (n.append(re(o.join(" "), !1)), !0) : !1,
523
- type: "multiline-element"
524
- };
525
- function rn() {
526
- return null;
527
- }
528
- class B extends $e {
529
- static getType() {
530
- return "hr";
531
- }
532
- static clone(e) {
533
- return new B(e?.__key);
534
- }
535
- static importJSON(e) {
536
- return Je();
537
- }
538
- exportJSON() {
539
- return {
540
- ...super.exportJSON()
541
- };
542
- }
543
- createDOM(e, t) {
544
- const r = document.createElement("hr");
545
- return r.style = "margin: 2rem 0;", r;
546
- }
547
- updateDOM(e, t, r) {
548
- return !1;
549
- }
550
- decorate(e) {
551
- return null;
552
- }
553
- }
554
- function Je() {
555
- return new B();
556
- }
557
- function on(n) {
558
- return n instanceof B;
559
- }
560
- const sn = {
561
- dependencies: [B],
562
- export: (n) => on(n) ? "***" : null,
563
- regExp: /^(---|\*\*\*|___)\s?$/,
564
- replace: (n) => {
565
- const e = Je();
566
- n.replace(e);
567
- },
568
- type: "element"
569
- }, ln = {
570
- dependencies: [],
571
- export: (n, e) => {
572
- if (ge(n)) {
573
- const t = n.getData();
574
- if (!t.length) return "";
575
- const r = Object.keys(t[0]), o = r.join(" | "), i = r.map(() => "---").join(" | "), l = t.map((a) => r.map((c) => String(a[c] || "")).join(" | "));
576
- return [`| ${o} |`, `| ${i} |`, ...l.map((a) => `| ${a} |`)].join(`
577
- `);
578
- }
579
- return null;
580
- },
581
- regExp: /^\s*(\|.+\|)\s*$/,
582
- replace: (n, e, t, r) => {
583
- const o = n.getPreviousSibling();
584
- if (/^\|?\s*:?-{3,}:?\s*(?:\|\s*:?-{3,}:?\s*)*\|?$/gm.test(t[0])) {
585
- n.remove();
586
- return;
587
- }
588
- const l = t[0].split("|").slice(1, -1).map((a) => a.trim());
589
- if (o?.getType() === "data_table" && ge(o)) {
590
- const a = o.getData(), c = {}, d = a.length === 1 && Object.values(a[0]).every((u) => u === ""), h = a.length > 0 ? Object.keys(a[0]) : l.map((u, m) => `col_${m}`);
591
- l.forEach((u, m) => {
592
- const g = h[m] || `col_${m}`;
593
- c[g] = u;
594
- });
595
- const f = d ? [c] : [...a, c], _ = he(f);
596
- o.replace(_), n.remove();
597
- } else {
598
- const a = {};
599
- l.forEach((d, h) => {
600
- a[d || `col_${h}`] = "";
601
- });
602
- const c = he([a]);
603
- n.replace(c);
604
- }
605
- },
606
- type: "element"
607
- }, cn = {
608
- dependencies: [ee],
609
- export: (n, e) => {
610
- if (n instanceof ee) {
611
- let t = n.getTextContent();
612
- if (n.hasFormat("bold"))
613
- t = `**${t}**`;
614
- else if (n.hasFormat("italic"))
615
- t = `*${t}*`;
616
- else if (n.hasFormat("underline"))
617
- t = `<ins>${t}</ins>`;
618
- else
619
- return null;
620
- return t;
621
- }
622
- return null;
623
- },
624
- regExp: /<ins>(.*)<\/ins>/,
625
- importRegExp: /<ins>(.*)<\/ins>/,
626
- replace: (n, e) => {
627
- const t = Ie(e[1]);
628
- t.toggleFormat("underline"), n.replace(t);
629
- },
630
- type: "text-match"
631
- }, an = {
632
- dependencies: [ee],
633
- export: (n, e) => null,
634
- regExp: /<u>(.*)<\/u>/,
635
- importRegExp: /<u>(.*)<\/u>/,
636
- replace: (n, e) => {
637
- const t = Ie(e[1]);
638
- t.toggleFormat("underline"), n.replace(t);
639
- },
640
- type: "text-match"
641
- }, We = [ln, sn, cn, an], Wr = [Oe, Se, H, ke, Te, Re, ae, K, q, B, ne], zr = [...Ne, ...We, Be, Ue, Gt], Kr = ue;
642
- function dn() {
643
- const n = C(3), [e] = L();
644
- let t, r;
645
- return n[0] !== e ? (t = () => {
646
- e.update(un);
647
- }, r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), F(t, r), null;
648
- }
649
- function un() {
650
- const n = ct(ae);
651
- for (const e of n) {
652
- const t = e.getLanguage() ?? "plaintext", r = e.getTextContent();
653
- e.replace(new K(t, r));
654
- }
655
- }
656
- function ze(n) {
657
- const e = C(4), {
658
- isEditable: t
659
- } = n, [r] = L();
660
- let o, i;
661
- return e[0] !== r || e[1] !== t ? (o = () => {
662
- r.setEditable(t);
663
- }, i = [t, r], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), F(o, i), null;
664
- }
665
- function Ke() {
666
- const n = C(2), [e] = L();
667
- let t;
668
- return n[0] !== e ? (t = /* @__PURE__ */ s(v, { fontSize: "xs", color: "fg.muted", padding: "4", children: /* @__PURE__ */ s(vt, { treeTypeButtonClassName: "debug-treetype-button", timeTravelButtonClassName: "debug-timetravel-button", timeTravelPanelButtonClassName: "debug-timetravel-button", timeTravelPanelClassName: "debug-timetravel-panel", timeTravelPanelSliderClassName: "debug-timetravel-slider", viewClassName: "tree-view-output", editor: e }) }), n[0] = e, n[1] = t) : t = n[1], t;
669
- }
670
- const mn = /^---\s*\n([\s\S]*?)\n---\s*(?:\n|$)/;
671
- function fn(n) {
672
- const e = n.match(mn);
673
- return e ? {
674
- frontmatter: e[0],
675
- body: n.slice(e[0].length)
676
- } : {
677
- frontmatter: "",
678
- body: n
679
- };
680
- }
681
- const pn = "UPLOAD_FILE", _n = "OPEN_CONTEXT", hn = "RUN_PROMPT", gn = "UPDATE_FORMAT", xn = "UPDATE_BEHAVIOR", En = "INSERT_PROMPT", bn = "RENAME_PROMPT", yn = "DUPLICATE_PROMPT", Sn = "DELETE_PROMPT", Tn = "DELETE_REFERENCES", Rn = "RENAME_REFERENCES", Nn = "INSERT_REFERENCE", Cn = "INSERT_BLOCK";
682
- k(pn);
683
- k(_n);
684
- k(hn);
685
- k(gn);
686
- k(xn);
687
- k(En);
688
- k(bn);
689
- k(yn);
690
- k(Sn);
691
- k(Tn);
692
- k(Rn);
693
- const Ve = k(Nn), On = k(Cn), kn = "INSERT_NEW_FILE_PLACEHOLDER", $n = "INSERT_NEW_TEXT_PLACEHOLDER", In = "INSERT_PLACEHOLDER_REFERENCE";
694
- k(kn);
695
- k($n);
696
- k(In);
697
- function vn(n) {
698
- const e = te();
699
- return n.style !== null && e.setFormat(n.style.textAlign), {
700
- node: e
701
- };
702
- }
703
- class Y extends $e {
704
- static getType() {
705
- return "comment";
706
- }
707
- static clone(e) {
708
- return new Y(e.__key);
709
- }
710
- createDOM(e) {
711
- const t = document.createElement("blockquote");
712
- return Ae(t, e.theme.comment), t;
713
- }
714
- updateDOM() {
715
- return !1;
716
- }
717
- static importDOM() {
718
- return {
719
- blockquote: () => ({
720
- conversion: vn,
721
- priority: 0
722
- })
723
- };
724
- }
725
- exportDOM(e) {
726
- const {
727
- element: t
728
- } = super.exportDOM(e);
729
- if (t && at(t)) {
730
- this.isEmpty() && t.append(document.createElement("br"));
731
- const r = this.getFormatType();
732
- t.style.textAlign = r;
733
- const o = this.getDirection();
734
- o && (t.dir = o);
735
- }
736
- return {
737
- element: t
738
- };
739
- }
740
- static importJSON(e) {
741
- const t = te();
742
- return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
743
- }
744
- exportJSON() {
745
- return {
746
- ...super.exportJSON(),
747
- type: "comment"
748
- };
749
- }
750
- getTextContent() {
751
- return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
752
- }
753
- // mutation
754
- insertNewAfter(e, t) {
755
- const r = se(), o = this.getDirection();
756
- return r.setDirection(o), this.insertAfter(r, t), r;
757
- }
758
- collapseAtStart() {
759
- const e = se();
760
- return this.getChildren().forEach((r) => {
761
- e.append(r);
762
- }), this.replace(e), !0;
763
- }
764
- }
765
- function te() {
766
- return new Y();
767
- }
768
- const wn = (n, e) => {
769
- const t = dt(), r = te();
770
- if (e) {
771
- e.getParent()?.replace(r, !0), e.remove(), r.selectEnd();
772
- return;
773
- }
774
- ut(t) && Tt(t, te);
775
- };
776
- function Pn() {
777
- const n = C(3), [e] = L();
778
- let t, r;
779
- return n[0] !== e ? (t = () => de(e.registerCommand(On, Ln, ve)), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), F(t, r), null;
780
- }
781
- function Ln(n) {
782
- const {
783
- optionId: e,
784
- nodeToReplace: t
785
- } = n;
786
- return wn(e, t), !1;
787
- }
788
- const Mn = () => {
789
- const n = C(3), [e] = L();
790
- let t, r;
791
- n[0] !== e ? (t = () => de(e.registerNodeTransform(Y, (o) => {
792
- const l = o.getChildren().filter(Dn);
793
- l.length > 0 && e.update(() => {
794
- l.forEach(An);
795
- });
796
- })), r = [e], n[0] = e, n[1] = t, n[2] = r) : (t = n[1], r = n[2]), F(t, r);
797
- };
798
- function Dn(n) {
799
- return n.getType() === "comment";
800
- }
801
- function An(n) {
802
- n.replace(se(), !0);
803
- }
804
- function Fn() {
805
- return Mn(), Pn(), null;
806
- }
807
- const qn = (n) => {
808
- let e = "";
809
- const t = n.getChildren(), r = t.length;
810
- for (let o = 0; o < r; o++) {
811
- const i = t[o];
812
- e += i.getTextContent(), mt(i) && o !== r - 1 && !i.isInline() && (e += `
813
- `);
814
- }
815
- return e;
816
- }, Hn = (n) => n.type !== "reference" ? null : `#${n.name ?? n.referenceId ?? ""}`, jn = (n) => n.type === "paragraph" && !!n.children?.length, Xe = (n) => {
817
- if (n.type === "comment")
818
- return "";
819
- const e = Hn(n);
820
- if (e !== null)
821
- return e;
822
- let t = typeof n.text == "string" ? n.text : "";
823
- const r = n.children;
824
- if (!Array.isArray(r)) return t;
825
- const o = r.length;
826
- for (let i = 0; i < o; i += 1) {
827
- const l = r[i];
828
- if (l.type === "comment") {
829
- i !== o - 1 && (t += `
830
- `);
831
- continue;
832
- }
833
- t += Xe(l), jn(l) && (t += `
834
- `);
835
- }
836
- return t;
837
- }, Ge = (n) => {
838
- try {
839
- const e = JSON.parse(n);
840
- return Xe(e.root ?? {});
841
- } catch {
842
- return "";
843
- }
844
- }, Bn = {
845
- root: {
846
- direction: "ltr",
847
- format: "",
848
- indent: 0,
849
- type: "root",
850
- version: 1,
851
- children: [{
852
- type: "paragraph",
853
- version: 1,
854
- format: "",
855
- indent: 0,
856
- textFormat: void 0,
857
- direction: null,
858
- children: []
859
- }]
860
- }
861
- };
862
- function Un(n = "") {
863
- return n.trim() ? {
864
- root: {
865
- direction: "ltr",
866
- format: "",
867
- indent: 0,
868
- type: "root",
869
- version: 1,
870
- children: n.split(/\r?\n/).map((r) => ({
871
- type: "paragraph",
872
- version: 1,
873
- format: "",
874
- indent: 0,
875
- textFormat: void 0,
876
- direction: null,
877
- children: r ? [{
878
- type: "text",
879
- version: 1,
880
- text: r,
881
- format: "",
882
- detail: 0,
883
- mode: "normal",
884
- style: ""
885
- }] : []
886
- }))
887
- }
888
- } : JSON.parse(JSON.stringify(Bn));
889
- }
890
- function Jn(n) {
891
- const e = C(4), {
892
- editorRef: t,
893
- previousTextRef: r
894
- } = n, [o] = L();
895
- let i, l;
896
- return e[0] !== o || e[1] !== r ? (i = () => ({
897
- setEditorValue: (a) => {
898
- const c = o.parseEditorState(JSON.stringify(Un(a)));
899
- o.setEditorState(c), r.current = Ge(a), o.focus(void 0, {
900
- defaultSelection: "rootEnd"
901
- });
902
- }
903
- }), l = [o, r], e[0] = o, e[1] = r, e[2] = i, e[3] = l) : (i = e[2], l = e[3]), Et(t, i, l), null;
904
- }
905
- const Wn = (n) => n.key !== "Enter" ? !1 : !n.ctrlKey && !n.metaKey && !n.shiftKey && !n.altKey;
906
- function zn(n) {
907
- const e = C(4), {
908
- onSubmit: t
909
- } = n, [r] = L();
910
- let o, i;
911
- return e[0] !== r || e[1] !== t ? (o = () => r.registerCommand(ft, (l) => Wn(l) ? (l.preventDefault(), t?.(), !0) : !1, pt), i = [r, t], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), F(o, i), null;
912
- }
913
- const Ee = ["table", "connector"], Kn = (n) => n.sort((r, o) => Ee.indexOf(r.group) - Ee.indexOf(o.group)).map((r, o) => ({
914
- ...r,
915
- index: o
916
- })).reduce((r, o) => {
917
- const i = r[o.group] ?? [];
918
- return i.push(o), r[o.group] = i, r;
919
- }, {});
920
- function be(n) {
921
- const e = C(19), {
922
- id: t,
923
- isSelected: r,
924
- onClick: o,
925
- onMouseEnter: i,
926
- setRefElement: l,
927
- secondaryLabel: a,
928
- primaryLabel: c,
929
- tabIndex: d
930
- } = n, h = d === void 0 ? -1 : d, f = r ? "bg.muted" : "transparent";
931
- let _;
932
- e[0] !== c ? (_ = /* @__PURE__ */ s(Z.Trigger, { children: /* @__PURE__ */ s(I, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: c }) }), e[0] = c, e[1] = _) : _ = e[1];
933
- let u;
934
- e[2] !== c ? (u = /* @__PURE__ */ s(Z.Positioner, { children: /* @__PURE__ */ s(Z.Content, { children: c }) }), e[2] = c, e[3] = u) : u = e[3];
935
- let m;
936
- e[4] !== _ || e[5] !== u ? (m = /* @__PURE__ */ P(Z.Root, { children: [
937
- _,
938
- u
939
- ] }), e[4] = _, e[5] = u, e[6] = m) : m = e[6];
940
- let g;
941
- e[7] !== a ? (g = a && /* @__PURE__ */ s(I, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: a }), e[7] = a, e[8] = g) : g = e[8];
942
- let y;
943
- return e[9] !== t || e[10] !== r || e[11] !== o || e[12] !== i || e[13] !== l || e[14] !== f || e[15] !== m || e[16] !== g || e[17] !== h ? (y = /* @__PURE__ */ P(V, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: f, tabIndex: h, ref: l, role: "option", "aria-selected": r, id: t, onMouseEnter: i, onClick: o, children: [
944
- m,
945
- g
946
- ] }), e[9] = t, e[10] = r, e[11] = o, e[12] = i, e[13] = l, e[14] = f, e[15] = m, e[16] = g, e[17] = h, e[18] = y) : y = e[18], y;
947
- }
948
- const Vn = (n) => {
949
- const e = C(12), {
950
- options: t,
951
- selectedIndex: r,
952
- onSelectItem: o,
953
- onMouseEnterItem: i
954
- } = n, {
955
- table: l,
956
- connector: a
957
- } = Kn(t), c = l === void 0 ? [] : l, d = a === void 0 ? [] : a, h = [...c, ...d].length;
958
- let f, _;
959
- e[0] !== r ? (f = () => {
960
- document.getElementById(`typeahead-item-${r}`)?.scrollIntoView({
961
- behavior: "instant",
962
- block: "nearest"
963
- });
964
- }, _ = [r], e[0] = r, e[1] = f, e[2] = _) : (f = e[1], _ = e[2]), F(f, _);
965
- const u = v, m = "1000", g = "absolute", y = "modal", E = "auto", R = "24rem";
966
- let S;
967
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (S = {
968
- base: "100vw",
969
- md: "264px"
970
- }, e[3] = S) : S = e[3];
971
- let T;
972
- e[4] !== h ? (T = !h && /* @__PURE__ */ s(I, { children: "No results" }), e[4] = h, e[5] = T) : T = e[5];
973
- const x = !!c.length && /* @__PURE__ */ P(pe, { children: [
974
- /* @__PURE__ */ s(I, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
975
- /* @__PURE__ */ s(v, { children: c.map((p) => /* @__PURE__ */ s(be, { id: `typeahead-item-${p.index}`, isSelected: r === p.index, onClick: () => o(p, p.index), onMouseEnter: () => i(p.index), primaryLabel: p.name, secondaryLabel: p.description, setRefElement: p.setRefElement, tabIndex: -1 }, p.id)) })
976
- ] }), N = !!d.length && /* @__PURE__ */ P(pe, { children: [
977
- /* @__PURE__ */ s(I, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
978
- /* @__PURE__ */ s(v, { children: d.map((p) => /* @__PURE__ */ s(be, { id: `typeahead-item-${p.index}`, isSelected: r === p.index, onClick: () => o(p, p.index), onMouseEnter: () => i(p.index), primaryLabel: p.name, secondaryLabel: p.description, setRefElement: p.setRefElement, tabIndex: -1 }, p.id)) })
979
- ] });
980
- let b;
981
- return e[6] !== u || e[7] !== T || e[8] !== x || e[9] !== N || e[10] !== S ? (b = /* @__PURE__ */ P(u, { zIndex: m, position: g, layerStyle: y, overflow: E, maxHeight: R, minWidth: S, children: [
982
- T,
983
- x,
984
- N
985
- ] }), e[6] = u, e[7] = T, e[8] = x, e[9] = N, e[10] = S, e[11] = b) : b = e[11], b;
986
- }, Xn = (n, e) => n.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
987
- function Gn(n, e = []) {
988
- const t = e.map((r, o) => ({
989
- id: r.resourceId,
990
- key: r.resourceId,
991
- index: o,
992
- group: r.resourceType,
993
- name: r.name,
994
- description: r.description,
995
- setRefElement: () => {
996
- }
997
- }));
998
- return n == null || n === "" ? t : Xn(t, n);
999
- }
1000
- const Ye = "\\.\\-<>_:", me = ["#"].join(""), Qe = `[^${me}${Ye}\\s]`, Yn = `(?:[${Ye}]|)`, Ze = 75, Qn = new RegExp(`(^|\\s|\\()([${me}]((?:${Qe}${Yn}){0,${Ze}}))$`), Zn = new RegExp(`(^|\\s|\\()([${me}]((?:${Qe}){0,${Ze}}))$`);
1001
- function er(n, e) {
1002
- let t = Qn.exec(n);
1003
- if (t === null && (t = Zn.exec(n)), t !== null) {
1004
- const r = t[1], o = t[3];
1005
- if (o.length >= e)
1006
- return {
1007
- leadOffset: t.index + r.length,
1008
- matchingString: o,
1009
- replaceableString: t[2]
1010
- };
1011
- }
1012
- return null;
1013
- }
1014
- const tr = 20;
1015
- function nr(n) {
1016
- const e = C(9), {
1017
- items: t
1018
- } = n;
1019
- let r;
1020
- e[0] !== t ? (r = t === void 0 ? [] : t, e[0] = t, e[1] = r) : r = e[1];
1021
- const o = r, [i, l] = bt(null), [a] = L(), c = Gn(i, o);
1022
- let d;
1023
- e[2] !== a ? (d = (g, y, E) => {
1024
- a.update(() => {
1025
- y && (a.dispatchCommand(Ve, {
1026
- resourceId: g.id,
1027
- resourceType: g.group,
1028
- name: g.name,
1029
- nodeToReplace: y
1030
- }), E());
1031
- });
1032
- }, e[2] = a, e[3] = d) : d = e[3];
1033
- const h = d, f = or;
1034
- let _;
1035
- e[4] !== c ? (_ = c.slice(0, tr), e[4] = c, e[5] = _) : _ = e[5];
1036
- const u = _;
1037
- let m;
1038
- return e[6] !== u || e[7] !== h ? (m = /* @__PURE__ */ s(Rt, { onQueryChange: l, onSelectOption: h, triggerFn: f, options: u, menuRenderFn: rr }), e[6] = u, e[7] = h, e[8] = m) : m = e[8], m;
1039
- }
1040
- function rr(n, e) {
1041
- const {
1042
- options: t,
1043
- selectedIndex: r,
1044
- selectOptionAndCleanUp: o,
1045
- setHighlightedIndex: i
1046
- } = e;
1047
- return n.current ? Nt.createPortal(/* @__PURE__ */ s(Vn, { options: t, selectedIndex: r, onSelectItem: (l, a) => {
1048
- i(a), o(l);
1049
- }, onMouseEnterItem: (l) => {
1050
- i(l);
1051
- } }), n.current) : null;
1052
- }
1053
- function or(n) {
1054
- return er(n, 0);
1055
- }
1056
- class X extends ee {
1057
- __referenceId;
1058
- __name;
1059
- static getType() {
1060
- return "reference";
1061
- }
1062
- static clone(e) {
1063
- return new X(e.__referenceId, e.__name, e.__key);
1064
- }
1065
- constructor(e, t, r) {
1066
- super(t, r), this.__referenceId = e, this.__name = t;
1067
- }
1068
- isKeyboardSelectable() {
1069
- return !1;
1070
- }
1071
- canBeEmpty() {
1072
- return !1;
1073
- }
1074
- canInsertTextAfter() {
1075
- return !1;
1076
- }
1077
- canInsertTextBefore() {
1078
- return !1;
1079
- }
1080
- createDOM(e) {
1081
- const t = document.createElement("span");
1082
- return Ae(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
1083
- }
1084
- updateDOM(e, t) {
1085
- return (e.__name !== this.__name || e.__referenceId !== this.__referenceId) && (t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`), !1;
1086
- }
1087
- exportDOM(e) {
1088
- const t = document.createElement("span");
1089
- return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
1090
- element: t
1091
- };
1092
- }
1093
- static importJSON(e) {
1094
- return new X(e.referenceId, e.name);
1095
- }
1096
- exportJSON() {
1097
- return {
1098
- ...super.exportJSON(),
1099
- type: "reference",
1100
- referenceId: this.__referenceId,
1101
- name: this.__name
1102
- };
1103
- }
1104
- getTextContent() {
1105
- return `#${this.__name}`;
1106
- }
1107
- }
1108
- function ir(n, e) {
1109
- return new X(n, e);
1110
- }
1111
- const sr = (n, e, t) => {
1112
- const r = ir(e, t);
1113
- if (n) {
1114
- n?.replace(r), n.remove(), r.selectEnd();
1115
- return;
1116
- }
1117
- };
1118
- function lr(n) {
1119
- const e = C(4), {
1120
- onAddReference: t
1121
- } = n, [r] = L();
1122
- let o, i;
1123
- return e[0] !== r || e[1] !== t ? (o = () => de(r.registerCommand(Ve, (l) => {
1124
- const {
1125
- resourceId: a,
1126
- resourceType: c,
1127
- name: d,
1128
- nodeToReplace: h
1129
- } = l;
1130
- return r.update(() => {
1131
- sr(h, a, d);
1132
- }), t?.(a, c), !0;
1133
- }, ve)), i = [r, t], e[0] = r, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), F(o, i), null;
1134
- }
1135
- const cr = {
1136
- ...ue,
1137
- // Override paragraph class to remove margins specifically for prompt input
1138
- paragraph: "rich-text__p rich-text__p--no-margin"
1139
- }, ar = [Y, _t, X], dr = (n, e) => {
1140
- const t = C(39), {
1141
- defaultState: r,
1142
- debug: o,
1143
- isEditable: i,
1144
- placeholder: l
1145
- } = n, a = o === void 0 ? !1 : o, c = i === void 0 ? !0 : i, {
1146
- onChange: d,
1147
- onError: h,
1148
- onSubmit: f,
1149
- references: _,
1150
- onAddReference: u
1151
- } = n, m = h === void 0 ? ur : h;
1152
- let g;
1153
- t[0] !== _ ? (g = _ === void 0 ? [] : _, t[0] = _, t[1] = g) : g = t[1];
1154
- const y = g;
1155
- let E;
1156
- t[2] !== r || t[3] !== c || t[4] !== m ? (E = {
1157
- namespace: "PROMPT_EDITOR",
1158
- nodes: ar,
1159
- editorState: r,
1160
- editable: c,
1161
- onError: m,
1162
- theme: cr
1163
- }, t[2] = r, t[3] = c, t[4] = m, t[5] = E) : E = t[5];
1164
- const R = E;
1165
- let S;
1166
- t[6] !== r ? (S = Ge(r), t[6] = r, t[7] = S) : S = t[7];
1167
- const T = St(S);
1168
- let x;
1169
- t[8] !== l ? (x = l ?? /* @__PURE__ */ P(I, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
1170
- "Type your query here or press ",
1171
- /* @__PURE__ */ s(st, { color: "fg.subtle", children: "#" }),
1172
- " to add a reference."
1173
- ] }), t[8] = l, t[9] = x) : x = t[9];
1174
- const N = x;
1175
- let b;
1176
- t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ s(ht, {}), t[10] = b) : b = t[10];
1177
- let p;
1178
- t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ s(Fe, { fullWidth: !0 }), t[11] = p) : p = t[11];
1179
- let O;
1180
- t[12] !== N ? (O = /* @__PURE__ */ s(De, { contentEditable: p, placeholder: N, ErrorBoundary: Le }), t[12] = N, t[13] = O) : O = t[13];
1181
- let $;
1182
- t[14] !== d ? ($ = /* @__PURE__ */ s(Me, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (fe) => {
1183
- fe.read(() => {
1184
- const tt = we(), oe = qn(tt);
1185
- oe !== T.current && (T.current = oe, d?.(oe, fe.toJSON()));
1186
- });
1187
- } }), t[14] = d, t[15] = $) : $ = t[15];
1188
- let w;
1189
- t[16] !== e ? (w = /* @__PURE__ */ s(Jn, { editorRef: e, previousTextRef: T }), t[16] = e, t[17] = w) : w = t[17];
1190
- let M;
1191
- t[18] !== c ? (M = /* @__PURE__ */ s(ze, { isEditable: c }), t[18] = c, t[19] = M) : M = t[19];
1192
- let U;
1193
- t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ s(Fn, {}), t[20] = U) : U = t[20];
1194
- let D;
1195
- t[21] !== f ? (D = /* @__PURE__ */ s(zn, { onSubmit: f }), t[21] = f, t[22] = D) : D = t[22];
1196
- let J;
1197
- t[23] !== y ? (J = /* @__PURE__ */ s(nr, { items: y }), t[23] = y, t[24] = J) : J = t[24];
1198
- let W;
1199
- t[25] !== u ? (W = /* @__PURE__ */ s(lr, { onAddReference: u }), t[25] = u, t[26] = W) : W = t[26];
1200
- let z;
1201
- t[27] !== a ? (z = a ? /* @__PURE__ */ s(Ke, {}) : "", t[27] = a, t[28] = z) : z = t[28];
1202
- let Q;
1203
- return t[29] !== R || t[30] !== O || t[31] !== $ || t[32] !== w || t[33] !== M || t[34] !== D || t[35] !== J || t[36] !== W || t[37] !== z ? (Q = /* @__PURE__ */ s(V, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ P(Pe, { initialConfig: R, children: [
1204
- b,
1205
- O,
1206
- $,
1207
- w,
1208
- M,
1209
- U,
1210
- D,
1211
- J,
1212
- W,
1213
- z
1214
- ] }) }), t[29] = R, t[30] = O, t[31] = $, t[32] = w, t[33] = M, t[34] = D, t[35] = J, t[36] = W, t[37] = z, t[38] = Q) : Q = t[38], Q;
1215
- }, Vr = yt(dr);
1216
- function ur() {
1217
- }
1218
- function mr(n) {
1219
- const e = C(5), {
1220
- value: t,
1221
- onUpdate: r
1222
- } = n, [o] = L();
1223
- let i, l;
1224
- return e[0] !== o || e[1] !== r || e[2] !== t ? (i = () => {
1225
- o && o.update(() => r(t), {
1226
- tag: "history-merge"
1227
- });
1228
- }, l = [t, o, r], e[0] = o, e[1] = r, e[2] = t, e[3] = i, e[4] = l) : (i = e[3], l = e[4]), F(i, l), null;
1229
- }
1230
- class j extends G {
1231
- __href;
1232
- __label;
1233
- static getType() {
1234
- return "reference-link";
1235
- }
1236
- static clone(e) {
1237
- return new j(e.__href, e.__label, e.__key);
1238
- }
1239
- constructor(e, t, r) {
1240
- super(r), this.__href = e, this.__label = t;
1241
- }
1242
- createDOM(e, t) {
1243
- return document.createElement("span");
1244
- }
1245
- updateDOM(e, t, r) {
1246
- return !1;
1247
- }
1248
- getTextContent() {
1249
- return `{{link('${this.__label ?? this.__href}')}}`;
1250
- }
1251
- exportJSON() {
1252
- return {
1253
- type: j.getType(),
1254
- version: 1,
1255
- href: this.__href,
1256
- label: this.__label
1257
- };
1258
- }
1259
- static importJSON(e) {
1260
- return et(e.href, e.label);
1261
- }
1262
- decorate(e, t) {
1263
- const r = this.__href, i = r.split("/").pop() || "unknown", l = /^https?:\/\//i.test(r), a = /^#?\$PROJECT\//i.test(r);
1264
- return /* @__PURE__ */ s(v, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ s(qe, { fileName: i, onSelect: () => {
1265
- if (l)
1266
- window.open(r, "_blank", "noopener,noreferrer");
1267
- else if (a) {
1268
- const c = r.replace(/^#?\$PROJECT\//i, ""), d = new CustomEvent("ui:open-project-file", {
1269
- detail: c
1270
- });
1271
- window.dispatchEvent(d);
1272
- } else
1273
- window.location.assign(r);
1274
- } }) });
1275
- }
1276
- }
1277
- function et(n, e) {
1278
- return new j(n, e);
1279
- }
1280
- function fr(n) {
1281
- return n instanceof j;
1282
- }
1283
- const ye = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, pr = {
1284
- dependencies: [j],
1285
- export: (n) => {
1286
- if (fr(n)) {
1287
- const e = n.__href, t = n.__label ?? e;
1288
- return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
1289
- }
1290
- return null;
1291
- },
1292
- regExp: ye,
1293
- importRegExp: ye,
1294
- replace: (n, e) => {
1295
- const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
1296
- n.replace(et(o, i));
1297
- },
1298
- type: "text-match"
1299
- }, ce = [...Ne, ...We, Be, Ue, pr];
1300
- function Xr(n) {
1301
- const e = C(30), {
1302
- debug: t,
1303
- defaultState: r,
1304
- isEditable: o,
1305
- onChange: i
1306
- } = n, l = t === void 0 ? !1 : t, a = r === void 0 ? "" : r, c = o === void 0 ? !1 : o;
1307
- let d;
1308
- e[0] !== a ? (d = fn(a), e[0] = a, e[1] = d) : d = e[1];
1309
- const {
1310
- frontmatter: h,
1311
- body: f
1312
- } = d, _ = c && !!i;
1313
- let u;
1314
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = [Oe, Se, H, ke, Te, Re, ae, K, q, B, j], e[2] = u) : u = e[2];
1315
- let m;
1316
- e[3] !== f ? (m = () => Ce(f, ce, void 0, !1), e[3] = f, e[4] = m) : m = e[4];
1317
- let g;
1318
- e[5] !== c || e[6] !== m ? (g = {
1319
- namespace: "RICH_MESSAGE",
1320
- nodes: u,
1321
- editorState: m,
1322
- onError: hr,
1323
- editable: c,
1324
- theme: ue
1325
- }, e[5] = c, e[6] = m, e[7] = g) : g = e[7];
1326
- const y = g;
1327
- let E;
1328
- e[8] !== f ? (E = /* @__PURE__ */ s(mr, { value: f, onUpdate: _r }), e[8] = f, e[9] = E) : E = e[9];
1329
- let R, S, T, x, N;
1330
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ s(Ot, {}), N = /* @__PURE__ */ s(kt, {}), R = /* @__PURE__ */ s(Ct, {}), S = /* @__PURE__ */ s(dn, {}), T = /* @__PURE__ */ s(rn, {}), e[10] = R, e[11] = S, e[12] = T, e[13] = x, e[14] = N) : (R = e[10], S = e[11], T = e[12], x = e[13], N = e[14]);
1331
- let b;
1332
- e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ s(De, { contentEditable: /* @__PURE__ */ s(Fe, { fullWidth: !1 }), ErrorBoundary: Le }), e[15] = b) : b = e[15];
1333
- let p;
1334
- e[16] !== h || e[17] !== i || e[18] !== _ ? (p = _ ? /* @__PURE__ */ s(Me, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (M) => {
1335
- M.read(() => {
1336
- const U = we(), D = nt(ce, U);
1337
- i?.(h + D);
1338
- });
1339
- } }) : null, e[16] = h, e[17] = i, e[18] = _, e[19] = p) : p = e[19];
1340
- let O;
1341
- e[20] !== c ? (O = /* @__PURE__ */ s(ze, { isEditable: c }), e[20] = c, e[21] = O) : O = e[21];
1342
- let $;
1343
- e[22] !== l ? ($ = l && /* @__PURE__ */ s(Ke, {}), e[22] = l, e[23] = $) : $ = e[23];
1344
- let w;
1345
- return e[24] !== y || e[25] !== p || e[26] !== O || e[27] !== $ || e[28] !== E ? (w = /* @__PURE__ */ s(V, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ P(Pe, { initialConfig: y, children: [
1346
- E,
1347
- x,
1348
- N,
1349
- R,
1350
- S,
1351
- T,
1352
- b,
1353
- p,
1354
- O,
1355
- $
1356
- ] }) }), e[24] = y, e[25] = p, e[26] = O, e[27] = $, e[28] = E, e[29] = w) : w = e[29], w;
1357
- }
1358
- function _r(n) {
1359
- Ce(n, ce, void 0, !1);
1360
- }
1361
- function hr(n) {
1362
- return console.error(n);
1363
- }
1364
- export {
1365
- Fe as C,
1366
- Qt as D,
1367
- rn as E,
1368
- dn as I,
1369
- Vr as P,
1370
- Xr as R,
1371
- ze as T,
1372
- Wr as a,
1373
- zr as b,
1374
- Ke as c,
1375
- Zt as d,
1376
- Kr as e,
1377
- Ge as f,
1378
- Un as g,
1379
- qe as h,
1380
- fn as s
1381
- };
1382
- //# sourceMappingURL=rich-message-B2gxL8oy.js.map