@pstdio/ui 0.24.2 → 0.25.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 (56) hide show
  1. package/dist/{MermaidComponent-DSvPk-J8.js → MermaidComponent-BVdDqDRU.js} +2 -2
  2. package/dist/{MermaidComponent-DSvPk-J8.js.map → MermaidComponent-BVdDqDRU.js.map} +1 -1
  3. package/dist/chat-ui.js +15 -14
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/activity/activity-comment.d.ts +10 -2
  6. package/dist/components/activity/index.d.ts +3 -1
  7. package/dist/components/activity/resource-activity-feed.d.ts +58 -0
  8. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +1 -1
  9. package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
  10. package/dist/data-table.js +4 -4
  11. package/dist/{edit-mode-data-table-2E4GSOou.js → edit-mode-data-table-B8UpWb7i.js} +3 -3
  12. package/dist/{edit-mode-data-table-2E4GSOou.js.map → edit-mode-data-table-B8UpWb7i.js.map} +1 -1
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1867 -1634
  15. package/dist/index.js.map +1 -1
  16. package/dist/{kanban-renderer-toolbar-Dcbxujbk.js → kanban-renderer-toolbar-DzY6THJY.js} +2 -2
  17. package/dist/{kanban-renderer-toolbar-Dcbxujbk.js.map → kanban-renderer-toolbar-DzY6THJY.js.map} +1 -1
  18. package/dist/kanban-renderer.js +4 -4
  19. package/dist/{lazy-markdown-editor-DSlelhHV.js → lazy-markdown-editor-ClZPZuaU.js} +2 -2
  20. package/dist/{lazy-markdown-editor-DSlelhHV.js.map → lazy-markdown-editor-ClZPZuaU.js.map} +1 -1
  21. package/dist/{markdown-editor-BHoRATej.js → markdown-editor-CAVqJ9yR.js} +2 -2
  22. package/dist/{markdown-editor-BHoRATej.js.map → markdown-editor-CAVqJ9yR.js.map} +1 -1
  23. package/dist/{markdown-Cli3KGu9.js → markdown-gNucAjnF.js} +9 -9
  24. package/dist/{markdown-Cli3KGu9.js.map → markdown-gNucAjnF.js.map} +1 -1
  25. package/dist/{param-editor-CaRflJ3e.js → param-editor-CTx3mDxQ.js} +2 -2
  26. package/dist/{param-editor-CaRflJ3e.js.map → param-editor-CTx3mDxQ.js.map} +1 -1
  27. package/dist/{param-editor-field-DVQlXbid.js → param-editor-field-DteDEyeU.js} +2 -2
  28. package/dist/{param-editor-field-DVQlXbid.js.map → param-editor-field-DteDEyeU.js.map} +1 -1
  29. package/dist/prompt-input-DNpRL5tI.js +564 -0
  30. package/dist/prompt-input-DNpRL5tI.js.map +1 -0
  31. package/dist/rich-message-CuPiKxKX.js +78 -0
  32. package/dist/rich-message-CuPiKxKX.js.map +1 -0
  33. package/dist/rich-text.js +24 -23
  34. package/dist/rich-text.js.map +1 -1
  35. package/dist/theme/primitives/colors.d.ts +0 -23
  36. package/dist/theme/recipes/activity-comment.d.ts +36 -0
  37. package/dist/theme/recipes/alert.d.ts +1 -1
  38. package/dist/theme/recipes/dialog.d.ts +1 -1
  39. package/dist/theme/recipes/drawer.d.ts +1 -1
  40. package/dist/theme/recipes/menu.d.ts +1 -1
  41. package/dist/theme/recipes/popover.d.ts +1 -1
  42. package/dist/theme/recipes/progress-circle.d.ts +3 -3
  43. package/dist/theme/recipes/switch.d.ts +1 -1
  44. package/dist/theme/recipes/timeline.d.ts +1 -1
  45. package/dist/theme/recipes/tooltip.d.ts +1 -1
  46. package/dist/theme/recipes/window-title-bar.d.ts +1 -1
  47. package/dist/{theme-B5OVwYEU.js → theme-Dc7hVvMC.js} +118 -808
  48. package/dist/theme-Dc7hVvMC.js.map +1 -0
  49. package/dist/theme.js +1 -1
  50. package/package.json +2 -2
  51. package/dist/rich-message-gWYlm8Ji.js +0 -628
  52. package/dist/rich-message-gWYlm8Ji.js.map +0 -1
  53. package/dist/theme/recipes/landing-story.d.ts +0 -10
  54. package/dist/theme/recipes/landing-tool-demo.d.ts +0 -1
  55. package/dist/theme/recipes/landing.d.ts +0 -23
  56. package/dist/theme-B5OVwYEU.js.map +0 -1
@@ -1,628 +0,0 @@
1
- import { jsx as s, jsxs as R, Fragment as Q } from "react/jsx-runtime";
2
- import { c as C } from "react/compiler-runtime";
3
- import { Tooltip as U, Text as D, Flex as q, Box as Z, Kbd as Ie } from "@chakra-ui/react";
4
- import { MarkNode as Te } from "@lexical/mark";
5
- import { LexicalComposer as oe } from "@lexical/react/LexicalComposer";
6
- import { LexicalErrorBoundary as ie } from "@lexical/react/LexicalErrorBoundary";
7
- import { HistoryPlugin as Re } from "@lexical/react/LexicalHistoryPlugin";
8
- import { OnChangePlugin as se } from "@lexical/react/LexicalOnChangePlugin";
9
- import { RichTextPlugin as ce } from "@lexical/react/LexicalRichTextPlugin";
10
- import { createCommand as le, ElementNode as Oe, isHTMLElement as Me, $createParagraphNode as j, COMMAND_PRIORITY_LOW as ae, $getSelection as $e, $isRangeSelection as Ne, $isElementNode as ve, KEY_DOWN_COMMAND as Pe, COMMAND_PRIORITY_HIGH as Ae, TextNode as Le, $getRoot as de, $addUpdateTag as ee } from "lexical";
11
- import { useEffect as B, useImperativeHandle as ke, useState as we, forwardRef as De, useRef as ue } from "react";
12
- import { t as Be, b as me, T as fe, h as pe, s as Fe, f as te, M as He, e as Je, a as Ke, C as Ue, I as Ge, E as We } from "./markdown-Cli3KGu9.js";
13
- import { useLexicalComposerContext as M } from "@lexical/react/LexicalComposerContext";
14
- import { $setBlocksType as Ve } from "@lexical/selection";
15
- import { addClassNamesToElement as ge, mergeRegister as X } from "@lexical/utils";
16
- import { LexicalTypeaheadMenuPlugin as je } from "@lexical/react/LexicalTypeaheadMenuPlugin";
17
- import * as qe from "react-dom";
18
- import { S as Xe } from "./browser-storage-DPtOQJx0.js";
19
- import { ClickableLinkPlugin as Ye } from "@lexical/react/LexicalClickableLinkPlugin";
20
- import { HorizontalRulePlugin as ze } from "@lexical/react/LexicalHorizontalRulePlugin";
21
- import { LinkPlugin as Qe } from "@lexical/react/LexicalLinkPlugin";
22
- import { ListPlugin as Ze } from "@lexical/react/LexicalListPlugin";
23
- import { TabIndentationPlugin as et } from "@lexical/react/LexicalTabIndentationPlugin";
24
- const tt = "INSERT_REFERENCE", nt = "INSERT_BLOCK", he = le(tt), rt = le(nt);
25
- function ot(r) {
26
- const e = G();
27
- return r.style !== null && e.setFormat(r.style.textAlign), {
28
- node: e
29
- };
30
- }
31
- class H extends Oe {
32
- static getType() {
33
- return "comment";
34
- }
35
- static clone(e) {
36
- return new H(e.__key);
37
- }
38
- createDOM(e) {
39
- const t = document.createElement("blockquote");
40
- return ge(t, e.theme.comment), t;
41
- }
42
- updateDOM() {
43
- return !1;
44
- }
45
- static importDOM() {
46
- return {
47
- blockquote: () => ({
48
- conversion: ot,
49
- priority: 0
50
- })
51
- };
52
- }
53
- exportDOM(e) {
54
- const {
55
- element: t
56
- } = super.exportDOM(e);
57
- if (t && Me(t)) {
58
- this.isEmpty() && t.append(document.createElement("br"));
59
- const n = this.getFormatType();
60
- t.style.textAlign = n;
61
- const o = this.getDirection();
62
- o && (t.dir = o);
63
- }
64
- return {
65
- element: t
66
- };
67
- }
68
- static importJSON(e) {
69
- const t = G();
70
- return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
71
- }
72
- exportJSON() {
73
- return {
74
- ...super.exportJSON(),
75
- type: "comment"
76
- };
77
- }
78
- getTextContent() {
79
- return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
80
- }
81
- // mutation
82
- insertNewAfter(e, t) {
83
- const n = j(), o = this.getDirection();
84
- return n.setDirection(o), this.insertAfter(n, t), n;
85
- }
86
- collapseAtStart() {
87
- const e = j();
88
- return this.getChildren().forEach((n) => {
89
- e.append(n);
90
- }), this.replace(e), !0;
91
- }
92
- }
93
- function G() {
94
- return new H();
95
- }
96
- const it = (r, e) => {
97
- const t = $e(), n = G();
98
- if (e) {
99
- e.getParent()?.replace(n, !0), e.remove(), n.selectEnd();
100
- return;
101
- }
102
- Ne(t) && Ve(t, G);
103
- };
104
- function st() {
105
- const r = C(3), [e] = M();
106
- let t, n;
107
- return r[0] !== e ? (t = () => X(e.registerCommand(rt, ct, ae)), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), B(t, n), null;
108
- }
109
- function ct(r) {
110
- const {
111
- optionId: e,
112
- nodeToReplace: t
113
- } = r;
114
- return it(e, t), !1;
115
- }
116
- const lt = () => {
117
- const r = C(3), [e] = M();
118
- let t, n;
119
- r[0] !== e ? (t = () => X(e.registerNodeTransform(H, (o) => {
120
- const c = o.getChildren().filter(at);
121
- c.length > 0 && e.update(() => {
122
- c.forEach(dt);
123
- });
124
- })), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), B(t, n);
125
- };
126
- function at(r) {
127
- return r.getType() === "comment";
128
- }
129
- function dt(r) {
130
- r.replace(j(), !0);
131
- }
132
- function ut() {
133
- return lt(), st(), null;
134
- }
135
- const mt = (r) => {
136
- let e = "";
137
- const t = r.getChildren(), n = t.length;
138
- for (let o = 0; o < n; o++) {
139
- const i = t[o];
140
- e += i.getTextContent(), ve(i) && o !== n - 1 && !i.isInline() && (e += `
141
- `);
142
- }
143
- return e;
144
- }, ft = (r) => r.type !== "reference" ? null : `#${r.name ?? r.referenceId ?? ""}`, pt = (r) => r.type === "paragraph" && !!r.children?.length, xe = (r) => {
145
- if (r.type === "comment")
146
- return "";
147
- const e = ft(r);
148
- if (e !== null)
149
- return e;
150
- let t = typeof r.text == "string" ? r.text : "";
151
- const n = r.children;
152
- if (!Array.isArray(n)) return t;
153
- const o = n.length;
154
- for (let i = 0; i < o; i += 1) {
155
- const c = n[i];
156
- if (c.type === "comment") {
157
- i !== o - 1 && (t += `
158
- `);
159
- continue;
160
- }
161
- t += xe(c), pt(c) && (t += `
162
- `);
163
- }
164
- return t;
165
- }, Ee = (r) => {
166
- try {
167
- const e = JSON.parse(r);
168
- return xe(e.root ?? {});
169
- } catch {
170
- return "";
171
- }
172
- }, gt = {
173
- root: {
174
- direction: "ltr",
175
- format: "",
176
- indent: 0,
177
- type: "root",
178
- version: 1,
179
- children: [{
180
- type: "paragraph",
181
- version: 1,
182
- format: "",
183
- indent: 0,
184
- textFormat: void 0,
185
- direction: null,
186
- children: []
187
- }]
188
- }
189
- };
190
- function ht(r = "") {
191
- return r.trim() ? {
192
- root: {
193
- direction: "ltr",
194
- format: "",
195
- indent: 0,
196
- type: "root",
197
- version: 1,
198
- children: r.split(/\r?\n/).map((n) => ({
199
- type: "paragraph",
200
- version: 1,
201
- format: "",
202
- indent: 0,
203
- textFormat: void 0,
204
- direction: null,
205
- children: n ? [{
206
- type: "text",
207
- version: 1,
208
- text: n,
209
- format: "",
210
- detail: 0,
211
- mode: "normal",
212
- style: ""
213
- }] : []
214
- }))
215
- }
216
- } : JSON.parse(JSON.stringify(gt));
217
- }
218
- function xt(r) {
219
- const e = C(4), {
220
- editorRef: t,
221
- previousTextRef: n
222
- } = r, [o] = M();
223
- let i, c;
224
- return e[0] !== o || e[1] !== n ? (i = () => ({
225
- setEditorValue: (a) => {
226
- const l = o.parseEditorState(JSON.stringify(ht(a)));
227
- o.setEditorState(l), n.current = Ee(a), o.focus(void 0, {
228
- defaultSelection: "rootEnd"
229
- });
230
- }
231
- }), c = [o, n], e[0] = o, e[1] = n, e[2] = i, e[3] = c) : (i = e[2], c = e[3]), ke(t, i, c), null;
232
- }
233
- const Et = (r) => r.key !== "Enter" ? !1 : !r.ctrlKey && !r.metaKey && !r.shiftKey && !r.altKey;
234
- function _t(r) {
235
- const e = C(4), {
236
- onSubmit: t
237
- } = r, [n] = M();
238
- let o, i;
239
- return e[0] !== n || e[1] !== t ? (o = () => n.registerCommand(Pe, (c) => Et(c) ? (c.preventDefault(), t?.(), !0) : !1, Ae), i = [n, t], e[0] = n, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), B(o, i), null;
240
- }
241
- const ne = ["table", "connector"], yt = (r) => r.sort((n, o) => ne.indexOf(n.group) - ne.indexOf(o.group)).map((n, o) => ({
242
- ...n,
243
- index: o
244
- })).reduce((n, o) => {
245
- const i = n[o.group] ?? [];
246
- return i.push(o), n[o.group] = i, n;
247
- }, {});
248
- function re(r) {
249
- const e = C(22), {
250
- id: t,
251
- isSelected: n,
252
- onClick: o,
253
- onMouseEnter: i,
254
- setRefElement: c,
255
- secondaryLabel: a,
256
- primaryLabel: l,
257
- tabIndex: p
258
- } = r, f = p === void 0 ? -1 : p, E = n ? "bg.active" : "transparent", d = n ? "bg.active" : "bg.hover";
259
- let m;
260
- e[0] !== d ? (m = {
261
- bg: d
262
- }, e[0] = d, e[1] = m) : m = e[1];
263
- let g;
264
- e[2] !== l ? (g = /* @__PURE__ */ s(U.Trigger, { children: /* @__PURE__ */ s(D, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: l }) }), e[2] = l, e[3] = g) : g = e[3];
265
- let h;
266
- e[4] !== l ? (h = /* @__PURE__ */ s(U.Positioner, { children: /* @__PURE__ */ s(U.Content, { children: l }) }), e[4] = l, e[5] = h) : h = e[5];
267
- let x;
268
- e[6] !== g || e[7] !== h ? (x = /* @__PURE__ */ R(U.Root, { children: [
269
- g,
270
- h
271
- ] }), e[6] = g, e[7] = h, e[8] = x) : x = e[8];
272
- let _;
273
- e[9] !== a ? (_ = a && /* @__PURE__ */ s(D, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: a }), e[9] = a, e[10] = _) : _ = e[10];
274
- let b;
275
- return e[11] !== t || e[12] !== n || e[13] !== o || e[14] !== i || e[15] !== c || e[16] !== E || e[17] !== m || e[18] !== x || e[19] !== _ || e[20] !== f ? (b = /* @__PURE__ */ R(q, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: E, _hover: m, tabIndex: f, ref: c, role: "option", "aria-selected": n, id: t, onMouseEnter: i, onClick: o, children: [
276
- x,
277
- _
278
- ] }), e[11] = t, e[12] = n, e[13] = o, e[14] = i, e[15] = c, e[16] = E, e[17] = m, e[18] = x, e[19] = _, e[20] = f, e[21] = b) : b = e[21], b;
279
- }
280
- const bt = (r) => {
281
- const e = C(12), {
282
- options: t,
283
- selectedIndex: n,
284
- onSelectItem: o,
285
- onMouseEnterItem: i
286
- } = r, {
287
- table: c,
288
- connector: a
289
- } = yt(t), l = c === void 0 ? [] : c, p = a === void 0 ? [] : a, f = [...l, ...p].length;
290
- let E, d;
291
- e[0] !== n ? (E = () => {
292
- document.getElementById(`typeahead-item-${n}`)?.scrollIntoView({
293
- behavior: "instant",
294
- block: "nearest"
295
- });
296
- }, d = [n], e[0] = n, e[1] = E, e[2] = d) : (E = e[1], d = e[2]), B(E, d);
297
- const m = Xe, g = "1000", h = "absolute", x = "modal", _ = "24rem", b = !1;
298
- let y;
299
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = {
300
- base: "100vw",
301
- md: "264px"
302
- }, e[3] = y) : y = e[3];
303
- let S;
304
- e[4] !== f ? (S = !f && /* @__PURE__ */ s(D, { children: "No results" }), e[4] = f, e[5] = S) : S = e[5];
305
- const T = !!l.length && /* @__PURE__ */ R(Q, { children: [
306
- /* @__PURE__ */ s(D, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
307
- /* @__PURE__ */ s(Z, { children: l.map((u) => /* @__PURE__ */ s(re, { id: `typeahead-item-${u.index}`, isSelected: n === u.index, onClick: () => o(u, u.index), onMouseEnter: () => i(u.index), primaryLabel: u.name, secondaryLabel: u.description, setRefElement: u.setRefElement, tabIndex: -1 }, u.id)) })
308
- ] }), O = !!p.length && /* @__PURE__ */ R(Q, { children: [
309
- /* @__PURE__ */ s(D, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
310
- /* @__PURE__ */ s(Z, { children: p.map((u) => /* @__PURE__ */ s(re, { id: `typeahead-item-${u.index}`, isSelected: n === u.index, onClick: () => o(u, u.index), onMouseEnter: () => i(u.index), primaryLabel: u.name, secondaryLabel: u.description, setRefElement: u.setRefElement, tabIndex: -1 }, u.id)) })
311
- ] });
312
- let I;
313
- return e[6] !== m || e[7] !== S || e[8] !== T || e[9] !== O || e[10] !== y ? (I = /* @__PURE__ */ R(m, { zIndex: g, position: h, layerStyle: x, maxHeight: _, showHorizontalScrollbar: b, minWidth: y, children: [
314
- S,
315
- T,
316
- O
317
- ] }), e[6] = m, e[7] = S, e[8] = T, e[9] = O, e[10] = y, e[11] = I) : I = e[11], I;
318
- }, St = (r, e) => r.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
319
- function Ct(r, e = []) {
320
- const t = e.map((n, o) => ({
321
- id: n.resourceId,
322
- key: n.resourceId,
323
- index: o,
324
- group: n.resourceType,
325
- name: n.name,
326
- description: n.description,
327
- setRefElement: () => {
328
- }
329
- }));
330
- return r == null || r === "" ? t : St(t, r);
331
- }
332
- const _e = "\\.\\-<>_:", Y = ["#"].join(""), ye = `[^${Y}${_e}\\s]`, It = `(?:[${_e}]|)`, be = 75, Tt = new RegExp(`(^|\\s|\\()([${Y}]((?:${ye}${It}){0,${be}}))$`), Rt = new RegExp(`(^|\\s|\\()([${Y}]((?:${ye}){0,${be}}))$`);
333
- function Ot(r, e) {
334
- let t = Tt.exec(r);
335
- if (t === null && (t = Rt.exec(r)), t !== null) {
336
- const n = t[1], o = t[3];
337
- if (o.length >= e)
338
- return {
339
- leadOffset: t.index + n.length,
340
- matchingString: o,
341
- replaceableString: t[2]
342
- };
343
- }
344
- return null;
345
- }
346
- const Mt = 20;
347
- function $t(r) {
348
- const e = C(9), {
349
- items: t
350
- } = r;
351
- let n;
352
- e[0] !== t ? (n = t === void 0 ? [] : t, e[0] = t, e[1] = n) : n = e[1];
353
- const o = n, [i, c] = we(null), [a] = M(), l = Ct(i, o);
354
- let p;
355
- e[2] !== a ? (p = (h, x, _) => {
356
- a.update(() => {
357
- x && (a.dispatchCommand(he, {
358
- resourceId: h.id,
359
- resourceType: h.group,
360
- name: h.name,
361
- nodeToReplace: x
362
- }), _());
363
- });
364
- }, e[2] = a, e[3] = p) : p = e[3];
365
- const f = p, E = vt;
366
- let d;
367
- e[4] !== l ? (d = l.slice(0, Mt), e[4] = l, e[5] = d) : d = e[5];
368
- const m = d;
369
- let g;
370
- return e[6] !== m || e[7] !== f ? (g = /* @__PURE__ */ s(je, { onQueryChange: c, onSelectOption: f, triggerFn: E, options: m, menuRenderFn: Nt }), e[6] = m, e[7] = f, e[8] = g) : g = e[8], g;
371
- }
372
- function Nt(r, e) {
373
- const {
374
- options: t,
375
- selectedIndex: n,
376
- selectOptionAndCleanUp: o,
377
- setHighlightedIndex: i
378
- } = e;
379
- return r.current ? qe.createPortal(/* @__PURE__ */ s(bt, { options: t, selectedIndex: n, onSelectItem: (c, a) => {
380
- i(a), o(c);
381
- }, onMouseEnterItem: (c) => {
382
- i(c);
383
- } }), r.current) : null;
384
- }
385
- function vt(r) {
386
- return Ot(r, 0);
387
- }
388
- class F extends Le {
389
- __referenceId;
390
- __name;
391
- static getType() {
392
- return "reference";
393
- }
394
- static clone(e) {
395
- return new F(e.__referenceId, e.__name, e.__key);
396
- }
397
- constructor(e, t, n) {
398
- super(t, n), this.__referenceId = e, this.__name = t;
399
- }
400
- isKeyboardSelectable() {
401
- return !1;
402
- }
403
- canBeEmpty() {
404
- return !1;
405
- }
406
- canInsertTextAfter() {
407
- return !1;
408
- }
409
- canInsertTextBefore() {
410
- return !1;
411
- }
412
- createDOM(e) {
413
- const t = document.createElement("span");
414
- return ge(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
415
- }
416
- updateDOM(e, t) {
417
- 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;
418
- }
419
- exportDOM(e) {
420
- const t = document.createElement("span");
421
- return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
422
- element: t
423
- };
424
- }
425
- static importDOM() {
426
- return {
427
- span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
428
- conversion: Pt,
429
- priority: 1
430
- }
431
- };
432
- }
433
- static importJSON(e) {
434
- return new F(e.referenceId, e.name);
435
- }
436
- exportJSON() {
437
- return {
438
- ...super.exportJSON(),
439
- type: "reference",
440
- referenceId: this.__referenceId,
441
- name: this.__name
442
- };
443
- }
444
- getTextContent() {
445
- return `#${this.__name}`;
446
- }
447
- }
448
- function Pt(r) {
449
- const e = r.getAttribute("data-reference-id"), t = r.getAttribute("data-name");
450
- return !e || !t ? null : {
451
- node: Se(e, t)
452
- };
453
- }
454
- function Se(r, e) {
455
- return new F(r, e);
456
- }
457
- const At = (r, e, t) => {
458
- const n = Se(e, t);
459
- if (r) {
460
- r?.replace(n), r.remove(), n.selectEnd();
461
- return;
462
- }
463
- };
464
- function Lt(r) {
465
- const e = C(4), {
466
- onAddReference: t
467
- } = r, [n] = M();
468
- let o, i;
469
- return e[0] !== n || e[1] !== t ? (o = () => X(n.registerCommand(he, (c) => {
470
- const {
471
- resourceId: a,
472
- resourceType: l,
473
- name: p,
474
- nodeToReplace: f
475
- } = c;
476
- return n.update(() => {
477
- At(f, a, p);
478
- }), t?.(a, l), !0;
479
- }, ae)), i = [n, t], e[0] = n, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), B(o, i), null;
480
- }
481
- const kt = {
482
- ...Be,
483
- // Override paragraph class to remove margins specifically for prompt input
484
- paragraph: "rich-text__p rich-text__p--no-margin"
485
- }, wt = [H, Te, F], Dt = (r, e) => {
486
- const t = C(39), {
487
- defaultState: n,
488
- debug: o,
489
- isEditable: i,
490
- placeholder: c
491
- } = r, a = o === void 0 ? !1 : o, l = i === void 0 ? !0 : i, {
492
- onChange: p,
493
- onError: f,
494
- onSubmit: E,
495
- references: d,
496
- onAddReference: m
497
- } = r, g = f === void 0 ? Bt : f;
498
- let h;
499
- t[0] !== d ? (h = d === void 0 ? [] : d, t[0] = d, t[1] = h) : h = t[1];
500
- const x = h;
501
- let _;
502
- t[2] !== n || t[3] !== l || t[4] !== g ? (_ = {
503
- namespace: "PROMPT_EDITOR",
504
- nodes: wt,
505
- editorState: n,
506
- editable: l,
507
- onError: g,
508
- theme: kt
509
- }, t[2] = n, t[3] = l, t[4] = g, t[5] = _) : _ = t[5];
510
- const b = _;
511
- let y;
512
- t[6] !== n ? (y = Ee(n), t[6] = n, t[7] = y) : y = t[7];
513
- const S = ue(y);
514
- let T;
515
- t[8] !== c ? (T = c ?? /* @__PURE__ */ R(D, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
516
- "Type your query here or press ",
517
- /* @__PURE__ */ s(Ie, { color: "fg.subtle", children: "#" }),
518
- " to add a reference."
519
- ] }), t[8] = c, t[9] = T) : T = t[9];
520
- const O = T;
521
- let I;
522
- t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ s(Re, {}), t[10] = I) : I = t[10];
523
- let u;
524
- t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ s(me, { fullWidth: !0 }), t[11] = u) : u = t[11];
525
- let $;
526
- t[12] !== O ? ($ = /* @__PURE__ */ s(ce, { contentEditable: u, placeholder: O, ErrorBoundary: ie }), t[12] = O, t[13] = $) : $ = t[13];
527
- let N;
528
- t[14] !== p ? (N = /* @__PURE__ */ s(se, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (z) => {
529
- z.read(() => {
530
- const Ce = de(), W = mt(Ce);
531
- W !== S.current && (S.current = W, p?.(W, z.toJSON()));
532
- });
533
- } }), t[14] = p, t[15] = N) : N = t[15];
534
- let v;
535
- t[16] !== e ? (v = /* @__PURE__ */ s(xt, { editorRef: e, previousTextRef: S }), t[16] = e, t[17] = v) : v = t[17];
536
- let P;
537
- t[18] !== l ? (P = /* @__PURE__ */ s(fe, { isEditable: l }), t[18] = l, t[19] = P) : P = t[19];
538
- let J;
539
- t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ s(ut, {}), t[20] = J) : J = t[20];
540
- let A;
541
- t[21] !== E ? (A = /* @__PURE__ */ s(_t, { onSubmit: E }), t[21] = E, t[22] = A) : A = t[22];
542
- let L;
543
- t[23] !== x ? (L = /* @__PURE__ */ s($t, { items: x }), t[23] = x, t[24] = L) : L = t[24];
544
- let k;
545
- t[25] !== m ? (k = /* @__PURE__ */ s(Lt, { onAddReference: m }), t[25] = m, t[26] = k) : k = t[26];
546
- let w;
547
- t[27] !== a ? (w = a ? /* @__PURE__ */ s(pe, {}) : "", t[27] = a, t[28] = w) : w = t[28];
548
- let K;
549
- return t[29] !== b || t[30] !== $ || t[31] !== N || t[32] !== v || t[33] !== P || t[34] !== A || t[35] !== L || t[36] !== k || t[37] !== w ? (K = /* @__PURE__ */ s(q, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ R(oe, { initialConfig: b, children: [
550
- I,
551
- $,
552
- N,
553
- v,
554
- P,
555
- J,
556
- A,
557
- L,
558
- k,
559
- w
560
- ] }) }), t[29] = b, t[30] = $, t[31] = N, t[32] = v, t[33] = P, t[34] = A, t[35] = L, t[36] = k, t[37] = w, t[38] = K) : K = t[38], K;
561
- }, an = De(Dt);
562
- function Bt() {
563
- }
564
- function Ft(r) {
565
- const e = C(5), {
566
- value: t,
567
- onUpdate: n
568
- } = r, [o] = M();
569
- let i, c;
570
- return e[0] !== o || e[1] !== n || e[2] !== t ? (i = () => {
571
- o && o.update(() => n(t), {
572
- tag: "history-merge"
573
- });
574
- }, c = [t, o, n], e[0] = o, e[1] = n, e[2] = t, e[3] = i, e[4] = c) : (i = e[3], c = e[4]), B(i, c), null;
575
- }
576
- const V = "markdown-source-import";
577
- function dn(r) {
578
- const {
579
- debug: e = !1,
580
- defaultState: t = "",
581
- fullWidth: n = !1,
582
- isEditable: o = !1,
583
- resolveMarkdownUrl: i,
584
- onChange: c
585
- } = r, {
586
- frontmatter: a,
587
- body: l
588
- } = Fe(t), p = o && !!c, f = ue(null);
589
- return f.current ??= te(l, i), /* @__PURE__ */ s(q, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ s(He, { resolver: i, children: /* @__PURE__ */ R(oe, { initialConfig: {
590
- namespace: "RICH_MESSAGE",
591
- nodes: Ke,
592
- editorState: () => {
593
- ee(V), f.current?.importToLexical();
594
- },
595
- onError: (d) => console.error(d),
596
- editable: o,
597
- theme: Je
598
- }, children: [
599
- /* @__PURE__ */ s(Ft, { value: l, onUpdate: (d) => {
600
- const m = te(d, i);
601
- f.current = m, ee(V), m.importToLexical();
602
- } }),
603
- /* @__PURE__ */ s(Qe, {}),
604
- /* @__PURE__ */ s(Ye, { newTab: !0 }),
605
- /* @__PURE__ */ s(Ze, {}),
606
- o ? /* @__PURE__ */ s(et, { maxIndent: 7 }) : null,
607
- /* @__PURE__ */ s(ze, {}),
608
- /* @__PURE__ */ s(Ue, {}),
609
- /* @__PURE__ */ s(Ge, {}),
610
- /* @__PURE__ */ s(We, {}),
611
- /* @__PURE__ */ s(ce, { contentEditable: /* @__PURE__ */ s(me, { fullWidth: n, isRichMessage: !0 }), ErrorBoundary: ie }),
612
- p ? /* @__PURE__ */ s(se, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (d, m, g) => {
613
- g.has(V) || d.read(() => {
614
- const h = de(), x = f.current?.exportFromLexical(h) ?? "";
615
- c?.(a + x);
616
- });
617
- } }) : null,
618
- /* @__PURE__ */ s(fe, { isEditable: o }),
619
- e && /* @__PURE__ */ s(pe, {})
620
- ] }) }) });
621
- }
622
- export {
623
- an as P,
624
- dn as R,
625
- Ee as a,
626
- ht as g
627
- };
628
- //# sourceMappingURL=rich-message-gWYlm8Ji.js.map