@pstdio/ui 0.19.0 → 0.20.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 (101) hide show
  1. package/dist/{MermaidComponent-BPiVFNYK.js → MermaidComponent-AmAjWLPm.js} +3 -3
  2. package/dist/{MermaidComponent-BPiVFNYK.js.map → MermaidComponent-AmAjWLPm.js.map} +1 -1
  3. package/dist/browser-storage-DPtOQJx0.js +127 -0
  4. package/dist/browser-storage-DPtOQJx0.js.map +1 -0
  5. package/dist/chat-ui.js +19 -20
  6. package/dist/chat-ui.js.map +1 -1
  7. package/dist/components/data-table/data-table-header.d.ts +3 -1
  8. package/dist/components/data-table/edit-mode-data-table-body.d.ts +29 -0
  9. package/dist/components/data-table/edit-mode-data-table-cell.d.ts +15 -0
  10. package/dist/components/data-table/edit-mode-data-table-editors.d.ts +19 -0
  11. package/dist/components/data-table/edit-mode-data-table-header.d.ts +23 -0
  12. package/dist/components/data-table/edit-mode-data-table-selection.d.ts +12 -0
  13. package/dist/components/data-table/edit-mode-data-table.d.ts +2 -0
  14. package/dist/components/data-table/edit-mode-story.d.ts +5 -0
  15. package/dist/components/data-table/index.d.ts +1 -1
  16. package/dist/components/data-table/pagination-footer.d.ts +8 -5
  17. package/dist/components/data-table/types.d.ts +24 -0
  18. package/dist/components/rich-text/index.d.ts +2 -0
  19. package/dist/components/rich-text/markdown-editor/markdown-editor.d.ts +7 -0
  20. package/dist/components/rich-text/markdown-editor/markdown-table.story-fixture.d.ts +3 -0
  21. package/dist/components/rich-text/markdown-editor/plugins/MarkdownSectionNavigationPlugin.d.ts +8 -0
  22. package/dist/components/rich-text/markdown-editor/plugins/MarkdownSlashCommandPlugin.d.ts +1 -0
  23. package/dist/components/rich-text/markdown-editor/plugins/markdown-history-plugin.d.ts +1 -0
  24. package/dist/components/rich-text/markdown-editor/plugins/markdown-section-navigation.d.ts +20 -0
  25. package/dist/components/rich-text/rich-message/rich-message.d.ts +2 -0
  26. package/dist/components/rich-text/shared/markdown-ast.d.ts +6 -0
  27. package/dist/components/rich-text/shared/markdown-codec.d.ts +3 -0
  28. package/dist/components/rich-text/shared/markdown-export.d.ts +2 -0
  29. package/dist/components/rich-text/shared/markdown-import.d.ts +2 -0
  30. package/dist/components/rich-text/shared/markdown-inline.d.ts +5 -0
  31. package/dist/components/rich-text/shared/markdown-table.d.ts +41 -0
  32. package/dist/components/rich-text/shared/markdown-url-context.d.ts +9 -0
  33. package/dist/components/rich-text/shared/markdown-url.d.ts +3 -0
  34. package/dist/components/rich-text/shared/nodes/DataTableNode.d.ts +13 -11
  35. package/dist/components/rich-text/shared/nodes/MarkdownImageNode.d.ts +35 -0
  36. package/dist/components/rich-text/shared/nodes/MarkdownLinkNode.d.ts +18 -0
  37. package/dist/components/rich-text/shared/nodes/RawHtmlNode.d.ts +31 -0
  38. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/floating-toolbar-buttons.d.ts +4 -2
  39. package/dist/components/rich-text/shared/plugins/FloatingTextFormatToolbarPlugin/resolve-block-type.d.ts +1 -1
  40. package/dist/components/rich-text/shared/plugins/LinkEditorPlugin/utils/setFloatingElemPos.d.ts +1 -1
  41. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +1 -0
  42. package/dist/components/rich-text/shared/transformers/markdown-transformers.d.ts +2 -3
  43. package/dist/data-table.js +723 -923
  44. package/dist/data-table.js.map +1 -1
  45. package/dist/diff.js +4 -4
  46. package/dist/edit-mode-data-table-4GMiDy75.js +775 -0
  47. package/dist/edit-mode-data-table-4GMiDy75.js.map +1 -0
  48. package/dist/editor-config-Dyh8n5A2.js +2416 -0
  49. package/dist/editor-config-Dyh8n5A2.js.map +1 -0
  50. package/dist/index.js +142 -144
  51. package/dist/index.js.map +1 -1
  52. package/dist/{kanban-renderer-toolbar-Bcj_N1qr.js → kanban-renderer-toolbar-BcUZvGyY.js} +359 -361
  53. package/dist/kanban-renderer-toolbar-BcUZvGyY.js.map +1 -0
  54. package/dist/kanban-renderer.js +28 -27
  55. package/dist/kanban-renderer.js.map +1 -1
  56. package/dist/{lazy-markdown-editor-DwhqQ-NN.js → lazy-markdown-editor-CWSREEhf.js} +2 -2
  57. package/dist/{lazy-markdown-editor-DwhqQ-NN.js.map → lazy-markdown-editor-CWSREEhf.js.map} +1 -1
  58. package/dist/{list-row-BtoVJpFs.js → list-row-B8L4TGsh.js} +2 -2
  59. package/dist/{list-row-BtoVJpFs.js.map → list-row-B8L4TGsh.js.map} +1 -1
  60. package/dist/{mermaid-renderer-DZo3qj6D.js → mermaid-renderer-H3IhLqnQ.js} +3 -3
  61. package/dist/{mermaid-renderer-DZo3qj6D.js.map → mermaid-renderer-H3IhLqnQ.js.map} +1 -1
  62. package/dist/mermaid.js +1 -1
  63. package/dist/number-input-WUfejtNx.js +343 -0
  64. package/dist/number-input-WUfejtNx.js.map +1 -0
  65. package/dist/param-editor-field-C8zRDStn.js +2845 -0
  66. package/dist/param-editor-field-C8zRDStn.js.map +1 -0
  67. package/dist/{param-editor-XRjSu6MT.js → param-editor-w3xH-t8A.js} +2 -2
  68. package/dist/{param-editor-XRjSu6MT.js.map → param-editor-w3xH-t8A.js.map} +1 -1
  69. package/dist/rich-message-jZ2oPQhU.js +658 -0
  70. package/dist/rich-message-jZ2oPQhU.js.map +1 -0
  71. package/dist/rich-text.js +182 -110
  72. package/dist/rich-text.js.map +1 -1
  73. package/dist/style.css +1 -1
  74. package/dist/theme/recipes/button.d.ts +11 -0
  75. package/dist/{theme-7PDdD9OD.js → theme-J8K8KbZi.js} +12 -1
  76. package/dist/theme-J8K8KbZi.js.map +1 -0
  77. package/dist/{theme-preference-DOzHx64J.js → theme-preference-DyymrYpR.js} +2 -2
  78. package/dist/{theme-preference-DOzHx64J.js.map → theme-preference-DyymrYpR.js.map} +1 -1
  79. package/dist/theme.js +1 -1
  80. package/dist/{tree-list-B2L0cTj2.js → tree-list-CC13pOYi.js} +2 -2
  81. package/dist/{tree-list-B2L0cTj2.js.map → tree-list-CC13pOYi.js.map} +1 -1
  82. package/package.json +9 -1
  83. package/dist/browser-storage-BinyFNJX.js +0 -40
  84. package/dist/browser-storage-BinyFNJX.js.map +0 -1
  85. package/dist/checkbox-B2zYVemL.js +0 -70
  86. package/dist/checkbox-B2zYVemL.js.map +0 -1
  87. package/dist/components/data-table/editable-cells-story.d.ts +0 -9
  88. package/dist/kanban-renderer-toolbar-Bcj_N1qr.js.map +0 -1
  89. package/dist/markdown-DDd2ESoH.js +0 -743
  90. package/dist/markdown-DDd2ESoH.js.map +0 -1
  91. package/dist/markdown-editor-CYVkzt8t.js +0 -741
  92. package/dist/markdown-editor-CYVkzt8t.js.map +0 -1
  93. package/dist/param-editor-field-B9lEPq8c.js +0 -3028
  94. package/dist/param-editor-field-B9lEPq8c.js.map +0 -1
  95. package/dist/resource-badge-CuItchgL.js +0 -98
  96. package/dist/resource-badge-CuItchgL.js.map +0 -1
  97. package/dist/rich-message--eRzjWYK.js +0 -730
  98. package/dist/rich-message--eRzjWYK.js.map +0 -1
  99. package/dist/scroll-area-BMbg1WcD.js +0 -91
  100. package/dist/scroll-area-BMbg1WcD.js.map +0 -1
  101. package/dist/theme-7PDdD9OD.js.map +0 -1
@@ -1,730 +0,0 @@
1
- import { jsx as l, jsxs as A, Fragment as ee } from "react/jsx-runtime";
2
- import { c as L } from "react/compiler-runtime";
3
- import { Tooltip as j, Text as H, Flex as Y, Box as q, Kbd as Ne } from "@chakra-ui/react";
4
- import { MarkNode as Oe } 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 $e } from "@lexical/react/LexicalHistoryPlugin";
8
- import { OnChangePlugin as se } from "@lexical/react/LexicalOnChangePlugin";
9
- import { RichTextPlugin as le } from "@lexical/react/LexicalRichTextPlugin";
10
- import { createCommand as ce, ElementNode as Me, isHTMLElement as ve, $createParagraphNode as X, COMMAND_PRIORITY_LOW as ae, $getSelection as ke, $isRangeSelection as we, $isElementNode as Le, KEY_DOWN_COMMAND as Pe, COMMAND_PRIORITY_HIGH as Ae, TextNode as De, $getRoot as de, DecoratorNode as Be } from "lexical";
11
- import { useEffect as J, useImperativeHandle as Fe, useState as He, forwardRef as Je, useRef as Ke } from "react";
12
- import { t as ue, b as me, T as fe, f as pe, s as Ge, g as Ue, M as je, h as We, H as Ve, n as he, i as qe, C as Xe, I as Qe, E as Ye } from "./markdown-DDd2ESoH.js";
13
- import { useLexicalComposerContext as B } from "@lexical/react/LexicalComposerContext";
14
- import { $setBlocksType as ze } from "@lexical/selection";
15
- import { addClassNamesToElement as ge, mergeRegister as z } from "@lexical/utils";
16
- import { LexicalTypeaheadMenuPlugin as Ze } from "@lexical/react/LexicalTypeaheadMenuPlugin";
17
- import * as et from "react-dom";
18
- import { S as tt } from "./scroll-area-BMbg1WcD.js";
19
- import { LinkNode as nt, AutoLinkNode as rt } from "@lexical/link";
20
- import { ListNode as ot, ListItemNode as it } from "@lexical/list";
21
- import { $convertFromMarkdownString as _e, $convertToMarkdownString as st } from "@lexical/markdown";
22
- import { ClickableLinkPlugin as lt } from "@lexical/react/LexicalClickableLinkPlugin";
23
- import { HorizontalRulePlugin as ct } from "@lexical/react/LexicalHorizontalRulePlugin";
24
- import { LinkPlugin as at } from "@lexical/react/LexicalLinkPlugin";
25
- import { ListPlugin as dt } from "@lexical/react/LexicalListPlugin";
26
- import { TabIndentationPlugin as ut } from "@lexical/react/LexicalTabIndentationPlugin";
27
- import { QuoteNode as mt, HeadingNode as ft } from "@lexical/rich-text";
28
- import { CodeNode as pt, CodeHighlightNode as ht } from "@lexical/code";
29
- import { R as gt } from "./resource-badge-CuItchgL.js";
30
- const _t = "INSERT_REFERENCE", Et = "INSERT_BLOCK", Ee = ce(_t), xt = ce(Et);
31
- function bt(r) {
32
- const e = W();
33
- return r.style !== null && e.setFormat(r.style.textAlign), {
34
- node: e
35
- };
36
- }
37
- class G extends Me {
38
- static getType() {
39
- return "comment";
40
- }
41
- static clone(e) {
42
- return new G(e.__key);
43
- }
44
- createDOM(e) {
45
- const t = document.createElement("blockquote");
46
- return ge(t, e.theme.comment), t;
47
- }
48
- updateDOM() {
49
- return !1;
50
- }
51
- static importDOM() {
52
- return {
53
- blockquote: () => ({
54
- conversion: bt,
55
- priority: 0
56
- })
57
- };
58
- }
59
- exportDOM(e) {
60
- const {
61
- element: t
62
- } = super.exportDOM(e);
63
- if (t && ve(t)) {
64
- this.isEmpty() && t.append(document.createElement("br"));
65
- const n = this.getFormatType();
66
- t.style.textAlign = n;
67
- const o = this.getDirection();
68
- o && (t.dir = o);
69
- }
70
- return {
71
- element: t
72
- };
73
- }
74
- static importJSON(e) {
75
- const t = W();
76
- return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
77
- }
78
- exportJSON() {
79
- return {
80
- ...super.exportJSON(),
81
- type: "comment"
82
- };
83
- }
84
- getTextContent() {
85
- return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
86
- }
87
- // mutation
88
- insertNewAfter(e, t) {
89
- const n = X(), o = this.getDirection();
90
- return n.setDirection(o), this.insertAfter(n, t), n;
91
- }
92
- collapseAtStart() {
93
- const e = X();
94
- return this.getChildren().forEach((n) => {
95
- e.append(n);
96
- }), this.replace(e), !0;
97
- }
98
- }
99
- function W() {
100
- return new G();
101
- }
102
- const yt = (r, e) => {
103
- const t = ke(), n = W();
104
- if (e) {
105
- e.getParent()?.replace(n, !0), e.remove(), n.selectEnd();
106
- return;
107
- }
108
- we(t) && ze(t, W);
109
- };
110
- function St() {
111
- const r = L(3), [e] = B();
112
- let t, n;
113
- return r[0] !== e ? (t = () => z(e.registerCommand(xt, Ct, ae)), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), J(t, n), null;
114
- }
115
- function Ct(r) {
116
- const {
117
- optionId: e,
118
- nodeToReplace: t
119
- } = r;
120
- return yt(e, t), !1;
121
- }
122
- const It = () => {
123
- const r = L(3), [e] = B();
124
- let t, n;
125
- r[0] !== e ? (t = () => z(e.registerNodeTransform(G, (o) => {
126
- const s = o.getChildren().filter(Tt);
127
- s.length > 0 && e.update(() => {
128
- s.forEach(Rt);
129
- });
130
- })), n = [e], r[0] = e, r[1] = t, r[2] = n) : (t = r[1], n = r[2]), J(t, n);
131
- };
132
- function Tt(r) {
133
- return r.getType() === "comment";
134
- }
135
- function Rt(r) {
136
- r.replace(X(), !0);
137
- }
138
- function Nt() {
139
- return It(), St(), null;
140
- }
141
- const Ot = (r) => {
142
- let e = "";
143
- const t = r.getChildren(), n = t.length;
144
- for (let o = 0; o < n; o++) {
145
- const i = t[o];
146
- e += i.getTextContent(), Le(i) && o !== n - 1 && !i.isInline() && (e += `
147
- `);
148
- }
149
- return e;
150
- }, $t = (r) => r.type !== "reference" ? null : `#${r.name ?? r.referenceId ?? ""}`, Mt = (r) => r.type === "paragraph" && !!r.children?.length, xe = (r) => {
151
- if (r.type === "comment")
152
- return "";
153
- const e = $t(r);
154
- if (e !== null)
155
- return e;
156
- let t = typeof r.text == "string" ? r.text : "";
157
- const n = r.children;
158
- if (!Array.isArray(n)) return t;
159
- const o = n.length;
160
- for (let i = 0; i < o; i += 1) {
161
- const s = n[i];
162
- if (s.type === "comment") {
163
- i !== o - 1 && (t += `
164
- `);
165
- continue;
166
- }
167
- t += xe(s), Mt(s) && (t += `
168
- `);
169
- }
170
- return t;
171
- }, be = (r) => {
172
- try {
173
- const e = JSON.parse(r);
174
- return xe(e.root ?? {});
175
- } catch {
176
- return "";
177
- }
178
- }, vt = {
179
- root: {
180
- direction: "ltr",
181
- format: "",
182
- indent: 0,
183
- type: "root",
184
- version: 1,
185
- children: [{
186
- type: "paragraph",
187
- version: 1,
188
- format: "",
189
- indent: 0,
190
- textFormat: void 0,
191
- direction: null,
192
- children: []
193
- }]
194
- }
195
- };
196
- function kt(r = "") {
197
- return r.trim() ? {
198
- root: {
199
- direction: "ltr",
200
- format: "",
201
- indent: 0,
202
- type: "root",
203
- version: 1,
204
- children: r.split(/\r?\n/).map((n) => ({
205
- type: "paragraph",
206
- version: 1,
207
- format: "",
208
- indent: 0,
209
- textFormat: void 0,
210
- direction: null,
211
- children: n ? [{
212
- type: "text",
213
- version: 1,
214
- text: n,
215
- format: "",
216
- detail: 0,
217
- mode: "normal",
218
- style: ""
219
- }] : []
220
- }))
221
- }
222
- } : JSON.parse(JSON.stringify(vt));
223
- }
224
- function wt(r) {
225
- const e = L(4), {
226
- editorRef: t,
227
- previousTextRef: n
228
- } = r, [o] = B();
229
- let i, s;
230
- return e[0] !== o || e[1] !== n ? (i = () => ({
231
- setEditorValue: (a) => {
232
- const c = o.parseEditorState(JSON.stringify(kt(a)));
233
- o.setEditorState(c), n.current = be(a), o.focus(void 0, {
234
- defaultSelection: "rootEnd"
235
- });
236
- }
237
- }), s = [o, n], e[0] = o, e[1] = n, e[2] = i, e[3] = s) : (i = e[2], s = e[3]), Fe(t, i, s), null;
238
- }
239
- const Lt = (r) => r.key !== "Enter" ? !1 : !r.ctrlKey && !r.metaKey && !r.shiftKey && !r.altKey;
240
- function Pt(r) {
241
- const e = L(4), {
242
- onSubmit: t
243
- } = r, [n] = B();
244
- let o, i;
245
- return e[0] !== n || e[1] !== t ? (o = () => n.registerCommand(Pe, (s) => Lt(s) ? (s.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]), J(o, i), null;
246
- }
247
- const te = ["table", "connector"], At = (r) => r.sort((n, o) => te.indexOf(n.group) - te.indexOf(o.group)).map((n, o) => ({
248
- ...n,
249
- index: o
250
- })).reduce((n, o) => {
251
- const i = n[o.group] ?? [];
252
- return i.push(o), n[o.group] = i, n;
253
- }, {});
254
- function ne(r) {
255
- const e = L(22), {
256
- id: t,
257
- isSelected: n,
258
- onClick: o,
259
- onMouseEnter: i,
260
- setRefElement: s,
261
- secondaryLabel: a,
262
- primaryLabel: c,
263
- tabIndex: f
264
- } = r, u = f === void 0 ? -1 : f, x = n ? "bg.active" : "transparent", p = n ? "bg.active" : "bg.hover";
265
- let m;
266
- e[0] !== p ? (m = {
267
- bg: p
268
- }, e[0] = p, e[1] = m) : m = e[1];
269
- let _;
270
- e[2] !== c ? (_ = /* @__PURE__ */ l(j.Trigger, { children: /* @__PURE__ */ l(H, { mt: "1px", lineClamp: 1, textOverflow: "ellipsis", textStyle: "label/M/regular", children: c }) }), e[2] = c, e[3] = _) : _ = e[3];
271
- let h;
272
- e[4] !== c ? (h = /* @__PURE__ */ l(j.Positioner, { children: /* @__PURE__ */ l(j.Content, { children: c }) }), e[4] = c, e[5] = h) : h = e[5];
273
- let g;
274
- e[6] !== _ || e[7] !== h ? (g = /* @__PURE__ */ A(j.Root, { children: [
275
- _,
276
- h
277
- ] }), e[6] = _, e[7] = h, e[8] = g) : g = e[8];
278
- let E;
279
- e[9] !== a ? (E = a && /* @__PURE__ */ l(H, { lineClamp: 2, textOverflow: "ellipsis", textStyle: "label/S/regular", color: "fg.muted", children: a }), e[9] = a, e[10] = E) : E = e[10];
280
- let C;
281
- return e[11] !== t || e[12] !== n || e[13] !== o || e[14] !== i || e[15] !== s || e[16] !== x || e[17] !== m || e[18] !== g || e[19] !== E || e[20] !== u ? (C = /* @__PURE__ */ A(Y, { direction: "column", cursor: "pointer", gap: "2xs", padding: "2xs", paddingX: "sm", bg: x, _hover: m, tabIndex: u, ref: s, role: "option", "aria-selected": n, id: t, onMouseEnter: i, onClick: o, children: [
282
- g,
283
- E
284
- ] }), e[11] = t, e[12] = n, e[13] = o, e[14] = i, e[15] = s, e[16] = x, e[17] = m, e[18] = g, e[19] = E, e[20] = u, e[21] = C) : C = e[21], C;
285
- }
286
- const Dt = (r) => {
287
- const e = L(12), {
288
- options: t,
289
- selectedIndex: n,
290
- onSelectItem: o,
291
- onMouseEnterItem: i
292
- } = r, {
293
- table: s,
294
- connector: a
295
- } = At(t), c = s === void 0 ? [] : s, f = a === void 0 ? [] : a, u = [...c, ...f].length;
296
- let x, p;
297
- e[0] !== n ? (x = () => {
298
- document.getElementById(`typeahead-item-${n}`)?.scrollIntoView({
299
- behavior: "instant",
300
- block: "nearest"
301
- });
302
- }, p = [n], e[0] = n, e[1] = x, e[2] = p) : (x = e[1], p = e[2]), J(x, p);
303
- const m = tt, _ = "1000", h = "absolute", g = "modal", E = "24rem", C = !1;
304
- let b;
305
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (b = {
306
- base: "100vw",
307
- md: "264px"
308
- }, e[3] = b) : b = e[3];
309
- let S;
310
- e[4] !== u ? (S = !u && /* @__PURE__ */ l(H, { children: "No results" }), e[4] = u, e[5] = S) : S = e[5];
311
- const I = !!c.length && /* @__PURE__ */ A(ee, { children: [
312
- /* @__PURE__ */ l(H, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Tables" }),
313
- /* @__PURE__ */ l(q, { children: c.map((d) => /* @__PURE__ */ l(ne, { 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)) })
314
- ] }), O = !!f.length && /* @__PURE__ */ A(ee, { children: [
315
- /* @__PURE__ */ l(H, { paddingTop: "xs", paddingBottom: "2xs", paddingX: "sm", color: "fg.muted", textStyle: "label/S/medium", children: "Data Sources" }),
316
- /* @__PURE__ */ l(q, { children: f.map((d) => /* @__PURE__ */ l(ne, { 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)) })
317
- ] });
318
- let y;
319
- return e[6] !== m || e[7] !== S || e[8] !== I || e[9] !== O || e[10] !== b ? (y = /* @__PURE__ */ A(m, { zIndex: _, position: h, layerStyle: g, maxHeight: E, showHorizontalScrollbar: C, minWidth: b, children: [
320
- S,
321
- I,
322
- O
323
- ] }), e[6] = m, e[7] = S, e[8] = I, e[9] = O, e[10] = b, e[11] = y) : y = e[11], y;
324
- }, Bt = (r, e) => r.filter((t) => t.name.replace(/ /g, "_").toLowerCase().includes(e.toLowerCase()));
325
- function Ft(r, e = []) {
326
- const t = e.map((n, o) => ({
327
- id: n.resourceId,
328
- key: n.resourceId,
329
- index: o,
330
- group: n.resourceType,
331
- name: n.name,
332
- description: n.description,
333
- setRefElement: () => {
334
- }
335
- }));
336
- return r == null || r === "" ? t : Bt(t, r);
337
- }
338
- const ye = "\\.\\-<>_:", Z = ["#"].join(""), Se = `[^${Z}${ye}\\s]`, Ht = `(?:[${ye}]|)`, Ce = 75, Jt = new RegExp(`(^|\\s|\\()([${Z}]((?:${Se}${Ht}){0,${Ce}}))$`), Kt = new RegExp(`(^|\\s|\\()([${Z}]((?:${Se}){0,${Ce}}))$`);
339
- function Gt(r, e) {
340
- let t = Jt.exec(r);
341
- if (t === null && (t = Kt.exec(r)), t !== null) {
342
- const n = t[1], o = t[3];
343
- if (o.length >= e)
344
- return {
345
- leadOffset: t.index + n.length,
346
- matchingString: o,
347
- replaceableString: t[2]
348
- };
349
- }
350
- return null;
351
- }
352
- const Ut = 20;
353
- function jt(r) {
354
- const e = L(9), {
355
- items: t
356
- } = r;
357
- let n;
358
- e[0] !== t ? (n = t === void 0 ? [] : t, e[0] = t, e[1] = n) : n = e[1];
359
- const o = n, [i, s] = He(null), [a] = B(), c = Ft(i, o);
360
- let f;
361
- e[2] !== a ? (f = (h, g, E) => {
362
- a.update(() => {
363
- g && (a.dispatchCommand(Ee, {
364
- resourceId: h.id,
365
- resourceType: h.group,
366
- name: h.name,
367
- nodeToReplace: g
368
- }), E());
369
- });
370
- }, e[2] = a, e[3] = f) : f = e[3];
371
- const u = f, x = Vt;
372
- let p;
373
- e[4] !== c ? (p = c.slice(0, Ut), e[4] = c, e[5] = p) : p = e[5];
374
- const m = p;
375
- let _;
376
- return e[6] !== m || e[7] !== u ? (_ = /* @__PURE__ */ l(Ze, { onQueryChange: s, onSelectOption: u, triggerFn: x, options: m, menuRenderFn: Wt }), e[6] = m, e[7] = u, e[8] = _) : _ = e[8], _;
377
- }
378
- function Wt(r, e) {
379
- const {
380
- options: t,
381
- selectedIndex: n,
382
- selectOptionAndCleanUp: o,
383
- setHighlightedIndex: i
384
- } = e;
385
- return r.current ? et.createPortal(/* @__PURE__ */ l(Dt, { options: t, selectedIndex: n, onSelectItem: (s, a) => {
386
- i(a), o(s);
387
- }, onMouseEnterItem: (s) => {
388
- i(s);
389
- } }), r.current) : null;
390
- }
391
- function Vt(r) {
392
- return Gt(r, 0);
393
- }
394
- class K extends De {
395
- __referenceId;
396
- __name;
397
- static getType() {
398
- return "reference";
399
- }
400
- static clone(e) {
401
- return new K(e.__referenceId, e.__name, e.__key);
402
- }
403
- constructor(e, t, n) {
404
- super(t, n), this.__referenceId = e, this.__name = t;
405
- }
406
- isKeyboardSelectable() {
407
- return !1;
408
- }
409
- canBeEmpty() {
410
- return !1;
411
- }
412
- canInsertTextAfter() {
413
- return !1;
414
- }
415
- canInsertTextBefore() {
416
- return !1;
417
- }
418
- createDOM(e) {
419
- const t = document.createElement("span");
420
- return ge(t, e.theme.reference), t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, t;
421
- }
422
- updateDOM(e, t) {
423
- 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;
424
- }
425
- exportDOM(e) {
426
- const t = document.createElement("span");
427
- return t.setAttribute("data-reference-id", this.__referenceId), t.setAttribute("data-name", this.__name), t.textContent = `#${this.__name}`, {
428
- element: t
429
- };
430
- }
431
- static importDOM() {
432
- return {
433
- span: (e) => !e.hasAttribute("data-reference-id") || !e.hasAttribute("data-name") ? null : {
434
- conversion: qt,
435
- priority: 1
436
- }
437
- };
438
- }
439
- static importJSON(e) {
440
- return new K(e.referenceId, e.name);
441
- }
442
- exportJSON() {
443
- return {
444
- ...super.exportJSON(),
445
- type: "reference",
446
- referenceId: this.__referenceId,
447
- name: this.__name
448
- };
449
- }
450
- getTextContent() {
451
- return `#${this.__name}`;
452
- }
453
- }
454
- function qt(r) {
455
- const e = r.getAttribute("data-reference-id"), t = r.getAttribute("data-name");
456
- return !e || !t ? null : {
457
- node: Ie(e, t)
458
- };
459
- }
460
- function Ie(r, e) {
461
- return new K(r, e);
462
- }
463
- const Xt = (r, e, t) => {
464
- const n = Ie(e, t);
465
- if (r) {
466
- r?.replace(n), r.remove(), n.selectEnd();
467
- return;
468
- }
469
- };
470
- function Qt(r) {
471
- const e = L(4), {
472
- onAddReference: t
473
- } = r, [n] = B();
474
- let o, i;
475
- return e[0] !== n || e[1] !== t ? (o = () => z(n.registerCommand(Ee, (s) => {
476
- const {
477
- resourceId: a,
478
- resourceType: c,
479
- name: f,
480
- nodeToReplace: u
481
- } = s;
482
- return n.update(() => {
483
- Xt(u, a, f);
484
- }), t?.(a, c), !0;
485
- }, ae)), i = [n, t], e[0] = n, e[1] = t, e[2] = o, e[3] = i) : (o = e[2], i = e[3]), J(o, i), null;
486
- }
487
- const Yt = {
488
- ...ue,
489
- // Override paragraph class to remove margins specifically for prompt input
490
- paragraph: "rich-text__p rich-text__p--no-margin"
491
- }, zt = [G, Oe, K], Zt = (r, e) => {
492
- const t = L(39), {
493
- defaultState: n,
494
- debug: o,
495
- isEditable: i,
496
- placeholder: s
497
- } = r, a = o === void 0 ? !1 : o, c = i === void 0 ? !0 : i, {
498
- onChange: f,
499
- onError: u,
500
- onSubmit: x,
501
- references: p,
502
- onAddReference: m
503
- } = r, _ = u === void 0 ? en : u;
504
- let h;
505
- t[0] !== p ? (h = p === void 0 ? [] : p, t[0] = p, t[1] = h) : h = t[1];
506
- const g = h;
507
- let E;
508
- t[2] !== n || t[3] !== c || t[4] !== _ ? (E = {
509
- namespace: "PROMPT_EDITOR",
510
- nodes: zt,
511
- editorState: n,
512
- editable: c,
513
- onError: _,
514
- theme: Yt
515
- }, t[2] = n, t[3] = c, t[4] = _, t[5] = E) : E = t[5];
516
- const C = E;
517
- let b;
518
- t[6] !== n ? (b = be(n), t[6] = n, t[7] = b) : b = t[7];
519
- const S = Ke(b);
520
- let I;
521
- t[8] !== s ? (I = s ?? /* @__PURE__ */ A(H, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: [
522
- "Type your query here or press ",
523
- /* @__PURE__ */ l(Ne, { color: "fg.subtle", children: "#" }),
524
- " to add a reference."
525
- ] }), t[8] = s, t[9] = I) : I = t[9];
526
- const O = I;
527
- let y;
528
- t[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ l($e, {}), t[10] = y) : y = t[10];
529
- let d;
530
- t[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ l(me, { fullWidth: !0 }), t[11] = d) : d = t[11];
531
- let $;
532
- t[12] !== O ? ($ = /* @__PURE__ */ l(le, { contentEditable: d, placeholder: O, ErrorBoundary: ie }), t[12] = O, t[13] = $) : $ = t[13];
533
- let M;
534
- t[14] !== f ? (M = /* @__PURE__ */ l(se, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (U) => {
535
- U.read(() => {
536
- const Re = de(), V = Ot(Re);
537
- V !== S.current && (S.current = V, f?.(V, U.toJSON()));
538
- });
539
- } }), t[14] = f, t[15] = M) : M = t[15];
540
- let v;
541
- t[16] !== e ? (v = /* @__PURE__ */ l(wt, { editorRef: e, previousTextRef: S }), t[16] = e, t[17] = v) : v = t[17];
542
- let T;
543
- t[18] !== c ? (T = /* @__PURE__ */ l(fe, { isEditable: c }), t[18] = c, t[19] = T) : T = t[19];
544
- let k;
545
- t[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ l(Nt, {}), t[20] = k) : k = t[20];
546
- let R;
547
- t[21] !== x ? (R = /* @__PURE__ */ l(Pt, { onSubmit: x }), t[21] = x, t[22] = R) : R = t[22];
548
- let N;
549
- t[23] !== g ? (N = /* @__PURE__ */ l(jt, { items: g }), t[23] = g, t[24] = N) : N = t[24];
550
- let w;
551
- t[25] !== m ? (w = /* @__PURE__ */ l(Qt, { onAddReference: m }), t[25] = m, t[26] = w) : w = t[26];
552
- let P;
553
- t[27] !== a ? (P = a ? /* @__PURE__ */ l(pe, {}) : "", t[27] = a, t[28] = P) : P = t[28];
554
- let F;
555
- return t[29] !== C || t[30] !== $ || t[31] !== M || t[32] !== v || t[33] !== T || t[34] !== R || t[35] !== N || t[36] !== w || t[37] !== P ? (F = /* @__PURE__ */ l(Y, { direction: "column", justifyContent: "space-between", width: "100%", position: "relative", children: /* @__PURE__ */ A(oe, { initialConfig: C, children: [
556
- y,
557
- $,
558
- M,
559
- v,
560
- T,
561
- k,
562
- R,
563
- N,
564
- w,
565
- P
566
- ] }) }), t[29] = C, t[30] = $, t[31] = M, t[32] = v, t[33] = T, t[34] = R, t[35] = N, t[36] = w, t[37] = P, t[38] = F) : F = t[38], F;
567
- }, Pn = Je(Zt);
568
- function en() {
569
- }
570
- function tn(r) {
571
- const e = L(5), {
572
- value: t,
573
- onUpdate: n
574
- } = r, [o] = B();
575
- let i, s;
576
- return e[0] !== o || e[1] !== n || e[2] !== t ? (i = () => {
577
- o && o.update(() => n(t), {
578
- tag: "history-merge"
579
- });
580
- }, s = [t, o, n], e[0] = o, e[1] = n, e[2] = t, e[3] = i, e[4] = s) : (i = e[3], s = e[4]), J(i, s), null;
581
- }
582
- class D extends Be {
583
- __href;
584
- __label;
585
- static getType() {
586
- return "reference-link";
587
- }
588
- static clone(e) {
589
- return new D(e.__href, e.__label, e.__key);
590
- }
591
- constructor(e, t, n) {
592
- super(n), this.__href = e, this.__label = t;
593
- }
594
- createDOM(e, t) {
595
- return document.createElement("span");
596
- }
597
- updateDOM(e, t, n) {
598
- return !1;
599
- }
600
- getTextContent() {
601
- return `{{link('${this.__label ?? this.__href}')}}`;
602
- }
603
- exportJSON() {
604
- return {
605
- type: D.getType(),
606
- version: 1,
607
- href: this.__href,
608
- label: this.__label
609
- };
610
- }
611
- static importJSON(e) {
612
- return Te(e.href, e.label);
613
- }
614
- decorate(e, t) {
615
- const n = this.__href, i = n.split("/").pop() || "unknown", s = /^https?:\/\//i.test(n), a = /^#?\$PROJECT\//i.test(n);
616
- return /* @__PURE__ */ l(q, { width: "fit-content", display: "inline-block", children: /* @__PURE__ */ l(gt, { fileName: i, onSelect: () => {
617
- if (s)
618
- window.open(n, "_blank", "noopener,noreferrer");
619
- else if (a) {
620
- const c = n.replace(/^#?\$PROJECT\//i, ""), f = new CustomEvent("ui:open-project-file", {
621
- detail: c
622
- });
623
- window.dispatchEvent(f);
624
- } else
625
- window.location.assign(n);
626
- } }) });
627
- }
628
- }
629
- function Te(r, e) {
630
- return new D(r, e);
631
- }
632
- function nn(r) {
633
- return r instanceof D;
634
- }
635
- const re = /\{\{\s*link\((['"])([^'"\s]+)\1\)\s*\}\}/, rn = {
636
- dependencies: [D],
637
- export: (r) => {
638
- if (nn(r)) {
639
- const e = r.__href, t = r.__label ?? e;
640
- return t ? `{{link('${t}')}}` : `{{link('${e}')}}`;
641
- }
642
- return null;
643
- },
644
- regExp: re,
645
- importRegExp: re,
646
- replace: (r, e) => {
647
- const t = e[2], o = /^(https?:\/\/|\/)/i.test(t) ? t : `#${t}`, i = t;
648
- r.replace(Te(o, i));
649
- },
650
- type: "text-match"
651
- }, Q = [...qe, rn];
652
- function An(r) {
653
- const e = L(37), {
654
- debug: t,
655
- defaultState: n,
656
- fullWidth: o,
657
- isEditable: i,
658
- onChange: s
659
- } = r, a = t === void 0 ? !1 : t, c = n === void 0 ? "" : n, f = o === void 0 ? !1 : o, u = i === void 0 ? !1 : i;
660
- let x;
661
- e[0] !== c ? (x = Ge(c), e[0] = c, e[1] = x) : x = e[1];
662
- const {
663
- frontmatter: p,
664
- body: m
665
- } = x, _ = u && !!s;
666
- let h;
667
- e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = [mt, nt, rt, Ue, ft, ot, it, pt, ht, je, We, Ve, D], e[2] = h) : h = e[2];
668
- let g;
669
- e[3] !== m ? (g = () => _e(he(m), Q, void 0, !1), e[3] = m, e[4] = g) : g = e[4];
670
- let E;
671
- e[5] !== u || e[6] !== g ? (E = {
672
- namespace: "RICH_MESSAGE",
673
- nodes: h,
674
- editorState: g,
675
- onError: sn,
676
- editable: u,
677
- theme: ue
678
- }, e[5] = u, e[6] = g, e[7] = E) : E = e[7];
679
- const C = E;
680
- let b;
681
- e[8] !== m ? (b = /* @__PURE__ */ l(tn, { value: m, onUpdate: on }), e[8] = m, e[9] = b) : b = e[9];
682
- let S, I, O;
683
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (O = /* @__PURE__ */ l(at, {}), S = /* @__PURE__ */ l(lt, { newTab: !0 }), I = /* @__PURE__ */ l(dt, {}), e[10] = S, e[11] = I, e[12] = O) : (S = e[10], I = e[11], O = e[12]);
684
- let y;
685
- e[13] !== u ? (y = u ? /* @__PURE__ */ l(ut, { maxIndent: 7 }) : null, e[13] = u, e[14] = y) : y = e[14];
686
- let d, $, M, v;
687
- e[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ l(ct, {}), $ = /* @__PURE__ */ l(Xe, {}), M = /* @__PURE__ */ l(Qe, {}), v = /* @__PURE__ */ l(Ye, {}), e[15] = d, e[16] = $, e[17] = M, e[18] = v) : (d = e[15], $ = e[16], M = e[17], v = e[18]);
688
- let T;
689
- e[19] !== f ? (T = /* @__PURE__ */ l(le, { contentEditable: /* @__PURE__ */ l(me, { fullWidth: f, isRichMessage: !0 }), ErrorBoundary: ie }), e[19] = f, e[20] = T) : T = e[20];
690
- let k;
691
- e[21] !== p || e[22] !== s || e[23] !== _ ? (k = _ ? /* @__PURE__ */ l(se, { ignoreSelectionChange: !0, ignoreHistoryMergeTagChange: !1, onChange: (P) => {
692
- P.read(() => {
693
- const F = de(), U = st(Q, F);
694
- s?.(p + U);
695
- });
696
- } }) : null, e[21] = p, e[22] = s, e[23] = _, e[24] = k) : k = e[24];
697
- let R;
698
- e[25] !== u ? (R = /* @__PURE__ */ l(fe, { isEditable: u }), e[25] = u, e[26] = R) : R = e[26];
699
- let N;
700
- e[27] !== a ? (N = a && /* @__PURE__ */ l(pe, {}), e[27] = a, e[28] = N) : N = e[28];
701
- let w;
702
- return e[29] !== C || e[30] !== y || e[31] !== T || e[32] !== k || e[33] !== R || e[34] !== N || e[35] !== b ? (w = /* @__PURE__ */ l(Y, { className: "rich-text", "data-rich-message": "true", justifyContent: "space-between", width: "100%", maxWidth: "100%", height: "100%", position: "relative", direction: "column", overflow: "hidden", children: /* @__PURE__ */ A(oe, { initialConfig: C, children: [
703
- b,
704
- O,
705
- S,
706
- I,
707
- y,
708
- d,
709
- $,
710
- M,
711
- v,
712
- T,
713
- k,
714
- R,
715
- N
716
- ] }) }), e[29] = C, e[30] = y, e[31] = T, e[32] = k, e[33] = R, e[34] = N, e[35] = b, e[36] = w) : w = e[36], w;
717
- }
718
- function on(r) {
719
- _e(he(r), Q, void 0, !1);
720
- }
721
- function sn(r) {
722
- return console.error(r);
723
- }
724
- export {
725
- Pn as P,
726
- An as R,
727
- be as a,
728
- kt as g
729
- };
730
- //# sourceMappingURL=rich-message--eRzjWYK.js.map