@pstdio/ui 0.41.0 → 0.42.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.
- package/dist/{MermaidComponent-BCiI63_G.js → MermaidComponent-D7vhkpka.js} +2 -2
- package/dist/{MermaidComponent-BCiI63_G.js.map → MermaidComponent-D7vhkpka.js.map} +1 -1
- package/dist/alert-MQ47wy7f.js +388 -0
- package/dist/alert-MQ47wy7f.js.map +1 -0
- package/dist/chat-ui.d.ts +36 -5
- package/dist/chat-ui.js +1777 -1422
- package/dist/chat-ui.js.map +1 -1
- package/dist/collection-view-fields-D3cysHNT.d.ts +232 -0
- package/dist/collection-view-grouping-D4nZk8-3.js +90 -0
- package/dist/collection-view-grouping-D4nZk8-3.js.map +1 -0
- package/dist/collection-view-search-CpjJy76w.js +1973 -0
- package/dist/collection-view-search-CpjJy76w.js.map +1 -0
- package/dist/collection-view.d.ts +4 -0
- package/dist/collection-view.js +2 -0
- package/dist/{data-table-stats-row-EiTEONdY.js → data-table-stats-row-64magT2g.js} +2 -2
- package/dist/{data-table-stats-row-EiTEONdY.js.map → data-table-stats-row-64magT2g.js.map} +1 -1
- package/dist/data-table.d.ts +3 -1
- package/dist/data-table.js +279 -277
- package/dist/data-table.js.map +1 -1
- package/dist/{diff-drawer-BwZBOObe.js → diff-drawer-IYpQ-QQK.js} +192 -191
- package/dist/diff-drawer-IYpQ-QQK.js.map +1 -0
- package/dist/{diff-viewer-kOOd7C7h.js → diff-viewer-C-0VAt9P.js} +4 -4
- package/dist/{diff-viewer-kOOd7C7h.js.map → diff-viewer-C-0VAt9P.js.map} +1 -1
- package/dist/diff.js +2 -2
- package/dist/{display-sort-control-DPxc0e5z.js → display-sort-control-f3rbILsV.js} +87 -86
- package/dist/{display-sort-control-DPxc0e5z.js.map → display-sort-control-f3rbILsV.js.map} +1 -1
- package/dist/drop-indicator-HjlBSIeV.js +27 -0
- package/dist/drop-indicator-HjlBSIeV.js.map +1 -0
- package/dist/edit-mode-data-table-DnMB2jiy.js +1449 -0
- package/dist/edit-mode-data-table-DnMB2jiy.js.map +1 -0
- package/dist/host-storage-BIo5azql.js +31 -0
- package/dist/host-storage-BIo5azql.js.map +1 -0
- package/dist/host-storage-J0089Hyk.d.ts +17 -0
- package/dist/icon-options-Tt6Wzhtv.js +308 -0
- package/dist/icon-options-Tt6Wzhtv.js.map +1 -0
- package/dist/{index-C9mywhyX.d.ts → index-B79hwNcB.d.ts} +17 -1
- package/dist/index-CKsd23jv.d.ts +80 -0
- package/dist/{index-D3UJyWWh.d.ts → index-ICoad2I_.d.ts} +4 -223
- package/dist/index.d.ts +22 -6
- package/dist/index.js +1174 -1112
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +2 -1
- package/dist/kanban-renderer.js +531 -528
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/list-row-Z4SHkseA.js +1195 -0
- package/dist/list-row-Z4SHkseA.js.map +1 -0
- package/dist/markdown-editor-Dd4mor7l.js +3236 -0
- package/dist/markdown-editor-Dd4mor7l.js.map +1 -0
- package/dist/number-input-7K66wnSC.js +63 -0
- package/dist/number-input-7K66wnSC.js.map +1 -0
- package/dist/param-editor-Dnix-fJo.js +225 -0
- package/dist/param-editor-Dnix-fJo.js.map +1 -0
- package/dist/param-editor-field-B3vLST-B.js +2394 -0
- package/dist/param-editor-field-B3vLST-B.js.map +1 -0
- package/dist/param-editor.js +4 -2
- package/dist/prism-OG4H7Hu4.js +334 -0
- package/dist/prism-OG4H7Hu4.js.map +1 -0
- package/dist/queued-follow-up-Bj_vtMgd.js +208 -0
- package/dist/queued-follow-up-Bj_vtMgd.js.map +1 -0
- package/dist/rich-text-BgEnAHr2.js +1160 -0
- package/dist/rich-text-BgEnAHr2.js.map +1 -0
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.js +4 -2
- package/dist/terminal.js +1 -1
- package/dist/{theme-at0rtSnX.js → theme-CMJdH59Z.js} +224 -90
- package/dist/theme-CMJdH59Z.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/tree-list-jarhD31R.js +1652 -0
- package/dist/tree-list-jarhD31R.js.map +1 -0
- package/dist/use-virtualizer-uj43XjBp.js +10 -0
- package/dist/use-virtualizer-uj43XjBp.js.map +1 -0
- package/dist/{host-storage-DP0RLj4i.d.ts → workspace-badge-BKtB805G.d.ts} +6 -16
- package/package.json +6 -2
- package/dist/chat-question-bubble-w2vMbFsS.js +0 -68
- package/dist/chat-question-bubble-w2vMbFsS.js.map +0 -1
- package/dist/diff-drawer-BwZBOObe.js.map +0 -1
- package/dist/list-row-DM0DiIrN.js +0 -1167
- package/dist/list-row-DM0DiIrN.js.map +0 -1
- package/dist/prism-JVIsQMoJ.js +0 -1029
- package/dist/prism-JVIsQMoJ.js.map +0 -1
- package/dist/rich-text-DM24VNQZ.js +0 -10447
- package/dist/rich-text-DM24VNQZ.js.map +0 -1
- package/dist/theme-at0rtSnX.js.map +0 -1
- package/dist/tree-list-Cqgl8mnN.js +0 -1621
- package/dist/tree-list-Cqgl8mnN.js.map +0 -1
|
@@ -0,0 +1,1160 @@
|
|
|
1
|
+
import { n as e, o as t, r as n, s as r, t as i } from "./alert-MQ47wy7f.js";
|
|
2
|
+
import { t as a } from "./scroll-area-Cr1lNXAr.js";
|
|
3
|
+
import { t as o } from "./list-row-Z4SHkseA.js";
|
|
4
|
+
import { t as s } from "./empty-state-3mVV_pV-.js";
|
|
5
|
+
import { C as c, D as l, E as u, O as d, S as f, T as p, a as m, c as h, d as g, f as _, g as v, h as y, i as b, l as x, o as S, p as C, r as w, s as T, u as E } from "./markdown-editor-Dd4mor7l.js";
|
|
6
|
+
import { Box as D, Button as O, Flex as ee, HStack as k, Icon as A, Spinner as j, Stack as M, Table as N, Text as P, Textarea as F, useSlotRecipe as I } from "@chakra-ui/react";
|
|
7
|
+
import { c as L } from "react/compiler-runtime";
|
|
8
|
+
import { jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
9
|
+
import { forwardRef as B, useEffect as V, useImperativeHandle as H, useLayoutEffect as U, useRef as W, useState as G } from "react";
|
|
10
|
+
import { Activity as K, Bell as q, CircleAlert as J, Component as Y, ExternalLink as te, GitBranch as ne, Info as re, MessageCircle as ie, ScanSearch as ae, Sparkles as X } from "lucide-react";
|
|
11
|
+
import { LexicalCollaboration as oe } from "@lexical/react/LexicalCollaborationContext";
|
|
12
|
+
import { CollaborationPluginV2__EXPERIMENTAL as se } from "@lexical/react/LexicalCollaborationPlugin";
|
|
13
|
+
import { LexicalComposer as ce } from "@lexical/react/LexicalComposer";
|
|
14
|
+
import { LexicalErrorBoundary as le } from "@lexical/react/LexicalErrorBoundary";
|
|
15
|
+
import { HorizontalRulePlugin as ue } from "@lexical/react/LexicalHorizontalRulePlugin";
|
|
16
|
+
import { LinkPlugin as de } from "@lexical/react/LexicalLinkPlugin";
|
|
17
|
+
import { ListPlugin as fe } from "@lexical/react/LexicalListPlugin";
|
|
18
|
+
import { RichTextPlugin as pe } from "@lexical/react/LexicalRichTextPlugin";
|
|
19
|
+
import { TabIndentationPlugin as me } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
20
|
+
import { WebsocketProvider as he } from "y-websocket";
|
|
21
|
+
import * as Z from "yjs";
|
|
22
|
+
import { $addUpdateTag as Q, $createParagraphNode as ge, $createRangeSelection as _e, $createTextNode as ve, $getNodeByKey as ye, $getRoot as be, $getSelection as xe, $isElementNode as Se, $isRangeSelection as Ce, $isTextNode as we, $setSelection as Te, COMMAND_PRIORITY_HIGH as Ee, COMMAND_PRIORITY_LOW as De, ElementNode as Oe, INSERT_LINE_BREAK_COMMAND as ke, INSERT_PARAGRAPH_COMMAND as Ae, KEY_DOWN_COMMAND as je, TextNode as Me, createCommand as Ne, isHTMLElement as Pe } from "lexical";
|
|
23
|
+
import { useLexicalComposerContext as $ } from "@lexical/react/LexicalComposerContext";
|
|
24
|
+
import { addClassNamesToElement as Fe, mergeRegister as Ie } from "@lexical/utils";
|
|
25
|
+
import { createPortal as Le } from "react-dom";
|
|
26
|
+
import { $setBlocksType as Re } from "@lexical/selection";
|
|
27
|
+
import { OnChangePlugin as ze } from "@lexical/react/LexicalOnChangePlugin";
|
|
28
|
+
import { LexicalTypeaheadMenuPlugin as Be, MenuOption as Ve } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
29
|
+
import { HistoryPlugin as He } from "@lexical/react/LexicalHistoryPlugin";
|
|
30
|
+
import { MarkNode as Ue } from "@lexical/mark";
|
|
31
|
+
import { ClickableLinkPlugin as We } from "@lexical/react/LexicalClickableLinkPlugin";
|
|
32
|
+
//#region src/components/rich-text/collaborative-markdown-editor/awareness-cursors.tsx
|
|
33
|
+
function Ge() {
|
|
34
|
+
let e = L(1), t;
|
|
35
|
+
return e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ R("style", { children: "\n .collaboration-cursor-container {\n position: relative;\n display: inline;\n }\n\n .collaboration-cursor-caret {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 2px;\n pointer-events: none;\n }\n\n .collaboration-cursor-label {\n position: absolute;\n top: -18px;\n left: -2px;\n padding: 1px 6px;\n font-size: 11px;\n font-weight: 600;\n line-height: 16px;\n white-space: nowrap;\n border-radius: 4px 4px 4px 0;\n color: #fff;\n pointer-events: none;\n user-select: none;\n }\n\n .collaboration-cursor-selection {\n position: absolute;\n pointer-events: none;\n opacity: 0.25;\n }\n " }), e[0] = t) : t = e[0], t;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/rich-text/collaborative-markdown-editor/collaborative-markdown-editor.tsx
|
|
39
|
+
function Ke(e) {
|
|
40
|
+
let t = L(43), { roomId: n, wsUrl: r, wsParams: i, userName: a, userColor: o, placeholder: s } = e, c;
|
|
41
|
+
t[0] === i ? c = t[1] : (c = i === void 0 ? {} : i, t[0] = i, t[1] = c);
|
|
42
|
+
let l = c, u = a === void 0 ? "Anonymous" : a, f = o === void 0 ? "#30bced" : o, p = W(null), [m, v] = G(null), [b, S] = G(!1), [w] = G(Je), O;
|
|
43
|
+
t[2] !== w || t[3] !== n || t[4] !== l || t[5] !== r ? (O = () => {
|
|
44
|
+
let e = new he(r, n, w, {
|
|
45
|
+
params: l,
|
|
46
|
+
connect: !1
|
|
47
|
+
});
|
|
48
|
+
return e.on("sync", (e) => {
|
|
49
|
+
e && S(!0);
|
|
50
|
+
}), e;
|
|
51
|
+
}, t[2] = w, t[3] = n, t[4] = l, t[5] = r, t[6] = O) : O = t[6];
|
|
52
|
+
let [k] = G(O), A, j;
|
|
53
|
+
t[7] === k ? (A = t[8], j = t[9]) : (A = () => (k.connect(), () => {
|
|
54
|
+
k.disconnect();
|
|
55
|
+
}), j = [k], t[7] = k, t[8] = A, t[9] = j), V(A, j);
|
|
56
|
+
let M, N;
|
|
57
|
+
t[10] === Symbol.for("react.memo_cache_sentinel") ? (M = () => {
|
|
58
|
+
v(p.current);
|
|
59
|
+
}, N = [], t[10] = M, t[11] = N) : (M = t[10], N = t[11]), V(M, N);
|
|
60
|
+
let P;
|
|
61
|
+
t[12] === Symbol.for("react.memo_cache_sentinel") ? (P = {
|
|
62
|
+
namespace: "COLLABORATIVE_EDITOR",
|
|
63
|
+
nodes: _,
|
|
64
|
+
editorState: null,
|
|
65
|
+
onError: qe,
|
|
66
|
+
editable: !0,
|
|
67
|
+
theme: C
|
|
68
|
+
}, t[12] = P) : P = t[12];
|
|
69
|
+
let F = P, I;
|
|
70
|
+
t[13] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ R(Ge, {}), t[13] = I) : I = t[13];
|
|
71
|
+
let B = k, H;
|
|
72
|
+
t[14] !== w || t[15] !== n || t[16] !== B || t[17] !== f || t[18] !== u ? (H = /* @__PURE__ */ R(se, {
|
|
73
|
+
id: n,
|
|
74
|
+
doc: w,
|
|
75
|
+
provider: B,
|
|
76
|
+
__shouldBootstrapUnsafe: !1,
|
|
77
|
+
username: u,
|
|
78
|
+
cursorColor: f
|
|
79
|
+
}), t[14] = w, t[15] = n, t[16] = B, t[17] = f, t[18] = u, t[19] = H) : H = t[19];
|
|
80
|
+
let U, K, q, J, Y, te, ne;
|
|
81
|
+
t[20] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ R(de, {}), K = /* @__PURE__ */ R(fe, {}), q = /* @__PURE__ */ R(T, {}), J = /* @__PURE__ */ R(me, { maxIndent: 7 }), Y = /* @__PURE__ */ R(ue, {}), te = /* @__PURE__ */ R(x, {}), ne = /* @__PURE__ */ R(E, {}), t[20] = U, t[21] = K, t[22] = q, t[23] = J, t[24] = Y, t[25] = te, t[26] = ne) : (U = t[20], K = t[21], q = t[22], J = t[23], Y = t[24], te = t[25], ne = t[26]);
|
|
82
|
+
let re;
|
|
83
|
+
t[27] === m ? re = t[28] : (re = /* @__PURE__ */ R(g, { anchorElem: m }), t[27] = m, t[28] = re);
|
|
84
|
+
let ie;
|
|
85
|
+
t[29] === Symbol.for("react.memo_cache_sentinel") ? (ie = /* @__PURE__ */ R(y, {}), t[29] = ie) : ie = t[29];
|
|
86
|
+
let ae;
|
|
87
|
+
t[30] === Symbol.for("react.memo_cache_sentinel") ? (ae = /* @__PURE__ */ R(d, { fullWidth: !1 }), t[30] = ae) : ae = t[30];
|
|
88
|
+
let X;
|
|
89
|
+
t[31] !== s || t[32] !== b ? (X = b && s ? /* @__PURE__ */ R(D, {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
top: "0",
|
|
92
|
+
color: "fg.muted",
|
|
93
|
+
pointerEvents: "none",
|
|
94
|
+
userSelect: "none",
|
|
95
|
+
textStyle: "paragraph/M/regular",
|
|
96
|
+
children: s
|
|
97
|
+
}) : null, t[31] = s, t[32] = b, t[33] = X) : X = t[33];
|
|
98
|
+
let Z;
|
|
99
|
+
t[34] === X ? Z = t[35] : (Z = /* @__PURE__ */ R(pe, {
|
|
100
|
+
contentEditable: ae,
|
|
101
|
+
placeholder: X,
|
|
102
|
+
ErrorBoundary: le
|
|
103
|
+
}), t[34] = X, t[35] = Z);
|
|
104
|
+
let Q;
|
|
105
|
+
t[36] === m ? Q = t[37] : (Q = m ? /* @__PURE__ */ R(h, { anchorElem: m }) : null, t[36] = m, t[37] = Q);
|
|
106
|
+
let ge;
|
|
107
|
+
return t[38] !== H || t[39] !== re || t[40] !== Z || t[41] !== Q ? (ge = /* @__PURE__ */ z(ee, {
|
|
108
|
+
ref: p,
|
|
109
|
+
className: "rich-text",
|
|
110
|
+
justifyContent: "space-between",
|
|
111
|
+
width: "100%",
|
|
112
|
+
maxWidth: "100%",
|
|
113
|
+
height: "100%",
|
|
114
|
+
position: "relative",
|
|
115
|
+
direction: "column",
|
|
116
|
+
overflow: "visible",
|
|
117
|
+
children: [I, /* @__PURE__ */ R(ce, {
|
|
118
|
+
initialConfig: F,
|
|
119
|
+
children: /* @__PURE__ */ z(oe, { children: [
|
|
120
|
+
H,
|
|
121
|
+
U,
|
|
122
|
+
K,
|
|
123
|
+
q,
|
|
124
|
+
J,
|
|
125
|
+
Y,
|
|
126
|
+
te,
|
|
127
|
+
ne,
|
|
128
|
+
re,
|
|
129
|
+
ie,
|
|
130
|
+
Z,
|
|
131
|
+
Q
|
|
132
|
+
] })
|
|
133
|
+
})]
|
|
134
|
+
}), t[38] = H, t[39] = re, t[40] = Z, t[41] = Q, t[42] = ge) : ge = t[42], ge;
|
|
135
|
+
}
|
|
136
|
+
function qe(e) {
|
|
137
|
+
return console.error(e);
|
|
138
|
+
}
|
|
139
|
+
function Je() {
|
|
140
|
+
return new Z.Doc();
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/rich-text/prompt-input/commands.ts
|
|
144
|
+
var Ye = Ne("INSERT_BLOCK");
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.tsx
|
|
147
|
+
function Xe(e) {
|
|
148
|
+
let t = Qe();
|
|
149
|
+
return e.style !== null && t.setFormat(e.style.textAlign), { node: t };
|
|
150
|
+
}
|
|
151
|
+
var Ze = class e extends Oe {
|
|
152
|
+
static getType() {
|
|
153
|
+
return "comment";
|
|
154
|
+
}
|
|
155
|
+
static clone(t) {
|
|
156
|
+
return new e(t.__key);
|
|
157
|
+
}
|
|
158
|
+
createDOM(e) {
|
|
159
|
+
let t = document.createElement("blockquote");
|
|
160
|
+
return Fe(t, e.theme.comment), t;
|
|
161
|
+
}
|
|
162
|
+
updateDOM() {
|
|
163
|
+
return !1;
|
|
164
|
+
}
|
|
165
|
+
static importDOM() {
|
|
166
|
+
return { blockquote: () => ({
|
|
167
|
+
conversion: Xe,
|
|
168
|
+
priority: 0
|
|
169
|
+
}) };
|
|
170
|
+
}
|
|
171
|
+
exportDOM(e) {
|
|
172
|
+
let { element: t } = super.exportDOM(e);
|
|
173
|
+
if (t && Pe(t)) {
|
|
174
|
+
this.isEmpty() && t.append(document.createElement("br"));
|
|
175
|
+
let e = this.getFormatType();
|
|
176
|
+
t.style.textAlign = e;
|
|
177
|
+
let n = this.getDirection();
|
|
178
|
+
n && (t.dir = n);
|
|
179
|
+
}
|
|
180
|
+
return { element: t };
|
|
181
|
+
}
|
|
182
|
+
static importJSON(e) {
|
|
183
|
+
let t = Qe();
|
|
184
|
+
return t.setFormat(e.format), t.setIndent(e.indent), t.setDirection(e.direction), t;
|
|
185
|
+
}
|
|
186
|
+
exportJSON() {
|
|
187
|
+
return {
|
|
188
|
+
...super.exportJSON(),
|
|
189
|
+
type: "comment"
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
getTextContent() {
|
|
193
|
+
return `{{! ${super.getTextContent().replace(/([{}])/g, "\\$1")} }}`;
|
|
194
|
+
}
|
|
195
|
+
insertNewAfter(e, t) {
|
|
196
|
+
let n = ge(), r = this.getDirection();
|
|
197
|
+
return n.setDirection(r), this.insertAfter(n, t), n;
|
|
198
|
+
}
|
|
199
|
+
collapseAtStart() {
|
|
200
|
+
let e = ge();
|
|
201
|
+
return this.getChildren().forEach((t) => {
|
|
202
|
+
e.append(t);
|
|
203
|
+
}), this.replace(e), !0;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
function Qe() {
|
|
207
|
+
return new Ze();
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentCommands.ts
|
|
211
|
+
var $e = (e, t) => {
|
|
212
|
+
let n = xe(), r = Qe();
|
|
213
|
+
if (t) {
|
|
214
|
+
t.getParent()?.replace(r, !0), t.remove(), r.selectEnd();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
Ce(n) && Re(n, Qe);
|
|
218
|
+
};
|
|
219
|
+
function et() {
|
|
220
|
+
let e = L(3), [t] = $(), n, r;
|
|
221
|
+
return e[0] === t ? (n = e[1], r = e[2]) : (n = () => Ie(t.registerCommand(Ye, tt, De)), r = [t], e[0] = t, e[1] = n, e[2] = r), V(n, r), null;
|
|
222
|
+
}
|
|
223
|
+
function tt(e) {
|
|
224
|
+
let { optionId: t, nodeToReplace: n } = e;
|
|
225
|
+
return $e(t, n), !1;
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/components/rich-text/prompt-input/plugins/CommentPlugin/hooks/useCommentSchema.ts
|
|
229
|
+
var nt = () => {
|
|
230
|
+
let e = L(3), [t] = $(), n, r;
|
|
231
|
+
e[0] === t ? (n = e[1], r = e[2]) : (n = () => Ie(t.registerNodeTransform(Ze, (e) => {
|
|
232
|
+
let n = e.getChildren().filter(rt);
|
|
233
|
+
n.length > 0 && t.update(() => {
|
|
234
|
+
n.forEach(it);
|
|
235
|
+
});
|
|
236
|
+
})), r = [t], e[0] = t, e[1] = n, e[2] = r), V(n, r);
|
|
237
|
+
};
|
|
238
|
+
function rt(e) {
|
|
239
|
+
return e.getType() === "comment";
|
|
240
|
+
}
|
|
241
|
+
function it(e) {
|
|
242
|
+
e.replace(ge(), !0);
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/components/rich-text/prompt-input/plugins/CommentPlugin/CommentPlugin.tsx
|
|
246
|
+
function at() {
|
|
247
|
+
return nt(), et(), null;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/components/rich-text/prompt-input/plugins/command-query.ts
|
|
251
|
+
var ot = (e) => {
|
|
252
|
+
let t = /(?:^|\s)(\/[^\s/]*)$/.exec(e)?.[1];
|
|
253
|
+
return t ? {
|
|
254
|
+
leadOffset: e.length - t.length,
|
|
255
|
+
matchingString: t.slice(1),
|
|
256
|
+
replaceableString: t
|
|
257
|
+
} : null;
|
|
258
|
+
}, st = class extends Ve {
|
|
259
|
+
command;
|
|
260
|
+
constructor(e) {
|
|
261
|
+
super(e.name), this.command = e;
|
|
262
|
+
}
|
|
263
|
+
}, ct = (e) => {
|
|
264
|
+
let t = L(21), { options: n, selectedIndex: r, onSelect: i, onHighlight: s } = e, c;
|
|
265
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (c = { key: "menu" }, t[0] = c) : c = t[0];
|
|
266
|
+
let l = I(c), u;
|
|
267
|
+
t[1] === l ? u = t[2] : (u = l(), t[1] = l, t[2] = u);
|
|
268
|
+
let d = u, f, p;
|
|
269
|
+
t[3] !== n || t[4] !== r ? (f = () => {
|
|
270
|
+
n[r ?? -1]?.ref?.current?.scrollIntoView({ block: "nearest" });
|
|
271
|
+
}, p = [n, r], t[3] = n, t[4] = r, t[5] = f, t[6] = p) : (f = t[5], p = t[6]), V(f, p);
|
|
272
|
+
let m = d.content, h;
|
|
273
|
+
if (t[7] !== s || t[8] !== i || t[9] !== n || t[10] !== r) {
|
|
274
|
+
let e;
|
|
275
|
+
t[12] !== s || t[13] !== i || t[14] !== r ? (e = (e, t) => /* @__PURE__ */ R(o, {
|
|
276
|
+
id: `typeahead-item-${t}`,
|
|
277
|
+
ref: e.setRefElement,
|
|
278
|
+
role: "option",
|
|
279
|
+
"aria-label": e.command.name,
|
|
280
|
+
"aria-disabled": !!e.command.disabledReason,
|
|
281
|
+
tabIndex: -1,
|
|
282
|
+
variant: "full-width",
|
|
283
|
+
label: e.command.name,
|
|
284
|
+
description: e.command.disabledReason ?? e.command.description,
|
|
285
|
+
disabled: !!e.command.disabledReason,
|
|
286
|
+
isSelected: r === t,
|
|
287
|
+
onMouseDown: ut,
|
|
288
|
+
onPointerMove: () => s(t),
|
|
289
|
+
onActivate: () => i(e, t)
|
|
290
|
+
}, e.key), t[12] = s, t[13] = i, t[14] = r, t[15] = e) : e = t[15], h = n.map(e), t[7] = s, t[8] = i, t[9] = n, t[10] = r, t[11] = h;
|
|
291
|
+
} else h = t[11];
|
|
292
|
+
let g;
|
|
293
|
+
t[16] === h ? g = t[17] : (g = /* @__PURE__ */ R(a, {
|
|
294
|
+
maxH: "xs",
|
|
295
|
+
showHorizontalScrollbar: !1,
|
|
296
|
+
children: h
|
|
297
|
+
}), t[16] = h, t[17] = g);
|
|
298
|
+
let _;
|
|
299
|
+
return t[18] !== d.content || t[19] !== g ? (_ = /* @__PURE__ */ R(D, {
|
|
300
|
+
css: m,
|
|
301
|
+
position: "absolute",
|
|
302
|
+
bottom: "100%",
|
|
303
|
+
mb: "2xs",
|
|
304
|
+
zIndex: "popover",
|
|
305
|
+
children: g
|
|
306
|
+
}), t[18] = d.content, t[19] = g, t[20] = _) : _ = t[20], _;
|
|
307
|
+
}, lt = (e) => {
|
|
308
|
+
let t = L(16), { commands: n } = e, [r] = $(), [i, a] = G(null), o, s;
|
|
309
|
+
t[0] === r ? (o = t[1], s = t[2]) : (o = () => {
|
|
310
|
+
let e = r.getRootElement();
|
|
311
|
+
e?.contains(e.ownerDocument.activeElement) && r.update(dt);
|
|
312
|
+
}, s = [r], t[0] = r, t[1] = o, t[2] = s), V(o, s);
|
|
313
|
+
let c;
|
|
314
|
+
if (t[3] !== n || t[4] !== i) {
|
|
315
|
+
let e;
|
|
316
|
+
t[6] === i ? e = t[7] : (e = (e) => e.name.startsWith(`/${i ?? ""}`), t[6] = i, t[7] = e), c = n.filter(e).map(ft), t[3] = n, t[4] = i, t[5] = c;
|
|
317
|
+
} else c = t[5];
|
|
318
|
+
let l = c, u;
|
|
319
|
+
t[8] === n ? u = t[9] : (u = (e) => {
|
|
320
|
+
let t = ot(e);
|
|
321
|
+
return !t || !n.some((e) => e.name.startsWith(`/${t.matchingString}`)) ? null : t;
|
|
322
|
+
}, t[8] = n, t[9] = u);
|
|
323
|
+
let d;
|
|
324
|
+
t[10] === r ? d = t[11] : (d = (e, t, n) => {
|
|
325
|
+
e.command.disabledReason || (r.update(() => {
|
|
326
|
+
t?.replace(ve(e.command.onSelect ? "" : `${e.command.name} `)).selectEnd(), n();
|
|
327
|
+
}), e.command.onSelect?.());
|
|
328
|
+
}, t[10] = r, t[11] = d);
|
|
329
|
+
let f;
|
|
330
|
+
return t[12] !== l || t[13] !== u || t[14] !== d ? (f = /* @__PURE__ */ R(Be, {
|
|
331
|
+
onQueryChange: a,
|
|
332
|
+
options: l,
|
|
333
|
+
triggerFn: u,
|
|
334
|
+
onSelectOption: d,
|
|
335
|
+
menuRenderFn: pt
|
|
336
|
+
}), t[12] = l, t[13] = u, t[14] = d, t[15] = f) : f = t[15], f;
|
|
337
|
+
};
|
|
338
|
+
function ut(e) {
|
|
339
|
+
return e.preventDefault();
|
|
340
|
+
}
|
|
341
|
+
function dt() {
|
|
342
|
+
let e = xe();
|
|
343
|
+
e && Te(e.clone());
|
|
344
|
+
}
|
|
345
|
+
function ft(e) {
|
|
346
|
+
return new st(e);
|
|
347
|
+
}
|
|
348
|
+
function pt(e, t) {
|
|
349
|
+
let { options: n, selectedIndex: r, selectOptionAndCleanUp: i, setHighlightedIndex: a } = t;
|
|
350
|
+
return e.current?.setAttribute("aria-label", "Harness commands"), e.current ? Le(/* @__PURE__ */ R(ct, {
|
|
351
|
+
options: n,
|
|
352
|
+
selectedIndex: r,
|
|
353
|
+
onHighlight: a,
|
|
354
|
+
onSelect: (e, t) => {
|
|
355
|
+
a(t), i(e);
|
|
356
|
+
}
|
|
357
|
+
}), e.current) : null;
|
|
358
|
+
}
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/components/rich-text/prompt-input/utils.ts
|
|
361
|
+
var mt = (e) => {
|
|
362
|
+
let t = "", n = e.getChildren(), r = n.length;
|
|
363
|
+
for (let e = 0; e < r; e++) {
|
|
364
|
+
let i = n[e];
|
|
365
|
+
t += i.getTextContent(), Se(i) && e !== r - 1 && !i.isInline() && (t += "\n");
|
|
366
|
+
}
|
|
367
|
+
return t;
|
|
368
|
+
}, ht = (e) => e.type === "paragraph" && !!e.children?.length, gt = (e) => {
|
|
369
|
+
if (e.type === "comment") return "";
|
|
370
|
+
let t = typeof e.text == "string" ? e.text : "", n = e.children;
|
|
371
|
+
if (!Array.isArray(n)) return t;
|
|
372
|
+
let r = n.length;
|
|
373
|
+
for (let e = 0; e < r; e += 1) {
|
|
374
|
+
let i = n[e];
|
|
375
|
+
if (i.type === "comment") {
|
|
376
|
+
e !== r - 1 && (t += "\n");
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
t += gt(i), ht(i) && (t += "\n");
|
|
380
|
+
}
|
|
381
|
+
return t;
|
|
382
|
+
}, _t = (e) => {
|
|
383
|
+
try {
|
|
384
|
+
return gt(JSON.parse(e).root ?? {});
|
|
385
|
+
} catch {
|
|
386
|
+
return "";
|
|
387
|
+
}
|
|
388
|
+
}, vt = { root: {
|
|
389
|
+
direction: "ltr",
|
|
390
|
+
format: "",
|
|
391
|
+
indent: 0,
|
|
392
|
+
type: "root",
|
|
393
|
+
version: 1,
|
|
394
|
+
children: [{
|
|
395
|
+
type: "paragraph",
|
|
396
|
+
version: 1,
|
|
397
|
+
format: "",
|
|
398
|
+
indent: 0,
|
|
399
|
+
textFormat: void 0,
|
|
400
|
+
direction: null,
|
|
401
|
+
children: []
|
|
402
|
+
}]
|
|
403
|
+
} };
|
|
404
|
+
function yt(e = "") {
|
|
405
|
+
return e.trim() ? { root: {
|
|
406
|
+
direction: "ltr",
|
|
407
|
+
format: "",
|
|
408
|
+
indent: 0,
|
|
409
|
+
type: "root",
|
|
410
|
+
version: 1,
|
|
411
|
+
children: e.split(/\r?\n/).map((e) => ({
|
|
412
|
+
type: "paragraph",
|
|
413
|
+
version: 1,
|
|
414
|
+
format: "",
|
|
415
|
+
indent: 0,
|
|
416
|
+
textFormat: void 0,
|
|
417
|
+
direction: null,
|
|
418
|
+
children: e ? [{
|
|
419
|
+
type: "text",
|
|
420
|
+
version: 1,
|
|
421
|
+
text: e,
|
|
422
|
+
format: "",
|
|
423
|
+
detail: 0,
|
|
424
|
+
mode: "normal",
|
|
425
|
+
style: ""
|
|
426
|
+
}] : []
|
|
427
|
+
}))
|
|
428
|
+
} } : JSON.parse(JSON.stringify(vt));
|
|
429
|
+
}
|
|
430
|
+
//#endregion
|
|
431
|
+
//#region src/components/rich-text/prompt-input/plugins/ImperativeAPIPlugin.tsx
|
|
432
|
+
function bt(e) {
|
|
433
|
+
let t = L(4), { editorRef: n, previousTextRef: r } = e, [i] = $(), a, o;
|
|
434
|
+
return t[0] !== i || t[1] !== r ? (a = () => ({ setEditorValue: (e) => {
|
|
435
|
+
let t = i.parseEditorState(JSON.stringify(yt(e)), xt);
|
|
436
|
+
i.setEditorState(t), r.current = e, i.focus();
|
|
437
|
+
} }), o = [i, r], t[0] = i, t[1] = r, t[2] = a, t[3] = o) : (a = t[2], o = t[3]), H(n, a, o), null;
|
|
438
|
+
}
|
|
439
|
+
function xt() {
|
|
440
|
+
be().selectEnd();
|
|
441
|
+
}
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/components/rich-text/prompt-input/plugins/keyboard-shortcuts.ts
|
|
444
|
+
var St = (e) => e.key === "Enter" && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey, Ct = (e) => e.key === "ArrowUp" && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey, wt = (e) => e.key === "ArrowDown" && !e.ctrlKey && !e.metaKey && !e.shiftKey && !e.altKey, Tt = (e, t) => {
|
|
445
|
+
t.preventDefault(), t.shiftKey ? e.dispatchCommand(ke, !1) : e.dispatchCommand(Ae, void 0);
|
|
446
|
+
};
|
|
447
|
+
function Et(e) {
|
|
448
|
+
let t = L(6), { onSubmit: n, onRecallPrevious: r, onRecallNext: i } = e, [a] = $(), o, s;
|
|
449
|
+
return t[0] !== a || t[1] !== i || t[2] !== r || t[3] !== n ? (o = () => a.registerCommand(je, (e) => a.getRootElement()?.hasAttribute("aria-controls") ? e.key === "Enter" && !St(e) && (Tt(a, e), !0) : St(e) ? (e.preventDefault(), n?.(), !0) : Ct(e) && r?.() || wt(e) && i?.() ? (e.preventDefault(), !0) : !1, Ee), s = [
|
|
450
|
+
a,
|
|
451
|
+
n,
|
|
452
|
+
r,
|
|
453
|
+
i
|
|
454
|
+
], t[0] = a, t[1] = i, t[2] = r, t[3] = n, t[4] = o, t[5] = s) : (o = t[4], s = t[5]), V(o, s), null;
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/components/rich-text/prompt-input/plugins/preserve-selection-plugin.tsx
|
|
458
|
+
var Dt = (e) => {
|
|
459
|
+
let t = ye(e.key);
|
|
460
|
+
return t?.isAttached() ? e.type === "text" ? we(t) && e.offset <= t.getTextContentSize() : Se(t) && e.offset <= t.getChildrenSize() : !1;
|
|
461
|
+
}, Ot = (e) => {
|
|
462
|
+
let t = [], n = ye(e.key);
|
|
463
|
+
for (; n?.getParent();) t.unshift(n.getIndexWithinParent()), n = n.getParent();
|
|
464
|
+
return {
|
|
465
|
+
path: t,
|
|
466
|
+
offset: e.offset,
|
|
467
|
+
type: e.type
|
|
468
|
+
};
|
|
469
|
+
}, kt = (e) => {
|
|
470
|
+
let t = be();
|
|
471
|
+
for (let n of e.path) t = Se(t) ? t.getChildAtIndex(n) ?? void 0 : void 0;
|
|
472
|
+
return t ? {
|
|
473
|
+
key: t.getKey(),
|
|
474
|
+
offset: e.offset,
|
|
475
|
+
type: e.type
|
|
476
|
+
} : void 0;
|
|
477
|
+
}, At = (e) => {
|
|
478
|
+
let { isEditable: t, initialSelection: n, onSelectionChange: r } = e, i = W(n), a = W(r);
|
|
479
|
+
a.current = r;
|
|
480
|
+
let [o] = $(), s = W(null), c = W(t);
|
|
481
|
+
return c.current = t, U(() => o.registerUpdateListener(({ editorState: e }) => {
|
|
482
|
+
e.read(() => {
|
|
483
|
+
let e = s.current;
|
|
484
|
+
if (e && (!Dt(e.anchor) || !Dt(e.focus)) && (s.current = null), !c.current) return;
|
|
485
|
+
let t = xe();
|
|
486
|
+
Ce(t) && (s.current = t.clone(), a.current?.({
|
|
487
|
+
anchor: Ot(t.anchor),
|
|
488
|
+
focus: Ot(t.focus)
|
|
489
|
+
}));
|
|
490
|
+
});
|
|
491
|
+
}), [o]), U(() => {
|
|
492
|
+
if (!t) return;
|
|
493
|
+
let e = o.getRootElement();
|
|
494
|
+
if (!e || e.contains(document.activeElement) || !s.current && !i.current) return;
|
|
495
|
+
let n = () => {
|
|
496
|
+
o.update(() => {
|
|
497
|
+
if (!s.current && i.current) {
|
|
498
|
+
let e = kt(i.current.anchor), t = kt(i.current.focus);
|
|
499
|
+
if (e && t) {
|
|
500
|
+
let n = _e();
|
|
501
|
+
n.anchor.set(e.key, e.offset, e.type), n.focus.set(t.key, t.offset, t.type), s.current = n;
|
|
502
|
+
}
|
|
503
|
+
i.current = void 0;
|
|
504
|
+
}
|
|
505
|
+
let e = s.current;
|
|
506
|
+
e && Dt(e.anchor) && Dt(e.focus) && Te(e.clone());
|
|
507
|
+
}, { discrete: !0 });
|
|
508
|
+
};
|
|
509
|
+
return e.addEventListener("focus", n, { once: !0 }), () => e.removeEventListener("focus", n);
|
|
510
|
+
}, [o, t]), null;
|
|
511
|
+
}, jt = {
|
|
512
|
+
...c,
|
|
513
|
+
paragraph: "rich-text__p rich-text__p--no-margin"
|
|
514
|
+
}, Mt = [Ze, Ue], Nt = B((e, t) => {
|
|
515
|
+
let n = L(49), { initialSelection: r, onSelectionChange: i, defaultState: a, debug: o, isEditable: s, placeholder: c } = e, l = o !== void 0 && o, u = s === void 0 || s, { onChange: f, onError: p, onSubmit: h, onRecallPrevious: g, onRecallNext: _, commands: v } = e, y = p === void 0 ? Pt : p, x = v === void 0 ? [] : v, S;
|
|
516
|
+
n[0] !== a || n[1] !== u || n[2] !== y ? (S = {
|
|
517
|
+
namespace: "PROMPT_EDITOR",
|
|
518
|
+
nodes: Mt,
|
|
519
|
+
editorState: a,
|
|
520
|
+
editable: u,
|
|
521
|
+
onError: y,
|
|
522
|
+
theme: jt
|
|
523
|
+
}, n[0] = a, n[1] = u, n[2] = y, n[3] = S) : S = n[3];
|
|
524
|
+
let C = S, w;
|
|
525
|
+
n[4] === a ? w = n[5] : (w = _t(a), n[4] = a, n[5] = w);
|
|
526
|
+
let T = W(w), E;
|
|
527
|
+
n[6] === c ? E = n[7] : (E = c ?? /* @__PURE__ */ R(P, {
|
|
528
|
+
textStyle: "label/M/regular",
|
|
529
|
+
color: "fg.subtle",
|
|
530
|
+
pointerEvents: "none",
|
|
531
|
+
position: "absolute",
|
|
532
|
+
top: "0",
|
|
533
|
+
children: "Type your message here."
|
|
534
|
+
}), n[6] = c, n[7] = E);
|
|
535
|
+
let D = E, O = ee, k = ce, A;
|
|
536
|
+
n[8] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ R(He, {}), n[8] = A) : A = n[8];
|
|
537
|
+
let j;
|
|
538
|
+
n[9] === Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ R(d, { fullWidth: !0 }), n[9] = j) : j = n[9];
|
|
539
|
+
let M;
|
|
540
|
+
n[10] === D ? M = n[11] : (M = /* @__PURE__ */ R(pe, {
|
|
541
|
+
contentEditable: j,
|
|
542
|
+
placeholder: D,
|
|
543
|
+
ErrorBoundary: le
|
|
544
|
+
}), n[10] = D, n[11] = M);
|
|
545
|
+
let N;
|
|
546
|
+
n[12] === f ? N = n[13] : (N = /* @__PURE__ */ R(ze, {
|
|
547
|
+
ignoreSelectionChange: !0,
|
|
548
|
+
ignoreHistoryMergeTagChange: !1,
|
|
549
|
+
onChange: (e) => {
|
|
550
|
+
e.read(() => {
|
|
551
|
+
let t = mt(be());
|
|
552
|
+
t !== T.current && (T.current = t, f?.(t, e.toJSON()));
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}), n[12] = f, n[13] = N);
|
|
556
|
+
let F;
|
|
557
|
+
n[14] === t ? F = n[15] : (F = /* @__PURE__ */ R(bt, {
|
|
558
|
+
editorRef: t,
|
|
559
|
+
previousTextRef: T
|
|
560
|
+
}), n[14] = t, n[15] = F);
|
|
561
|
+
let I;
|
|
562
|
+
n[16] === u ? I = n[17] : (I = /* @__PURE__ */ R(m, { isEditable: u }), n[16] = u, n[17] = I);
|
|
563
|
+
let B;
|
|
564
|
+
n[18] !== r || n[19] !== u || n[20] !== i ? (B = /* @__PURE__ */ R(At, {
|
|
565
|
+
isEditable: u,
|
|
566
|
+
initialSelection: r,
|
|
567
|
+
onSelectionChange: i
|
|
568
|
+
}), n[18] = r, n[19] = u, n[20] = i, n[21] = B) : B = n[21];
|
|
569
|
+
let V;
|
|
570
|
+
n[22] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ R(at, {}), n[22] = V) : V = n[22];
|
|
571
|
+
let H;
|
|
572
|
+
n[23] !== _ || n[24] !== g || n[25] !== h ? (H = /* @__PURE__ */ R(Et, {
|
|
573
|
+
onSubmit: h,
|
|
574
|
+
onRecallPrevious: g,
|
|
575
|
+
onRecallNext: _
|
|
576
|
+
}), n[23] = _, n[24] = g, n[25] = h, n[26] = H) : H = n[26];
|
|
577
|
+
let U = lt, G = x.map(Ft).join("\n"), K;
|
|
578
|
+
n[27] !== U || n[28] !== x || n[29] !== G ? (K = /* @__PURE__ */ R(U, { commands: x }, G), n[27] = U, n[28] = x, n[29] = G, n[30] = K) : K = n[30];
|
|
579
|
+
let q;
|
|
580
|
+
n[31] === l ? q = n[32] : (q = l ? /* @__PURE__ */ R(b, {}) : "", n[31] = l, n[32] = q);
|
|
581
|
+
let J;
|
|
582
|
+
n[33] !== k || n[34] !== C || n[35] !== A || n[36] !== M || n[37] !== N || n[38] !== F || n[39] !== I || n[40] !== B || n[41] !== V || n[42] !== H || n[43] !== K || n[44] !== q ? (J = /* @__PURE__ */ z(k, {
|
|
583
|
+
initialConfig: C,
|
|
584
|
+
children: [
|
|
585
|
+
A,
|
|
586
|
+
M,
|
|
587
|
+
N,
|
|
588
|
+
F,
|
|
589
|
+
I,
|
|
590
|
+
B,
|
|
591
|
+
V,
|
|
592
|
+
H,
|
|
593
|
+
K,
|
|
594
|
+
q
|
|
595
|
+
]
|
|
596
|
+
}), n[33] = k, n[34] = C, n[35] = A, n[36] = M, n[37] = N, n[38] = F, n[39] = I, n[40] = B, n[41] = V, n[42] = H, n[43] = K, n[44] = q, n[45] = J) : J = n[45];
|
|
597
|
+
let Y;
|
|
598
|
+
return n[46] !== O || n[47] !== J ? (Y = /* @__PURE__ */ R(O, {
|
|
599
|
+
direction: "column",
|
|
600
|
+
justifyContent: "space-between",
|
|
601
|
+
width: "100%",
|
|
602
|
+
position: "relative",
|
|
603
|
+
children: J
|
|
604
|
+
}), n[46] = O, n[47] = J, n[48] = Y) : Y = n[48], Y;
|
|
605
|
+
});
|
|
606
|
+
function Pt() {}
|
|
607
|
+
function Ft(e) {
|
|
608
|
+
return e.name;
|
|
609
|
+
}
|
|
610
|
+
//#endregion
|
|
611
|
+
//#region src/components/chat-ui/links/chat-code-link-node.ts
|
|
612
|
+
var It = class e extends Me {
|
|
613
|
+
__href;
|
|
614
|
+
__description;
|
|
615
|
+
static getType() {
|
|
616
|
+
return "chat-code-link";
|
|
617
|
+
}
|
|
618
|
+
static clone(t) {
|
|
619
|
+
return new e(t.__text, t.__href, t.__description, t.__key);
|
|
620
|
+
}
|
|
621
|
+
constructor(e, t, n, r) {
|
|
622
|
+
super(e, r), this.__href = t, this.__description = n;
|
|
623
|
+
}
|
|
624
|
+
static importJSON(t) {
|
|
625
|
+
return new e(t.text, null).updateFromJSON(t);
|
|
626
|
+
}
|
|
627
|
+
exportJSON() {
|
|
628
|
+
return {
|
|
629
|
+
...super.exportJSON(),
|
|
630
|
+
type: "chat-code-link"
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
createDOM(e) {
|
|
634
|
+
let t = document.createElement("a");
|
|
635
|
+
return this.__href ? t.href = this.__href : (t.setAttribute("role", "button"), t.tabIndex = 0), t.dataset.chatSource = this.__text, t.dataset.chatOrigin = "inline-code", t.title = this.__description ?? `Open file: ${this.__text}`, t.append(super.createDOM(e)), t;
|
|
636
|
+
}
|
|
637
|
+
updateDOM(e) {
|
|
638
|
+
return e.__text !== this.__text || e.__format !== this.__format || e.__href !== this.__href;
|
|
639
|
+
}
|
|
640
|
+
}, Lt = (e) => e instanceof MouseEvent && (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey), Rt = (e, t) => {
|
|
641
|
+
if (t instanceof KeyboardEvent && t.key !== "Enter") return;
|
|
642
|
+
let n = t.target;
|
|
643
|
+
if (!(n instanceof Element)) return;
|
|
644
|
+
let r = n.closest("a");
|
|
645
|
+
if (!r || !r.dataset.chatSource) return;
|
|
646
|
+
let i = {
|
|
647
|
+
source: r.dataset.chatSource,
|
|
648
|
+
origin: r.dataset.chatOrigin === "markdown" ? "markdown" : "inline-code"
|
|
649
|
+
}, a = l(i, window.location.origin);
|
|
650
|
+
if (!a) return;
|
|
651
|
+
let o = e.resolveHref(i);
|
|
652
|
+
(a.kind !== "external" || o) && (o && Lt(t) || (t.preventDefault(), t.stopImmediatePropagation(), e.open(i)));
|
|
653
|
+
}, zt = () => {
|
|
654
|
+
let e = L(4), [t] = $(), n = u(), r, i;
|
|
655
|
+
return e[0] !== t || e[1] !== n ? (r = () => {
|
|
656
|
+
if (!n) return;
|
|
657
|
+
let e = t.registerNodeTransform(v, (e) => {
|
|
658
|
+
let t = {
|
|
659
|
+
source: e.getSource(),
|
|
660
|
+
origin: "markdown"
|
|
661
|
+
}, r = l(t, window.location.origin);
|
|
662
|
+
r && (r.kind !== "external" || n.resolveHref(t)) && e.setResolvedURL(n.resolveHref(t) ?? "#");
|
|
663
|
+
}), r = t.registerMutationListener(v, (e) => {
|
|
664
|
+
for (let [r, i] of e) {
|
|
665
|
+
if (i === "destroyed") continue;
|
|
666
|
+
let e = t.getElementByKey(r), a = e?.dataset.chatSource;
|
|
667
|
+
if (!e || !a) continue;
|
|
668
|
+
let o = {
|
|
669
|
+
source: a,
|
|
670
|
+
origin: "markdown"
|
|
671
|
+
}, s = l(o, window.location.origin);
|
|
672
|
+
s && (s.kind !== "external" || n.resolveHref(o)) && (e.title = n.describe?.(o) ?? `Open file or document: ${a}`);
|
|
673
|
+
}
|
|
674
|
+
}), i = t.registerNodeTransform(Me, (e) => {
|
|
675
|
+
if (e instanceof It || !e.hasFormat("code")) return;
|
|
676
|
+
let t = e.getParent();
|
|
677
|
+
if (!t || t.getType() === "code" || t.getType().includes("link")) return;
|
|
678
|
+
let r = {
|
|
679
|
+
source: e.getTextContent(),
|
|
680
|
+
origin: "inline-code"
|
|
681
|
+
}, i = l(r, window.location.origin);
|
|
682
|
+
if (!i || i.kind === "external") return;
|
|
683
|
+
let a = new It(r.source, n.resolveHref(r), n.describe?.(r));
|
|
684
|
+
a.setFormat(e.getFormat()), e.replace(a);
|
|
685
|
+
}), a = (e) => Rt(n, e), o = t.registerRootListener((e, t) => {
|
|
686
|
+
t?.removeEventListener("click", a, !0), t?.removeEventListener("keydown", a, !0), e?.addEventListener("click", a, !0), e?.addEventListener("keydown", a, !0), e && (e.dataset.chatLinks = "true");
|
|
687
|
+
});
|
|
688
|
+
return () => {
|
|
689
|
+
e(), i(), r(), o();
|
|
690
|
+
};
|
|
691
|
+
}, i = [t, n], e[0] = t, e[1] = n, e[2] = r, e[3] = i) : (r = e[2], i = e[3]), V(r, i), null;
|
|
692
|
+
};
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/components/rich-text/shared/plugins/StateUpdatePlugin.tsx
|
|
695
|
+
function Bt(e) {
|
|
696
|
+
let t = L(5), { value: n, onUpdate: r } = e, [i] = $(), a, o;
|
|
697
|
+
return t[0] !== i || t[1] !== r || t[2] !== n ? (a = () => {
|
|
698
|
+
i && i.update(() => r(n), { tag: "history-merge" });
|
|
699
|
+
}, o = [
|
|
700
|
+
n,
|
|
701
|
+
i,
|
|
702
|
+
r
|
|
703
|
+
], t[0] = i, t[1] = r, t[2] = n, t[3] = a, t[4] = o) : (a = t[3], o = t[4]), V(a, o), null;
|
|
704
|
+
}
|
|
705
|
+
//#endregion
|
|
706
|
+
//#region src/components/rich-text/rich-message/rich-message.tsx
|
|
707
|
+
var Vt = "markdown-source-import";
|
|
708
|
+
function Ht(e) {
|
|
709
|
+
let t = L(5), n = u(), r = e.linkHandler ?? n, i;
|
|
710
|
+
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ R(Ut, { ...e }), t[0] = e, t[1] = i);
|
|
711
|
+
let a;
|
|
712
|
+
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ R(p, {
|
|
713
|
+
handler: r,
|
|
714
|
+
children: i
|
|
715
|
+
}), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
|
|
716
|
+
}
|
|
717
|
+
function Ut(e) {
|
|
718
|
+
let { debug: t = !1, defaultState: n = "", fullWidth: r = !1, isEditable: i = !1, resolveMarkdownUrl: a, onChange: o } = e, { frontmatter: s, body: c } = w(n), l = i && !!o, u = W(null);
|
|
719
|
+
u.current ??= S(c, a);
|
|
720
|
+
let p = {
|
|
721
|
+
namespace: "RICH_MESSAGE",
|
|
722
|
+
nodes: [..._, It],
|
|
723
|
+
editorState: () => {
|
|
724
|
+
Q(Vt), u.current?.importToLexical();
|
|
725
|
+
},
|
|
726
|
+
onError: (e) => console.error(e),
|
|
727
|
+
editable: i,
|
|
728
|
+
theme: C
|
|
729
|
+
};
|
|
730
|
+
return /* @__PURE__ */ R(ee, {
|
|
731
|
+
className: "rich-text",
|
|
732
|
+
"data-rich-message": "true",
|
|
733
|
+
justifyContent: "space-between",
|
|
734
|
+
width: "100%",
|
|
735
|
+
maxWidth: "100%",
|
|
736
|
+
height: "100%",
|
|
737
|
+
position: "relative",
|
|
738
|
+
direction: "column",
|
|
739
|
+
overflow: "hidden",
|
|
740
|
+
children: /* @__PURE__ */ R(f, {
|
|
741
|
+
resolver: a,
|
|
742
|
+
children: /* @__PURE__ */ z(ce, {
|
|
743
|
+
initialConfig: p,
|
|
744
|
+
children: [
|
|
745
|
+
/* @__PURE__ */ R(Bt, {
|
|
746
|
+
value: c,
|
|
747
|
+
onUpdate: (e) => {
|
|
748
|
+
let t = S(e, a);
|
|
749
|
+
u.current = t, Q(Vt), t.importToLexical();
|
|
750
|
+
}
|
|
751
|
+
}),
|
|
752
|
+
/* @__PURE__ */ R(de, {}),
|
|
753
|
+
/* @__PURE__ */ R(zt, {}),
|
|
754
|
+
/* @__PURE__ */ R(We, { newTab: !0 }),
|
|
755
|
+
/* @__PURE__ */ R(fe, {}),
|
|
756
|
+
/* @__PURE__ */ R(T, {}),
|
|
757
|
+
i ? /* @__PURE__ */ R(me, { maxIndent: 7 }) : null,
|
|
758
|
+
/* @__PURE__ */ R(ue, {}),
|
|
759
|
+
/* @__PURE__ */ R(x, {}),
|
|
760
|
+
/* @__PURE__ */ R(E, {}),
|
|
761
|
+
/* @__PURE__ */ R(y, {}),
|
|
762
|
+
/* @__PURE__ */ R(pe, {
|
|
763
|
+
contentEditable: /* @__PURE__ */ R(d, {
|
|
764
|
+
fullWidth: r,
|
|
765
|
+
isRichMessage: !0
|
|
766
|
+
}),
|
|
767
|
+
ErrorBoundary: le
|
|
768
|
+
}),
|
|
769
|
+
l ? /* @__PURE__ */ R(ze, {
|
|
770
|
+
ignoreSelectionChange: !0,
|
|
771
|
+
ignoreHistoryMergeTagChange: !1,
|
|
772
|
+
onChange: (e, t, n) => {
|
|
773
|
+
n.has(Vt) || e.read(() => {
|
|
774
|
+
let e = be(), t = u.current?.exportFromLexical(e) ?? "";
|
|
775
|
+
o?.(s + t);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
}) : null,
|
|
779
|
+
/* @__PURE__ */ R(m, { isEditable: i }),
|
|
780
|
+
t && /* @__PURE__ */ R(b, {})
|
|
781
|
+
]
|
|
782
|
+
})
|
|
783
|
+
})
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/components/rich-text/resource-activity-feed/resource-activity-feed.tsx
|
|
788
|
+
var Wt = {
|
|
789
|
+
activity: K,
|
|
790
|
+
bell: q,
|
|
791
|
+
"circle-alert": J,
|
|
792
|
+
component: Y,
|
|
793
|
+
"external-link": te,
|
|
794
|
+
"git-branch": ne,
|
|
795
|
+
info: re,
|
|
796
|
+
"message-circle": ie,
|
|
797
|
+
"scan-search": ae,
|
|
798
|
+
sparkles: X
|
|
799
|
+
}, Gt = (e) => {
|
|
800
|
+
let t = L(2), n = Wt[e.name], r;
|
|
801
|
+
return t[0] === n ? r = t[1] : (r = /* @__PURE__ */ R(A, {
|
|
802
|
+
as: n,
|
|
803
|
+
boxSize: "13px"
|
|
804
|
+
}), t[0] = n, t[1] = r), r;
|
|
805
|
+
}, Kt = (e) => {
|
|
806
|
+
let t = L(12), { item: n, size: r, onActionSelect: i, onRelatedResourceSelect: a } = e, o = n.kind === "message" ? n.attention?.actions : void 0;
|
|
807
|
+
if (!n.relatedResources?.length && !o?.length) return null;
|
|
808
|
+
let s;
|
|
809
|
+
t[0] !== o || t[1] !== n || t[2] !== i || t[3] !== r ? (s = o?.map((e) => /* @__PURE__ */ z(O, {
|
|
810
|
+
type: "button",
|
|
811
|
+
size: r === "compact" ? "2xs" : "xs",
|
|
812
|
+
variant: "outline",
|
|
813
|
+
disabled: !i,
|
|
814
|
+
onClick: () => i?.(e, n),
|
|
815
|
+
children: [e.icon ? /* @__PURE__ */ R(Gt, { name: e.icon }) : null, e.label]
|
|
816
|
+
}, e.id)), t[0] = o, t[1] = n, t[2] = i, t[3] = r, t[4] = s) : s = t[4];
|
|
817
|
+
let c;
|
|
818
|
+
t[5] !== n || t[6] !== a || t[7] !== r ? (c = n.relatedResources?.map((e) => /* @__PURE__ */ R(O, {
|
|
819
|
+
type: "button",
|
|
820
|
+
size: r === "compact" ? "2xs" : "xs",
|
|
821
|
+
variant: "ghost",
|
|
822
|
+
disabled: !a,
|
|
823
|
+
onClick: () => a?.(e, n),
|
|
824
|
+
children: e.label
|
|
825
|
+
}, `${e.type}:${e.id}`)), t[5] = n, t[6] = a, t[7] = r, t[8] = c) : c = t[8];
|
|
826
|
+
let l;
|
|
827
|
+
return t[9] !== s || t[10] !== c ? (l = /* @__PURE__ */ z(k, {
|
|
828
|
+
gap: "2xs",
|
|
829
|
+
flexWrap: "wrap",
|
|
830
|
+
children: [s, c]
|
|
831
|
+
}), t[9] = s, t[10] = c, t[11] = l) : l = t[11], l;
|
|
832
|
+
}, qt = (e) => {
|
|
833
|
+
let t = L(7), { attention: n } = e;
|
|
834
|
+
if (!n.statusLabel) return null;
|
|
835
|
+
let r = n.icon ?? "bell", i;
|
|
836
|
+
t[0] === r ? i = t[1] : (i = /* @__PURE__ */ R(Gt, { name: r }), t[0] = r, t[1] = i);
|
|
837
|
+
let a;
|
|
838
|
+
t[2] === n.statusLabel ? a = t[3] : (a = /* @__PURE__ */ R(P, {
|
|
839
|
+
textStyle: "label/XS/medium",
|
|
840
|
+
children: n.statusLabel
|
|
841
|
+
}), t[2] = n.statusLabel, t[3] = a);
|
|
842
|
+
let o;
|
|
843
|
+
return t[4] !== i || t[5] !== a ? (o = /* @__PURE__ */ z(k, {
|
|
844
|
+
gap: "2xs",
|
|
845
|
+
color: "fg.warning",
|
|
846
|
+
children: [i, a]
|
|
847
|
+
}), t[4] = i, t[5] = a, t[6] = o) : o = t[6], o;
|
|
848
|
+
}, Jt = (n) => {
|
|
849
|
+
let i = L(50), { item: a, size: o, fallbackActorName: s, formatTimestamp: c, onActionSelect: l, onRelatedResourceSelect: u } = n, d;
|
|
850
|
+
i[0] !== s || i[1] !== a.actor ? (d = a.actor ?? { name: s }, i[0] = s, i[1] = a.actor, i[2] = d) : d = i[2];
|
|
851
|
+
let f = d, p;
|
|
852
|
+
i[3] !== c || i[4] !== a ? (p = a.timestampLabel ?? c(a.createdAt, a), i[3] = c, i[4] = a, i[5] = p) : p = i[5];
|
|
853
|
+
let m;
|
|
854
|
+
i[6] !== a.createdAt || i[7] !== p ? (m = /* @__PURE__ */ R("time", {
|
|
855
|
+
dateTime: a.createdAt,
|
|
856
|
+
children: p
|
|
857
|
+
}), i[6] = a.createdAt, i[7] = p, i[8] = m) : m = i[8];
|
|
858
|
+
let h = m;
|
|
859
|
+
if (a.kind === "event") {
|
|
860
|
+
let n;
|
|
861
|
+
i[9] === a.icon ? n = i[10] : (n = a.icon ? /* @__PURE__ */ R(Gt, { name: a.icon }) : void 0, i[9] = a.icon, i[10] = n);
|
|
862
|
+
let r = o === "compact" ? "sm" : "md", s;
|
|
863
|
+
i[11] === a.summary ? s = i[12] : (s = /* @__PURE__ */ R(P, {
|
|
864
|
+
as: "span",
|
|
865
|
+
children: a.summary
|
|
866
|
+
}), i[11] = a.summary, i[12] = s);
|
|
867
|
+
let c;
|
|
868
|
+
i[13] !== a || i[14] !== u || i[15] !== o ? (c = /* @__PURE__ */ R(Kt, {
|
|
869
|
+
item: a,
|
|
870
|
+
size: o,
|
|
871
|
+
onRelatedResourceSelect: u
|
|
872
|
+
}), i[13] = a, i[14] = u, i[15] = o, i[16] = c) : c = i[16];
|
|
873
|
+
let l;
|
|
874
|
+
return i[17] !== f || i[18] !== n || i[19] !== r || i[20] !== s || i[21] !== c || i[22] !== h ? (l = /* @__PURE__ */ R(e, { children: /* @__PURE__ */ z(t, {
|
|
875
|
+
actor: f,
|
|
876
|
+
icon: n,
|
|
877
|
+
timestamp: h,
|
|
878
|
+
paddingX: r,
|
|
879
|
+
children: [s, c]
|
|
880
|
+
}) }), i[17] = f, i[18] = n, i[19] = r, i[20] = s, i[21] = c, i[22] = h, i[23] = l) : l = i[23], l;
|
|
881
|
+
}
|
|
882
|
+
let g = a.attention?.icon ?? "bell", _;
|
|
883
|
+
i[24] !== g || i[25] !== a.attention ? (_ = a.attention ? /* @__PURE__ */ R(Gt, { name: g }) : void 0, i[24] = g, i[25] = a.attention, i[26] = _) : _ = i[26];
|
|
884
|
+
let v = a.attention ? "fg.warning" : void 0, y = a.attention ? "bg.warning" : void 0, b;
|
|
885
|
+
i[27] === a.attention ? b = i[28] : (b = a.attention ? /* @__PURE__ */ R(qt, { attention: a.attention }) : void 0, i[27] = a.attention, i[28] = b);
|
|
886
|
+
let x = a.attention ? "attention" : "default", S = o === "compact" ? "xs" : "sm", C;
|
|
887
|
+
i[29] === a.markdown ? C = i[30] : (C = /* @__PURE__ */ R(Ht, {
|
|
888
|
+
defaultState: a.markdown,
|
|
889
|
+
fullWidth: !0
|
|
890
|
+
}), i[29] = a.markdown, i[30] = C);
|
|
891
|
+
let w;
|
|
892
|
+
i[31] !== a || i[32] !== l || i[33] !== u || i[34] !== o ? (w = /* @__PURE__ */ R(Kt, {
|
|
893
|
+
item: a,
|
|
894
|
+
size: o,
|
|
895
|
+
onActionSelect: l,
|
|
896
|
+
onRelatedResourceSelect: u
|
|
897
|
+
}), i[31] = a, i[32] = l, i[33] = u, i[34] = o, i[35] = w) : w = i[35];
|
|
898
|
+
let T;
|
|
899
|
+
i[36] !== w || i[37] !== S || i[38] !== C ? (T = /* @__PURE__ */ z(M, {
|
|
900
|
+
gap: S,
|
|
901
|
+
children: [C, w]
|
|
902
|
+
}), i[36] = w, i[37] = S, i[38] = C, i[39] = T) : T = i[39];
|
|
903
|
+
let E;
|
|
904
|
+
return i[40] !== f || i[41] !== o || i[42] !== T || i[43] !== _ || i[44] !== v || i[45] !== y || i[46] !== b || i[47] !== x || i[48] !== h ? (E = /* @__PURE__ */ R(r, {
|
|
905
|
+
actor: f,
|
|
906
|
+
icon: _,
|
|
907
|
+
iconColor: v,
|
|
908
|
+
iconBackground: y,
|
|
909
|
+
timestamp: h,
|
|
910
|
+
actions: b,
|
|
911
|
+
tone: x,
|
|
912
|
+
size: o,
|
|
913
|
+
children: T
|
|
914
|
+
}), i[40] = f, i[41] = o, i[42] = T, i[43] = _, i[44] = v, i[45] = y, i[46] = b, i[47] = x, i[48] = h, i[49] = E) : E = i[49], E;
|
|
915
|
+
}, Yt = (e) => e, Xt = (e) => {
|
|
916
|
+
let t = L(56), r, a, o, c, l, u, d, f, p, m, h, g, _, v, y, b, x;
|
|
917
|
+
t[0] === e ? (r = t[1], a = t[2], o = t[3], c = t[4], l = t[5], u = t[6], d = t[7], f = t[8], p = t[9], m = t[10], h = t[11], g = t[12], _ = t[13], v = t[14], y = t[15], b = t[16], x = t[17]) : ({items: a, size: d, isLoading: f, error: r, hasMore: m, isLoadingMore: h, emptyTitle: g, emptyDescription: _, errorTitle: v, loadMoreLabel: y, loadingLabel: b, fallbackActorName: x, formatTimestamp: p, onActionSelect: o, onLoadMore: c, onRelatedResourceSelect: l, ...u} = e, t[0] = e, t[1] = r, t[2] = a, t[3] = o, t[4] = c, t[5] = l, t[6] = u, t[7] = d, t[8] = f, t[9] = p, t[10] = m, t[11] = h, t[12] = g, t[13] = _, t[14] = v, t[15] = y, t[16] = b, t[17] = x);
|
|
918
|
+
let S = d === void 0 ? "comfortable" : d, C = f !== void 0 && f, w = m !== void 0 && m, T = h !== void 0 && h, E = g === void 0 ? "No activity yet" : g, D = _ === void 0 ? "Events and messages will appear here." : _, ee = v === void 0 ? "Activity unavailable" : v, A = y === void 0 ? "Load more" : y, M = b === void 0 ? "Loading activity" : b, N = x === void 0 ? "System" : x, F = p === void 0 ? Yt : p;
|
|
919
|
+
if (r) {
|
|
920
|
+
let e;
|
|
921
|
+
return t[18] !== r || t[19] !== ee || t[20] !== u ? (e = /* @__PURE__ */ R(i, {
|
|
922
|
+
status: "error",
|
|
923
|
+
colorPalette: "red",
|
|
924
|
+
title: ee,
|
|
925
|
+
size: "sm",
|
|
926
|
+
...u,
|
|
927
|
+
children: r
|
|
928
|
+
}), t[18] = r, t[19] = ee, t[20] = u, t[21] = e) : e = t[21], e;
|
|
929
|
+
}
|
|
930
|
+
if (C && a.length === 0) {
|
|
931
|
+
let e;
|
|
932
|
+
t[22] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ R(j, { size: "sm" }), t[22] = e) : e = t[22];
|
|
933
|
+
let n;
|
|
934
|
+
t[23] === M ? n = t[24] : (n = /* @__PURE__ */ R(P, {
|
|
935
|
+
textStyle: "label/S/regular",
|
|
936
|
+
children: M
|
|
937
|
+
}), t[23] = M, t[24] = n);
|
|
938
|
+
let r;
|
|
939
|
+
return t[25] !== u || t[26] !== n ? (r = /* @__PURE__ */ z(k, {
|
|
940
|
+
role: "status",
|
|
941
|
+
"aria-live": "polite",
|
|
942
|
+
gap: "xs",
|
|
943
|
+
color: "fg.muted",
|
|
944
|
+
...u,
|
|
945
|
+
children: [e, n]
|
|
946
|
+
}), t[25] = u, t[26] = n, t[27] = r) : r = t[27], r;
|
|
947
|
+
}
|
|
948
|
+
if (a.length === 0) {
|
|
949
|
+
let e;
|
|
950
|
+
return t[28] !== D || t[29] !== E || t[30] !== u ? (e = /* @__PURE__ */ R(s, {
|
|
951
|
+
title: E,
|
|
952
|
+
description: D,
|
|
953
|
+
...u
|
|
954
|
+
}), t[28] = D, t[29] = E, t[30] = u, t[31] = e) : e = t[31], e;
|
|
955
|
+
}
|
|
956
|
+
let I = S === "compact" ? "sm" : "md", B;
|
|
957
|
+
if (t[32] !== N || t[33] !== F || t[34] !== a || t[35] !== o || t[36] !== l || t[37] !== S) {
|
|
958
|
+
let e;
|
|
959
|
+
t[39] !== N || t[40] !== F || t[41] !== o || t[42] !== l || t[43] !== S ? (e = (e) => /* @__PURE__ */ R(Jt, {
|
|
960
|
+
item: e,
|
|
961
|
+
size: S,
|
|
962
|
+
fallbackActorName: N,
|
|
963
|
+
formatTimestamp: F,
|
|
964
|
+
onActionSelect: o,
|
|
965
|
+
onRelatedResourceSelect: l
|
|
966
|
+
}, e.id), t[39] = N, t[40] = F, t[41] = o, t[42] = l, t[43] = S, t[44] = e) : e = t[44], B = a.map(e), t[32] = N, t[33] = F, t[34] = a, t[35] = o, t[36] = l, t[37] = S, t[38] = B;
|
|
967
|
+
} else B = t[38];
|
|
968
|
+
let V;
|
|
969
|
+
t[45] !== w || t[46] !== T || t[47] !== A || t[48] !== c || t[49] !== S ? (V = w ? /* @__PURE__ */ R(O, {
|
|
970
|
+
type: "button",
|
|
971
|
+
width: "full",
|
|
972
|
+
size: S === "compact" ? "xs" : "sm",
|
|
973
|
+
variant: "ghost",
|
|
974
|
+
loading: T,
|
|
975
|
+
onClick: c,
|
|
976
|
+
children: A
|
|
977
|
+
}) : null, t[45] = w, t[46] = T, t[47] = A, t[48] = c, t[49] = S, t[50] = V) : V = t[50];
|
|
978
|
+
let H;
|
|
979
|
+
return t[51] !== u || t[52] !== I || t[53] !== B || t[54] !== V ? (H = /* @__PURE__ */ z(n, {
|
|
980
|
+
gap: I,
|
|
981
|
+
...u,
|
|
982
|
+
children: [B, V]
|
|
983
|
+
}), t[51] = u, t[52] = I, t[53] = B, t[54] = V, t[55] = H) : H = t[55], H;
|
|
984
|
+
}, Zt = "calc(var(--chakra-font-sizes-sm) * var(--rich-text-font-scale))", Qt = (e) => e == null ? "-" : typeof e == "string" ? e.length ? e : "-" : typeof e == "number" || typeof e == "boolean" ? String(e).toUpperCase() : e instanceof Date ? e.toISOString() : JSON.stringify(e), $t = (e) => {
|
|
985
|
+
let t = L(8), { defaultCode: n, isEditable: r, showLineNumbers: i, disableScroll: o } = e, s = n === void 0 ? "" : n, c = r !== void 0 && r, l = i !== void 0 && i, u = o !== void 0 && o;
|
|
986
|
+
if (c) {
|
|
987
|
+
let e;
|
|
988
|
+
return t[0] === s ? e = t[1] : (e = /* @__PURE__ */ R(F, {
|
|
989
|
+
defaultValue: s,
|
|
990
|
+
fontFamily: "mono",
|
|
991
|
+
fontSize: Zt,
|
|
992
|
+
resize: "vertical",
|
|
993
|
+
minHeight: "100%"
|
|
994
|
+
}), t[0] = s, t[1] = e), e;
|
|
995
|
+
}
|
|
996
|
+
let d;
|
|
997
|
+
if (t[2] !== s || t[3] !== u || t[4] !== l) {
|
|
998
|
+
let e = l ? s.split("\n") : [s];
|
|
999
|
+
d = /* @__PURE__ */ R(D, {
|
|
1000
|
+
as: "pre",
|
|
1001
|
+
margin: 0,
|
|
1002
|
+
padding: "sm",
|
|
1003
|
+
fontFamily: "mono",
|
|
1004
|
+
fontSize: Zt,
|
|
1005
|
+
lineHeight: "1.5",
|
|
1006
|
+
background: "bg.code",
|
|
1007
|
+
borderRadius: "md",
|
|
1008
|
+
width: "100%",
|
|
1009
|
+
overflowY: u ? "hidden" : void 0,
|
|
1010
|
+
children: l ? /* @__PURE__ */ R(D, {
|
|
1011
|
+
as: "code",
|
|
1012
|
+
display: "grid",
|
|
1013
|
+
gridTemplateColumns: "auto 1fr",
|
|
1014
|
+
columnGap: "sm",
|
|
1015
|
+
children: e.map(tn)
|
|
1016
|
+
}) : /* @__PURE__ */ R(D, {
|
|
1017
|
+
as: "code",
|
|
1018
|
+
children: s
|
|
1019
|
+
})
|
|
1020
|
+
}), t[2] = s, t[3] = u, t[4] = l, t[5] = d;
|
|
1021
|
+
} else d = t[5];
|
|
1022
|
+
let f = d;
|
|
1023
|
+
if (u) return f;
|
|
1024
|
+
let p;
|
|
1025
|
+
return t[6] === f ? p = t[7] : (p = /* @__PURE__ */ R(a, {
|
|
1026
|
+
width: "100%",
|
|
1027
|
+
background: "bg.code",
|
|
1028
|
+
borderRadius: "md",
|
|
1029
|
+
showHorizontalScrollbar: !0,
|
|
1030
|
+
children: f
|
|
1031
|
+
}), t[6] = f, t[7] = p), p;
|
|
1032
|
+
}, en = (e) => {
|
|
1033
|
+
let t = L(26), { data: n, fullWidth: r, noBorder: i, hiddenColumns: o } = e, s = r !== void 0 && r, c = i !== void 0 && i, l;
|
|
1034
|
+
t[0] === o ? l = t[1] : (l = o === void 0 ? [] : o, t[0] = o, t[1] = l);
|
|
1035
|
+
let u = l;
|
|
1036
|
+
if (!n.length) {
|
|
1037
|
+
let e = c ? "0" : "1px", n;
|
|
1038
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ R(P, {
|
|
1039
|
+
textStyle: "label/S/regular",
|
|
1040
|
+
fontSize: Zt,
|
|
1041
|
+
color: "fg.muted",
|
|
1042
|
+
children: "No data"
|
|
1043
|
+
}), t[2] = n) : n = t[2];
|
|
1044
|
+
let r;
|
|
1045
|
+
return t[3] === e ? r = t[4] : (r = /* @__PURE__ */ R(D, {
|
|
1046
|
+
padding: "sm",
|
|
1047
|
+
borderWidth: e,
|
|
1048
|
+
borderColor: "border.subtle",
|
|
1049
|
+
children: n
|
|
1050
|
+
}), t[3] = e, t[4] = r), r;
|
|
1051
|
+
}
|
|
1052
|
+
let d;
|
|
1053
|
+
t[5] === u ? d = t[6] : (d = new Set(u), t[5] = u, t[6] = d);
|
|
1054
|
+
let f = d, p;
|
|
1055
|
+
t[7] === n[0] ? p = t[8] : (p = Object.keys(n[0] ?? {}), t[7] = n[0], t[8] = p);
|
|
1056
|
+
let m;
|
|
1057
|
+
t[9] !== f || t[10] !== p ? (m = p.filter((e) => !f.has(e)), t[9] = f, t[10] = p, t[11] = m) : m = t[11];
|
|
1058
|
+
let h = m, g = s ? "100%" : "fit-content", _ = c ? "0" : "1px", v;
|
|
1059
|
+
t[12] === h ? v = t[13] : (v = /* @__PURE__ */ R(N.Header, { children: /* @__PURE__ */ R(N.Row, {
|
|
1060
|
+
background: "bg.muted",
|
|
1061
|
+
children: h.map(nn)
|
|
1062
|
+
}) }), t[12] = h, t[13] = v);
|
|
1063
|
+
let y;
|
|
1064
|
+
if (t[14] !== h || t[15] !== n) {
|
|
1065
|
+
let e;
|
|
1066
|
+
t[17] === h ? e = t[18] : (e = (e, t) => /* @__PURE__ */ R(N.Row, { children: h.map((n) => /* @__PURE__ */ R(N.Cell, {
|
|
1067
|
+
paddingX: "xs",
|
|
1068
|
+
paddingY: "2xs",
|
|
1069
|
+
children: /* @__PURE__ */ R(P, {
|
|
1070
|
+
textStyle: "paragraph/S/regular",
|
|
1071
|
+
fontSize: Zt,
|
|
1072
|
+
children: Qt(e[n])
|
|
1073
|
+
})
|
|
1074
|
+
}, `${t}-${n}`)) }, `${t}-${h.join("-")}`), t[17] = h, t[18] = e), y = n.map(e), t[14] = h, t[15] = n, t[16] = y;
|
|
1075
|
+
} else y = t[16];
|
|
1076
|
+
let b;
|
|
1077
|
+
t[19] === y ? b = t[20] : (b = /* @__PURE__ */ R(N.Body, { children: y }), t[19] = y, t[20] = b);
|
|
1078
|
+
let x;
|
|
1079
|
+
return t[21] !== b || t[22] !== g || t[23] !== _ || t[24] !== v ? (x = /* @__PURE__ */ R(a, {
|
|
1080
|
+
maxWidth: "100%",
|
|
1081
|
+
showHorizontalScrollbar: !0,
|
|
1082
|
+
showVerticalScrollbar: !1,
|
|
1083
|
+
children: /* @__PURE__ */ z(N.Root, {
|
|
1084
|
+
size: "sm",
|
|
1085
|
+
width: g,
|
|
1086
|
+
borderWidth: _,
|
|
1087
|
+
borderColor: "border.subtle",
|
|
1088
|
+
children: [v, b]
|
|
1089
|
+
})
|
|
1090
|
+
}), t[21] = b, t[22] = g, t[23] = _, t[24] = v, t[25] = x) : x = t[25], x;
|
|
1091
|
+
};
|
|
1092
|
+
function tn(e, t) {
|
|
1093
|
+
return /* @__PURE__ */ z(D, {
|
|
1094
|
+
as: "span",
|
|
1095
|
+
display: "contents",
|
|
1096
|
+
children: [/* @__PURE__ */ R(P, {
|
|
1097
|
+
as: "span",
|
|
1098
|
+
color: "fg.muted",
|
|
1099
|
+
textAlign: "right",
|
|
1100
|
+
fontSize: "inherit",
|
|
1101
|
+
children: t + 1
|
|
1102
|
+
}), /* @__PURE__ */ R(P, {
|
|
1103
|
+
as: "span",
|
|
1104
|
+
fontSize: "inherit",
|
|
1105
|
+
children: e.length ? e : " "
|
|
1106
|
+
})]
|
|
1107
|
+
}, `${t}-${e}`);
|
|
1108
|
+
}
|
|
1109
|
+
function nn(e) {
|
|
1110
|
+
return /* @__PURE__ */ R(N.ColumnHeader, {
|
|
1111
|
+
textTransform: "none",
|
|
1112
|
+
paddingX: "xs",
|
|
1113
|
+
paddingY: "2xs",
|
|
1114
|
+
children: /* @__PURE__ */ R(P, {
|
|
1115
|
+
textStyle: "label/S/medium",
|
|
1116
|
+
fontSize: Zt,
|
|
1117
|
+
children: e
|
|
1118
|
+
})
|
|
1119
|
+
}, e);
|
|
1120
|
+
}
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region src/components/rich-text/utils/inferResourceType.ts
|
|
1123
|
+
function rn(e) {
|
|
1124
|
+
let t = e.toLowerCase().trim();
|
|
1125
|
+
return t ? t.startsWith("image/") ? "image" : t === "application/pdf" ? "pdf" : t === "text/markdown" ? "markdown" : t === "text/csv" || t === "text/tab-separated-values" ? "table" : t === "application/json" ? "json" : (t.startsWith("text/") || t.startsWith("application/"), "text") : "text";
|
|
1126
|
+
}
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region src/components/rich-text/utils/mediaType.ts
|
|
1129
|
+
var an = {
|
|
1130
|
+
csv: "text/csv",
|
|
1131
|
+
tsv: "text/tab-separated-values",
|
|
1132
|
+
json: "application/json",
|
|
1133
|
+
md: "text/markdown",
|
|
1134
|
+
markdown: "text/markdown",
|
|
1135
|
+
txt: "text/plain",
|
|
1136
|
+
pdf: "application/pdf",
|
|
1137
|
+
png: "image/png",
|
|
1138
|
+
jpg: "image/jpeg",
|
|
1139
|
+
jpeg: "image/jpeg",
|
|
1140
|
+
gif: "image/gif",
|
|
1141
|
+
svg: "image/svg+xml",
|
|
1142
|
+
webp: "image/webp",
|
|
1143
|
+
mp4: "video/mp4",
|
|
1144
|
+
mov: "video/quicktime",
|
|
1145
|
+
ts: "text/typescript",
|
|
1146
|
+
tsx: "text/typescript",
|
|
1147
|
+
js: "text/javascript",
|
|
1148
|
+
jsx: "text/javascript",
|
|
1149
|
+
sql: "text/x-sql",
|
|
1150
|
+
yml: "text/yaml",
|
|
1151
|
+
yaml: "text/yaml"
|
|
1152
|
+
};
|
|
1153
|
+
function on(e) {
|
|
1154
|
+
let t = (e.split("?")[0]?.split("#")[0] ?? "").split(".").pop()?.toLowerCase();
|
|
1155
|
+
return t ? an[t] ?? null : null;
|
|
1156
|
+
}
|
|
1157
|
+
//#endregion
|
|
1158
|
+
export { Xt as a, yt as c, en as i, _t as l, rn as n, Ht as o, $t as r, Nt as s, on as t, Ke as u };
|
|
1159
|
+
|
|
1160
|
+
//# sourceMappingURL=rich-text-BgEnAHr2.js.map
|