@pstdio/ui 0.44.0 → 0.45.0-nightly.20261021030241
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-DhNTaUMt.js → MermaidComponent-CTWuGAqI.js} +2 -2
- package/dist/{MermaidComponent-DhNTaUMt.js.map → MermaidComponent-CTWuGAqI.js.map} +1 -1
- package/dist/alert-CO-uOKLm.js +409 -0
- package/dist/alert-CO-uOKLm.js.map +1 -0
- package/dist/chat-ui.d.ts +7 -5
- package/dist/chat-ui.js +1110 -1119
- package/dist/chat-ui.js.map +1 -1
- package/dist/{collection-view-grouping-BKIr4QAb.js → collection-view-grouping-BQMfKdQG.js} +2 -2
- package/dist/{collection-view-grouping-BKIr4QAb.js.map → collection-view-grouping-BQMfKdQG.js.map} +1 -1
- package/dist/{collection-view-search-D7HFymZW.js → collection-view-search-DS9U9WAl.js} +2 -2
- package/dist/{collection-view-search-D7HFymZW.js.map → collection-view-search-DS9U9WAl.js.map} +1 -1
- package/dist/collection-view.d.ts +90 -3
- package/dist/collection-view.js +1 -1
- package/dist/data-table.d.ts +1 -2
- package/dist/data-table.js +4 -4
- package/dist/{diff-viewer-Cpiw-1ut.js → diff-viewer-ChEyTNpa.js} +2 -2
- package/dist/{diff-viewer-Cpiw-1ut.js.map → diff-viewer-ChEyTNpa.js.map} +1 -1
- package/dist/diff.js +2 -2
- package/dist/{display-sort-control-BuqijDAl.js → display-sort-control-BUMkmlIu.js} +3 -3
- package/dist/{display-sort-control-BuqijDAl.js.map → display-sort-control-BUMkmlIu.js.map} +1 -1
- package/dist/{edit-mode-data-table-BwNTRik5.js → edit-mode-data-table-MKEjfFUw.js} +4 -4
- package/dist/{edit-mode-data-table-BwNTRik5.js.map → edit-mode-data-table-MKEjfFUw.js.map} +1 -1
- package/dist/icon-options-DpzDAnlu.js +313 -0
- package/dist/icon-options-DpzDAnlu.js.map +1 -0
- package/dist/{index-DTjRTEez.d.ts → index-C0PaeiBy.d.ts} +8 -1
- package/dist/{index-Bq1BDCBk.d.ts → index-eV_0Gjzo.d.ts} +4 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +862 -780
- package/dist/index.js.map +1 -1
- package/dist/kanban-renderer.d.ts +2 -2
- package/dist/kanban-renderer.js +596 -397
- package/dist/kanban-renderer.js.map +1 -1
- package/dist/{markdown-editor-DUBUE7M-.js → markdown-editor-BPGIS9ku.js} +996 -876
- package/dist/markdown-editor-BPGIS9ku.js.map +1 -0
- package/dist/param-editor-Bva0M7Ns.js +374 -0
- package/dist/param-editor-Bva0M7Ns.js.map +1 -0
- package/dist/{param-editor-field-B5z6200g.js → param-editor-field-BPBlweVg.js} +1183 -1161
- package/dist/param-editor-field-BPBlweVg.js.map +1 -0
- package/dist/param-editor.d.ts +57 -2
- package/dist/param-editor.js +3 -3
- package/dist/{resolve-icon-component-Ck6ZyRnc.js → resolve-icon-component-Dy0pOuj5.js} +2 -2
- package/dist/{resolve-icon-component-Ck6ZyRnc.js.map → resolve-icon-component-Dy0pOuj5.js.map} +1 -1
- package/dist/{rich-text-2c_ra5gK.js → rich-text-CH2psble.js} +569 -524
- package/dist/rich-text-CH2psble.js.map +1 -0
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.js +3 -3
- package/dist/terminal.js +1 -1
- package/dist/{theme-Chgjys_o.js → theme-BsStBWWL.js} +255 -155
- package/dist/theme-BsStBWWL.js.map +1 -0
- package/dist/theme.js +1 -1
- package/dist/{tree-list-B8Gtot1M.js → tree-list-aNC_UTGS.js} +396 -341
- package/dist/tree-list-aNC_UTGS.js.map +1 -0
- package/package.json +2 -2
- package/dist/alert-MQ47wy7f.js +0 -388
- package/dist/alert-MQ47wy7f.js.map +0 -1
- package/dist/icon-options-Tt6Wzhtv.js +0 -308
- package/dist/icon-options-Tt6Wzhtv.js.map +0 -1
- package/dist/index-kYQwGcym.d.ts +0 -91
- package/dist/markdown-editor-DUBUE7M-.js.map +0 -1
- package/dist/param-editor-DK1uCOh3.js +0 -225
- package/dist/param-editor-DK1uCOh3.js.map +0 -1
- package/dist/param-editor-field-B5z6200g.js.map +0 -1
- package/dist/rich-text-2c_ra5gK.js.map +0 -1
- package/dist/theme-Chgjys_o.js.map +0 -1
- package/dist/tree-list-B8Gtot1M.js.map +0 -1
package/dist/chat-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./alert-
|
|
1
|
+
import { t as e } from "./alert-CO-uOKLm.js";
|
|
2
2
|
import { n as t, t as n } from "./scroll-area-IeoRS73V.js";
|
|
3
3
|
import { t as r } from "./list-row-BDDAVuVd.js";
|
|
4
4
|
import { t as i } from "./use-virtualizer-CqDYJolY.js";
|
|
@@ -6,23 +6,23 @@ import { i as a } from "./prism-E3-NXX_t.js";
|
|
|
6
6
|
import { a as o } from "./host-storage-28AkEy1N.js";
|
|
7
7
|
import { t as s } from "./drop-indicator-HjlBSIeV.js";
|
|
8
8
|
import { t as c } from "./empty-state-3mVV_pV-.js";
|
|
9
|
-
import { t as l } from "./icon-options-
|
|
9
|
+
import { t as l } from "./icon-options-DpzDAnlu.js";
|
|
10
10
|
import { n as u, t as d } from "./radio-CiFrDN6O.js";
|
|
11
11
|
import { n as f, t as p } from "./queued-follow-up-Bj_vtMgd.js";
|
|
12
|
-
import {
|
|
13
|
-
import { c as
|
|
14
|
-
import { t as
|
|
15
|
-
import { AbsoluteCenter as
|
|
12
|
+
import { B as m, C as h, E as g, F as _, L as v, P as y, S as b, T as x, w as S, z as C } from "./markdown-editor-BPGIS9ku.js";
|
|
13
|
+
import { c as w, l as T, o as E, s as D } from "./rich-text-CH2psble.js";
|
|
14
|
+
import { t as O } from "./diff-bubble-DewUd_2w.js";
|
|
15
|
+
import { AbsoluteCenter as k, Avatar as A, Box as j, Button as M, Card as N, Code as P, Field as F, Flex as I, HStack as L, Icon as ee, IconButton as R, Image as z, Input as te, Kbd as B, Link as ne, Menu as re, Popover as V, Portal as ie, Skeleton as H, Span as U, Spinner as ae, Stack as W, Tag as oe, Text as G, Textarea as se, Timeline as ce, Tooltip as le, chakra as K, createSlotRecipeContext as ue, defineSlotRecipe as de, useRecipe as fe, useSlotRecipe as pe } from "@chakra-ui/react";
|
|
16
16
|
import { c as q } from "react/compiler-runtime";
|
|
17
|
-
import { Fragment as
|
|
18
|
-
import { Fragment as
|
|
19
|
-
import { AlertTriangle as
|
|
20
|
-
import { defaultRangeExtractor as
|
|
21
|
-
import { DndContext as
|
|
22
|
-
import { StickToBottom as
|
|
17
|
+
import { Fragment as me, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
18
|
+
import { Fragment as he, Suspense as ge, createContext as _e, lazy as ve, useContext as ye, useEffect as X, useLayoutEffect as be, useRef as Z, useState as Q } from "react";
|
|
19
|
+
import { AlertTriangle as xe, ArrowDownIcon as Se, ArrowRight as Ce, ArrowUp as we, Check as Te, ChevronUpIcon as Ee, CircleQuestionMark as De, Copy as Oe, DotIcon as ke, File as Ae, FileDiff as je, FileDown as Me, FilePen as Ne, FileText as Pe, FileUp as Fe, Globe as Ie, GripVertical as Le, ListTodo as Re, ListTree as ze, MessageCircleIcon as Be, Move as Ve, Pause as He, Search as Ue, ShieldCheck as We, ShieldX as Ge, Terminal as Ke, Trash2 as qe } from "lucide-react";
|
|
20
|
+
import { defaultRangeExtractor as Je } from "@tanstack/react-virtual";
|
|
21
|
+
import { DndContext as Ye, KeyboardSensor as Xe, PointerSensor as Ze, pointerWithin as Qe, rectIntersection as $e, useDraggable as et, useDroppable as tt, useSensor as nt, useSensors as rt } from "@dnd-kit/core";
|
|
22
|
+
import { StickToBottom as it, useStickToBottomContext as at } from "use-stick-to-bottom";
|
|
23
23
|
//#region src/components/chat-ui/components/use-conversation-visibility.ts
|
|
24
|
-
var
|
|
25
|
-
let e = q(5), { scrollRef: t, stopScroll: n, scrollToBottom: r } =
|
|
24
|
+
var ot = () => {
|
|
25
|
+
let e = q(5), { scrollRef: t, stopScroll: n, scrollToBottom: r } = at(), i, a;
|
|
26
26
|
e[0] !== t || e[1] !== r || e[2] !== n ? (i = () => {
|
|
27
27
|
let e = t.current;
|
|
28
28
|
if (!e) return;
|
|
@@ -51,8 +51,8 @@ var at = () => {
|
|
|
51
51
|
t,
|
|
52
52
|
n,
|
|
53
53
|
r
|
|
54
|
-
], e[0] = t, e[1] = r, e[2] = n, e[3] = i, e[4] = a) : (i = e[3], a = e[4]),
|
|
55
|
-
},
|
|
54
|
+
], e[0] = t, e[1] = r, e[2] = n, e[3] = i, e[4] = a) : (i = e[3], a = e[4]), be(i, a);
|
|
55
|
+
}, st = K(it, { base: {
|
|
56
56
|
position: "relative",
|
|
57
57
|
flex: 1,
|
|
58
58
|
overflow: "hidden",
|
|
@@ -65,11 +65,11 @@ var at = () => {
|
|
|
65
65
|
resize: "instant",
|
|
66
66
|
role: "log"
|
|
67
67
|
}
|
|
68
|
-
}),
|
|
68
|
+
}), ct = (e) => {
|
|
69
69
|
let t = q(10), r, i;
|
|
70
70
|
t[0] === e ? (r = t[1], i = t[2]) : ({children: r, ...i} = e, t[0] = e, t[1] = r, t[2] = i);
|
|
71
|
-
let { contentRef: a, scrollRef: o } =
|
|
72
|
-
|
|
71
|
+
let { contentRef: a, scrollRef: o } = at();
|
|
72
|
+
ot();
|
|
73
73
|
let s = o, c = a, l, u;
|
|
74
74
|
t[3] === Symbol.for("react.memo_cache_sentinel") ? (l = { zIndex: 2 }, u = {
|
|
75
75
|
layerStyle: "chatContent",
|
|
@@ -89,28 +89,28 @@ var at = () => {
|
|
|
89
89
|
contentProps: u,
|
|
90
90
|
children: r
|
|
91
91
|
}), t[5] = r, t[6] = i, t[7] = s, t[8] = c, t[9] = d) : d = t[9], d;
|
|
92
|
-
},
|
|
92
|
+
}, lt = {
|
|
93
93
|
axis: "horizontal",
|
|
94
94
|
bottom: "md",
|
|
95
95
|
zIndex: 2
|
|
96
|
-
},
|
|
97
|
-
Root:
|
|
98
|
-
Viewport:
|
|
96
|
+
}, ut = {
|
|
97
|
+
Root: st,
|
|
98
|
+
Viewport: ct,
|
|
99
99
|
ScrollToBottom: (e) => {
|
|
100
|
-
let t = q(4), { isAtBottom: n, scrollToBottom: r } =
|
|
101
|
-
return t[0] !== n || t[1] !== e || t[2] !== r ? (i = !n && /* @__PURE__ */ J(
|
|
102
|
-
...
|
|
100
|
+
let t = q(4), { isAtBottom: n, scrollToBottom: r } = at(), i;
|
|
101
|
+
return t[0] !== n || t[1] !== e || t[2] !== r ? (i = !n && /* @__PURE__ */ J(k, {
|
|
102
|
+
...lt,
|
|
103
103
|
children: /* @__PURE__ */ J(R, {
|
|
104
104
|
rounded: "full",
|
|
105
105
|
onClick: () => r(),
|
|
106
106
|
variant: "outline",
|
|
107
107
|
size: "xs",
|
|
108
108
|
...e,
|
|
109
|
-
children: /* @__PURE__ */ J(
|
|
109
|
+
children: /* @__PURE__ */ J(Se, { size: 16 })
|
|
110
110
|
})
|
|
111
111
|
}), t[0] = n, t[1] = e, t[2] = r, t[3] = i) : i = t[3], i;
|
|
112
112
|
}
|
|
113
|
-
},
|
|
113
|
+
}, dt = de({
|
|
114
114
|
className: "ai-message",
|
|
115
115
|
slots: ["root", "content"],
|
|
116
116
|
base: {
|
|
@@ -193,23 +193,23 @@ var at = () => {
|
|
|
193
193
|
shape: "rounded",
|
|
194
194
|
delivery: "sent"
|
|
195
195
|
}
|
|
196
|
-
}), { withProvider:
|
|
197
|
-
Root:
|
|
198
|
-
Content:
|
|
199
|
-
},
|
|
196
|
+
}), { withProvider: ft, withContext: pt } = ue({ recipe: dt }), mt = {
|
|
197
|
+
Root: ft("div", "root"),
|
|
198
|
+
Content: pt("div", "content")
|
|
199
|
+
}, ht = (e) => {
|
|
200
200
|
if (e == null) return null;
|
|
201
201
|
let t = typeof e == "string" ? e : JSON.stringify(e, null, 2);
|
|
202
202
|
return t.length === 0 ? null : t.length > 200 ? `${t.slice(0, 200)}...` : t;
|
|
203
|
-
},
|
|
203
|
+
}, gt = (e) => {
|
|
204
204
|
let t = q(19), { toolName: r, toolInput: i, onApprove: a, onDeny: o } = e, s;
|
|
205
|
-
t[0] === i ? s = t[1] : (s =
|
|
205
|
+
t[0] === i ? s = t[1] : (s = ht(i), t[0] = i, t[1] = s);
|
|
206
206
|
let c = s, l;
|
|
207
207
|
t[2] === r ? l = t[3] : (l = /* @__PURE__ */ Y(G, {
|
|
208
208
|
textStyle: "label/S/medium",
|
|
209
209
|
color: "fg",
|
|
210
210
|
children: [
|
|
211
211
|
"Allow ",
|
|
212
|
-
/* @__PURE__ */ J(
|
|
212
|
+
/* @__PURE__ */ J(P, {
|
|
213
213
|
size: "sm",
|
|
214
214
|
children: r
|
|
215
215
|
}),
|
|
@@ -219,7 +219,7 @@ var at = () => {
|
|
|
219
219
|
let u;
|
|
220
220
|
t[4] === c ? u = t[5] : (u = c ? /* @__PURE__ */ J(n, {
|
|
221
221
|
maxH: "6rem",
|
|
222
|
-
children: /* @__PURE__ */ J(
|
|
222
|
+
children: /* @__PURE__ */ J(P, {
|
|
223
223
|
size: "sm",
|
|
224
224
|
whiteSpace: "pre-wrap",
|
|
225
225
|
display: "block",
|
|
@@ -228,31 +228,31 @@ var at = () => {
|
|
|
228
228
|
})
|
|
229
229
|
}) : null, t[4] = c, t[5] = u);
|
|
230
230
|
let d;
|
|
231
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ J(
|
|
231
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ J(Ge, { size: 14 }), t[6] = d) : d = t[6];
|
|
232
232
|
let f;
|
|
233
|
-
t[7] === o ? f = t[8] : (f = /* @__PURE__ */ Y(
|
|
233
|
+
t[7] === o ? f = t[8] : (f = /* @__PURE__ */ Y(M, {
|
|
234
234
|
size: "xs",
|
|
235
235
|
variant: "outline",
|
|
236
236
|
onClick: o,
|
|
237
237
|
children: [d, "Deny"]
|
|
238
238
|
}), t[7] = o, t[8] = f);
|
|
239
239
|
let p;
|
|
240
|
-
t[9] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ J(
|
|
240
|
+
t[9] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ J(We, { size: 14 }), t[9] = p) : p = t[9];
|
|
241
241
|
let m;
|
|
242
|
-
t[10] === a ? m = t[11] : (m = /* @__PURE__ */ Y(
|
|
242
|
+
t[10] === a ? m = t[11] : (m = /* @__PURE__ */ Y(M, {
|
|
243
243
|
size: "xs",
|
|
244
244
|
colorPalette: "green",
|
|
245
245
|
onClick: a,
|
|
246
246
|
children: [p, "Allow"]
|
|
247
247
|
}), t[10] = a, t[11] = m);
|
|
248
248
|
let h;
|
|
249
|
-
t[12] !== f || t[13] !== m ? (h = /* @__PURE__ */ Y(
|
|
249
|
+
t[12] !== f || t[13] !== m ? (h = /* @__PURE__ */ Y(L, {
|
|
250
250
|
gap: "xs",
|
|
251
251
|
justifyContent: "flex-end",
|
|
252
252
|
children: [f, m]
|
|
253
253
|
}), t[12] = f, t[13] = m, t[14] = h) : h = t[14];
|
|
254
254
|
let g;
|
|
255
|
-
return t[15] !== l || t[16] !== u || t[17] !== h ? (g = /* @__PURE__ */ J(
|
|
255
|
+
return t[15] !== l || t[16] !== u || t[17] !== h ? (g = /* @__PURE__ */ J(j, {
|
|
256
256
|
px: "sm",
|
|
257
257
|
py: "xs",
|
|
258
258
|
mx: "sm",
|
|
@@ -260,7 +260,7 @@ var at = () => {
|
|
|
260
260
|
borderColor: "border.warning",
|
|
261
261
|
borderRadius: "lg",
|
|
262
262
|
bg: "bg.warning",
|
|
263
|
-
children: /* @__PURE__ */ Y(
|
|
263
|
+
children: /* @__PURE__ */ Y(I, {
|
|
264
264
|
direction: "column",
|
|
265
265
|
gap: "xs",
|
|
266
266
|
children: [
|
|
@@ -270,10 +270,10 @@ var at = () => {
|
|
|
270
270
|
]
|
|
271
271
|
})
|
|
272
272
|
}), t[15] = l, t[16] = u, t[17] = h, t[18] = g) : g = t[18], g;
|
|
273
|
-
},
|
|
273
|
+
}, _t = "md", vt = "neutral", yt = (e) => {
|
|
274
274
|
let t = q(17), { attachments: n, onSelect: r, onRemove: i, renderBadge: o, size: s, tone: c } = e, l;
|
|
275
275
|
t[0] === n ? l = t[1] : (l = n === void 0 ? [] : n, t[0] = n, t[1] = l);
|
|
276
|
-
let u = l, d = s === void 0 ?
|
|
276
|
+
let u = l, d = s === void 0 ? _t : s, f = c === void 0 ? vt : c;
|
|
277
277
|
if (u.length === 0) return null;
|
|
278
278
|
let p;
|
|
279
279
|
if (t[2] !== u || t[3] !== i || t[4] !== r || t[5] !== o || t[6] !== d || t[7] !== f) {
|
|
@@ -288,7 +288,7 @@ var at = () => {
|
|
|
288
288
|
size: d,
|
|
289
289
|
tone: f
|
|
290
290
|
});
|
|
291
|
-
return /* @__PURE__ */ J(
|
|
291
|
+
return /* @__PURE__ */ J(he, { children: r }, e);
|
|
292
292
|
}
|
|
293
293
|
return /* @__PURE__ */ J(a, {
|
|
294
294
|
fileName: e,
|
|
@@ -307,13 +307,13 @@ var at = () => {
|
|
|
307
307
|
flexWrap: "wrap",
|
|
308
308
|
children: p
|
|
309
309
|
}), t[15] = p, t[16] = m), m;
|
|
310
|
-
},
|
|
310
|
+
}, bt = (e) => {
|
|
311
311
|
let { previousUserMessageCount: t, userMessageCount: n } = e;
|
|
312
312
|
return t !== 0 && n > t;
|
|
313
|
-
},
|
|
313
|
+
}, xt = (e) => {
|
|
314
314
|
let t = e.conversationKey ?? null;
|
|
315
315
|
return e.state.conversationKey === t ? {
|
|
316
|
-
shouldScroll:
|
|
316
|
+
shouldScroll: bt({
|
|
317
317
|
previousUserMessageCount: e.state.userMessageCount,
|
|
318
318
|
userMessageCount: e.userMessageCount
|
|
319
319
|
}),
|
|
@@ -328,19 +328,19 @@ var at = () => {
|
|
|
328
328
|
userMessageCount: e.userMessageCount
|
|
329
329
|
}
|
|
330
330
|
};
|
|
331
|
-
},
|
|
332
|
-
let t =
|
|
331
|
+
}, St = (e) => {
|
|
332
|
+
let t = xt(e);
|
|
333
333
|
return t.shouldScroll && e.scrollToBottom("instant"), t;
|
|
334
334
|
};
|
|
335
|
-
function
|
|
336
|
-
let t = q(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } =
|
|
335
|
+
function Ct(e) {
|
|
336
|
+
let t = q(8), { conversationKey: n, userMessageCount: r } = e, { scrollToBottom: i } = at(), a = n ?? null, o;
|
|
337
337
|
t[0] !== a || t[1] !== r ? (o = {
|
|
338
338
|
conversationKey: a,
|
|
339
339
|
userMessageCount: r
|
|
340
340
|
}, t[0] = a, t[1] = r, t[2] = o) : o = t[2];
|
|
341
341
|
let s = Z(o), c, l;
|
|
342
342
|
return t[3] !== n || t[4] !== i || t[5] !== r ? (c = () => {
|
|
343
|
-
let e =
|
|
343
|
+
let e = St({
|
|
344
344
|
state: s.current,
|
|
345
345
|
conversationKey: n,
|
|
346
346
|
userMessageCount: r,
|
|
@@ -355,7 +355,7 @@ function St(e) {
|
|
|
355
355
|
}
|
|
356
356
|
//#endregion
|
|
357
357
|
//#region src/theme/recipes/chat-composer.ts
|
|
358
|
-
var
|
|
358
|
+
var wt = de({
|
|
359
359
|
className: "ps-chat-composer",
|
|
360
360
|
slots: ["input", "workspace"],
|
|
361
361
|
base: {
|
|
@@ -384,13 +384,13 @@ var Ct = ue({
|
|
|
384
384
|
bg: "bg.muted"
|
|
385
385
|
} } }
|
|
386
386
|
}
|
|
387
|
-
}),
|
|
387
|
+
}), Tt = (e = "") => JSON.stringify(w(e)), Et = (e) => e.trim().length > 0, Dt = (e) => {
|
|
388
388
|
let { canSubmit: t, isDisabled: n, text: r } = e;
|
|
389
|
-
return n || !t || !
|
|
390
|
-
},
|
|
389
|
+
return n || !t || !Et(r) ? "none" : "submit";
|
|
390
|
+
}, Ot = (e) => {
|
|
391
391
|
let { canInterrupt: t, canSubmit: n, hasQuestionPrompt: r, isDisabled: i, streaming: a, text: o } = e;
|
|
392
|
-
return i ? "none" : n &&
|
|
393
|
-
},
|
|
392
|
+
return i ? "none" : n && Et(o) ? "submit" : a && !r && t ? "interrupt" : "none";
|
|
393
|
+
}, kt = (e, t = 200) => e.length > 0 && e.split(/\r\n|\r|\n/).length > t, At = (e) => {
|
|
394
394
|
let { onAttachFiles: t, onAttachText: n, textAttachmentPasteLineThreshold: r } = e;
|
|
395
395
|
return {
|
|
396
396
|
onDragOver: (e) => {
|
|
@@ -407,18 +407,18 @@ var Ct = ue({
|
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
409
|
let a = e.clipboardData.getData("text/plain");
|
|
410
|
-
n &&
|
|
410
|
+
n && kt(a, r) && (e.preventDefault(), n(a));
|
|
411
411
|
}
|
|
412
412
|
};
|
|
413
|
-
},
|
|
413
|
+
}, jt = (e) => {
|
|
414
414
|
let t = q(22), n, r, i, a;
|
|
415
415
|
t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4]) : ({title: a, shortcut: i, canInterrupt: n, ...r} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a);
|
|
416
416
|
let o = r["aria-label"] ?? a, s;
|
|
417
|
-
t[5] === n ? s = t[6] : (s = n ? /* @__PURE__ */ J(
|
|
417
|
+
t[5] === n ? s = t[6] : (s = n ? /* @__PURE__ */ J(He, {
|
|
418
418
|
size: 16,
|
|
419
419
|
strokeWidth: 2,
|
|
420
420
|
fill: "currentColor"
|
|
421
|
-
}) : /* @__PURE__ */ J(
|
|
421
|
+
}) : /* @__PURE__ */ J(we, {
|
|
422
422
|
size: 16,
|
|
423
423
|
strokeWidth: 2
|
|
424
424
|
}), t[5] = n, t[6] = s);
|
|
@@ -435,7 +435,7 @@ var Ct = ue({
|
|
|
435
435
|
let u = l;
|
|
436
436
|
if (a) {
|
|
437
437
|
let e;
|
|
438
|
-
t[12] !== i || t[13] !== a ? (e = i ? /* @__PURE__ */ Y(
|
|
438
|
+
t[12] !== i || t[13] !== a ? (e = i ? /* @__PURE__ */ Y(me, { children: [
|
|
439
439
|
a,
|
|
440
440
|
" ",
|
|
441
441
|
/* @__PURE__ */ J(B, {
|
|
@@ -444,28 +444,28 @@ var Ct = ue({
|
|
|
444
444
|
})
|
|
445
445
|
] }) : a, t[12] = i, t[13] = a, t[14] = e) : e = t[14];
|
|
446
446
|
let n = e, r;
|
|
447
|
-
t[15] === u ? r = t[16] : (r = /* @__PURE__ */ J(
|
|
447
|
+
t[15] === u ? r = t[16] : (r = /* @__PURE__ */ J(le.Trigger, {
|
|
448
448
|
asChild: !0,
|
|
449
449
|
children: u
|
|
450
450
|
}), t[15] = u, t[16] = r);
|
|
451
451
|
let o;
|
|
452
|
-
t[17] === n ? o = t[18] : (o = /* @__PURE__ */ J(
|
|
452
|
+
t[17] === n ? o = t[18] : (o = /* @__PURE__ */ J(ie, { children: /* @__PURE__ */ J(le.Positioner, { children: /* @__PURE__ */ J(le.Content, { children: n }) }) }), t[17] = n, t[18] = o);
|
|
453
453
|
let s;
|
|
454
|
-
return t[19] !== r || t[20] !== o ? (s = /* @__PURE__ */ Y(
|
|
454
|
+
return t[19] !== r || t[20] !== o ? (s = /* @__PURE__ */ Y(le.Root, {
|
|
455
455
|
closeDelay: 50,
|
|
456
456
|
openDelay: 100,
|
|
457
457
|
children: [r, o]
|
|
458
458
|
}), t[19] = r, t[20] = o, t[21] = s) : s = t[21], s;
|
|
459
459
|
}
|
|
460
460
|
return u;
|
|
461
|
-
},
|
|
461
|
+
}, Mt = (e) => {
|
|
462
462
|
let t = q(18), { actions: r, submitActions: i, questionPrompt: a, skipDisabled: o, skipTitle: s, onSkip: c, buttonAction: l, submitTitle: u, submitLabel: d, messageTitle: f, runAction: p } = e, m;
|
|
463
463
|
t[0] === r ? m = t[1] : (m = /* @__PURE__ */ J(n, {
|
|
464
464
|
flex: "1",
|
|
465
465
|
minW: "0",
|
|
466
466
|
showVerticalScrollbar: !1,
|
|
467
467
|
showHorizontalScrollbar: !0,
|
|
468
|
-
children: /* @__PURE__ */ J(
|
|
468
|
+
children: /* @__PURE__ */ J(L, {
|
|
469
469
|
gap: "1",
|
|
470
470
|
width: "max-content",
|
|
471
471
|
minH: "7",
|
|
@@ -473,7 +473,7 @@ var Ct = ue({
|
|
|
473
473
|
})
|
|
474
474
|
}), t[0] = r, t[1] = m);
|
|
475
475
|
let h;
|
|
476
|
-
t[2] !== c || t[3] !== a || t[4] !== o || t[5] !== s ? (h = a ? /* @__PURE__ */ J(
|
|
476
|
+
t[2] !== c || t[3] !== a || t[4] !== o || t[5] !== s ? (h = a ? /* @__PURE__ */ J(M, {
|
|
477
477
|
size: "xs",
|
|
478
478
|
variant: "ghost",
|
|
479
479
|
disabled: o,
|
|
@@ -482,13 +482,13 @@ var Ct = ue({
|
|
|
482
482
|
children: "Skip"
|
|
483
483
|
}) : null, t[2] = c, t[3] = a, t[4] = o, t[5] = s, t[6] = h) : h = t[6];
|
|
484
484
|
let g;
|
|
485
|
-
t[7] !== l || t[8] !== f || t[9] !== p || t[10] !== d || t[11] !== u ? (g = d ? /* @__PURE__ */ J(
|
|
485
|
+
t[7] !== l || t[8] !== f || t[9] !== p || t[10] !== d || t[11] !== u ? (g = d ? /* @__PURE__ */ J(M, {
|
|
486
486
|
size: "xs",
|
|
487
487
|
variant: "primary",
|
|
488
488
|
disabled: l === "none",
|
|
489
489
|
onClick: () => p(l),
|
|
490
490
|
children: d
|
|
491
|
-
}) : /* @__PURE__ */ J(
|
|
491
|
+
}) : /* @__PURE__ */ J(jt, {
|
|
492
492
|
canInterrupt: l === "interrupt",
|
|
493
493
|
title: l === "interrupt" ? "Stop Response" : u ?? f,
|
|
494
494
|
shortcut: l === "submit" ? "Enter" : void 0,
|
|
@@ -496,7 +496,7 @@ var Ct = ue({
|
|
|
496
496
|
disabled: l === "none"
|
|
497
497
|
}), t[7] = l, t[8] = f, t[9] = p, t[10] = d, t[11] = u, t[12] = g) : g = t[12];
|
|
498
498
|
let _;
|
|
499
|
-
return t[13] !== i || t[14] !== m || t[15] !== h || t[16] !== g ? (_ = /* @__PURE__ */ Y(
|
|
499
|
+
return t[13] !== i || t[14] !== m || t[15] !== h || t[16] !== g ? (_ = /* @__PURE__ */ Y(L, {
|
|
500
500
|
gap: "1",
|
|
501
501
|
minH: "7",
|
|
502
502
|
align: "center",
|
|
@@ -507,19 +507,19 @@ var Ct = ue({
|
|
|
507
507
|
g
|
|
508
508
|
]
|
|
509
509
|
}), t[13] = i, t[14] = m, t[15] = h, t[16] = g, t[17] = _) : _ = t[17], _;
|
|
510
|
-
},
|
|
510
|
+
}, Nt = async (e) => {
|
|
511
511
|
await e.onSubmit(e.text, e.response ? [] : e.attachments, e.response), e.response || e.onClearAttachments?.();
|
|
512
|
-
},
|
|
513
|
-
let { [
|
|
512
|
+
}, Pt = "Other", Ft = "__pstdio_other__", It = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, Lt = (e) => !!e.allowCustomAnswer && e.options.length > 0, Rt = (e, t) => e.id ?? `question-${t}`, zt = (e, t, n) => Object.hasOwn(e, Rt(t, n)), Bt = (e, t, n) => {
|
|
513
|
+
let { [Rt(t, n)]: r, ...i } = e;
|
|
514
514
|
return i;
|
|
515
|
-
},
|
|
515
|
+
}, Vt = (e, t, n) => zt(e, t, n) ? Bt(e, t, n) : {
|
|
516
516
|
...e,
|
|
517
|
-
[
|
|
518
|
-
},
|
|
517
|
+
[Rt(t, n)]: ""
|
|
518
|
+
}, Ht = "Skipped the question.", Ut = (e, t) => e.callId ? {
|
|
519
519
|
answers: t,
|
|
520
520
|
callId: e.callId
|
|
521
|
-
} : { answers: t },
|
|
522
|
-
let i =
|
|
521
|
+
} : { answers: t }, Wt = (e) => Ut(e, []), Gt = (e, t, n, r) => {
|
|
522
|
+
let i = Rt(t, n), a = It(e, i) ?? [], o = a.includes(r);
|
|
523
523
|
return t.multiple ? {
|
|
524
524
|
...e,
|
|
525
525
|
[i]: o ? a.filter((e) => e !== r) : [...a, r]
|
|
@@ -527,11 +527,11 @@ var Ct = ue({
|
|
|
527
527
|
...e,
|
|
528
528
|
[i]: o ? [] : [r]
|
|
529
529
|
};
|
|
530
|
-
},
|
|
530
|
+
}, Kt = (e) => e ? JSON.stringify({
|
|
531
531
|
callId: e.callId,
|
|
532
532
|
delivery: e.delivery,
|
|
533
533
|
questions: e.questions.map((e, t) => ({
|
|
534
|
-
id:
|
|
534
|
+
id: Rt(e, t),
|
|
535
535
|
question: e.question,
|
|
536
536
|
multiple: !!e.multiple,
|
|
537
537
|
required: !!e.required,
|
|
@@ -541,44 +541,44 @@ var Ct = ue({
|
|
|
541
541
|
description: e.description ?? ""
|
|
542
542
|
}))
|
|
543
543
|
}))
|
|
544
|
-
}) : "",
|
|
544
|
+
}) : "", qt = (e, t, n) => {
|
|
545
545
|
let r = n?.trim();
|
|
546
546
|
return r ? e.multiple ? [...t, r] : [r] : t;
|
|
547
|
-
},
|
|
547
|
+
}, Jt = (e, t, n, r) => qt(e, It(n, t) ?? [], It(r, t)), Yt = (e, t, n) => {
|
|
548
548
|
let r = [];
|
|
549
549
|
for (let i = 0; i < e.questions.length; i += 1) {
|
|
550
|
-
let a = e.questions[i], o =
|
|
550
|
+
let a = e.questions[i], o = Jt(a, Rt(a, i), t, n);
|
|
551
551
|
o.length !== 0 && r.push(`${a.question}: ${o.join(", ")}`);
|
|
552
552
|
}
|
|
553
553
|
return r;
|
|
554
|
-
},
|
|
555
|
-
if (
|
|
554
|
+
}, Xt = (e) => typeof e != "string", Zt = (e, t) => {
|
|
555
|
+
if (Xt(t)) return t;
|
|
556
556
|
let n = t.trim();
|
|
557
|
-
return n.length === 0 ? {} : Object.fromEntries(e.questions.flatMap((e, t) => e.allowCustomAnswer ? [[
|
|
558
|
-
},
|
|
557
|
+
return n.length === 0 ? {} : Object.fromEntries(e.questions.flatMap((e, t) => e.allowCustomAnswer ? [[Rt(e, t), n]] : []));
|
|
558
|
+
}, Qt = (e, t, n) => {
|
|
559
559
|
if (!e) return typeof n == "string" ? n.trim() : "";
|
|
560
|
-
let r =
|
|
560
|
+
let r = Yt(e, t, Zt(e, n)), i = typeof n == "string" ? n.trim() : "", a = e.questions.some((e) => e.allowCustomAnswer);
|
|
561
561
|
return i.length > 0 && !a && r.push(`Additional response: ${i}`), r.join("\n");
|
|
562
|
-
}, Qt = (e, t, n) => {
|
|
563
|
-
let r = Xt(e, n);
|
|
564
|
-
return e.questions.map((e, n) => qt(e, Lt(e, n), t, r));
|
|
565
562
|
}, $t = (e, t, n) => {
|
|
563
|
+
let r = Zt(e, n);
|
|
564
|
+
return e.questions.map((e, n) => Jt(e, Rt(e, n), t, r));
|
|
565
|
+
}, en = (e, t, n) => {
|
|
566
566
|
if (!e) return !1;
|
|
567
|
-
let r =
|
|
567
|
+
let r = Zt(e, n);
|
|
568
568
|
for (let n = 0; n < e.questions.length; n += 1) {
|
|
569
569
|
let i = e.questions[n];
|
|
570
|
-
if (!(!i.required ||
|
|
570
|
+
if (!(!i.required || Jt(i, Rt(i, n), t, r).length > 0)) return !0;
|
|
571
571
|
}
|
|
572
572
|
return !1;
|
|
573
|
-
},
|
|
573
|
+
}, tn = (e, t, n, r) => Jt(e, Rt(e, t), n, r).length > 0, nn = (e) => {
|
|
574
574
|
let n = q(22), { question: r, questionIndex: i, isActive: a, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: c } = e, l;
|
|
575
|
-
n[0] !== s || n[1] !== r || n[2] !== i || n[3] !== o ? (l =
|
|
575
|
+
n[0] !== s || n[1] !== r || n[2] !== i || n[3] !== o ? (l = tn(r, i, o, s), n[0] = s, n[1] = r, n[2] = i, n[3] = o, n[4] = l) : l = n[4];
|
|
576
576
|
let u = l, d = u ? "answered" : "not answered", f = a ? "outline" : "ghost", p = `question-step-tab-${r.id}`, m = `${r.question} (${d})`, h = `question-step-panel-${r.id}`, g;
|
|
577
577
|
n[5] !== c || n[6] !== i ? (g = () => c(i), n[5] = c, n[6] = i, n[7] = g) : g = n[7];
|
|
578
578
|
let _;
|
|
579
|
-
n[8] !== u || n[9] !== i ? (_ = u ? /* @__PURE__ */ J(
|
|
579
|
+
n[8] !== u || n[9] !== i ? (_ = u ? /* @__PURE__ */ J(Te, { "aria-hidden": "true" }) : i + 1, n[8] = u, n[9] = i, n[10] = _) : _ = n[10];
|
|
580
580
|
let v;
|
|
581
|
-
n[11] !== a || n[12] !== p || n[13] !== m || n[14] !== h || n[15] !== g || n[16] !== _ || n[17] !== f ? (v = /* @__PURE__ */ J(
|
|
581
|
+
n[11] !== a || n[12] !== p || n[13] !== m || n[14] !== h || n[15] !== g || n[16] !== _ || n[17] !== f ? (v = /* @__PURE__ */ J(M, {
|
|
582
582
|
id: p,
|
|
583
583
|
role: "tab",
|
|
584
584
|
"aria-label": m,
|
|
@@ -595,92 +595,92 @@ var Ct = ue({
|
|
|
595
595
|
content: r.question,
|
|
596
596
|
children: v
|
|
597
597
|
}), n[19] = r.question, n[20] = v, n[21] = y) : y = n[21], y;
|
|
598
|
-
},
|
|
598
|
+
}, rn = (e) => typeof e == "object" && !!e && !Array.isArray(e), an = (e) => {
|
|
599
599
|
try {
|
|
600
600
|
let t = JSON.parse(e);
|
|
601
|
-
return
|
|
601
|
+
return rn(t) ? t : null;
|
|
602
602
|
} catch {
|
|
603
603
|
return null;
|
|
604
604
|
}
|
|
605
|
-
},
|
|
606
|
-
let t =
|
|
605
|
+
}, on = (e) => rn(e) ? e : typeof e == "string" && e.trim().length > 0 ? an(e) : null, sn = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, cn = (e) => {
|
|
606
|
+
let t = sn(e);
|
|
607
607
|
if (t) return t;
|
|
608
608
|
if (Array.isArray(e)) {
|
|
609
|
-
let t = e.map(
|
|
609
|
+
let t = e.map(cn).filter((e) => e !== null);
|
|
610
610
|
return t.length > 0 ? t.join("\n") : null;
|
|
611
611
|
}
|
|
612
|
-
return
|
|
613
|
-
},
|
|
612
|
+
return rn(e) ? cn(e.response) ?? cn(e.answer) ?? cn(e.text) ?? cn(e.answers) : null;
|
|
613
|
+
}, ln = (e) => rn(e) ? Array.isArray(e.answers) ? !0 : ln(e.response) || ln(e.answer) : !1, un = (e) => cn(e) !== null || ln(e), dn = (e) => {
|
|
614
614
|
if (typeof e == "string" && e.trim().length > 0) return {
|
|
615
615
|
label: e,
|
|
616
616
|
description: void 0
|
|
617
617
|
};
|
|
618
|
-
if (!
|
|
619
|
-
let t =
|
|
618
|
+
if (!rn(e)) return null;
|
|
619
|
+
let t = sn(e.label);
|
|
620
620
|
return t ? {
|
|
621
621
|
label: t,
|
|
622
|
-
description:
|
|
622
|
+
description: sn(e.description) ?? void 0
|
|
623
623
|
} : null;
|
|
624
|
-
},
|
|
625
|
-
if (!
|
|
626
|
-
let n =
|
|
624
|
+
}, fn = (e, t) => {
|
|
625
|
+
if (!rn(e)) return null;
|
|
626
|
+
let n = sn(e.question);
|
|
627
627
|
if (!n) return null;
|
|
628
|
-
let r = Array.isArray(e.options) ? e.options.map(
|
|
628
|
+
let r = Array.isArray(e.options) ? e.options.map(dn).filter((e) => e !== null) : [], i = sn(e.type), a = typeof e.allowCustomAnswer == "boolean" ? e.allowCustomAnswer : r.length === 0 || i === "freeform" || i === "text", o = typeof e.custom == "boolean" ? e.custom : a;
|
|
629
629
|
return {
|
|
630
|
-
id:
|
|
630
|
+
id: sn(e.id) ?? `question-${t}`,
|
|
631
631
|
question: n,
|
|
632
632
|
options: r,
|
|
633
633
|
multiple: typeof e.multiple == "boolean" ? e.multiple : i === "multi_choice" || i === "multiple_choice",
|
|
634
634
|
required: typeof e.required != "boolean" || e.required,
|
|
635
635
|
allowCustomAnswer: o
|
|
636
636
|
};
|
|
637
|
-
},
|
|
638
|
-
let t =
|
|
637
|
+
}, pn = (e) => {
|
|
638
|
+
let t = on(e);
|
|
639
639
|
if (!t || !Array.isArray(t.questions)) return null;
|
|
640
|
-
let n = t.questions.map(
|
|
640
|
+
let n = t.questions.map(fn).filter((e) => e !== null);
|
|
641
641
|
return n.length === 0 ? null : {
|
|
642
642
|
questions: n,
|
|
643
643
|
...t.delivery === "async" ? { delivery: "async" } : {}
|
|
644
644
|
};
|
|
645
|
-
},
|
|
645
|
+
}, mn = (e) => e.tool.toLowerCase() === "question", hn = (e) => {
|
|
646
646
|
let t = /* @__PURE__ */ new Map();
|
|
647
|
-
for (let n of e) if (n.role === "assistant") for (let e of n.parts) e.type === "tool" &&
|
|
647
|
+
for (let n of e) if (n.role === "assistant") for (let e of n.parts) e.type === "tool" && mn(e) && t.set(e.callId ?? e, e);
|
|
648
648
|
return t.values();
|
|
649
|
-
},
|
|
650
|
-
if (!
|
|
651
|
-
let t =
|
|
649
|
+
}, gn = (e) => e.callId ?? JSON.stringify(e.state?.input), _n = (e) => e.status !== "failed" && e.status !== "denied" && !un(e.state?.output) && !un(e.state?.metadata), vn = (e) => {
|
|
650
|
+
if (!_n(e)) return;
|
|
651
|
+
let t = pn(e.state?.input);
|
|
652
652
|
return t ? {
|
|
653
653
|
...t,
|
|
654
654
|
...e.callId ? { callId: e.callId } : {}
|
|
655
655
|
} : void 0;
|
|
656
|
-
},
|
|
657
|
-
let n = [...
|
|
658
|
-
return n ?
|
|
659
|
-
},
|
|
660
|
-
for (let t of
|
|
661
|
-
let e =
|
|
656
|
+
}, yn = (e, t) => {
|
|
657
|
+
let n = [...hn(e)].find((e) => gn(e) === t);
|
|
658
|
+
return n ? vn(n) : void 0;
|
|
659
|
+
}, bn = (e) => {
|
|
660
|
+
for (let t of hn(e)) {
|
|
661
|
+
let e = vn(t);
|
|
662
662
|
if (e && e.delivery !== "async") return e;
|
|
663
663
|
}
|
|
664
|
-
},
|
|
664
|
+
}, xn = (e, t) => {
|
|
665
665
|
for (let n of [e.state?.metadata, e.state?.output]) {
|
|
666
|
-
let e =
|
|
666
|
+
let e = on(n);
|
|
667
667
|
if (Array.isArray(e?.answers)) {
|
|
668
668
|
let n = e.answers[t];
|
|
669
669
|
return Array.isArray(n) && n.length ? n.join(", ") : "Skipped";
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
if (
|
|
673
|
-
let n =
|
|
672
|
+
if (_n(e)) return;
|
|
673
|
+
let n = pn(e.state?.input), r = cn(e.state?.output);
|
|
674
674
|
if (!r || !n) return e.status === "failed" || e.status === "denied" ? "Unavailable" : "Answered";
|
|
675
675
|
let i = n.questions[t].question, a = r.split(/\n\n/).find((e) => e.startsWith(`${i}\n`));
|
|
676
676
|
return a ? a.slice(i.length + 1).trim() || "Skipped" : n.questions.length === 1 ? r : "Answered";
|
|
677
|
-
},
|
|
677
|
+
}, Sn = _e(void 0), Cn = () => ye(Sn), wn = (e, t) => {
|
|
678
678
|
let n = q(14), [r, i] = Q(), a = r?.conversationKey === t ? r : void 0, o;
|
|
679
|
-
n[0] !== a || n[1] !== e ? (o = a ?
|
|
679
|
+
n[0] !== a || n[1] !== e ? (o = a ? yn(e, a.key) : void 0, n[0] = a, n[1] = e, n[2] = o) : o = n[2];
|
|
680
680
|
let s = o, c = s ? a?.key : void 0, l = s ? a : void 0, u;
|
|
681
681
|
n[3] === t ? u = n[4] : (u = (e, n) => i((r) => ({
|
|
682
682
|
conversationKey: t,
|
|
683
|
-
key:
|
|
683
|
+
key: gn(e),
|
|
684
684
|
index: n,
|
|
685
685
|
revision: (r?.revision ?? 0) + 1
|
|
686
686
|
})), n[3] = t, n[4] = u);
|
|
@@ -702,9 +702,9 @@ var Ct = ue({
|
|
|
702
702
|
prompt: s,
|
|
703
703
|
value: m
|
|
704
704
|
}, n[11] = s, n[12] = m, n[13] = h) : h = n[13], h;
|
|
705
|
-
}, wn = (e) => {
|
|
706
|
-
e.preventDefault();
|
|
707
705
|
}, Tn = (e) => {
|
|
706
|
+
e.preventDefault();
|
|
707
|
+
}, En = (e) => {
|
|
708
708
|
let t = q(7), { option: n } = e, r;
|
|
709
709
|
t[0] === n.label ? r = t[1] : (r = /* @__PURE__ */ J(G, {
|
|
710
710
|
textStyle: "label/S/regular",
|
|
@@ -723,11 +723,11 @@ var Ct = ue({
|
|
|
723
723
|
minWidth: "0",
|
|
724
724
|
children: [r, i]
|
|
725
725
|
}), t[4] = r, t[5] = i, t[6] = a) : a = t[6], a;
|
|
726
|
-
},
|
|
726
|
+
}, Dn = (e) => {
|
|
727
727
|
let t = q(12), { option: n, name: r, checked: i, editable: a, onToggle: s } = e, c = !a, l = a ? void 0 : "true", u;
|
|
728
728
|
t[0] === a ? u = t[1] : (u = a ? void 0 : { tabIndex: -1 }, t[0] = a, t[1] = u);
|
|
729
729
|
let d = a ? s : void 0, f;
|
|
730
|
-
t[2] === n ? f = t[3] : (f = /* @__PURE__ */ J(
|
|
730
|
+
t[2] === n ? f = t[3] : (f = /* @__PURE__ */ J(En, { option: n }), t[2] = n, t[3] = f);
|
|
731
731
|
let p;
|
|
732
732
|
return t[4] !== i || t[5] !== r || t[6] !== c || t[7] !== l || t[8] !== u || t[9] !== d || t[10] !== f ? (p = /* @__PURE__ */ J(o, {
|
|
733
733
|
name: r,
|
|
@@ -739,15 +739,15 @@ var Ct = ue({
|
|
|
739
739
|
onCheckedChange: d,
|
|
740
740
|
children: f
|
|
741
741
|
}), t[4] = i, t[5] = r, t[6] = c, t[7] = l, t[8] = u, t[9] = d, t[10] = f, t[11] = p) : p = t[11], p;
|
|
742
|
-
},
|
|
742
|
+
}, On = (e) => {
|
|
743
743
|
let t = q(30), { question: n, questionIndex: r, name: i, selectedOption: a, otherSelected: o, editable: s, onToggleOption: c, onToggleOther: l } = e, { otherField: f } = e, p;
|
|
744
|
-
t[0] === n ? p = t[1] : (p =
|
|
744
|
+
t[0] === n ? p = t[1] : (p = Lt(n), t[0] = n, t[1] = p);
|
|
745
745
|
let m = p, h;
|
|
746
746
|
if (t[2] !== n.options || t[3] !== a) {
|
|
747
747
|
let e;
|
|
748
748
|
t[5] === a ? e = t[6] : (e = (e) => e.label === a, t[5] = a, t[6] = e), h = n.options.findIndex(e), t[2] = n.options, t[3] = a, t[4] = h;
|
|
749
749
|
} else h = t[4];
|
|
750
|
-
let g = h, _ = o ?
|
|
750
|
+
let g = h, _ = o ? Ft : g === -1 ? null : String(g), v = !s, y = s ? void 0 : "true", b;
|
|
751
751
|
t[7] !== s || t[8] !== c || t[9] !== l || t[10] !== n || t[11] !== r ? (b = s ? (e) => {
|
|
752
752
|
e.value && (e.value === "__pstdio_other__" ? l?.(n, r) : c?.(n, r, n.options[Number(e.value)].label));
|
|
753
753
|
} : void 0, t[7] = s, t[8] = c, t[9] = l, t[10] = n, t[11] = r, t[12] = b) : b = t[12];
|
|
@@ -758,15 +758,15 @@ var Ct = ue({
|
|
|
758
758
|
value: String(t),
|
|
759
759
|
inputProps: s ? void 0 : { tabIndex: -1 },
|
|
760
760
|
alignItems: "flex-start",
|
|
761
|
-
children: /* @__PURE__ */ J(
|
|
761
|
+
children: /* @__PURE__ */ J(En, { option: e })
|
|
762
762
|
}, e.label), t[16] = s, t[17] = e), x = n.options.map(e), t[13] = s, t[14] = n.options, t[15] = x;
|
|
763
763
|
} else x = t[15];
|
|
764
764
|
let S;
|
|
765
765
|
t[18] !== s || t[19] !== m ? (S = m ? /* @__PURE__ */ J(d, {
|
|
766
|
-
value:
|
|
766
|
+
value: Ft,
|
|
767
767
|
inputProps: s ? void 0 : { tabIndex: -1 },
|
|
768
768
|
alignItems: "flex-start",
|
|
769
|
-
children: /* @__PURE__ */ J(
|
|
769
|
+
children: /* @__PURE__ */ J(En, { option: { label: Pt } })
|
|
770
770
|
}) : null, t[18] = s, t[19] = m, t[20] = S) : S = t[20];
|
|
771
771
|
let C = o ? f : null, w;
|
|
772
772
|
return t[21] !== i || t[22] !== _ || t[23] !== v || t[24] !== y || t[25] !== b || t[26] !== x || t[27] !== S || t[28] !== C ? (w = /* @__PURE__ */ Y(u, {
|
|
@@ -784,9 +784,9 @@ var Ct = ue({
|
|
|
784
784
|
C
|
|
785
785
|
]
|
|
786
786
|
}), t[21] = i, t[22] = _, t[23] = v, t[24] = y, t[25] = b, t[26] = x, t[27] = S, t[28] = C, t[29] = w) : w = t[29], w;
|
|
787
|
-
},
|
|
787
|
+
}, kn = (e) => {
|
|
788
788
|
let t = q(4), { items: n } = e, r;
|
|
789
|
-
t[0] === n ? r = t[1] : (r = n.map(
|
|
789
|
+
t[0] === n ? r = t[1] : (r = n.map(Pn), t[0] = n, t[1] = r);
|
|
790
790
|
let i;
|
|
791
791
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(W, {
|
|
792
792
|
as: "ul",
|
|
@@ -796,11 +796,11 @@ var Ct = ue({
|
|
|
796
796
|
padding: "0",
|
|
797
797
|
children: r
|
|
798
798
|
}), t[2] = r, t[3] = i), i;
|
|
799
|
-
},
|
|
800
|
-
let t = q(12), { question: n, questionIndex: r, editable: i, customAnswer: a, onCustomAnswerChange: o, hasOtherChoice: s } = e, c = s ? "Type your answer..." : "Answer...", l = !i, u = i ? void 0 : "true", d = a ?? "", f = i ? c : "Answer", p = s ? `${n.question} (${
|
|
799
|
+
}, An = (e) => {
|
|
800
|
+
let t = q(12), { question: n, questionIndex: r, editable: i, customAnswer: a, onCustomAnswerChange: o, hasOtherChoice: s } = e, c = s ? "Type your answer..." : "Answer...", l = !i, u = i ? void 0 : "true", d = a ?? "", f = i ? c : "Answer", p = s ? `${n.question} (${Pt})` : n.question, m = i ? "vertical" : "none", h;
|
|
801
801
|
t[0] !== o || t[1] !== n || t[2] !== r ? (h = (e) => o?.(n, r, e.currentTarget.value), t[0] = o, t[1] = n, t[2] = r, t[3] = h) : h = t[3];
|
|
802
802
|
let g;
|
|
803
|
-
return t[4] !== l || t[5] !== u || t[6] !== d || t[7] !== f || t[8] !== p || t[9] !== m || t[10] !== h ? (g = /* @__PURE__ */ J(
|
|
803
|
+
return t[4] !== l || t[5] !== u || t[6] !== d || t[7] !== f || t[8] !== p || t[9] !== m || t[10] !== h ? (g = /* @__PURE__ */ J(se, {
|
|
804
804
|
readOnly: l,
|
|
805
805
|
"aria-readonly": u,
|
|
806
806
|
value: d,
|
|
@@ -815,11 +815,11 @@ var Ct = ue({
|
|
|
815
815
|
color: "fg",
|
|
816
816
|
onChange: h
|
|
817
817
|
}), t[4] = l, t[5] = u, t[6] = d, t[7] = f, t[8] = p, t[9] = m, t[10] = h, t[11] = g) : g = t[11], g;
|
|
818
|
-
},
|
|
818
|
+
}, jn = (e) => {
|
|
819
819
|
let t = q(21), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, { name: l, otherField: u } = e, d;
|
|
820
|
-
t[0] === n ? d = t[1] : (d =
|
|
820
|
+
t[0] === n ? d = t[1] : (d = Lt(n), t[0] = n, t[1] = d);
|
|
821
821
|
let f = d, p = o !== void 0, m;
|
|
822
|
-
t[2] !== i || t[3] !== l || t[4] !== s || t[5] !== n || t[6] !== r || t[7] !== a ? (m = n.options.map((e) => /* @__PURE__ */ J(
|
|
822
|
+
t[2] !== i || t[3] !== l || t[4] !== s || t[5] !== n || t[6] !== r || t[7] !== a ? (m = n.options.map((e) => /* @__PURE__ */ J(Dn, {
|
|
823
823
|
option: e,
|
|
824
824
|
name: l,
|
|
825
825
|
checked: a.includes(e.label),
|
|
@@ -827,24 +827,24 @@ var Ct = ue({
|
|
|
827
827
|
onToggle: () => s?.(n, r, e.label)
|
|
828
828
|
}, e.label)), t[2] = i, t[3] = l, t[4] = s, t[5] = n, t[6] = r, t[7] = a, t[8] = m) : m = t[8];
|
|
829
829
|
let h;
|
|
830
|
-
t[9] !== i || t[10] !== f || t[11] !== l || t[12] !== c || t[13] !== p || t[14] !== n || t[15] !== r ? (h = f ? /* @__PURE__ */ J(
|
|
831
|
-
option: { label:
|
|
830
|
+
t[9] !== i || t[10] !== f || t[11] !== l || t[12] !== c || t[13] !== p || t[14] !== n || t[15] !== r ? (h = f ? /* @__PURE__ */ J(Dn, {
|
|
831
|
+
option: { label: Pt },
|
|
832
832
|
name: l,
|
|
833
833
|
checked: p,
|
|
834
834
|
editable: i,
|
|
835
835
|
onToggle: () => c?.(n, r)
|
|
836
836
|
}) : null, t[9] = i, t[10] = f, t[11] = l, t[12] = c, t[13] = p, t[14] = n, t[15] = r, t[16] = h) : h = t[16];
|
|
837
837
|
let g = p ? u : null, _;
|
|
838
|
-
return t[17] !== m || t[18] !== h || t[19] !== g ? (_ = /* @__PURE__ */ Y(
|
|
838
|
+
return t[17] !== m || t[18] !== h || t[19] !== g ? (_ = /* @__PURE__ */ Y(me, { children: [
|
|
839
839
|
m,
|
|
840
840
|
h,
|
|
841
841
|
g
|
|
842
842
|
] }), t[17] = m, t[18] = h, t[19] = g, t[20] = _) : _ = t[20], _;
|
|
843
|
-
},
|
|
843
|
+
}, Mn = (e) => {
|
|
844
844
|
let t = q(30), { question: n, questionIndex: r, editable: i, selectedOptions: a, customAnswer: o, onToggleOption: s, onToggleOther: c } = e, l = n.id ?? `question-${r}`, u;
|
|
845
|
-
t[0] === n ? u = t[1] : (u =
|
|
845
|
+
t[0] === n ? u = t[1] : (u = Lt(n), t[0] = n, t[1] = u);
|
|
846
846
|
let d = u, f;
|
|
847
|
-
t[2] !== d || t[3] !== e || t[4] !== n.allowCustomAnswer ? (f = n.allowCustomAnswer ? /* @__PURE__ */ J(
|
|
847
|
+
t[2] !== d || t[3] !== e || t[4] !== n.allowCustomAnswer ? (f = n.allowCustomAnswer ? /* @__PURE__ */ J(An, {
|
|
848
848
|
...e,
|
|
849
849
|
hasOtherChoice: d
|
|
850
850
|
}) : null, t[2] = d, t[3] = e, t[4] = n.allowCustomAnswer, t[5] = f) : f = t[5];
|
|
@@ -857,13 +857,13 @@ var Ct = ue({
|
|
|
857
857
|
children: n.question
|
|
858
858
|
}), t[6] = n.question, t[7] = h);
|
|
859
859
|
let g;
|
|
860
|
-
t[8] !== m || t[9] !== l || t[10] !== p || t[11] !== e || t[12] !== n.multiple ? (g = m && n.multiple ? /* @__PURE__ */ J(
|
|
860
|
+
t[8] !== m || t[9] !== l || t[10] !== p || t[11] !== e || t[12] !== n.multiple ? (g = m && n.multiple ? /* @__PURE__ */ J(jn, {
|
|
861
861
|
...e,
|
|
862
862
|
name: l,
|
|
863
863
|
otherField: p
|
|
864
864
|
}) : null, t[8] = m, t[9] = l, t[10] = p, t[11] = e, t[12] = n.multiple, t[13] = g) : g = t[13];
|
|
865
865
|
let _;
|
|
866
|
-
t[14] !== o || t[15] !== i || t[16] !== m || t[17] !== l || t[18] !== s || t[19] !== c || t[20] !== p || t[21] !== n || t[22] !== r || t[23] !== a ? (_ = m && !n.multiple ? /* @__PURE__ */ J(
|
|
866
|
+
t[14] !== o || t[15] !== i || t[16] !== m || t[17] !== l || t[18] !== s || t[19] !== c || t[20] !== p || t[21] !== n || t[22] !== r || t[23] !== a ? (_ = m && !n.multiple ? /* @__PURE__ */ J(On, {
|
|
867
867
|
question: n,
|
|
868
868
|
questionIndex: r,
|
|
869
869
|
name: l,
|
|
@@ -890,7 +890,7 @@ var Ct = ue({
|
|
|
890
890
|
v
|
|
891
891
|
]
|
|
892
892
|
}), t[25] = h, t[26] = g, t[27] = _, t[28] = v, t[29] = y) : y = t[29], y;
|
|
893
|
-
},
|
|
893
|
+
}, Nn = (e) => {
|
|
894
894
|
let t = q(21), { questions: n, editable: r, selectedOptionsByQuestion: i, customAnswersByQuestion: a, onToggleOption: o, onToggleOther: s, onCustomAnswerChange: c } = e, l = r !== void 0 && r, u;
|
|
895
895
|
t[0] === i ? u = t[1] : (u = i === void 0 ? {} : i, t[0] = i, t[1] = u);
|
|
896
896
|
let d = u, f;
|
|
@@ -900,12 +900,12 @@ var Ct = ue({
|
|
|
900
900
|
let e;
|
|
901
901
|
t[12] !== p || t[13] !== l || t[14] !== c || t[15] !== o || t[16] !== s || t[17] !== d ? (e = (e, t) => {
|
|
902
902
|
let n = e.id ?? `question-${t}`;
|
|
903
|
-
return /* @__PURE__ */ J(
|
|
903
|
+
return /* @__PURE__ */ J(Mn, {
|
|
904
904
|
question: e,
|
|
905
905
|
questionIndex: t,
|
|
906
906
|
editable: l,
|
|
907
|
-
selectedOptions:
|
|
908
|
-
customAnswer:
|
|
907
|
+
selectedOptions: It(d, n) ?? [],
|
|
908
|
+
customAnswer: It(p, n),
|
|
909
909
|
onToggleOption: o,
|
|
910
910
|
onToggleOther: s,
|
|
911
911
|
onCustomAnswerChange: c
|
|
@@ -916,13 +916,13 @@ var Ct = ue({
|
|
|
916
916
|
return t[19] === m ? h = t[20] : (h = /* @__PURE__ */ J(W, {
|
|
917
917
|
as: "form",
|
|
918
918
|
gap: "sm",
|
|
919
|
-
onSubmit:
|
|
919
|
+
onSubmit: Tn,
|
|
920
920
|
"aria-label": "Question form",
|
|
921
921
|
children: m
|
|
922
922
|
}), t[19] = m, t[20] = h), h;
|
|
923
923
|
};
|
|
924
|
-
function
|
|
925
|
-
return /* @__PURE__ */ J(
|
|
924
|
+
function Pn(e, t) {
|
|
925
|
+
return /* @__PURE__ */ J(j, {
|
|
926
926
|
as: "li",
|
|
927
927
|
children: /* @__PURE__ */ J(o, {
|
|
928
928
|
checked: e.checked,
|
|
@@ -940,15 +940,15 @@ function Nn(e, t) {
|
|
|
940
940
|
}
|
|
941
941
|
//#endregion
|
|
942
942
|
//#region src/components/chat-ui/components/chat-input-question-prompt.tsx
|
|
943
|
-
var
|
|
944
|
-
id:
|
|
943
|
+
var Fn = (e) => e.questions.map((e, t) => ({
|
|
944
|
+
id: Rt(e, t),
|
|
945
945
|
question: e.question,
|
|
946
946
|
options: e.options,
|
|
947
947
|
multiple: !!e.multiple,
|
|
948
948
|
required: !!e.required,
|
|
949
949
|
allowCustomAnswer: !!e.allowCustomAnswer
|
|
950
|
-
})),
|
|
951
|
-
let t = q(49), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { onToggleOther: s } = e, { questions: c, isEditable: l } = e, [u, d] = Q(0), f = Z(null), p =
|
|
950
|
+
})), In = (e) => {
|
|
951
|
+
let t = q(49), { questionPrompt: n, selectedOptionsByQuestion: r, customAnswersByQuestion: i, onToggleOption: a, onCustomAnswerChange: o } = e, { onToggleOther: s } = e, { questions: c, isEditable: l } = e, [u, d] = Q(0), f = Z(null), p = Cn(), m = p?.selection, h = m?.revision, g, _;
|
|
952
952
|
t[0] === h ? (g = t[1], _ = t[2]) : (g = () => {
|
|
953
953
|
h !== void 0 && f.current?.focus();
|
|
954
954
|
}, _ = [h], t[0] = h, t[1] = g, t[2] = _), X(g, _);
|
|
@@ -957,12 +957,12 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
957
957
|
m ? p?.selectStep(e) : d(e);
|
|
958
958
|
}, t[3] = p, t[4] = m, t[5] = v) : v = t[5];
|
|
959
959
|
let y = v, b = Math.min(m?.index ?? u, c.length - 1), x = c[b], S = c.length > 1, C = S ? "0" : "xs", w;
|
|
960
|
-
t[6] !== i || t[7] !== S || t[8] !== c || t[9] !== b || t[10] !== y || t[11] !== r ? (w = S ? /* @__PURE__ */ J(
|
|
960
|
+
t[6] !== i || t[7] !== S || t[8] !== c || t[9] !== b || t[10] !== y || t[11] !== r ? (w = S ? /* @__PURE__ */ J(L, {
|
|
961
961
|
role: "tablist",
|
|
962
962
|
"aria-label": "Question steps",
|
|
963
963
|
gap: "1",
|
|
964
964
|
minWidth: "0",
|
|
965
|
-
children: c.map((e, t) => /* @__PURE__ */ J(
|
|
965
|
+
children: c.map((e, t) => /* @__PURE__ */ J(nn, {
|
|
966
966
|
question: e,
|
|
967
967
|
questionIndex: t,
|
|
968
968
|
isActive: t === b,
|
|
@@ -975,7 +975,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
975
975
|
t[13] === x ? O = t[14] : (O = [x], t[13] = x, t[14] = O);
|
|
976
976
|
let k;
|
|
977
977
|
t[15] !== x.id || t[16] !== i || t[17] !== a || t[18] !== n.questions || t[19] !== c.length || t[20] !== b || t[21] !== y || t[22] !== r ? (k = (e, t, o) => {
|
|
978
|
-
let s = n.questions[b], l = (
|
|
978
|
+
let s = n.questions[b], l = (It(r, x.id) ?? []).length > 0 || zt(i, s, b);
|
|
979
979
|
a(s, b, o), !s.multiple && !l && b < c.length - 1 && (f.current?.focus(), y(b + 1));
|
|
980
980
|
}, t[15] = x.id, t[16] = i, t[17] = a, t[18] = n.questions, t[19] = c.length, t[20] = b, t[21] = y, t[22] = r, t[23] = k) : k = t[23];
|
|
981
981
|
let A;
|
|
@@ -987,7 +987,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
987
987
|
o(n.questions[b], b, r);
|
|
988
988
|
}, t[28] = o, t[29] = n.questions, t[30] = b, t[31] = j) : j = t[31];
|
|
989
989
|
let M;
|
|
990
|
-
t[32] !== i || t[33] !== l || t[34] !== r || t[35] !== A || t[36] !== j || t[37] !== O || t[38] !== k ? (M = /* @__PURE__ */ J(
|
|
990
|
+
t[32] !== i || t[33] !== l || t[34] !== r || t[35] !== A || t[36] !== j || t[37] !== O || t[38] !== k ? (M = /* @__PURE__ */ J(Nn, {
|
|
991
991
|
questions: O,
|
|
992
992
|
editable: l,
|
|
993
993
|
selectedOptionsByQuestion: r,
|
|
@@ -1013,21 +1013,21 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1013
1013
|
pt: C,
|
|
1014
1014
|
children: [w, N]
|
|
1015
1015
|
}), t[45] = N, t[46] = C, t[47] = w, t[48] = P) : P = t[48], P;
|
|
1016
|
-
},
|
|
1016
|
+
}, Ln = (e) => {
|
|
1017
1017
|
let t = q(8), { questionPrompt: n } = e, r;
|
|
1018
|
-
t[0] === n ? r = t[1] : (r =
|
|
1018
|
+
t[0] === n ? r = t[1] : (r = Fn(n), t[0] = n, t[1] = r);
|
|
1019
1019
|
let i = r, a;
|
|
1020
|
-
t[2] === n ? a = t[3] : (a =
|
|
1020
|
+
t[2] === n ? a = t[3] : (a = Kt(n), t[2] = n, t[3] = a);
|
|
1021
1021
|
let o = a, s;
|
|
1022
|
-
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ J(
|
|
1022
|
+
return t[4] !== e || t[5] !== o || t[6] !== i ? (s = /* @__PURE__ */ J(In, {
|
|
1023
1023
|
...e,
|
|
1024
1024
|
questions: i
|
|
1025
1025
|
}, o), t[4] = e, t[5] = o, t[6] = i, t[7] = s) : s = t[7], s;
|
|
1026
|
-
},
|
|
1027
|
-
let [n, r] = Q(() =>
|
|
1026
|
+
}, Rn = (e) => Object.fromEntries((e?.questions ?? []).flatMap((t, n) => e?.delivery === "async" && t.options.length ? [[Rt(t, n), [t.options[0].label]]] : [])), zn = (e, t) => {
|
|
1027
|
+
let [n, r] = Q(() => Rn(e)), [i, a] = Q({}), o = Kt(e), s = Z(JSON.stringify([o, t ?? null]));
|
|
1028
1028
|
return X(() => {
|
|
1029
1029
|
let n = JSON.stringify([o, t ?? null]);
|
|
1030
|
-
s.current !== n && (s.current = n, r(
|
|
1030
|
+
s.current !== n && (s.current = n, r(Rn(e)), a({}));
|
|
1031
1031
|
}, [
|
|
1032
1032
|
o,
|
|
1033
1033
|
t,
|
|
@@ -1037,33 +1037,33 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1037
1037
|
selectedOptionsByQuestion: n,
|
|
1038
1038
|
customAnswersByQuestion: i,
|
|
1039
1039
|
reset: () => {
|
|
1040
|
-
r(
|
|
1040
|
+
r(Rn(e)), a({});
|
|
1041
1041
|
},
|
|
1042
1042
|
restore: (e, t) => {
|
|
1043
1043
|
r(e), a(t);
|
|
1044
1044
|
},
|
|
1045
1045
|
toggleOption: (e, t, n) => {
|
|
1046
|
-
r((r) =>
|
|
1046
|
+
r((r) => Gt(r, e, t, n)), e.multiple || a((n) => Bt(n, e, t));
|
|
1047
1047
|
},
|
|
1048
1048
|
toggleOther: (e, t) => {
|
|
1049
|
-
a((n) =>
|
|
1049
|
+
a((n) => Vt(n, e, t)), e.multiple || r((n) => ({
|
|
1050
1050
|
...n,
|
|
1051
|
-
[
|
|
1051
|
+
[Rt(e, t)]: []
|
|
1052
1052
|
}));
|
|
1053
1053
|
},
|
|
1054
1054
|
setCustomAnswer: (e, t, n) => {
|
|
1055
|
-
let r =
|
|
1055
|
+
let r = Rt(e, t);
|
|
1056
1056
|
a((e) => ({
|
|
1057
1057
|
...e,
|
|
1058
1058
|
[r]: n
|
|
1059
1059
|
}));
|
|
1060
1060
|
},
|
|
1061
|
-
responseText: e ?
|
|
1062
|
-
hasMissingRequiredAnswer:
|
|
1063
|
-
buildAnswers: () => e ?
|
|
1061
|
+
responseText: e ? Qt(e, n, i) : "",
|
|
1062
|
+
hasMissingRequiredAnswer: en(e, n, i),
|
|
1063
|
+
buildAnswers: () => e ? $t(e, n, i) : []
|
|
1064
1064
|
};
|
|
1065
|
-
},
|
|
1066
|
-
let t = q(33), { prompt: n, actions: r, disabled: i, onSubmit: a } = e, o =
|
|
1065
|
+
}, Bn = (e) => {
|
|
1066
|
+
let t = q(33), { prompt: n, actions: r, disabled: i, onSubmit: a } = e, o = zn(n), s = Cn(), [c, l] = Q(!1), u = Z(!1), d;
|
|
1067
1067
|
t[0] !== i || t[1] !== a || t[2] !== n || t[3] !== o ? (d = async (e) => {
|
|
1068
1068
|
let t = e !== void 0 && e;
|
|
1069
1069
|
if (u.current || i || !t && o.hasMissingRequiredAnswer) return;
|
|
@@ -1071,7 +1071,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1071
1071
|
let r = {
|
|
1072
1072
|
selectedOptions: o.selectedOptionsByQuestion,
|
|
1073
1073
|
customAnswers: o.customAnswersByQuestion
|
|
1074
|
-
}, s = t ?
|
|
1074
|
+
}, s = t ? Ht : o.responseText, c = t ? Wt(n) : Ut(n, o.buildAnswers());
|
|
1075
1075
|
o.reset();
|
|
1076
1076
|
try {
|
|
1077
1077
|
await a(s, c);
|
|
@@ -1080,7 +1080,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1080
1080
|
}
|
|
1081
1081
|
}, t[0] = i, t[1] = a, t[2] = n, t[3] = o, t[4] = d) : d = t[4];
|
|
1082
1082
|
let f = d, p = !i && !c, m;
|
|
1083
|
-
t[5] !== n || t[6] !== o.customAnswersByQuestion || t[7] !== o.selectedOptionsByQuestion || t[8] !== o.setCustomAnswer || t[9] !== o.toggleOption || t[10] !== o.toggleOther || t[11] !== p ? (m = /* @__PURE__ */ J(
|
|
1083
|
+
t[5] !== n || t[6] !== o.customAnswersByQuestion || t[7] !== o.selectedOptionsByQuestion || t[8] !== o.setCustomAnswer || t[9] !== o.toggleOption || t[10] !== o.toggleOther || t[11] !== p ? (m = /* @__PURE__ */ J(Ln, {
|
|
1084
1084
|
isEditable: p,
|
|
1085
1085
|
questionPrompt: n,
|
|
1086
1086
|
selectedOptionsByQuestion: o.selectedOptionsByQuestion,
|
|
@@ -1090,7 +1090,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1090
1090
|
onCustomAnswerChange: o.setCustomAnswer
|
|
1091
1091
|
}), t[5] = n, t[6] = o.customAnswersByQuestion, t[7] = o.selectedOptionsByQuestion, t[8] = o.setCustomAnswer, t[9] = o.toggleOption, t[10] = o.toggleOther, t[11] = p, t[12] = m) : m = t[12];
|
|
1092
1092
|
let h;
|
|
1093
|
-
t[13] !== s || t[14] !== n.delivery || t[15] !== c ? (h = n.delivery === "async" && s ? /* @__PURE__ */ J(
|
|
1093
|
+
t[13] !== s || t[14] !== n.delivery || t[15] !== c ? (h = n.delivery === "async" && s ? /* @__PURE__ */ J(M, {
|
|
1094
1094
|
size: "xs",
|
|
1095
1095
|
variant: "ghost",
|
|
1096
1096
|
disabled: c,
|
|
@@ -1098,7 +1098,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1098
1098
|
children: "Back to message"
|
|
1099
1099
|
}) : null, t[13] = s, t[14] = n.delivery, t[15] = c, t[16] = h) : h = t[16];
|
|
1100
1100
|
let g;
|
|
1101
|
-
t[17] !== r || t[18] !== h ? (g = /* @__PURE__ */ Y(
|
|
1101
|
+
t[17] !== r || t[18] !== h ? (g = /* @__PURE__ */ Y(me, { children: [h, r] }), t[17] = r, t[18] = h, t[19] = g) : g = t[19];
|
|
1102
1102
|
let _ = i || c, v;
|
|
1103
1103
|
t[20] === f ? v = t[21] : (v = () => void f(!0), t[20] = f, t[21] = v);
|
|
1104
1104
|
let y = i || c || o.hasMissingRequiredAnswer || !o.responseText ? "none" : "submit", b;
|
|
@@ -1106,7 +1106,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1106
1106
|
e === "submit" && f();
|
|
1107
1107
|
}, t[22] = f, t[23] = b);
|
|
1108
1108
|
let x;
|
|
1109
|
-
t[24] !== g || t[25] !== _ || t[26] !== v || t[27] !== y || t[28] !== b ? (x = /* @__PURE__ */ J(
|
|
1109
|
+
t[24] !== g || t[25] !== _ || t[26] !== v || t[27] !== y || t[28] !== b ? (x = /* @__PURE__ */ J(Mt, {
|
|
1110
1110
|
actions: g,
|
|
1111
1111
|
questionPrompt: !0,
|
|
1112
1112
|
skipDisabled: _,
|
|
@@ -1117,8 +1117,8 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1117
1117
|
runAction: b
|
|
1118
1118
|
}), t[24] = g, t[25] = _, t[26] = v, t[27] = y, t[28] = b, t[29] = x) : x = t[29];
|
|
1119
1119
|
let S;
|
|
1120
|
-
return t[30] !== m || t[31] !== x ? (S = /* @__PURE__ */ Y(
|
|
1121
|
-
},
|
|
1120
|
+
return t[30] !== m || t[31] !== x ? (S = /* @__PURE__ */ Y(me, { children: [m, x] }), t[30] = m, t[31] = x, t[32] = S) : S = t[32], S;
|
|
1121
|
+
}, Vn = (e) => {
|
|
1122
1122
|
let { decision: t, disabled: n } = e, [r, i] = Q(!1), a = Z(!1), o = async (e) => {
|
|
1123
1123
|
let r = t.actions.find((t) => t.id === e);
|
|
1124
1124
|
if (!(a.current || n || t.pending || !r || r.disabled)) {
|
|
@@ -1130,7 +1130,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1130
1130
|
}
|
|
1131
1131
|
}
|
|
1132
1132
|
};
|
|
1133
|
-
return /* @__PURE__ */ Y(
|
|
1133
|
+
return /* @__PURE__ */ Y(I, {
|
|
1134
1134
|
"aria-label": "Plan decision",
|
|
1135
1135
|
align: "center",
|
|
1136
1136
|
justify: "space-between",
|
|
@@ -1145,12 +1145,12 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1145
1145
|
alignItems: "center",
|
|
1146
1146
|
children: t.model
|
|
1147
1147
|
}) : null,
|
|
1148
|
-
/* @__PURE__ */ J(
|
|
1148
|
+
/* @__PURE__ */ J(L, {
|
|
1149
1149
|
gap: "xs",
|
|
1150
1150
|
marginStart: "auto",
|
|
1151
1151
|
wrap: "wrap",
|
|
1152
1152
|
justify: "end",
|
|
1153
|
-
children: t.actions.map((e) => /* @__PURE__ */ J(
|
|
1153
|
+
children: t.actions.map((e) => /* @__PURE__ */ J(M, {
|
|
1154
1154
|
size: "xs",
|
|
1155
1155
|
variant: e.variant,
|
|
1156
1156
|
disabled: n || r || t.pending || e.disabled,
|
|
@@ -1160,28 +1160,28 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1160
1160
|
})
|
|
1161
1161
|
]
|
|
1162
1162
|
});
|
|
1163
|
-
},
|
|
1164
|
-
let t = q(11), { request: n, question: r, decision: i, actions: a, disabled: o,
|
|
1163
|
+
}, Hn = (e) => {
|
|
1164
|
+
let t = q(11), { request: n, question: r, decision: i, actions: a, disabled: o, onSubmit: s } = e;
|
|
1165
1165
|
if (n?.kind === "decision" && i) {
|
|
1166
1166
|
let e;
|
|
1167
|
-
return t[0] !== i || t[1] !== o ? (e = /* @__PURE__ */ J(
|
|
1167
|
+
return t[0] !== i || t[1] !== o ? (e = /* @__PURE__ */ J(Vn, {
|
|
1168
1168
|
decision: i,
|
|
1169
1169
|
disabled: o
|
|
1170
1170
|
}, i.id), t[0] = i, t[1] = o, t[2] = e) : e = t[2], e;
|
|
1171
1171
|
}
|
|
1172
1172
|
if (n?.kind === "question" && r) {
|
|
1173
1173
|
let e;
|
|
1174
|
-
t[3] === r ? e = t[4] : (e =
|
|
1175
|
-
let n
|
|
1176
|
-
return t[5] !== a || t[6] !==
|
|
1174
|
+
t[3] === r ? e = t[4] : (e = Kt(r), t[3] = r, t[4] = e);
|
|
1175
|
+
let n;
|
|
1176
|
+
return t[5] !== a || t[6] !== o || t[7] !== s || t[8] !== r || t[9] !== e ? (n = /* @__PURE__ */ J(Bn, {
|
|
1177
1177
|
prompt: r,
|
|
1178
1178
|
actions: a,
|
|
1179
|
-
disabled:
|
|
1180
|
-
onSubmit:
|
|
1181
|
-
}, e), t[5] = a, t[6] =
|
|
1179
|
+
disabled: o,
|
|
1180
|
+
onSubmit: s
|
|
1181
|
+
}, e), t[5] = a, t[6] = o, t[7] = s, t[8] = r, t[9] = e, t[10] = n) : n = t[10], n;
|
|
1182
1182
|
}
|
|
1183
1183
|
return null;
|
|
1184
|
-
},
|
|
1184
|
+
}, Un = (e, t) => {
|
|
1185
1185
|
let n = q(7), [r, i] = Q(e || t !== 0), a;
|
|
1186
1186
|
n[0] !== e || n[1] !== t ? (a = {
|
|
1187
1187
|
autoFocus: e,
|
|
@@ -1200,7 +1200,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1200
1200
|
request: c,
|
|
1201
1201
|
complete: l
|
|
1202
1202
|
}, n[5] = r, n[6] = u), u;
|
|
1203
|
-
},
|
|
1203
|
+
}, Wn = (e) => {
|
|
1204
1204
|
let t = [];
|
|
1205
1205
|
for (let n = e.length - 1; n >= 0 && t.length < 10; n--) {
|
|
1206
1206
|
let r = e[n];
|
|
@@ -1209,7 +1209,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1209
1209
|
i.trim() && t.push(i);
|
|
1210
1210
|
}
|
|
1211
1211
|
return t;
|
|
1212
|
-
},
|
|
1212
|
+
}, Gn = (e, t, n, r) => r === 0 ? null : e === null ? t === "previous" && n === "" ? { index: 0 } : null : t === "previous" ? { index: Math.min(e + 1, r - 1) } : { index: e === 0 ? null : e - 1 }, Kn = (e) => {
|
|
1213
1213
|
let t = q(24), { recentUserMessages: n, text: r, blocked: i, resetKey: a, onChange: o } = e, s = Z(null), c = Z(null), l, u;
|
|
1214
1214
|
if (t[0] !== i || t[1] !== n || t[2] !== a) {
|
|
1215
1215
|
l = n.slice(0, 10);
|
|
@@ -1235,7 +1235,7 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1235
1235
|
let v = _, y;
|
|
1236
1236
|
t[12] !== i || t[13] !== o || t[14] !== l || t[15] !== r ? (y = (e) => {
|
|
1237
1237
|
if (i) return !1;
|
|
1238
|
-
let t =
|
|
1238
|
+
let t = Gn(c.current, e, r, l.length);
|
|
1239
1239
|
if (!t) return !1;
|
|
1240
1240
|
c.current = t.index;
|
|
1241
1241
|
let n = t.index === null ? "" : l[t.index];
|
|
@@ -1251,18 +1251,18 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1251
1251
|
recallPrevious: x,
|
|
1252
1252
|
recallNext: S
|
|
1253
1253
|
}, t[20] = v, t[21] = x, t[22] = S, t[23] = C) : C = t[23], C;
|
|
1254
|
-
},
|
|
1254
|
+
}, qn = (e) => {
|
|
1255
1255
|
let t = q(7), [n, r] = Q(e), [i, a] = Q(e), [o, s] = Q(0), c;
|
|
1256
|
-
t[0] === e ? c = t[1] : (c = () =>
|
|
1256
|
+
t[0] === e ? c = t[1] : (c = () => T(e), t[0] = e, t[1] = c);
|
|
1257
1257
|
let [l, u] = Q(c), d;
|
|
1258
1258
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (d = (e) => {
|
|
1259
|
-
a(e), s(
|
|
1259
|
+
a(e), s(Jn);
|
|
1260
1260
|
}, t[2] = d) : d = t[2];
|
|
1261
1261
|
let f = d;
|
|
1262
1262
|
if (n !== e) {
|
|
1263
1263
|
r(e);
|
|
1264
|
-
let t =
|
|
1265
|
-
t !==
|
|
1264
|
+
let t = T(e);
|
|
1265
|
+
t !== T(i) && (f(e), u(t));
|
|
1266
1266
|
}
|
|
1267
1267
|
let p;
|
|
1268
1268
|
return t[3] !== o || t[4] !== i || t[5] !== l ? (p = {
|
|
@@ -1274,24 +1274,24 @@ var Pn = (e) => e.questions.map((e, t) => ({
|
|
|
1274
1274
|
text: l
|
|
1275
1275
|
}, t[3] = o, t[4] = i, t[5] = l, t[6] = p) : p = t[6], p;
|
|
1276
1276
|
};
|
|
1277
|
-
function
|
|
1277
|
+
function Jn(e) {
|
|
1278
1278
|
return e + 1;
|
|
1279
1279
|
}
|
|
1280
1280
|
//#endregion
|
|
1281
1281
|
//#region src/components/chat-ui/components/composer-request.ts
|
|
1282
|
-
var
|
|
1282
|
+
var Yn = (e, t, n) => {
|
|
1283
1283
|
let r = [];
|
|
1284
1284
|
return e && r.push({
|
|
1285
1285
|
kind: "question",
|
|
1286
|
-
id: e.callId ??
|
|
1286
|
+
id: e.callId ?? Kt(e)
|
|
1287
1287
|
}), t && r.push({
|
|
1288
1288
|
kind: "decision",
|
|
1289
1289
|
id: t.id
|
|
1290
1290
|
}), r.find((e) => e.kind === n?.kind && e.id === n.id) ?? r[0];
|
|
1291
|
-
},
|
|
1292
|
-
let [n, r] = Q(), i =
|
|
1291
|
+
}, Xn = (e, t) => {
|
|
1292
|
+
let [n, r] = Q(), i = Yn(e, t, n);
|
|
1293
1293
|
return (i?.kind !== n?.kind || i?.id !== n?.id) && r(i), i;
|
|
1294
|
-
},
|
|
1294
|
+
}, Zn = (e) => {
|
|
1295
1295
|
let t = q(2), { placeholder: n } = e;
|
|
1296
1296
|
if (!n) return null;
|
|
1297
1297
|
let r;
|
|
@@ -1303,70 +1303,69 @@ var Jn = (e, t, n) => {
|
|
|
1303
1303
|
top: "0",
|
|
1304
1304
|
children: n
|
|
1305
1305
|
}), t[0] = n, t[1] = r), r;
|
|
1306
|
-
},
|
|
1307
|
-
let { defaultState: t, recentUserMessages: r = [], onSubmit: i = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: l = !1, attachedResources: u = [], onClearAttachments: d, isDisabled: f = !1, submitDisabled: p = !1, onChange: m, placeholder: h, attachmentList: g, actions: _, submitActions: v, attachmentActions: y, attachedToTop: b = !1, questionPrompt: x, decision: S, autoFocus: C = !1, focusSignal: w = 0, submitTitle: T, submitLabel:
|
|
1306
|
+
}, Qn = (e) => {
|
|
1307
|
+
let { defaultState: t, recentUserMessages: r = [], onSubmit: i = () => {}, onInterrupt: a, onAttachFiles: o, onAttachText: s, textAttachmentPasteLineThreshold: c = 200, streaming: l = !1, attachedResources: u = [], onClearAttachments: d, isDisabled: f = !1, submitDisabled: p = !1, onChange: m, placeholder: h, attachmentList: g, actions: _, submitActions: v, attachmentActions: y, attachedToTop: b = !1, questionPrompt: x, decision: S, autoFocus: C = !1, focusSignal: w = 0, submitTitle: T, submitLabel: E, initialSelection: O, onSelectionChange: k, onEditorStateChange: A, retainTextUntilAcknowledged: M = !1, commands: N = [] } = e, P = Xn(x, S), F = !!P, L = pe({ recipe: wt })({ attachedToTop: b }), [ee, R] = Q(!1), { editorKey: z, editorState: te, remountEditor: B, setEditorState: ne, setText: re, text: V } = qn(t), ie = Un(C, w), H = Kn({
|
|
1308
1308
|
recentUserMessages: r,
|
|
1309
|
-
text:
|
|
1310
|
-
blocked: f ||
|
|
1311
|
-
resetKey: String(
|
|
1309
|
+
text: V,
|
|
1310
|
+
blocked: f || ee || F,
|
|
1311
|
+
resetKey: String(z),
|
|
1312
1312
|
onChange: (e) => {
|
|
1313
|
-
|
|
1313
|
+
re(e), m?.(e);
|
|
1314
1314
|
}
|
|
1315
|
-
}),
|
|
1315
|
+
}), U = (e) => {
|
|
1316
1316
|
let t = e.target;
|
|
1317
|
-
t instanceof Element && e.currentTarget.contains(t) && (t.closest("button, input, textarea, select, a, label, [role=button], [role=combobox]") ||
|
|
1318
|
-
},
|
|
1319
|
-
|
|
1320
|
-
},
|
|
1321
|
-
canInterrupt: !
|
|
1322
|
-
canSubmit: !p && !
|
|
1323
|
-
hasQuestionPrompt:
|
|
1324
|
-
isDisabled: f ||
|
|
1317
|
+
t instanceof Element && e.currentTarget.contains(t) && (t.closest("button, input, textarea, select, a, label, [role=button], [role=combobox]") || F || ie.request());
|
|
1318
|
+
}, ae = (e) => {
|
|
1319
|
+
B(Tt(e)), H.change(e);
|
|
1320
|
+
}, W = !f && !ee && !p && !F, oe = {
|
|
1321
|
+
canInterrupt: !F && !!a,
|
|
1322
|
+
canSubmit: !p && !F,
|
|
1323
|
+
hasQuestionPrompt: F,
|
|
1324
|
+
isDisabled: f || ee,
|
|
1325
1325
|
streaming: l,
|
|
1326
|
-
text:
|
|
1327
|
-
},
|
|
1328
|
-
if (!
|
|
1329
|
-
let e =
|
|
1330
|
-
|
|
1326
|
+
text: V
|
|
1327
|
+
}, G = Ot(oe), se = l ? "Queue message" : "Send message", ce = async () => {
|
|
1328
|
+
if (!W || !V.trim()) return;
|
|
1329
|
+
let e = V;
|
|
1330
|
+
H.reset(), R(!0), M || ae("");
|
|
1331
1331
|
try {
|
|
1332
|
-
await
|
|
1333
|
-
text:
|
|
1332
|
+
await Nt({
|
|
1333
|
+
text: V.trim(),
|
|
1334
1334
|
attachments: u,
|
|
1335
1335
|
onSubmit: i,
|
|
1336
1336
|
onClearAttachments: d
|
|
1337
1337
|
});
|
|
1338
1338
|
} catch {
|
|
1339
|
-
M ||
|
|
1339
|
+
M || ae(e);
|
|
1340
1340
|
} finally {
|
|
1341
|
-
|
|
1341
|
+
R(!1), ie.request();
|
|
1342
1342
|
}
|
|
1343
|
-
},
|
|
1343
|
+
}, le = (e) => {
|
|
1344
1344
|
e === "interrupt" && a?.(), e === "submit" && ce();
|
|
1345
|
-
},
|
|
1345
|
+
}, K = At({
|
|
1346
1346
|
onAttachFiles: o,
|
|
1347
1347
|
onAttachText: s,
|
|
1348
1348
|
textAttachmentPasteLineThreshold: c
|
|
1349
1349
|
});
|
|
1350
|
-
return /* @__PURE__ */ J(
|
|
1350
|
+
return /* @__PURE__ */ J(j, {
|
|
1351
1351
|
className: "ps-chat-composer__input",
|
|
1352
1352
|
css: L.input,
|
|
1353
|
-
onPasteCapture:
|
|
1354
|
-
onDropCapture:
|
|
1355
|
-
onDragOver:
|
|
1356
|
-
onClick:
|
|
1357
|
-
children: /* @__PURE__ */ Y(
|
|
1353
|
+
onPasteCapture: F ? void 0 : K.onPasteCapture,
|
|
1354
|
+
onDropCapture: F ? void 0 : K.onDropCapture,
|
|
1355
|
+
onDragOver: F ? void 0 : K.onDragOver,
|
|
1356
|
+
onClick: U,
|
|
1357
|
+
children: /* @__PURE__ */ Y(I, {
|
|
1358
1358
|
direction: "column",
|
|
1359
1359
|
color: "fg",
|
|
1360
1360
|
gap: "xs",
|
|
1361
1361
|
children: [
|
|
1362
|
-
/* @__PURE__ */ J(
|
|
1362
|
+
/* @__PURE__ */ J(Hn, {
|
|
1363
1363
|
request: P,
|
|
1364
1364
|
question: x,
|
|
1365
1365
|
decision: S,
|
|
1366
1366
|
actions: _,
|
|
1367
1367
|
disabled: f,
|
|
1368
|
-
|
|
1369
|
-
onSubmit: (e, t) => Mt({
|
|
1368
|
+
onSubmit: (e, t) => Nt({
|
|
1370
1369
|
text: e,
|
|
1371
1370
|
response: t,
|
|
1372
1371
|
attachments: u,
|
|
@@ -1374,59 +1373,59 @@ var Jn = (e, t, n) => {
|
|
|
1374
1373
|
onClearAttachments: d
|
|
1375
1374
|
})
|
|
1376
1375
|
}),
|
|
1377
|
-
/* @__PURE__ */ Y(
|
|
1378
|
-
display:
|
|
1379
|
-
children: [g ? /* @__PURE__ */ J(
|
|
1376
|
+
/* @__PURE__ */ Y(j, {
|
|
1377
|
+
display: F ? "none" : void 0,
|
|
1378
|
+
children: [g ? /* @__PURE__ */ J(j, {
|
|
1380
1379
|
mb: "xs",
|
|
1381
1380
|
children: g
|
|
1382
1381
|
}) : null, /* @__PURE__ */ J(n, {
|
|
1383
1382
|
maxH: "10rem",
|
|
1384
1383
|
showHorizontalScrollbar: !1,
|
|
1385
1384
|
contentProps: { pr: "2xs" },
|
|
1386
|
-
children: /* @__PURE__ */ J(
|
|
1385
|
+
children: /* @__PURE__ */ J(I, {
|
|
1387
1386
|
minH: "7",
|
|
1388
1387
|
align: "center",
|
|
1389
|
-
children: /* @__PURE__ */ J(
|
|
1390
|
-
ref:
|
|
1391
|
-
onRecallPrevious:
|
|
1392
|
-
onRecallNext:
|
|
1393
|
-
defaultState:
|
|
1388
|
+
children: /* @__PURE__ */ J(D, {
|
|
1389
|
+
ref: H.editorRef,
|
|
1390
|
+
onRecallPrevious: H.recallPrevious,
|
|
1391
|
+
onRecallNext: H.recallNext,
|
|
1392
|
+
defaultState: te,
|
|
1394
1393
|
initialSelection: O,
|
|
1395
1394
|
onSelectionChange: k,
|
|
1396
|
-
isEditable: !f && !
|
|
1397
|
-
focusRequested:
|
|
1398
|
-
onFocusRequestComplete:
|
|
1399
|
-
placeholder: /* @__PURE__ */ J(
|
|
1395
|
+
isEditable: !f && !ee && !F,
|
|
1396
|
+
focusRequested: ie.requested,
|
|
1397
|
+
onFocusRequestComplete: ie.complete,
|
|
1398
|
+
placeholder: /* @__PURE__ */ J(Zn, { placeholder: h }),
|
|
1400
1399
|
onChange: (e, t) => {
|
|
1401
|
-
|
|
1400
|
+
ne(JSON.stringify(t)), A?.(e, JSON.stringify(t)), H.change(e);
|
|
1402
1401
|
},
|
|
1403
|
-
onSubmit: () =>
|
|
1402
|
+
onSubmit: () => le(Dt(oe)),
|
|
1404
1403
|
commands: N
|
|
1405
|
-
},
|
|
1404
|
+
}, z)
|
|
1406
1405
|
})
|
|
1407
1406
|
})]
|
|
1408
1407
|
}),
|
|
1409
|
-
|
|
1410
|
-
actions: /* @__PURE__ */ Y(
|
|
1408
|
+
F ? null : /* @__PURE__ */ J(Mt, {
|
|
1409
|
+
actions: /* @__PURE__ */ Y(me, { children: [y, _] }),
|
|
1411
1410
|
questionPrompt: !1,
|
|
1412
1411
|
skipDisabled: !1,
|
|
1413
1412
|
skipTitle: "",
|
|
1414
1413
|
onSkip: () => {},
|
|
1415
|
-
buttonAction:
|
|
1414
|
+
buttonAction: G,
|
|
1416
1415
|
submitTitle: T,
|
|
1417
|
-
submitLabel:
|
|
1416
|
+
submitLabel: E,
|
|
1418
1417
|
submitActions: v,
|
|
1419
1418
|
messageTitle: se,
|
|
1420
|
-
runAction:
|
|
1419
|
+
runAction: le
|
|
1421
1420
|
})
|
|
1422
1421
|
]
|
|
1423
1422
|
})
|
|
1424
1423
|
});
|
|
1425
|
-
},
|
|
1424
|
+
}, $n = {
|
|
1426
1425
|
animationName: "message-fade-in",
|
|
1427
1426
|
animationDuration: "200ms",
|
|
1428
1427
|
animationTimingFunction: "ease-out"
|
|
1429
|
-
},
|
|
1428
|
+
}, er = (e) => {
|
|
1430
1429
|
let t = /* @__PURE__ */ new Set(), n = new Set(e.state.seenKeys);
|
|
1431
1430
|
for (let r of e.itemKeys) e.state.initialized && !n.has(r) && t.add(r), n.add(r);
|
|
1432
1431
|
return {
|
|
@@ -1436,17 +1435,17 @@ var Jn = (e, t, n) => {
|
|
|
1436
1435
|
seenKeys: n
|
|
1437
1436
|
}
|
|
1438
1437
|
};
|
|
1439
|
-
},
|
|
1438
|
+
}, tr = (e, t) => {
|
|
1440
1439
|
if (e.length !== t.length) return !1;
|
|
1441
1440
|
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
1442
1441
|
return !0;
|
|
1443
|
-
},
|
|
1442
|
+
}, nr = (e) => {
|
|
1444
1443
|
let t = Z({
|
|
1445
1444
|
initialized: !1,
|
|
1446
1445
|
seenKeys: /* @__PURE__ */ new Set()
|
|
1447
1446
|
}), n = Z(null);
|
|
1448
|
-
if (n.current &&
|
|
1449
|
-
let r =
|
|
1447
|
+
if (n.current && tr(n.current.itemKeys, e)) return n.current.animatedKeys;
|
|
1448
|
+
let r = er({
|
|
1450
1449
|
itemKeys: e,
|
|
1451
1450
|
state: t.current
|
|
1452
1451
|
});
|
|
@@ -1454,15 +1453,15 @@ var Jn = (e, t, n) => {
|
|
|
1454
1453
|
itemKeys: [...e],
|
|
1455
1454
|
animatedKeys: r.animatedKeys
|
|
1456
1455
|
}, r.animatedKeys;
|
|
1457
|
-
},
|
|
1456
|
+
}, rr = (e) => e.type === "text", ir = (e) => (e.parts ?? []).filter(rr).map((e) => e.text.trim()).filter(Boolean).join("\n\n"), ar = (e, t, n) => e.delivery === "unsent" ? "Not sent" : e.createdAt ? new Intl.DateTimeFormat(t, {
|
|
1458
1457
|
hour: "numeric",
|
|
1459
1458
|
minute: "2-digit",
|
|
1460
1459
|
timeZone: n
|
|
1461
|
-
}).format(new Date(e.createdAt)) : "",
|
|
1460
|
+
}).format(new Date(e.createdAt)) : "", or = (e) => {
|
|
1462
1461
|
let n = q(20), { message: r, alwaysVisible: i, copyAlwaysVisible: a } = e, o = i !== void 0 && i, s = a === void 0 ? o : a, [c, l] = Q(!1), u = Z(null), d;
|
|
1463
|
-
n[0] === r ? d = n[1] : (d =
|
|
1462
|
+
n[0] === r ? d = n[1] : (d = ir(r), n[0] = r, n[1] = d);
|
|
1464
1463
|
let f = d, p;
|
|
1465
|
-
n[2] === r ? p = n[3] : (p =
|
|
1464
|
+
n[2] === r ? p = n[3] : (p = ar(r), n[2] = r, n[3] = p);
|
|
1466
1465
|
let m = p, h, g;
|
|
1467
1466
|
n[4] === Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
|
|
1468
1467
|
u.current !== null && window.clearTimeout(u.current);
|
|
@@ -1484,11 +1483,11 @@ var Jn = (e, t, n) => {
|
|
|
1484
1483
|
children: m
|
|
1485
1484
|
}) : null, n[8] = m, n[9] = x);
|
|
1486
1485
|
let S;
|
|
1487
|
-
n[10] !== s || n[11] !== v || n[12] !== f || n[13] !== c ? (S = f ? /* @__PURE__ */ J(
|
|
1486
|
+
n[10] !== s || n[11] !== v || n[12] !== f || n[13] !== c ? (S = f ? /* @__PURE__ */ J(j, {
|
|
1488
1487
|
opacity: s ? "1" : "0",
|
|
1489
1488
|
pointerEvents: s ? "auto" : "none",
|
|
1490
1489
|
transition: "opacity 120ms ease",
|
|
1491
|
-
css:
|
|
1490
|
+
css: sr,
|
|
1492
1491
|
children: /* @__PURE__ */ J(t, {
|
|
1493
1492
|
content: c ? "Copied" : "Copy message",
|
|
1494
1493
|
children: /* @__PURE__ */ J(R, {
|
|
@@ -1496,22 +1495,22 @@ var Jn = (e, t, n) => {
|
|
|
1496
1495
|
variant: "ghost",
|
|
1497
1496
|
size: "2xs",
|
|
1498
1497
|
onClick: v,
|
|
1499
|
-
children: J(c ?
|
|
1498
|
+
children: J(c ? Te : Oe, { size: 12 })
|
|
1500
1499
|
})
|
|
1501
1500
|
})
|
|
1502
1501
|
}) : null, n[10] = s, n[11] = v, n[12] = f, n[13] = c, n[14] = S) : S = n[14];
|
|
1503
1502
|
let C;
|
|
1504
|
-
return n[15] !== S || n[16] !== y || n[17] !== b || n[18] !== x ? (C = /* @__PURE__ */ Y(
|
|
1503
|
+
return n[15] !== S || n[16] !== y || n[17] !== b || n[18] !== x ? (C = /* @__PURE__ */ Y(L, {
|
|
1505
1504
|
"data-chat-message-action-panel": "true",
|
|
1506
1505
|
gap: "2xs",
|
|
1507
1506
|
minH: "6",
|
|
1508
1507
|
opacity: y,
|
|
1509
1508
|
pointerEvents: b,
|
|
1510
1509
|
transition: "opacity 120ms ease",
|
|
1511
|
-
css:
|
|
1510
|
+
css: sr,
|
|
1512
1511
|
children: [x, S]
|
|
1513
1512
|
}), n[15] = S, n[16] = y, n[17] = b, n[18] = x, n[19] = C) : C = n[19], C;
|
|
1514
|
-
},
|
|
1513
|
+
}, sr = {
|
|
1515
1514
|
"[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
|
|
1516
1515
|
opacity: 1,
|
|
1517
1516
|
pointerEvents: "auto"
|
|
@@ -1524,31 +1523,31 @@ var Jn = (e, t, n) => {
|
|
|
1524
1523
|
opacity: 1,
|
|
1525
1524
|
pointerEvents: "auto"
|
|
1526
1525
|
}
|
|
1527
|
-
},
|
|
1526
|
+
}, cr = (e) => {
|
|
1528
1527
|
let t = q(12), n, r, i, a;
|
|
1529
1528
|
t[0] === e ? (n = t[1], r = t[2], i = t[3], a = t[4]) : ({children: n, linkHandler: r, streaming: a, ...i} = e, t[0] = e, t[1] = n, t[2] = r, t[3] = i, t[4] = a);
|
|
1530
1529
|
let o;
|
|
1531
|
-
t[5] !== n || t[6] !== r || t[7] !== a ? (o = /* @__PURE__ */ J(
|
|
1530
|
+
t[5] !== n || t[6] !== r || t[7] !== a ? (o = /* @__PURE__ */ J(E, {
|
|
1532
1531
|
defaultState: n,
|
|
1533
1532
|
linkHandler: r,
|
|
1534
1533
|
streaming: a,
|
|
1535
1534
|
fullWidth: !0
|
|
1536
1535
|
}), t[5] = n, t[6] = r, t[7] = a, t[8] = o) : o = t[8];
|
|
1537
1536
|
let s;
|
|
1538
|
-
return t[9] !== i || t[10] !== o ? (s = /* @__PURE__ */ J(
|
|
1537
|
+
return t[9] !== i || t[10] !== o ? (s = /* @__PURE__ */ J(j, {
|
|
1539
1538
|
...i,
|
|
1540
1539
|
children: o
|
|
1541
1540
|
}), t[9] = i, t[10] = o, t[11] = s) : s = t[11], s;
|
|
1542
|
-
},
|
|
1543
|
-
let t = q(12), { part: n } = e, r =
|
|
1541
|
+
}, lr = (e) => {
|
|
1542
|
+
let t = q(12), { part: n } = e, r = pn(n.state?.input), i = Cn(), a;
|
|
1544
1543
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (a = { recipe: f }, t[0] = a) : a = t[0];
|
|
1545
|
-
let o =
|
|
1544
|
+
let o = fe(a);
|
|
1546
1545
|
if (!r) return null;
|
|
1547
1546
|
let s;
|
|
1548
|
-
t[1] === n ? s = t[2] : (s =
|
|
1547
|
+
t[1] === n ? s = t[2] : (s = _n(n), t[1] = n, t[2] = s);
|
|
1549
1548
|
let c = s, l = c && !!i, u = W, d;
|
|
1550
1549
|
t[3] !== l || t[4] !== i || t[5] !== n || t[6] !== c || t[7] !== o ? (d = (e, t) => {
|
|
1551
|
-
let r =
|
|
1550
|
+
let r = xn(n, t) ?? e.options[0]?.label ?? "Your answer", a = i?.activeKey === gn(n) && i?.selection?.index === t;
|
|
1552
1551
|
return /* @__PURE__ */ Y(K.button, {
|
|
1553
1552
|
type: "button",
|
|
1554
1553
|
css: o({ multiline: e.question.includes("\n") }),
|
|
@@ -1562,7 +1561,7 @@ var Jn = (e, t, n) => {
|
|
|
1562
1561
|
children: e.question
|
|
1563
1562
|
}), /* @__PURE__ */ Y("span", {
|
|
1564
1563
|
"data-question-answer-row": !0,
|
|
1565
|
-
children: [/* @__PURE__ */ J(
|
|
1564
|
+
children: [/* @__PURE__ */ J(Ce, { "aria-hidden": "true" }), /* @__PURE__ */ J("span", {
|
|
1566
1565
|
"data-question-answer": !0,
|
|
1567
1566
|
children: r
|
|
1568
1567
|
})]
|
|
@@ -1575,37 +1574,37 @@ var Jn = (e, t, n) => {
|
|
|
1575
1574
|
align: "start",
|
|
1576
1575
|
children: p
|
|
1577
1576
|
}), t[9] = u, t[10] = p, t[11] = m) : m = t[11], m;
|
|
1578
|
-
},
|
|
1579
|
-
let t =
|
|
1577
|
+
}, ur = (e) => e.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), dr = (e) => {
|
|
1578
|
+
let t = ur(e), n = t.replace(/_/g, "");
|
|
1580
1579
|
return [.../* @__PURE__ */ new Set([
|
|
1581
1580
|
e,
|
|
1582
1581
|
t,
|
|
1583
1582
|
n
|
|
1584
1583
|
])];
|
|
1585
|
-
}, dr = {
|
|
1586
|
-
shell: Ge,
|
|
1587
|
-
ls: Re,
|
|
1588
|
-
read_file: Ne,
|
|
1589
|
-
write_file: Me,
|
|
1590
|
-
delete_file: Ke,
|
|
1591
|
-
patch: Ae,
|
|
1592
|
-
upload_files: Pe,
|
|
1593
|
-
download_file: je,
|
|
1594
|
-
move_file: Be
|
|
1595
1584
|
}, fr = {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}, pr =
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1585
|
+
shell: Ke,
|
|
1586
|
+
ls: ze,
|
|
1587
|
+
read_file: Pe,
|
|
1588
|
+
write_file: Ne,
|
|
1589
|
+
delete_file: qe,
|
|
1590
|
+
patch: je,
|
|
1591
|
+
upload_files: Fe,
|
|
1592
|
+
download_file: Me,
|
|
1593
|
+
move_file: Ve
|
|
1594
|
+
}, pr = {
|
|
1595
|
+
dot: ke,
|
|
1596
|
+
danger: xe,
|
|
1597
|
+
search: Ue,
|
|
1598
|
+
browser: Ie,
|
|
1599
|
+
file: Ae,
|
|
1600
|
+
question: De,
|
|
1601
|
+
todo: Re,
|
|
1602
|
+
terminal: Ke,
|
|
1603
|
+
...fr
|
|
1604
|
+
}, mr = "dot", hr = (e) => Object.hasOwn(fr, e), gr = (e) => pr[e], _r = (e) => {
|
|
1605
|
+
if (!e) return mr;
|
|
1606
|
+
let t = ur(e);
|
|
1607
|
+
if (hr(t)) return t;
|
|
1609
1608
|
let n = t.replace(/_/g, "");
|
|
1610
1609
|
switch (t) {
|
|
1611
1610
|
case "read": return "file";
|
|
@@ -1620,79 +1619,79 @@ var Jn = (e, t, n) => {
|
|
|
1620
1619
|
case "question": return "question";
|
|
1621
1620
|
case "fs":
|
|
1622
1621
|
case "file": return "file";
|
|
1623
|
-
default: return n === "todowrite" || n === "todo" ? "todo" :
|
|
1622
|
+
default: return n === "todowrite" || n === "todo" ? "todo" : mr;
|
|
1624
1623
|
}
|
|
1625
1624
|
};
|
|
1626
1625
|
//#endregion
|
|
1627
1626
|
//#region src/components/chat-ui/utils/diff.ts
|
|
1628
|
-
function
|
|
1627
|
+
function vr(e) {
|
|
1629
1628
|
let t = e.lastIndexOf("/");
|
|
1630
1629
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
1631
1630
|
}
|
|
1632
|
-
function
|
|
1631
|
+
function yr(e) {
|
|
1633
1632
|
if (!e) return null;
|
|
1634
1633
|
let t = e.split(" ")[0].trim();
|
|
1635
1634
|
if (t === "/dev/null") return null;
|
|
1636
1635
|
let n = t;
|
|
1637
1636
|
return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
1638
1637
|
}
|
|
1639
|
-
var
|
|
1638
|
+
var br = (e) => e.startsWith("--- "), xr = (e) => e.startsWith("+++ "), Sr = (e) => e.startsWith("@@"), Cr = (e) => e.startsWith("+") && !(xr(e) || e === "+++"), wr = (e) => e.startsWith("-") && !(br(e) || e === "---"), Tr = (e, t) => {
|
|
1640
1639
|
e.has(t) || e.set(t, {
|
|
1641
1640
|
additions: 0,
|
|
1642
1641
|
deletions: 0
|
|
1643
1642
|
});
|
|
1644
|
-
},
|
|
1643
|
+
}, Er = (e, t) => {
|
|
1645
1644
|
let n = e.get(t);
|
|
1646
1645
|
n && (n.additions += 1);
|
|
1647
|
-
},
|
|
1646
|
+
}, Dr = (e, t) => {
|
|
1648
1647
|
let n = e.get(t);
|
|
1649
1648
|
n && (n.deletions += 1);
|
|
1650
|
-
},
|
|
1651
|
-
if (
|
|
1649
|
+
}, Or = (e, t, n) => {
|
|
1650
|
+
if (br(e)) return {
|
|
1652
1651
|
...t,
|
|
1653
|
-
lastMinusHeader:
|
|
1652
|
+
lastMinusHeader: yr(e.slice(4)),
|
|
1654
1653
|
inHunk: !1
|
|
1655
1654
|
};
|
|
1656
|
-
if (
|
|
1657
|
-
let r =
|
|
1658
|
-
return r &&
|
|
1655
|
+
if (xr(e)) {
|
|
1656
|
+
let r = yr(e.slice(4)) ?? t.lastMinusHeader;
|
|
1657
|
+
return r && Tr(n, r), {
|
|
1659
1658
|
...t,
|
|
1660
1659
|
currentPath: r,
|
|
1661
1660
|
inHunk: !1
|
|
1662
1661
|
};
|
|
1663
1662
|
}
|
|
1664
|
-
return t.currentPath ?
|
|
1663
|
+
return t.currentPath ? Sr(e) ? {
|
|
1665
1664
|
...t,
|
|
1666
1665
|
inHunk: !0
|
|
1667
|
-
} : t.inHunk ?
|
|
1666
|
+
} : t.inHunk ? Cr(e) ? (Er(n, t.currentPath), t) : (wr(e) && Dr(n, t.currentPath), t) : t : t;
|
|
1668
1667
|
};
|
|
1669
|
-
function
|
|
1668
|
+
function kr(e) {
|
|
1670
1669
|
if (!e || typeof e != "string") return [];
|
|
1671
1670
|
let t = /* @__PURE__ */ new Map(), n = {
|
|
1672
1671
|
currentPath: null,
|
|
1673
1672
|
lastMinusHeader: null,
|
|
1674
1673
|
inHunk: !1
|
|
1675
1674
|
}, r = e.split(/\r?\n/);
|
|
1676
|
-
for (let e of r) n =
|
|
1675
|
+
for (let e of r) n = Or(e, n, t);
|
|
1677
1676
|
return Array.from(t.entries()).map(([e, { additions: t, deletions: n }]) => ({
|
|
1678
1677
|
filePath: e,
|
|
1679
1678
|
additions: t,
|
|
1680
1679
|
deletions: n
|
|
1681
1680
|
}));
|
|
1682
1681
|
}
|
|
1683
|
-
function
|
|
1684
|
-
return
|
|
1682
|
+
function Ar(e) {
|
|
1683
|
+
return kr(e).map((e) => ({
|
|
1685
1684
|
kind: "diff",
|
|
1686
|
-
fileName:
|
|
1685
|
+
fileName: vr(e.filePath),
|
|
1687
1686
|
filePath: e.filePath,
|
|
1688
1687
|
additions: e.additions,
|
|
1689
1688
|
deletions: e.deletions
|
|
1690
1689
|
}));
|
|
1691
1690
|
}
|
|
1692
|
-
function
|
|
1693
|
-
return
|
|
1691
|
+
function jr(e) {
|
|
1692
|
+
return kr(e).map((e) => e.filePath);
|
|
1694
1693
|
}
|
|
1695
|
-
var
|
|
1694
|
+
var Mr = (e) => br(e) || e.startsWith("diff --git "), Nr = (e) => e.startsWith(" ") || e.startsWith("+") || e.startsWith("-") ? !1 : e.trim() !== "", Pr = (e, t, n) => {
|
|
1696
1695
|
if (e.startsWith(" ")) {
|
|
1697
1696
|
let r = e.slice(1);
|
|
1698
1697
|
t.push(r), n.push(r);
|
|
@@ -1703,26 +1702,26 @@ var jr = (e) => yr(e) || e.startsWith("diff --git "), Mr = (e) => e.startsWith("
|
|
|
1703
1702
|
return;
|
|
1704
1703
|
}
|
|
1705
1704
|
e.startsWith("+") && n.push(e.slice(1));
|
|
1706
|
-
},
|
|
1705
|
+
}, Fr = (e, t, n, r) => {
|
|
1707
1706
|
let i = t;
|
|
1708
1707
|
for (; i < e.length;) {
|
|
1709
1708
|
let t = e[i] || "";
|
|
1710
|
-
if (
|
|
1711
|
-
|
|
1709
|
+
if (Mr(t) || Sr(t) || Nr(t)) break;
|
|
1710
|
+
Pr(t, n, r), i += 1;
|
|
1712
1711
|
}
|
|
1713
1712
|
return (n.length > 0 || r.length > 0) && (n.push(""), r.push("")), i;
|
|
1714
|
-
},
|
|
1715
|
-
let n =
|
|
1716
|
-
if (!
|
|
1717
|
-
let i =
|
|
1713
|
+
}, Ir = (e, t) => {
|
|
1714
|
+
let n = yr((e[t] || "").slice(4)), r = e[t + 1] || "";
|
|
1715
|
+
if (!xr(r)) return { nextIndex: t + 1 };
|
|
1716
|
+
let i = yr(r.slice(4)) ?? n ?? "", a = [], o = [], s = t + 2;
|
|
1718
1717
|
for (; s < e.length;) {
|
|
1719
1718
|
let t = e[s] || "";
|
|
1720
|
-
if (
|
|
1721
|
-
if (!
|
|
1719
|
+
if (Mr(t)) break;
|
|
1720
|
+
if (!Sr(t)) {
|
|
1722
1721
|
s += 1;
|
|
1723
1722
|
continue;
|
|
1724
1723
|
}
|
|
1725
|
-
s =
|
|
1724
|
+
s = Fr(e, s + 1, a, o);
|
|
1726
1725
|
}
|
|
1727
1726
|
return {
|
|
1728
1727
|
nextIndex: s,
|
|
@@ -1733,22 +1732,22 @@ var jr = (e) => yr(e) || e.startsWith("diff --git "), Mr = (e) => e.startsWith("
|
|
|
1733
1732
|
}
|
|
1734
1733
|
};
|
|
1735
1734
|
};
|
|
1736
|
-
function
|
|
1735
|
+
function Lr(e) {
|
|
1737
1736
|
if (!e || typeof e != "string") return [];
|
|
1738
1737
|
let t = e.split(/\r?\n/), n = [], r = 0;
|
|
1739
1738
|
for (; r < t.length;) {
|
|
1740
|
-
if (!
|
|
1739
|
+
if (!br(t[r] || "")) {
|
|
1741
1740
|
r += 1;
|
|
1742
1741
|
continue;
|
|
1743
1742
|
}
|
|
1744
|
-
let { nextIndex: e, preview: i } =
|
|
1743
|
+
let { nextIndex: e, preview: i } = Ir(t, r);
|
|
1745
1744
|
i && n.push(i), r = Math.max(e, r + 1);
|
|
1746
1745
|
}
|
|
1747
1746
|
return n;
|
|
1748
1747
|
}
|
|
1749
1748
|
//#endregion
|
|
1750
1749
|
//#region src/components/chat-ui/tool-rendering/shared.ts
|
|
1751
|
-
var
|
|
1750
|
+
var Rr = {
|
|
1752
1751
|
apply_patch: "Apply patch",
|
|
1753
1752
|
bash: "Run command",
|
|
1754
1753
|
edit: "Edit file",
|
|
@@ -1757,34 +1756,34 @@ var Lr = {
|
|
|
1757
1756
|
read: "Read file",
|
|
1758
1757
|
skill: "Load skill",
|
|
1759
1758
|
todowrite: "Update todos"
|
|
1760
|
-
},
|
|
1759
|
+
}, zr = {
|
|
1761
1760
|
error: "failed",
|
|
1762
1761
|
"output-error": "failed",
|
|
1763
1762
|
input_streaming: "running",
|
|
1764
1763
|
running: "running",
|
|
1765
1764
|
completed: "completed",
|
|
1766
1765
|
failed: "failed"
|
|
1767
|
-
},
|
|
1768
|
-
let t =
|
|
1769
|
-
return
|
|
1770
|
-
},
|
|
1766
|
+
}, Br = (e) => e.replace(/^tool-/, "").toLowerCase(), Vr = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Hr = (e) => Br(e.tool ?? "tool"), Ur = (e) => {
|
|
1767
|
+
let t = Br(e);
|
|
1768
|
+
return Rr[t] ?? Vr(t.replace(/_/g, " "));
|
|
1769
|
+
}, Wr = (e) => {
|
|
1771
1770
|
let t = e.state?.status ?? e.status;
|
|
1772
1771
|
if (!t || typeof t != "string") return null;
|
|
1773
1772
|
let n = t.replace(/-/g, "_");
|
|
1774
|
-
return
|
|
1775
|
-
},
|
|
1773
|
+
return zr[n] ? zr[n] : n.includes("stream") ? "running" : null;
|
|
1774
|
+
}, Gr = (e) => {
|
|
1776
1775
|
let t = e.state?.status ?? e.status;
|
|
1777
1776
|
return t === "error" || t === "output-error" || t === "failed";
|
|
1778
|
-
},
|
|
1777
|
+
}, Kr = (e) => Gr(e) ? {
|
|
1779
1778
|
type: "icon",
|
|
1780
1779
|
icon: "danger"
|
|
1781
1780
|
} : {
|
|
1782
1781
|
type: "icon",
|
|
1783
|
-
icon:
|
|
1784
|
-
},
|
|
1782
|
+
icon: _r(Hr(e))
|
|
1783
|
+
}, qr = (e, t, n, r) => {
|
|
1785
1784
|
let i = [{
|
|
1786
1785
|
kind: "text",
|
|
1787
|
-
text: n ??
|
|
1786
|
+
text: n ?? Ur(e.tool ?? "tool"),
|
|
1788
1787
|
bold: !0
|
|
1789
1788
|
}];
|
|
1790
1789
|
t && i.push({
|
|
@@ -1796,100 +1795,100 @@ var Lr = {
|
|
|
1796
1795
|
monospace: !0
|
|
1797
1796
|
} : {}
|
|
1798
1797
|
});
|
|
1799
|
-
let a =
|
|
1798
|
+
let a = Wr(e);
|
|
1800
1799
|
return a && a !== "completed" && i.push({
|
|
1801
1800
|
kind: "text",
|
|
1802
1801
|
text: a,
|
|
1803
1802
|
muted: !0
|
|
1804
1803
|
}), i;
|
|
1805
|
-
},
|
|
1804
|
+
}, Jr = (e) => {
|
|
1806
1805
|
let t = e.state?.input;
|
|
1807
1806
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1808
|
-
},
|
|
1807
|
+
}, Yr = (e) => {
|
|
1809
1808
|
let t = e.state?.output;
|
|
1810
1809
|
return !t || typeof t != "object" || Array.isArray(t) ? null : t;
|
|
1811
|
-
}, $ = (e) => typeof e == "string" && e.trim().length > 0 ? e : null,
|
|
1812
|
-
let n =
|
|
1813
|
-
return n ?
|
|
1814
|
-
},
|
|
1815
|
-
let t = Jr(e);
|
|
1816
|
-
return [Xr(e, "metadata"), Yr(t?.metadata)].filter(Boolean);
|
|
1817
|
-
}, ei = (e) => {
|
|
1810
|
+
}, $ = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Xr = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Zr = (e, t) => {
|
|
1811
|
+
let n = Xr(e.state);
|
|
1812
|
+
return n ? Xr(n[t]) : null;
|
|
1813
|
+
}, Qr = (e) => e.replace(/\\/g, "/").replace(/^\/+/, ""), $r = (e) => e.includes("--- ") && e.includes("+++ ") && e.includes("@@"), ei = (e) => {
|
|
1818
1814
|
let t = Yr(e);
|
|
1815
|
+
return [Zr(e, "metadata"), Xr(t?.metadata)].filter(Boolean);
|
|
1816
|
+
}, ti = (e) => {
|
|
1817
|
+
let t = Xr(e);
|
|
1819
1818
|
if (!t) return null;
|
|
1820
1819
|
let n = $(t.filePath) ?? $(t.relativePath) ?? $(t.path);
|
|
1821
1820
|
return n ? {
|
|
1822
|
-
filePath:
|
|
1821
|
+
filePath: Qr(n),
|
|
1823
1822
|
additions: typeof t.additions == "number" ? t.additions : 0,
|
|
1824
1823
|
deletions: typeof t.deletions == "number" ? t.deletions : 0,
|
|
1825
1824
|
diff: $(t.diff) ?? void 0,
|
|
1826
1825
|
before: $(t.before) ?? void 0,
|
|
1827
1826
|
after: $(t.after) ?? void 0
|
|
1828
1827
|
} : null;
|
|
1829
|
-
},
|
|
1828
|
+
}, ni = (e) => {
|
|
1830
1829
|
let t = [];
|
|
1831
|
-
for (let n of
|
|
1830
|
+
for (let n of ei(e)) {
|
|
1832
1831
|
let e = Array.isArray(n.files) ? n.files : [];
|
|
1833
1832
|
for (let n of e) {
|
|
1834
|
-
let e =
|
|
1833
|
+
let e = ti(n);
|
|
1835
1834
|
e && t.push(e);
|
|
1836
1835
|
}
|
|
1837
1836
|
}
|
|
1838
1837
|
return t;
|
|
1839
|
-
}, ni = (e) => {
|
|
1840
|
-
let t = qr(e), n = (Array.isArray(t?.changes) ? t.changes : []).map((e) => $(Yr(e)?.path)).filter((e) => !!e).map(Zr);
|
|
1841
|
-
return Array.from(new Set(n));
|
|
1842
1838
|
}, ri = (e) => {
|
|
1843
|
-
let t =
|
|
1839
|
+
let t = Jr(e), n = (Array.isArray(t?.changes) ? t.changes : []).map((e) => $(Xr(e)?.path)).filter((e) => !!e).map(Qr);
|
|
1840
|
+
return Array.from(new Set(n));
|
|
1841
|
+
}, ii = (e) => {
|
|
1842
|
+
let t = Jr(e), n = $(t?.diff);
|
|
1844
1843
|
if (n) return n;
|
|
1845
|
-
for (let t of
|
|
1844
|
+
for (let t of ei(e)) {
|
|
1846
1845
|
let e = $(t.diff);
|
|
1847
1846
|
if (e) return e;
|
|
1848
1847
|
}
|
|
1849
|
-
let r =
|
|
1848
|
+
let r = ni(e).map((e) => e.diff).filter((e) => !!e);
|
|
1850
1849
|
if (r.length > 0) return r.join("\n");
|
|
1851
1850
|
let i = $(t?.patchText);
|
|
1852
|
-
return i &&
|
|
1853
|
-
},
|
|
1851
|
+
return i && $r(i) ? i : null;
|
|
1852
|
+
}, ai = (e) => {
|
|
1854
1853
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
1855
1854
|
for (let r of e) t.has(r.filePath) || (t.add(r.filePath), n.push({
|
|
1856
1855
|
kind: "diff",
|
|
1857
|
-
fileName:
|
|
1856
|
+
fileName: vr(r.filePath),
|
|
1858
1857
|
filePath: r.filePath,
|
|
1859
1858
|
additions: r.additions,
|
|
1860
1859
|
deletions: r.deletions
|
|
1861
1860
|
}));
|
|
1862
1861
|
return n;
|
|
1863
|
-
},
|
|
1864
|
-
let t =
|
|
1862
|
+
}, oi = (e) => Array.from(new Set(e.map((e) => e.filePath))), si = (e) => {
|
|
1863
|
+
let t = Yr(e);
|
|
1865
1864
|
return $(e.state?.output) ?? $(t?.returnDisplay) ?? $(t?.preview) ?? $(t?.stdout) ?? $(t?.content);
|
|
1866
|
-
},
|
|
1865
|
+
}, ci = (e) => {
|
|
1867
1866
|
let t = e.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
|
|
1868
1867
|
return t ? {
|
|
1869
1868
|
skillName: $(t[1]) ?? void 0,
|
|
1870
1869
|
content: $(t[2]) ?? ""
|
|
1871
1870
|
} : null;
|
|
1872
|
-
},
|
|
1873
|
-
let t =
|
|
1871
|
+
}, li = (e) => {
|
|
1872
|
+
let t = Jr(e);
|
|
1874
1873
|
return $(t?.name) ?? $(t?.skillName) ?? $(t?.skill) ?? $(t?.skill_name) ?? void 0;
|
|
1875
|
-
},
|
|
1874
|
+
}, ui = (e, t) => ({
|
|
1876
1875
|
kind: "link",
|
|
1877
|
-
text:
|
|
1876
|
+
text: vr(e),
|
|
1878
1877
|
filePath: e,
|
|
1879
1878
|
...t ? { variant: t } : {}
|
|
1880
|
-
}),
|
|
1879
|
+
}), di = (e, t) => !Gr(e) || !e.state?.errorText ? t : [{
|
|
1881
1880
|
type: "comment",
|
|
1882
1881
|
text: e.state.errorText
|
|
1883
|
-
}, ...t],
|
|
1882
|
+
}, ...t], fi = (e) => Lr(e ?? void 0).map((e) => ({
|
|
1884
1883
|
type: "diff",
|
|
1885
1884
|
language: "diff",
|
|
1886
1885
|
original: e.original,
|
|
1887
1886
|
modified: e.modified,
|
|
1888
1887
|
sideBySide: !1
|
|
1889
|
-
})),
|
|
1890
|
-
let t =
|
|
1891
|
-
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...
|
|
1892
|
-
let o = [...
|
|
1888
|
+
})), pi = (e) => Ar(e ?? void 0), mi = (e) => jr(e ?? void 0), hi = (e) => {
|
|
1889
|
+
let t = ii(e), n = ni(e), r = ri(e), i = qr(e, void 0, "Apply patch"), a = pi(t);
|
|
1890
|
+
a.length > 0 ? i.push(...a) : n.length > 0 ? i.push(...ai(n)) : i.push(...r.map((e) => ui(e, "bubble")));
|
|
1891
|
+
let o = [...fi(t)];
|
|
1893
1892
|
if (o.length === 0) for (let e of n) (e.before || e.after) && o.push({
|
|
1894
1893
|
type: "diff",
|
|
1895
1894
|
language: "diff",
|
|
@@ -1898,36 +1897,36 @@ var Lr = {
|
|
|
1898
1897
|
sideBySide: !1
|
|
1899
1898
|
});
|
|
1900
1899
|
if (o.length === 0) {
|
|
1901
|
-
let e =
|
|
1902
|
-
e.length === 0 && e.push(...
|
|
1900
|
+
let e = mi(t);
|
|
1901
|
+
e.length === 0 && e.push(...oi(n)), e.length === 0 && e.push(...r), e.length > 0 && o.push({
|
|
1903
1902
|
type: "references",
|
|
1904
1903
|
references: e
|
|
1905
1904
|
});
|
|
1906
1905
|
}
|
|
1907
1906
|
return {
|
|
1908
|
-
indicator:
|
|
1907
|
+
indicator: Kr(e),
|
|
1909
1908
|
title: i,
|
|
1910
|
-
blocks:
|
|
1909
|
+
blocks: di(e, o)
|
|
1911
1910
|
};
|
|
1912
|
-
},
|
|
1911
|
+
}, gi = (e, t) => [{
|
|
1913
1912
|
type: "diff",
|
|
1914
1913
|
language: "text",
|
|
1915
1914
|
original: e,
|
|
1916
1915
|
modified: t,
|
|
1917
1916
|
sideBySide: !1
|
|
1918
|
-
}],
|
|
1919
|
-
let t =
|
|
1920
|
-
r && o.push(
|
|
1921
|
-
let s = i !== void 0 && a !== void 0 ?
|
|
1917
|
+
}], _i = (e) => {
|
|
1918
|
+
let t = Jr(e), n = Yr(e), r = $(t?.filePath) ?? $(t?.file_path) ?? $(n?.filePath) ?? void 0, i = $(n?.oldString) ?? $(t?.old_string) ?? void 0, a = $(n?.newString) ?? $(t?.new_string) ?? void 0, o = qr(e, void 0, "Edit file");
|
|
1919
|
+
r && o.push(ui(r));
|
|
1920
|
+
let s = i !== void 0 && a !== void 0 ? gi(i, a) : fi($(n?.diff));
|
|
1922
1921
|
return {
|
|
1923
|
-
indicator:
|
|
1922
|
+
indicator: Kr(e),
|
|
1924
1923
|
title: o,
|
|
1925
|
-
blocks:
|
|
1924
|
+
blocks: di(e, s)
|
|
1926
1925
|
};
|
|
1927
|
-
},
|
|
1926
|
+
}, vi = (e) => {
|
|
1928
1927
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
1929
1928
|
return (e) => {
|
|
1930
|
-
let i =
|
|
1929
|
+
let i = un(e.state?.output) || un(e.state?.metadata), a = pn(e.state?.input), o = a ? {
|
|
1931
1930
|
type: "question-form",
|
|
1932
1931
|
questions: a.questions
|
|
1933
1932
|
} : null;
|
|
@@ -1940,15 +1939,15 @@ var Lr = {
|
|
|
1940
1939
|
expandable: !1
|
|
1941
1940
|
};
|
|
1942
1941
|
};
|
|
1943
|
-
},
|
|
1944
|
-
let t =
|
|
1945
|
-
return r && i.push(
|
|
1946
|
-
indicator:
|
|
1942
|
+
}, yi = (e) => {
|
|
1943
|
+
let t = Jr(e), n = Yr(e), r = $(t?.filePath) ?? $(t?.file_path) ?? $(t?.file) ?? $(n?.filePath) ?? $(n?.file) ?? $(n?.path) ?? void 0, i = qr(e, void 0, "Read file");
|
|
1944
|
+
return r && i.push(ui(r)), {
|
|
1945
|
+
indicator: Kr(e),
|
|
1947
1946
|
title: i,
|
|
1948
|
-
blocks:
|
|
1947
|
+
blocks: di(e, [])
|
|
1949
1948
|
};
|
|
1950
|
-
},
|
|
1951
|
-
let n =
|
|
1949
|
+
}, bi = (e, t) => {
|
|
1950
|
+
let n = Jr(e), r = Yr(e), i = qr(e, $(n?.command) ?? void 0, t, "monospace"), a = [], o = si(e);
|
|
1952
1951
|
o && a.push({
|
|
1953
1952
|
type: "code",
|
|
1954
1953
|
language: "text",
|
|
@@ -1963,23 +1962,23 @@ var Lr = {
|
|
|
1963
1962
|
type: "text",
|
|
1964
1963
|
text: `Exit code: ${r.exitCode}`
|
|
1965
1964
|
}), {
|
|
1966
|
-
indicator:
|
|
1965
|
+
indicator: Kr(e),
|
|
1967
1966
|
title: i,
|
|
1968
|
-
blocks:
|
|
1967
|
+
blocks: di(e, a)
|
|
1969
1968
|
};
|
|
1970
|
-
},
|
|
1971
|
-
let t =
|
|
1969
|
+
}, xi = (e) => bi(e, "Run command"), Si = (e) => bi(e, "Shell"), Ci = (e) => {
|
|
1970
|
+
let t = Jr(e), n = si(e), r = qr(e, $(t?.pattern) ?? void 0, "Search files"), i = n ? [{
|
|
1972
1971
|
type: "code",
|
|
1973
1972
|
language: "text",
|
|
1974
1973
|
code: n
|
|
1975
1974
|
}] : [];
|
|
1976
1975
|
return {
|
|
1977
|
-
indicator:
|
|
1976
|
+
indicator: Kr(e),
|
|
1978
1977
|
title: r,
|
|
1979
|
-
blocks:
|
|
1978
|
+
blocks: di(e, i)
|
|
1980
1979
|
};
|
|
1981
|
-
},
|
|
1982
|
-
let t =
|
|
1980
|
+
}, wi = (e) => {
|
|
1981
|
+
let t = Jr(e), n = si(e), r = qr(e, $(t?.pattern) ?? void 0, "Find files"), i = [];
|
|
1983
1982
|
if (n) {
|
|
1984
1983
|
let e = n.split(/\r?\n/).map((e) => e.trim()).filter((e) => e.length > 0);
|
|
1985
1984
|
e.length > 0 && i.push({
|
|
@@ -1988,50 +1987,50 @@ var Lr = {
|
|
|
1988
1987
|
});
|
|
1989
1988
|
}
|
|
1990
1989
|
return {
|
|
1991
|
-
indicator:
|
|
1990
|
+
indicator: Kr(e),
|
|
1992
1991
|
title: r,
|
|
1993
|
-
blocks:
|
|
1992
|
+
blocks: di(e, i)
|
|
1994
1993
|
};
|
|
1995
|
-
},
|
|
1996
|
-
let t =
|
|
1994
|
+
}, Ti = (e) => {
|
|
1995
|
+
let t = si(e), n = t ? ci(t) : null, r = qr(e, li(e) ?? n?.skillName, "Load skill"), i = n?.content ?? t, a = i ? [{
|
|
1997
1996
|
type: "code",
|
|
1998
1997
|
language: "markdown",
|
|
1999
1998
|
code: i
|
|
2000
1999
|
}] : [];
|
|
2001
2000
|
return {
|
|
2002
|
-
indicator:
|
|
2001
|
+
indicator: Kr(e),
|
|
2003
2002
|
title: r,
|
|
2004
|
-
blocks:
|
|
2003
|
+
blocks: di(e, a)
|
|
2005
2004
|
};
|
|
2006
|
-
},
|
|
2007
|
-
let t =
|
|
2005
|
+
}, Ei = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Di = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Oi = (e) => {
|
|
2006
|
+
let t = Di(e);
|
|
2008
2007
|
if (!t) return null;
|
|
2009
|
-
let n =
|
|
2008
|
+
let n = Ei(t.content) ?? Ei(t.title);
|
|
2010
2009
|
return n ? {
|
|
2011
2010
|
label: n,
|
|
2012
|
-
checked:
|
|
2011
|
+
checked: Ei(t.status) === "completed"
|
|
2013
2012
|
} : null;
|
|
2014
|
-
},
|
|
2013
|
+
}, ki = (e) => {
|
|
2015
2014
|
if (!e) return {
|
|
2016
2015
|
items: [],
|
|
2017
2016
|
explicit: !1
|
|
2018
2017
|
};
|
|
2019
2018
|
let t = (() => {
|
|
2020
2019
|
if (Array.isArray(e)) return e;
|
|
2021
|
-
let t =
|
|
2020
|
+
let t = Di(e);
|
|
2022
2021
|
return !t || !Array.isArray(t.todos) ? null : t.todos;
|
|
2023
2022
|
})();
|
|
2024
2023
|
return t ? {
|
|
2025
|
-
items: t.map(
|
|
2024
|
+
items: t.map(Oi).filter((e) => e !== null),
|
|
2026
2025
|
explicit: !0
|
|
2027
2026
|
} : {
|
|
2028
2027
|
items: [],
|
|
2029
2028
|
explicit: !1
|
|
2030
2029
|
};
|
|
2031
|
-
},
|
|
2030
|
+
}, Ai = (e) => {
|
|
2032
2031
|
let { buildBaseTitle: t, buildIndicator: n, prependErrorBlock: r } = e;
|
|
2033
2032
|
return (e) => {
|
|
2034
|
-
let i =
|
|
2033
|
+
let i = ki(e.state?.input), a = ki(e.state?.output), o = a.explicit ? a : i;
|
|
2035
2034
|
if (!o.explicit) return null;
|
|
2036
2035
|
let s = o.items, c = `${s.length} item${s.length === 1 ? "" : "s"}`, l = t(e, c, "Update todos");
|
|
2037
2036
|
if (s.length === 0) return {
|
|
@@ -2052,37 +2051,37 @@ var Lr = {
|
|
|
2052
2051
|
blocks: r(e, u)
|
|
2053
2052
|
};
|
|
2054
2053
|
};
|
|
2055
|
-
},
|
|
2056
|
-
buildBaseTitle:
|
|
2057
|
-
buildIndicator:
|
|
2058
|
-
prependErrorBlock:
|
|
2059
|
-
}),
|
|
2060
|
-
buildBaseTitle:
|
|
2061
|
-
buildIndicator:
|
|
2062
|
-
prependErrorBlock:
|
|
2063
|
-
}),
|
|
2064
|
-
apply_patch:
|
|
2065
|
-
bash:
|
|
2066
|
-
edit:
|
|
2067
|
-
glob:
|
|
2068
|
-
grep:
|
|
2069
|
-
question:
|
|
2070
|
-
read:
|
|
2071
|
-
shell:
|
|
2072
|
-
skill:
|
|
2073
|
-
todo_write:
|
|
2074
|
-
todowrite:
|
|
2075
|
-
}),
|
|
2054
|
+
}, ji = vi({
|
|
2055
|
+
buildBaseTitle: qr,
|
|
2056
|
+
buildIndicator: Kr,
|
|
2057
|
+
prependErrorBlock: di
|
|
2058
|
+
}), Mi = Ai({
|
|
2059
|
+
buildBaseTitle: qr,
|
|
2060
|
+
buildIndicator: Kr,
|
|
2061
|
+
prependErrorBlock: di
|
|
2062
|
+
}), Ni = () => ({
|
|
2063
|
+
apply_patch: hi,
|
|
2064
|
+
bash: xi,
|
|
2065
|
+
edit: _i,
|
|
2066
|
+
glob: wi,
|
|
2067
|
+
grep: Ci,
|
|
2068
|
+
question: ji,
|
|
2069
|
+
read: yi,
|
|
2070
|
+
shell: Si,
|
|
2071
|
+
skill: Ti,
|
|
2072
|
+
todo_write: Mi,
|
|
2073
|
+
todowrite: Mi
|
|
2074
|
+
}), Pi = {
|
|
2076
2075
|
error: "failed",
|
|
2077
2076
|
"output-error": "failed",
|
|
2078
2077
|
"input-streaming": "running"
|
|
2079
|
-
},
|
|
2078
|
+
}, Fi = (e) => e.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Ii = (e) => Fi(ur(e ?? "tool").replace(/_/g, " ")), Li = (e) => e === "error" || e === "output-error", Ri = (e) => Li(e.state?.status) ? {
|
|
2080
2079
|
type: "icon",
|
|
2081
2080
|
icon: "danger"
|
|
2082
2081
|
} : {
|
|
2083
2082
|
type: "icon",
|
|
2084
|
-
icon:
|
|
2085
|
-
},
|
|
2083
|
+
icon: _r(e.tool ?? "tool")
|
|
2084
|
+
}, zi = (e) => !e || typeof e != "string" ? null : Pi[e] ? Pi[e] : e.includes("stream") ? "running" : null, Bi = (e) => {
|
|
2086
2085
|
if (typeof e == "string") return e;
|
|
2087
2086
|
if (e == null) return null;
|
|
2088
2087
|
try {
|
|
@@ -2090,30 +2089,30 @@ var Lr = {
|
|
|
2090
2089
|
} catch {
|
|
2091
2090
|
return null;
|
|
2092
2091
|
}
|
|
2093
|
-
},
|
|
2094
|
-
let n =
|
|
2092
|
+
}, Vi = (e) => e == null ? !0 : typeof e == "string" ? e.trim().length === 0 : Array.isArray(e) ? e.length === 0 || e.every(Vi) : typeof e == "object" && Object.values(e).every(Vi), Hi = (e) => !e || typeof e != "object" || Array.isArray(e) ? null : e, Ui = (e) => typeof e == "string" && e.trim().length > 0 ? e : null, Wi = (e) => Ui(e.mime_type) ?? Ui(e.mediaType) ?? Ui(e.mimeType), Gi = (e) => !!e?.startsWith("image/"), Ki = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, qi = (e, t) => {
|
|
2093
|
+
let n = Hi(e);
|
|
2095
2094
|
if (!n) return null;
|
|
2096
|
-
let r =
|
|
2097
|
-
if (i &&
|
|
2095
|
+
let r = Wi(n), i = Ui(n.data);
|
|
2096
|
+
if (i && Gi(r)) return {
|
|
2098
2097
|
type: "image",
|
|
2099
2098
|
src: `data:${r};base64,${i}`,
|
|
2100
2099
|
alt: t
|
|
2101
2100
|
};
|
|
2102
|
-
let a =
|
|
2103
|
-
return a && (
|
|
2101
|
+
let a = Ui(n.url) ?? Ui(n.src);
|
|
2102
|
+
return a && (Gi(r) || Ki.test(a)) ? {
|
|
2104
2103
|
type: "image",
|
|
2105
2104
|
src: a,
|
|
2106
2105
|
alt: t
|
|
2107
2106
|
} : null;
|
|
2108
|
-
},
|
|
2109
|
-
let t =
|
|
2107
|
+
}, Ji = (e) => {
|
|
2108
|
+
let t = Hi(e);
|
|
2110
2109
|
if (!t) return null;
|
|
2111
|
-
let n =
|
|
2110
|
+
let n = Ui(t.path) ?? Ui(t.filePath) ?? Ui(t.filename), r = Ui(t.content) ?? Ui(t.body) ?? Ui(t.text);
|
|
2112
2111
|
return !n || r === null ? null : {
|
|
2113
2112
|
filePath: n,
|
|
2114
2113
|
content: r
|
|
2115
2114
|
};
|
|
2116
|
-
},
|
|
2115
|
+
}, Yi = {
|
|
2117
2116
|
css: "css",
|
|
2118
2117
|
html: "html",
|
|
2119
2118
|
js: "js",
|
|
@@ -2125,88 +2124,88 @@ var Lr = {
|
|
|
2125
2124
|
tsx: "tsx",
|
|
2126
2125
|
yaml: "yaml",
|
|
2127
2126
|
yml: "yaml"
|
|
2128
|
-
},
|
|
2127
|
+
}, Xi = (e) => {
|
|
2129
2128
|
let t = e.split(".").pop()?.toLowerCase();
|
|
2130
|
-
return t ?
|
|
2131
|
-
},
|
|
2129
|
+
return t ? Yi[t] ?? t : "text";
|
|
2130
|
+
}, Zi = (e, t) => t.length === 0 ? [] : [{
|
|
2132
2131
|
type: "text",
|
|
2133
2132
|
text: e
|
|
2134
|
-
}, ...t],
|
|
2133
|
+
}, ...t], Qi = (e, t) => {
|
|
2135
2134
|
let n = [];
|
|
2136
2135
|
for (let r of e) {
|
|
2137
|
-
let e =
|
|
2136
|
+
let e = Hi(r), i = Ui(e?.type);
|
|
2138
2137
|
if (i === "image") {
|
|
2139
|
-
let e =
|
|
2138
|
+
let e = qi(r, t);
|
|
2140
2139
|
e && n.push(e);
|
|
2141
2140
|
continue;
|
|
2142
2141
|
}
|
|
2143
2142
|
if (i === "text") {
|
|
2144
|
-
let t =
|
|
2143
|
+
let t = Ui(e?.text);
|
|
2145
2144
|
t && n.push({
|
|
2146
2145
|
type: "text",
|
|
2147
2146
|
text: t
|
|
2148
2147
|
});
|
|
2149
2148
|
continue;
|
|
2150
2149
|
}
|
|
2151
|
-
n.push(...
|
|
2150
|
+
n.push(...ta(r, t));
|
|
2152
2151
|
}
|
|
2153
2152
|
return n;
|
|
2154
|
-
},
|
|
2155
|
-
let t =
|
|
2153
|
+
}, $i = (e) => {
|
|
2154
|
+
let t = Ji(e);
|
|
2156
2155
|
return t ? [{
|
|
2157
2156
|
type: "code",
|
|
2158
|
-
language:
|
|
2157
|
+
language: Xi(t.filePath),
|
|
2159
2158
|
code: t.content
|
|
2160
2159
|
}] : null;
|
|
2161
|
-
},
|
|
2162
|
-
let t =
|
|
2160
|
+
}, ea = (e) => {
|
|
2161
|
+
let t = Hi(e), n = Ui(t?.attachment_name) ?? Ui(t?.attachmentName), r = Ui(t?.attachment_file_id) ?? Ui(t?.attachmentFileId);
|
|
2163
2162
|
return !n && !r ? null : [{
|
|
2164
2163
|
type: "text",
|
|
2165
2164
|
text: n ?? `Attachment ${r}`
|
|
2166
2165
|
}];
|
|
2167
|
-
},
|
|
2168
|
-
if (
|
|
2169
|
-
let n =
|
|
2166
|
+
}, ta = (e, t) => {
|
|
2167
|
+
if (Vi(e)) return [];
|
|
2168
|
+
let n = qi(e, t);
|
|
2170
2169
|
if (n) return [n];
|
|
2171
|
-
if (Array.isArray(e)) return
|
|
2172
|
-
let r =
|
|
2170
|
+
if (Array.isArray(e)) return Qi(e, t);
|
|
2171
|
+
let r = $i(e);
|
|
2173
2172
|
if (r) return r;
|
|
2174
|
-
let i =
|
|
2173
|
+
let i = ea(e);
|
|
2175
2174
|
if (i) return i;
|
|
2176
|
-
let a =
|
|
2175
|
+
let a = Bi(e);
|
|
2177
2176
|
return a?.trim() ? [{
|
|
2178
2177
|
type: "code",
|
|
2179
2178
|
language: typeof e == "string" ? "text" : "json",
|
|
2180
2179
|
code: a
|
|
2181
2180
|
}] : [];
|
|
2182
|
-
},
|
|
2183
|
-
let t = [], n =
|
|
2184
|
-
return
|
|
2181
|
+
}, na = (e) => {
|
|
2182
|
+
let t = [], n = Ii(e.tool);
|
|
2183
|
+
return Li(e.state?.status) && e.state?.errorText && t.push({
|
|
2185
2184
|
type: "comment",
|
|
2186
2185
|
text: e.state.errorText
|
|
2187
|
-
}), t.push(...
|
|
2188
|
-
},
|
|
2186
|
+
}), t.push(...Zi("Input", ta(e.state?.input, `${n} input`))), t.push(...Zi("Output", ta(e.state?.output, `${n} output`))), t;
|
|
2187
|
+
}, ra = (e) => {
|
|
2189
2188
|
let t = [{
|
|
2190
2189
|
kind: "text",
|
|
2191
|
-
text:
|
|
2190
|
+
text: Ii(e.tool),
|
|
2192
2191
|
bold: !0
|
|
2193
|
-
}], n =
|
|
2192
|
+
}], n = Ji(e.state?.output);
|
|
2194
2193
|
n && t.push({
|
|
2195
2194
|
kind: "link",
|
|
2196
2195
|
text: n.filePath,
|
|
2197
2196
|
filePath: n.filePath
|
|
2198
2197
|
});
|
|
2199
|
-
let r =
|
|
2198
|
+
let r = zi(e.state?.status);
|
|
2200
2199
|
return r && t.push({
|
|
2201
2200
|
kind: "text",
|
|
2202
2201
|
text: r,
|
|
2203
2202
|
muted: !0
|
|
2204
2203
|
}), {
|
|
2205
|
-
indicator:
|
|
2204
|
+
indicator: Ri(e),
|
|
2206
2205
|
title: t,
|
|
2207
|
-
blocks:
|
|
2206
|
+
blocks: na(e)
|
|
2208
2207
|
};
|
|
2209
|
-
},
|
|
2208
|
+
}, ia = (e) => e.kind === "text" || e.kind === "link" ? e.text.trim().length > 0 : e.kind !== "diff" || e.fileName.trim().length > 0, aa = (e) => {
|
|
2210
2209
|
switch (e.type) {
|
|
2211
2210
|
case "comment":
|
|
2212
2211
|
case "code":
|
|
@@ -2219,45 +2218,45 @@ var Lr = {
|
|
|
2219
2218
|
case "input":
|
|
2220
2219
|
case "component": return !0;
|
|
2221
2220
|
}
|
|
2222
|
-
},
|
|
2223
|
-
let t = e.title.some(
|
|
2221
|
+
}, oa = (e) => {
|
|
2222
|
+
let t = e.title.some(ia), n = (e.blocks ?? []).some(aa);
|
|
2224
2223
|
return t || n;
|
|
2225
|
-
},
|
|
2226
|
-
...
|
|
2224
|
+
}, sa = (e) => e ? {
|
|
2225
|
+
...Ni(),
|
|
2227
2226
|
...e
|
|
2228
|
-
} :
|
|
2227
|
+
} : Ni(), ca = (e, t) => {
|
|
2229
2228
|
let n = e.tool ?? "tool";
|
|
2230
|
-
for (let e of
|
|
2229
|
+
for (let e of dr(n)) {
|
|
2231
2230
|
let n = t[e];
|
|
2232
2231
|
if (n) return n;
|
|
2233
2232
|
}
|
|
2234
|
-
},
|
|
2235
|
-
let r =
|
|
2233
|
+
}, la = (e, t, n) => {
|
|
2234
|
+
let r = ca(e, t);
|
|
2236
2235
|
if (r) {
|
|
2237
2236
|
let t = r(e, n);
|
|
2238
2237
|
if (t) return t;
|
|
2239
2238
|
}
|
|
2240
|
-
return
|
|
2241
|
-
},
|
|
2242
|
-
let n =
|
|
2243
|
-
return { items: e.map((e) =>
|
|
2244
|
-
},
|
|
2239
|
+
return ra(e);
|
|
2240
|
+
}, ua = (e, t) => {
|
|
2241
|
+
let n = sa(t?.toolRenderers);
|
|
2242
|
+
return { items: e.map((e) => la(e, n, t)).filter(oa) };
|
|
2243
|
+
}, da = ve(() => import("./diff-editor-CGpeyoCE.js").then((e) => e.n).then((e) => ({ default: e.DiffEditor }))), fa = (e) => {
|
|
2245
2244
|
let t = q(2), n;
|
|
2246
|
-
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ J(
|
|
2245
|
+
return t[0] === e ? n = t[1] : (n = /* @__PURE__ */ J(ge, {
|
|
2247
2246
|
fallback: null,
|
|
2248
|
-
children: /* @__PURE__ */ J(
|
|
2247
|
+
children: /* @__PURE__ */ J(da, { ...e })
|
|
2249
2248
|
}), t[0] = e, t[1] = n), n;
|
|
2250
2249
|
};
|
|
2251
2250
|
//#endregion
|
|
2252
2251
|
//#region src/components/chat-ui/components/timeline-indicator.tsx
|
|
2253
|
-
function
|
|
2252
|
+
function pa(e) {
|
|
2254
2253
|
let t = q(10), { ind: n } = e;
|
|
2255
2254
|
if (!n || n.type === "none") return null;
|
|
2256
2255
|
if (n.type === "icon") {
|
|
2257
2256
|
let e;
|
|
2258
|
-
t[0] === n.icon ? e = t[1] : (e =
|
|
2257
|
+
t[0] === n.icon ? e = t[1] : (e = gr(n.icon), t[0] = n.icon, t[1] = e);
|
|
2259
2258
|
let r = e, i;
|
|
2260
|
-
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(
|
|
2259
|
+
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(ce.Indicator, {
|
|
2261
2260
|
outline: "none",
|
|
2262
2261
|
border: "none",
|
|
2263
2262
|
background: "bg",
|
|
@@ -2273,68 +2272,68 @@ function fa(e) {
|
|
|
2273
2272
|
}), t[2] = r, t[3] = i), i;
|
|
2274
2273
|
}
|
|
2275
2274
|
let r;
|
|
2276
|
-
t[4] !== n.alt || t[5] !== n.src ? (r = /* @__PURE__ */ J(
|
|
2275
|
+
t[4] !== n.alt || t[5] !== n.src ? (r = /* @__PURE__ */ J(A.Image, {
|
|
2277
2276
|
src: n.src,
|
|
2278
2277
|
alt: n.alt
|
|
2279
2278
|
}), t[4] = n.alt, t[5] = n.src, t[6] = r) : r = t[6];
|
|
2280
2279
|
let i;
|
|
2281
|
-
t[7] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ J(
|
|
2280
|
+
t[7] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ J(A.Fallback, {
|
|
2282
2281
|
background: "bg.muted",
|
|
2283
2282
|
color: "fg.muted"
|
|
2284
2283
|
}), t[7] = i) : i = t[7];
|
|
2285
2284
|
let a;
|
|
2286
|
-
return t[8] === r ? a = t[9] : (a = /* @__PURE__ */ J(
|
|
2285
|
+
return t[8] === r ? a = t[9] : (a = /* @__PURE__ */ J(ce.Indicator, { children: /* @__PURE__ */ Y(A.Root, {
|
|
2287
2286
|
boxSize: "full",
|
|
2288
2287
|
children: [r, i]
|
|
2289
2288
|
}) }), t[8] = r, t[9] = a), a;
|
|
2290
2289
|
}
|
|
2291
2290
|
//#endregion
|
|
2292
2291
|
//#region src/components/chat-ui/components/timeline-title.tsx
|
|
2293
|
-
var
|
|
2292
|
+
var ma = (e, t, n, r = !1) => {
|
|
2294
2293
|
r && e.stopPropagation(), t.href || e.preventDefault(), t.filePath && n?.(t.filePath);
|
|
2295
2294
|
};
|
|
2296
|
-
function
|
|
2295
|
+
function ha(e) {
|
|
2297
2296
|
let t = q(6), { seg: n } = e, r;
|
|
2298
|
-
t[0] !== n.alt || t[1] !== n.src ? (r = /* @__PURE__ */ J(
|
|
2297
|
+
t[0] !== n.alt || t[1] !== n.src ? (r = /* @__PURE__ */ J(A.Image, {
|
|
2299
2298
|
src: n.src,
|
|
2300
2299
|
alt: n.alt
|
|
2301
2300
|
}), t[0] = n.alt, t[1] = n.src, t[2] = r) : r = t[2];
|
|
2302
2301
|
let i;
|
|
2303
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ J(
|
|
2302
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ J(A.Fallback, {
|
|
2304
2303
|
background: "bg.muted",
|
|
2305
2304
|
color: "fg.muted"
|
|
2306
2305
|
}), t[3] = i) : i = t[3];
|
|
2307
2306
|
let a;
|
|
2308
|
-
return t[4] === r ? a = t[5] : (a = /* @__PURE__ */ Y(
|
|
2307
|
+
return t[4] === r ? a = t[5] : (a = /* @__PURE__ */ Y(A.Root, {
|
|
2309
2308
|
width: "1.5rem",
|
|
2310
2309
|
height: "1.5rem",
|
|
2311
2310
|
children: [r, i]
|
|
2312
2311
|
}), t[4] = r, t[5] = a), a;
|
|
2313
2312
|
}
|
|
2314
|
-
function
|
|
2313
|
+
function ga(e) {
|
|
2315
2314
|
let t = q(9), { seg: n, onOpenFile: r } = e, i = n.additions ?? 0, a = n.deletions ?? 0, o;
|
|
2316
2315
|
t[0] !== r || t[1] !== n.fileName || t[2] !== n.filePath ? (o = () => {
|
|
2317
2316
|
let e = n.filePath ?? n.fileName;
|
|
2318
2317
|
r?.(e);
|
|
2319
2318
|
}, t[0] = r, t[1] = n.fileName, t[2] = n.filePath, t[3] = o) : o = t[3];
|
|
2320
2319
|
let s;
|
|
2321
|
-
return t[4] !== n.fileName || t[5] !== i || t[6] !== a || t[7] !== o ? (s = /* @__PURE__ */ J(
|
|
2320
|
+
return t[4] !== n.fileName || t[5] !== i || t[6] !== a || t[7] !== o ? (s = /* @__PURE__ */ J(O, {
|
|
2322
2321
|
fileName: n.fileName,
|
|
2323
2322
|
additions: i,
|
|
2324
2323
|
deletions: a,
|
|
2325
2324
|
onClickFileLink: o
|
|
2326
2325
|
}), t[4] = n.fileName, t[5] = i, t[6] = a, t[7] = o, t[8] = s) : s = t[8], s;
|
|
2327
2326
|
}
|
|
2328
|
-
function
|
|
2327
|
+
function _a(e) {
|
|
2329
2328
|
let t = q(13), { seg: n, onOpenFile: r } = e, i = n.bold ? "medium" : void 0, a = !!(n.href || n.filePath), o = n.href ?? "#", s = (n.muted, "fg.muted"), c = a ? "pointer" : "default", l;
|
|
2330
|
-
t[0] !== r || t[1] !== n ? (l = (e) =>
|
|
2329
|
+
t[0] !== r || t[1] !== n ? (l = (e) => ma(e, n, r, !0), t[0] = r, t[1] = n, t[2] = l) : l = t[2];
|
|
2331
2330
|
let u = n.muted ? "fg.muted" : "fg.blue-dark", d;
|
|
2332
2331
|
t[3] === u ? d = t[4] : (d = {
|
|
2333
2332
|
textDecoration: "underline",
|
|
2334
2333
|
color: u
|
|
2335
2334
|
}, t[3] = u, t[4] = d);
|
|
2336
2335
|
let f;
|
|
2337
|
-
return t[5] !== i || t[6] !== n.text || t[7] !== o || t[8] !== s || t[9] !== c || t[10] !== l || t[11] !== d ? (f = /* @__PURE__ */ J(
|
|
2336
|
+
return t[5] !== i || t[6] !== n.text || t[7] !== o || t[8] !== s || t[9] !== c || t[10] !== l || t[11] !== d ? (f = /* @__PURE__ */ J(ne, {
|
|
2338
2337
|
href: o,
|
|
2339
2338
|
fontWeight: i,
|
|
2340
2339
|
color: s,
|
|
@@ -2345,16 +2344,16 @@ function ga(e) {
|
|
|
2345
2344
|
children: n.text
|
|
2346
2345
|
}), t[5] = i, t[6] = n.text, t[7] = o, t[8] = s, t[9] = c, t[10] = l, t[11] = d, t[12] = f) : f = t[12], f;
|
|
2347
2346
|
}
|
|
2348
|
-
function
|
|
2347
|
+
function va(e) {
|
|
2349
2348
|
let t = q(12), { seg: n, onOpenFile: r } = e, i = n.bold ? "medium" : void 0, a = n.href ?? "#", o = n.muted ? "fg.muted" : "accent.primary", s;
|
|
2350
|
-
t[0] !== r || t[1] !== n ? (s = (e) =>
|
|
2349
|
+
t[0] !== r || t[1] !== n ? (s = (e) => ma(e, n, r), t[0] = r, t[1] = n, t[2] = s) : s = t[2];
|
|
2351
2350
|
let c = n.muted ? "fg.muted" : "accent.primary", l;
|
|
2352
2351
|
t[3] === c ? l = t[4] : (l = {
|
|
2353
2352
|
color: c,
|
|
2354
2353
|
textDecoration: "underline"
|
|
2355
2354
|
}, t[3] = c, t[4] = l);
|
|
2356
2355
|
let u;
|
|
2357
|
-
return t[5] !== i || t[6] !== n.text || t[7] !== a || t[8] !== o || t[9] !== s || t[10] !== l ? (u = /* @__PURE__ */ J(
|
|
2356
|
+
return t[5] !== i || t[6] !== n.text || t[7] !== a || t[8] !== o || t[9] !== s || t[10] !== l ? (u = /* @__PURE__ */ J(ne, {
|
|
2358
2357
|
href: a,
|
|
2359
2358
|
fontWeight: i,
|
|
2360
2359
|
color: o,
|
|
@@ -2364,7 +2363,7 @@ function _a(e) {
|
|
|
2364
2363
|
children: n.text
|
|
2365
2364
|
}), t[5] = i, t[6] = n.text, t[7] = a, t[8] = o, t[9] = s, t[10] = l, t[11] = u) : u = t[11], u;
|
|
2366
2365
|
}
|
|
2367
|
-
function
|
|
2366
|
+
function ya(e) {
|
|
2368
2367
|
let n = q(14), { seg: r, isClickable: i } = e, a = r.bold ? "medium" : void 0, o = r.monospace ? "mono/XS" : void 0, s = r.truncate ? "0" : void 0, c = r.truncate ? "hidden" : void 0, l = r.truncate ? "ellipsis" : void 0, u = r.truncate ? "nowrap" : void 0, d = i && !r.muted ? "fg" : "fg.muted", f;
|
|
2369
2368
|
n[0] === d ? f = n[1] : (f = { color: d }, n[0] = d, n[1] = f);
|
|
2370
2369
|
let p;
|
|
@@ -2387,22 +2386,22 @@ function va(e) {
|
|
|
2387
2386
|
children: m
|
|
2388
2387
|
}), n[11] = r.text, n[12] = m, n[13] = h) : h = n[13], h;
|
|
2389
2388
|
}
|
|
2390
|
-
function
|
|
2389
|
+
function ba(e) {
|
|
2391
2390
|
let t = q(22), { seg: n, isClickable: r, onOpenFile: i } = e;
|
|
2392
|
-
if (
|
|
2391
|
+
if (v() && (n.kind === "link" || n.kind === "diff") && (n.filePath || n.kind === "diff")) {
|
|
2393
2392
|
let e = n.filePath ?? (n.kind === "diff" ? n.fileName : n.text), r;
|
|
2394
2393
|
t[0] === e ? r = t[1] : (r = {
|
|
2395
2394
|
source: e,
|
|
2396
2395
|
origin: "tool"
|
|
2397
2396
|
}, t[0] = e, t[1] = r);
|
|
2398
2397
|
let i;
|
|
2399
|
-
t[2] !== n.additions || t[3] !== n.deletions || t[4] !== n.fileName || t[5] !== n.kind || t[6] !== n.text ? (i = n.kind === "diff" ? /* @__PURE__ */ J(
|
|
2398
|
+
t[2] !== n.additions || t[3] !== n.deletions || t[4] !== n.fileName || t[5] !== n.kind || t[6] !== n.text ? (i = n.kind === "diff" ? /* @__PURE__ */ J(O, {
|
|
2400
2399
|
fileName: n.fileName,
|
|
2401
2400
|
additions: n.additions ?? 0,
|
|
2402
2401
|
deletions: n.deletions ?? 0
|
|
2403
2402
|
}) : n.text, t[2] = n.additions, t[3] = n.deletions, t[4] = n.fileName, t[5] = n.kind, t[6] = n.text, t[7] = i) : i = t[7];
|
|
2404
2403
|
let a;
|
|
2405
|
-
return t[8] !== r || t[9] !== i ? (a = /* @__PURE__ */ J(
|
|
2404
|
+
return t[8] !== r || t[9] !== i ? (a = /* @__PURE__ */ J(y, {
|
|
2406
2405
|
candidate: r,
|
|
2407
2406
|
children: i
|
|
2408
2407
|
}), t[8] = r, t[9] = i, t[10] = a) : a = t[10], a;
|
|
@@ -2410,28 +2409,28 @@ function ya(e) {
|
|
|
2410
2409
|
switch (n.kind) {
|
|
2411
2410
|
case "avatar": {
|
|
2412
2411
|
let e;
|
|
2413
|
-
return t[11] === n ? e = t[12] : (e = /* @__PURE__ */ J(
|
|
2412
|
+
return t[11] === n ? e = t[12] : (e = /* @__PURE__ */ J(ha, { seg: n }), t[11] = n, t[12] = e), e;
|
|
2414
2413
|
}
|
|
2415
2414
|
case "diff": {
|
|
2416
2415
|
let e;
|
|
2417
|
-
return t[13] !== i || t[14] !== n ? (e = /* @__PURE__ */ J(
|
|
2416
|
+
return t[13] !== i || t[14] !== n ? (e = /* @__PURE__ */ J(ga, {
|
|
2418
2417
|
seg: n,
|
|
2419
2418
|
onOpenFile: i
|
|
2420
2419
|
}), t[13] = i, t[14] = n, t[15] = e) : e = t[15], e;
|
|
2421
2420
|
}
|
|
2422
2421
|
case "link": {
|
|
2423
2422
|
let e;
|
|
2424
|
-
return t[16] !== i || t[17] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ J(
|
|
2423
|
+
return t[16] !== i || t[17] !== n ? (e = n.variant === "bubble" ? /* @__PURE__ */ J(_a, {
|
|
2425
2424
|
seg: n,
|
|
2426
2425
|
onOpenFile: i
|
|
2427
|
-
}) : /* @__PURE__ */ J(
|
|
2426
|
+
}) : /* @__PURE__ */ J(va, {
|
|
2428
2427
|
seg: n,
|
|
2429
2428
|
onOpenFile: i
|
|
2430
2429
|
}), t[16] = i, t[17] = n, t[18] = e) : e = t[18], e;
|
|
2431
2430
|
}
|
|
2432
2431
|
case "text": {
|
|
2433
2432
|
let e;
|
|
2434
|
-
return t[19] !== r || t[20] !== n ? (e = /* @__PURE__ */ J(
|
|
2433
|
+
return t[19] !== r || t[20] !== n ? (e = /* @__PURE__ */ J(ya, {
|
|
2435
2434
|
seg: n,
|
|
2436
2435
|
isClickable: r
|
|
2437
2436
|
}), t[19] = r, t[20] = n, t[21] = e) : e = t[21], e;
|
|
@@ -2441,10 +2440,10 @@ function ya(e) {
|
|
|
2441
2440
|
}
|
|
2442
2441
|
//#endregion
|
|
2443
2442
|
//#region src/components/chat-ui/components/timeline.tsx
|
|
2444
|
-
var
|
|
2445
|
-
function
|
|
2443
|
+
var xa = ce;
|
|
2444
|
+
function Sa(e) {
|
|
2446
2445
|
let t = q(5), { code: r, language: i } = e, a = i ? `${i} code block` : "code block", o;
|
|
2447
|
-
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ J(
|
|
2446
|
+
t[0] === r ? o = t[1] : (o = /* @__PURE__ */ J(j, {
|
|
2448
2447
|
as: "code",
|
|
2449
2448
|
children: r
|
|
2450
2449
|
}), t[0] = r, t[1] = o);
|
|
@@ -2457,7 +2456,7 @@ function xa(e) {
|
|
|
2457
2456
|
borderRadius: "md",
|
|
2458
2457
|
showHorizontalScrollbar: !0,
|
|
2459
2458
|
showVerticalScrollbar: !1,
|
|
2460
|
-
children: /* @__PURE__ */ J(
|
|
2459
|
+
children: /* @__PURE__ */ J(j, {
|
|
2461
2460
|
as: "pre",
|
|
2462
2461
|
padding: "sm",
|
|
2463
2462
|
textStyle: "mono/XS",
|
|
@@ -2467,25 +2466,25 @@ function xa(e) {
|
|
|
2467
2466
|
})
|
|
2468
2467
|
}), t[2] = a, t[3] = o, t[4] = s) : s = t[4], s;
|
|
2469
2468
|
}
|
|
2470
|
-
function
|
|
2469
|
+
function Ca(e) {
|
|
2471
2470
|
let t = q(38), { b: n, onOpenFile: r } = e;
|
|
2472
2471
|
switch (n.type) {
|
|
2473
2472
|
case "comment": {
|
|
2474
2473
|
let e;
|
|
2475
|
-
t[0] === n.text ? e = t[1] : (e = /* @__PURE__ */ J(
|
|
2474
|
+
t[0] === n.text ? e = t[1] : (e = /* @__PURE__ */ J(N.Body, { children: n.text }), t[0] = n.text, t[1] = e);
|
|
2476
2475
|
let r;
|
|
2477
|
-
t[2] === n.reactions ? r = t[3] : (r = n.reactions?.clap ? /* @__PURE__ */ J(
|
|
2476
|
+
t[2] === n.reactions ? r = t[3] : (r = n.reactions?.clap ? /* @__PURE__ */ J(N.Footer, { children: /* @__PURE__ */ Y(M, { children: ["👏 ", n.reactions.clap] }) }) : null, t[2] = n.reactions, t[3] = r);
|
|
2478
2477
|
let i;
|
|
2479
|
-
return t[4] !== e || t[5] !== r ? (i = /* @__PURE__ */ Y(
|
|
2478
|
+
return t[4] !== e || t[5] !== r ? (i = /* @__PURE__ */ Y(N.Root, { children: [e, r] }), t[4] = e, t[5] = r, t[6] = i) : i = t[6], i;
|
|
2480
2479
|
}
|
|
2481
2480
|
case "code": {
|
|
2482
2481
|
let e;
|
|
2483
|
-
return t[7] !== n.code || t[8] !== n.language ? (e = /* @__PURE__ */ J(
|
|
2482
|
+
return t[7] !== n.code || t[8] !== n.language ? (e = /* @__PURE__ */ J(N.Root, {
|
|
2484
2483
|
border: "0",
|
|
2485
2484
|
padding: "0",
|
|
2486
|
-
children: /* @__PURE__ */ J(
|
|
2485
|
+
children: /* @__PURE__ */ J(N.Body, {
|
|
2487
2486
|
padding: "0",
|
|
2488
|
-
children: /* @__PURE__ */ J(
|
|
2487
|
+
children: /* @__PURE__ */ J(Sa, {
|
|
2489
2488
|
language: n.language,
|
|
2490
2489
|
code: n.code
|
|
2491
2490
|
})
|
|
@@ -2494,16 +2493,16 @@ function Sa(e) {
|
|
|
2494
2493
|
}
|
|
2495
2494
|
case "diff": {
|
|
2496
2495
|
let e = n.sideBySide ?? !1, r;
|
|
2497
|
-
return t[10] !== n.language || t[11] !== n.modified || t[12] !== n.original || t[13] !== e ? (r = /* @__PURE__ */ J(
|
|
2496
|
+
return t[10] !== n.language || t[11] !== n.modified || t[12] !== n.original || t[13] !== e ? (r = /* @__PURE__ */ J(N.Root, {
|
|
2498
2497
|
border: "0",
|
|
2499
2498
|
padding: "0",
|
|
2500
|
-
children: /* @__PURE__ */ J(
|
|
2499
|
+
children: /* @__PURE__ */ J(N.Body, {
|
|
2501
2500
|
padding: "0",
|
|
2502
|
-
children: /* @__PURE__ */ J(
|
|
2501
|
+
children: /* @__PURE__ */ J(j, {
|
|
2503
2502
|
height: "240px",
|
|
2504
2503
|
minW: "320px",
|
|
2505
2504
|
overflow: "hidden",
|
|
2506
|
-
children: /* @__PURE__ */ J(
|
|
2505
|
+
children: /* @__PURE__ */ J(fa, {
|
|
2507
2506
|
original: n.original,
|
|
2508
2507
|
modified: n.modified,
|
|
2509
2508
|
language: n.language,
|
|
@@ -2516,9 +2515,9 @@ function Sa(e) {
|
|
|
2516
2515
|
}
|
|
2517
2516
|
case "text": {
|
|
2518
2517
|
let e;
|
|
2519
|
-
return t[15] === n.text ? e = t[16] : (e = /* @__PURE__ */ J(
|
|
2518
|
+
return t[15] === n.text ? e = t[16] : (e = /* @__PURE__ */ J(N.Root, {
|
|
2520
2519
|
background: "transparent",
|
|
2521
|
-
children: /* @__PURE__ */ J(
|
|
2520
|
+
children: /* @__PURE__ */ J(N.Body, {
|
|
2522
2521
|
padding: "sm",
|
|
2523
2522
|
children: /* @__PURE__ */ J(G, {
|
|
2524
2523
|
textStyle: "label/S/regular",
|
|
@@ -2529,15 +2528,15 @@ function Sa(e) {
|
|
|
2529
2528
|
}
|
|
2530
2529
|
case "todo-list": {
|
|
2531
2530
|
let e;
|
|
2532
|
-
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ J(
|
|
2531
|
+
return t[17] === n.items ? e = t[18] : (e = /* @__PURE__ */ J(kn, { items: n.items }), t[17] = n.items, t[18] = e), e;
|
|
2533
2532
|
}
|
|
2534
2533
|
case "question-form": {
|
|
2535
2534
|
let e;
|
|
2536
|
-
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ J(
|
|
2535
|
+
return t[19] === n.questions ? e = t[20] : (e = /* @__PURE__ */ J(Nn, { questions: n.questions }), t[19] = n.questions, t[20] = e), e;
|
|
2537
2536
|
}
|
|
2538
2537
|
case "references": {
|
|
2539
2538
|
let e;
|
|
2540
|
-
t[21] === n.references ? e = t[22] : (e = n.references.map(
|
|
2539
|
+
t[21] === n.references ? e = t[22] : (e = n.references.map(wa), t[21] = n.references, t[22] = e);
|
|
2541
2540
|
let r;
|
|
2542
2541
|
return t[23] === e ? r = t[24] : (r = /* @__PURE__ */ J(W, {
|
|
2543
2542
|
mt: "xs",
|
|
@@ -2568,11 +2567,11 @@ function Sa(e) {
|
|
|
2568
2567
|
children: n.caption
|
|
2569
2568
|
}) : null, t[28] = n.caption, t[29] = r);
|
|
2570
2569
|
let i;
|
|
2571
|
-
return t[30] !== e || t[31] !== r ? (i = /* @__PURE__ */ J(
|
|
2570
|
+
return t[30] !== e || t[31] !== r ? (i = /* @__PURE__ */ J(N.Root, {
|
|
2572
2571
|
border: "0",
|
|
2573
2572
|
padding: "0",
|
|
2574
2573
|
background: "transparent",
|
|
2575
|
-
children: /* @__PURE__ */ Y(
|
|
2574
|
+
children: /* @__PURE__ */ Y(N.Body, {
|
|
2576
2575
|
padding: "0",
|
|
2577
2576
|
children: [e, r]
|
|
2578
2577
|
})
|
|
@@ -2582,12 +2581,12 @@ function Sa(e) {
|
|
|
2582
2581
|
let e;
|
|
2583
2582
|
t[33] !== n || t[34] !== r ? (e = n.render({ onOpenFile: r }), t[33] = n, t[34] = r, t[35] = e) : e = t[35];
|
|
2584
2583
|
let i;
|
|
2585
|
-
return t[36] === e ? i = t[37] : (i = /* @__PURE__ */ J(
|
|
2584
|
+
return t[36] === e ? i = t[37] : (i = /* @__PURE__ */ J(me, { children: e }), t[36] = e, t[37] = i), i;
|
|
2586
2585
|
}
|
|
2587
2586
|
}
|
|
2588
2587
|
}
|
|
2589
|
-
function
|
|
2590
|
-
return /* @__PURE__ */ J(
|
|
2588
|
+
function wa(e) {
|
|
2589
|
+
return /* @__PURE__ */ J(y, {
|
|
2591
2590
|
candidate: {
|
|
2592
2591
|
source: e,
|
|
2593
2592
|
origin: "tool"
|
|
@@ -2595,13 +2594,13 @@ function Ca(e) {
|
|
|
2595
2594
|
children: /* @__PURE__ */ J(a, { fileName: e })
|
|
2596
2595
|
}, e);
|
|
2597
2596
|
}
|
|
2598
|
-
function
|
|
2597
|
+
function Ta(e) {
|
|
2599
2598
|
let t = q(23), { item: n, itemKey: r, isOpen: i, canExpand: a, hasBlocks: o, onToggle: s, onOpenFile: c } = e, l;
|
|
2600
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ J(
|
|
2599
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ J(xa.Separator, {}), t[0] = l) : l = t[0];
|
|
2601
2600
|
let u;
|
|
2602
|
-
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ Y(
|
|
2601
|
+
t[1] === n.indicator ? u = t[2] : (u = /* @__PURE__ */ Y(xa.Connector, { children: [l, /* @__PURE__ */ J(pa, { ind: n.indicator })] }), t[1] = n.indicator, t[2] = u);
|
|
2603
2602
|
let d = i ? "auto" : "20px", f;
|
|
2604
|
-
t[3] !== a || t[4] !== i || t[5] !== n.title || t[6] !== r || t[7] !== c || t[8] !== s ? (f = n.title.length > 0 && /* @__PURE__ */ J(
|
|
2603
|
+
t[3] !== a || t[4] !== i || t[5] !== n.title || t[6] !== r || t[7] !== c || t[8] !== s ? (f = n.title.length > 0 && /* @__PURE__ */ J(xa.Title, {
|
|
2605
2604
|
className: "group",
|
|
2606
2605
|
fontWeight: "normal",
|
|
2607
2606
|
display: "flex",
|
|
@@ -2626,7 +2625,7 @@ function wa(e) {
|
|
|
2626
2625
|
minW: "0",
|
|
2627
2626
|
flex: "1",
|
|
2628
2627
|
overflow: "hidden",
|
|
2629
|
-
children: n.title.map((e, t) => /* @__PURE__ */ J(
|
|
2628
|
+
children: n.title.map((e, t) => /* @__PURE__ */ J(ba, {
|
|
2630
2629
|
seg: e,
|
|
2631
2630
|
isClickable: a,
|
|
2632
2631
|
onOpenFile: c
|
|
@@ -2639,48 +2638,48 @@ function wa(e) {
|
|
|
2639
2638
|
color: "transparent",
|
|
2640
2639
|
flexShrink: "0",
|
|
2641
2640
|
_groupHover: { color: "fg" },
|
|
2642
|
-
children: /* @__PURE__ */ J(
|
|
2641
|
+
children: /* @__PURE__ */ J(Ee, { size: 12 })
|
|
2643
2642
|
}) : null]
|
|
2644
2643
|
})
|
|
2645
2644
|
}), t[3] = a, t[4] = i, t[5] = n.title, t[6] = r, t[7] = c, t[8] = s, t[9] = f) : f = t[9];
|
|
2646
2645
|
let p;
|
|
2647
|
-
t[10] !== o || t[11] !== i || t[12] !== n.blocks || t[13] !== c ? (p = o ? /* @__PURE__ */ J(
|
|
2646
|
+
t[10] !== o || t[11] !== i || t[12] !== n.blocks || t[13] !== c ? (p = o ? /* @__PURE__ */ J(j, {
|
|
2648
2647
|
display: "grid",
|
|
2649
2648
|
gridTemplateRows: i ? "1fr" : "0fr",
|
|
2650
2649
|
transition: "grid-template-rows 220ms ease",
|
|
2651
|
-
children: i ? /* @__PURE__ */ J(
|
|
2650
|
+
children: i ? /* @__PURE__ */ J(j, {
|
|
2652
2651
|
overflow: "hidden",
|
|
2653
2652
|
opacity: 1,
|
|
2654
2653
|
transform: "translateY(0)",
|
|
2655
2654
|
transition: "opacity 200ms ease, transform 200ms ease",
|
|
2656
|
-
children: n.blocks.map((e, t) => /* @__PURE__ */ J(
|
|
2655
|
+
children: n.blocks.map((e, t) => /* @__PURE__ */ J(j, { children: /* @__PURE__ */ J(Ca, {
|
|
2657
2656
|
b: e,
|
|
2658
2657
|
onOpenFile: c
|
|
2659
2658
|
}) }, t))
|
|
2660
2659
|
}) : null
|
|
2661
2660
|
}) : null, t[10] = o, t[11] = i, t[12] = n.blocks, t[13] = c, t[14] = p) : p = t[14];
|
|
2662
2661
|
let m;
|
|
2663
|
-
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ Y(
|
|
2662
|
+
t[15] !== d || t[16] !== f || t[17] !== p ? (m = /* @__PURE__ */ Y(xa.Content, {
|
|
2664
2663
|
h: d,
|
|
2665
2664
|
children: [f, p]
|
|
2666
2665
|
}), t[15] = d, t[16] = f, t[17] = p, t[18] = m) : m = t[18];
|
|
2667
2666
|
let h;
|
|
2668
|
-
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ Y(
|
|
2667
|
+
return t[19] !== r || t[20] !== u || t[21] !== m ? (h = /* @__PURE__ */ Y(xa.Item, {
|
|
2669
2668
|
gap: "xs",
|
|
2670
2669
|
children: [u, m]
|
|
2671
2670
|
}, r), t[19] = r, t[20] = u, t[21] = m, t[22] = h) : h = t[22], h;
|
|
2672
2671
|
}
|
|
2673
|
-
function
|
|
2674
|
-
let t = q(5), n =
|
|
2675
|
-
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(
|
|
2672
|
+
function Ea(e) {
|
|
2673
|
+
let t = q(5), n = v(), r = e.linkHandler ?? n, i;
|
|
2674
|
+
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(Da, { ...e }), t[0] = e, t[1] = i);
|
|
2676
2675
|
let a;
|
|
2677
|
-
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(
|
|
2676
|
+
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(_, {
|
|
2678
2677
|
handler: r,
|
|
2679
2678
|
children: i
|
|
2680
2679
|
}), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
|
|
2681
2680
|
}
|
|
2682
|
-
function
|
|
2683
|
-
let t = q(13), { data: n } = e, r =
|
|
2681
|
+
function Da(e) {
|
|
2682
|
+
let t = q(13), { data: n } = e, r = v(), i;
|
|
2684
2683
|
t[0] === r ? i = t[1] : (i = r ? (e) => {
|
|
2685
2684
|
r.open({
|
|
2686
2685
|
source: e,
|
|
@@ -2689,7 +2688,7 @@ function Ea(e) {
|
|
|
2689
2688
|
} : void 0, t[0] = r, t[1] = i);
|
|
2690
2689
|
let a = i, o;
|
|
2691
2690
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (o = {}, t[2] = o) : o = t[2];
|
|
2692
|
-
let [s, c] = Q(o), l =
|
|
2691
|
+
let [s, c] = Q(o), l = Oa, u;
|
|
2693
2692
|
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = (e) => {
|
|
2694
2693
|
c((t) => ({
|
|
2695
2694
|
...t,
|
|
@@ -2701,7 +2700,7 @@ function Ea(e) {
|
|
|
2701
2700
|
let e;
|
|
2702
2701
|
t[8] !== s || t[9] !== a ? (e = (e, t) => {
|
|
2703
2702
|
let n = l(e, t), r = (e.blocks?.length ?? 0) > 0, i = (e.expandable ?? !0) && r, o = i ? s[n] ?? !1 : r;
|
|
2704
|
-
return /* @__PURE__ */ J(
|
|
2703
|
+
return /* @__PURE__ */ J(Ta, {
|
|
2705
2704
|
item: e,
|
|
2706
2705
|
itemKey: n,
|
|
2707
2706
|
isOpen: o,
|
|
@@ -2713,53 +2712,53 @@ function Ea(e) {
|
|
|
2713
2712
|
}, t[8] = s, t[9] = a, t[10] = e) : e = t[10], f = n.items.map(e), t[4] = n.items, t[5] = s, t[6] = a, t[7] = f;
|
|
2714
2713
|
} else f = t[7];
|
|
2715
2714
|
let p;
|
|
2716
|
-
return t[11] === f ? p = t[12] : (p = /* @__PURE__ */ J(
|
|
2715
|
+
return t[11] === f ? p = t[12] : (p = /* @__PURE__ */ J(xa.Root, {
|
|
2717
2716
|
variant: "tool",
|
|
2718
2717
|
children: f
|
|
2719
2718
|
}), t[11] = f, t[12] = p), p;
|
|
2720
2719
|
}
|
|
2721
|
-
function
|
|
2720
|
+
function Oa(e, t) {
|
|
2722
2721
|
return e.id ? `id:${e.id}` : `idx:${t}`;
|
|
2723
2722
|
}
|
|
2724
2723
|
//#endregion
|
|
2725
2724
|
//#region src/components/chat-ui/components/tool-invocation-timeline.tsx
|
|
2726
|
-
var
|
|
2725
|
+
var ka = (e) => ur(e.tool ?? "").replace(/_/g, "") === "question", Aa = (e) => {
|
|
2727
2726
|
let t = e.state?.output;
|
|
2728
2727
|
return typeof t == "string" ? t.trim().length > 0 : Array.isArray(t) ? t.length > 0 : t && typeof t == "object" ? Object.keys(t).length > 0 : t != null;
|
|
2729
2728
|
};
|
|
2730
|
-
function
|
|
2729
|
+
function ja(e) {
|
|
2731
2730
|
let t = q(8), { invocations: n, labeledBlocks: r, hideQuestionForms: i, linkHandler: a } = e, o = i !== void 0 && i, s, c;
|
|
2732
2731
|
if (t[0] !== o || t[1] !== n || t[2] !== r) {
|
|
2733
2732
|
c = Symbol.for("react.early_return_sentinel");
|
|
2734
2733
|
bb0: {
|
|
2735
|
-
let e = o ? n.filter(
|
|
2734
|
+
let e = o ? n.filter(Ma) : n;
|
|
2736
2735
|
if (e.length === 0) {
|
|
2737
2736
|
c = null;
|
|
2738
2737
|
break bb0;
|
|
2739
2738
|
}
|
|
2740
|
-
s =
|
|
2739
|
+
s = ua(e, { labeledBlocks: r });
|
|
2741
2740
|
}
|
|
2742
2741
|
t[0] = o, t[1] = n, t[2] = r, t[3] = s, t[4] = c;
|
|
2743
2742
|
} else s = t[3], c = t[4];
|
|
2744
2743
|
if (c !== Symbol.for("react.early_return_sentinel")) return c;
|
|
2745
2744
|
let l = s, u;
|
|
2746
|
-
return t[5] !== l || t[6] !== a ? (u = /* @__PURE__ */ J(
|
|
2745
|
+
return t[5] !== l || t[6] !== a ? (u = /* @__PURE__ */ J(Ea, {
|
|
2747
2746
|
data: l,
|
|
2748
2747
|
linkHandler: a
|
|
2749
2748
|
}), t[5] = l, t[6] = a, t[7] = u) : u = t[7], u;
|
|
2750
2749
|
}
|
|
2751
|
-
function
|
|
2752
|
-
return !
|
|
2750
|
+
function Ma(e) {
|
|
2751
|
+
return !ka(e) || Aa(e);
|
|
2753
2752
|
}
|
|
2754
2753
|
//#endregion
|
|
2755
2754
|
//#region src/components/chat-ui/components/message-parts-renderer.tsx
|
|
2756
|
-
var
|
|
2755
|
+
var Na = (e) => e.type === "tool", Pa = (e) => e.filename ?? e.url.split("/").pop() ?? "attachment", Fa = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, Ia = (e) => e.mediaType?.startsWith("image/") || Fa.test(Pa(e)), La = (e) => Ia(e) ? /* @__PURE__ */ J(z, {
|
|
2757
2756
|
src: e.url,
|
|
2758
|
-
alt: `${
|
|
2757
|
+
alt: `${Pa(e)} preview thumbnail`,
|
|
2759
2758
|
boxSize: "18px",
|
|
2760
2759
|
borderRadius: "xs",
|
|
2761
2760
|
objectFit: "cover"
|
|
2762
|
-
}) : void 0,
|
|
2761
|
+
}) : void 0, Ra = (e, t) => {
|
|
2763
2762
|
if (t) {
|
|
2764
2763
|
t.open({
|
|
2765
2764
|
source: e.url,
|
|
@@ -2768,7 +2767,7 @@ var Ma = (e) => e.type === "tool", Na = (e) => e.filename ?? e.url.split("/").po
|
|
|
2768
2767
|
return;
|
|
2769
2768
|
}
|
|
2770
2769
|
typeof window < "u" && window.open(e.url, "_blank", "noopener,noreferrer");
|
|
2771
|
-
},
|
|
2770
|
+
}, za = (e) => {
|
|
2772
2771
|
if (e.message && e.message.trim().length > 0) return e.message;
|
|
2773
2772
|
let { errorType: t } = e;
|
|
2774
2773
|
switch (t) {
|
|
@@ -2777,17 +2776,17 @@ var Ma = (e) => e.type === "tool", Na = (e) => e.filename ?? e.url.split("/").po
|
|
|
2777
2776
|
case "permission": return "Permission denied.";
|
|
2778
2777
|
default: return "An error occurred.";
|
|
2779
2778
|
}
|
|
2780
|
-
},
|
|
2779
|
+
}, Ba = {
|
|
2781
2780
|
info: "blue",
|
|
2782
2781
|
warning: "orange",
|
|
2783
2782
|
error: "red",
|
|
2784
2783
|
success: "green",
|
|
2785
2784
|
loading: "blue"
|
|
2786
|
-
},
|
|
2785
|
+
}, Va = (e, t) => {
|
|
2787
2786
|
let n = [], r = t;
|
|
2788
2787
|
for (; r < e.length;) {
|
|
2789
2788
|
let t = e[r];
|
|
2790
|
-
if (!
|
|
2789
|
+
if (!Na(t) || t.tool === "question" && pn(t.state?.input)) break;
|
|
2791
2790
|
n.push(t), r += 1;
|
|
2792
2791
|
}
|
|
2793
2792
|
return {
|
|
@@ -2795,19 +2794,19 @@ var Ma = (e) => e.type === "tool", Na = (e) => e.filename ?? e.url.split("/").po
|
|
|
2795
2794
|
nextIndex: r - 1
|
|
2796
2795
|
};
|
|
2797
2796
|
};
|
|
2798
|
-
function
|
|
2799
|
-
let t = q(5), n =
|
|
2800
|
-
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(
|
|
2797
|
+
function Ha(e) {
|
|
2798
|
+
let t = q(5), n = v(), r = e.linkHandler ?? n, i;
|
|
2799
|
+
t[0] === e ? i = t[1] : (i = /* @__PURE__ */ J(Ua, { ...e }), t[0] = e, t[1] = i);
|
|
2801
2800
|
let a;
|
|
2802
|
-
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(
|
|
2801
|
+
return t[2] !== r || t[3] !== i ? (a = /* @__PURE__ */ J(_, {
|
|
2803
2802
|
handler: r,
|
|
2804
2803
|
children: i
|
|
2805
2804
|
}), t[2] = r, t[3] = i, t[4] = a) : a = t[4], a;
|
|
2806
2805
|
}
|
|
2807
|
-
function
|
|
2808
|
-
let n = q(9), { message: r, streaming: i, hideQuestionForms: o, toolInvocationTimeline: s } = t, c = i !== void 0 && i, l = o !== void 0 && o, u =
|
|
2806
|
+
function Ua(t) {
|
|
2807
|
+
let n = q(9), { message: r, streaming: i, hideQuestionForms: o, toolInvocationTimeline: s } = t, c = i !== void 0 && i, l = o !== void 0 && o, u = v(), d = g(), f;
|
|
2809
2808
|
if (n[0] !== l || n[1] !== d || n[2] !== u || n[3] !== r || n[4] !== c || n[5] !== s) {
|
|
2810
|
-
let t =
|
|
2809
|
+
let t = x([r], u), i = s ?? ja, o;
|
|
2811
2810
|
n[7] === r.parts ? o = n[8] : (o = r.parts ?? [], n[7] = r.parts, n[8] = o);
|
|
2812
2811
|
let p = o, m = [];
|
|
2813
2812
|
for (let n = 0; n < p.length; n += 1) {
|
|
@@ -2816,33 +2815,33 @@ function Ha(t) {
|
|
|
2816
2815
|
case "text":
|
|
2817
2816
|
m.push(/* @__PURE__ */ J(h, {
|
|
2818
2817
|
value: d.get(o) ?? t.get(o) ?? S,
|
|
2819
|
-
children: /* @__PURE__ */ J("div", { children: /* @__PURE__ */ J(
|
|
2818
|
+
children: /* @__PURE__ */ J("div", { children: /* @__PURE__ */ J(cr, {
|
|
2820
2819
|
streaming: c,
|
|
2821
2820
|
children: o.text
|
|
2822
2821
|
}) })
|
|
2823
2822
|
}, s));
|
|
2824
2823
|
break bb0;
|
|
2825
2824
|
case "reasoning":
|
|
2826
|
-
m.push(/* @__PURE__ */ J(
|
|
2825
|
+
m.push(/* @__PURE__ */ J(j, {
|
|
2827
2826
|
padding: "0",
|
|
2828
2827
|
css: { "& .rich-text, & .rich-text *": {
|
|
2829
2828
|
color: "fg.subtle !important",
|
|
2830
2829
|
fontSize: ".75rem !important",
|
|
2831
2830
|
fontWeight: "normal !important"
|
|
2832
2831
|
} },
|
|
2833
|
-
children: /* @__PURE__ */ J(
|
|
2832
|
+
children: /* @__PURE__ */ J(E, {
|
|
2834
2833
|
defaultState: o.text,
|
|
2835
2834
|
fullWidth: !0
|
|
2836
2835
|
})
|
|
2837
2836
|
}, s));
|
|
2838
2837
|
break bb0;
|
|
2839
2838
|
case "tool": {
|
|
2840
|
-
if (o.tool === "question" &&
|
|
2841
|
-
m.push(/* @__PURE__ */ J(
|
|
2839
|
+
if (o.tool === "question" && pn(o.state?.input)) {
|
|
2840
|
+
m.push(/* @__PURE__ */ J(lr, { part: o }, s));
|
|
2842
2841
|
break bb0;
|
|
2843
2842
|
}
|
|
2844
|
-
let { invocations: e, nextIndex: t } =
|
|
2845
|
-
n = t, m.push(/* @__PURE__ */ J(
|
|
2843
|
+
let { invocations: e, nextIndex: t } = Va(p, n);
|
|
2844
|
+
n = t, m.push(/* @__PURE__ */ J(j, {
|
|
2846
2845
|
width: "full",
|
|
2847
2846
|
children: /* @__PURE__ */ J(i, {
|
|
2848
2847
|
invocations: e,
|
|
@@ -2854,40 +2853,40 @@ function Ha(t) {
|
|
|
2854
2853
|
break bb0;
|
|
2855
2854
|
}
|
|
2856
2855
|
case "file":
|
|
2857
|
-
m.push(/* @__PURE__ */ J(
|
|
2856
|
+
m.push(/* @__PURE__ */ J(j, {
|
|
2858
2857
|
width: "fit-content",
|
|
2859
2858
|
children: /* @__PURE__ */ J(a, {
|
|
2860
|
-
fileName:
|
|
2859
|
+
fileName: Pa(o),
|
|
2861
2860
|
size: "sm",
|
|
2862
2861
|
tone: "neutral",
|
|
2863
|
-
icon:
|
|
2864
|
-
onSelect: () =>
|
|
2862
|
+
icon: La(o),
|
|
2863
|
+
onSelect: () => Ra(o, u)
|
|
2865
2864
|
})
|
|
2866
2865
|
}, s));
|
|
2867
2866
|
break bb0;
|
|
2868
2867
|
case "error":
|
|
2869
|
-
m.push(/* @__PURE__ */ J(
|
|
2868
|
+
m.push(/* @__PURE__ */ J(j, {
|
|
2870
2869
|
py: "2",
|
|
2871
2870
|
width: "full",
|
|
2872
2871
|
children: /* @__PURE__ */ J(e, {
|
|
2873
2872
|
borderRadius: "xs",
|
|
2874
2873
|
status: "error",
|
|
2875
2874
|
colorPalette: "red",
|
|
2876
|
-
title:
|
|
2875
|
+
title: za(o),
|
|
2877
2876
|
size: "sm"
|
|
2878
2877
|
})
|
|
2879
2878
|
}, s));
|
|
2880
2879
|
break bb0;
|
|
2881
2880
|
case "token_usage": break bb0;
|
|
2882
2881
|
case "alert":
|
|
2883
|
-
m.push(/* @__PURE__ */ J(
|
|
2882
|
+
m.push(/* @__PURE__ */ J(j, {
|
|
2884
2883
|
width: "full",
|
|
2885
2884
|
children: /* @__PURE__ */ J(e, {
|
|
2886
2885
|
borderRadius: "xs",
|
|
2887
2886
|
status: o.status === "loading" ? "info" : o.status,
|
|
2888
|
-
colorPalette:
|
|
2887
|
+
colorPalette: Ba[o.status],
|
|
2889
2888
|
title: o.title,
|
|
2890
|
-
icon: o.status === "loading" ? /* @__PURE__ */ J(
|
|
2889
|
+
icon: o.status === "loading" ? /* @__PURE__ */ J(ae, { size: "sm" }) : void 0,
|
|
2891
2890
|
size: "sm",
|
|
2892
2891
|
children: o.message
|
|
2893
2892
|
})
|
|
@@ -2896,23 +2895,23 @@ function Ha(t) {
|
|
|
2896
2895
|
default: m.push(null);
|
|
2897
2896
|
}
|
|
2898
2897
|
}
|
|
2899
|
-
f = /* @__PURE__ */ J(
|
|
2898
|
+
f = /* @__PURE__ */ J(me, { children: m }), n[0] = l, n[1] = d, n[2] = u, n[3] = r, n[4] = c, n[5] = s, n[6] = f;
|
|
2900
2899
|
} else f = n[6];
|
|
2901
2900
|
return f;
|
|
2902
2901
|
}
|
|
2903
2902
|
//#endregion
|
|
2904
2903
|
//#region src/components/chat-ui/components/message-types.ts
|
|
2905
|
-
var
|
|
2904
|
+
var Wa = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "assistant", Ga = (e) => e.text.trim().length > 0, Ka = (e) => e.title.trim().length > 0 || !!e.message?.trim(), qa = (e) => {
|
|
2906
2905
|
switch (e.type) {
|
|
2907
2906
|
case "text":
|
|
2908
|
-
case "reasoning": return
|
|
2907
|
+
case "reasoning": return Ga(e);
|
|
2909
2908
|
case "tool":
|
|
2910
2909
|
case "file":
|
|
2911
2910
|
case "error": return !0;
|
|
2912
|
-
case "alert": return
|
|
2911
|
+
case "alert": return Ka(e);
|
|
2913
2912
|
default: return !1;
|
|
2914
2913
|
}
|
|
2915
|
-
},
|
|
2914
|
+
}, Ja = (e) => e.type === "reasoning" || e.type === "tool" && e.tool.toLowerCase() !== "question", Ya = (e) => e.role === "user" || e.parts.length === 0 ? !1 : e.parts.every(Ja), Xa = (e) => {
|
|
2916
2915
|
if (e.length === 0) return null;
|
|
2917
2916
|
let [t, ...n] = e;
|
|
2918
2917
|
return t ? {
|
|
@@ -2922,12 +2921,12 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2922
2921
|
modelId: n.at(-1)?.modelId ?? t.modelId,
|
|
2923
2922
|
providerId: n.at(-1)?.providerId ?? t.providerId
|
|
2924
2923
|
} : null;
|
|
2925
|
-
},
|
|
2924
|
+
}, Za = (e, t = {}) => {
|
|
2926
2925
|
let n = [], r = [], i = () => {
|
|
2927
2926
|
r = [];
|
|
2928
2927
|
};
|
|
2929
2928
|
for (let t of e) {
|
|
2930
|
-
let e = (t.parts ?? []).filter(
|
|
2929
|
+
let e = (t.parts ?? []).filter(qa);
|
|
2931
2930
|
if (e.length === 0) continue;
|
|
2932
2931
|
let a = e.length === t.parts.length ? t : {
|
|
2933
2932
|
...t,
|
|
@@ -2937,7 +2936,7 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2937
2936
|
i(), n.push(a);
|
|
2938
2937
|
continue;
|
|
2939
2938
|
}
|
|
2940
|
-
if (
|
|
2939
|
+
if (Ya(a)) {
|
|
2941
2940
|
r.push(a);
|
|
2942
2941
|
continue;
|
|
2943
2942
|
}
|
|
@@ -2951,14 +2950,14 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2951
2950
|
n.push(a);
|
|
2952
2951
|
}
|
|
2953
2952
|
if (t.streaming && r.length > 0) {
|
|
2954
|
-
let e =
|
|
2953
|
+
let e = Xa(r);
|
|
2955
2954
|
e && n.push(e);
|
|
2956
2955
|
}
|
|
2957
2956
|
return n;
|
|
2958
|
-
}, Za = (e) => {
|
|
2959
|
-
let t = e.at(-1);
|
|
2960
|
-
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" && Wa(e)) ? t.id : null;
|
|
2961
2957
|
}, Qa = (e) => {
|
|
2958
|
+
let t = e.at(-1);
|
|
2959
|
+
return t?.role === "assistant" && t.parts.some((e) => e.type === "text" && Ga(e)) ? t.id : null;
|
|
2960
|
+
}, $a = (e) => {
|
|
2962
2961
|
let t = [], n = [];
|
|
2963
2962
|
for (let r of e) r.role === "user" ? t.push({
|
|
2964
2963
|
userMessage: r,
|
|
@@ -2968,39 +2967,39 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
2968
2967
|
groups: t,
|
|
2969
2968
|
leadingResponses: n
|
|
2970
2969
|
};
|
|
2971
|
-
},
|
|
2970
|
+
}, eo = (e) => {
|
|
2972
2971
|
let t = q(18), { message: n, streaming: r, hideQuestionForms: i, animate: a, showAssistantActions: o } = e, s = i !== void 0 && i, c = a !== void 0 && a, l;
|
|
2973
|
-
t[0] === n.role ? l = t[1] : (l =
|
|
2974
|
-
let u = l, d = u === "user" || u === "assistant" && o, f = c ?
|
|
2975
|
-
t[2] !== s || t[3] !== n || t[4] !== p ? (m = /* @__PURE__ */ J(
|
|
2972
|
+
t[0] === n.role ? l = t[1] : (l = Wa(n.role), t[0] = n.role, t[1] = l);
|
|
2973
|
+
let u = l, d = u === "user" || u === "assistant" && o, f = c ? $n : void 0, p = r && u === "assistant", m;
|
|
2974
|
+
t[2] !== s || t[3] !== n || t[4] !== p ? (m = /* @__PURE__ */ J(Ha, {
|
|
2976
2975
|
message: n,
|
|
2977
2976
|
streaming: p,
|
|
2978
2977
|
hideQuestionForms: s
|
|
2979
2978
|
}), t[2] = s, t[3] = n, t[4] = p, t[5] = m) : m = t[5];
|
|
2980
2979
|
let h;
|
|
2981
|
-
t[6] !== u || t[7] !== n || t[8] !== d ? (h = d ? /* @__PURE__ */ J(
|
|
2980
|
+
t[6] !== u || t[7] !== n || t[8] !== d ? (h = d ? /* @__PURE__ */ J(or, {
|
|
2982
2981
|
message: n,
|
|
2983
2982
|
alwaysVisible: u === "user",
|
|
2984
2983
|
copyAlwaysVisible: u !== "user"
|
|
2985
2984
|
}) : null, t[6] = u, t[7] = n, t[8] = d, t[9] = h) : h = t[9];
|
|
2986
2985
|
let g;
|
|
2987
|
-
t[10] !== u || t[11] !== m || t[12] !== h ? (g = /* @__PURE__ */ Y(
|
|
2986
|
+
t[10] !== u || t[11] !== m || t[12] !== h ? (g = /* @__PURE__ */ Y(mt.Content, {
|
|
2988
2987
|
from: u,
|
|
2989
2988
|
children: [m, h]
|
|
2990
2989
|
}), t[10] = u, t[11] = m, t[12] = h, t[13] = g) : g = t[13];
|
|
2991
2990
|
let _;
|
|
2992
|
-
return t[14] !== u || t[15] !== f || t[16] !== g ? (_ = /* @__PURE__ */ J(
|
|
2991
|
+
return t[14] !== u || t[15] !== f || t[16] !== g ? (_ = /* @__PURE__ */ J(mt.Root, {
|
|
2993
2992
|
from: u,
|
|
2994
2993
|
...f,
|
|
2995
2994
|
children: g
|
|
2996
2995
|
}), t[14] = u, t[15] = f, t[16] = g, t[17] = _) : _ = t[17], _;
|
|
2997
|
-
},
|
|
2996
|
+
}, to = (e) => {
|
|
2998
2997
|
let t = q(11), { expanded: n, label: r, onClick: i, actionPanel: a } = e, o;
|
|
2999
2998
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (o = { key: "stickyUserMessage" }, t[0] = o) : o = t[0];
|
|
3000
|
-
let s =
|
|
2999
|
+
let s = pe(o), c;
|
|
3001
3000
|
t[1] !== n || t[2] !== s ? (c = s({ expanded: n }), t[1] = n, t[2] = s, t[3] = c) : c = t[3];
|
|
3002
3001
|
let l = c, u;
|
|
3003
|
-
t[4] !== r || t[5] !== i ? (u = /* @__PURE__ */ J(
|
|
3002
|
+
t[4] !== r || t[5] !== i ? (u = /* @__PURE__ */ J(M, {
|
|
3004
3003
|
size: "2xs",
|
|
3005
3004
|
variant: "outline",
|
|
3006
3005
|
pointerEvents: "auto",
|
|
@@ -3008,12 +3007,12 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
3008
3007
|
children: r
|
|
3009
3008
|
}), t[4] = r, t[5] = i, t[6] = u) : u = t[6];
|
|
3010
3009
|
let d;
|
|
3011
|
-
return t[7] !== a || t[8] !== l.footer || t[9] !== u ? (d = /* @__PURE__ */ Y(
|
|
3010
|
+
return t[7] !== a || t[8] !== l.footer || t[9] !== u ? (d = /* @__PURE__ */ Y(I, {
|
|
3012
3011
|
css: l.footer,
|
|
3013
3012
|
children: [a, u]
|
|
3014
3013
|
}), t[7] = a, t[8] = l.footer, t[9] = u, t[10] = d) : d = t[10], d;
|
|
3015
|
-
},
|
|
3016
|
-
let n =
|
|
3014
|
+
}, no = (e, t) => {
|
|
3015
|
+
let n = Qa(e), r = e.map((e) => ({
|
|
3017
3016
|
type: "response",
|
|
3018
3017
|
key: e.id,
|
|
3019
3018
|
message: e,
|
|
@@ -3022,7 +3021,7 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
3022
3021
|
isActiveTurn: t.length === 0
|
|
3023
3022
|
}));
|
|
3024
3023
|
for (let [e, n] of t.entries()) {
|
|
3025
|
-
let i = r.length, a =
|
|
3024
|
+
let i = r.length, a = Qa(n.responses);
|
|
3026
3025
|
r.push({
|
|
3027
3026
|
type: "user",
|
|
3028
3027
|
key: n.userMessage.id,
|
|
@@ -3039,24 +3038,24 @@ var Ua = (e) => e === "user" || e === "assistant" || e === "developer" ? e : "as
|
|
|
3039
3038
|
});
|
|
3040
3039
|
}
|
|
3041
3040
|
return r;
|
|
3042
|
-
},
|
|
3041
|
+
}, ro = (e, t) => {
|
|
3043
3042
|
let n = e[t];
|
|
3044
3043
|
return n?.type === "user" ? t : n?.userIndex ?? null;
|
|
3045
|
-
},
|
|
3044
|
+
}, io = (e, t) => {
|
|
3046
3045
|
let n = e[t + 1];
|
|
3047
|
-
return !!n && (n.type === "user" ||
|
|
3048
|
-
},
|
|
3046
|
+
return !!n && (n.type === "user" || ro(e, t) === null);
|
|
3047
|
+
}, ao = 1, oo = (e, t) => {
|
|
3049
3048
|
let n = Math.max(0, e.scrollHeight - e.clientHeight);
|
|
3050
|
-
return t === 0 || n <=
|
|
3051
|
-
},
|
|
3052
|
-
|
|
3049
|
+
return t === 0 || n <= ao ? !1 : t < 0 ? e.scrollTop > ao : e.scrollTop < n - ao;
|
|
3050
|
+
}, so = (e) => {
|
|
3051
|
+
oo(e.currentTarget, e.deltaY) && e.stopPropagation();
|
|
3053
3052
|
};
|
|
3054
|
-
function
|
|
3053
|
+
function co(e) {
|
|
3055
3054
|
let t = q(46), { message: r, expanded: i, animate: a, onToggle: o } = e, s = Z(null), c = Z(null), l = Z(null), [u, d] = Q(!1), f = u && i, p;
|
|
3056
3055
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (p = { key: "stickyUserMessage" }, t[0] = p) : p = t[0];
|
|
3057
|
-
let m =
|
|
3056
|
+
let m = pe(p), h;
|
|
3058
3057
|
t[1] !== f || t[2] !== m ? (h = m({ expanded: f }), t[1] = f, t[2] = m, t[3] = h) : h = t[3];
|
|
3059
|
-
let g = h, _ = f ? "expanded" : "collapsed", v = f ?
|
|
3058
|
+
let g = h, _ = f ? "expanded" : "collapsed", v = f ? so : void 0, y;
|
|
3060
3059
|
t[4] !== g.viewport || t[5] !== _ || t[6] !== v ? (y = {
|
|
3061
3060
|
css: g.viewport,
|
|
3062
3061
|
"data-sticky-user-message-content": _,
|
|
@@ -3068,31 +3067,31 @@ function so(e) {
|
|
|
3068
3067
|
d(e.getBoundingClientRect().height > t.getBoundingClientRect().height + 1);
|
|
3069
3068
|
}, r = new ResizeObserver(n);
|
|
3070
3069
|
return r.observe(e), r.observe(t), n(), () => r.disconnect();
|
|
3071
|
-
}, S = [], t[8] = x, t[9] = S) : (x = t[8], S = t[9]),
|
|
3070
|
+
}, S = [], t[8] = x, t[9] = S) : (x = t[8], S = t[9]), be(x, S);
|
|
3072
3071
|
let C, w;
|
|
3073
3072
|
t[10] === f ? (C = t[11], w = t[12]) : (C = () => {
|
|
3074
3073
|
f || (s.current.scrollTop = 0);
|
|
3075
|
-
}, w = [f], t[10] = f, t[11] = C, t[12] = w),
|
|
3074
|
+
}, w = [f], t[10] = f, t[11] = C, t[12] = w), be(C, w);
|
|
3076
3075
|
let T;
|
|
3077
|
-
t[13] === r ? T = t[14] : (T = /* @__PURE__ */ J(
|
|
3076
|
+
t[13] === r ? T = t[14] : (T = /* @__PURE__ */ J(or, {
|
|
3078
3077
|
message: r,
|
|
3079
3078
|
alwaysVisible: !0,
|
|
3080
3079
|
copyAlwaysVisible: !1
|
|
3081
3080
|
}), t[13] = r, t[14] = T);
|
|
3082
|
-
let E = T, D = r.delivery ?? "sent", O = a ?
|
|
3083
|
-
t[15] === g.preview ? k = t[16] : (k = /* @__PURE__ */ J(
|
|
3081
|
+
let E = T, D = r.delivery ?? "sent", O = a ? $n : void 0, k;
|
|
3082
|
+
t[15] === g.preview ? k = t[16] : (k = /* @__PURE__ */ J(j, {
|
|
3084
3083
|
ref: l,
|
|
3085
3084
|
css: g.preview,
|
|
3086
3085
|
"aria-hidden": "true"
|
|
3087
3086
|
}), t[15] = g.preview, t[16] = k);
|
|
3088
|
-
let
|
|
3089
|
-
t[17] === r ?
|
|
3087
|
+
let A;
|
|
3088
|
+
t[17] === r ? A = t[18] : (A = /* @__PURE__ */ J(Ha, { message: r }), t[17] = r, t[18] = A);
|
|
3090
3089
|
let M;
|
|
3091
|
-
t[19] !== g.body || t[20] !==
|
|
3090
|
+
t[19] !== g.body || t[20] !== A ? (M = /* @__PURE__ */ J(j, {
|
|
3092
3091
|
ref: c,
|
|
3093
3092
|
css: g.body,
|
|
3094
|
-
children:
|
|
3095
|
-
}), t[19] = g.body, t[20] =
|
|
3093
|
+
children: A
|
|
3094
|
+
}), t[19] = g.body, t[20] = A, t[21] = M) : M = t[21];
|
|
3096
3095
|
let N;
|
|
3097
3096
|
t[22] !== f || t[23] !== M || t[24] !== b ? (N = /* @__PURE__ */ J(n, {
|
|
3098
3097
|
viewportRef: s,
|
|
@@ -3101,19 +3100,19 @@ function so(e) {
|
|
|
3101
3100
|
children: M
|
|
3102
3101
|
}), t[22] = f, t[23] = M, t[24] = b, t[25] = N) : N = t[25];
|
|
3103
3102
|
let P;
|
|
3104
|
-
t[26] !== E || t[27] !== u || t[28] !== g.actions ? (P = u ? null : /* @__PURE__ */ J(
|
|
3103
|
+
t[26] !== E || t[27] !== u || t[28] !== g.actions ? (P = u ? null : /* @__PURE__ */ J(j, {
|
|
3105
3104
|
css: g.actions,
|
|
3106
3105
|
children: E
|
|
3107
3106
|
}), t[26] = E, t[27] = u, t[28] = g.actions, t[29] = P) : P = t[29];
|
|
3108
3107
|
let F;
|
|
3109
|
-
t[30] !== E || t[31] !== u || t[32] !== f || t[33] !== r.id || t[34] !== o ? (F = u ? /* @__PURE__ */ J(
|
|
3108
|
+
t[30] !== E || t[31] !== u || t[32] !== f || t[33] !== r.id || t[34] !== o ? (F = u ? /* @__PURE__ */ J(to, {
|
|
3110
3109
|
expanded: f,
|
|
3111
3110
|
label: f ? "Show less" : "Show more",
|
|
3112
3111
|
onClick: () => o(r.id),
|
|
3113
3112
|
actionPanel: E
|
|
3114
3113
|
}) : null, t[30] = E, t[31] = u, t[32] = f, t[33] = r.id, t[34] = o, t[35] = F) : F = t[35];
|
|
3115
3114
|
let I;
|
|
3116
|
-
t[36] !== g.root || t[37] !== k || t[38] !== N || t[39] !== P || t[40] !== F ? (I = /* @__PURE__ */ Y(
|
|
3115
|
+
t[36] !== g.root || t[37] !== k || t[38] !== N || t[39] !== P || t[40] !== F ? (I = /* @__PURE__ */ Y(mt.Content, {
|
|
3117
3116
|
from: "user",
|
|
3118
3117
|
css: g.root,
|
|
3119
3118
|
children: [
|
|
@@ -3124,7 +3123,7 @@ function so(e) {
|
|
|
3124
3123
|
]
|
|
3125
3124
|
}), t[36] = g.root, t[37] = k, t[38] = N, t[39] = P, t[40] = F, t[41] = I) : I = t[41];
|
|
3126
3125
|
let L;
|
|
3127
|
-
return t[42] !== D || t[43] !== O || t[44] !== I ? (L = /* @__PURE__ */ J(
|
|
3126
|
+
return t[42] !== D || t[43] !== O || t[44] !== I ? (L = /* @__PURE__ */ J(mt.Root, {
|
|
3128
3127
|
from: "user",
|
|
3129
3128
|
delivery: D,
|
|
3130
3129
|
...O,
|
|
@@ -3133,68 +3132,62 @@ function so(e) {
|
|
|
3133
3132
|
}
|
|
3134
3133
|
//#endregion
|
|
3135
3134
|
//#region src/components/chat-ui/components/use-chat-tail-ready.ts
|
|
3136
|
-
var
|
|
3135
|
+
var lo = 3, uo = 20, fo = 1, po = (e, t) => Math.abs(e.scrollTop - t.scrollTop) <= fo && Math.abs(e.totalSize - t.totalSize) <= fo, mo = (e) => !!e && e.scrollHeight <= e.clientHeight, ho = (e) => ({
|
|
3137
3136
|
scrollTop: e?.scrollTop ?? 0,
|
|
3138
|
-
totalSize:
|
|
3139
|
-
}),
|
|
3140
|
-
let t = q(
|
|
3141
|
-
t[0] ===
|
|
3142
|
-
|
|
3143
|
-
},
|
|
3144
|
-
let
|
|
3145
|
-
t[3]
|
|
3146
|
-
if (
|
|
3147
|
-
|
|
3137
|
+
totalSize: e?.scrollHeight ?? 0
|
|
3138
|
+
}), go = (e) => {
|
|
3139
|
+
let t = q(6), { onReady: n, scrollRef: r } = e, i = Z(n), a, o;
|
|
3140
|
+
t[0] === n ? (a = t[1], o = t[2]) : (a = () => {
|
|
3141
|
+
i.current = n;
|
|
3142
|
+
}, o = [n], t[0] = n, t[1] = a, t[2] = o), X(a, o);
|
|
3143
|
+
let s, c;
|
|
3144
|
+
t[3] === r ? (s = t[4], c = t[5]) : (s = () => {
|
|
3145
|
+
if (typeof requestAnimationFrame > "u" || mo(r.current)) {
|
|
3146
|
+
i.current?.();
|
|
3148
3147
|
return;
|
|
3149
3148
|
}
|
|
3150
|
-
let e = 0, t = 0,
|
|
3149
|
+
let e = 0, t = 0, n = 0, a = null, o = () => {
|
|
3151
3150
|
t += 1;
|
|
3152
|
-
let
|
|
3153
|
-
if (
|
|
3154
|
-
|
|
3151
|
+
let s = ho(r.current);
|
|
3152
|
+
if (n = a && po(s, a) ? n + 1 : 0, a = s, n >= lo || t >= uo) {
|
|
3153
|
+
i.current?.();
|
|
3155
3154
|
return;
|
|
3156
3155
|
}
|
|
3157
|
-
e = requestAnimationFrame(
|
|
3156
|
+
e = requestAnimationFrame(o);
|
|
3158
3157
|
};
|
|
3159
|
-
return e = requestAnimationFrame(
|
|
3160
|
-
},
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
a
|
|
3164
|
-
], t[3] = n, t[4] = i, t[5] = a, t[6] = l, t[7] = u) : (l = t[6], u = t[7]), ye(l, u);
|
|
3165
|
-
}, go = 360, _o = 4, vo = 8, yo = (e) => {
|
|
3166
|
-
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: a, expandedStickyMessageIds: o, onToggleStickyMessage: s, onReady: c } = e, { scrollRef: l } = it(), u = to(t, n), d = tr(u.map((e) => e.key)), f = l.current?.clientHeight || 1, p = Math.max(t.length + n.length - 1, 0), { virtualizer: m, virtualItems: h, totalSize: g, measurements: _ } = i({
|
|
3158
|
+
return e = requestAnimationFrame(o), () => cancelAnimationFrame(e);
|
|
3159
|
+
}, c = [r], t[3] = r, t[4] = s, t[5] = c), be(s, c);
|
|
3160
|
+
}, _o = 360, vo = 4, yo = 8, bo = (e) => {
|
|
3161
|
+
let { leadingResponses: t, groups: n, streaming: r, hideActiveQuestionForms: a, expandedStickyMessageIds: o, onToggleStickyMessage: s, onReady: c } = e, { scrollRef: l } = at(), u = no(t, n), d = nr(u.map((e) => e.key)), f = l.current?.clientHeight || 1, p = Math.max(t.length + n.length - 1, 0), { virtualizer: m, virtualItems: h, totalSize: g, measurements: _ } = i({
|
|
3167
3162
|
count: u.length,
|
|
3168
3163
|
getScrollElement: () => l.current,
|
|
3169
|
-
estimateSize: (e) =>
|
|
3164
|
+
estimateSize: (e) => _o + (io(u, e) ? yo : 0),
|
|
3170
3165
|
getItemKey: (e) => u[e].key,
|
|
3171
|
-
overscan:
|
|
3166
|
+
overscan: vo,
|
|
3172
3167
|
initialRect: {
|
|
3173
3168
|
width: 0,
|
|
3174
3169
|
height: f
|
|
3175
3170
|
},
|
|
3176
|
-
initialOffset: () => Math.max(u.length *
|
|
3171
|
+
initialOffset: () => Math.max(u.length * _o + p * yo - f, 0),
|
|
3177
3172
|
rangeExtractor: (e) => {
|
|
3178
|
-
let t =
|
|
3173
|
+
let t = Je(e), n = ro(u, e.startIndex);
|
|
3179
3174
|
return n !== null && !t.includes(n) && t.unshift(n), t;
|
|
3180
3175
|
}
|
|
3181
3176
|
});
|
|
3182
|
-
return
|
|
3183
|
-
itemCount: u.length,
|
|
3177
|
+
return go({
|
|
3184
3178
|
onReady: c,
|
|
3185
|
-
scrollRef: l
|
|
3186
|
-
|
|
3187
|
-
}), /* @__PURE__ */ J(A, {
|
|
3179
|
+
scrollRef: l
|
|
3180
|
+
}), /* @__PURE__ */ J(j, {
|
|
3188
3181
|
px: "xs",
|
|
3189
|
-
children: /* @__PURE__ */ J(
|
|
3182
|
+
children: /* @__PURE__ */ J(j, {
|
|
3190
3183
|
position: "relative",
|
|
3191
3184
|
width: "100%",
|
|
3192
3185
|
style: { height: g },
|
|
3193
3186
|
children: h.map((e) => {
|
|
3194
3187
|
let t = u[e.index];
|
|
3195
3188
|
if (t.type === "user") {
|
|
3196
|
-
let n = (_[t.endIndex]?.end ?? g) - (
|
|
3197
|
-
return /* @__PURE__ */ J(
|
|
3189
|
+
let n = (_[t.endIndex]?.end ?? g) - (io(u, t.endIndex) ? yo : 0);
|
|
3190
|
+
return /* @__PURE__ */ J(j, {
|
|
3198
3191
|
position: "absolute",
|
|
3199
3192
|
left: "0",
|
|
3200
3193
|
width: "100%",
|
|
@@ -3204,7 +3197,7 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3204
3197
|
top: e.start,
|
|
3205
3198
|
height: Math.max(e.size, n - e.start)
|
|
3206
3199
|
},
|
|
3207
|
-
children: /* @__PURE__ */ J(
|
|
3200
|
+
children: /* @__PURE__ */ J(j, {
|
|
3208
3201
|
ref: m.measureElement,
|
|
3209
3202
|
"data-index": e.index,
|
|
3210
3203
|
"data-chat-message-list-item": "user",
|
|
@@ -3212,8 +3205,8 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3212
3205
|
position: "sticky",
|
|
3213
3206
|
top: "0",
|
|
3214
3207
|
pointerEvents: "auto",
|
|
3215
|
-
pb:
|
|
3216
|
-
children: /* @__PURE__ */ J(
|
|
3208
|
+
pb: io(u, e.index) ? "xs" : void 0,
|
|
3209
|
+
children: /* @__PURE__ */ J(co, {
|
|
3217
3210
|
message: t.message,
|
|
3218
3211
|
expanded: o.has(t.key),
|
|
3219
3212
|
animate: d.has(t.key),
|
|
@@ -3222,7 +3215,7 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3222
3215
|
})
|
|
3223
3216
|
}, e.key);
|
|
3224
3217
|
}
|
|
3225
|
-
return /* @__PURE__ */ J(
|
|
3218
|
+
return /* @__PURE__ */ J(j, {
|
|
3226
3219
|
ref: m.measureElement,
|
|
3227
3220
|
"data-index": e.index,
|
|
3228
3221
|
"data-chat-message-list-item": t.type,
|
|
@@ -3230,9 +3223,9 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3230
3223
|
position: "absolute",
|
|
3231
3224
|
left: "0",
|
|
3232
3225
|
width: "100%",
|
|
3233
|
-
pb:
|
|
3226
|
+
pb: io(u, e.index) ? "xs" : void 0,
|
|
3234
3227
|
style: { top: e.start },
|
|
3235
|
-
children: /* @__PURE__ */ J(
|
|
3228
|
+
children: /* @__PURE__ */ J(eo, {
|
|
3236
3229
|
message: t.message,
|
|
3237
3230
|
streaming: r && t.isActiveTurn && t.showAssistantActions,
|
|
3238
3231
|
hideQuestionForms: !t.isActiveTurn || a,
|
|
@@ -3243,14 +3236,14 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3243
3236
|
})
|
|
3244
3237
|
})
|
|
3245
3238
|
});
|
|
3246
|
-
},
|
|
3239
|
+
}, xo = (e) => {
|
|
3247
3240
|
let { queuedFollowUps: t, defaultValue: n, onChange: r, onSubmit: i, onUpdate: a, onCreate: o, onRestoreDraft: s, canRestoreDraft: c = !1, disabled: l = !1, onSelect: u, onDiscard: d } = e, [f, p] = Q(null), [m, h] = Q({}), [g, _] = Q(null), [v, y] = Q(0), [b, x] = Q({}), [S, C] = Q(null), [w, T] = Q(!1), [E, D] = Q(null), [O, k] = Q(null), A = t.find((e) => e.id === f?.id), j = !(!f || A), M = !!(f && A && f.revision && f.revision !== A.revision), N = f ? m[f.id]?.text ?? f.prompt : n, P = g?.text === n ? g.state : void 0, F = f ? m[f.id]?.state : P, I = (e) => {
|
|
3248
3241
|
p(e), C(null), k(null), u?.(e), y((e) => e + 1);
|
|
3249
3242
|
};
|
|
3250
3243
|
X(() => {
|
|
3251
3244
|
!f || A || w || l || E === f.id || (D(f.id), c && r && !n.trim() && !t.length && (s?.(f.id), _({
|
|
3252
3245
|
text: N,
|
|
3253
|
-
state: F ??
|
|
3246
|
+
state: F ?? Tt(N)
|
|
3254
3247
|
}), x((e) => ({
|
|
3255
3248
|
...e,
|
|
3256
3249
|
draft: e[f.id]
|
|
@@ -3282,10 +3275,10 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3282
3275
|
...t,
|
|
3283
3276
|
[f.id]: {
|
|
3284
3277
|
text: e,
|
|
3285
|
-
state:
|
|
3278
|
+
state: Tt(e)
|
|
3286
3279
|
}
|
|
3287
3280
|
}));
|
|
3288
|
-
},
|
|
3281
|
+
}, ee = (e, t) => {
|
|
3289
3282
|
if (!f) {
|
|
3290
3283
|
_({
|
|
3291
3284
|
text: e,
|
|
@@ -3300,12 +3293,12 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3300
3293
|
state: t
|
|
3301
3294
|
}
|
|
3302
3295
|
}));
|
|
3303
|
-
},
|
|
3296
|
+
}, R = () => {
|
|
3304
3297
|
f && (d?.(f.id), h((e) => {
|
|
3305
3298
|
let t = { ...e };
|
|
3306
3299
|
return delete t[f.id], t;
|
|
3307
3300
|
})), I(null);
|
|
3308
|
-
},
|
|
3301
|
+
}, z = async (e, t, n) => {
|
|
3309
3302
|
if (n) return i?.(e, t, n);
|
|
3310
3303
|
if (!f) return i?.(e, t);
|
|
3311
3304
|
if (M || w) throw Error("Select the saved request again before updating.");
|
|
@@ -3324,30 +3317,30 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3324
3317
|
} finally {
|
|
3325
3318
|
T(!1);
|
|
3326
3319
|
}
|
|
3327
|
-
},
|
|
3320
|
+
}, te = f?.id ?? "draft";
|
|
3328
3321
|
return {
|
|
3329
|
-
initialSelection: b[
|
|
3322
|
+
initialSelection: b[te],
|
|
3330
3323
|
changeSelection: (e) => x((t) => ({
|
|
3331
3324
|
...t,
|
|
3332
|
-
[
|
|
3325
|
+
[te]: e
|
|
3333
3326
|
})),
|
|
3334
3327
|
draftValue: n,
|
|
3335
3328
|
change: L,
|
|
3336
|
-
changeState:
|
|
3329
|
+
changeState: ee,
|
|
3337
3330
|
edit: (e) => {
|
|
3338
3331
|
w || I(e);
|
|
3339
3332
|
},
|
|
3340
3333
|
selectDraft: () => {
|
|
3341
3334
|
w || I(null);
|
|
3342
3335
|
},
|
|
3343
|
-
discard:
|
|
3336
|
+
discard: R,
|
|
3344
3337
|
editingItem: f,
|
|
3345
3338
|
editingItemId: f?.id ?? null,
|
|
3346
3339
|
focusSignal: v,
|
|
3347
3340
|
inputValue: N,
|
|
3348
3341
|
editorState: F,
|
|
3349
3342
|
isEditing: !!f,
|
|
3350
|
-
submit:
|
|
3343
|
+
submit: z,
|
|
3351
3344
|
error: S,
|
|
3352
3345
|
notice: O ?? (j ? "This request was sent. Create a new queue item to keep your edits." : null),
|
|
3353
3346
|
createNew: j,
|
|
@@ -3355,23 +3348,23 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3355
3348
|
stale: M,
|
|
3356
3349
|
dirtyItemIds: Object.keys(m).filter((e) => m[e].text !== t.find((t) => t.id === e)?.prompt)
|
|
3357
3350
|
};
|
|
3358
|
-
},
|
|
3351
|
+
}, So = (e) => {
|
|
3359
3352
|
let t = q(50), { conversationKey: n, recentUserMessages: r, actions: i, attachmentActions: a, attachedResources: o, attachmentList: s, chatInputAutoFocus: c, chatInputPlaceholder: l, chatInputQuestionPrompt: u, composerDecision: d, chatInputCommands: f, inputDisabled: p, submitDisabled: m, onAttachFiles: h, onAttachText: g, onClearAttachments: _, onInterrupt: v, queuedComposer: y, streaming: b } = e, { editing: x, hasQueuedFollowUps: S } = e, C = y.createNew ? "Create new queue item" : "Update", w = y.updating ? "Saving…" : C, T;
|
|
3360
3353
|
t[0] !== x || t[1] !== p || t[2] !== y ? (T = (e) => {
|
|
3361
3354
|
e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing || !x || p || y.updating || !e.currentTarget.contains(e.target) || (e.preventDefault(), e.stopPropagation(), y.discard());
|
|
3362
3355
|
}, t[0] = x, t[1] = p, t[2] = y, t[3] = T) : T = t[3];
|
|
3363
3356
|
let E = `${n ?? ""}:${y.editingItemId ?? "draft"}`, D;
|
|
3364
|
-
t[4] !== y.editorState || t[5] !== y.inputValue ? (D = y.editorState ??
|
|
3365
|
-
let O = !x && b, k = x ? void 0 : v,
|
|
3366
|
-
t[7] !== x || t[8] !== p || t[9] !== y.discard || t[10] !== y.updating ? (
|
|
3357
|
+
t[4] !== y.editorState || t[5] !== y.inputValue ? (D = y.editorState ?? Tt(y.inputValue), t[4] = y.editorState, t[5] = y.inputValue, t[6] = D) : D = t[6];
|
|
3358
|
+
let O = !x && b, k = x ? void 0 : v, A;
|
|
3359
|
+
t[7] !== x || t[8] !== p || t[9] !== y.discard || t[10] !== y.updating ? (A = x ? /* @__PURE__ */ J(M, {
|
|
3367
3360
|
size: "xs",
|
|
3368
3361
|
variant: "ghost",
|
|
3369
3362
|
onClick: y.discard,
|
|
3370
3363
|
disabled: y.updating || p,
|
|
3371
3364
|
children: "Cancel"
|
|
3372
|
-
}) : null, t[7] = x, t[8] = p, t[9] = y.discard, t[10] = y.updating, t[11] =
|
|
3373
|
-
let N = p || y.updating, P = m || x && y.stale, F = !x && S, I = x ? C : void 0, L = x ? w : void 0,
|
|
3374
|
-
t[12] !== i || t[13] !== o || t[14] !== a || t[15] !== s || t[16] !== c || t[17] !== f || t[18] !== l || t[19] !== u || t[20] !== d || t[21] !== x || t[22] !== h || t[23] !== g || t[24] !== _ || t[25] !== y.change || t[26] !== y.changeSelection || t[27] !== y.changeState || t[28] !== y.focusSignal || t[29] !== y.initialSelection || t[30] !== y.submit || t[31] !== r || t[32] !== E || t[33] !== L || t[34] !== D || t[35] !== O || t[36] !== k || t[37] !==
|
|
3365
|
+
}) : null, t[7] = x, t[8] = p, t[9] = y.discard, t[10] = y.updating, t[11] = A) : A = t[11];
|
|
3366
|
+
let N = p || y.updating, P = m || x && y.stale, F = !x && S, I = x ? C : void 0, L = x ? w : void 0, ee;
|
|
3367
|
+
t[12] !== i || t[13] !== o || t[14] !== a || t[15] !== s || t[16] !== c || t[17] !== f || t[18] !== l || t[19] !== u || t[20] !== d || t[21] !== x || t[22] !== h || t[23] !== g || t[24] !== _ || t[25] !== y.change || t[26] !== y.changeSelection || t[27] !== y.changeState || t[28] !== y.focusSignal || t[29] !== y.initialSelection || t[30] !== y.submit || t[31] !== r || t[32] !== E || t[33] !== L || t[34] !== D || t[35] !== O || t[36] !== k || t[37] !== A || t[38] !== N || t[39] !== P || t[40] !== F || t[41] !== I ? (ee = /* @__PURE__ */ J(Qn, {
|
|
3375
3368
|
recentUserMessages: r,
|
|
3376
3369
|
placeholder: l,
|
|
3377
3370
|
defaultState: D,
|
|
@@ -3385,7 +3378,7 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3385
3378
|
initialSelection: y.initialSelection,
|
|
3386
3379
|
onSelectionChange: y.changeSelection,
|
|
3387
3380
|
actions: i,
|
|
3388
|
-
submitActions:
|
|
3381
|
+
submitActions: A,
|
|
3389
3382
|
attachmentActions: a,
|
|
3390
3383
|
attachedResources: o,
|
|
3391
3384
|
onClearAttachments: _,
|
|
@@ -3401,18 +3394,18 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3401
3394
|
submitLabel: L,
|
|
3402
3395
|
retainTextUntilAcknowledged: x,
|
|
3403
3396
|
commands: f
|
|
3404
|
-
}, E), t[12] = i, t[13] = o, t[14] = a, t[15] = s, t[16] = c, t[17] = f, t[18] = l, t[19] = u, t[20] = d, t[21] = x, t[22] = h, t[23] = g, t[24] = _, t[25] = y.change, t[26] = y.changeSelection, t[27] = y.changeState, t[28] = y.focusSignal, t[29] = y.initialSelection, t[30] = y.submit, t[31] = r, t[32] = E, t[33] = L, t[34] = D, t[35] = O, t[36] = k, t[37] =
|
|
3405
|
-
let
|
|
3406
|
-
t[43] !== x || t[44] !== y ? (
|
|
3397
|
+
}, E), t[12] = i, t[13] = o, t[14] = a, t[15] = s, t[16] = c, t[17] = f, t[18] = l, t[19] = u, t[20] = d, t[21] = x, t[22] = h, t[23] = g, t[24] = _, t[25] = y.change, t[26] = y.changeSelection, t[27] = y.changeState, t[28] = y.focusSignal, t[29] = y.initialSelection, t[30] = y.submit, t[31] = r, t[32] = E, t[33] = L, t[34] = D, t[35] = O, t[36] = k, t[37] = A, t[38] = N, t[39] = P, t[40] = F, t[41] = I, t[42] = ee) : ee = t[42];
|
|
3398
|
+
let R;
|
|
3399
|
+
t[43] !== x || t[44] !== y ? (R = /* @__PURE__ */ J(Co, {
|
|
3407
3400
|
queuedComposer: y,
|
|
3408
3401
|
editing: x
|
|
3409
|
-
}), t[43] = x, t[44] = y, t[45] =
|
|
3410
|
-
let
|
|
3411
|
-
return t[46] !== T || t[47] !==
|
|
3402
|
+
}), t[43] = x, t[44] = y, t[45] = R) : R = t[45];
|
|
3403
|
+
let z;
|
|
3404
|
+
return t[46] !== T || t[47] !== ee || t[48] !== R ? (z = /* @__PURE__ */ Y(j, {
|
|
3412
3405
|
onKeyDown: T,
|
|
3413
|
-
children: [
|
|
3414
|
-
}), t[46] = T, t[47] =
|
|
3415
|
-
},
|
|
3406
|
+
children: [ee, R]
|
|
3407
|
+
}), t[46] = T, t[47] = ee, t[48] = R, t[49] = z) : z = t[49], z;
|
|
3408
|
+
}, Co = (e) => {
|
|
3416
3409
|
let t = q(4), { queuedComposer: n, editing: r } = e, i = r && n.stale, a = n.error ?? (i ? "This request changed. Your edit is kept; select the saved request again before updating." : n.notice);
|
|
3417
3410
|
if (!a) return null;
|
|
3418
3411
|
let o = !!(n.error || i), s = o ? "fg.error" : "fg.muted", c = o ? "alert" : "status", l;
|
|
@@ -3424,7 +3417,7 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3424
3417
|
"aria-label": "Queued edit notice",
|
|
3425
3418
|
children: a
|
|
3426
3419
|
}), t[0] = a, t[1] = s, t[2] = c, t[3] = l) : l = t[3], l;
|
|
3427
|
-
},
|
|
3420
|
+
}, wo = (e, { context: t }, n) => {
|
|
3428
3421
|
if (![
|
|
3429
3422
|
"ArrowUp",
|
|
3430
3423
|
"ArrowDown",
|
|
@@ -3439,8 +3432,8 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3439
3432
|
x: o.left + (o.width - (t.collisionRect?.width ?? 0)) / 2,
|
|
3440
3433
|
y: o.top + (o.height - (t.collisionRect?.height ?? 0)) / 2
|
|
3441
3434
|
};
|
|
3442
|
-
},
|
|
3443
|
-
let { item: t, index: n, kind: r } = e, i =
|
|
3435
|
+
}, To = (e) => {
|
|
3436
|
+
let { item: t, index: n, kind: r } = e, i = tt({
|
|
3444
3437
|
id: `${t.id}:${r}`,
|
|
3445
3438
|
disabled: !!(t.sending || t.steeringDelivery),
|
|
3446
3439
|
data: {
|
|
@@ -3466,48 +3459,48 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3466
3459
|
height: "25%"
|
|
3467
3460
|
}
|
|
3468
3461
|
}[r];
|
|
3469
|
-
return /* @__PURE__ */ J(
|
|
3462
|
+
return /* @__PURE__ */ J(j, {
|
|
3470
3463
|
ref: i.setNodeRef,
|
|
3471
3464
|
position: "absolute",
|
|
3472
3465
|
insetX: "0",
|
|
3473
3466
|
pointerEvents: "none",
|
|
3474
3467
|
...a
|
|
3475
3468
|
});
|
|
3476
|
-
},
|
|
3477
|
-
let { visible: t, targeted: n, reason: r } = e, i =
|
|
3469
|
+
}, Eo = (e) => {
|
|
3470
|
+
let { visible: t, targeted: n, reason: r } = e, i = tt({
|
|
3478
3471
|
id: "queue-send-now",
|
|
3479
3472
|
disabled: !t,
|
|
3480
3473
|
data: {
|
|
3481
3474
|
kind: "steer",
|
|
3482
3475
|
order: -1
|
|
3483
3476
|
}
|
|
3484
|
-
}), a =
|
|
3485
|
-
return t ? /* @__PURE__ */ J(
|
|
3477
|
+
}), a = pe({ recipe: p })();
|
|
3478
|
+
return t ? /* @__PURE__ */ J(j, {
|
|
3486
3479
|
ref: i.setNodeRef,
|
|
3487
3480
|
css: a.sendNowHit,
|
|
3488
|
-
children: /* @__PURE__ */ Y(
|
|
3481
|
+
children: /* @__PURE__ */ Y(j, {
|
|
3489
3482
|
css: a.sendNow,
|
|
3490
3483
|
bottom: "0",
|
|
3491
3484
|
title: r ?? void 0,
|
|
3492
3485
|
"aria-disabled": !!r,
|
|
3493
3486
|
"data-targeted": n && !r,
|
|
3494
3487
|
"data-queue-send-now": !0,
|
|
3495
|
-
children: [/* @__PURE__ */ J(
|
|
3488
|
+
children: [/* @__PURE__ */ J(we, { size: 14 }), /* @__PURE__ */ J(G, { children: "drop here to send now" })]
|
|
3496
3489
|
})
|
|
3497
3490
|
}) : null;
|
|
3498
|
-
},
|
|
3499
|
-
let { item: t, index: n, editor: r, source: i, destination: a, unavailableReason: o, editing: c, onEdit: l, onRemove: u } = e, d = !!(t.sending || t.steeringDelivery), f =
|
|
3491
|
+
}, Do = (e) => {
|
|
3492
|
+
let { item: t, index: n, editor: r, source: i, destination: a, unavailableReason: o, editing: c, onEdit: l, onRemove: u } = e, d = !!(t.sending || t.steeringDelivery), f = et({
|
|
3500
3493
|
id: t.id,
|
|
3501
3494
|
data: { item: t },
|
|
3502
3495
|
disabled: d
|
|
3503
|
-
}), m =
|
|
3496
|
+
}), m = pe({ recipe: p })(), [h, g] = Q(!1), [_, v] = Q(!1), y = Z(void 0), b = Z(null);
|
|
3504
3497
|
X(() => () => clearTimeout(y.current), []), X(() => {
|
|
3505
3498
|
c && b.current?.scrollIntoView({ block: "nearest" });
|
|
3506
3499
|
}, [c]);
|
|
3507
3500
|
let x = () => {
|
|
3508
3501
|
clearTimeout(y.current), g(!0);
|
|
3509
3502
|
}, S = !r;
|
|
3510
|
-
return /* @__PURE__ */ Y(
|
|
3503
|
+
return /* @__PURE__ */ Y(j, {
|
|
3511
3504
|
className: "group",
|
|
3512
3505
|
ref: (e) => {
|
|
3513
3506
|
f.setNodeRef(e), b.current = e;
|
|
@@ -3542,13 +3535,13 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3542
3535
|
css: m.handle,
|
|
3543
3536
|
disabled: d,
|
|
3544
3537
|
onClick: (e) => e.stopPropagation(),
|
|
3545
|
-
children: /* @__PURE__ */ J(
|
|
3538
|
+
children: /* @__PURE__ */ J(Le, { size: 14 })
|
|
3546
3539
|
}),
|
|
3547
3540
|
/* @__PURE__ */ Y(W, {
|
|
3548
3541
|
flex: "1",
|
|
3549
3542
|
minW: "0",
|
|
3550
3543
|
gap: "2xs",
|
|
3551
|
-
children: [r ?? /* @__PURE__ */ J(
|
|
3544
|
+
children: [r ?? /* @__PURE__ */ J(j, {
|
|
3552
3545
|
asChild: !0,
|
|
3553
3546
|
css: m.content,
|
|
3554
3547
|
children: /* @__PURE__ */ Y("button", {
|
|
@@ -3576,7 +3569,7 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3576
3569
|
children: "Delivery is unconfirmed. Saved input is kept and will not be replayed."
|
|
3577
3570
|
}) : null]
|
|
3578
3571
|
}),
|
|
3579
|
-
u && !r && !d ? /* @__PURE__ */ J(
|
|
3572
|
+
u && !r && !d ? /* @__PURE__ */ J(L, {
|
|
3580
3573
|
css: m.actions,
|
|
3581
3574
|
"data-visible": h || _ || c,
|
|
3582
3575
|
children: /* @__PURE__ */ J(R, {
|
|
@@ -3586,20 +3579,20 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3586
3579
|
onClick: (e) => {
|
|
3587
3580
|
e.stopPropagation(), u(t.id);
|
|
3588
3581
|
},
|
|
3589
|
-
children: /* @__PURE__ */ J(
|
|
3582
|
+
children: /* @__PURE__ */ J(qe, { size: 14 })
|
|
3590
3583
|
})
|
|
3591
3584
|
}) : null,
|
|
3592
|
-
/* @__PURE__ */ J(
|
|
3585
|
+
/* @__PURE__ */ J(To, {
|
|
3593
3586
|
item: t,
|
|
3594
3587
|
index: n,
|
|
3595
3588
|
kind: "before"
|
|
3596
3589
|
}),
|
|
3597
|
-
/* @__PURE__ */ J(
|
|
3590
|
+
/* @__PURE__ */ J(To, {
|
|
3598
3591
|
item: t,
|
|
3599
3592
|
index: n,
|
|
3600
3593
|
kind: "combine"
|
|
3601
3594
|
}),
|
|
3602
|
-
/* @__PURE__ */ J(
|
|
3595
|
+
/* @__PURE__ */ J(To, {
|
|
3603
3596
|
item: t,
|
|
3604
3597
|
index: n,
|
|
3605
3598
|
kind: "after"
|
|
@@ -3608,52 +3601,52 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3608
3601
|
a === "after" ? /* @__PURE__ */ J(s, { bottom: "0" }) : null
|
|
3609
3602
|
]
|
|
3610
3603
|
});
|
|
3611
|
-
},
|
|
3604
|
+
}, Oo = (e) => JSON.stringify([e.model, Object.entries(e.params ?? {}).sort(([e], [t]) => e.localeCompare(t))]), ko = (e) => {
|
|
3612
3605
|
let t = q(87), { items: r, editingItemId: i, editor: a, retainedEditor: o, retainedEditorPosition: s, dirtyItemIds: c, steeringUnavailableReason: l, onEdit: u, onRemove: d, onMove: f, onSteer: m, onCombine: h } = e, g;
|
|
3613
3606
|
t[0] === c ? g = t[1] : (g = c === void 0 ? [] : c, t[0] = c, t[1] = g);
|
|
3614
3607
|
let _ = g, v;
|
|
3615
3608
|
t[2] === Symbol.for("react.memo_cache_sentinel") ? (v = { recipe: p }, t[2] = v) : v = t[2];
|
|
3616
|
-
let y =
|
|
3609
|
+
let y = pe(v), b;
|
|
3617
3610
|
t[3] === y ? b = t[4] : (b = y(), t[3] = y, t[4] = b);
|
|
3618
3611
|
let x = b, [S, C] = Q(null), w;
|
|
3619
3612
|
t[5] === Symbol.for("react.memo_cache_sentinel") ? (w = { activationConstraint: { distance: 4 } }, t[5] = w) : w = t[5];
|
|
3620
3613
|
let T;
|
|
3621
|
-
t[6] === Symbol.for("react.memo_cache_sentinel") ? (T = { coordinateGetter: (e, t) =>
|
|
3622
|
-
let E = nt(
|
|
3614
|
+
t[6] === Symbol.for("react.memo_cache_sentinel") ? (T = { coordinateGetter: (e, t) => wo(e, t, C) }, t[6] = T) : T = t[6];
|
|
3615
|
+
let E = rt(nt(Ze, w), nt(Xe, T)), [D, O] = Q(null), k;
|
|
3623
3616
|
t[7] === Symbol.for("react.memo_cache_sentinel") ? (k = [], t[7] = k) : k = t[7];
|
|
3624
|
-
let [
|
|
3617
|
+
let [A, M] = Q(k), [N, P] = Q(null), [F, I] = Q(null), [L, ee] = Q(!1);
|
|
3625
3618
|
if (!r.length && !o) return null;
|
|
3626
|
-
let
|
|
3627
|
-
t[8] !== r || t[9] !== s ? (
|
|
3628
|
-
let
|
|
3629
|
-
t[11] !== _ || t[12] !== m || t[13] !== D || t[14] !== l ? (
|
|
3630
|
-
let
|
|
3631
|
-
t[16] !== _ || t[17] !== D ? (
|
|
3632
|
-
let
|
|
3633
|
-
t[19] !==
|
|
3634
|
-
let r =
|
|
3619
|
+
let R;
|
|
3620
|
+
t[8] !== r || t[9] !== s ? (R = Ao(r, s), t[8] = r, t[9] = s, t[10] = R) : R = t[10];
|
|
3621
|
+
let z = R, te;
|
|
3622
|
+
t[11] !== _ || t[12] !== m || t[13] !== D || t[14] !== l ? (te = D?.steeringUnavailableReason ?? l ?? (D && _.includes(D.id) ? "Update or Cancel this edit before sending." : null) ?? (m ? null : "This conversation cannot accept live input."), t[11] = _, t[12] = m, t[13] = D, t[14] = l, t[15] = te) : te = t[15];
|
|
3623
|
+
let B = te, ne = !!(D && m && !l), re;
|
|
3624
|
+
t[16] !== _ || t[17] !== D ? (re = (e) => !D || D.id === e.id ? "Choose another request." : _.includes(D.id) || _.includes(e.id) ? "Update or Cancel the edits first." : Oo(D) === Oo(e) ? e.steeringDelivery ? "Delivery is still being confirmed." : null : "Model and thinking settings must match.", t[16] = _, t[17] = D, t[18] = re) : re = t[18];
|
|
3625
|
+
let V = re, ie;
|
|
3626
|
+
t[19] !== A || t[20] !== f ? (ie = (e, t, n) => {
|
|
3627
|
+
let r = A.filter(Mo), i = r.findIndex((t) => t.id === e.id), a = r.findIndex((e) => e.id === t.id);
|
|
3635
3628
|
if (i < 0 || a < 0 || i === a) return;
|
|
3636
3629
|
let o = a + +(n === "after"), s = o - +(i < o);
|
|
3637
3630
|
if (s !== i) return f?.(e.id, s < i ? "up" : "down", Math.abs(s - i), {
|
|
3638
3631
|
source: e,
|
|
3639
|
-
items:
|
|
3632
|
+
items: A
|
|
3640
3633
|
});
|
|
3641
|
-
}, t[19] =
|
|
3642
|
-
let
|
|
3643
|
-
t[22] !==
|
|
3634
|
+
}, t[19] = A, t[20] = f, t[21] = ie) : ie = t[21];
|
|
3635
|
+
let H = ie, U;
|
|
3636
|
+
t[22] !== V || t[23] !== h || t[24] !== m || t[25] !== H || t[26] !== B ? (U = (e, t) => {
|
|
3644
3637
|
if (t.kind === "steer") {
|
|
3645
|
-
if (!
|
|
3646
|
-
I(
|
|
3638
|
+
if (!B) return m?.(e);
|
|
3639
|
+
I(B);
|
|
3647
3640
|
return;
|
|
3648
3641
|
}
|
|
3649
|
-
if (t.item) return t.kind === "combine" ?
|
|
3650
|
-
}, t[22] =
|
|
3651
|
-
let
|
|
3652
|
-
t[28] === S ?
|
|
3642
|
+
if (t.item) return t.kind === "combine" ? V(t.item) ? void 0 : h?.(e, t.item) : H(e, t.item, t.kind);
|
|
3643
|
+
}, t[22] = V, t[23] = h, t[24] = m, t[25] = H, t[26] = B, t[27] = U) : U = t[27];
|
|
3644
|
+
let ae = U, W;
|
|
3645
|
+
t[28] === S ? W = t[29] : (W = (e) => {
|
|
3653
3646
|
if (!e.pointerCoordinates && S !== null) return [{ id: S }];
|
|
3654
|
-
let t =
|
|
3655
|
-
return t.length ? t :
|
|
3656
|
-
}, t[28] = S, t[29] =
|
|
3647
|
+
let t = Qe(e);
|
|
3648
|
+
return t.length ? t : $e(e);
|
|
3649
|
+
}, t[28] = S, t[29] = W);
|
|
3657
3650
|
let oe;
|
|
3658
3651
|
t[30] === r ? oe = t[31] : (oe = (e) => {
|
|
3659
3652
|
C(null), O(e.active.data.current?.item ?? null), M(r), I(null);
|
|
@@ -3662,162 +3655,159 @@ var co = 3, lo = 20, uo = 1, fo = (e, t) => Math.abs(e.scrollTop - t.scrollTop)
|
|
|
3662
3655
|
t[32] === Symbol.for("react.memo_cache_sentinel") ? (se = (e) => P(e.over?.data.current ?? null), ce = () => {
|
|
3663
3656
|
C(null), O(null), P(null);
|
|
3664
3657
|
}, t[32] = se, t[33] = ce) : (se = t[32], ce = t[33]);
|
|
3665
|
-
let
|
|
3666
|
-
t[34] !== L || t[35] !==
|
|
3658
|
+
let le;
|
|
3659
|
+
t[34] !== L || t[35] !== ae || t[36] !== D ? (le = (e) => {
|
|
3667
3660
|
let t = D, n = e.over?.data.current;
|
|
3668
|
-
O(null), P(null), t && n && !L && (
|
|
3669
|
-
}, t[34] = L, t[35] =
|
|
3670
|
-
let
|
|
3671
|
-
t[38] !==
|
|
3672
|
-
visible:
|
|
3661
|
+
O(null), P(null), t && n && !L && (ee(!0), Promise.resolve().then(() => ae(t, n)).catch((e) => I(e instanceof Error ? e.message : "Could not change the queue. Saved input is kept.")).finally(() => ee(!1)));
|
|
3662
|
+
}, t[34] = L, t[35] = ae, t[36] = D, t[37] = le) : le = t[37];
|
|
3663
|
+
let K = x.root, ue = N?.kind === "steer", de;
|
|
3664
|
+
t[38] !== ne || t[39] !== B || t[40] !== ue ? (de = /* @__PURE__ */ J(Eo, {
|
|
3665
|
+
visible: ne,
|
|
3673
3666
|
targeted: ue,
|
|
3674
|
-
reason:
|
|
3675
|
-
}), t[38] =
|
|
3676
|
-
let
|
|
3677
|
-
t[42] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3678
|
-
let
|
|
3679
|
-
if (t[43] !==
|
|
3667
|
+
reason: B
|
|
3668
|
+
}), t[38] = ne, t[39] = B, t[40] = ue, t[41] = de) : de = t[41];
|
|
3669
|
+
let fe;
|
|
3670
|
+
t[42] === Symbol.for("react.memo_cache_sentinel") ? (fe = { maxH: "queue-viewport" }, t[42] = fe) : fe = t[42];
|
|
3671
|
+
let me;
|
|
3672
|
+
if (t[43] !== V || t[44] !== N || t[45] !== i || t[46] !== a || t[47] !== r || t[48] !== u || t[49] !== d || t[50] !== o || t[51] !== z || t[52] !== D?.id) {
|
|
3680
3673
|
let e;
|
|
3681
|
-
t[54] !==
|
|
3674
|
+
t[54] !== V || t[55] !== N || t[56] !== i || t[57] !== a || t[58] !== u || t[59] !== d || t[60] !== o || t[61] !== z || t[62] !== D?.id ? (e = (e, t) => /* @__PURE__ */ Y(he, { children: [o && t === z ? /* @__PURE__ */ J(jo, { children: o }) : null, /* @__PURE__ */ J(Do, {
|
|
3682
3675
|
item: e,
|
|
3683
3676
|
index: t,
|
|
3684
3677
|
source: D?.id === e.id,
|
|
3685
3678
|
destination: N?.item?.id === e.id ? N.kind : void 0,
|
|
3686
|
-
unavailableReason: N?.kind === "combine" ?
|
|
3679
|
+
unavailableReason: N?.kind === "combine" ? V(e) : null,
|
|
3687
3680
|
editing: i === e.id,
|
|
3688
3681
|
editor: i === e.id ? a : void 0,
|
|
3689
3682
|
onEdit: u,
|
|
3690
3683
|
onRemove: d
|
|
3691
|
-
})] }, e.id), t[54] =
|
|
3692
|
-
} else
|
|
3684
|
+
})] }, e.id), t[54] = V, t[55] = N, t[56] = i, t[57] = a, t[58] = u, t[59] = d, t[60] = o, t[61] = z, t[62] = D?.id, t[63] = e) : e = t[63], me = r.map(e), t[43] = V, t[44] = N, t[45] = i, t[46] = a, t[47] = r, t[48] = u, t[49] = d, t[50] = o, t[51] = z, t[52] = D?.id, t[53] = me;
|
|
3685
|
+
} else me = t[53];
|
|
3693
3686
|
let ge;
|
|
3694
|
-
t[64] !== r.length || t[65] !== o || t[66] !==
|
|
3687
|
+
t[64] !== r.length || t[65] !== o || t[66] !== z ? (ge = o && z === r.length ? /* @__PURE__ */ J(jo, { children: o }) : null, t[64] = r.length, t[65] = o, t[66] = z, t[67] = ge) : ge = t[67];
|
|
3695
3688
|
let _e;
|
|
3696
|
-
t[68] !==
|
|
3689
|
+
t[68] !== me || t[69] !== ge ? (_e = /* @__PURE__ */ Y(n, {
|
|
3697
3690
|
maxH: "queue-viewport",
|
|
3698
3691
|
minH: "0",
|
|
3699
|
-
viewportProps:
|
|
3700
|
-
children: [
|
|
3701
|
-
}), t[68] =
|
|
3692
|
+
viewportProps: fe,
|
|
3693
|
+
children: [me, ge]
|
|
3694
|
+
}), t[68] = me, t[69] = ge, t[70] = _e) : _e = t[70];
|
|
3702
3695
|
let ve;
|
|
3703
3696
|
t[71] !== F || t[72] !== x.notice ? (ve = F ? /* @__PURE__ */ J(G, {
|
|
3704
3697
|
css: x.notice,
|
|
3705
3698
|
role: "alert",
|
|
3706
3699
|
children: F
|
|
3707
3700
|
}) : null, t[71] = F, t[72] = x.notice, t[73] = ve) : ve = t[73];
|
|
3708
|
-
let
|
|
3709
|
-
t[74] !== L || t[75] !==
|
|
3710
|
-
css:
|
|
3711
|
-
"data-send-now-visible":
|
|
3701
|
+
let ye;
|
|
3702
|
+
t[74] !== L || t[75] !== ne || t[76] !== x.root || t[77] !== de || t[78] !== _e || t[79] !== ve ? (ye = /* @__PURE__ */ Y(j, {
|
|
3703
|
+
css: K,
|
|
3704
|
+
"data-send-now-visible": ne,
|
|
3712
3705
|
"aria-busy": L,
|
|
3713
3706
|
children: [
|
|
3714
3707
|
de,
|
|
3715
3708
|
_e,
|
|
3716
3709
|
ve
|
|
3717
3710
|
]
|
|
3718
|
-
}), t[74] = L, t[75] =
|
|
3719
|
-
let
|
|
3720
|
-
return t[81] !== E || t[82] !==
|
|
3711
|
+
}), t[74] = L, t[75] = ne, t[76] = x.root, t[77] = de, t[78] = _e, t[79] = ve, t[80] = ye) : ye = t[80];
|
|
3712
|
+
let X;
|
|
3713
|
+
return t[81] !== E || t[82] !== W || t[83] !== oe || t[84] !== le || t[85] !== ye ? (X = /* @__PURE__ */ J(Ye, {
|
|
3721
3714
|
sensors: E,
|
|
3722
|
-
collisionDetection:
|
|
3715
|
+
collisionDetection: W,
|
|
3723
3716
|
autoScroll: !0,
|
|
3724
3717
|
onDragStart: oe,
|
|
3725
3718
|
onDragOver: se,
|
|
3726
3719
|
onDragCancel: ce,
|
|
3727
|
-
onDragEnd:
|
|
3728
|
-
children:
|
|
3729
|
-
}), t[81] = E, t[82] =
|
|
3730
|
-
},
|
|
3720
|
+
onDragEnd: le,
|
|
3721
|
+
children: ye
|
|
3722
|
+
}), t[81] = E, t[82] = W, t[83] = oe, t[84] = le, t[85] = ye, t[86] = X) : X = t[86], X;
|
|
3723
|
+
}, Ao = (e, t = Infinity) => {
|
|
3731
3724
|
let n = e.findIndex((e) => (e.position ?? Infinity) > t);
|
|
3732
3725
|
return n < 0 ? e.length : n;
|
|
3733
|
-
},
|
|
3726
|
+
}, jo = (e) => {
|
|
3734
3727
|
let t = q(8), { children: n } = e, r;
|
|
3735
3728
|
t[0] === Symbol.for("react.memo_cache_sentinel") ? (r = { recipe: p }, t[0] = r) : r = t[0];
|
|
3736
|
-
let i =
|
|
3729
|
+
let i = pe(r), a;
|
|
3737
3730
|
t[1] === i ? a = t[2] : (a = i(), t[1] = i, t[2] = a);
|
|
3738
3731
|
let o = a, s;
|
|
3739
|
-
t[3] === n ? s = t[4] : (s = /* @__PURE__ */ J(
|
|
3732
|
+
t[3] === n ? s = t[4] : (s = /* @__PURE__ */ J(j, {
|
|
3740
3733
|
flex: "1",
|
|
3741
3734
|
minW: "0",
|
|
3742
3735
|
children: n
|
|
3743
3736
|
}), t[3] = n, t[4] = s);
|
|
3744
3737
|
let c;
|
|
3745
|
-
return t[5] !== o.row || t[6] !== s ? (c = /* @__PURE__ */ J(
|
|
3738
|
+
return t[5] !== o.row || t[6] !== s ? (c = /* @__PURE__ */ J(j, {
|
|
3746
3739
|
css: o.row,
|
|
3747
3740
|
children: s
|
|
3748
3741
|
}), t[5] = o.row, t[6] = s, t[7] = c) : c = t[7], c;
|
|
3749
3742
|
};
|
|
3750
|
-
function
|
|
3743
|
+
function Mo(e) {
|
|
3751
3744
|
return !e.sending && !e.steeringDelivery;
|
|
3752
3745
|
}
|
|
3753
3746
|
//#endregion
|
|
3754
3747
|
//#region src/components/chat-ui/components/chat-panel-composer.tsx
|
|
3755
|
-
var
|
|
3756
|
-
let t = q(
|
|
3757
|
-
t[0] ===
|
|
3758
|
-
let
|
|
3759
|
-
t[2] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3760
|
-
let
|
|
3761
|
-
t[3] ===
|
|
3762
|
-
let
|
|
3763
|
-
t[5] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3764
|
-
let
|
|
3765
|
-
t[6] !==
|
|
3766
|
-
let
|
|
3767
|
-
t[9] !==
|
|
3748
|
+
var No = (e) => {
|
|
3749
|
+
let t = q(40), { composerHeader: n, composerFallback: r, chatInputQuestionPrompt: i, composerDecision: a, hasWorkspaceHub: o, onQueuedFollowUpMove: s, onQueuedFollowUpRemove: c, onQueuedFollowUpUpdate: l, onQueuedFollowUpSteer: u, onQueuedFollowUpCombine: d, queueSteeringUnavailableReason: f, unsavedQueueItemIds: m, queuedComposer: h, queuedFollowUps: g, workspaceHub: _ } = e, v;
|
|
3750
|
+
t[0] === m ? v = t[1] : (v = m === void 0 ? [] : m, t[0] = m, t[1] = v);
|
|
3751
|
+
let y = v, b;
|
|
3752
|
+
t[2] === Symbol.for("react.memo_cache_sentinel") ? (b = { recipe: p }, t[2] = b) : b = t[2];
|
|
3753
|
+
let x = pe(b), S;
|
|
3754
|
+
t[3] === x ? S = t[4] : (S = x(), t[3] = x, t[4] = S);
|
|
3755
|
+
let C = S, w;
|
|
3756
|
+
t[5] === Symbol.for("react.memo_cache_sentinel") ? (w = { recipe: wt }, t[5] = w) : w = t[5];
|
|
3757
|
+
let T = pe(w), E;
|
|
3758
|
+
t[6] !== o || t[7] !== T ? (E = T({ workspace: o }), t[6] = o, t[7] = T, t[8] = E) : E = t[8];
|
|
3759
|
+
let D = E, O = g.length > 0, k = !!(i || a), A = h.isEditing && !k, M;
|
|
3760
|
+
t[9] !== A || t[10] !== O || t[11] !== e ? (M = /* @__PURE__ */ J(So, {
|
|
3768
3761
|
...e,
|
|
3769
|
-
editing:
|
|
3770
|
-
hasQueuedFollowUps:
|
|
3771
|
-
}), t[9] =
|
|
3772
|
-
let
|
|
3773
|
-
t[13] !==
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
}), t[16] = u, t[17] = o, t[18] = s, t[19] = l, t[20] = d, t[21] = m.editingItemId, t[22] = h, t[23] = N, t[24] = P, t[25] = F, t[26] = I, t[27] = M, t[28] = L) : L = t[28];
|
|
3789
|
-
let R;
|
|
3790
|
-
t[29] !== O || t[30] !== j || t[31] !== m.draftValue || t[32] !== m.selectDraft || t[33] !== S ? (R = O ? /* @__PURE__ */ J(A, {
|
|
3791
|
-
css: S.draft,
|
|
3762
|
+
editing: A,
|
|
3763
|
+
hasQueuedFollowUps: O
|
|
3764
|
+
}), t[9] = A, t[10] = O, t[11] = e, t[12] = M) : M = t[12];
|
|
3765
|
+
let N = M, P;
|
|
3766
|
+
t[13] !== r || t[14] !== A || t[15] !== N || t[16] !== d || t[17] !== s || t[18] !== c || t[19] !== u || t[20] !== l || t[21] !== f || t[22] !== h.createNew || t[23] !== h.dirtyItemIds || t[24] !== h.draftValue || t[25] !== h.edit || t[26] !== h.editingItem?.position || t[27] !== h.editingItemId || t[28] !== h.selectDraft || t[29] !== g || t[30] !== C || t[31] !== y ? (P = !r && /* @__PURE__ */ Y(me, { children: [/* @__PURE__ */ J(ko, {
|
|
3767
|
+
items: g,
|
|
3768
|
+
editor: A ? N : void 0,
|
|
3769
|
+
retainedEditor: A && h.createNew ? N : void 0,
|
|
3770
|
+
retainedEditorPosition: h.editingItem?.position,
|
|
3771
|
+
dirtyItemIds: [...h.dirtyItemIds, ...y],
|
|
3772
|
+
steeringUnavailableReason: f,
|
|
3773
|
+
onSteer: u,
|
|
3774
|
+
onCombine: d,
|
|
3775
|
+
editingItemId: h.editingItemId,
|
|
3776
|
+
onEdit: l ? h.edit : void 0,
|
|
3777
|
+
onRemove: c,
|
|
3778
|
+
onMove: s
|
|
3779
|
+
}), A && /* @__PURE__ */ J(j, {
|
|
3780
|
+
css: C.draft,
|
|
3792
3781
|
asChild: !0,
|
|
3793
3782
|
children: /* @__PURE__ */ J("button", {
|
|
3794
3783
|
type: "button",
|
|
3795
|
-
onClick:
|
|
3784
|
+
onClick: h.selectDraft,
|
|
3796
3785
|
"aria-label": "Edit saved draft",
|
|
3797
|
-
children:
|
|
3786
|
+
children: h.draftValue || "Saved draft · select to edit"
|
|
3798
3787
|
})
|
|
3799
|
-
})
|
|
3800
|
-
let
|
|
3801
|
-
return t[
|
|
3788
|
+
})] }), t[13] = r, t[14] = A, t[15] = N, t[16] = d, t[17] = s, t[18] = c, t[19] = u, t[20] = l, t[21] = f, t[22] = h.createNew, t[23] = h.dirtyItemIds, t[24] = h.draftValue, t[25] = h.edit, t[26] = h.editingItem?.position, t[27] = h.editingItemId, t[28] = h.selectDraft, t[29] = g, t[30] = C, t[31] = y, t[32] = P) : P = t[32];
|
|
3789
|
+
let F = !A && (!r || k) && N, I;
|
|
3790
|
+
return t[33] !== r || t[34] !== n || t[35] !== D.workspace || t[36] !== F || t[37] !== P || t[38] !== _ ? (I = /* @__PURE__ */ J(W, {
|
|
3802
3791
|
p: "xs",
|
|
3803
3792
|
gap: "0",
|
|
3804
|
-
children: /* @__PURE__ */ Y(
|
|
3793
|
+
children: /* @__PURE__ */ Y(j, {
|
|
3805
3794
|
className: "ps-chat-composer__workspace",
|
|
3806
|
-
css:
|
|
3795
|
+
css: D.workspace,
|
|
3807
3796
|
children: [
|
|
3808
|
-
|
|
3797
|
+
_,
|
|
3809
3798
|
n,
|
|
3810
|
-
|
|
3811
|
-
|
|
3799
|
+
r,
|
|
3800
|
+
P,
|
|
3801
|
+
F
|
|
3812
3802
|
]
|
|
3813
3803
|
})
|
|
3814
|
-
}), t[
|
|
3815
|
-
},
|
|
3804
|
+
}), t[33] = r, t[34] = n, t[35] = D.workspace, t[36] = F, t[37] = P, t[38] = _, t[39] = I) : I = t[39], I;
|
|
3805
|
+
}, Po = (e) => {
|
|
3816
3806
|
let t = Math.max(0, Math.floor(e));
|
|
3817
3807
|
if (t < 60) return `${t}s`;
|
|
3818
3808
|
let n = Math.floor(t / 60);
|
|
3819
3809
|
return n < 60 ? `${n}m ${String(t % 60).padStart(2, "0")}s` : `${Math.floor(n / 60)}h ${String(n % 60).padStart(2, "0")}m`;
|
|
3820
|
-
},
|
|
3810
|
+
}, Fo = (e) => {
|
|
3821
3811
|
let t = q(8), { startedAt: n, hidden: r } = e, i = r !== void 0 && r, [a] = Q(Date.now), [o, s] = Q(Date.now), c, l;
|
|
3822
3812
|
if (t[0] === i ? (c = t[1], l = t[2]) : (c = () => {
|
|
3823
3813
|
if (i) return;
|
|
@@ -3827,14 +3817,14 @@ var Mo = (e) => {
|
|
|
3827
3817
|
return () => clearInterval(t);
|
|
3828
3818
|
}, l = [i], t[0] = i, t[1] = c, t[2] = l), X(c, l), i) return null;
|
|
3829
3819
|
let u;
|
|
3830
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ J(
|
|
3820
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ J(ae, {
|
|
3831
3821
|
size: "xs",
|
|
3832
3822
|
color: "fg.muted"
|
|
3833
3823
|
}), t[3] = u) : u = t[3];
|
|
3834
3824
|
let d = (o - (n ?? a)) / 1e3, f;
|
|
3835
|
-
t[4] === d ? f = t[5] : (f =
|
|
3825
|
+
t[4] === d ? f = t[5] : (f = Po(d), t[4] = d, t[5] = f);
|
|
3836
3826
|
let p;
|
|
3837
|
-
return t[6] === f ? p = t[7] : (p = /* @__PURE__ */ Y(
|
|
3827
|
+
return t[6] === f ? p = t[7] : (p = /* @__PURE__ */ Y(L, {
|
|
3838
3828
|
gap: "2xs",
|
|
3839
3829
|
px: "sm",
|
|
3840
3830
|
py: "xs",
|
|
@@ -3846,179 +3836,180 @@ var Mo = (e) => {
|
|
|
3846
3836
|
children: f
|
|
3847
3837
|
})]
|
|
3848
3838
|
}), t[6] = f, t[7] = p), p;
|
|
3849
|
-
},
|
|
3850
|
-
let t = q(
|
|
3851
|
-
t[0] ===
|
|
3852
|
-
let
|
|
3853
|
-
t[2] ===
|
|
3854
|
-
let
|
|
3839
|
+
}, Io = (e) => {
|
|
3840
|
+
let t = q(114), { conversationKey: n, linkHandler: r, messages: i, loading: a, streaming: o, streamingStartedAt: s, emptyStateTitle: l, emptyStateDescription: u, emptyStateContent: d, loaderComponent: f, chatInputPlaceholder: p, chatInputDefaultValue: m, onSubmitMessage: h, onInterrupt: g, onAttachFiles: v, onAttachText: y, onChatInputChange: S, actions: C, attachmentActions: w, composerHeader: T, composerFallback: E, attachedResources: D, onClearAttachments: O, attachmentList: k, approvalPrompt: A, conversationNotices: M, workspaceHub: N, workspaceInitializing: P, inputDisabled: F, submitDisabled: L, chatInputQuestionPrompt: ee, composerDecision: R, chatInputAutoFocus: z, queuedFollowUps: te, onQueuedFollowUpUpdate: B, onQueuedFollowUpCreate: ne, onQueuedFollowUpRestoreDraft: re, canRestoreQueuedEditToDraft: V, onQueuedFollowUpSelect: ie, onQueuedFollowUpDiscard: H, onQueuedFollowUpSteer: U, onQueuedFollowUpCombine: ae, queueSteeringUnavailableReason: W, unsavedQueueItemIds: oe, onQueuedFollowUpRemove: G, onQueuedFollowUpMove: se, chatInputCommands: ce } = e, le = a !== void 0 && a, K = o !== void 0 && o, ue = m === void 0 ? "" : m, de = P !== void 0 && P, fe = F !== void 0 && F, pe = L !== void 0 && L, he = z !== void 0 && z, ge;
|
|
3841
|
+
t[0] === te ? ge = t[1] : (ge = te === void 0 ? [] : te, t[0] = te, t[1] = ge);
|
|
3842
|
+
let _e = ge, ve;
|
|
3843
|
+
t[2] === ce ? ve = t[3] : (ve = ce === void 0 ? [] : ce, t[2] = ce, t[3] = ve);
|
|
3844
|
+
let ye = ve, X, be, Z, xe, Se;
|
|
3855
3845
|
if (t[4] !== n || t[5] !== i || t[6] !== K) {
|
|
3856
|
-
let e =
|
|
3857
|
-
X = e.length > 0, Z = n ?? e[0]?.id,
|
|
3858
|
-
} else X = t[7],
|
|
3859
|
-
let { groups:
|
|
3860
|
-
t[12] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3846
|
+
let e = Za(i, { streaming: K });
|
|
3847
|
+
X = e.length > 0, Z = n ?? e[0]?.id, be = X ? Z ?? "active-conversation" : null, Se = e.reduce(Lo, 0), xe = $a(e), t[4] = n, t[5] = i, t[6] = K, t[7] = X, t[8] = be, t[9] = Z, t[10] = xe, t[11] = Se;
|
|
3848
|
+
} else X = t[7], be = t[8], Z = t[9], xe = t[10], Se = t[11];
|
|
3849
|
+
let { groups: Ce, leadingResponses: we } = xe, [Te, Ee] = Q(Ro), [De, Oe] = Q(null), ke = !X && le, Ae;
|
|
3850
|
+
t[12] === Symbol.for("react.memo_cache_sentinel") ? (Ae = /* @__PURE__ */ J(Be, {
|
|
3861
3851
|
size: 48,
|
|
3862
3852
|
strokeWidth: 1.5
|
|
3863
|
-
}), t[12] =
|
|
3864
|
-
let
|
|
3865
|
-
t[13] !== u || t[14] !== l ? (
|
|
3866
|
-
icon:
|
|
3853
|
+
}), t[12] = Ae) : Ae = t[12];
|
|
3854
|
+
let je;
|
|
3855
|
+
t[13] !== u || t[14] !== l ? (je = /* @__PURE__ */ J(c, {
|
|
3856
|
+
icon: Ae,
|
|
3867
3857
|
title: l,
|
|
3868
3858
|
description: u
|
|
3869
|
-
}), t[13] = u, t[14] = l, t[15] =
|
|
3870
|
-
let
|
|
3871
|
-
t[16] !==
|
|
3872
|
-
let
|
|
3873
|
-
t[20] !==
|
|
3874
|
-
queuedFollowUps:
|
|
3875
|
-
defaultValue:
|
|
3859
|
+
}), t[13] = u, t[14] = l, t[15] = je) : je = t[15];
|
|
3860
|
+
let Me = ke ? f : d ?? je, Ne = !!N, Pe = wn(i, n ?? i[0]?.id), Fe;
|
|
3861
|
+
t[16] !== ee || t[17] !== i || t[18] !== Pe.prompt ? (Fe = Pe.prompt ?? ee ?? bn(i), t[16] = ee, t[17] = i, t[18] = Pe.prompt, t[19] = Fe) : Fe = t[19];
|
|
3862
|
+
let Ie = Fe, Le = !!Ie, Re = K && X && !de && !Ie, ze = !be || De === be, Ve;
|
|
3863
|
+
t[20] !== V || t[21] !== ue || t[22] !== fe || t[23] !== S || t[24] !== ne || t[25] !== H || t[26] !== re || t[27] !== ie || t[28] !== B || t[29] !== h || t[30] !== _e ? (Ve = {
|
|
3864
|
+
queuedFollowUps: _e,
|
|
3865
|
+
defaultValue: ue,
|
|
3876
3866
|
onChange: S,
|
|
3877
3867
|
onSubmit: h,
|
|
3878
3868
|
onUpdate: B,
|
|
3879
|
-
onCreate:
|
|
3880
|
-
onRestoreDraft:
|
|
3881
|
-
canRestoreDraft:
|
|
3882
|
-
disabled:
|
|
3883
|
-
onSelect:
|
|
3884
|
-
onDiscard:
|
|
3885
|
-
}, t[20] =
|
|
3886
|
-
let
|
|
3887
|
-
t[32] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
3888
|
-
|
|
3869
|
+
onCreate: ne,
|
|
3870
|
+
onRestoreDraft: re,
|
|
3871
|
+
canRestoreDraft: V,
|
|
3872
|
+
disabled: fe,
|
|
3873
|
+
onSelect: ie,
|
|
3874
|
+
onDiscard: H
|
|
3875
|
+
}, t[20] = V, t[21] = ue, t[22] = fe, t[23] = S, t[24] = ne, t[25] = H, t[26] = re, t[27] = ie, t[28] = B, t[29] = h, t[30] = _e, t[31] = Ve) : Ve = t[31];
|
|
3876
|
+
let He = xo(Ve), Ue;
|
|
3877
|
+
t[32] === Symbol.for("react.memo_cache_sentinel") ? (Ue = (e) => {
|
|
3878
|
+
Ee((t) => {
|
|
3889
3879
|
let n = new Set(t);
|
|
3890
3880
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
3891
3881
|
});
|
|
3892
|
-
}, t[32] =
|
|
3893
|
-
let
|
|
3894
|
-
t[33] !== r || t[34] !== i ? (
|
|
3895
|
-
let
|
|
3896
|
-
t[36] !==
|
|
3897
|
-
conversationKey:
|
|
3898
|
-
userMessageCount:
|
|
3899
|
-
}), t[36] =
|
|
3900
|
-
let
|
|
3901
|
-
t[39] !==
|
|
3902
|
-
leadingResponses:
|
|
3903
|
-
groups:
|
|
3882
|
+
}, t[32] = Ue) : Ue = t[32];
|
|
3883
|
+
let We = Ue, Ge;
|
|
3884
|
+
t[33] !== r || t[34] !== i ? (Ge = x(i, r), t[33] = r, t[34] = i, t[35] = Ge) : Ge = t[35];
|
|
3885
|
+
let Ke = Pe.value, qe = Z ?? null, Je;
|
|
3886
|
+
t[36] !== qe || t[37] !== Se ? (Je = /* @__PURE__ */ J(Ct, {
|
|
3887
|
+
conversationKey: qe,
|
|
3888
|
+
userMessageCount: Se
|
|
3889
|
+
}), t[36] = qe, t[37] = Se, t[38] = Je) : Je = t[38];
|
|
3890
|
+
let Ye = ze ? "visible" : "hidden", Xe;
|
|
3891
|
+
t[39] !== M || t[40] !== Me || t[41] !== Te || t[42] !== Ce || t[43] !== X || t[44] !== Le || t[45] !== we || t[46] !== be || t[47] !== K ? (Xe = X ? /* @__PURE__ */ Y(me, { children: [/* @__PURE__ */ J(bo, {
|
|
3892
|
+
leadingResponses: we,
|
|
3893
|
+
groups: Ce,
|
|
3904
3894
|
streaming: K,
|
|
3905
|
-
hideActiveQuestionForms:
|
|
3906
|
-
expandedStickyMessageIds:
|
|
3907
|
-
onToggleStickyMessage:
|
|
3908
|
-
onReady: () =>
|
|
3909
|
-
},
|
|
3910
|
-
let Xe;
|
|
3911
|
-
t[49] !== Je || t[50] !== Ye ? (Xe = /* @__PURE__ */ J(lt.Viewport, {
|
|
3912
|
-
visibility: Je,
|
|
3913
|
-
children: Ye
|
|
3914
|
-
}), t[49] = Je, t[50] = Ye, t[51] = Xe) : Xe = t[51];
|
|
3895
|
+
hideActiveQuestionForms: Le,
|
|
3896
|
+
expandedStickyMessageIds: Te,
|
|
3897
|
+
onToggleStickyMessage: We,
|
|
3898
|
+
onReady: () => Oe(be)
|
|
3899
|
+
}, be), M] }) : /* @__PURE__ */ Y(me, { children: [M, Me] }), t[39] = M, t[40] = Me, t[41] = Te, t[42] = Ce, t[43] = X, t[44] = Le, t[45] = we, t[46] = be, t[47] = K, t[48] = Xe) : Xe = t[48];
|
|
3915
3900
|
let Ze;
|
|
3916
|
-
t[
|
|
3901
|
+
t[49] !== Ye || t[50] !== Xe ? (Ze = /* @__PURE__ */ J(ut.Viewport, {
|
|
3902
|
+
visibility: Ye,
|
|
3903
|
+
children: Xe
|
|
3904
|
+
}), t[49] = Ye, t[50] = Xe, t[51] = Ze) : Ze = t[51];
|
|
3917
3905
|
let Qe;
|
|
3918
|
-
t[
|
|
3919
|
-
qe,
|
|
3920
|
-
Xe,
|
|
3921
|
-
Ze
|
|
3922
|
-
] }, Z), t[54] = Z, t[55] = qe, t[56] = Xe, t[57] = Ze, t[58] = Qe) : Qe = t[58];
|
|
3906
|
+
t[52] === ze ? Qe = t[53] : (Qe = ze ? /* @__PURE__ */ J(ut.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, t[52] = ze, t[53] = Qe);
|
|
3923
3907
|
let $e;
|
|
3924
|
-
t[
|
|
3908
|
+
t[54] !== Z || t[55] !== Je || t[56] !== Ze || t[57] !== Qe ? ($e = /* @__PURE__ */ Y(ut.Root, { children: [
|
|
3909
|
+
Je,
|
|
3910
|
+
Ze,
|
|
3911
|
+
Qe
|
|
3912
|
+
] }, Z), t[54] = Z, t[55] = Je, t[56] = Ze, t[57] = Qe, t[58] = $e) : $e = t[58];
|
|
3913
|
+
let et;
|
|
3914
|
+
t[59] !== Z || t[60] !== Re || t[61] !== K || t[62] !== s ? (et = K ? /* @__PURE__ */ J(Fo, {
|
|
3925
3915
|
startedAt: s,
|
|
3926
|
-
hidden: !
|
|
3927
|
-
}, Z) : null, t[59] = Z, t[60] =
|
|
3928
|
-
let
|
|
3929
|
-
t[64] === i ?
|
|
3930
|
-
let
|
|
3931
|
-
t[66] !== C || t[67] !==
|
|
3932
|
-
conversationKey:
|
|
3933
|
-
recentUserMessages:
|
|
3916
|
+
hidden: !Re
|
|
3917
|
+
}, Z) : null, t[59] = Z, t[60] = Re, t[61] = K, t[62] = s, t[63] = et) : et = t[63];
|
|
3918
|
+
let tt = n ?? i[0]?.id, nt;
|
|
3919
|
+
t[64] === i ? nt = t[65] : (nt = Wn(i), t[64] = i, t[65] = nt);
|
|
3920
|
+
let rt = Pe.prompt ? void 0 : R, it;
|
|
3921
|
+
t[66] !== C || t[67] !== Ie || t[68] !== D || t[69] !== w || t[70] !== k || t[71] !== he || t[72] !== ye || t[73] !== p || t[74] !== E || t[75] !== T || t[76] !== Ne || t[77] !== fe || t[78] !== v || t[79] !== y || t[80] !== O || t[81] !== g || t[82] !== ae || t[83] !== se || t[84] !== G || t[85] !== U || t[86] !== B || t[87] !== W || t[88] !== He || t[89] !== _e || t[90] !== K || t[91] !== pe || t[92] !== tt || t[93] !== nt || t[94] !== rt || t[95] !== oe || t[96] !== N ? (it = /* @__PURE__ */ J(No, {
|
|
3922
|
+
conversationKey: tt,
|
|
3923
|
+
recentUserMessages: nt,
|
|
3934
3924
|
actions: C,
|
|
3935
3925
|
attachmentActions: w,
|
|
3936
3926
|
composerHeader: T,
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3927
|
+
composerFallback: E,
|
|
3928
|
+
attachedResources: D,
|
|
3929
|
+
attachmentList: k,
|
|
3930
|
+
chatInputAutoFocus: he,
|
|
3940
3931
|
chatInputPlaceholder: p,
|
|
3941
|
-
chatInputQuestionPrompt:
|
|
3942
|
-
composerDecision:
|
|
3943
|
-
chatInputCommands:
|
|
3944
|
-
hasWorkspaceHub:
|
|
3945
|
-
inputDisabled:
|
|
3946
|
-
submitDisabled:
|
|
3947
|
-
onAttachFiles:
|
|
3948
|
-
onAttachText:
|
|
3949
|
-
onClearAttachments:
|
|
3932
|
+
chatInputQuestionPrompt: Ie,
|
|
3933
|
+
composerDecision: rt,
|
|
3934
|
+
chatInputCommands: ye,
|
|
3935
|
+
hasWorkspaceHub: Ne,
|
|
3936
|
+
inputDisabled: fe,
|
|
3937
|
+
submitDisabled: pe,
|
|
3938
|
+
onAttachFiles: v,
|
|
3939
|
+
onAttachText: y,
|
|
3940
|
+
onClearAttachments: O,
|
|
3950
3941
|
onInterrupt: g,
|
|
3951
|
-
onQueuedFollowUpMove:
|
|
3942
|
+
onQueuedFollowUpMove: se,
|
|
3952
3943
|
onQueuedFollowUpRemove: G,
|
|
3953
3944
|
onQueuedFollowUpUpdate: B,
|
|
3954
3945
|
onQueuedFollowUpSteer: U,
|
|
3955
|
-
onQueuedFollowUpCombine:
|
|
3946
|
+
onQueuedFollowUpCombine: ae,
|
|
3956
3947
|
queueSteeringUnavailableReason: W,
|
|
3957
|
-
unsavedQueueItemIds:
|
|
3958
|
-
queuedComposer:
|
|
3959
|
-
queuedFollowUps:
|
|
3948
|
+
unsavedQueueItemIds: oe,
|
|
3949
|
+
queuedComposer: He,
|
|
3950
|
+
queuedFollowUps: _e,
|
|
3960
3951
|
streaming: K,
|
|
3961
|
-
workspaceHub:
|
|
3962
|
-
}), t[66] = C, t[67] =
|
|
3963
|
-
let
|
|
3964
|
-
t[
|
|
3952
|
+
workspaceHub: N
|
|
3953
|
+
}), t[66] = C, t[67] = Ie, t[68] = D, t[69] = w, t[70] = k, t[71] = he, t[72] = ye, t[73] = p, t[74] = E, t[75] = T, t[76] = Ne, t[77] = fe, t[78] = v, t[79] = y, t[80] = O, t[81] = g, t[82] = ae, t[83] = se, t[84] = G, t[85] = U, t[86] = B, t[87] = W, t[88] = He, t[89] = _e, t[90] = K, t[91] = pe, t[92] = tt, t[93] = nt, t[94] = rt, t[95] = oe, t[96] = N, t[97] = it) : it = t[97];
|
|
3954
|
+
let at;
|
|
3955
|
+
t[98] !== A || t[99] !== et || t[100] !== it ? (at = /* @__PURE__ */ Y(j, {
|
|
3965
3956
|
layerStyle: "chatContent",
|
|
3966
3957
|
flexShrink: "0",
|
|
3967
3958
|
children: [
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3959
|
+
A,
|
|
3960
|
+
et,
|
|
3961
|
+
it
|
|
3971
3962
|
]
|
|
3972
|
-
}), t[
|
|
3973
|
-
let
|
|
3974
|
-
t[
|
|
3963
|
+
}), t[98] = A, t[99] = et, t[100] = it, t[101] = at) : at = t[101];
|
|
3964
|
+
let ot;
|
|
3965
|
+
t[102] !== $e || t[103] !== at ? (ot = /* @__PURE__ */ Y(I, {
|
|
3975
3966
|
position: "relative",
|
|
3976
3967
|
direction: "column",
|
|
3977
3968
|
w: "full",
|
|
3978
3969
|
h: "full",
|
|
3979
3970
|
overflow: "hidden",
|
|
3980
|
-
children: [
|
|
3981
|
-
}), t[
|
|
3982
|
-
let ot;
|
|
3983
|
-
t[104] !== Ne.value || t[105] !== at ? (ot = /* @__PURE__ */ J(xn, {
|
|
3984
|
-
value: Ge,
|
|
3985
|
-
children: at
|
|
3986
|
-
}), t[104] = Ne.value, t[105] = at, t[106] = ot) : ot = t[106];
|
|
3971
|
+
children: [$e, at]
|
|
3972
|
+
}), t[102] = $e, t[103] = at, t[104] = ot) : ot = t[104];
|
|
3987
3973
|
let st;
|
|
3988
|
-
t[
|
|
3989
|
-
|
|
3974
|
+
t[105] !== Pe.value || t[106] !== ot ? (st = /* @__PURE__ */ J(Sn, {
|
|
3975
|
+
value: Ke,
|
|
3990
3976
|
children: ot
|
|
3991
|
-
}), t[
|
|
3977
|
+
}), t[105] = Pe.value, t[106] = ot, t[107] = st) : st = t[107];
|
|
3992
3978
|
let ct;
|
|
3993
|
-
|
|
3994
|
-
|
|
3979
|
+
t[108] !== r || t[109] !== st ? (ct = /* @__PURE__ */ J(_, {
|
|
3980
|
+
handler: r,
|
|
3995
3981
|
children: st
|
|
3996
|
-
}), t[
|
|
3982
|
+
}), t[108] = r, t[109] = st, t[110] = ct) : ct = t[110];
|
|
3983
|
+
let lt;
|
|
3984
|
+
return t[111] !== Ge || t[112] !== ct ? (lt = /* @__PURE__ */ J(b, {
|
|
3985
|
+
value: Ge,
|
|
3986
|
+
children: ct
|
|
3987
|
+
}), t[111] = Ge, t[112] = ct, t[113] = lt) : lt = t[113], lt;
|
|
3997
3988
|
};
|
|
3998
|
-
function
|
|
3989
|
+
function Lo(e, t) {
|
|
3999
3990
|
return e + +(t.role === "user");
|
|
4000
3991
|
}
|
|
4001
|
-
function
|
|
3992
|
+
function Ro() {
|
|
4002
3993
|
return /* @__PURE__ */ new Set();
|
|
4003
3994
|
}
|
|
4004
3995
|
//#endregion
|
|
4005
3996
|
//#region src/components/chat-ui/components/chat-skeleton.tsx
|
|
4006
|
-
var
|
|
3997
|
+
var zo = (e) => {
|
|
4007
3998
|
let t = q(4), { widths: n } = e, r;
|
|
4008
|
-
t[0] === n ? r = t[1] : (r = n.map(
|
|
3999
|
+
t[0] === n ? r = t[1] : (r = n.map(Vo), t[0] = n, t[1] = r);
|
|
4009
4000
|
let i;
|
|
4010
4001
|
return t[2] === r ? i = t[3] : (i = /* @__PURE__ */ J(W, {
|
|
4011
4002
|
gap: "xs",
|
|
4012
4003
|
w: "full",
|
|
4013
4004
|
children: r
|
|
4014
4005
|
}), t[2] = r, t[3] = i), i;
|
|
4015
|
-
},
|
|
4006
|
+
}, Bo = () => {
|
|
4016
4007
|
let e = q(2), t;
|
|
4017
|
-
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ J(
|
|
4008
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ J(mt.Root, {
|
|
4018
4009
|
from: "user",
|
|
4019
|
-
children: /* @__PURE__ */ J(
|
|
4010
|
+
children: /* @__PURE__ */ J(mt.Content, {
|
|
4020
4011
|
from: "user",
|
|
4021
|
-
children: /* @__PURE__ */ J(
|
|
4012
|
+
children: /* @__PURE__ */ J(zo, { widths: ["72%", "46%"] })
|
|
4022
4013
|
})
|
|
4023
4014
|
}), e[0] = t) : t = e[0];
|
|
4024
4015
|
let n;
|
|
@@ -4026,11 +4017,11 @@ var Ro = (e) => {
|
|
|
4026
4017
|
minH: "full",
|
|
4027
4018
|
py: "xs",
|
|
4028
4019
|
gap: "0",
|
|
4029
|
-
children: [t, /* @__PURE__ */ J(
|
|
4020
|
+
children: [t, /* @__PURE__ */ J(mt.Root, {
|
|
4030
4021
|
from: "assistant",
|
|
4031
|
-
children: /* @__PURE__ */ J(
|
|
4022
|
+
children: /* @__PURE__ */ J(mt.Content, {
|
|
4032
4023
|
from: "assistant",
|
|
4033
|
-
children: /* @__PURE__ */ J(
|
|
4024
|
+
children: /* @__PURE__ */ J(zo, { widths: [
|
|
4034
4025
|
"76%",
|
|
4035
4026
|
"62%",
|
|
4036
4027
|
"40%"
|
|
@@ -4039,8 +4030,8 @@ var Ro = (e) => {
|
|
|
4039
4030
|
})]
|
|
4040
4031
|
}), e[1] = n) : n = e[1], n;
|
|
4041
4032
|
};
|
|
4042
|
-
function
|
|
4043
|
-
return /* @__PURE__ */ J(
|
|
4033
|
+
function Vo(e, t) {
|
|
4034
|
+
return /* @__PURE__ */ J(H, {
|
|
4044
4035
|
height: "3",
|
|
4045
4036
|
width: e,
|
|
4046
4037
|
borderRadius: "xs"
|
|
@@ -4048,15 +4039,15 @@ function Bo(e, t) {
|
|
|
4048
4039
|
}
|
|
4049
4040
|
//#endregion
|
|
4050
4041
|
//#region src/components/chat-ui/components/conversation-browse.tsx
|
|
4051
|
-
var
|
|
4042
|
+
var Ho = 3, Uo = 10, Wo = 4, Go = (e, t) => {
|
|
4052
4043
|
if (t === null) return 0;
|
|
4053
4044
|
let n = Math.abs(e - t);
|
|
4054
|
-
return n >=
|
|
4055
|
-
},
|
|
4045
|
+
return n >= Wo ? 0 : (1 + Math.cos(Math.PI * n / Wo)) / 2;
|
|
4046
|
+
}, Ko = (e, t) => {
|
|
4056
4047
|
if (t === null) return "fg.subtle";
|
|
4057
4048
|
let n = Math.abs(e - t);
|
|
4058
|
-
return n < .5 ? "fg" : n <
|
|
4059
|
-
},
|
|
4049
|
+
return n < .5 ? "fg" : n < Wo ? "fg.muted" : "fg.subtle";
|
|
4050
|
+
}, qo = (e) => {
|
|
4060
4051
|
let t = q(11), { item: n, position: r } = e, i = `${r.left}px`, a = `${r.top}px`, o;
|
|
4061
4052
|
t[0] === n.message ? o = t[1] : (o = /* @__PURE__ */ J(G, {
|
|
4062
4053
|
textStyle: "label/S/medium",
|
|
@@ -4082,7 +4073,7 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4082
4073
|
children: [o, s]
|
|
4083
4074
|
}), t[4] = o, t[5] = s, t[6] = c) : c = t[6];
|
|
4084
4075
|
let l;
|
|
4085
|
-
return t[7] !== i || t[8] !== a || t[9] !== c ? (l = /* @__PURE__ */ J(
|
|
4076
|
+
return t[7] !== i || t[8] !== a || t[9] !== c ? (l = /* @__PURE__ */ J(ie, { children: /* @__PURE__ */ J(j, {
|
|
4086
4077
|
position: "fixed",
|
|
4087
4078
|
left: i,
|
|
4088
4079
|
ml: "2xs",
|
|
@@ -4094,9 +4085,9 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4094
4085
|
pointerEvents: "none",
|
|
4095
4086
|
children: c
|
|
4096
4087
|
}) }), t[7] = i, t[8] = a, t[9] = c, t[10] = l) : l = t[10], l;
|
|
4097
|
-
},
|
|
4088
|
+
}, Jo = (e) => {
|
|
4098
4089
|
let t = q(22), { items: n, onSelect: r, floating: i } = e, a = i !== void 0 && i, [o, s] = Q(null), [c, l] = Q(null);
|
|
4099
|
-
if (n.length <
|
|
4090
|
+
if (n.length < Ho) return null;
|
|
4100
4091
|
let u;
|
|
4101
4092
|
t[0] === n.length ? u = t[1] : (u = (e) => {
|
|
4102
4093
|
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientY - t.top) / t.height, i = Math.min(n.length - 1, Math.max(0, r * n.length - .5)), a = Math.round(i);
|
|
@@ -4121,8 +4112,8 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4121
4112
|
t[9] !== r || t[10] !== o ? (e = (e, t) => /* @__PURE__ */ J(K.button, {
|
|
4122
4113
|
type: "button",
|
|
4123
4114
|
h: "2px",
|
|
4124
|
-
w: `${
|
|
4125
|
-
bg:
|
|
4115
|
+
w: `${Uo + 16 * Go(t, o)}px`,
|
|
4116
|
+
bg: Ko(t, o),
|
|
4126
4117
|
borderRadius: "1px",
|
|
4127
4118
|
transition: "width 80ms linear, background-color 80ms linear",
|
|
4128
4119
|
"aria-label": `Jump to message ${t + 1}`,
|
|
@@ -4130,7 +4121,7 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4130
4121
|
}, e.id), t[9] = r, t[10] = o, t[11] = e) : e = t[11], g = n.map(e), t[5] = n, t[6] = r, t[7] = o, t[8] = g;
|
|
4131
4122
|
} else g = t[8];
|
|
4132
4123
|
let _;
|
|
4133
|
-
t[12] !== d || t[13] !== h || t[14] !== g ? (_ = /* @__PURE__ */ J(
|
|
4124
|
+
t[12] !== d || t[13] !== h || t[14] !== g ? (_ = /* @__PURE__ */ J(I, {
|
|
4134
4125
|
direction: "column",
|
|
4135
4126
|
align: "flex-start",
|
|
4136
4127
|
gap: "1.5",
|
|
@@ -4143,22 +4134,22 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4143
4134
|
children: g
|
|
4144
4135
|
}), t[12] = d, t[13] = h, t[14] = g, t[15] = _) : _ = t[15];
|
|
4145
4136
|
let v;
|
|
4146
|
-
t[16] !== p || t[17] !== c ? (v = p && c ? /* @__PURE__ */ J(
|
|
4137
|
+
t[16] !== p || t[17] !== c ? (v = p && c ? /* @__PURE__ */ J(qo, {
|
|
4147
4138
|
item: p,
|
|
4148
4139
|
position: c
|
|
4149
4140
|
}) : null, t[16] = p, t[17] = c, t[18] = v) : v = t[18];
|
|
4150
4141
|
let y;
|
|
4151
|
-
return t[19] !== _ || t[20] !== v ? (y = /* @__PURE__ */ Y(
|
|
4142
|
+
return t[19] !== _ || t[20] !== v ? (y = /* @__PURE__ */ Y(j, {
|
|
4152
4143
|
position: "relative",
|
|
4153
4144
|
w: "10",
|
|
4154
4145
|
flexShrink: 0,
|
|
4155
4146
|
children: [_, v]
|
|
4156
4147
|
}), t[19] = _, t[20] = v, t[21] = y) : y = t[21], y;
|
|
4157
|
-
},
|
|
4148
|
+
}, Yo = (e) => {
|
|
4158
4149
|
let n = q(17), { tag: r } = e, i;
|
|
4159
|
-
n[0] !== r.description || n[1] !== r.label ? (i = /* @__PURE__ */ J(
|
|
4150
|
+
n[0] !== r.description || n[1] !== r.label ? (i = /* @__PURE__ */ J(re.Trigger, {
|
|
4160
4151
|
asChild: !0,
|
|
4161
|
-
children: /* @__PURE__ */ J(
|
|
4152
|
+
children: /* @__PURE__ */ J(oe.Label, {
|
|
4162
4153
|
asChild: !0,
|
|
4163
4154
|
children: /* @__PURE__ */ J("button", {
|
|
4164
4155
|
type: "button",
|
|
@@ -4168,12 +4159,12 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4168
4159
|
})
|
|
4169
4160
|
}), n[0] = r.description, n[1] = r.label, n[2] = i) : i = n[2];
|
|
4170
4161
|
let a = r.closeLabel ?? `Remove ${r.label}`, o;
|
|
4171
|
-
n[3] !== a || n[4] !== r.onClose ? (o = /* @__PURE__ */ J(
|
|
4162
|
+
n[3] !== a || n[4] !== r.onClose ? (o = /* @__PURE__ */ J(oe.CloseTrigger, {
|
|
4172
4163
|
"aria-label": a,
|
|
4173
4164
|
onClick: r.onClose
|
|
4174
4165
|
}), n[3] = a, n[4] = r.onClose, n[5] = o) : o = n[5];
|
|
4175
4166
|
let s;
|
|
4176
|
-
n[6] !== i || n[7] !== o ? (s = /* @__PURE__ */ Y(
|
|
4167
|
+
n[6] !== i || n[7] !== o ? (s = /* @__PURE__ */ Y(oe.Root, {
|
|
4177
4168
|
variant: "ticket",
|
|
4178
4169
|
size: "composer",
|
|
4179
4170
|
children: [i, o]
|
|
@@ -4186,18 +4177,18 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4186
4177
|
children: s
|
|
4187
4178
|
}), n[9] = s, n[10] = r.description, n[11] = c) : c = n[11];
|
|
4188
4179
|
let l;
|
|
4189
|
-
n[12] === r.description ? l = n[13] : (l = /* @__PURE__ */ J(
|
|
4180
|
+
n[12] === r.description ? l = n[13] : (l = /* @__PURE__ */ J(ie, { children: /* @__PURE__ */ J(re.Positioner, { children: /* @__PURE__ */ J(re.Content, { children: /* @__PURE__ */ J(G, {
|
|
4190
4181
|
p: "sm",
|
|
4191
4182
|
textStyle: "label/S/regular",
|
|
4192
4183
|
overflowWrap: "anywhere",
|
|
4193
4184
|
children: r.description
|
|
4194
4185
|
}) }) }) }), n[12] = r.description, n[13] = l);
|
|
4195
4186
|
let u;
|
|
4196
|
-
return n[14] !== c || n[15] !== l ? (u = /* @__PURE__ */ Y(
|
|
4197
|
-
},
|
|
4187
|
+
return n[14] !== c || n[15] !== l ? (u = /* @__PURE__ */ Y(re.Root, { children: [c, l] }), n[14] = c, n[15] = l, n[16] = u) : u = n[16], u;
|
|
4188
|
+
}, Xo = (e) => {
|
|
4198
4189
|
let n = q(64), { mode: i, pending: a, unavailable: o, onRequestConfirmation: s, onAction: c } = e, u;
|
|
4199
4190
|
n[0] === Symbol.for("react.memo_cache_sentinel") ? (u = { key: "menu" }, n[0] = u) : u = n[0];
|
|
4200
|
-
let d =
|
|
4191
|
+
let d = pe(u), f;
|
|
4201
4192
|
n[1] === d ? f = n[2] : (f = d(), n[1] = d, n[2] = f);
|
|
4202
4193
|
let p = f, [m, h] = Q(null), [g, _] = Q(""), [v, y] = Q(!1), b;
|
|
4203
4194
|
if (n[3] !== i.actions || n[4] !== i.closeActionId) {
|
|
@@ -4220,16 +4211,16 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4220
4211
|
y(e.open), e.open || h(null);
|
|
4221
4212
|
}, n[11] = T, n[12] = E) : (T = n[11], E = n[12]);
|
|
4222
4213
|
let D = `${i.label}: ${i.description} · ${w}`, O;
|
|
4223
|
-
n[13] !== i.indicator || n[14] !== o ? (O = i.indicator ? /* @__PURE__ */ J(
|
|
4214
|
+
n[13] !== i.indicator || n[14] !== o ? (O = i.indicator ? /* @__PURE__ */ J(oe.StartElement, { children: /* @__PURE__ */ J(K.span, {
|
|
4224
4215
|
role: "img",
|
|
4225
4216
|
"aria-label": o ? "Status unavailable" : i.indicator.label,
|
|
4226
4217
|
"data-status-dot": "",
|
|
4227
4218
|
"data-tone": o ? "neutral" : i.indicator.tone
|
|
4228
4219
|
}) }) : null, n[13] = i.indicator, n[14] = o, n[15] = O) : O = n[15];
|
|
4229
4220
|
let k = `${i.label} details`, A;
|
|
4230
|
-
n[16] !== i.label || n[17] !== k ? (A = /* @__PURE__ */ J(
|
|
4221
|
+
n[16] !== i.label || n[17] !== k ? (A = /* @__PURE__ */ J(V.Trigger, {
|
|
4231
4222
|
asChild: !0,
|
|
4232
|
-
children: /* @__PURE__ */ J(
|
|
4223
|
+
children: /* @__PURE__ */ J(oe.Label, {
|
|
4233
4224
|
asChild: !0,
|
|
4234
4225
|
children: /* @__PURE__ */ J("button", {
|
|
4235
4226
|
type: "button",
|
|
@@ -4238,85 +4229,85 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4238
4229
|
})
|
|
4239
4230
|
})
|
|
4240
4231
|
}), n[16] = i.label, n[17] = k, n[18] = A) : A = n[18];
|
|
4241
|
-
let
|
|
4242
|
-
n[19] !== x || n[20] !== C || n[21] !== a || n[22] !== o ? (
|
|
4232
|
+
let j;
|
|
4233
|
+
n[19] !== x || n[20] !== C || n[21] !== a || n[22] !== o ? (j = x ? /* @__PURE__ */ J(oe.CloseTrigger, {
|
|
4243
4234
|
"aria-label": x.label,
|
|
4244
4235
|
disabled: a || o,
|
|
4245
4236
|
onClick: () => void C(x)
|
|
4246
|
-
}) : null, n[19] = x, n[20] = C, n[21] = a, n[22] = o, n[23] =
|
|
4237
|
+
}) : null, n[19] = x, n[20] = C, n[21] = a, n[22] = o, n[23] = j) : j = n[23];
|
|
4247
4238
|
let N;
|
|
4248
|
-
n[24] !== A || n[25] !==
|
|
4239
|
+
n[24] !== A || n[25] !== j || n[26] !== O ? (N = /* @__PURE__ */ Y(oe.Root, {
|
|
4249
4240
|
variant: "ticket",
|
|
4250
4241
|
size: "composer",
|
|
4251
4242
|
children: [
|
|
4252
4243
|
O,
|
|
4253
4244
|
A,
|
|
4254
|
-
|
|
4245
|
+
j
|
|
4255
4246
|
]
|
|
4256
|
-
}), n[24] = A, n[25] =
|
|
4257
|
-
let
|
|
4258
|
-
n[28] !== N || n[29] !== D ? (
|
|
4247
|
+
}), n[24] = A, n[25] = j, n[26] = O, n[27] = N) : N = n[27];
|
|
4248
|
+
let P;
|
|
4249
|
+
n[28] !== N || n[29] !== D ? (P = /* @__PURE__ */ J(t, {
|
|
4259
4250
|
content: D,
|
|
4260
4251
|
openDelay: 300,
|
|
4261
4252
|
closeDelay: 150,
|
|
4262
4253
|
children: N
|
|
4263
|
-
}), n[28] = N, n[29] = D, n[30] =
|
|
4264
|
-
let
|
|
4265
|
-
n[31] === i.label ?
|
|
4254
|
+
}), n[28] = N, n[29] = D, n[30] = P) : P = n[30];
|
|
4255
|
+
let I = `${i.label} details`, R;
|
|
4256
|
+
n[31] === i.label ? R = n[32] : (R = /* @__PURE__ */ J(G, {
|
|
4266
4257
|
textStyle: "label/S/medium",
|
|
4267
4258
|
children: i.label
|
|
4268
|
-
}), n[31] = i.label, n[32] =
|
|
4269
|
-
let
|
|
4270
|
-
n[33] === i.description ?
|
|
4259
|
+
}), n[31] = i.label, n[32] = R);
|
|
4260
|
+
let z;
|
|
4261
|
+
n[33] === i.description ? z = n[34] : (z = /* @__PURE__ */ J(G, {
|
|
4271
4262
|
textStyle: "label/S/regular",
|
|
4272
4263
|
overflowWrap: "anywhere",
|
|
4273
4264
|
children: i.description
|
|
4274
|
-
}), n[33] = i.description, n[34] =
|
|
4275
|
-
let
|
|
4276
|
-
n[35] === w ?
|
|
4265
|
+
}), n[33] = i.description, n[34] = z);
|
|
4266
|
+
let B;
|
|
4267
|
+
n[35] === w ? B = n[36] : (B = /* @__PURE__ */ J(G, {
|
|
4277
4268
|
textStyle: "label/XS/regular",
|
|
4278
4269
|
color: "fg.muted",
|
|
4279
4270
|
children: w
|
|
4280
|
-
}), n[35] = w, n[36] =
|
|
4281
|
-
let
|
|
4282
|
-
n[37] !== g || n[38] !== m || n[39] !== C || n[40] !== a || n[41] !== o ? (
|
|
4283
|
-
/* @__PURE__ */ J(
|
|
4284
|
-
/* @__PURE__ */ J(
|
|
4271
|
+
}), n[35] = w, n[36] = B);
|
|
4272
|
+
let ne;
|
|
4273
|
+
n[37] !== g || n[38] !== m || n[39] !== C || n[40] !== a || n[41] !== o ? (ne = m?.action.argument ? /* @__PURE__ */ Y(F.Root, { children: [
|
|
4274
|
+
/* @__PURE__ */ J(F.Label, { children: m.action.argument.label }),
|
|
4275
|
+
/* @__PURE__ */ J(te, {
|
|
4285
4276
|
autoFocus: !0,
|
|
4286
4277
|
size: "sm",
|
|
4287
4278
|
value: g,
|
|
4288
4279
|
onChange: (e) => _(e.target.value)
|
|
4289
4280
|
}),
|
|
4290
|
-
/* @__PURE__ */ Y(
|
|
4281
|
+
/* @__PURE__ */ Y(L, { children: [/* @__PURE__ */ J(M, {
|
|
4291
4282
|
size: "xs",
|
|
4292
4283
|
variant: "ghost",
|
|
4293
4284
|
onClick: () => h(null),
|
|
4294
4285
|
children: "Cancel"
|
|
4295
|
-
}), /* @__PURE__ */ J(
|
|
4286
|
+
}), /* @__PURE__ */ J(M, {
|
|
4296
4287
|
size: "xs",
|
|
4297
4288
|
variant: "ghost",
|
|
4298
4289
|
disabled: a || o || !g.trim(),
|
|
4299
4290
|
onClick: () => void C(m.action, g, m.mode),
|
|
4300
4291
|
children: "Apply"
|
|
4301
4292
|
})] })
|
|
4302
|
-
] }) : null, n[37] = g, n[38] = m, n[39] = C, n[40] = a, n[41] = o, n[42] =
|
|
4293
|
+
] }) : null, n[37] = g, n[38] = m, n[39] = C, n[40] = a, n[41] = o, n[42] = ne) : ne = n[42];
|
|
4303
4294
|
let re;
|
|
4304
|
-
n[43] !==
|
|
4295
|
+
n[43] !== R || n[44] !== z || n[45] !== B || n[46] !== ne ? (re = /* @__PURE__ */ Y(W, {
|
|
4305
4296
|
p: "sm",
|
|
4306
4297
|
gap: "xs",
|
|
4307
4298
|
children: [
|
|
4299
|
+
R,
|
|
4308
4300
|
z,
|
|
4309
4301
|
B,
|
|
4310
|
-
|
|
4311
|
-
V
|
|
4302
|
+
ne
|
|
4312
4303
|
]
|
|
4313
|
-
}), n[43] =
|
|
4314
|
-
let
|
|
4315
|
-
n[48] !== m || n[49] !== C || n[50] !== i || n[51] !== s || n[52] !== a || n[53] !== o ? (
|
|
4304
|
+
}), n[43] = R, n[44] = z, n[45] = B, n[46] = ne, n[47] = re) : re = n[47];
|
|
4305
|
+
let H;
|
|
4306
|
+
n[48] !== m || n[49] !== C || n[50] !== i || n[51] !== s || n[52] !== a || n[53] !== o ? (H = m ? null : i.actions.map((e) => /* @__PURE__ */ J(r, {
|
|
4316
4307
|
role: "button",
|
|
4317
4308
|
variant: "full-width",
|
|
4318
4309
|
label: e.label,
|
|
4319
|
-
icon: e.icon ? /* @__PURE__ */ J(
|
|
4310
|
+
icon: e.icon ? /* @__PURE__ */ J(ee, {
|
|
4320
4311
|
as: l(e.icon),
|
|
4321
4312
|
boxSize: "icon-xs"
|
|
4322
4313
|
}) : void 0,
|
|
@@ -4327,25 +4318,25 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4327
4318
|
mode: i
|
|
4328
4319
|
})) : C(e);
|
|
4329
4320
|
}
|
|
4330
|
-
}, e.id)), n[48] = m, n[49] = C, n[50] = i, n[51] = s, n[52] = a, n[53] = o, n[54] =
|
|
4331
|
-
let
|
|
4332
|
-
n[55] !== p.content || n[56] !==
|
|
4321
|
+
}, e.id)), n[48] = m, n[49] = C, n[50] = i, n[51] = s, n[52] = a, n[53] = o, n[54] = H) : H = n[54];
|
|
4322
|
+
let U;
|
|
4323
|
+
n[55] !== p.content || n[56] !== I || n[57] !== re || n[58] !== H ? (U = /* @__PURE__ */ J(ie, { children: /* @__PURE__ */ J(V.Positioner, { children: /* @__PURE__ */ Y(V.Content, {
|
|
4333
4324
|
css: p.content,
|
|
4334
|
-
"aria-label":
|
|
4335
|
-
children: [re,
|
|
4336
|
-
}) }) }), n[55] = p.content, n[56] =
|
|
4337
|
-
let
|
|
4338
|
-
return n[60] !== v || n[61] !==
|
|
4325
|
+
"aria-label": I,
|
|
4326
|
+
children: [re, H]
|
|
4327
|
+
}) }) }), n[55] = p.content, n[56] = I, n[57] = re, n[58] = H, n[59] = U) : U = n[59];
|
|
4328
|
+
let ae;
|
|
4329
|
+
return n[60] !== v || n[61] !== P || n[62] !== U ? (ae = /* @__PURE__ */ Y(V.Root, {
|
|
4339
4330
|
open: v,
|
|
4340
4331
|
positioning: T,
|
|
4341
4332
|
onOpenChange: E,
|
|
4342
|
-
children: [
|
|
4343
|
-
}), n[60] = v, n[61] =
|
|
4344
|
-
},
|
|
4333
|
+
children: [P, U]
|
|
4334
|
+
}), n[60] = v, n[61] = P, n[62] = U, n[63] = ae) : ae = n[63], ae;
|
|
4335
|
+
}, Zo = (e) => {
|
|
4345
4336
|
let t = q(19), { modes: n, draftTag: r, sentTag: i, pending: a, unavailable: o, onRequestConfirmation: s, onAction: c } = e, l;
|
|
4346
4337
|
if (t[0] !== n || t[1] !== c || t[2] !== s || t[3] !== a || t[4] !== o) {
|
|
4347
4338
|
let e;
|
|
4348
|
-
t[6] !== c || t[7] !== s || t[8] !== a || t[9] !== o ? (e = (e) => /* @__PURE__ */ J(
|
|
4339
|
+
t[6] !== c || t[7] !== s || t[8] !== a || t[9] !== o ? (e = (e) => /* @__PURE__ */ J(Xo, {
|
|
4349
4340
|
mode: e,
|
|
4350
4341
|
pending: a,
|
|
4351
4342
|
unavailable: o,
|
|
@@ -4354,11 +4345,11 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4354
4345
|
}, e.id), t[6] = c, t[7] = s, t[8] = a, t[9] = o, t[10] = e) : e = t[10], l = n.map(e), t[0] = n, t[1] = c, t[2] = s, t[3] = a, t[4] = o, t[5] = l;
|
|
4355
4346
|
} else l = t[5];
|
|
4356
4347
|
let u;
|
|
4357
|
-
t[11] === r ? u = t[12] : (u = r ? /* @__PURE__ */ J(
|
|
4348
|
+
t[11] === r ? u = t[12] : (u = r ? /* @__PURE__ */ J(Yo, { tag: r }) : null, t[11] = r, t[12] = u);
|
|
4358
4349
|
let d;
|
|
4359
|
-
t[13] === i ? d = t[14] : (d = i ? /* @__PURE__ */ J(
|
|
4350
|
+
t[13] === i ? d = t[14] : (d = i ? /* @__PURE__ */ J(Yo, { tag: i }) : null, t[13] = i, t[14] = d);
|
|
4360
4351
|
let f;
|
|
4361
|
-
return t[15] !== l || t[16] !== u || t[17] !== d ? (f = /* @__PURE__ */ Y(
|
|
4352
|
+
return t[15] !== l || t[16] !== u || t[17] !== d ? (f = /* @__PURE__ */ Y(L, {
|
|
4362
4353
|
gap: "2xs",
|
|
4363
4354
|
minW: "0",
|
|
4364
4355
|
"aria-label": "Harness controls",
|
|
@@ -4368,16 +4359,16 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4368
4359
|
d
|
|
4369
4360
|
]
|
|
4370
4361
|
}), t[15] = l, t[16] = u, t[17] = d, t[18] = f) : f = t[18], f;
|
|
4371
|
-
},
|
|
4362
|
+
}, Qo = (e) => {
|
|
4372
4363
|
let t = q(13), { status: n, statusLabel: r, additions: i, deletions: a } = e;
|
|
4373
4364
|
if (n === "loading") {
|
|
4374
4365
|
let e;
|
|
4375
|
-
t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(
|
|
4366
|
+
t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(ae, {
|
|
4376
4367
|
size: "xs",
|
|
4377
4368
|
color: "fg.muted"
|
|
4378
4369
|
}), t[0] = e) : e = t[0];
|
|
4379
4370
|
let n = r ?? "Setting up workspace...", i;
|
|
4380
|
-
return t[1] === n ? i = t[2] : (i = /* @__PURE__ */ Y(
|
|
4371
|
+
return t[1] === n ? i = t[2] : (i = /* @__PURE__ */ Y(L, {
|
|
4381
4372
|
gap: "2xs",
|
|
4382
4373
|
minW: "0",
|
|
4383
4374
|
children: [e, /* @__PURE__ */ J(G, {
|
|
@@ -4390,12 +4381,12 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4390
4381
|
}
|
|
4391
4382
|
if (n === "error") {
|
|
4392
4383
|
let e;
|
|
4393
|
-
t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(
|
|
4384
|
+
t[3] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ J(xe, {
|
|
4394
4385
|
size: 14,
|
|
4395
4386
|
color: "var(--chakra-colors-fg-error)"
|
|
4396
4387
|
}), t[3] = e) : e = t[3];
|
|
4397
4388
|
let n = r ?? "Workspace setup failed", i;
|
|
4398
|
-
return t[4] === n ? i = t[5] : (i = /* @__PURE__ */ Y(
|
|
4389
|
+
return t[4] === n ? i = t[5] : (i = /* @__PURE__ */ Y(L, {
|
|
4399
4390
|
gap: "2xs",
|
|
4400
4391
|
minW: "0",
|
|
4401
4392
|
children: [e, /* @__PURE__ */ J(G, {
|
|
@@ -4420,31 +4411,31 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4420
4411
|
children: ["−", a]
|
|
4421
4412
|
}), t[8] = a, t[9] = s);
|
|
4422
4413
|
let c;
|
|
4423
|
-
return t[10] !== o || t[11] !== s ? (c = /* @__PURE__ */ Y(
|
|
4414
|
+
return t[10] !== o || t[11] !== s ? (c = /* @__PURE__ */ Y(L, {
|
|
4424
4415
|
gap: "2xs",
|
|
4425
4416
|
children: [o, s]
|
|
4426
4417
|
}), t[10] = o, t[11] = s, t[12] = c) : c = t[12], c;
|
|
4427
|
-
},
|
|
4418
|
+
}, $o = (e) => {
|
|
4428
4419
|
let t = q(13), { workspaceControl: n, additions: r, deletions: i, action: a, status: o, statusLabel: s } = e, c = o === void 0 ? "ready" : o, l;
|
|
4429
|
-
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ J(
|
|
4420
|
+
t[0] !== r || t[1] !== i || t[2] !== c || t[3] !== s ? (l = /* @__PURE__ */ J(Qo, {
|
|
4430
4421
|
status: c,
|
|
4431
4422
|
statusLabel: s,
|
|
4432
4423
|
additions: r,
|
|
4433
4424
|
deletions: i
|
|
4434
4425
|
}), t[0] = r, t[1] = i, t[2] = c, t[3] = s, t[4] = l) : l = t[4];
|
|
4435
4426
|
let u;
|
|
4436
|
-
t[5] !== l || t[6] !== n ? (u = /* @__PURE__ */ Y(
|
|
4427
|
+
t[5] !== l || t[6] !== n ? (u = /* @__PURE__ */ Y(L, {
|
|
4437
4428
|
gap: "sm",
|
|
4438
4429
|
minW: "0",
|
|
4439
4430
|
children: [n, l]
|
|
4440
4431
|
}), t[5] = l, t[6] = n, t[7] = u) : u = t[7];
|
|
4441
4432
|
let d;
|
|
4442
|
-
t[8] === a ? d = t[9] : (d = a ? /* @__PURE__ */ J(
|
|
4433
|
+
t[8] === a ? d = t[9] : (d = a ? /* @__PURE__ */ J(I, {
|
|
4443
4434
|
flexShrink: 0,
|
|
4444
4435
|
children: a
|
|
4445
4436
|
}) : null, t[8] = a, t[9] = d);
|
|
4446
4437
|
let f;
|
|
4447
|
-
return t[10] !== u || t[11] !== d ? (f = /* @__PURE__ */ Y(
|
|
4438
|
+
return t[10] !== u || t[11] !== d ? (f = /* @__PURE__ */ Y(I, {
|
|
4448
4439
|
align: "center",
|
|
4449
4440
|
justify: "space-between",
|
|
4450
4441
|
gap: "sm",
|
|
@@ -4456,6 +4447,6 @@ var Vo = 3, Ho = 10, Uo = 4, Wo = (e, t) => {
|
|
|
4456
4447
|
}), t[10] = u, t[11] = d, t[12] = f) : f = t[12], f;
|
|
4457
4448
|
};
|
|
4458
4449
|
//#endregion
|
|
4459
|
-
export {
|
|
4450
|
+
export { gt as ApprovalPrompt, yt as AttachmentList, Ct as AutoScroll, Qn as ChatInput, mt as ChatMessage, Io as ChatPanel, ut as ChatPrimitives, Bo as ChatSkeleton, $o as ChatWorkspaceHub, Jo as ConversationBrowse, Zo as HarnessControls, Ln as QuestionPromptControls, jt as SendButton, Tt as createSerializedPromptState, C as isGuessedChatLink, m as parseChatLink, zn as useQuestionPromptState };
|
|
4460
4451
|
|
|
4461
4452
|
//# sourceMappingURL=chat-ui.js.map
|