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