@pstdio/ui 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/chat-ui.js +1270 -1080
  2. package/dist/chat-ui.js.map +1 -1
  3. package/dist/components/chat-ui/components/ai-message.d.ts +2 -0
  4. package/dist/components/chat-ui/components/chat-message-list.d.ts +12 -0
  5. package/dist/components/chat-ui/components/chat-panel.d.ts +3 -1
  6. package/dist/components/chat-ui/components/message-action-panel.d.ts +10 -0
  7. package/dist/components/chat-ui/performance/chat-mount-metrics.d.ts +37 -0
  8. package/dist/components/chat-ui/performance/chat-panel.perf.d.ts +18 -0
  9. package/dist/components/chat-ui/performance/chat-performance-fixtures.d.ts +29 -0
  10. package/dist/components/chat-ui/performance/chat-performance-panel.d.ts +23 -0
  11. package/dist/components/chat-ui/performance/chat-performance-story-utils.d.ts +30 -0
  12. package/dist/components/code-editor.d.ts +1 -1
  13. package/dist/components/diff-viewer/build-changed-files-tree.d.ts +4 -0
  14. package/dist/components/diff-viewer/diff-card-body.d.ts +34 -0
  15. package/dist/components/diff-viewer/diff-card-content.d.ts +22 -0
  16. package/dist/components/diff-viewer/diff-card-load-state.d.ts +9 -0
  17. package/dist/components/diff-viewer/diff-card.d.ts +43 -0
  18. package/dist/components/diff-viewer/diff-drawer.d.ts +33 -0
  19. package/dist/components/diff-viewer/diff-editor.d.ts +20 -0
  20. package/dist/components/diff-viewer/diff-size.d.ts +14 -0
  21. package/dist/components/diff-viewer/diff-view-adapter.d.ts +27 -0
  22. package/dist/components/diff-viewer/diff-viewer.d.ts +14 -0
  23. package/dist/components/diff-viewer/diff-viewer.store.d.ts +21 -0
  24. package/dist/components/diff-viewer/file-list-panel.d.ts +19 -0
  25. package/dist/components/diff-viewer/index.d.ts +5 -0
  26. package/dist/components/diff-viewer/types.d.ts +13 -0
  27. package/dist/components/integration-card.d.ts +12 -0
  28. package/dist/components/list-row/list-row-menu.d.ts +12 -0
  29. package/dist/components/list-row/list-row.types.d.ts +8 -0
  30. package/dist/components/palette-filter.d.ts +23 -0
  31. package/dist/components/palette-list.d.ts +11 -0
  32. package/dist/components/palette-shortcut.d.ts +4 -0
  33. package/dist/components/palette.d.ts +47 -0
  34. package/dist/components/panel-sidebar-registration-context.d.ts +12 -0
  35. package/dist/components/param-editor-label.d.ts +6 -0
  36. package/dist/components/param-editor.d.ts +2 -2
  37. package/dist/components/param-editor.types.d.ts +6 -1
  38. package/dist/components/performance-panel.d.ts +40 -0
  39. package/dist/components/{folder-picker-dialog.d.ts → repo-picker-dialog.d.ts} +6 -6
  40. package/dist/components/resizable-split-layout.d.ts +20 -0
  41. package/dist/components/resizable-split-layout.handle.d.ts +17 -0
  42. package/dist/components/resource-context-menu.d.ts +1 -0
  43. package/dist/components/session-indicator.d.ts +2 -2
  44. package/dist/components/sidebar/sidebar-header.d.ts +0 -1
  45. package/dist/components/sidebar/sidebar.types.d.ts +7 -1
  46. package/dist/components/simple-card.d.ts +5 -0
  47. package/dist/components/tree-list/tree-list.d.ts +28 -1
  48. package/dist/index.d.ts +18 -8
  49. package/dist/index.js +4356 -2292
  50. package/dist/index.js.map +1 -1
  51. package/dist/radio-DJtQY9po.js +286 -0
  52. package/dist/radio-DJtQY9po.js.map +1 -0
  53. package/dist/style.css +1 -1
  54. package/dist/theme/custom/index.d.ts +2 -0
  55. package/dist/theme/custom/vscode-theme.d.ts +32 -0
  56. package/dist/theme/index.d.ts +2 -1
  57. package/dist/theme/recipes/dialog.d.ts +1 -1
  58. package/dist/theme/recipes/drawer.d.ts +1 -1
  59. package/dist/theme/recipes/menu.d.ts +1 -1
  60. package/dist/theme/recipes/tabs.d.ts +18 -0
  61. package/dist/{theme-0SQvHr1t.js → theme-D-aCJqTf.js} +200 -123
  62. package/dist/theme-D-aCJqTf.js.map +1 -0
  63. package/dist/theme.js +6 -4
  64. package/dist/utils/apply-theme-preference.d.ts +2 -0
  65. package/package.json +5 -2
  66. package/dist/components/app-shell/app-shell.d.ts +0 -1
  67. package/dist/components/app-shell/command-palette.d.ts +0 -16
  68. package/dist/components/app-shell/file-tree.d.ts +0 -7
  69. package/dist/components/app-shell/mock-chat.d.ts +0 -2
  70. package/dist/components/app-shell/mock-data.d.ts +0 -37
  71. package/dist/components/app-shell/pages/project-list-page.d.ts +0 -7
  72. package/dist/components/app-shell/pages/sessions-page.d.ts +0 -6
  73. package/dist/components/app-shell/pages/settings-page.d.ts +0 -5
  74. package/dist/components/app-shell/pages/ticket-details-page.d.ts +0 -7
  75. package/dist/components/app-shell/pages/tickets-page.d.ts +0 -7
  76. package/dist/components/app-shell/pages/workspace-page.d.ts +0 -1
  77. package/dist/components/app-shell/resizable-panel.d.ts +0 -13
  78. package/dist/components/attached-panel.utils.d.ts +0 -6
  79. package/dist/components/diff-card.d.ts +0 -17
  80. package/dist/components/diff-drawer.d.ts +0 -7
  81. package/dist/components/diff-editor.d.ts +0 -11
  82. package/dist/components/diff-view-adapter.d.ts +0 -14
  83. package/dist/components/properties.d.ts +0 -18
  84. package/dist/radio-C42qncrD.js +0 -236
  85. package/dist/radio-C42qncrD.js.map +0 -1
  86. package/dist/theme-0SQvHr1t.js.map +0 -1
  87. /package/dist/components/{diff-bubble.d.ts → diff-viewer/diff-bubble.d.ts} +0 -0
package/dist/chat-ui.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as l, jsxs as w, Fragment as It } from "react/jsx-runtime";
2
- import { c as S } from "react/compiler-runtime";
3
- import { chakra as _n, AbsoluteCenter as An, IconButton as Ut, defineSlotRecipe as Rn, createSlotRecipeContext as Bn, Text as F, Code as qt, Button as qe, HStack as Me, Box as M, Flex as fe, Stack as z, Textarea as In, Tooltip as tt, Portal as Pn, Kbd as Mn, Spacer as $n, Timeline as On, Span as Le, Avatar as Ie, Card as J, Link as Gt, Spinner as Pt, Skeleton as En } from "@chakra-ui/react";
4
- import { ArrowDownIcon as Dn, ShieldX as Ln, ShieldCheck as qn, Check as vn, Square as Qn, ArrowUp as Fn, Move as zn, FileDown as Wn, FileUp as Hn, FileDiff as jn, Trash2 as Nn, FilePen as Vn, FileText as Un, ListTree as Gn, Terminal as Kt, ListTodo as Kn, CircleQuestionMark as Xn, File as Yn, Globe as Jn, Search as Zn, AlertTriangle as Xt, DotIcon as eo, ChevronUpIcon as to, MessageCircleIcon as no } from "lucide-react";
5
- import { StickToBottom as oo, useStickToBottomContext as Mt } from "use-stick-to-bottom";
6
- import { S as Yt, T as so } from "./get-file-type-icon-Bwqf1WXA.js";
7
- import { useRef as nt, useEffect as De, useState as Z } from "react";
8
- import { i as Tt, P as ro, h as io, R as Jt, j as lo } from "./rich-message-33DPxuWJ.js";
1
+ import { jsx as l, jsxs as w, Fragment as Bt } from "react/jsx-runtime";
2
+ import { c as T } from "react/compiler-runtime";
3
+ import { chakra as Bn, AbsoluteCenter as Ln, IconButton as Lt, defineSlotRecipe as vn, createSlotRecipeContext as $n, Text as q, Code as qt, Button as Ke, HStack as Ee, Box as I, Flex as Ce, Stack as Z, Textarea as On, Tooltip as it, Portal as Dn, Kbd as Fn, Spacer as zn, Timeline as qn, Span as Ue, Avatar as qe, Card as le, Link as Jt, Spinner as vt, Skeleton as Qn } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as Hn, ShieldX as Wn, ShieldCheck as Nn, Check as Zt, Square as Vn, ArrowUp as jn, Copy as Un, Move as Kn, FileDown as Gn, FileUp as Xn, FileDiff as Yn, Trash2 as Jn, FilePen as Zn, FileText as es, ListTree as ts, Terminal as en, ListTodo as ns, CircleQuestionMark as ss, File as os, Globe as rs, Search as is, AlertTriangle as tn, DotIcon as ls, ChevronUpIcon as as, MessageCircleIcon as cs } from "lucide-react";
5
+ import { StickToBottom as us, useStickToBottomContext as ct } from "use-stick-to-bottom";
6
+ import { S as nn, T as sn } from "./get-file-type-icon-Bwqf1WXA.js";
7
+ import { useRef as Qe, useEffect as we, useState as G } from "react";
8
+ import { i as _t, P as ds, h as fs, R as on, j as ps } from "./rich-message-33DPxuWJ.js";
9
9
  import "@lexical/react/LexicalCollaborationContext";
10
10
  import "@lexical/react/LexicalCollaborationPlugin";
11
11
  import "@lexical/react/LexicalComposer";
@@ -33,13 +33,14 @@ import "@lexical/react/LexicalHistoryPlugin";
33
33
  import "@lexical/react/LexicalOnChangePlugin";
34
34
  import "@lexical/react/LexicalTreeView";
35
35
  import "@lexical/react/LexicalClickableLinkPlugin";
36
- import { C as Zt, R as co, a as ao, D as uo, b as en, A as vt, E as fo } from "./radio-C42qncrD.js";
37
- const po = {
36
+ import { C as rn, R as ms, a as hs, D as gs, b as ln, A as Qt, E as bs } from "./radio-DJtQY9po.js";
37
+ import { useVirtualizer as ys } from "@tanstack/react-virtual";
38
+ const xs = {
38
39
  "aria-roledescription": "conversation",
39
40
  initial: "instant",
40
41
  resize: "instant",
41
42
  role: "log"
42
- }, mo = _n(oo, {
43
+ }, Ss = Bn(us, {
43
44
  base: {
44
45
  position: "relative",
45
46
  flex: 1,
@@ -47,43 +48,45 @@ const po = {
47
48
  height: "full"
48
49
  }
49
50
  }, {
50
- forwardProps: ["resize"],
51
- defaultProps: po
52
- }), ho = (t) => {
53
- const e = S(9);
54
- let n, s;
51
+ forwardProps: ["initial", "resize"],
52
+ defaultProps: xs
53
+ }), Ts = (t) => {
54
+ const e = T(10);
55
+ let n, o;
55
56
  e[0] !== t ? ({
56
57
  children: n,
57
- ...s
58
- } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
58
+ ...o
59
+ } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
59
60
  const {
60
- contentRef: o,
61
+ contentRef: s,
61
62
  scrollRef: r
62
- } = Mt(), i = r, c = o;
63
- let a;
64
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = {
63
+ } = ct(), i = r, a = s;
64
+ let c, u;
65
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = {
66
+ zIndex: 2
67
+ }, u = {
65
68
  py: "sm",
66
69
  "aria-live": "polite",
67
70
  role: "list"
68
- }, e[3] = a) : a = e[3];
69
- let u;
70
- return e[4] !== n || e[5] !== s || e[6] !== i || e[7] !== c ? (u = /* @__PURE__ */ l(Yt, { ...s, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: c, contentProps: a, children: n }), e[4] = n, e[5] = s, e[6] = i, e[7] = c, e[8] = u) : u = e[8], u;
71
- }, go = {
71
+ }, e[3] = c, e[4] = u) : (c = e[3], u = e[4]);
72
+ let d;
73
+ return e[5] !== n || e[6] !== o || e[7] !== i || e[8] !== a ? (d = /* @__PURE__ */ l(nn, { ...o, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: a, verticalScrollbarProps: c, contentProps: u, children: n }), e[5] = n, e[6] = o, e[7] = i, e[8] = a, e[9] = d) : d = e[9], d;
74
+ }, ws = {
72
75
  axis: "horizontal",
73
76
  bottom: "md",
74
77
  zIndex: 2
75
- }, bo = (t) => {
76
- const e = S(4), {
78
+ }, ks = (t) => {
79
+ const e = T(4), {
77
80
  isAtBottom: n,
78
- scrollToBottom: s
79
- } = Mt();
80
- let o;
81
- return e[0] !== n || e[1] !== t || e[2] !== s ? (o = !n && /* @__PURE__ */ l(An, { ...go, children: /* @__PURE__ */ l(Ut, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(Dn, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = o) : o = e[3], o;
82
- }, Ct = {
83
- Root: mo,
84
- Viewport: ho,
85
- ScrollToBottom: bo
86
- }, xo = Rn({
81
+ scrollToBottom: o
82
+ } = ct();
83
+ let s;
84
+ return e[0] !== n || e[1] !== t || e[2] !== o ? (s = !n && /* @__PURE__ */ l(Ln, { ...ws, children: /* @__PURE__ */ l(Lt, { rounded: "full", onClick: () => o(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ l(Hn, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = o, e[3] = s) : s = e[3], s;
85
+ }, At = {
86
+ Root: Ss,
87
+ Viewport: Ts,
88
+ ScrollToBottom: ks
89
+ }, Cs = vn({
87
90
  className: "ai-message",
88
91
  slots: ["root", "content"],
89
92
  base: {
@@ -118,7 +121,9 @@ const po = {
118
121
  },
119
122
  content: {
120
123
  borderTopWidth: "1px",
124
+ borderRightWidth: "1px",
121
125
  borderBottomWidth: "1px",
126
+ borderLeftWidth: "1px",
122
127
  borderColor: "border.muted",
123
128
  bg: "bg.subtle",
124
129
  px: "xs",
@@ -191,604 +196,661 @@ const po = {
191
196
  shape: "rounded"
192
197
  }
193
198
  }), {
194
- withProvider: yo,
195
- withContext: So
196
- } = Bn({
197
- recipe: xo
198
- }), ko = yo("div", "root"), wo = So("div", "content"), de = {
199
- Root: ko,
200
- Content: wo
201
- }, To = (t) => {
199
+ withProvider: _s,
200
+ withContext: As
201
+ } = $n({
202
+ recipe: Cs
203
+ }), Rs = _s("div", "root"), Is = As("div", "content"), ke = {
204
+ Root: Rs,
205
+ Content: Is
206
+ }, Ms = (t) => {
202
207
  if (t == null) return null;
203
208
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
204
209
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
205
- }, Ti = (t) => {
206
- const e = S(19), {
210
+ }, ji = (t) => {
211
+ const e = T(19), {
207
212
  toolName: n,
208
- toolInput: s,
209
- onApprove: o,
213
+ toolInput: o,
214
+ onApprove: s,
210
215
  onDeny: r
211
216
  } = t;
212
217
  let i;
213
- e[0] !== s ? (i = To(s), e[0] = s, e[1] = i) : i = e[1];
214
- const c = i;
215
- let a;
216
- e[2] !== n ? (a = /* @__PURE__ */ w(F, { textStyle: "label/S/medium", color: "fg", children: [
218
+ e[0] !== o ? (i = Ms(o), e[0] = o, e[1] = i) : i = e[1];
219
+ const a = i;
220
+ let c;
221
+ e[2] !== n ? (c = /* @__PURE__ */ w(q, { textStyle: "label/S/medium", color: "fg", children: [
217
222
  "Allow ",
218
223
  /* @__PURE__ */ l(qt, { size: "sm", children: n }),
219
224
  "?"
220
- ] }), e[2] = n, e[3] = a) : a = e[3];
225
+ ] }), e[2] = n, e[3] = c) : c = e[3];
221
226
  let u;
222
- e[4] !== c ? (u = c ? /* @__PURE__ */ l(qt, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: c }) : null, e[4] = c, e[5] = u) : u = e[5];
227
+ e[4] !== a ? (u = a ? /* @__PURE__ */ l(qt, { size: "sm", whiteSpace: "pre-wrap", maxH: "6rem", overflowY: "auto", children: a }) : null, e[4] = a, e[5] = u) : u = e[5];
223
228
  let d;
224
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ l(Ln, { size: 14 }), e[6] = d) : d = e[6];
225
- let f;
226
- e[7] !== r ? (f = /* @__PURE__ */ w(qe, { size: "xs", variant: "outline", onClick: r, children: [
229
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ l(Wn, { size: 14 }), e[6] = d) : d = e[6];
230
+ let p;
231
+ e[7] !== r ? (p = /* @__PURE__ */ w(Ke, { size: "xs", variant: "outline", onClick: r, children: [
227
232
  d,
228
233
  "Deny"
229
- ] }), e[7] = r, e[8] = f) : f = e[8];
234
+ ] }), e[7] = r, e[8] = p) : p = e[8];
230
235
  let m;
231
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ l(qn, { size: 14 }), e[9] = m) : m = e[9];
232
- let p;
233
- e[10] !== o ? (p = /* @__PURE__ */ w(qe, { size: "xs", colorPalette: "green", onClick: o, children: [
236
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ l(Nn, { size: 14 }), e[9] = m) : m = e[9];
237
+ let f;
238
+ e[10] !== s ? (f = /* @__PURE__ */ w(Ke, { size: "xs", colorPalette: "green", onClick: s, children: [
234
239
  m,
235
240
  "Allow"
236
- ] }), e[10] = o, e[11] = p) : p = e[11];
241
+ ] }), e[10] = s, e[11] = f) : f = e[11];
237
242
  let h;
238
- e[12] !== f || e[13] !== p ? (h = /* @__PURE__ */ w(Me, { gap: "xs", justifyContent: "flex-end", children: [
239
- f,
240
- p
241
- ] }), e[12] = f, e[13] = p, e[14] = h) : h = e[14];
243
+ e[12] !== p || e[13] !== f ? (h = /* @__PURE__ */ w(Ee, { gap: "xs", justifyContent: "flex-end", children: [
244
+ p,
245
+ f
246
+ ] }), e[12] = p, e[13] = f, e[14] = h) : h = e[14];
242
247
  let g;
243
- return e[15] !== a || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ l(M, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ w(fe, { direction: "column", gap: "xs", children: [
244
- a,
248
+ return e[15] !== c || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ l(I, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ w(Ce, { direction: "column", gap: "xs", children: [
249
+ c,
245
250
  u,
246
251
  h
247
- ] }) }), e[15] = a, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
248
- }, Co = (t) => {
252
+ ] }) }), e[15] = c, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
253
+ }, Es = (t) => {
249
254
  const {
250
255
  previousUserMessageCount: e,
251
256
  userMessageCount: n
252
257
  } = t;
253
258
  return e === 0 ? !1 : n > e;
254
259
  };
255
- function _o(t) {
256
- const e = S(4), {
260
+ function Ps(t) {
261
+ const e = T(4), {
257
262
  userMessageCount: n
258
263
  } = t, {
259
- scrollToBottom: s
260
- } = Mt(), o = nt(n);
264
+ scrollToBottom: o
265
+ } = ct(), s = Qe(n);
261
266
  let r, i;
262
- return e[0] !== s || e[1] !== n ? (r = () => {
263
- Co({
264
- previousUserMessageCount: o.current,
267
+ return e[0] !== o || e[1] !== n ? (r = () => {
268
+ Es({
269
+ previousUserMessageCount: s.current,
265
270
  userMessageCount: n
266
- }) && s(), o.current = n;
267
- }, i = [n, s], e[0] = s, e[1] = n, e[2] = r, e[3] = i) : (r = e[2], i = e[3]), De(r, i), null;
271
+ }) && o(), s.current = n;
272
+ }, i = [n, o], e[0] = o, e[1] = n, e[2] = r, e[3] = i) : (r = e[2], i = e[3]), we(r, i), null;
268
273
  }
269
- const tn = (t) => t.trim().length > 0, Ao = (t) => {
274
+ const an = (t) => t.trim().length > 0, Bs = (t) => {
270
275
  const {
271
276
  isDisabled: e,
272
277
  streaming: n,
273
- text: s
278
+ text: o
274
279
  } = t;
275
- return e || n || !tn(s) ? "none" : "submit";
276
- }, Ro = (t) => {
280
+ return e || n || !an(o) ? "none" : "submit";
281
+ }, Ls = (t) => {
277
282
  const {
278
283
  canInterrupt: e,
279
284
  isDisabled: n,
280
- streaming: s,
281
- text: o
285
+ streaming: o,
286
+ text: s
282
287
  } = t;
283
- return n ? "none" : s ? e ? "interrupt" : "none" : tn(o) ? "submit" : "none";
284
- }, Bo = (t) => {
288
+ return n ? "none" : o ? e ? "interrupt" : "none" : an(s) ? "submit" : "none";
289
+ }, vs = (t) => {
285
290
  t.preventDefault();
286
- }, nn = (t) => {
287
- const e = S(7), {
291
+ }, cn = (t) => {
292
+ const e = T(7), {
288
293
  option: n
289
294
  } = t;
290
- let s;
291
- e[0] !== n.label ? (s = /* @__PURE__ */ l(F, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = s) : s = e[1];
292
295
  let o;
293
- e[2] !== n.description ? (o = n.description ? /* @__PURE__ */ l(F, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = o) : o = e[3];
296
+ e[0] !== n.label ? (o = /* @__PURE__ */ l(q, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = o) : o = e[1];
297
+ let s;
298
+ e[2] !== n.description ? (s = n.description ? /* @__PURE__ */ l(q, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = s) : s = e[3];
294
299
  let r;
295
- return e[4] !== s || e[5] !== o ? (r = /* @__PURE__ */ w(z, { gap: "0", minWidth: "0", children: [
296
- s,
297
- o
298
- ] }), e[4] = s, e[5] = o, e[6] = r) : r = e[6], r;
299
- }, Io = (t) => {
300
- const e = S(12), {
300
+ return e[4] !== o || e[5] !== s ? (r = /* @__PURE__ */ w(Z, { gap: "0", minWidth: "0", children: [
301
+ o,
302
+ s
303
+ ] }), e[4] = o, e[5] = s, e[6] = r) : r = e[6], r;
304
+ }, $s = (t) => {
305
+ const e = T(12), {
301
306
  option: n,
302
- name: s,
303
- checked: o,
307
+ name: o,
308
+ checked: s,
304
309
  editable: r,
305
310
  onToggle: i
306
- } = t, c = !r, a = r ? void 0 : "true";
311
+ } = t, a = !r, c = r ? void 0 : "true";
307
312
  let u;
308
313
  e[0] !== r ? (u = r ? void 0 : {
309
314
  tabIndex: -1
310
315
  }, e[0] = r, e[1] = u) : u = e[1];
311
316
  const d = r ? i : void 0;
312
- let f;
313
- e[2] !== n ? (f = /* @__PURE__ */ l(nn, { option: n }), e[2] = n, e[3] = f) : f = e[3];
317
+ let p;
318
+ e[2] !== n ? (p = /* @__PURE__ */ l(cn, { option: n }), e[2] = n, e[3] = p) : p = e[3];
314
319
  let m;
315
- return e[4] !== o || e[5] !== s || e[6] !== c || e[7] !== a || e[8] !== u || e[9] !== d || e[10] !== f ? (m = /* @__PURE__ */ l(Zt, { name: s, checked: o, readOnly: c, "aria-readonly": a, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = o, e[5] = s, e[6] = c, e[7] = a, e[8] = u, e[9] = d, e[10] = f, e[11] = m) : m = e[11], m;
316
- }, Po = (t) => {
317
- const e = S(17), {
320
+ return e[4] !== s || e[5] !== o || e[6] !== a || e[7] !== c || e[8] !== u || e[9] !== d || e[10] !== p ? (m = /* @__PURE__ */ l(rn, { name: o, checked: s, readOnly: a, "aria-readonly": c, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: p }), e[4] = s, e[5] = o, e[6] = a, e[7] = c, e[8] = u, e[9] = d, e[10] = p, e[11] = m) : m = e[11], m;
321
+ }, Os = (t) => {
322
+ const e = T(17), {
318
323
  question: n,
319
- questionIndex: s,
320
- name: o,
324
+ questionIndex: o,
325
+ name: s,
321
326
  selectedOption: r,
322
327
  editable: i,
323
- onToggleOption: c
324
- } = t, a = r ?? null, u = !i, d = i ? void 0 : "true";
325
- let f;
326
- e[0] !== i || e[1] !== c || e[2] !== n || e[3] !== s ? (f = i ? (h) => {
327
- h.value && c?.(n, s, h.value);
328
- } : void 0, e[0] = i, e[1] = c, e[2] = n, e[3] = s, e[4] = f) : f = e[4];
328
+ onToggleOption: a
329
+ } = t, c = r ?? null, u = !i, d = i ? void 0 : "true";
330
+ let p;
331
+ e[0] !== i || e[1] !== a || e[2] !== n || e[3] !== o ? (p = i ? (h) => {
332
+ h.value && a?.(n, o, h.value);
333
+ } : void 0, e[0] = i, e[1] = a, e[2] = n, e[3] = o, e[4] = p) : p = e[4];
329
334
  let m;
330
335
  if (e[5] !== i || e[6] !== n.options) {
331
336
  let h;
332
- e[8] !== i ? (h = (g) => /* @__PURE__ */ l(co, { value: g.label, inputProps: i ? void 0 : {
337
+ e[8] !== i ? (h = (g) => /* @__PURE__ */ l(ms, { value: g.label, inputProps: i ? void 0 : {
333
338
  tabIndex: -1
334
- }, alignItems: "flex-start", children: /* @__PURE__ */ l(nn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], m = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = m;
339
+ }, alignItems: "flex-start", children: /* @__PURE__ */ l(cn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], m = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = m;
335
340
  } else
336
341
  m = e[7];
337
- let p;
338
- return e[10] !== o || e[11] !== a || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== m ? (p = /* @__PURE__ */ l(ao, { name: o, value: a, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: m }), e[10] = o, e[11] = a, e[12] = u, e[13] = d, e[14] = f, e[15] = m, e[16] = p) : p = e[16], p;
339
- }, Mo = (t) => {
340
- const e = S(4), {
342
+ let f;
343
+ return e[10] !== s || e[11] !== c || e[12] !== u || e[13] !== d || e[14] !== p || e[15] !== m ? (f = /* @__PURE__ */ l(hs, { name: s, value: c, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: p, children: m }), e[10] = s, e[11] = c, e[12] = u, e[13] = d, e[14] = p, e[15] = m, e[16] = f) : f = e[16], f;
344
+ }, Ds = (t) => {
345
+ const e = T(4), {
341
346
  items: n
342
347
  } = t;
343
- let s;
344
- e[0] !== n ? (s = n.map($o), e[0] = n, e[1] = s) : s = e[1];
345
348
  let o;
346
- return e[2] !== s ? (o = /* @__PURE__ */ l(z, { as: "ul", gap: "2xs", listStyleType: "none", margin: "0", padding: "0", children: s }), e[2] = s, e[3] = o) : o = e[3], o;
347
- }, on = (t) => {
348
- const e = S(19), {
349
+ e[0] !== n ? (o = n.map(Fs), e[0] = n, e[1] = o) : o = e[1];
350
+ let s;
351
+ return e[2] !== o ? (s = /* @__PURE__ */ l(Z, { as: "ul", gap: "0", listStyleType: "none", margin: "0", padding: "0", children: o }), e[2] = o, e[3] = s) : s = e[3], s;
352
+ }, un = (t) => {
353
+ const e = T(19), {
349
354
  questions: n,
350
- editable: s,
351
- selectedOptionsByQuestion: o,
355
+ editable: o,
356
+ selectedOptionsByQuestion: s,
352
357
  customAnswersByQuestion: r,
353
358
  onToggleOption: i,
354
- onCustomAnswerChange: c
355
- } = t, a = s === void 0 ? !1 : s;
359
+ onCustomAnswerChange: a
360
+ } = t, c = o === void 0 ? !1 : o;
356
361
  let u;
357
- e[0] !== o ? (u = o === void 0 ? {} : o, e[0] = o, e[1] = u) : u = e[1];
362
+ e[0] !== s ? (u = s === void 0 ? {} : s, e[0] = s, e[1] = u) : u = e[1];
358
363
  const d = u;
359
- let f;
360
- e[2] !== r ? (f = r === void 0 ? {} : r, e[2] = r, e[3] = f) : f = e[3];
361
- const m = f;
362
364
  let p;
363
- if (e[4] !== m || e[5] !== a || e[6] !== c || e[7] !== i || e[8] !== n || e[9] !== d) {
365
+ e[2] !== r ? (p = r === void 0 ? {} : r, e[2] = r, e[3] = p) : p = e[3];
366
+ const m = p;
367
+ let f;
368
+ if (e[4] !== m || e[5] !== c || e[6] !== a || e[7] !== i || e[8] !== n || e[9] !== d) {
364
369
  let g;
365
- e[11] !== m || e[12] !== a || e[13] !== c || e[14] !== i || e[15] !== d ? (g = (b, x) => {
366
- const k = b.id ?? `question-${x}`, T = b.multiple ? "checkbox" : "radio", A = d[k] ?? [];
367
- return /* @__PURE__ */ w(z, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
368
- /* @__PURE__ */ l(F, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: b.question }),
369
- T === "radio" ? /* @__PURE__ */ l(Po, { question: b, questionIndex: x, name: k, selectedOption: A[0], editable: a, onToggleOption: i }) : b.options.map((R) => /* @__PURE__ */ l(Io, { option: R, name: k, checked: A.includes(R.label), editable: a, onToggle: () => i?.(b, x, R.label) }, R.label)),
370
- b.allowCustomAnswer ? /* @__PURE__ */ l(In, { readOnly: !a, "aria-readonly": a ? void 0 : "true", value: m[k] ?? "", placeholder: a ? "Answer..." : "Custom answer", "aria-label": b.question, rows: 2, borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "xs", resize: a ? "vertical" : "none", color: "fg", onChange: (R) => c?.(b, x, R.currentTarget.value) }) : null
371
- ] }, k);
372
- }, e[11] = m, e[12] = a, e[13] = c, e[14] = i, e[15] = d, e[16] = g) : g = e[16], p = n.map(g), e[4] = m, e[5] = a, e[6] = c, e[7] = i, e[8] = n, e[9] = d, e[10] = p;
370
+ e[11] !== m || e[12] !== c || e[13] !== a || e[14] !== i || e[15] !== d ? (g = (b, y) => {
371
+ const x = b.id ?? `question-${y}`, _ = b.multiple ? "checkbox" : "radio", C = d[x] ?? [];
372
+ return /* @__PURE__ */ w(Z, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
373
+ /* @__PURE__ */ l(q, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: b.question }),
374
+ _ === "radio" ? /* @__PURE__ */ l(Os, { question: b, questionIndex: y, name: x, selectedOption: C[0], editable: c, onToggleOption: i }) : b.options.map((k) => /* @__PURE__ */ l($s, { option: k, name: x, checked: C.includes(k.label), editable: c, onToggle: () => i?.(b, y, k.label) }, k.label)),
375
+ b.allowCustomAnswer ? /* @__PURE__ */ l(On, { readOnly: !c, "aria-readonly": c ? void 0 : "true", value: m[x] ?? "", placeholder: c ? "Answer..." : "Custom answer", "aria-label": b.question, rows: 2, borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "xs", resize: c ? "vertical" : "none", color: "fg", onChange: (k) => a?.(b, y, k.currentTarget.value) }) : null
376
+ ] }, x);
377
+ }, e[11] = m, e[12] = c, e[13] = a, e[14] = i, e[15] = d, e[16] = g) : g = e[16], f = n.map(g), e[4] = m, e[5] = c, e[6] = a, e[7] = i, e[8] = n, e[9] = d, e[10] = f;
373
378
  } else
374
- p = e[10];
379
+ f = e[10];
375
380
  let h;
376
- return e[17] !== p ? (h = /* @__PURE__ */ l(z, { as: "form", gap: "sm", onSubmit: Bo, "aria-label": "Question form", children: p }), e[17] = p, e[18] = h) : h = e[18], h;
381
+ return e[17] !== f ? (h = /* @__PURE__ */ l(Z, { as: "form", gap: "sm", onSubmit: vs, "aria-label": "Question form", children: f }), e[17] = f, e[18] = h) : h = e[18], h;
377
382
  };
378
- function $o(t, e) {
379
- return /* @__PURE__ */ l(M, { as: "li", children: /* @__PURE__ */ l(Zt, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
383
+ function Fs(t, e) {
384
+ return /* @__PURE__ */ l(I, { as: "li", children: /* @__PURE__ */ l(rn, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
380
385
  tabIndex: -1
381
- }, children: /* @__PURE__ */ l(F, { textStyle: "label/S/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
386
+ }, size: "xs", children: /* @__PURE__ */ l(q, { textStyle: "label/XS/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
382
387
  }
383
- const ee = (t, e) => t.id ?? `question-${e}`, Bt = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
384
- id: ee(e, n),
388
+ const ae = (t, e) => t.id ?? `question-${e}`, Et = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
389
+ id: ae(e, n),
385
390
  question: e.question,
386
391
  multiple: !!e.multiple,
387
392
  required: !!e.required,
388
393
  allowCustomAnswer: !!e.allowCustomAnswer,
389
- options: e.options.map((s) => ({
390
- label: s.label,
391
- description: s.description ?? ""
394
+ options: e.options.map((o) => ({
395
+ label: o.label,
396
+ description: o.description ?? ""
392
397
  }))
393
- }))) : "", Oo = (t, e, n) => {
394
- const s = [];
395
- for (let o = 0; o < t.questions.length; o += 1) {
396
- const r = t.questions[o], i = ee(r, o), c = e[i] ?? [], a = n[i]?.trim(), u = a ? [...c, a] : c;
397
- u.length !== 0 && s.push(`${r.question}: ${u.join(", ")}`);
398
+ }))) : "", zs = (t, e, n) => {
399
+ const o = [];
400
+ for (let s = 0; s < t.questions.length; s += 1) {
401
+ const r = t.questions[s], i = ae(r, s), a = e[i] ?? [], c = n[i]?.trim(), u = c ? [...a, c] : a;
402
+ u.length !== 0 && o.push(`${r.question}: ${u.join(", ")}`);
398
403
  }
399
- return s;
400
- }, Eo = (t) => typeof t != "string", $t = (t, e) => {
401
- if (Eo(e)) return e;
404
+ return o;
405
+ }, qs = (t) => typeof t != "string", $t = (t, e) => {
406
+ if (qs(e)) return e;
402
407
  const n = e.trim();
403
408
  if (n.length === 0) return {};
404
- const s = {};
405
- for (let o = 0; o < t.questions.length; o += 1) {
406
- const r = t.questions[o];
407
- r.allowCustomAnswer && (s[ee(r, o)] = n);
409
+ const o = {};
410
+ for (let s = 0; s < t.questions.length; s += 1) {
411
+ const r = t.questions[s];
412
+ r.allowCustomAnswer && (o[ae(r, s)] = n);
408
413
  }
409
- return s;
410
- }, Do = (t, e, n) => {
414
+ return o;
415
+ }, Qs = (t, e, n) => {
411
416
  if (!t) return typeof n == "string" ? n.trim() : "";
412
- const s = $t(t, n), o = Oo(t, e, s), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((c) => c.allowCustomAnswer);
413
- return r.length > 0 && !i && o.push(`Additional response: ${r}`), o.join(`
417
+ const o = $t(t, n), s = zs(t, e, o), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((a) => a.allowCustomAnswer);
418
+ return r.length > 0 && !i && s.push(`Additional response: ${r}`), s.join(`
414
419
  `);
415
- }, Lo = (t, e, n) => {
416
- const s = $t(t, n);
417
- return t.questions.map((o, r) => {
418
- const i = ee(o, r), c = e[i] ?? [], a = s[i]?.trim();
419
- return a ? [...c, a] : c;
420
+ }, Hs = (t, e, n) => {
421
+ const o = $t(t, n);
422
+ return t.questions.map((s, r) => {
423
+ const i = ae(s, r), a = e[i] ?? [], c = o[i]?.trim();
424
+ return c ? [...a, c] : a;
420
425
  });
421
- }, qo = (t, e, n) => {
426
+ }, Ws = (t, e, n) => {
422
427
  if (!t) return !1;
423
- const s = $t(t, n);
424
- for (let o = 0; o < t.questions.length; o += 1) {
425
- const r = t.questions[o];
428
+ const o = $t(t, n);
429
+ for (let s = 0; s < t.questions.length; s += 1) {
430
+ const r = t.questions[s];
426
431
  if (!r.required) continue;
427
- const i = ee(r, o);
428
- if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && s[i]?.trim()))
432
+ const i = ae(r, s);
433
+ if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && o[i]?.trim()))
429
434
  return !0;
430
435
  }
431
436
  return !1;
432
- }, vo = (t) => t.questions.map((e, n) => ({
433
- id: ee(e, n),
437
+ }, Ns = (t) => t.questions.map((e, n) => ({
438
+ id: ae(e, n),
434
439
  question: e.question,
435
440
  options: e.options,
436
441
  multiple: !!e.multiple,
437
442
  required: !!e.required,
438
443
  allowCustomAnswer: !!e.allowCustomAnswer
439
- })), Qo = (t, e, n, s) => {
440
- const o = ee(t, e);
441
- return (n[o] ?? []).length > 0 || !!s[o]?.trim();
442
- }, Fo = (t) => {
443
- const e = S(22), {
444
+ })), Vs = (t, e, n, o) => {
445
+ const s = ae(t, e);
446
+ return (n[s] ?? []).length > 0 || !!o[s]?.trim();
447
+ }, js = (t) => {
448
+ const e = T(22), {
444
449
  question: n,
445
- sourceQuestion: s,
446
- questionIndex: o,
450
+ sourceQuestion: o,
451
+ questionIndex: s,
447
452
  isActive: r,
448
453
  selectedOptionsByQuestion: i,
449
- customAnswersByQuestion: c,
450
- onSelectStep: a
454
+ customAnswersByQuestion: a,
455
+ onSelectStep: c
451
456
  } = t;
452
457
  let u;
453
- e[0] !== c || e[1] !== o || e[2] !== i || e[3] !== s ? (u = Qo(s, o, i, c), e[0] = c, e[1] = o, e[2] = i, e[3] = s, e[4] = u) : u = e[4];
454
- const d = u, f = d ? "answered" : "not answered", m = r ? "outline" : "ghost", p = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`;
458
+ e[0] !== a || e[1] !== s || e[2] !== i || e[3] !== o ? (u = Vs(o, s, i, a), e[0] = a, e[1] = s, e[2] = i, e[3] = o, e[4] = u) : u = e[4];
459
+ const d = u, p = d ? "answered" : "not answered", m = r ? "outline" : "ghost", f = `question-step-tab-${n.id}`, h = `${n.question} (${p})`, g = `question-step-panel-${n.id}`;
455
460
  let b;
456
- e[5] !== a || e[6] !== o ? (b = () => a(o), e[5] = a, e[6] = o, e[7] = b) : b = e[7];
461
+ e[5] !== c || e[6] !== s ? (b = () => c(s), e[5] = c, e[6] = s, e[7] = b) : b = e[7];
462
+ let y;
463
+ e[8] !== d || e[9] !== s ? (y = d ? /* @__PURE__ */ l(Zt, { "aria-hidden": "true" }) : s + 1, e[8] = d, e[9] = s, e[10] = y) : y = e[10];
457
464
  let x;
458
- e[8] !== d || e[9] !== o ? (x = d ? /* @__PURE__ */ l(vn, { "aria-hidden": "true" }) : o + 1, e[8] = d, e[9] = o, e[10] = x) : x = e[10];
459
- let k;
460
- e[11] !== r || e[12] !== p || e[13] !== h || e[14] !== g || e[15] !== b || e[16] !== x || e[17] !== m ? (k = /* @__PURE__ */ l(qe, { id: p, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: m, minW: "8", onClick: b, children: x }), e[11] = r, e[12] = p, e[13] = h, e[14] = g, e[15] = b, e[16] = x, e[17] = m, e[18] = k) : k = e[18];
461
- let T;
462
- return e[19] !== n.question || e[20] !== k ? (T = /* @__PURE__ */ l(so, { content: n.question, showArrow: !0, children: k }), e[19] = n.question, e[20] = k, e[21] = T) : T = e[21], T;
463
- }, zo = (t) => {
464
- const e = S(31), {
465
+ e[11] !== r || e[12] !== f || e[13] !== h || e[14] !== g || e[15] !== b || e[16] !== y || e[17] !== m ? (x = /* @__PURE__ */ l(Ke, { id: f, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: m, minW: "8", onClick: b, children: y }), e[11] = r, e[12] = f, e[13] = h, e[14] = g, e[15] = b, e[16] = y, e[17] = m, e[18] = x) : x = e[18];
466
+ let _;
467
+ return e[19] !== n.question || e[20] !== x ? (_ = /* @__PURE__ */ l(sn, { content: n.question, showArrow: !0, children: x }), e[19] = n.question, e[20] = x, e[21] = _) : _ = e[21], _;
468
+ }, Us = (t) => {
469
+ const e = T(31), {
465
470
  questionPrompt: n,
466
- selectedOptionsByQuestion: s,
467
- customAnswersByQuestion: o,
471
+ selectedOptionsByQuestion: o,
472
+ customAnswersByQuestion: s,
468
473
  onToggleOption: r,
469
474
  onCustomAnswerChange: i
470
475
  } = t, {
471
- questions: c
472
- } = t, [a, u] = Z(0), d = Math.min(a, c.length - 1), f = c[d], m = c.length > 1;
473
- let p;
474
- e[0] !== o || e[1] !== m || e[2] !== n.questions || e[3] !== c || e[4] !== d || e[5] !== s ? (p = m ? /* @__PURE__ */ l(Me, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: c.map((I, _) => /* @__PURE__ */ l(Fo, { question: I, sourceQuestion: n.questions[_], questionIndex: _, isActive: _ === d, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onSelectStep: u }, I.id)) }) : null, e[0] = o, e[1] = m, e[2] = n.questions, e[3] = c, e[4] = d, e[5] = s, e[6] = p) : p = e[6];
475
- const h = `question-step-panel-${f.id}`, g = m ? "tabpanel" : void 0, b = m ? `question-step-tab-${f.id}` : void 0;
476
+ questions: a
477
+ } = t, [c, u] = G(0), d = Math.min(c, a.length - 1), p = a[d], m = a.length > 1;
478
+ let f;
479
+ e[0] !== s || e[1] !== m || e[2] !== n.questions || e[3] !== a || e[4] !== d || e[5] !== o ? (f = m ? /* @__PURE__ */ l(Ee, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: a.map((P, M) => /* @__PURE__ */ l(js, { question: P, sourceQuestion: n.questions[M], questionIndex: M, isActive: M === d, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: u }, P.id)) }) : null, e[0] = s, e[1] = m, e[2] = n.questions, e[3] = a, e[4] = d, e[5] = o, e[6] = f) : f = e[6];
480
+ const h = `question-step-panel-${p.id}`, g = m ? "tabpanel" : void 0, b = m ? `question-step-tab-${p.id}` : void 0;
481
+ let y;
482
+ e[7] !== p ? (y = [p], e[7] = p, e[8] = y) : y = e[8];
476
483
  let x;
477
- e[7] !== f ? (x = [f], e[7] = f, e[8] = x) : x = e[8];
484
+ e[9] !== r || e[10] !== n.questions || e[11] !== d ? (x = (P, M, B) => {
485
+ r(n.questions[d], d, B);
486
+ }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = x) : x = e[12];
487
+ let _;
488
+ e[13] !== i || e[14] !== n.questions || e[15] !== d ? (_ = (P, M, B) => {
489
+ i(n.questions[d], d, B);
490
+ }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = _) : _ = e[16];
491
+ let C;
492
+ e[17] !== s || e[18] !== o || e[19] !== y || e[20] !== x || e[21] !== _ ? (C = /* @__PURE__ */ l(un, { questions: y, editable: !0, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onToggleOption: x, onCustomAnswerChange: _ }), e[17] = s, e[18] = o, e[19] = y, e[20] = x, e[21] = _, e[22] = C) : C = e[22];
478
493
  let k;
479
- e[9] !== r || e[10] !== n.questions || e[11] !== d ? (k = (I, _, P) => {
480
- r(n.questions[d], d, P);
481
- }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = k) : k = e[12];
482
- let T;
483
- e[13] !== i || e[14] !== n.questions || e[15] !== d ? (T = (I, _, P) => {
484
- i(n.questions[d], d, P);
485
- }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = T) : T = e[16];
486
- let A;
487
- e[17] !== o || e[18] !== s || e[19] !== x || e[20] !== k || e[21] !== T ? (A = /* @__PURE__ */ l(on, { questions: x, editable: !0, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onToggleOption: k, onCustomAnswerChange: T }), e[17] = o, e[18] = s, e[19] = x, e[20] = k, e[21] = T, e[22] = A) : A = e[22];
494
+ e[23] !== h || e[24] !== g || e[25] !== b || e[26] !== C ? (k = /* @__PURE__ */ l(Z, { id: h, role: g, "aria-labelledby": b, gap: "0", children: C }), e[23] = h, e[24] = g, e[25] = b, e[26] = C, e[27] = k) : k = e[27];
488
495
  let R;
489
- e[23] !== h || e[24] !== g || e[25] !== b || e[26] !== A ? (R = /* @__PURE__ */ l(z, { id: h, role: g, "aria-labelledby": b, gap: "0", children: A }), e[23] = h, e[24] = g, e[25] = b, e[26] = A, e[27] = R) : R = e[27];
490
- let B;
491
- return e[28] !== p || e[29] !== R ? (B = /* @__PURE__ */ w(z, { gap: "xs", pb: "sm", children: [
492
- p,
493
- R
494
- ] }), e[28] = p, e[29] = R, e[30] = B) : B = e[30], B;
495
- }, Wo = (t) => {
496
- const e = S(8), {
496
+ return e[28] !== f || e[29] !== k ? (R = /* @__PURE__ */ w(Z, { gap: "xs", pb: "sm", children: [
497
+ f,
498
+ k
499
+ ] }), e[28] = f, e[29] = k, e[30] = R) : R = e[30], R;
500
+ }, Ks = (t) => {
501
+ const e = T(8), {
497
502
  questionPrompt: n
498
503
  } = t;
499
- let s;
500
- e[0] !== n ? (s = vo(n), e[0] = n, e[1] = s) : s = e[1];
501
- const o = s;
504
+ let o;
505
+ e[0] !== n ? (o = Ns(n), e[0] = n, e[1] = o) : o = e[1];
506
+ const s = o;
502
507
  let r;
503
- e[2] !== n ? (r = Bt(n), e[2] = n, e[3] = r) : r = e[3];
508
+ e[2] !== n ? (r = Et(n), e[2] = n, e[3] = r) : r = e[3];
504
509
  const i = r;
505
- let c;
506
- return e[4] !== t || e[5] !== i || e[6] !== o ? (c = /* @__PURE__ */ l(zo, { ...t, questions: o }, i), e[4] = t, e[5] = i, e[6] = o, e[7] = c) : c = e[7], c;
507
- }, Ho = (t) => {
508
- const e = S(22);
509
- let n, s, o, r;
510
+ let a;
511
+ return e[4] !== t || e[5] !== i || e[6] !== s ? (a = /* @__PURE__ */ l(Us, { ...t, questions: s }, i), e[4] = t, e[5] = i, e[6] = s, e[7] = a) : a = e[7], a;
512
+ }, Gs = (t) => {
513
+ const e = T(22);
514
+ let n, o, s, r;
510
515
  e[0] !== t ? ({
511
516
  title: r,
512
- shortcut: o,
517
+ shortcut: s,
513
518
  canInterrupt: n,
514
- ...s
515
- } = t, e[0] = t, e[1] = n, e[2] = s, e[3] = o, e[4] = r) : (n = e[1], s = e[2], o = e[3], r = e[4]);
516
- const i = s["aria-label"] ?? r;
517
- let c;
518
- e[5] !== n ? (c = n ? /* @__PURE__ */ l(Qn, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(Fn, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = c) : c = e[6];
519
- const a = c;
519
+ ...o
520
+ } = t, e[0] = t, e[1] = n, e[2] = o, e[3] = s, e[4] = r) : (n = e[1], o = e[2], s = e[3], r = e[4]);
521
+ const i = o["aria-label"] ?? r;
522
+ let a;
523
+ e[5] !== n ? (a = n ? /* @__PURE__ */ l(Vn, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ l(jn, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = a) : a = e[6];
524
+ const c = a;
520
525
  let u;
521
- e[7] !== i || e[8] !== a || e[9] !== s || e[10] !== r ? (u = /* @__PURE__ */ l(Ut, { "data-testid": "send-message-button", size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": i, title: r, ...s, children: a }), e[7] = i, e[8] = a, e[9] = s, e[10] = r, e[11] = u) : u = e[11];
526
+ e[7] !== i || e[8] !== c || e[9] !== o || e[10] !== r ? (u = /* @__PURE__ */ l(Lt, { "data-testid": "send-message-button", size: "sm", variant: "solid", borderRadius: "full", colorPalette: "primary", "aria-label": i, title: r, ...o, children: c }), e[7] = i, e[8] = c, e[9] = o, e[10] = r, e[11] = u) : u = e[11];
522
527
  const d = u;
523
528
  if (r) {
524
- let f;
525
- e[12] !== o || e[13] !== r ? (f = o ? /* @__PURE__ */ w(It, { children: [
529
+ let p;
530
+ e[12] !== s || e[13] !== r ? (p = s ? /* @__PURE__ */ w(Bt, { children: [
526
531
  r,
527
532
  " ",
528
- /* @__PURE__ */ l(Mn, { fontSize: "xs", children: o })
529
- ] }) : r, e[12] = o, e[13] = r, e[14] = f) : f = e[14];
530
- const m = f;
531
- let p;
532
- e[15] !== d ? (p = /* @__PURE__ */ l(tt.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = p) : p = e[16];
533
+ /* @__PURE__ */ l(Fn, { fontSize: "xs", children: s })
534
+ ] }) : r, e[12] = s, e[13] = r, e[14] = p) : p = e[14];
535
+ const m = p;
536
+ let f;
537
+ e[15] !== d ? (f = /* @__PURE__ */ l(it.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = f) : f = e[16];
533
538
  let h;
534
- e[17] !== m ? (h = /* @__PURE__ */ l(Pn, { children: /* @__PURE__ */ l(tt.Positioner, { children: /* @__PURE__ */ l(tt.Content, { children: m }) }) }), e[17] = m, e[18] = h) : h = e[18];
539
+ e[17] !== m ? (h = /* @__PURE__ */ l(Dn, { children: /* @__PURE__ */ l(it.Positioner, { children: /* @__PURE__ */ l(it.Content, { children: m }) }) }), e[17] = m, e[18] = h) : h = e[18];
535
540
  let g;
536
- return e[19] !== p || e[20] !== h ? (g = /* @__PURE__ */ w(tt.Root, { closeDelay: 50, openDelay: 100, children: [
537
- p,
541
+ return e[19] !== f || e[20] !== h ? (g = /* @__PURE__ */ w(it.Root, { closeDelay: 50, openDelay: 100, children: [
542
+ f,
538
543
  h
539
- ] }), e[19] = p, e[20] = h, e[21] = g) : g = e[21], g;
544
+ ] }), e[19] = f, e[20] = h, e[21] = g) : g = e[21], g;
540
545
  }
541
546
  return d;
542
- }, jo = (t) => {
543
- const e = S(94), {
547
+ }, Xs = (t) => {
548
+ const e = T(94), {
544
549
  defaultState: n,
545
- onSubmit: s,
546
- onInterrupt: o,
550
+ onSubmit: o,
551
+ onInterrupt: s,
547
552
  streaming: r,
548
553
  attachedResources: i,
549
- onClearAttachments: c,
550
- isDisabled: a,
554
+ onClearAttachments: a,
555
+ isDisabled: c,
551
556
  onChange: u,
552
557
  placeholder: d,
553
- attachmentList: f,
558
+ attachmentList: p,
554
559
  actions: m,
555
- attachedToTop: p,
560
+ attachedToTop: f,
556
561
  questionPrompt: h,
557
562
  autoFocus: g
558
- } = t, b = s === void 0 ? No : s, x = r === void 0 ? !1 : r;
559
- let k;
560
- e[0] !== i ? (k = i === void 0 ? [] : i, e[0] = i, e[1] = k) : k = e[1];
561
- const T = k, A = a === void 0 ? !1 : a, R = p === void 0 ? !1 : p, B = g === void 0 ? !1 : g, [I, _] = Z(!1), [P, L] = Z(n), [O, q] = Z(0);
563
+ } = t, b = o === void 0 ? Ys : o, y = r === void 0 ? !1 : r;
564
+ let x;
565
+ e[0] !== i ? (x = i === void 0 ? [] : i, e[0] = i, e[1] = x) : x = e[1];
566
+ const _ = x, C = c === void 0 ? !1 : c, k = f === void 0 ? !1 : f, R = g === void 0 ? !1 : g, [P, M] = G(!1), [B, Q] = G(n), [L, H] = G(0);
567
+ let ee;
568
+ e[2] !== n ? (ee = () => _t(n), e[2] = n, e[3] = ee) : ee = e[3];
569
+ const [_e, Ae] = G(ee);
570
+ let $;
571
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? ($ = {}, e[4] = $) : $ = e[4];
572
+ const [E, te] = G($);
562
573
  let W;
563
- e[2] !== n ? (W = () => Tt(n), e[2] = n, e[3] = W) : W = e[3];
564
- const [ye, $e] = Z(W);
565
- let se;
566
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (se = {}, e[4] = se) : se = e[4];
567
- const [E, Se] = Z(se);
568
- let ke;
569
- e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ke = {}, e[5] = ke) : ke = e[5];
570
- const [D, H] = Z(ke), we = nt(null), pe = nt(u);
571
- let j;
572
- e[6] !== h ? (j = Bt(h), e[6] = h, e[7] = j) : j = e[7];
573
- const Fe = nt(j);
574
- let re, ie;
575
- e[8] !== u ? (re = () => {
576
- pe.current = u;
577
- }, ie = [u], e[8] = u, e[9] = re, e[10] = ie) : (re = e[9], ie = e[10]), De(re, ie);
578
- let N, V;
579
- e[11] !== n ? (N = () => {
580
- const C = Tt(n);
581
- L(n), q(Vo), $e(C), Se({}), H({}), pe.current?.(C);
582
- }, V = [n], e[11] = n, e[12] = N, e[13] = V) : (N = e[12], V = e[13]), De(N, V);
583
- let U;
584
- e[14] !== h ? (U = Bt(h), e[14] = h, e[15] = U) : U = e[15];
585
- const G = U;
586
- let v, Q;
587
- e[16] !== G ? (v = () => {
588
- Fe.current !== G && (Fe.current = G, Se({}), H({}));
589
- }, Q = [G], e[16] = G, e[17] = v, e[18] = Q) : (v = e[17], Q = e[18]), De(v, Q);
590
- let K;
591
- e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (K = () => {
592
- const C = we.current?.querySelector('[contenteditable="true"]');
593
- C instanceof HTMLElement && C.focus();
594
- }, e[19] = K) : K = e[19];
595
- const me = K;
596
- let $, le;
597
- e[20] !== B ? ($ = () => {
598
- if (!B)
574
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = {}, e[5] = W) : W = e[5];
575
+ const [O, fe] = G(W), Re = Qe(null), We = Qe(u);
576
+ let Be;
577
+ e[6] !== h ? (Be = Et(h), e[6] = h, e[7] = Be) : Be = e[7];
578
+ const Ye = Qe(Be);
579
+ let Le, ne;
580
+ e[8] !== u ? (Le = () => {
581
+ We.current = u;
582
+ }, ne = [u], e[8] = u, e[9] = Le, e[10] = ne) : (Le = e[9], ne = e[10]), we(Le, ne);
583
+ let se, Ne;
584
+ e[11] !== n ? (se = () => {
585
+ const A = _t(n);
586
+ Q(n), H(Js), Ae(A), te({}), fe({}), We.current?.(A);
587
+ }, Ne = [n], e[11] = n, e[12] = se, e[13] = Ne) : (se = e[12], Ne = e[13]), we(se, Ne);
588
+ let pe;
589
+ e[14] !== h ? (pe = Et(h), e[14] = h, e[15] = pe) : pe = e[15];
590
+ const X = pe;
591
+ let me, he;
592
+ e[16] !== X ? (me = () => {
593
+ Ye.current !== X && (Ye.current = X, te({}), fe({}));
594
+ }, he = [X], e[16] = X, e[17] = me, e[18] = he) : (me = e[17], he = e[18]), we(me, he);
595
+ let oe;
596
+ e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (oe = () => {
597
+ const A = Re.current?.querySelector('[contenteditable="true"]');
598
+ A instanceof HTMLElement && A.focus();
599
+ }, e[19] = oe) : oe = e[19];
600
+ const Ie = oe;
601
+ let ve, N;
602
+ e[20] !== R ? (ve = () => {
603
+ if (!R)
599
604
  return;
600
- const C = requestAnimationFrame(() => {
601
- const ae = we.current?.querySelector('[contenteditable="true"]');
602
- ae instanceof HTMLElement && ae.focus(), _(!0);
605
+ const A = requestAnimationFrame(() => {
606
+ const Se = Re.current?.querySelector('[contenteditable="true"]');
607
+ Se instanceof HTMLElement && Se.focus(), M(!0);
603
608
  });
604
- return () => cancelAnimationFrame(C);
605
- }, le = [B], e[20] = B, e[21] = $, e[22] = le) : ($ = e[21], le = e[22]), De($, le);
606
- let X;
607
- e[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (X = () => {
608
- _(!0), me();
609
- }, e[23] = X) : X = e[23];
610
- const kn = X;
611
- let ze;
612
- e[24] !== n ? (ze = (C) => {
613
- const ae = C === void 0 ? !1 : C;
614
- L(n), q(Uo);
615
- const Y = Tt(n);
616
- $e(Y), Se({}), H({}), pe.current?.(Y), ae && requestAnimationFrame(() => {
617
- me();
609
+ return () => cancelAnimationFrame(A);
610
+ }, N = [R], e[20] = R, e[21] = ve, e[22] = N) : (ve = e[21], N = e[22]), we(ve, N);
611
+ let ge;
612
+ e[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ge = () => {
613
+ M(!0), Ie();
614
+ }, e[23] = ge) : ge = e[23];
615
+ const be = ge;
616
+ let V;
617
+ e[24] !== n ? (V = (A) => {
618
+ const Se = A === void 0 ? !1 : A;
619
+ Q(n), H(Zs);
620
+ const ie = _t(n);
621
+ Ae(ie), te({}), fe({}), We.current?.(ie), Se && requestAnimationFrame(() => {
622
+ Ie();
618
623
  });
619
- }, e[24] = n, e[25] = ze) : ze = e[25];
620
- const ct = ze, he = x && !!o;
621
- let ge, ce, We;
622
- if (e[26] !== he || e[27] !== D || e[28] !== A || e[29] !== h || e[30] !== E || e[31] !== x || e[32] !== ye) {
623
- ce = h ? Do(h, E, D) : ye.trim();
624
- const C = qo(h, E, D);
625
- ge = {
626
- canInterrupt: he,
627
- isDisabled: A || C,
628
- streaming: x,
629
- text: ce
630
- }, We = Ro(ge), e[26] = he, e[27] = D, e[28] = A, e[29] = h, e[30] = E, e[31] = x, e[32] = ye, e[33] = ge, e[34] = ce, e[35] = We;
624
+ }, e[24] = n, e[25] = V) : V = e[25];
625
+ const Y = V, D = y && !!s;
626
+ let F, z, j;
627
+ if (e[26] !== D || e[27] !== O || e[28] !== C || e[29] !== h || e[30] !== E || e[31] !== y || e[32] !== _e) {
628
+ z = h ? Qs(h, E, O) : _e.trim();
629
+ const A = Ws(h, E, O);
630
+ F = {
631
+ canInterrupt: D,
632
+ isDisabled: C || A,
633
+ streaming: y,
634
+ text: z
635
+ }, j = Ls(F), e[26] = D, e[27] = O, e[28] = C, e[29] = h, e[30] = E, e[31] = y, e[32] = _e, e[33] = F, e[34] = z, e[35] = j;
631
636
  } else
632
- ge = e[33], ce = e[34], We = e[35];
633
- const He = We;
634
- let je;
635
- e[36] !== T || e[37] !== D || e[38] !== c || e[39] !== b || e[40] !== h || e[41] !== ct || e[42] !== ce || e[43] !== E ? (je = () => {
636
- if (!ce)
637
+ F = e[33], z = e[34], j = e[35];
638
+ const U = j;
639
+ let K;
640
+ e[36] !== _ || e[37] !== O || e[38] !== a || e[39] !== b || e[40] !== h || e[41] !== Y || e[42] !== z || e[43] !== E ? (K = () => {
641
+ if (!z)
637
642
  return;
638
- const C = h ? {
639
- answers: Lo(h, E, D)
643
+ const A = h ? {
644
+ answers: Hs(h, E, O)
640
645
  } : void 0;
641
- b(ce, T, C), ct(!0), c?.();
642
- }, e[36] = T, e[37] = D, e[38] = c, e[39] = b, e[40] = h, e[41] = ct, e[42] = ce, e[43] = E, e[44] = je) : je = e[44];
643
- const at = je;
644
- let Ne;
645
- e[45] !== o || e[46] !== at ? (Ne = (C) => {
646
- if (C === "interrupt") {
647
- o?.();
646
+ b(z, _, A), Y(!0), a?.();
647
+ }, e[36] = _, e[37] = O, e[38] = a, e[39] = b, e[40] = h, e[41] = Y, e[42] = z, e[43] = E, e[44] = K) : K = e[44];
648
+ const J = K;
649
+ let re;
650
+ e[45] !== s || e[46] !== J ? (re = (A) => {
651
+ if (A === "interrupt") {
652
+ s?.();
648
653
  return;
649
654
  }
650
- C === "submit" && at();
651
- }, e[45] = o, e[46] = at, e[47] = Ne) : Ne = e[47];
652
- const Te = Ne;
653
- let Ve;
654
- e[48] !== ge || e[49] !== Te ? (Ve = () => {
655
- Te(Ao(ge));
656
- }, e[48] = ge, e[49] = Te, e[50] = Ve) : Ve = e[50];
657
- const ut = Ve;
658
- let Ue;
659
- e[51] !== He || e[52] !== Te ? (Ue = () => {
660
- Te(He);
661
- }, e[51] = He, e[52] = Te, e[53] = Ue) : Ue = e[53];
662
- const dt = Ue;
663
- let Ge;
664
- e[54] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ge = (C, ae, Y) => {
665
- const Oe = ee(C, ae);
666
- Se((Ee) => {
667
- const wt = Ee[Oe] ?? [], Lt = wt.includes(Y);
668
- return C.multiple ? {
669
- ...Ee,
670
- [Oe]: Lt ? wt.filter((Cn) => Cn !== Y) : [...wt, Y]
655
+ A === "submit" && J();
656
+ }, e[45] = s, e[46] = J, e[47] = re) : re = e[47];
657
+ const v = re;
658
+ let ye;
659
+ e[48] !== F || e[49] !== v ? (ye = () => {
660
+ v(Bs(F));
661
+ }, e[48] = F, e[49] = v, e[50] = ye) : ye = e[50];
662
+ const xe = ye;
663
+ let Je;
664
+ e[51] !== U || e[52] !== v ? (Je = () => {
665
+ v(U);
666
+ }, e[51] = U, e[52] = v, e[53] = Je) : Je = e[53];
667
+ const pt = Je;
668
+ let Ze;
669
+ e[54] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ze = (A, Se, ie) => {
670
+ const Ve = ae(A, Se);
671
+ te((je) => {
672
+ const Ct = je[Ve] ?? [], zt = Ct.includes(ie);
673
+ return A.multiple ? {
674
+ ...je,
675
+ [Ve]: zt ? Ct.filter((Pn) => Pn !== ie) : [...Ct, ie]
671
676
  } : {
672
- ...Ee,
673
- [Oe]: Lt ? [] : [Y]
677
+ ...je,
678
+ [Ve]: zt ? [] : [ie]
674
679
  };
675
680
  });
676
- }, e[54] = Ge) : Ge = e[54];
677
- const wn = Ge;
678
- let Ke;
679
- e[55] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ke = (C, ae, Y) => {
680
- const Oe = ee(C, ae);
681
- H((Ee) => ({
682
- ...Ee,
683
- [Oe]: Y
681
+ }, e[54] = Ze) : Ze = e[54];
682
+ const Mn = Ze;
683
+ let et;
684
+ e[55] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (et = (A, Se, ie) => {
685
+ const Ve = ae(A, Se);
686
+ fe((je) => ({
687
+ ...je,
688
+ [Ve]: ie
684
689
  }));
685
- }, e[55] = Ke) : Ke = e[55];
686
- const Tn = Ke;
687
- let Xe;
688
- e[56] !== d ? (Xe = d ? /* @__PURE__ */ l(F, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: d }) : void 0, e[56] = d, e[57] = Xe) : Xe = e[57];
689
- const ft = Xe, pt = R ? "-1px" : void 0, mt = R ? "0" : void 0, ht = I ? "blue.border" : "border.muted", gt = I ? "mid" : "low", bt = I ? 1 : 0, xt = I ? "blue.border" : "border";
690
- let Ce;
691
- e[58] !== xt ? (Ce = {
692
- borderColor: xt,
690
+ }, e[55] = et) : et = e[55];
691
+ const En = et;
692
+ let tt;
693
+ e[56] !== d ? (tt = d ? /* @__PURE__ */ l(q, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: d }) : void 0, e[56] = d, e[57] = tt) : tt = e[57];
694
+ const mt = tt, ht = k ? "-1px" : void 0, gt = k ? "0" : void 0, bt = P ? "blue.border" : "border.muted", yt = P ? "mid" : "low", xt = P ? 1 : 0, St = P ? "blue.border" : "border";
695
+ let $e;
696
+ e[58] !== St ? ($e = {
697
+ borderColor: St,
693
698
  boxShadow: "mid",
694
699
  zIndex: 1
695
- }, e[58] = xt, e[59] = Ce) : Ce = e[59];
696
- let Ye;
697
- e[60] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ye = {
700
+ }, e[58] = St, e[59] = $e) : $e = e[59];
701
+ let nt;
702
+ e[60] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (nt = {
698
703
  borderColor: "blue.border",
699
704
  boxShadow: "mid",
700
705
  zIndex: 1
701
- }, e[60] = Ye) : Ye = e[60];
702
- let Je;
703
- e[61] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Je = () => _(!1), e[61] = Je) : Je = e[61];
704
- let _e;
705
- e[62] !== D || e[63] !== O || e[64] !== P || e[65] !== ut || e[66] !== A || e[67] !== u || e[68] !== ft || e[69] !== h || e[70] !== E ? (_e = h ? /* @__PURE__ */ l(Wo, { questionPrompt: h, selectedOptionsByQuestion: E, customAnswersByQuestion: D, onToggleOption: wn, onCustomAnswerChange: Tn }) : /* @__PURE__ */ l(Yt, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
706
+ }, e[60] = nt) : nt = e[60];
707
+ let st;
708
+ e[61] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (st = () => M(!1), e[61] = st) : st = e[61];
709
+ let Oe;
710
+ e[62] !== O || e[63] !== L || e[64] !== B || e[65] !== xe || e[66] !== C || e[67] !== u || e[68] !== mt || e[69] !== h || e[70] !== E ? (Oe = h ? /* @__PURE__ */ l(Ks, { questionPrompt: h, selectedOptionsByQuestion: E, customAnswersByQuestion: O, onToggleOption: Mn, onCustomAnswerChange: En }) : /* @__PURE__ */ l(nn, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
706
711
  pr: "2xs"
707
- }, children: /* @__PURE__ */ l(ro, { defaultState: P, isEditable: !A, placeholder: ft, onChange: (C) => {
708
- $e(C), u?.(C);
709
- }, onSubmit: ut }, O) }), e[62] = D, e[63] = O, e[64] = P, e[65] = ut, e[66] = A, e[67] = u, e[68] = ft, e[69] = h, e[70] = E, e[71] = _e) : _e = e[71];
710
- let Ze;
711
- e[72] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ze = /* @__PURE__ */ l($n, {}), e[72] = Ze) : Ze = e[72];
712
- const yt = he ? "Stop Response" : "Message Sending", St = x ? void 0 : "Enter", kt = He === "none";
713
- let Ae;
714
- e[73] !== he || e[74] !== dt || e[75] !== yt || e[76] !== St || e[77] !== kt ? (Ae = /* @__PURE__ */ l(Ho, { canInterrupt: he, title: yt, shortcut: St, onClick: dt, disabled: kt }), e[73] = he, e[74] = dt, e[75] = yt, e[76] = St, e[77] = kt, e[78] = Ae) : Ae = e[78];
715
- let Re;
716
- e[79] !== m || e[80] !== Ae ? (Re = /* @__PURE__ */ w(Me, { gap: "1", mt: "md", children: [
712
+ }, children: /* @__PURE__ */ l(ds, { defaultState: B, isEditable: !C, placeholder: mt, onChange: (A) => {
713
+ Ae(A), u?.(A);
714
+ }, onSubmit: xe }, L) }), e[62] = O, e[63] = L, e[64] = B, e[65] = xe, e[66] = C, e[67] = u, e[68] = mt, e[69] = h, e[70] = E, e[71] = Oe) : Oe = e[71];
715
+ let ot;
716
+ e[72] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ot = /* @__PURE__ */ l(zn, {}), e[72] = ot) : ot = e[72];
717
+ const Tt = D ? "Stop Response" : "Message Sending", wt = y ? void 0 : "Enter", kt = U === "none";
718
+ let De;
719
+ e[73] !== D || e[74] !== pt || e[75] !== Tt || e[76] !== wt || e[77] !== kt ? (De = /* @__PURE__ */ l(Gs, { canInterrupt: D, title: Tt, shortcut: wt, onClick: pt, disabled: kt }), e[73] = D, e[74] = pt, e[75] = Tt, e[76] = wt, e[77] = kt, e[78] = De) : De = e[78];
720
+ let Fe;
721
+ e[79] !== m || e[80] !== De ? (Fe = /* @__PURE__ */ w(Ee, { gap: "1", mt: "md", children: [
717
722
  m,
718
- Ze,
719
- Ae
720
- ] }), e[79] = m, e[80] = Ae, e[81] = Re) : Re = e[81];
721
- let Be;
722
- e[82] !== f || e[83] !== _e || e[84] !== Re ? (Be = /* @__PURE__ */ w(fe, { direction: "column", color: "fg", children: [
723
- f,
724
- _e,
725
- Re
726
- ] }), e[82] = f, e[83] = _e, e[84] = Re, e[85] = Be) : Be = e[85];
727
- let et;
728
- return e[86] !== pt || e[87] !== mt || e[88] !== ht || e[89] !== gt || e[90] !== bt || e[91] !== Ce || e[92] !== Be ? (et = /* @__PURE__ */ l(M, { ref: we, position: "relative", width: "100%", paddingX: "lg", paddingY: "md", mt: pt, bg: "bg", borderRadius: "md", borderTopRadius: mt, borderWidth: "1px", borderStyle: "solid", borderColor: ht, boxShadow: gt, zIndex: bt, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: Ce, _focusWithin: Ye, onClick: kn, onBlur: Je, children: Be }), e[86] = pt, e[87] = mt, e[88] = ht, e[89] = gt, e[90] = bt, e[91] = Ce, e[92] = Be, e[93] = et) : et = e[93], et;
723
+ ot,
724
+ De
725
+ ] }), e[79] = m, e[80] = De, e[81] = Fe) : Fe = e[81];
726
+ let ze;
727
+ e[82] !== p || e[83] !== Oe || e[84] !== Fe ? (ze = /* @__PURE__ */ w(Ce, { direction: "column", color: "fg", children: [
728
+ p,
729
+ Oe,
730
+ Fe
731
+ ] }), e[82] = p, e[83] = Oe, e[84] = Fe, e[85] = ze) : ze = e[85];
732
+ let rt;
733
+ return e[86] !== ht || e[87] !== gt || e[88] !== bt || e[89] !== yt || e[90] !== xt || e[91] !== $e || e[92] !== ze ? (rt = /* @__PURE__ */ l(I, { ref: Re, position: "relative", width: "100%", paddingX: "xs", paddingY: "md", mt: ht, bg: "bg", borderRadius: "md", borderTopRadius: gt, borderWidth: "1px", borderStyle: "solid", borderColor: bt, boxShadow: yt, zIndex: xt, transition: "box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out", _hover: $e, _focusWithin: nt, onClick: be, onBlur: st, children: ze }), e[86] = ht, e[87] = gt, e[88] = bt, e[89] = yt, e[90] = xt, e[91] = $e, e[92] = ze, e[93] = rt) : rt = e[93], rt;
729
734
  };
730
- function No() {
735
+ function Ys() {
731
736
  }
732
- function Vo(t) {
737
+ function Js(t) {
733
738
  return t + 1;
734
739
  }
735
- function Uo(t) {
740
+ function Zs(t) {
736
741
  return t + 1;
737
742
  }
738
- const Go = (t = "") => JSON.stringify(io(t)), Ko = 360, Xo = 4, Yo = "min(10vh, 4rem)", sn = "min(70dvh, calc(100dvh - 12rem), 22rem)", _t = 1, Jo = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
743
+ const eo = (t = "") => JSON.stringify(fs(t)), to = 360, no = 4, so = "min(10vh, 4rem)", dn = "min(70dvh, calc(100dvh - 12rem), 22rem)", Rt = 1, oo = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
739
744
  lineCount: e.lineCount + n.text.split(/\r\n|\r|\n/).length,
740
745
  textLength: e.textLength + n.text.length
741
746
  }, {
742
747
  lineCount: 0,
743
748
  textLength: 0
744
- }), Zo = (t) => {
749
+ }), ro = (t) => {
745
750
  if (t.role !== "user") return !1;
746
751
  const {
747
752
  lineCount: e,
748
753
  textLength: n
749
- } = Jo(t);
750
- return n > Ko || e > Xo;
751
- }, es = (t, e) => {
754
+ } = oo(t);
755
+ return n > to || e > no;
756
+ }, io = (t, e) => {
752
757
  const n = Math.max(0, t.scrollHeight - t.clientHeight);
753
- return e === 0 || n <= _t ? !1 : e < 0 ? t.scrollTop > _t : t.scrollTop < n - _t;
754
- }, ts = (t) => {
755
- const e = S(8);
756
- let n, s;
758
+ return e === 0 || n <= Rt ? !1 : e < 0 ? t.scrollTop > Rt : t.scrollTop < n - Rt;
759
+ }, lo = (t) => t.type === "text", ao = (t) => (t.parts ?? []).filter(lo).map((e) => e.text.trim()).filter(Boolean).join(`
760
+
761
+ `), co = (t, e, n) => t.createdAt ? new Intl.DateTimeFormat(e, {
762
+ hour: "numeric",
763
+ minute: "2-digit",
764
+ timeZone: n
765
+ }).format(new Date(t.createdAt)) : "", Pt = (t) => {
766
+ const e = T(20), {
767
+ message: n,
768
+ alwaysVisible: o,
769
+ copyAlwaysVisible: s
770
+ } = t, r = o === void 0 ? !1 : o, i = s === void 0 ? r : s, [a, c] = G(!1), u = Qe(null);
771
+ let d;
772
+ e[0] !== n ? (d = ao(n), e[0] = n, e[1] = d) : d = e[1];
773
+ const p = d;
774
+ let m;
775
+ e[2] !== n ? (m = co(n), e[2] = n, e[3] = m) : m = e[3];
776
+ const f = m;
777
+ let h, g;
778
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
779
+ u.current !== null && window.clearTimeout(u.current);
780
+ }, g = [], e[4] = h, e[5] = g) : (h = e[4], g = e[5]), we(h, g);
781
+ let b;
782
+ e[6] !== p ? (b = async () => {
783
+ if (p)
784
+ try {
785
+ await navigator.clipboard.writeText(p), c(!0), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => c(!1), 1200);
786
+ } catch {
787
+ c(!1);
788
+ }
789
+ }, e[6] = p, e[7] = b) : b = e[7];
790
+ const y = b;
791
+ if (!p && !f)
792
+ return null;
793
+ const x = r ? "1" : "0", _ = r ? "auto" : "none";
794
+ let C;
795
+ e[8] !== f ? (C = f ? /* @__PURE__ */ l(q, { textStyle: "label/XS/regular", color: "fg.muted", children: f }) : null, e[8] = f, e[9] = C) : C = e[9];
796
+ let k;
797
+ e[10] !== i || e[11] !== y || e[12] !== p || e[13] !== a ? (k = p ? /* @__PURE__ */ l(I, { opacity: i ? "1" : "0", pointerEvents: i ? "auto" : "none", transition: "opacity 120ms ease", css: Ht, children: /* @__PURE__ */ l(sn, { content: a ? "Copied" : "Copy message", children: /* @__PURE__ */ l(Lt, { "aria-label": a ? "Copied" : "Copy message", variant: "ghost", size: "2xs", onClick: y, children: a ? /* @__PURE__ */ l(Zt, { size: 12 }) : /* @__PURE__ */ l(Un, { size: 12 }) }) }) }) : null, e[10] = i, e[11] = y, e[12] = p, e[13] = a, e[14] = k) : k = e[14];
798
+ let R;
799
+ return e[15] !== k || e[16] !== x || e[17] !== _ || e[18] !== C ? (R = /* @__PURE__ */ w(Ee, { "data-chat-message-action-panel": "true", gap: "2xs", minH: "6", opacity: x, pointerEvents: _, transition: "opacity 120ms ease", css: Ht, children: [
800
+ C,
801
+ k
802
+ ] }), e[15] = k, e[16] = x, e[17] = _, e[18] = C, e[19] = R) : R = e[19], R;
803
+ }, Ht = {
804
+ "[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
805
+ opacity: 1,
806
+ pointerEvents: "auto"
807
+ },
808
+ ".ai-message__root:hover &, .ai-message__root:focus-within &": {
809
+ opacity: 1,
810
+ pointerEvents: "auto"
811
+ },
812
+ "[data-scope='ai-message'][data-part='root']:hover &, [data-scope='ai-message'][data-part='root']:focus-within &": {
813
+ opacity: 1,
814
+ pointerEvents: "auto"
815
+ }
816
+ }, uo = (t) => {
817
+ const e = T(8);
818
+ let n, o;
757
819
  e[0] !== t ? ({
758
820
  children: n,
759
- ...s
760
- } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
761
- let o;
762
- e[3] !== n ? (o = /* @__PURE__ */ l(Jt, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
821
+ ...o
822
+ } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
823
+ let s;
824
+ e[3] !== n ? (s = /* @__PURE__ */ l(on, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = s) : s = e[4];
763
825
  let r;
764
- return e[5] !== s || e[6] !== o ? (r = /* @__PURE__ */ l(M, { ...s, children: o }), e[5] = s, e[6] = o, e[7] = r) : r = e[7], r;
765
- }, ns = ts, rt = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), os = (t) => {
766
- const e = rt(t), n = e.replace(/_/g, "");
826
+ return e[5] !== o || e[6] !== s ? (r = /* @__PURE__ */ l(I, { ...o, children: s }), e[5] = o, e[6] = s, e[7] = r) : r = e[7], r;
827
+ }, fo = uo, ut = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), po = (t) => {
828
+ const e = ut(t), n = e.replace(/_/g, "");
767
829
  return [.../* @__PURE__ */ new Set([t, e, n])];
768
- }, rn = {
769
- shell: Kt,
770
- ls: Gn,
771
- read_file: Un,
772
- write_file: Vn,
773
- delete_file: Nn,
774
- patch: jn,
775
- upload_files: Hn,
776
- download_file: Wn,
777
- move_file: zn
778
- }, ss = {
779
- dot: eo,
780
- danger: Xt,
781
- search: Zn,
782
- browser: Jn,
783
- file: Yn,
784
- question: Xn,
785
- todo: Kn,
786
- terminal: Kt,
787
- ...rn
788
- }, Qt = "dot", rs = (t) => Object.hasOwn(rn, t), is = (t) => ss[t], ln = (t) => {
789
- if (!t) return Qt;
790
- const e = rt(t);
791
- if (rs(e)) return e;
830
+ }, fn = {
831
+ shell: en,
832
+ ls: ts,
833
+ read_file: es,
834
+ write_file: Zn,
835
+ delete_file: Jn,
836
+ patch: Yn,
837
+ upload_files: Xn,
838
+ download_file: Gn,
839
+ move_file: Kn
840
+ }, mo = {
841
+ dot: ls,
842
+ danger: tn,
843
+ search: is,
844
+ browser: rs,
845
+ file: os,
846
+ question: ss,
847
+ todo: ns,
848
+ terminal: en,
849
+ ...fn
850
+ }, Wt = "dot", ho = (t) => Object.hasOwn(fn, t), go = (t) => mo[t], pn = (t) => {
851
+ if (!t) return Wt;
852
+ const e = ut(t);
853
+ if (ho(e)) return e;
792
854
  const n = e.replace(/_/g, "");
793
855
  switch (e) {
794
856
  case "read":
@@ -815,52 +877,52 @@ const Go = (t = "") => JSON.stringify(io(t)), Ko = 360, Xo = 4, Yo = "min(10vh,
815
877
  case "file":
816
878
  return "file";
817
879
  default:
818
- return n === "todowrite" || n === "todo" ? "todo" : Qt;
880
+ return n === "todowrite" || n === "todo" ? "todo" : Wt;
819
881
  }
820
882
  };
821
883
  function Ot(t) {
822
884
  const e = t.lastIndexOf("/");
823
885
  return e >= 0 ? t.slice(e + 1) : t;
824
886
  }
825
- function ot(t) {
887
+ function lt(t) {
826
888
  if (!t) return null;
827
889
  const e = t.split(" ")[0].trim();
828
890
  if (e === "/dev/null") return null;
829
891
  let n = e;
830
892
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
831
893
  }
832
- const it = (t) => t.startsWith("--- "), Et = (t) => t.startsWith("+++ "), Dt = (t) => t.startsWith("@@"), ls = (t) => t.startsWith("+") && !(Et(t) || t === "+++"), cs = (t) => t.startsWith("-") && !(it(t) || t === "---"), as = (t, e) => {
894
+ const dt = (t) => t.startsWith("--- "), Dt = (t) => t.startsWith("+++ "), Ft = (t) => t.startsWith("@@"), bo = (t) => t.startsWith("+") && !(Dt(t) || t === "+++"), yo = (t) => t.startsWith("-") && !(dt(t) || t === "---"), xo = (t, e) => {
833
895
  t.has(e) || t.set(e, {
834
896
  additions: 0,
835
897
  deletions: 0
836
898
  });
837
- }, us = (t, e) => {
899
+ }, So = (t, e) => {
838
900
  const n = t.get(e);
839
901
  n && (n.additions += 1);
840
- }, ds = (t, e) => {
902
+ }, To = (t, e) => {
841
903
  const n = t.get(e);
842
904
  n && (n.deletions += 1);
843
- }, fs = (t, e, n) => {
844
- if (it(t))
905
+ }, wo = (t, e, n) => {
906
+ if (dt(t))
845
907
  return {
846
908
  ...e,
847
- lastMinusHeader: ot(t.slice(4)),
909
+ lastMinusHeader: lt(t.slice(4)),
848
910
  inHunk: !1
849
911
  };
850
- if (Et(t)) {
851
- const o = ot(t.slice(4)) ?? e.lastMinusHeader;
852
- return o && as(n, o), {
912
+ if (Dt(t)) {
913
+ const s = lt(t.slice(4)) ?? e.lastMinusHeader;
914
+ return s && xo(n, s), {
853
915
  ...e,
854
- currentPath: o,
916
+ currentPath: s,
855
917
  inHunk: !1
856
918
  };
857
919
  }
858
- return e.currentPath ? Dt(t) ? {
920
+ return e.currentPath ? Ft(t) ? {
859
921
  ...e,
860
922
  inHunk: !0
861
- } : e.inHunk ? ls(t) ? (us(n, e.currentPath), e) : (cs(t) && ds(n, e.currentPath), e) : e : e;
923
+ } : e.inHunk ? bo(t) ? (So(n, e.currentPath), e) : (yo(t) && To(n, e.currentPath), e) : e : e;
862
924
  };
863
- function cn(t) {
925
+ function mn(t) {
864
926
  if (!t || typeof t != "string") return [];
865
927
  const e = /* @__PURE__ */ new Map();
866
928
  let n = {
@@ -868,20 +930,20 @@ function cn(t) {
868
930
  lastMinusHeader: null,
869
931
  inHunk: !1
870
932
  };
871
- const s = t.split(/\r?\n/);
872
- for (const o of s)
873
- n = fs(o, n, e);
874
- return Array.from(e.entries()).map(([o, {
933
+ const o = t.split(/\r?\n/);
934
+ for (const s of o)
935
+ n = wo(s, n, e);
936
+ return Array.from(e.entries()).map(([s, {
875
937
  additions: r,
876
938
  deletions: i
877
939
  }]) => ({
878
- filePath: o,
940
+ filePath: s,
879
941
  additions: r,
880
942
  deletions: i
881
943
  }));
882
944
  }
883
- function ps(t) {
884
- return cn(t).map((e) => ({
945
+ function ko(t) {
946
+ return mn(t).map((e) => ({
885
947
  kind: "diff",
886
948
  fileName: Ot(e.filePath),
887
949
  filePath: e.filePath,
@@ -889,13 +951,13 @@ function ps(t) {
889
951
  deletions: e.deletions
890
952
  }));
891
953
  }
892
- function ms(t) {
893
- return cn(t).map((e) => e.filePath);
954
+ function Co(t) {
955
+ return mn(t).map((e) => e.filePath);
894
956
  }
895
- const an = (t) => it(t) || t.startsWith("diff --git "), hs = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", gs = (t, e, n) => {
957
+ const hn = (t) => dt(t) || t.startsWith("diff --git "), _o = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Ao = (t, e, n) => {
896
958
  if (t.startsWith(" ")) {
897
- const s = t.slice(1);
898
- e.push(s), n.push(s);
959
+ const o = t.slice(1);
960
+ e.push(o), n.push(o);
899
961
  return;
900
962
  }
901
963
  if (t.startsWith("-")) {
@@ -903,61 +965,61 @@ const an = (t) => it(t) || t.startsWith("diff --git "), hs = (t) => t.startsWith
903
965
  return;
904
966
  }
905
967
  t.startsWith("+") && n.push(t.slice(1));
906
- }, bs = (t, e, n, s) => {
907
- let o = e;
908
- for (; o < t.length; ) {
909
- const r = t[o] || "";
910
- if (an(r) || Dt(r) || hs(r))
968
+ }, Ro = (t, e, n, o) => {
969
+ let s = e;
970
+ for (; s < t.length; ) {
971
+ const r = t[s] || "";
972
+ if (hn(r) || Ft(r) || _o(r))
911
973
  break;
912
- gs(r, n, s), o += 1;
974
+ Ao(r, n, o), s += 1;
913
975
  }
914
- return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), o;
915
- }, xs = (t, e) => {
916
- const n = ot((t[e] || "").slice(4)), s = t[e + 1] || "";
917
- if (!Et(s)) return {
976
+ return (n.length > 0 || o.length > 0) && (n.push(""), o.push("")), s;
977
+ }, Io = (t, e) => {
978
+ const n = lt((t[e] || "").slice(4)), o = t[e + 1] || "";
979
+ if (!Dt(o)) return {
918
980
  nextIndex: e + 1
919
981
  };
920
- const r = ot(s.slice(4)) ?? n ?? "", i = [], c = [];
921
- let a = e + 2;
922
- for (; a < t.length; ) {
923
- const u = t[a] || "";
924
- if (an(u)) break;
925
- if (!Dt(u)) {
926
- a += 1;
982
+ const r = lt(o.slice(4)) ?? n ?? "", i = [], a = [];
983
+ let c = e + 2;
984
+ for (; c < t.length; ) {
985
+ const u = t[c] || "";
986
+ if (hn(u)) break;
987
+ if (!Ft(u)) {
988
+ c += 1;
927
989
  continue;
928
990
  }
929
- a = bs(t, a + 1, i, c);
991
+ c = Ro(t, c + 1, i, a);
930
992
  }
931
993
  return {
932
- nextIndex: a,
994
+ nextIndex: c,
933
995
  preview: {
934
996
  filePath: r,
935
997
  original: i.join(`
936
998
  `),
937
- modified: c.join(`
999
+ modified: a.join(`
938
1000
  `)
939
1001
  }
940
1002
  };
941
1003
  };
942
- function ys(t) {
1004
+ function Mo(t) {
943
1005
  if (!t || typeof t != "string") return [];
944
1006
  const e = t.split(/\r?\n/), n = [];
945
- let s = 0;
946
- for (; s < e.length; ) {
947
- const o = e[s] || "";
948
- if (!it(o)) {
949
- s += 1;
1007
+ let o = 0;
1008
+ for (; o < e.length; ) {
1009
+ const s = e[o] || "";
1010
+ if (!dt(s)) {
1011
+ o += 1;
950
1012
  continue;
951
1013
  }
952
1014
  const {
953
1015
  nextIndex: r,
954
1016
  preview: i
955
- } = xs(e, s);
956
- i && n.push(i), s = Math.max(r, s + 1);
1017
+ } = Io(e, o);
1018
+ i && n.push(i), o = Math.max(r, o + 1);
957
1019
  }
958
1020
  return n;
959
1021
  }
960
- const Ss = {
1022
+ const Eo = {
961
1023
  apply_patch: "Apply patch",
962
1024
  bash: "Run command",
963
1025
  edit: "Edit file",
@@ -966,7 +1028,7 @@ const Ss = {
966
1028
  read: "Read file",
967
1029
  skill: "Load skill",
968
1030
  todowrite: "Update todos"
969
- }, Ft = {
1031
+ }, Nt = {
970
1032
  pending: "queued",
971
1033
  error: "failed",
972
1034
  "output-error": "failed",
@@ -975,126 +1037,126 @@ const Ss = {
975
1037
  running: "running",
976
1038
  completed: "completed",
977
1039
  failed: "failed"
978
- }, un = (t) => t.replace(/^tool-/, "").toLowerCase(), ks = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), ws = (t) => un(t.tool ?? "tool"), Ts = (t) => {
979
- const e = un(t);
980
- return Ss[e] ?? ks(e.replace(/_/g, " "));
981
- }, Cs = (t) => {
1040
+ }, gn = (t) => t.replace(/^tool-/, "").toLowerCase(), Po = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Bo = (t) => gn(t.tool ?? "tool"), Lo = (t) => {
1041
+ const e = gn(t);
1042
+ return Eo[e] ?? Po(e.replace(/_/g, " "));
1043
+ }, vo = (t) => {
982
1044
  const e = t.state?.status ?? t.status;
983
1045
  if (!e || typeof e != "string") return null;
984
1046
  const n = e.replace(/-/g, "_");
985
- return Ft[n] ? Ft[n] : n.includes("stream") ? "running" : null;
986
- }, dn = (t) => {
1047
+ return Nt[n] ? Nt[n] : n.includes("stream") ? "running" : null;
1048
+ }, bn = (t) => {
987
1049
  const e = t.state?.status ?? t.status;
988
1050
  return e === "error" || e === "output-error" || e === "failed";
989
- }, te = (t) => dn(t) ? {
1051
+ }, ce = (t) => bn(t) ? {
990
1052
  type: "icon",
991
1053
  icon: "danger"
992
1054
  } : {
993
1055
  type: "icon",
994
- icon: ln(ws(t))
995
- }, ne = (t, e, n) => {
996
- const o = [{
1056
+ icon: pn(Bo(t))
1057
+ }, ue = (t, e, n) => {
1058
+ const s = [{
997
1059
  kind: "text",
998
- text: n ?? Ts(t.tool ?? "tool"),
1060
+ text: n ?? Lo(t.tool ?? "tool"),
999
1061
  bold: !0
1000
1062
  }];
1001
- e && o.push({
1063
+ e && s.push({
1002
1064
  kind: "text",
1003
1065
  text: e,
1004
1066
  muted: !0
1005
1067
  });
1006
- const r = Cs(t);
1007
- return r && r !== "completed" && o.push({
1068
+ const r = vo(t);
1069
+ return r && r !== "completed" && s.push({
1008
1070
  kind: "text",
1009
1071
  text: r,
1010
1072
  muted: !0
1011
- }), o;
1012
- }, xe = (t) => {
1073
+ }), s;
1074
+ }, Pe = (t) => {
1013
1075
  const e = t.state?.input;
1014
1076
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1015
- }, ve = (t) => {
1077
+ }, Ge = (t) => {
1016
1078
  const e = t.state?.output;
1017
1079
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1018
- }, y = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, st = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, _s = (t, e) => {
1019
- const n = st(t.state);
1020
- return n ? st(n[e]) : null;
1021
- }, As = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Rs = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), fn = (t) => {
1022
- const e = ve(t);
1023
- return [_s(t, "metadata"), st(e?.metadata)].filter(Boolean);
1024
- }, Bs = (t) => {
1025
- const e = st(t);
1080
+ }, S = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, at = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, $o = (t, e) => {
1081
+ const n = at(t.state);
1082
+ return n ? at(n[e]) : null;
1083
+ }, Oo = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Do = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), yn = (t) => {
1084
+ const e = Ge(t);
1085
+ return [$o(t, "metadata"), at(e?.metadata)].filter(Boolean);
1086
+ }, Fo = (t) => {
1087
+ const e = at(t);
1026
1088
  if (!e) return null;
1027
- const n = y(e.filePath) ?? y(e.relativePath) ?? y(e.path);
1089
+ const n = S(e.filePath) ?? S(e.relativePath) ?? S(e.path);
1028
1090
  return n ? {
1029
- filePath: As(n),
1091
+ filePath: Oo(n),
1030
1092
  additions: typeof e.additions == "number" ? e.additions : 0,
1031
1093
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
1032
- diff: y(e.diff) ?? void 0,
1033
- before: y(e.before) ?? void 0,
1034
- after: y(e.after) ?? void 0
1094
+ diff: S(e.diff) ?? void 0,
1095
+ before: S(e.before) ?? void 0,
1096
+ after: S(e.after) ?? void 0
1035
1097
  } : null;
1036
- }, pn = (t) => {
1098
+ }, xn = (t) => {
1037
1099
  const e = [];
1038
- for (const n of fn(t)) {
1039
- const s = Array.isArray(n.files) ? n.files : [];
1040
- for (const o of s) {
1041
- const r = Bs(o);
1100
+ for (const n of yn(t)) {
1101
+ const o = Array.isArray(n.files) ? n.files : [];
1102
+ for (const s of o) {
1103
+ const r = Fo(s);
1042
1104
  r && e.push(r);
1043
1105
  }
1044
1106
  }
1045
1107
  return e;
1046
- }, Is = (t) => {
1047
- const e = xe(t), n = y(e?.diff);
1108
+ }, zo = (t) => {
1109
+ const e = Pe(t), n = S(e?.diff);
1048
1110
  if (n) return n;
1049
- for (const r of fn(t)) {
1050
- const i = y(r.diff);
1111
+ for (const r of yn(t)) {
1112
+ const i = S(r.diff);
1051
1113
  if (i) return i;
1052
1114
  }
1053
- const s = pn(t).map((r) => r.diff).filter((r) => !!r);
1054
- if (s.length > 0) return s.join(`
1115
+ const o = xn(t).map((r) => r.diff).filter((r) => !!r);
1116
+ if (o.length > 0) return o.join(`
1055
1117
  `);
1056
- const o = y(e?.patchText);
1057
- return o && Rs(o) ? o : null;
1058
- }, Ps = (t) => {
1118
+ const s = S(e?.patchText);
1119
+ return s && Do(s) ? s : null;
1120
+ }, qo = (t) => {
1059
1121
  const e = /* @__PURE__ */ new Set(), n = [];
1060
- for (const s of t)
1061
- e.has(s.filePath) || (e.add(s.filePath), n.push({
1122
+ for (const o of t)
1123
+ e.has(o.filePath) || (e.add(o.filePath), n.push({
1062
1124
  kind: "diff",
1063
- fileName: Ot(s.filePath),
1064
- filePath: s.filePath,
1065
- additions: s.additions,
1066
- deletions: s.deletions
1125
+ fileName: Ot(o.filePath),
1126
+ filePath: o.filePath,
1127
+ additions: o.additions,
1128
+ deletions: o.deletions
1067
1129
  }));
1068
1130
  return n;
1069
- }, Ms = (t) => Array.from(new Set(t.map((e) => e.filePath))), lt = (t) => {
1070
- const e = ve(t);
1071
- return y(t.state?.output) ?? y(e?.returnDisplay) ?? y(e?.preview) ?? y(e?.stdout) ?? y(e?.content);
1072
- }, $s = (t) => {
1131
+ }, Qo = (t) => Array.from(new Set(t.map((e) => e.filePath))), ft = (t) => {
1132
+ const e = Ge(t);
1133
+ return S(t.state?.output) ?? S(e?.returnDisplay) ?? S(e?.preview) ?? S(e?.stdout) ?? S(e?.content);
1134
+ }, Ho = (t) => {
1073
1135
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
1074
1136
  return e ? {
1075
- skillName: y(e[1]) ?? void 0,
1076
- content: y(e[2]) ?? ""
1137
+ skillName: S(e[1]) ?? void 0,
1138
+ content: S(e[2]) ?? ""
1077
1139
  } : null;
1078
- }, Os = (t) => {
1079
- const e = xe(t);
1080
- return y(e?.name) ?? y(e?.skillName) ?? y(e?.skill) ?? y(e?.skill_name) ?? void 0;
1081
- }, mn = (t) => ({
1140
+ }, Wo = (t) => {
1141
+ const e = Pe(t);
1142
+ return S(e?.name) ?? S(e?.skillName) ?? S(e?.skill) ?? S(e?.skill_name) ?? void 0;
1143
+ }, Sn = (t) => ({
1082
1144
  kind: "link",
1083
1145
  text: Ot(t),
1084
1146
  filePath: t
1085
- }), oe = (t, e) => !dn(t) || !t.state?.errorText ? e : [{
1147
+ }), de = (t, e) => !bn(t) || !t.state?.errorText ? e : [{
1086
1148
  type: "comment",
1087
1149
  text: t.state.errorText
1088
- }, ...e], hn = (t) => ys(t ?? void 0).map((e) => ({
1150
+ }, ...e], Tn = (t) => Mo(t ?? void 0).map((e) => ({
1089
1151
  type: "diff",
1090
1152
  language: "diff",
1091
1153
  original: e.original,
1092
1154
  modified: e.modified,
1093
1155
  sideBySide: !1
1094
- })), Es = (t) => ps(t ?? void 0), Ds = (t) => ms(t ?? void 0), Ls = (t) => {
1095
- const e = Is(t), n = pn(t), s = ne(t, void 0, "Apply patch"), o = Es(e);
1096
- o.length > 0 ? s.push(...o) : s.push(...Ps(n));
1097
- const r = [...hn(e)];
1156
+ })), No = (t) => ko(t ?? void 0), Vo = (t) => Co(t ?? void 0), jo = (t) => {
1157
+ const e = zo(t), n = xn(t), o = ue(t, void 0, "Apply patch"), s = No(e);
1158
+ s.length > 0 ? o.push(...s) : o.push(...qo(n));
1159
+ const r = [...Tn(e)];
1098
1160
  if (r.length === 0)
1099
1161
  for (const i of n)
1100
1162
  !i.before && !i.after || r.push({
@@ -1105,252 +1167,252 @@ const Ss = {
1105
1167
  sideBySide: !1
1106
1168
  });
1107
1169
  if (r.length === 0) {
1108
- const i = Ds(e);
1109
- i.length === 0 && i.push(...Ms(n)), i.length > 0 && r.push({
1170
+ const i = Vo(e);
1171
+ i.length === 0 && i.push(...Qo(n)), i.length > 0 && r.push({
1110
1172
  type: "references",
1111
1173
  references: i
1112
1174
  });
1113
1175
  }
1114
1176
  return {
1115
- indicator: te(t),
1116
- title: s,
1117
- blocks: oe(t, r)
1177
+ indicator: ce(t),
1178
+ title: o,
1179
+ blocks: de(t, r)
1118
1180
  };
1119
- }, qs = (t, e) => [{
1181
+ }, Uo = (t, e) => [{
1120
1182
  type: "diff",
1121
1183
  language: "text",
1122
1184
  original: t,
1123
1185
  modified: e,
1124
1186
  sideBySide: !1
1125
- }], vs = (t) => {
1126
- const e = xe(t), n = ve(t), s = y(e?.filePath) ?? y(e?.file_path) ?? y(n?.filePath) ?? void 0, o = y(n?.oldString) ?? y(e?.old_string) ?? void 0, r = y(n?.newString) ?? y(e?.new_string) ?? void 0, i = ne(t, void 0, "Edit file");
1127
- s && i.push(mn(s));
1128
- const c = o !== void 0 && r !== void 0 ? qs(o, r) : hn(y(n?.diff));
1187
+ }], Ko = (t) => {
1188
+ const e = Pe(t), n = Ge(t), o = S(e?.filePath) ?? S(e?.file_path) ?? S(n?.filePath) ?? void 0, s = S(n?.oldString) ?? S(e?.old_string) ?? void 0, r = S(n?.newString) ?? S(e?.new_string) ?? void 0, i = ue(t, void 0, "Edit file");
1189
+ o && i.push(Sn(o));
1190
+ const a = s !== void 0 && r !== void 0 ? Uo(s, r) : Tn(S(n?.diff));
1129
1191
  return {
1130
- indicator: te(t),
1192
+ indicator: ce(t),
1131
1193
  title: i,
1132
- blocks: oe(t, c)
1194
+ blocks: de(t, a)
1133
1195
  };
1134
- }, Qe = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Qs = (t) => {
1196
+ }, Xe = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Go = (t) => {
1135
1197
  try {
1136
1198
  const e = JSON.parse(t);
1137
- return Qe(e) ? e : null;
1199
+ return Xe(e) ? e : null;
1138
1200
  } catch {
1139
1201
  return null;
1140
1202
  }
1141
- }, Fs = (t) => Qe(t) ? t : typeof t == "string" && t.trim().length > 0 ? Qs(t) : null, Pe = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, be = (t) => {
1142
- const e = Pe(t);
1203
+ }, Xo = (t) => Xe(t) ? t : typeof t == "string" && t.trim().length > 0 ? Go(t) : null, He = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, Me = (t) => {
1204
+ const e = He(t);
1143
1205
  if (e) return e;
1144
1206
  if (Array.isArray(t)) {
1145
- const n = t.map(be).filter((s) => s !== null);
1207
+ const n = t.map(Me).filter((o) => o !== null);
1146
1208
  return n.length > 0 ? n.join(`
1147
1209
  `) : null;
1148
1210
  }
1149
- return Qe(t) ? be(t.response) ?? be(t.answer) ?? be(t.text) ?? be(t.answers) : null;
1150
- }, zs = (t) => {
1211
+ return Xe(t) ? Me(t.response) ?? Me(t.answer) ?? Me(t.text) ?? Me(t.answers) : null;
1212
+ }, Yo = (t) => {
1151
1213
  if (typeof t == "string" && t.trim().length > 0)
1152
1214
  return {
1153
1215
  label: t,
1154
1216
  description: void 0
1155
1217
  };
1156
- if (!Qe(t)) return null;
1157
- const e = Pe(t.label);
1218
+ if (!Xe(t)) return null;
1219
+ const e = He(t.label);
1158
1220
  return e ? {
1159
1221
  label: e,
1160
- description: Pe(t.description) ?? void 0
1222
+ description: He(t.description) ?? void 0
1161
1223
  } : null;
1162
- }, Ws = (t, e) => {
1163
- if (!Qe(t)) return null;
1164
- const n = Pe(t.question);
1224
+ }, Jo = (t, e) => {
1225
+ if (!Xe(t)) return null;
1226
+ const n = He(t.question);
1165
1227
  if (!n) return null;
1166
- const s = Array.isArray(t.options) ? t.options.map(zs).filter((i) => i !== null) : [], o = Pe(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : o === "freeform" || o === "text";
1167
- return s.length === 0 && !r ? null : {
1168
- id: Pe(t.id) ?? `question-${e}`,
1228
+ const o = Array.isArray(t.options) ? t.options.map(Yo).filter((i) => i !== null) : [], s = He(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : s === "freeform" || s === "text";
1229
+ return o.length === 0 && !r ? null : {
1230
+ id: He(t.id) ?? `question-${e}`,
1169
1231
  question: n,
1170
- options: s,
1171
- multiple: typeof t.multiple == "boolean" ? t.multiple : o === "multi_choice" || o === "multiple_choice",
1232
+ options: o,
1233
+ multiple: typeof t.multiple == "boolean" ? t.multiple : s === "multi_choice" || s === "multiple_choice",
1172
1234
  required: typeof t.required == "boolean" ? t.required : !1,
1173
1235
  allowCustomAnswer: r
1174
1236
  };
1175
- }, Hs = (t) => {
1176
- const e = Fs(t);
1237
+ }, Zo = (t) => {
1238
+ const e = Xo(t);
1177
1239
  if (!e || !Array.isArray(e.questions)) return null;
1178
- const n = e.questions.map(Ws).filter((s) => s !== null);
1240
+ const n = e.questions.map(Jo).filter((o) => o !== null);
1179
1241
  return n.length === 0 ? null : {
1180
1242
  type: "question-form",
1181
1243
  questions: n
1182
1244
  };
1183
- }, js = (t) => {
1245
+ }, er = (t) => {
1184
1246
  const {
1185
1247
  buildBaseTitle: e,
1186
1248
  buildIndicator: n,
1187
- prependErrorBlock: s
1249
+ prependErrorBlock: o
1188
1250
  } = t;
1189
- return (o) => {
1190
- const r = be(o.state?.output) ?? be(o.state?.metadata), i = Hs(o.state?.input);
1251
+ return (s) => {
1252
+ const r = Me(s.state?.output) ?? Me(s.state?.metadata), i = Zo(s.state?.input);
1191
1253
  if (!r && !i) return null;
1192
- const c = i ? `${i.questions.length} field${i.questions.length === 1 ? "" : "s"}` : void 0, a = r ? [] : [i];
1254
+ const a = i ? `${i.questions.length} field${i.questions.length === 1 ? "" : "s"}` : void 0, c = r ? [] : [i];
1193
1255
  return {
1194
- indicator: n(o),
1195
- title: e(o, c, "Question"),
1196
- blocks: s(o, a),
1256
+ indicator: n(s),
1257
+ title: e(s, a, "Question"),
1258
+ blocks: o(s, c),
1197
1259
  expandable: !1
1198
1260
  };
1199
1261
  };
1200
- }, Ns = (t) => {
1201
- const e = xe(t), n = ve(t), s = y(e?.filePath) ?? y(e?.file_path) ?? y(e?.file) ?? y(n?.filePath) ?? y(n?.file) ?? y(n?.path) ?? void 0, o = ne(t, void 0, "Read file");
1202
- return s && o.push(mn(s)), {
1203
- indicator: te(t),
1204
- title: o,
1205
- blocks: oe(t, [])
1262
+ }, tr = (t) => {
1263
+ const e = Pe(t), n = Ge(t), o = S(e?.filePath) ?? S(e?.file_path) ?? S(e?.file) ?? S(n?.filePath) ?? S(n?.file) ?? S(n?.path) ?? void 0, s = ue(t, void 0, "Read file");
1264
+ return o && s.push(Sn(o)), {
1265
+ indicator: ce(t),
1266
+ title: s,
1267
+ blocks: de(t, [])
1206
1268
  };
1207
- }, Vs = (t) => {
1208
- const e = xe(t), n = ve(t), s = y(e?.command) ?? void 0, o = ne(t, s, "Run command"), r = [], i = lt(t);
1269
+ }, nr = (t) => {
1270
+ const e = Pe(t), n = Ge(t), o = S(e?.command) ?? void 0, s = ue(t, o, "Run command"), r = [], i = ft(t);
1209
1271
  i && r.push({
1210
1272
  type: "code",
1211
1273
  language: "text",
1212
1274
  code: i
1213
1275
  });
1214
- const c = y(n?.stderr);
1215
- return c && c !== i && r.push({
1276
+ const a = S(n?.stderr);
1277
+ return a && a !== i && r.push({
1216
1278
  type: "code",
1217
1279
  language: "text",
1218
- code: c
1280
+ code: a
1219
1281
  }), typeof n?.exitCode == "number" && r.push({
1220
1282
  type: "text",
1221
1283
  text: `Exit code: ${n.exitCode}`
1222
1284
  }), {
1223
- indicator: te(t),
1224
- title: o,
1225
- blocks: oe(t, r)
1285
+ indicator: ce(t),
1286
+ title: s,
1287
+ blocks: de(t, r)
1226
1288
  };
1227
- }, Us = (t) => {
1228
- const e = xe(t), n = lt(t), s = y(e?.pattern) ?? void 0, o = ne(t, s, "Search files"), r = n ? [{
1289
+ }, sr = (t) => {
1290
+ const e = Pe(t), n = ft(t), o = S(e?.pattern) ?? void 0, s = ue(t, o, "Search files"), r = n ? [{
1229
1291
  type: "code",
1230
1292
  language: "text",
1231
1293
  code: n
1232
1294
  }] : [];
1233
1295
  return {
1234
- indicator: te(t),
1235
- title: o,
1236
- blocks: oe(t, r)
1296
+ indicator: ce(t),
1297
+ title: s,
1298
+ blocks: de(t, r)
1237
1299
  };
1238
- }, Gs = (t) => {
1239
- const e = xe(t), n = lt(t), s = y(e?.pattern) ?? void 0, o = ne(t, s, "Find files"), r = [];
1300
+ }, or = (t) => {
1301
+ const e = Pe(t), n = ft(t), o = S(e?.pattern) ?? void 0, s = ue(t, o, "Find files"), r = [];
1240
1302
  if (n) {
1241
- const i = n.split(/\r?\n/).map((c) => c.trim()).filter((c) => c.length > 0);
1303
+ const i = n.split(/\r?\n/).map((a) => a.trim()).filter((a) => a.length > 0);
1242
1304
  i.length > 0 && r.push({
1243
1305
  type: "references",
1244
1306
  references: i
1245
1307
  });
1246
1308
  }
1247
1309
  return {
1248
- indicator: te(t),
1249
- title: o,
1250
- blocks: oe(t, r)
1310
+ indicator: ce(t),
1311
+ title: s,
1312
+ blocks: de(t, r)
1251
1313
  };
1252
- }, Ks = (t) => {
1253
- const e = lt(t), n = e ? $s(e) : null, s = Os(t) ?? n?.skillName, o = ne(t, s, "Load skill"), r = n?.content ?? e, i = r ? [{
1314
+ }, rr = (t) => {
1315
+ const e = ft(t), n = e ? Ho(e) : null, o = Wo(t) ?? n?.skillName, s = ue(t, o, "Load skill"), r = n?.content ?? e, i = r ? [{
1254
1316
  type: "code",
1255
1317
  language: "markdown",
1256
1318
  code: r
1257
1319
  }] : [];
1258
1320
  return {
1259
- indicator: te(t),
1260
- title: o,
1261
- blocks: oe(t, i)
1321
+ indicator: ce(t),
1322
+ title: s,
1323
+ blocks: de(t, i)
1262
1324
  };
1263
- }, At = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, gn = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Xs = (t) => {
1264
- const e = gn(t);
1325
+ }, It = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, wn = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, ir = (t) => {
1326
+ const e = wn(t);
1265
1327
  if (!e) return null;
1266
- const n = At(e.content) ?? At(e.title);
1328
+ const n = It(e.content) ?? It(e.title);
1267
1329
  if (!n) return null;
1268
- const s = At(e.status);
1330
+ const o = It(e.status);
1269
1331
  return {
1270
1332
  label: n,
1271
- checked: s === "completed"
1333
+ checked: o === "completed"
1272
1334
  };
1273
- }, zt = (t) => {
1335
+ }, Vt = (t) => {
1274
1336
  if (!t) return {
1275
1337
  items: [],
1276
1338
  explicit: !1
1277
1339
  };
1278
1340
  const e = (() => {
1279
1341
  if (Array.isArray(t)) return t;
1280
- const n = gn(t);
1342
+ const n = wn(t);
1281
1343
  return !n || !Array.isArray(n.todos) ? null : n.todos;
1282
1344
  })();
1283
1345
  return e ? {
1284
- items: e.map(Xs).filter((n) => n !== null),
1346
+ items: e.map(ir).filter((n) => n !== null),
1285
1347
  explicit: !0
1286
1348
  } : {
1287
1349
  items: [],
1288
1350
  explicit: !1
1289
1351
  };
1290
- }, Ys = (t) => {
1352
+ }, lr = (t) => {
1291
1353
  const {
1292
1354
  buildBaseTitle: e,
1293
1355
  buildIndicator: n,
1294
- prependErrorBlock: s
1356
+ prependErrorBlock: o
1295
1357
  } = t;
1296
- return (o) => {
1297
- const r = zt(o.state?.input), i = zt(o.state?.output), c = i.explicit ? i : r;
1298
- if (!c.explicit) return null;
1299
- const a = c.items, u = `${a.length} item${a.length === 1 ? "" : "s"}`, d = e(o, u, "Update todos");
1300
- if (a.length === 0)
1358
+ return (s) => {
1359
+ const r = Vt(s.state?.input), i = Vt(s.state?.output), a = i.explicit ? i : r;
1360
+ if (!a.explicit) return null;
1361
+ const c = a.items, u = `${c.length} item${c.length === 1 ? "" : "s"}`, d = e(s, u, "Update todos");
1362
+ if (c.length === 0)
1301
1363
  return {
1302
- indicator: n(o),
1364
+ indicator: n(s),
1303
1365
  title: d,
1304
- blocks: s(o, [{
1366
+ blocks: o(s, [{
1305
1367
  type: "comment",
1306
1368
  text: "No todos"
1307
1369
  }])
1308
1370
  };
1309
- const f = [{
1371
+ const p = [{
1310
1372
  type: "todo-list",
1311
- items: a
1373
+ items: c
1312
1374
  }];
1313
1375
  return {
1314
- indicator: n(o),
1376
+ indicator: n(s),
1315
1377
  title: d,
1316
- blocks: s(o, f)
1378
+ blocks: o(s, p)
1317
1379
  };
1318
1380
  };
1319
- }, Js = js({
1320
- buildBaseTitle: ne,
1321
- buildIndicator: te,
1322
- prependErrorBlock: oe
1323
- }), Wt = Ys({
1324
- buildBaseTitle: ne,
1325
- buildIndicator: te,
1326
- prependErrorBlock: oe
1327
- }), Ht = () => ({
1328
- apply_patch: Ls,
1329
- bash: Vs,
1330
- edit: vs,
1331
- glob: Gs,
1332
- grep: Us,
1333
- question: Js,
1334
- read: Ns,
1335
- skill: Ks,
1336
- todo_write: Wt,
1337
- todowrite: Wt
1338
- }), jt = {
1381
+ }, ar = er({
1382
+ buildBaseTitle: ue,
1383
+ buildIndicator: ce,
1384
+ prependErrorBlock: de
1385
+ }), jt = lr({
1386
+ buildBaseTitle: ue,
1387
+ buildIndicator: ce,
1388
+ prependErrorBlock: de
1389
+ }), Ut = () => ({
1390
+ apply_patch: jo,
1391
+ bash: nr,
1392
+ edit: Ko,
1393
+ glob: or,
1394
+ grep: sr,
1395
+ question: ar,
1396
+ read: tr,
1397
+ skill: rr,
1398
+ todo_write: jt,
1399
+ todowrite: jt
1400
+ }), Kt = {
1339
1401
  pending: "queued",
1340
1402
  error: "failed",
1341
1403
  "output-error": "failed",
1342
1404
  "input-streaming": "running",
1343
1405
  "input-available": "queued"
1344
- }, Zs = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), er = (t) => {
1345
- const e = rt(t ?? "tool").replace(/_/g, " ");
1346
- return Zs(e);
1347
- }, bn = (t) => t === "error" || t === "output-error", tr = (t) => bn(t.state?.status) ? {
1406
+ }, cr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), ur = (t) => {
1407
+ const e = ut(t ?? "tool").replace(/_/g, " ");
1408
+ return cr(e);
1409
+ }, kn = (t) => t === "error" || t === "output-error", dr = (t) => kn(t.state?.status) ? {
1348
1410
  type: "icon",
1349
1411
  icon: "danger"
1350
1412
  } : {
1351
1413
  type: "icon",
1352
- icon: ln(t.tool ?? "tool")
1353
- }, nr = (t) => !t || typeof t != "string" ? null : jt[t] ? jt[t] : t.includes("stream") ? "running" : null, Nt = (t) => {
1414
+ icon: pn(t.tool ?? "tool")
1415
+ }, fr = (t) => !t || typeof t != "string" ? null : Kt[t] ? Kt[t] : t.includes("stream") ? "running" : null, Gt = (t) => {
1354
1416
  if (typeof t == "string") return t;
1355
1417
  if (t == null) return null;
1356
1418
  try {
@@ -1358,360 +1420,360 @@ const Ss = {
1358
1420
  } catch {
1359
1421
  return null;
1360
1422
  }
1361
- }, or = (t) => {
1423
+ }, pr = (t) => {
1362
1424
  const e = [];
1363
- bn(t.state?.status) && t.state?.errorText && e.push({
1425
+ kn(t.state?.status) && t.state?.errorText && e.push({
1364
1426
  type: "comment",
1365
1427
  text: t.state.errorText
1366
1428
  });
1367
- const n = Nt(t.state?.input);
1429
+ const n = Gt(t.state?.input);
1368
1430
  n && e.push({
1369
1431
  type: "code",
1370
1432
  language: "json",
1371
1433
  code: n
1372
1434
  });
1373
- const s = Nt(t.state?.output);
1374
- return s && e.push({
1435
+ const o = Gt(t.state?.output);
1436
+ return o && e.push({
1375
1437
  type: "code",
1376
1438
  language: "json",
1377
- code: s
1439
+ code: o
1378
1440
  }), e;
1379
- }, sr = (t) => {
1441
+ }, mr = (t) => {
1380
1442
  const e = [{
1381
1443
  kind: "text",
1382
- text: er(t.tool),
1444
+ text: ur(t.tool),
1383
1445
  bold: !0
1384
- }], n = nr(t.state?.status);
1446
+ }], n = fr(t.state?.status);
1385
1447
  return n && e.push({
1386
1448
  kind: "text",
1387
1449
  text: n,
1388
1450
  muted: !0
1389
1451
  }), {
1390
- indicator: tr(t),
1452
+ indicator: dr(t),
1391
1453
  title: e,
1392
- blocks: or(t)
1454
+ blocks: pr(t)
1393
1455
  };
1394
- }, rr = (t) => t ? {
1395
- ...Ht(),
1456
+ }, hr = (t) => t ? {
1457
+ ...Ut(),
1396
1458
  ...t
1397
- } : Ht(), ir = (t, e) => {
1459
+ } : Ut(), gr = (t, e) => {
1398
1460
  const n = t.tool ?? "tool";
1399
- for (const s of os(n)) {
1400
- const o = e[s];
1401
- if (o) return o;
1461
+ for (const o of po(n)) {
1462
+ const s = e[o];
1463
+ if (s) return s;
1402
1464
  }
1403
- }, lr = (t, e, n) => {
1404
- const s = ir(t, e);
1405
- if (s) {
1406
- const o = s(t, n);
1407
- if (o) return o;
1465
+ }, br = (t, e, n) => {
1466
+ const o = gr(t, e);
1467
+ if (o) {
1468
+ const s = o(t, n);
1469
+ if (s) return s;
1408
1470
  }
1409
- return sr(t);
1410
- }, cr = (t, e) => {
1411
- const n = rr(e?.toolRenderers);
1471
+ return mr(t);
1472
+ }, yr = (t, e) => {
1473
+ const n = hr(e?.toolRenderers);
1412
1474
  return {
1413
- items: t.map((o) => lr(o, n, e))
1475
+ items: t.map((s) => br(s, n, e))
1414
1476
  };
1415
- }, ue = On, xn = (t, e, n, s = !1) => {
1416
- s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1477
+ }, Te = qn, Cn = (t, e, n, o = !1) => {
1478
+ o && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1417
1479
  };
1418
- function ar(t) {
1419
- const e = S(6), {
1480
+ function xr(t) {
1481
+ const e = T(6), {
1420
1482
  seg: n
1421
1483
  } = t;
1422
- let s;
1423
- e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ l(Ie.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
1424
1484
  let o;
1425
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ l(Ie.Fallback, {}), e[3] = o) : o = e[3];
1485
+ e[0] !== n.alt || e[1] !== n.src ? (o = /* @__PURE__ */ l(qe.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = o) : o = e[2];
1486
+ let s;
1487
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ l(qe.Fallback, {}), e[3] = s) : s = e[3];
1426
1488
  let r;
1427
- return e[4] !== s ? (r = /* @__PURE__ */ w(Ie.Root, { width: "1.5rem", height: "1.5rem", children: [
1428
- s,
1429
- o
1430
- ] }), e[4] = s, e[5] = r) : r = e[5], r;
1489
+ return e[4] !== o ? (r = /* @__PURE__ */ w(qe.Root, { width: "1.5rem", height: "1.5rem", children: [
1490
+ o,
1491
+ s
1492
+ ] }), e[4] = o, e[5] = r) : r = e[5], r;
1431
1493
  }
1432
- function ur(t) {
1433
- const e = S(9), {
1494
+ function Sr(t) {
1495
+ const e = T(9), {
1434
1496
  seg: n,
1435
- onOpenFile: s
1436
- } = t, o = n.additions ?? 0, r = n.deletions ?? 0;
1497
+ onOpenFile: o
1498
+ } = t, s = n.additions ?? 0, r = n.deletions ?? 0;
1437
1499
  let i;
1438
- e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1439
- const a = n.filePath ?? n.fileName;
1440
- s?.(a);
1441
- }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1442
- let c;
1443
- return e[4] !== n.fileName || e[5] !== o || e[6] !== r || e[7] !== i ? (c = /* @__PURE__ */ l(en, { fileName: n.fileName, additions: o, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = o, e[6] = r, e[7] = i, e[8] = c) : c = e[8], c;
1500
+ e[0] !== o || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1501
+ const c = n.filePath ?? n.fileName;
1502
+ o?.(c);
1503
+ }, e[0] = o, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1504
+ let a;
1505
+ return e[4] !== n.fileName || e[5] !== s || e[6] !== r || e[7] !== i ? (a = /* @__PURE__ */ l(ln, { fileName: n.fileName, additions: s, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = s, e[6] = r, e[7] = i, e[8] = a) : a = e[8], a;
1444
1506
  }
1445
- function dr(t) {
1446
- const e = S(13), {
1507
+ function Tr(t) {
1508
+ const e = T(13), {
1447
1509
  seg: n,
1448
- onOpenFile: s
1449
- } = t, o = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", c = (n.muted, "fg.muted"), a = r ? "pointer" : "default";
1510
+ onOpenFile: o
1511
+ } = t, s = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", a = (n.muted, "fg.muted"), c = r ? "pointer" : "default";
1450
1512
  let u;
1451
- e[0] !== s || e[1] !== n ? (u = (p) => xn(p, n, s, !0), e[0] = s, e[1] = n, e[2] = u) : u = e[2];
1513
+ e[0] !== o || e[1] !== n ? (u = (f) => Cn(f, n, o, !0), e[0] = o, e[1] = n, e[2] = u) : u = e[2];
1452
1514
  const d = n.muted ? "fg.muted" : "fg.blue-dark";
1453
- let f;
1454
- e[3] !== d ? (f = {
1515
+ let p;
1516
+ e[3] !== d ? (p = {
1455
1517
  textDecoration: "underline",
1456
1518
  color: d
1457
- }, e[3] = d, e[4] = f) : f = e[4];
1519
+ }, e[3] = d, e[4] = p) : p = e[4];
1458
1520
  let m;
1459
- return e[5] !== o || e[6] !== n.text || e[7] !== i || e[8] !== c || e[9] !== a || e[10] !== u || e[11] !== f ? (m = /* @__PURE__ */ l(Gt, { href: i, fontWeight: o, color: c, textDecoration: "none", cursor: a, onClick: u, _hover: f, children: n.text }), e[5] = o, e[6] = n.text, e[7] = i, e[8] = c, e[9] = a, e[10] = u, e[11] = f, e[12] = m) : m = e[12], m;
1521
+ return e[5] !== s || e[6] !== n.text || e[7] !== i || e[8] !== a || e[9] !== c || e[10] !== u || e[11] !== p ? (m = /* @__PURE__ */ l(Jt, { href: i, fontWeight: s, color: a, textDecoration: "none", cursor: c, onClick: u, _hover: p, children: n.text }), e[5] = s, e[6] = n.text, e[7] = i, e[8] = a, e[9] = c, e[10] = u, e[11] = p, e[12] = m) : m = e[12], m;
1460
1522
  }
1461
- function fr(t) {
1462
- const e = S(12), {
1523
+ function wr(t) {
1524
+ const e = T(12), {
1463
1525
  seg: n,
1464
- onOpenFile: s
1465
- } = t, o = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1466
- let c;
1467
- e[0] !== s || e[1] !== n ? (c = (f) => xn(f, n, s), e[0] = s, e[1] = n, e[2] = c) : c = e[2];
1468
- const a = n.muted ? "fg.muted" : "accent.primary";
1526
+ onOpenFile: o
1527
+ } = t, s = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1528
+ let a;
1529
+ e[0] !== o || e[1] !== n ? (a = (p) => Cn(p, n, o), e[0] = o, e[1] = n, e[2] = a) : a = e[2];
1530
+ const c = n.muted ? "fg.muted" : "accent.primary";
1469
1531
  let u;
1470
- e[3] !== a ? (u = {
1471
- color: a,
1532
+ e[3] !== c ? (u = {
1533
+ color: c,
1472
1534
  textDecoration: "underline"
1473
- }, e[3] = a, e[4] = u) : u = e[4];
1535
+ }, e[3] = c, e[4] = u) : u = e[4];
1474
1536
  let d;
1475
- return e[5] !== o || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== c || e[10] !== u ? (d = /* @__PURE__ */ l(Gt, { href: r, fontWeight: o, color: i, textDecoration: "underline", onClick: c, _hover: u, children: n.text }), e[5] = o, e[6] = n.text, e[7] = r, e[8] = i, e[9] = c, e[10] = u, e[11] = d) : d = e[11], d;
1537
+ return e[5] !== s || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== a || e[10] !== u ? (d = /* @__PURE__ */ l(Jt, { href: r, fontWeight: s, color: i, textDecoration: "underline", onClick: a, _hover: u, children: n.text }), e[5] = s, e[6] = n.text, e[7] = r, e[8] = i, e[9] = a, e[10] = u, e[11] = d) : d = e[11], d;
1476
1538
  }
1477
- function pr(t) {
1478
- const e = S(6), {
1539
+ function kr(t) {
1540
+ const e = T(6), {
1479
1541
  seg: n,
1480
- isClickable: s
1481
- } = t, o = n.bold ? "medium" : void 0, r = s && !n.muted ? "fg" : "fg.muted";
1542
+ isClickable: o
1543
+ } = t, s = n.bold ? "medium" : void 0, r = o && !n.muted ? "fg" : "fg.muted";
1482
1544
  let i;
1483
1545
  e[0] !== r ? (i = {
1484
1546
  color: r
1485
1547
  }, e[0] = r, e[1] = i) : i = e[1];
1486
- let c;
1487
- return e[2] !== n.text || e[3] !== o || e[4] !== i ? (c = /* @__PURE__ */ l(Le, { fontWeight: o, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = o, e[4] = i, e[5] = c) : c = e[5], c;
1548
+ let a;
1549
+ return e[2] !== n.text || e[3] !== s || e[4] !== i ? (a = /* @__PURE__ */ l(Ue, { fontWeight: s, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = s, e[4] = i, e[5] = a) : a = e[5], a;
1488
1550
  }
1489
- function mr(t) {
1490
- const e = S(11), {
1551
+ function Cr(t) {
1552
+ const e = T(11), {
1491
1553
  seg: n,
1492
- isClickable: s,
1493
- onOpenFile: o
1554
+ isClickable: o,
1555
+ onOpenFile: s
1494
1556
  } = t;
1495
1557
  switch (n.kind) {
1496
1558
  case "avatar": {
1497
1559
  let r;
1498
- return e[0] !== n ? (r = /* @__PURE__ */ l(ar, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1560
+ return e[0] !== n ? (r = /* @__PURE__ */ l(xr, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1499
1561
  }
1500
1562
  case "diff": {
1501
1563
  let r;
1502
- return e[2] !== o || e[3] !== n ? (r = /* @__PURE__ */ l(ur, { seg: n, onOpenFile: o }), e[2] = o, e[3] = n, e[4] = r) : r = e[4], r;
1564
+ return e[2] !== s || e[3] !== n ? (r = /* @__PURE__ */ l(Sr, { seg: n, onOpenFile: s }), e[2] = s, e[3] = n, e[4] = r) : r = e[4], r;
1503
1565
  }
1504
1566
  case "link": {
1505
1567
  let r;
1506
- return e[5] !== o || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ l(dr, { seg: n, onOpenFile: o }) : /* @__PURE__ */ l(fr, { seg: n, onOpenFile: o }), e[5] = o, e[6] = n, e[7] = r) : r = e[7], r;
1568
+ return e[5] !== s || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ l(Tr, { seg: n, onOpenFile: s }) : /* @__PURE__ */ l(wr, { seg: n, onOpenFile: s }), e[5] = s, e[6] = n, e[7] = r) : r = e[7], r;
1507
1569
  }
1508
1570
  case "text": {
1509
1571
  let r;
1510
- return e[8] !== s || e[9] !== n ? (r = /* @__PURE__ */ l(pr, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = r) : r = e[10], r;
1572
+ return e[8] !== o || e[9] !== n ? (r = /* @__PURE__ */ l(kr, { seg: n, isClickable: o }), e[8] = o, e[9] = n, e[10] = r) : r = e[10], r;
1511
1573
  }
1512
1574
  default:
1513
1575
  return null;
1514
1576
  }
1515
1577
  }
1516
- function hr(t) {
1517
- const e = S(10), {
1578
+ function _r(t) {
1579
+ const e = T(10), {
1518
1580
  ind: n
1519
1581
  } = t;
1520
1582
  if (!n || n.type === "none")
1521
1583
  return null;
1522
1584
  if (n.type === "icon") {
1523
1585
  let i;
1524
- e[0] !== n.icon ? (i = is(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1525
- const c = i;
1526
- let a;
1527
- return e[2] !== c ? (a = /* @__PURE__ */ l(ue.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(Le, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(c, { size: 14, strokeWidth: 1 }) }) }), e[2] = c, e[3] = a) : a = e[3], a;
1586
+ e[0] !== n.icon ? (i = go(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1587
+ const a = i;
1588
+ let c;
1589
+ return e[2] !== a ? (c = /* @__PURE__ */ l(Te.Indicator, { outline: "none", shadow: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ l(Ue, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ l(a, { size: 14, strokeWidth: 1 }) }) }), e[2] = a, e[3] = c) : c = e[3], c;
1528
1590
  }
1529
- let s;
1530
- e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ l(Ie.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
1531
1591
  let o;
1532
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ l(Ie.Fallback, {}), e[7] = o) : o = e[7];
1592
+ e[4] !== n.alt || e[5] !== n.src ? (o = /* @__PURE__ */ l(qe.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = o) : o = e[6];
1593
+ let s;
1594
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ l(qe.Fallback, {}), e[7] = s) : s = e[7];
1533
1595
  let r;
1534
- return e[8] !== s ? (r = /* @__PURE__ */ l(ue.Indicator, { children: /* @__PURE__ */ w(Ie.Root, { boxSize: "full", children: [
1535
- s,
1536
- o
1537
- ] }) }), e[8] = s, e[9] = r) : r = e[9], r;
1596
+ return e[8] !== o ? (r = /* @__PURE__ */ l(Te.Indicator, { children: /* @__PURE__ */ w(qe.Root, { boxSize: "full", children: [
1597
+ o,
1598
+ s
1599
+ ] }) }), e[8] = o, e[9] = r) : r = e[9], r;
1538
1600
  }
1539
- function gr(t) {
1540
- const e = S(5), {
1601
+ function Ar(t) {
1602
+ const e = T(5), {
1541
1603
  code: n,
1542
- language: s
1543
- } = t, o = s ? `${s} code block` : "code block";
1604
+ language: o
1605
+ } = t, s = o ? `${o} code block` : "code block";
1544
1606
  let r;
1545
- e[0] !== n ? (r = /* @__PURE__ */ l(M, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1607
+ e[0] !== n ? (r = /* @__PURE__ */ l(I, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1546
1608
  let i;
1547
- return e[2] !== o || e[3] !== r ? (i = /* @__PURE__ */ l(M, { as: "pre", background: "bg.code", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": o, children: r }), e[2] = o, e[3] = r, e[4] = i) : i = e[4], i;
1609
+ return e[2] !== s || e[3] !== r ? (i = /* @__PURE__ */ l(I, { as: "pre", background: "bg.code", color: "fg", borderRadius: "md", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", overflowX: "auto", whiteSpace: "pre", "aria-label": s, children: r }), e[2] = s, e[3] = r, e[4] = i) : i = e[4], i;
1548
1610
  }
1549
- function br(t) {
1550
- const e = S(30), {
1611
+ function Rr(t) {
1612
+ const e = T(30), {
1551
1613
  b: n,
1552
- onOpenFile: s
1614
+ onOpenFile: o
1553
1615
  } = t;
1554
1616
  switch (n.type) {
1555
1617
  case "comment": {
1556
- let o;
1557
- e[0] !== n.text ? (o = /* @__PURE__ */ l(J.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1618
+ let s;
1619
+ e[0] !== n.text ? (s = /* @__PURE__ */ l(le.Body, { children: n.text }), e[0] = n.text, e[1] = s) : s = e[1];
1558
1620
  let r;
1559
- e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ l(J.Footer, { children: /* @__PURE__ */ w(qe, { children: [
1621
+ e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ l(le.Footer, { children: /* @__PURE__ */ w(Ke, { children: [
1560
1622
  "👏 ",
1561
1623
  n.reactions.clap
1562
1624
  ] }) }) : null, e[2] = n.reactions, e[3] = r) : r = e[3];
1563
1625
  let i;
1564
- return e[4] !== o || e[5] !== r ? (i = /* @__PURE__ */ w(J.Root, { children: [
1565
- o,
1626
+ return e[4] !== s || e[5] !== r ? (i = /* @__PURE__ */ w(le.Root, { children: [
1627
+ s,
1566
1628
  r
1567
- ] }), e[4] = o, e[5] = r, e[6] = i) : i = e[6], i;
1629
+ ] }), e[4] = s, e[5] = r, e[6] = i) : i = e[6], i;
1568
1630
  }
1569
1631
  case "code": {
1570
- let o;
1571
- return e[7] !== n.code || e[8] !== n.language ? (o = /* @__PURE__ */ l(J.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(J.Body, { padding: "0", children: /* @__PURE__ */ l(gr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = o) : o = e[9], o;
1632
+ let s;
1633
+ return e[7] !== n.code || e[8] !== n.language ? (s = /* @__PURE__ */ l(le.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(le.Body, { padding: "0", children: /* @__PURE__ */ l(Ar, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = s) : s = e[9], s;
1572
1634
  }
1573
1635
  case "diff": {
1574
- const o = n.sideBySide ?? !1;
1636
+ const s = n.sideBySide ?? !1;
1575
1637
  let r;
1576
- return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== o ? (r = /* @__PURE__ */ l(J.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(J.Body, { padding: "0", children: /* @__PURE__ */ l(M, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(uo, { original: n.original, modified: n.modified, language: n.language, sideBySide: o, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = o, e[14] = r) : r = e[14], r;
1638
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== s ? (r = /* @__PURE__ */ l(le.Root, { border: "0", padding: "0", children: /* @__PURE__ */ l(le.Body, { padding: "0", children: /* @__PURE__ */ l(I, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ l(gs, { original: n.original, modified: n.modified, language: n.language, sideBySide: s, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = s, e[14] = r) : r = e[14], r;
1577
1639
  }
1578
1640
  case "text": {
1579
- let o;
1580
- return e[15] !== n.text ? (o = /* @__PURE__ */ l(J.Root, { background: "transparent", children: /* @__PURE__ */ l(J.Body, { padding: "sm", children: /* @__PURE__ */ l(F, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = o) : o = e[16], o;
1641
+ let s;
1642
+ return e[15] !== n.text ? (s = /* @__PURE__ */ l(le.Root, { background: "transparent", children: /* @__PURE__ */ l(le.Body, { padding: "sm", children: /* @__PURE__ */ l(q, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = s) : s = e[16], s;
1581
1643
  }
1582
1644
  case "todo-list": {
1583
- let o;
1584
- return e[17] !== n.items ? (o = /* @__PURE__ */ l(Mo, { items: n.items }), e[17] = n.items, e[18] = o) : o = e[18], o;
1645
+ let s;
1646
+ return e[17] !== n.items ? (s = /* @__PURE__ */ l(Ds, { items: n.items }), e[17] = n.items, e[18] = s) : s = e[18], s;
1585
1647
  }
1586
1648
  case "question-form": {
1587
- let o;
1588
- return e[19] !== n.questions ? (o = /* @__PURE__ */ l(on, { questions: n.questions }), e[19] = n.questions, e[20] = o) : o = e[20], o;
1649
+ let s;
1650
+ return e[19] !== n.questions ? (s = /* @__PURE__ */ l(un, { questions: n.questions }), e[19] = n.questions, e[20] = s) : s = e[20], s;
1589
1651
  }
1590
1652
  case "references": {
1591
- let o;
1592
- e[21] !== n.references ? (o = n.references.map(xr), e[21] = n.references, e[22] = o) : o = e[22];
1653
+ let s;
1654
+ e[21] !== n.references ? (s = n.references.map(Ir), e[21] = n.references, e[22] = s) : s = e[22];
1593
1655
  let r;
1594
- return e[23] !== o ? (r = /* @__PURE__ */ l(z, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: o }), e[23] = o, e[24] = r) : r = e[24], r;
1656
+ return e[23] !== s ? (r = /* @__PURE__ */ l(Z, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: s }), e[23] = s, e[24] = r) : r = e[24], r;
1595
1657
  }
1596
1658
  case "component": {
1597
- let o;
1598
- e[25] !== n || e[26] !== s ? (o = n.render({
1599
- onOpenFile: s
1600
- }), e[25] = n, e[26] = s, e[27] = o) : o = e[27];
1659
+ let s;
1660
+ e[25] !== n || e[26] !== o ? (s = n.render({
1661
+ onOpenFile: o
1662
+ }), e[25] = n, e[26] = o, e[27] = s) : s = e[27];
1601
1663
  let r;
1602
- return e[28] !== o ? (r = /* @__PURE__ */ l(It, { children: o }), e[28] = o, e[29] = r) : r = e[29], r;
1664
+ return e[28] !== s ? (r = /* @__PURE__ */ l(Bt, { children: s }), e[28] = s, e[29] = r) : r = e[29], r;
1603
1665
  }
1604
1666
  }
1605
1667
  }
1606
- function xr(t) {
1607
- return /* @__PURE__ */ l(lo, { fileName: t }, t);
1668
+ function Ir(t) {
1669
+ return /* @__PURE__ */ l(ps, { fileName: t }, t);
1608
1670
  }
1609
- function yr(t) {
1610
- const e = S(23), {
1671
+ function Mr(t) {
1672
+ const e = T(23), {
1611
1673
  item: n,
1612
- itemKey: s,
1613
- isOpen: o,
1674
+ itemKey: o,
1675
+ isOpen: s,
1614
1676
  canExpand: r,
1615
1677
  hasBlocks: i,
1616
- onToggle: c,
1617
- onOpenFile: a
1678
+ onToggle: a,
1679
+ onOpenFile: c
1618
1680
  } = t;
1619
1681
  let u;
1620
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(ue.Separator, {}), e[0] = u) : u = e[0];
1682
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ l(Te.Separator, {}), e[0] = u) : u = e[0];
1621
1683
  let d;
1622
- e[1] !== n.indicator ? (d = /* @__PURE__ */ w(ue.Connector, { children: [
1684
+ e[1] !== n.indicator ? (d = /* @__PURE__ */ w(Te.Connector, { children: [
1623
1685
  u,
1624
- /* @__PURE__ */ l(hr, { ind: n.indicator })
1686
+ /* @__PURE__ */ l(_r, { ind: n.indicator })
1625
1687
  ] }), e[1] = n.indicator, e[2] = d) : d = e[2];
1626
- const f = o ? "auto" : "20px";
1688
+ const p = s ? "auto" : "20px";
1627
1689
  let m;
1628
- e[3] !== r || e[4] !== o || e[5] !== n.title || e[6] !== s || e[7] !== a || e[8] !== c ? (m = n.title.length > 0 && /* @__PURE__ */ l(ue.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: r ? "pointer" : "default", onClick: r ? () => c(s) : void 0, children: /* @__PURE__ */ w(Le, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1629
- /* @__PURE__ */ l(Le, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((b, x) => /* @__PURE__ */ l(mr, { seg: b, isClickable: r, onOpenFile: a }, x)) }),
1630
- r ? /* @__PURE__ */ l(Le, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: o ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1690
+ e[3] !== r || e[4] !== s || e[5] !== n.title || e[6] !== o || e[7] !== c || e[8] !== a ? (m = n.title.length > 0 && /* @__PURE__ */ l(Te.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: r ? "pointer" : "default", onClick: r ? () => a(o) : void 0, children: /* @__PURE__ */ w(Ue, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1691
+ /* @__PURE__ */ l(Ue, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((b, y) => /* @__PURE__ */ l(Cr, { seg: b, isClickable: r, onOpenFile: c }, y)) }),
1692
+ r ? /* @__PURE__ */ l(Ue, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: s ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1631
1693
  color: "fg"
1632
- }, children: /* @__PURE__ */ l(to, { size: 12 }) }) : null
1633
- ] }) }), e[3] = r, e[4] = o, e[5] = n.title, e[6] = s, e[7] = a, e[8] = c, e[9] = m) : m = e[9];
1634
- let p;
1635
- e[10] !== i || e[11] !== o || e[12] !== n.blocks || e[13] !== a ? (p = i ? /* @__PURE__ */ l(M, { display: "grid", gridTemplateRows: o ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: o ? /* @__PURE__ */ l(M, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((b, x) => /* @__PURE__ */ l(M, { children: /* @__PURE__ */ l(br, { b, onOpenFile: a }) }, x)) }) : null }) : null, e[10] = i, e[11] = o, e[12] = n.blocks, e[13] = a, e[14] = p) : p = e[14];
1694
+ }, children: /* @__PURE__ */ l(as, { size: 12 }) }) : null
1695
+ ] }) }), e[3] = r, e[4] = s, e[5] = n.title, e[6] = o, e[7] = c, e[8] = a, e[9] = m) : m = e[9];
1696
+ let f;
1697
+ e[10] !== i || e[11] !== s || e[12] !== n.blocks || e[13] !== c ? (f = i ? /* @__PURE__ */ l(I, { display: "grid", gridTemplateRows: s ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: s ? /* @__PURE__ */ l(I, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((b, y) => /* @__PURE__ */ l(I, { children: /* @__PURE__ */ l(Rr, { b, onOpenFile: c }) }, y)) }) : null }) : null, e[10] = i, e[11] = s, e[12] = n.blocks, e[13] = c, e[14] = f) : f = e[14];
1636
1698
  let h;
1637
- e[15] !== f || e[16] !== m || e[17] !== p ? (h = /* @__PURE__ */ w(ue.Content, { pb: "xs", h: f, overflow: "hidden", children: [
1699
+ e[15] !== p || e[16] !== m || e[17] !== f ? (h = /* @__PURE__ */ w(Te.Content, { pb: "xs", h: p, overflow: "hidden", children: [
1638
1700
  m,
1639
- p
1640
- ] }), e[15] = f, e[16] = m, e[17] = p, e[18] = h) : h = e[18];
1701
+ f
1702
+ ] }), e[15] = p, e[16] = m, e[17] = f, e[18] = h) : h = e[18];
1641
1703
  let g;
1642
- return e[19] !== s || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ w(ue.Item, { gap: "xs", children: [
1704
+ return e[19] !== o || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ w(Te.Item, { gap: "xs", children: [
1643
1705
  d,
1644
1706
  h
1645
- ] }, s), e[19] = s, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1707
+ ] }, o), e[19] = o, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1646
1708
  }
1647
- function Sr(t) {
1648
- const e = S(11), {
1709
+ function Er(t) {
1710
+ const e = T(11), {
1649
1711
  data: n,
1650
- onOpenFile: s
1712
+ onOpenFile: o
1651
1713
  } = t;
1652
- let o;
1653
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
1654
- const [r, i] = Z(o), c = kr;
1655
- let a;
1656
- e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = (m) => {
1657
- i((p) => ({
1658
- ...p,
1659
- [m]: !p[m]
1714
+ let s;
1715
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {}, e[0] = s) : s = e[0];
1716
+ const [r, i] = G(s), a = Pr;
1717
+ let c;
1718
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = (m) => {
1719
+ i((f) => ({
1720
+ ...f,
1721
+ [m]: !f[m]
1660
1722
  }));
1661
- }, e[1] = a) : a = e[1];
1662
- const u = a;
1723
+ }, e[1] = c) : c = e[1];
1724
+ const u = c;
1663
1725
  let d;
1664
- if (e[2] !== n.items || e[3] !== r || e[4] !== s) {
1726
+ if (e[2] !== n.items || e[3] !== r || e[4] !== o) {
1665
1727
  let m;
1666
- e[6] !== r || e[7] !== s ? (m = (p, h) => {
1667
- const g = c(p, h), b = (p.blocks?.length ?? 0) > 0, x = (p.expandable ?? !0) && b, k = x ? r[g] ?? !1 : b;
1668
- return /* @__PURE__ */ l(yr, { item: p, itemKey: g, isOpen: k, canExpand: x, hasBlocks: b, onToggle: u, onOpenFile: s }, g);
1669
- }, e[6] = r, e[7] = s, e[8] = m) : m = e[8], d = n.items.map(m), e[2] = n.items, e[3] = r, e[4] = s, e[5] = d;
1728
+ e[6] !== r || e[7] !== o ? (m = (f, h) => {
1729
+ const g = a(f, h), b = (f.blocks?.length ?? 0) > 0, y = (f.expandable ?? !0) && b, x = y ? r[g] ?? !1 : b;
1730
+ return /* @__PURE__ */ l(Mr, { item: f, itemKey: g, isOpen: x, canExpand: y, hasBlocks: b, onToggle: u, onOpenFile: o }, g);
1731
+ }, e[6] = r, e[7] = o, e[8] = m) : m = e[8], d = n.items.map(m), e[2] = n.items, e[3] = r, e[4] = o, e[5] = d;
1670
1732
  } else
1671
1733
  d = e[5];
1672
- let f;
1673
- return e[9] !== d ? (f = /* @__PURE__ */ l(ue.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1734
+ let p;
1735
+ return e[9] !== d ? (p = /* @__PURE__ */ l(Te.Root, { children: d }), e[9] = d, e[10] = p) : p = e[10], p;
1674
1736
  }
1675
- function kr(t, e) {
1737
+ function Pr(t, e) {
1676
1738
  return t.id ? `id:${t.id}` : `idx:${e}`;
1677
1739
  }
1678
- const wr = (t) => rt(t.tool ?? "").replace(/_/g, "") === "question", Tr = (t) => {
1740
+ const Br = (t) => ut(t.tool ?? "").replace(/_/g, "") === "question", Lr = (t) => {
1679
1741
  const e = t.state?.output;
1680
1742
  return typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : e && typeof e == "object" ? Object.keys(e).length > 0 : e != null;
1681
1743
  };
1682
- function Cr(t) {
1683
- const e = S(8), {
1744
+ function vr(t) {
1745
+ const e = T(8), {
1684
1746
  invocations: n,
1685
- labeledBlocks: s,
1686
- hideQuestionForms: o,
1747
+ labeledBlocks: o,
1748
+ hideQuestionForms: s,
1687
1749
  onOpenFile: r
1688
- } = t, i = o === void 0 ? !1 : o;
1689
- let c, a;
1690
- if (e[0] !== i || e[1] !== n || e[2] !== s) {
1691
- a = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1750
+ } = t, i = s === void 0 ? !1 : s;
1751
+ let a, c;
1752
+ if (e[0] !== i || e[1] !== n || e[2] !== o) {
1753
+ c = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1692
1754
  e: {
1693
- const f = i ? n.filter(_r) : n;
1694
- if (f.length === 0) {
1695
- a = null;
1755
+ const p = i ? n.filter($r) : n;
1756
+ if (p.length === 0) {
1757
+ c = null;
1696
1758
  break e;
1697
1759
  }
1698
- c = cr(f, {
1699
- labeledBlocks: s
1760
+ a = yr(p, {
1761
+ labeledBlocks: o
1700
1762
  });
1701
1763
  }
1702
- e[0] = i, e[1] = n, e[2] = s, e[3] = c, e[4] = a;
1764
+ e[0] = i, e[1] = n, e[2] = o, e[3] = a, e[4] = c;
1703
1765
  } else
1704
- c = e[3], a = e[4];
1705
- if (a !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
1706
- return a;
1707
- const u = c;
1766
+ a = e[3], c = e[4];
1767
+ if (c !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
1768
+ return c;
1769
+ const u = a;
1708
1770
  let d;
1709
- return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ l(Sr, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
1771
+ return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ l(Er, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
1710
1772
  }
1711
- function _r(t) {
1712
- return !wr(t) || Tr(t);
1773
+ function $r(t) {
1774
+ return !Br(t) || Lr(t);
1713
1775
  }
1714
- const Ar = (t) => t.type === "tool", Rt = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Rr = (t) => {
1776
+ const Or = (t) => t.type === "tool", Mt = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : String(t), Dr = (t) => {
1715
1777
  if (t.message && t.message.trim().length > 0)
1716
1778
  return t.message;
1717
1779
  const {
@@ -1727,100 +1789,100 @@ const Ar = (t) => t.type === "tool", Rt = (t) => t >= 1e3 ? `${(t / 1e3).toFixed
1727
1789
  default:
1728
1790
  return "An error occurred.";
1729
1791
  }
1730
- }, Br = {
1792
+ }, Fr = {
1731
1793
  info: "blue",
1732
1794
  warning: "orange",
1733
1795
  error: "red",
1734
1796
  success: "green",
1735
1797
  loading: "blue"
1736
- }, Ir = (t, e) => {
1798
+ }, zr = (t, e) => {
1737
1799
  const n = [];
1738
- let s = e;
1739
- for (; s < t.length; ) {
1740
- const o = t[s];
1741
- if (!Ar(o)) break;
1742
- n.push(o), s += 1;
1800
+ let o = e;
1801
+ for (; o < t.length; ) {
1802
+ const s = t[o];
1803
+ if (!Or(s)) break;
1804
+ n.push(s), o += 1;
1743
1805
  }
1744
1806
  return {
1745
1807
  invocations: n,
1746
- nextIndex: s - 1
1808
+ nextIndex: o - 1
1747
1809
  };
1748
1810
  };
1749
- function yn(t) {
1750
- const e = S(8), {
1811
+ function _n(t) {
1812
+ const e = T(8), {
1751
1813
  message: n,
1752
- hideQuestionForms: s,
1753
- onOpenFile: o,
1814
+ hideQuestionForms: o,
1815
+ onOpenFile: s,
1754
1816
  toolInvocationTimeline: r
1755
- } = t, i = s === void 0 ? !1 : s, c = r ?? Cr;
1756
- let a;
1757
- e[0] !== n.parts ? (a = n.parts ?? [], e[0] = n.parts, e[1] = a) : a = e[1];
1758
- const u = a;
1817
+ } = t, i = o === void 0 ? !1 : o, a = r ?? vr;
1818
+ let c;
1819
+ e[0] !== n.parts ? (c = n.parts ?? [], e[0] = n.parts, e[1] = c) : c = e[1];
1820
+ const u = c;
1759
1821
  let d;
1760
- if (e[2] !== c || e[3] !== i || e[4] !== n.id || e[5] !== o || e[6] !== u) {
1761
- const f = [];
1822
+ if (e[2] !== a || e[3] !== i || e[4] !== n.id || e[5] !== s || e[6] !== u) {
1823
+ const p = [];
1762
1824
  for (let m = 0; m < u.length; m = m + 1, m) {
1763
- const p = u[m], h = `${n.id}-${m}`;
1764
- e: switch (p.type) {
1825
+ const f = u[m], h = `${n.id}-${m}`;
1826
+ e: switch (f.type) {
1765
1827
  case "text": {
1766
- f.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(ns, { children: p.text }) }, h));
1828
+ p.push(/* @__PURE__ */ l("div", { children: /* @__PURE__ */ l(fo, { children: f.text }) }, h));
1767
1829
  break e;
1768
1830
  }
1769
1831
  case "reasoning": {
1770
- f.push(/* @__PURE__ */ l(M, { padding: "0", css: {
1832
+ p.push(/* @__PURE__ */ l(I, { padding: "0", css: {
1771
1833
  "& .rich-text, & .rich-text *": {
1772
1834
  color: "fg.subtle !important",
1773
1835
  fontSize: ".75rem !important",
1774
1836
  fontWeight: "normal !important"
1775
1837
  }
1776
- }, children: /* @__PURE__ */ l(Jt, { defaultState: p.text, fullWidth: !0 }) }, h));
1838
+ }, children: /* @__PURE__ */ l(on, { defaultState: f.text, fullWidth: !0 }) }, h));
1777
1839
  break e;
1778
1840
  }
1779
1841
  case "tool": {
1780
1842
  const {
1781
1843
  invocations: g,
1782
1844
  nextIndex: b
1783
- } = Ir(u, m);
1784
- m = b, f.push(/* @__PURE__ */ l(M, { width: "full", children: /* @__PURE__ */ l(c, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: o }) }, h));
1845
+ } = zr(u, m);
1846
+ m = b, p.push(/* @__PURE__ */ l(I, { width: "full", children: /* @__PURE__ */ l(a, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: s }) }, h));
1785
1847
  break e;
1786
1848
  }
1787
1849
  case "error": {
1788
- f.push(/* @__PURE__ */ l(M, { py: "2", width: "full", children: /* @__PURE__ */ l(vt, { borderRadius: "xs", status: "error", colorPalette: "red", title: Rr(p), size: "sm" }) }, h));
1850
+ p.push(/* @__PURE__ */ l(I, { py: "2", width: "full", children: /* @__PURE__ */ l(Qt, { borderRadius: "xs", status: "error", colorPalette: "red", title: Dr(f), size: "sm" }) }, h));
1789
1851
  break e;
1790
1852
  }
1791
1853
  case "token_usage": {
1792
- f.push(/* @__PURE__ */ l(M, { children: /* @__PURE__ */ w(F, { fontSize: "xs", color: "fg.subtle", children: [
1854
+ p.push(/* @__PURE__ */ l(I, { children: /* @__PURE__ */ w(q, { fontSize: "xs", color: "fg.subtle", children: [
1793
1855
  "Tokens: ",
1794
- Rt(p.inputTokens),
1856
+ Mt(f.inputTokens),
1795
1857
  " in / ",
1796
- Rt(p.outputTokens),
1858
+ Mt(f.outputTokens),
1797
1859
  " out",
1798
- p.cacheReadTokens ? ` / ${Rt(p.cacheReadTokens)} cache read` : ""
1860
+ f.cacheReadTokens ? ` / ${Mt(f.cacheReadTokens)} cache read` : ""
1799
1861
  ] }) }, h));
1800
1862
  break e;
1801
1863
  }
1802
1864
  case "alert": {
1803
- f.push(/* @__PURE__ */ l(M, { width: "full", children: /* @__PURE__ */ l(vt, { borderRadius: "xs", status: p.status === "loading" ? "info" : p.status, colorPalette: Br[p.status], title: p.title, icon: p.status === "loading" ? /* @__PURE__ */ l(Pt, { size: "sm" }) : void 0, size: "sm", children: p.message }) }, h));
1865
+ p.push(/* @__PURE__ */ l(I, { width: "full", children: /* @__PURE__ */ l(Qt, { borderRadius: "xs", status: f.status === "loading" ? "info" : f.status, colorPalette: Fr[f.status], title: f.title, icon: f.status === "loading" ? /* @__PURE__ */ l(vt, { size: "sm" }) : void 0, size: "sm", children: f.message }) }, h));
1804
1866
  break e;
1805
1867
  }
1806
1868
  default:
1807
- f.push(null);
1869
+ p.push(null);
1808
1870
  }
1809
1871
  }
1810
- d = /* @__PURE__ */ l(It, { children: f }), e[2] = c, e[3] = i, e[4] = n.id, e[5] = o, e[6] = u, e[7] = d;
1872
+ d = /* @__PURE__ */ l(Bt, { children: p }), e[2] = a, e[3] = i, e[4] = n.id, e[5] = s, e[6] = u, e[7] = d;
1811
1873
  } else
1812
1874
  d = e[7];
1813
1875
  return d;
1814
1876
  }
1815
- const Pr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Mr = (t) => {
1877
+ const qr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Qr = (t) => {
1816
1878
  const e = t.parts ?? [];
1817
- return e.length === 0 || e.some((s) => s.type === "text" && "text" in s) ? !1 : e.some((s) => s.type === "reasoning" || s.type === "tool");
1818
- }, $r = (t) => {
1879
+ return e.length === 0 || e.some((o) => o.type === "text" && "text" in o) ? !1 : e.some((o) => o.type === "reasoning" || o.type === "tool");
1880
+ }, Hr = (t) => {
1819
1881
  const e = [];
1820
1882
  for (const n of t) {
1821
- const s = e[e.length - 1];
1822
- if (s && s.role === n.role && Mr(n)) {
1823
- s.parts = [...s.parts ?? [], ...n.parts ?? []];
1883
+ const o = e[e.length - 1];
1884
+ if (o && o.role === n.role && Qr(n)) {
1885
+ o.parts = [...o.parts ?? [], ...n.parts ?? []];
1824
1886
  continue;
1825
1887
  }
1826
1888
  e.push({
@@ -1829,197 +1891,325 @@ const Pr = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "
1829
1891
  });
1830
1892
  }
1831
1893
  return e;
1832
- }, Or = (t) => {
1894
+ }, Wr = (t) => {
1833
1895
  const e = [], n = [];
1834
- for (const s of t)
1835
- s.role === "user" ? e.push({
1836
- userMessage: s,
1896
+ for (const o of t)
1897
+ o.role === "user" ? e.push({
1898
+ userMessage: o,
1837
1899
  responses: []
1838
- }) : e.length > 0 ? e[e.length - 1].responses.push(s) : n.push(s);
1900
+ }) : e.length > 0 ? e[e.length - 1].responses.push(o) : n.push(o);
1839
1901
  return {
1840
1902
  groups: e,
1841
1903
  leadingResponses: n
1842
1904
  };
1843
- }, Er = (t) => {
1844
- const e = S(3), {
1905
+ }, An = 720, Nr = 1, Vr = 3, jr = 20, Xt = 1, Ur = 4, Rn = 8, Kr = (t, e) => [...t.map((n) => ({
1906
+ type: "leading-response",
1907
+ key: n.id,
1908
+ message: n
1909
+ })), ...e.map((n, o) => ({
1910
+ type: "group",
1911
+ key: n.userMessage.id,
1912
+ group: n,
1913
+ groupIndex: o
1914
+ }))], Gr = (t, e) => {
1915
+ if (t === 0) return 0;
1916
+ const n = t * An + (t - 1) * Rn;
1917
+ return Math.max(n - e, 0);
1918
+ }, Xr = (t) => t?.clientHeight || Nr, Yr = (t, e) => Math.abs(t.scrollTop - e.scrollTop) <= Xt && Math.abs(t.totalSize - e.totalSize) <= Xt, Jr = (t, e) => ({
1919
+ scrollTop: t?.scrollTop ?? 0,
1920
+ totalSize: e
1921
+ }), Zr = (t) => {
1922
+ const e = T(8), {
1923
+ itemCount: n,
1924
+ onReady: o,
1925
+ scrollRef: s,
1926
+ totalSize: r
1927
+ } = t, i = Qe(o);
1928
+ let a, c;
1929
+ e[0] !== o ? (a = () => {
1930
+ i.current = o;
1931
+ }, c = [o], e[0] = o, e[1] = a, e[2] = c) : (a = e[1], c = e[2]), we(a, c);
1932
+ let u, d;
1933
+ e[3] !== n || e[4] !== s || e[5] !== r ? (u = () => {
1934
+ if (n === 0 || typeof requestAnimationFrame > "u") {
1935
+ i.current?.();
1936
+ return;
1937
+ }
1938
+ let p = 0, m = 0, f = 0, h = null;
1939
+ const g = () => {
1940
+ m = m + 1;
1941
+ const b = Jr(s.current, r);
1942
+ if (f = h && Yr(b, h) ? f + 1 : 0, h = b, f >= Vr || m >= jr) {
1943
+ i.current?.();
1944
+ return;
1945
+ }
1946
+ p = requestAnimationFrame(g);
1947
+ };
1948
+ return p = requestAnimationFrame(g), () => cancelAnimationFrame(p);
1949
+ }, d = [n, s, r], e[3] = n, e[4] = s, e[5] = r, e[6] = u, e[7] = d) : (u = e[6], d = e[7]), we(u, d);
1950
+ }, ei = (t) => {
1951
+ const e = T(7), {
1845
1952
  label: n,
1846
- onClick: s
1847
- } = t;
1848
- let o;
1849
- return e[0] !== n || e[1] !== s ? (o = /* @__PURE__ */ l(fe, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: "flex-end", alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: /* @__PURE__ */ l(qe, { size: "2xs", variant: "solid", pointerEvents: "auto", onClick: s, children: n }) }), e[0] = n, e[1] = s, e[2] = o) : o = e[2], o;
1850
- }, Sn = (t, e, n = !1) => {
1851
- const s = Pr(t.role);
1852
- return /* @__PURE__ */ l(de.Root, { from: s, children: /* @__PURE__ */ l(de.Content, { from: s, children: /* @__PURE__ */ l(yn, { message: t, streaming: e, hideQuestionForms: n }) }) }, t.id);
1853
- }, Dr = (t) => {
1854
- es(t.currentTarget, t.deltaY) && t.stopPropagation();
1855
- }, Lr = (t, e) => {
1953
+ onClick: o,
1954
+ actionPanel: s
1955
+ } = t, r = s ? "space-between" : "flex-end";
1956
+ let i;
1957
+ e[0] !== n || e[1] !== o ? (i = /* @__PURE__ */ l(Ke, { size: "2xs", variant: "solid", pointerEvents: "auto", onClick: o, children: n }), e[0] = n, e[1] = o, e[2] = i) : i = e[2];
1958
+ let a;
1959
+ return e[3] !== s || e[4] !== r || e[5] !== i ? (a = /* @__PURE__ */ w(Ce, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: r, alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: [
1960
+ s,
1961
+ i
1962
+ ] }), e[3] = s, e[4] = r, e[5] = i, e[6] = a) : a = e[6], a;
1963
+ }, In = (t, e, n = !1) => {
1964
+ const o = qr(t.role);
1965
+ return /* @__PURE__ */ l(ke.Root, { from: o, children: /* @__PURE__ */ w(ke.Content, { from: o, children: [
1966
+ /* @__PURE__ */ l(_n, { message: t, streaming: e, hideQuestionForms: n }),
1967
+ o === "assistant" || o === "user" ? /* @__PURE__ */ l(Pt, { message: t, alwaysVisible: o === "user", copyAlwaysVisible: o !== "user" }) : null
1968
+ ] }) });
1969
+ }, ti = (t) => {
1970
+ io(t.currentTarget, t.deltaY) && t.stopPropagation();
1971
+ }, ni = (t, e) => {
1856
1972
  if (t)
1857
- return e ? sn : Yo;
1858
- }, qr = (t) => {
1973
+ return e ? dn : so;
1974
+ }, si = (t) => {
1859
1975
  if (t)
1860
- return sn;
1861
- }, vr = (t) => {
1862
- const e = S(42), {
1976
+ return dn;
1977
+ }, oi = (t) => {
1978
+ const e = T(43), {
1863
1979
  group: n,
1864
- streaming: s,
1865
- hideQuestionForms: o,
1980
+ streaming: o,
1981
+ hideQuestionForms: s,
1866
1982
  isExpanded: r,
1867
1983
  onToggleStickyMessage: i
1868
1984
  } = t;
1869
- let c, a, u;
1870
- e[0] !== n.userMessage || e[1] !== r ? (c = Zo(n.userMessage), a = c && r, u = Lr(c, r), e[0] = n.userMessage, e[1] = r, e[2] = c, e[3] = a, e[4] = u) : (c = e[2], a = e[3], u = e[4]);
1985
+ let a, c, u;
1986
+ e[0] !== n.userMessage || e[1] !== r ? (a = ro(n.userMessage), c = a && r, u = ni(a, r), e[0] = n.userMessage, e[1] = r, e[2] = a, e[3] = c, e[4] = u) : (a = e[2], c = e[3], u = e[4]);
1871
1987
  const d = u;
1872
- let f;
1873
- e[5] !== n.userMessage.id || e[6] !== i ? (f = () => i(n.userMessage.id), e[5] = n.userMessage.id, e[6] = i, e[7] = f) : f = e[7];
1874
- const m = f, p = c ? "0" : void 0, h = c ? "relative" : void 0, g = c ? r ? "expanded" : "collapsed" : void 0;
1988
+ let p;
1989
+ e[5] !== n.userMessage.id || e[6] !== i ? (p = () => i(n.userMessage.id), e[5] = n.userMessage.id, e[6] = i, e[7] = p) : p = e[7];
1990
+ const m = p, f = a ? "0" : void 0, h = a ? "relative" : void 0, g = a ? r ? "expanded" : "collapsed" : void 0;
1875
1991
  let b;
1876
- e[8] !== a ? (b = qr(a), e[8] = a, e[9] = b) : b = e[9];
1877
- const x = a ? "auto" : "visible", k = c ? "xs" : void 0, T = c ? "xs" : void 0, A = a ? "3rem" : void 0, R = a ? Dr : void 0;
1878
- let B;
1879
- e[10] !== n.userMessage || e[11] !== s ? (B = /* @__PURE__ */ l(yn, { message: n.userMessage, streaming: s }), e[10] = n.userMessage, e[11] = s, e[12] = B) : B = e[12];
1880
- let I;
1881
- e[13] !== R || e[14] !== B || e[15] !== g || e[16] !== b || e[17] !== x || e[18] !== k || e[19] !== T || e[20] !== A ? (I = /* @__PURE__ */ l(M, { "data-sticky-user-message-content": g, display: "flex", flexDirection: "column", gap: "sm", maxH: b, minH: "0", overflowY: x, px: k, py: T, pb: A, onWheel: R, children: B }), e[13] = R, e[14] = B, e[15] = g, e[16] = b, e[17] = x, e[18] = k, e[19] = T, e[20] = A, e[21] = I) : I = e[21];
1882
- let _;
1883
- e[22] !== c || e[23] !== r || e[24] !== m ? (_ = c && /* @__PURE__ */ l(Er, { label: r ? "Show less" : "Show more", onClick: m }), e[22] = c, e[23] = r, e[24] = m, e[25] = _) : _ = e[25];
1992
+ e[8] !== c ? (b = si(c), e[8] = c, e[9] = b) : b = e[9];
1993
+ const y = c ? "auto" : "visible", x = a ? "xs" : void 0, _ = a ? "xs" : void 0, C = c ? "3rem" : void 0, k = c ? ti : void 0;
1994
+ let R;
1995
+ e[10] !== n.userMessage || e[11] !== o ? (R = /* @__PURE__ */ l(_n, { message: n.userMessage, streaming: o }), e[10] = n.userMessage, e[11] = o, e[12] = R) : R = e[12];
1884
1996
  let P;
1885
- e[26] !== d || e[27] !== I || e[28] !== _ || e[29] !== p || e[30] !== h ? (P = /* @__PURE__ */ l(M, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ l(de.Root, { from: "user", children: /* @__PURE__ */ w(de.Content, { from: "user", maxH: d, overflow: "hidden", p, position: h, children: [
1886
- I,
1887
- _
1888
- ] }) }) }), e[26] = d, e[27] = I, e[28] = _, e[29] = p, e[30] = h, e[31] = P) : P = e[31];
1889
- let L;
1890
- if (e[32] !== n.responses || e[33] !== o || e[34] !== s) {
1891
- let q;
1892
- e[36] !== o || e[37] !== s ? (q = (W) => Sn(W, s, o), e[36] = o, e[37] = s, e[38] = q) : q = e[38], L = n.responses.map(q), e[32] = n.responses, e[33] = o, e[34] = s, e[35] = L;
1893
- } else
1894
- L = e[35];
1895
- let O;
1896
- return e[39] !== P || e[40] !== L ? (O = /* @__PURE__ */ w(M, { children: [
1997
+ e[13] !== k || e[14] !== R || e[15] !== g || e[16] !== b || e[17] !== y || e[18] !== x || e[19] !== _ || e[20] !== C ? (P = /* @__PURE__ */ l(I, { "data-sticky-user-message-content": g, display: "flex", flexDirection: "column", gap: "sm", maxH: b, minH: "0", overflowY: y, px: x, py: _, pb: C, onWheel: k, children: R }), e[13] = k, e[14] = R, e[15] = g, e[16] = b, e[17] = y, e[18] = x, e[19] = _, e[20] = C, e[21] = P) : P = e[21];
1998
+ let M;
1999
+ e[22] !== n.userMessage || e[23] !== a || e[24] !== r || e[25] !== m ? (M = a ? /* @__PURE__ */ l(ei, { label: r ? "Show less" : "Show more", onClick: m, actionPanel: /* @__PURE__ */ l(Pt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }) }) : /* @__PURE__ */ l(Pt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }), e[22] = n.userMessage, e[23] = a, e[24] = r, e[25] = m, e[26] = M) : M = e[26];
2000
+ let B;
2001
+ e[27] !== d || e[28] !== P || e[29] !== M || e[30] !== f || e[31] !== h ? (B = /* @__PURE__ */ l(I, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ l(ke.Root, { from: "user", children: /* @__PURE__ */ w(ke.Content, { from: "user", maxH: d, overflow: "hidden", p: f, position: h, children: [
1897
2002
  P,
1898
- L
1899
- ] }), e[39] = P, e[40] = L, e[41] = O) : O = e[41], O;
1900
- }, Ci = (t) => {
1901
- const e = S(30), {
1902
- messages: n,
1903
- streaming: s,
1904
- emptyStateTitle: o,
1905
- emptyStateDescription: r,
1906
- emptyStateContent: i,
1907
- loadingContent: c,
1908
- chatInputPlaceholder: a,
1909
- chatInputDefaultValue: u,
1910
- onSubmitMessage: d,
2003
+ M
2004
+ ] }) }) }), e[27] = d, e[28] = P, e[29] = M, e[30] = f, e[31] = h, e[32] = B) : B = e[32];
2005
+ let Q;
2006
+ if (e[33] !== n.responses || e[34] !== s || e[35] !== o) {
2007
+ let H;
2008
+ e[37] !== s || e[38] !== o ? (H = (ee) => /* @__PURE__ */ l(I, { children: In(ee, o, s) }, ee.id), e[37] = s, e[38] = o, e[39] = H) : H = e[39], Q = n.responses.map(H), e[33] = n.responses, e[34] = s, e[35] = o, e[36] = Q;
2009
+ } else
2010
+ Q = e[36];
2011
+ let L;
2012
+ return e[40] !== B || e[41] !== Q ? (L = /* @__PURE__ */ w(I, { children: [
2013
+ B,
2014
+ Q
2015
+ ] }), e[40] = B, e[41] = Q, e[42] = L) : L = e[42], L;
2016
+ }, ri = (t, e) => {
2017
+ const {
2018
+ groups: n,
2019
+ streaming: o,
2020
+ hideActiveQuestionForms: s,
2021
+ expandedStickyMessageIds: r,
2022
+ onToggleStickyMessage: i
2023
+ } = e;
2024
+ return t.type === "leading-response" ? In(t.message, o, n.length > 0 || s) : /* @__PURE__ */ l(oi, { group: t.group, streaming: o, hideQuestionForms: t.groupIndex < n.length - 1 || s, isExpanded: r.has(t.group.userMessage.id), onToggleStickyMessage: i });
2025
+ }, ii = (t) => {
2026
+ const {
2027
+ leadingResponses: e,
2028
+ groups: n,
2029
+ streaming: o,
2030
+ hideActiveQuestionForms: s,
2031
+ expandedStickyMessageIds: r,
2032
+ onToggleStickyMessage: i,
2033
+ onReady: a
2034
+ } = t, {
2035
+ scrollRef: c
2036
+ } = ct(), u = Kr(e, n), d = Xr(c.current), p = ys({
2037
+ count: u.length,
2038
+ getScrollElement: () => c.current,
2039
+ estimateSize: () => An,
2040
+ getItemKey: (f) => u[f]?.key ?? f,
2041
+ overscan: Ur,
2042
+ gap: Rn,
2043
+ initialRect: {
2044
+ width: 0,
2045
+ height: d
2046
+ },
2047
+ initialOffset: () => Gr(u.length, d)
2048
+ }), m = p.getTotalSize();
2049
+ return Zr({
2050
+ itemCount: u.length,
2051
+ onReady: a,
2052
+ scrollRef: c,
2053
+ totalSize: m
2054
+ }), /* @__PURE__ */ l(I, { px: "xs", children: /* @__PURE__ */ l(I, { position: "relative", width: "100%", style: {
2055
+ height: m
2056
+ }, children: p.getVirtualItems().map((f) => {
2057
+ const h = u[f.index];
2058
+ return h ? /* @__PURE__ */ l(I, { ref: p.measureElement, "data-index": f.index, "data-chat-message-list-item": h.type, position: "absolute", top: "0", left: "0", width: "100%", style: {
2059
+ top: f.start
2060
+ }, children: ri(h, {
2061
+ groups: n,
2062
+ streaming: o,
2063
+ hideActiveQuestionForms: s,
2064
+ expandedStickyMessageIds: r,
2065
+ onToggleStickyMessage: i
2066
+ }) }, f.key) : null;
2067
+ }) }) });
2068
+ }, Ui = (t) => {
2069
+ const e = T(62), {
2070
+ conversationKey: n,
2071
+ messages: o,
2072
+ loading: s,
2073
+ streaming: r,
2074
+ emptyStateTitle: i,
2075
+ emptyStateDescription: a,
2076
+ emptyStateContent: c,
2077
+ loaderComponent: u,
2078
+ chatInputPlaceholder: d,
2079
+ chatInputDefaultValue: p,
2080
+ onSubmitMessage: m,
1911
2081
  onInterrupt: f,
1912
- onChatInputChange: m,
1913
- actions: p,
1914
- repoMenu: h,
1915
- attachedResources: g,
1916
- onClearAttachments: b,
1917
- attachmentList: x,
1918
- approvalPrompt: k,
1919
- workspaceHub: T,
1920
- workspaceInitializing: A,
1921
- inputDisabled: R,
1922
- chatInputQuestionPrompt: B,
1923
- chatInputAutoFocus: I
1924
- } = t, _ = s === void 0 ? !1 : s, P = u === void 0 ? "" : u, L = A === void 0 ? !1 : A, O = R === void 0 ? !1 : R, q = I === void 0 ? !1 : I, W = $r(n), ye = W.length > 0, $e = W.reduce(Qr, 0), {
1925
- groups: se,
1926
- leadingResponses: E
1927
- } = Or(W), [Se, ke] = Z(Fr), D = _ ? c ?? i : i, H = !!T, we = !!B, pe = _ && ye && !L;
1928
- let j;
1929
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (j = ($) => {
1930
- ke((le) => {
1931
- const X = new Set(le);
1932
- return X.has($) ? X.delete($) : X.add($), X;
2082
+ onChatInputChange: h,
2083
+ actions: g,
2084
+ repoMenu: b,
2085
+ attachedResources: y,
2086
+ onClearAttachments: x,
2087
+ attachmentList: _,
2088
+ approvalPrompt: C,
2089
+ workspaceHub: k,
2090
+ workspaceInitializing: R,
2091
+ inputDisabled: P,
2092
+ chatInputQuestionPrompt: M,
2093
+ chatInputAutoFocus: B
2094
+ } = t, Q = s === void 0 ? !1 : s, L = r === void 0 ? !1 : r, H = p === void 0 ? "" : p, ee = R === void 0 ? !1 : R, _e = P === void 0 ? !1 : P, Ae = B === void 0 ? !1 : B;
2095
+ let $, E, te, W;
2096
+ if (e[0] !== n || e[1] !== o) {
2097
+ const v = Hr(o);
2098
+ $ = v.length > 0;
2099
+ const ye = n ?? v[0]?.id;
2100
+ E = $ ? ye ?? "active-conversation" : null, W = v.reduce(li, 0), te = Wr(v), e[0] = n, e[1] = o, e[2] = $, e[3] = E, e[4] = te, e[5] = W;
2101
+ } else
2102
+ $ = e[2], E = e[3], te = e[4], W = e[5];
2103
+ const {
2104
+ groups: O,
2105
+ leadingResponses: fe
2106
+ } = te, [Re, We] = G(ai), [Be, Ye] = G(null), Le = !$ && Q;
2107
+ let ne;
2108
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ne = /* @__PURE__ */ l(cs, { size: 48, strokeWidth: 1.5 }), e[6] = ne) : ne = e[6];
2109
+ let se;
2110
+ e[7] !== a || e[8] !== i ? (se = /* @__PURE__ */ l(bs, { icon: ne, title: i, description: a }), e[7] = a, e[8] = i, e[9] = se) : se = e[9];
2111
+ const pe = Le ? u : c ?? se, X = !!k, me = !!M, he = L && $ && !ee, oe = !E || Be === E;
2112
+ let Ie;
2113
+ e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ie = (v) => {
2114
+ We((ye) => {
2115
+ const xe = new Set(ye);
2116
+ return xe.has(v) ? xe.delete(v) : xe.add(v), xe;
1933
2117
  });
1934
- }, e[0] = j) : j = e[0];
1935
- const Fe = j, re = Ct, ie = ye ? /* @__PURE__ */ w(z, { gap: "sm", children: [
1936
- E.map(($) => Sn($, _, se.length > 0 || we)),
1937
- se.map(($, le) => /* @__PURE__ */ l(vr, { group: $, streaming: _, hideQuestionForms: le < se.length - 1 || we, isExpanded: Se.has($.userMessage.id), onToggleStickyMessage: Fe }, $.userMessage.id))
1938
- ] }) : D ?? /* @__PURE__ */ l(fo, { icon: /* @__PURE__ */ l(no, { size: 48, strokeWidth: 1.5 }), title: o, description: r });
2118
+ }, e[10] = Ie) : Ie = e[10];
2119
+ const ve = Ie;
1939
2120
  let N;
1940
- e[1] !== re.Viewport || e[2] !== ie ? (N = /* @__PURE__ */ l(re.Viewport, { children: ie }), e[1] = re.Viewport, e[2] = ie, e[3] = N) : N = e[3];
2121
+ e[11] !== W ? (N = /* @__PURE__ */ l(Ps, { userMessageCount: W }), e[11] = W, e[12] = N) : N = e[12];
2122
+ const ge = oe ? "visible" : "hidden";
2123
+ let be;
2124
+ e[13] !== pe || e[14] !== Re || e[15] !== O || e[16] !== $ || e[17] !== me || e[18] !== fe || e[19] !== E || e[20] !== L ? (be = $ ? /* @__PURE__ */ l(ii, { leadingResponses: fe, groups: O, streaming: L, hideActiveQuestionForms: me, expandedStickyMessageIds: Re, onToggleStickyMessage: ve, onReady: () => Ye(E) }, E) : pe, e[13] = pe, e[14] = Re, e[15] = O, e[16] = $, e[17] = me, e[18] = fe, e[19] = E, e[20] = L, e[21] = be) : be = e[21];
1941
2125
  let V;
1942
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ l(Ct.ScrollToBottom, { "aria-label": "Scroll to latest message" }), e[4] = V) : V = e[4];
2126
+ e[22] !== ge || e[23] !== be ? (V = /* @__PURE__ */ l(At.Viewport, { visibility: ge, children: be }), e[22] = ge, e[23] = be, e[24] = V) : V = e[24];
2127
+ let Y;
2128
+ e[25] !== oe ? (Y = oe ? /* @__PURE__ */ l(At.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, e[25] = oe, e[26] = Y) : Y = e[26];
2129
+ let D;
2130
+ e[27] !== N || e[28] !== V || e[29] !== Y ? (D = /* @__PURE__ */ w(At.Root, { children: [
2131
+ N,
2132
+ V,
2133
+ Y
2134
+ ] }), e[27] = N, e[28] = V, e[29] = Y, e[30] = D) : D = e[30];
2135
+ let F;
2136
+ e[31] !== he ? (F = he ? /* @__PURE__ */ w(Ee, { gap: "xs", px: "sm", py: "2xs", children: [
2137
+ /* @__PURE__ */ l(vt, { size: "xs", color: "fg.muted" }),
2138
+ /* @__PURE__ */ l(q, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
2139
+ ] }) : null, e[31] = he, e[32] = F) : F = e[32];
2140
+ const z = X ? "0" : "xs";
2141
+ let j;
2142
+ e[33] !== H ? (j = eo(H), e[33] = H, e[34] = j) : j = e[34];
1943
2143
  let U;
1944
- e[5] !== pe ? (U = pe ? /* @__PURE__ */ w(Me, { gap: "xs", px: "sm", py: "2xs", children: [
1945
- /* @__PURE__ */ l(Pt, { size: "xs", color: "fg.muted" }),
1946
- /* @__PURE__ */ l(F, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
1947
- ] }) : null, e[5] = pe, e[6] = U) : U = e[6];
1948
- const G = H ? "0" : "xs";
1949
- let v;
1950
- e[7] !== P ? (v = Go(P), e[7] = P, e[8] = v) : v = e[8];
1951
- let Q;
1952
- e[9] !== p || e[10] !== g || e[11] !== x || e[12] !== q || e[13] !== a || e[14] !== B || e[15] !== H || e[16] !== O || e[17] !== m || e[18] !== b || e[19] !== f || e[20] !== d || e[21] !== _ || e[22] !== v ? (Q = /* @__PURE__ */ l(jo, { placeholder: a, defaultState: v, streaming: _, onSubmit: d, onInterrupt: f, onChange: m, actions: p, attachedResources: g, onClearAttachments: b, attachmentList: x, isDisabled: O, attachedToTop: H, questionPrompt: B, autoFocus: q }), e[9] = p, e[10] = g, e[11] = x, e[12] = q, e[13] = a, e[14] = B, e[15] = H, e[16] = O, e[17] = m, e[18] = b, e[19] = f, e[20] = d, e[21] = _, e[22] = v, e[23] = Q) : Q = e[23];
2144
+ e[35] !== g || e[36] !== y || e[37] !== _ || e[38] !== Ae || e[39] !== d || e[40] !== M || e[41] !== X || e[42] !== _e || e[43] !== h || e[44] !== x || e[45] !== f || e[46] !== m || e[47] !== L || e[48] !== j ? (U = /* @__PURE__ */ l(Xs, { placeholder: d, defaultState: j, streaming: L, onSubmit: m, onInterrupt: f, onChange: h, actions: g, attachedResources: y, onClearAttachments: x, attachmentList: _, isDisabled: _e, attachedToTop: X, questionPrompt: M, autoFocus: Ae }), e[35] = g, e[36] = y, e[37] = _, e[38] = Ae, e[39] = d, e[40] = M, e[41] = X, e[42] = _e, e[43] = h, e[44] = x, e[45] = f, e[46] = m, e[47] = L, e[48] = j, e[49] = U) : U = e[49];
1953
2145
  let K;
1954
- e[24] !== G || e[25] !== Q || e[26] !== T ? (K = /* @__PURE__ */ w(z, { px: "sm", gap: G, children: [
1955
- T,
1956
- Q
1957
- ] }), e[24] = G, e[25] = Q, e[26] = T, e[27] = K) : K = e[27];
1958
- let me;
1959
- return e[28] !== h ? (me = /* @__PURE__ */ l(fe, { p: "2xs", justifyContent: "flex-end", children: h }), e[28] = h, e[29] = me) : me = e[29], /* @__PURE__ */ w(fe, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
1960
- /* @__PURE__ */ w(Ct.Root, { children: [
1961
- /* @__PURE__ */ l(_o, { userMessageCount: $e }),
1962
- N,
1963
- V
1964
- ] }),
2146
+ e[50] !== z || e[51] !== U || e[52] !== k ? (K = /* @__PURE__ */ w(Z, { px: "xs", gap: z, children: [
1965
2147
  k,
1966
- U,
2148
+ U
2149
+ ] }), e[50] = z, e[51] = U, e[52] = k, e[53] = K) : K = e[53];
2150
+ let J;
2151
+ e[54] !== b ? (J = /* @__PURE__ */ l(Ce, { p: "2xs", justifyContent: "flex-end", children: b }), e[54] = b, e[55] = J) : J = e[55];
2152
+ let re;
2153
+ return e[56] !== C || e[57] !== D || e[58] !== F || e[59] !== K || e[60] !== J ? (re = /* @__PURE__ */ w(Ce, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
2154
+ D,
2155
+ C,
2156
+ F,
1967
2157
  K,
1968
- me
1969
- ] });
2158
+ J
2159
+ ] }), e[56] = C, e[57] = D, e[58] = F, e[59] = K, e[60] = J, e[61] = re) : re = e[61], re;
1970
2160
  };
1971
- function Qr(t, e) {
2161
+ function li(t, e) {
1972
2162
  return t + (e.role === "user" ? 1 : 0);
1973
2163
  }
1974
- function Fr() {
2164
+ function ai() {
1975
2165
  return /* @__PURE__ */ new Set();
1976
2166
  }
1977
- const Vt = (t) => /* @__PURE__ */ l(z, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ l(En, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), _i = () => {
1978
- const t = S(2);
2167
+ const Yt = (t) => /* @__PURE__ */ l(Z, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ l(Qn, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), Ki = () => {
2168
+ const t = T(2);
1979
2169
  let e;
1980
- t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ l(de.Root, { from: "user", children: /* @__PURE__ */ l(de.Content, { from: "user", children: Vt(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
2170
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ l(ke.Root, { from: "user", children: /* @__PURE__ */ l(ke.Content, { from: "user", children: Yt(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
1981
2171
  let n;
1982
- return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ w(z, { minH: "full", py: "xs", gap: "0", children: [
2172
+ return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ w(Z, { minH: "full", py: "xs", gap: "0", children: [
1983
2173
  e,
1984
- /* @__PURE__ */ l(de.Root, { from: "assistant", children: /* @__PURE__ */ l(de.Content, { from: "assistant", children: Vt(["76%", "62%", "40%"]) }) })
2174
+ /* @__PURE__ */ l(ke.Root, { from: "assistant", children: /* @__PURE__ */ l(ke.Content, { from: "assistant", children: Yt(["76%", "62%", "40%"]) }) })
1985
2175
  ] }), t[1] = n) : n = t[1], n;
1986
- }, Ai = (t) => {
1987
- const e = S(14), {
2176
+ }, Gi = (t) => {
2177
+ const e = T(14), {
1988
2178
  changesLabel: n,
1989
- additions: s,
1990
- deletions: o,
2179
+ additions: o,
2180
+ deletions: s,
1991
2181
  action: r,
1992
2182
  status: i,
1993
- statusLabel: c
1994
- } = t, a = i === void 0 ? "ready" : i, u = s > 0 || o > 0, d = a === "error" ? "border.error" : "border.muted", f = a === "error" ? "bg.error" : "bg.subtle";
2183
+ statusLabel: a
2184
+ } = t, c = i === void 0 ? "ready" : i, u = o > 0 || s > 0, d = c === "error" ? "border.error" : "border.muted", p = c === "error" ? "bg.error" : "bg.subtle";
1995
2185
  let m;
1996
- e[0] !== s || e[1] !== n || e[2] !== o || e[3] !== u || e[4] !== a || e[5] !== c ? (m = a === "loading" ? /* @__PURE__ */ w(Me, { gap: "xs", minW: "0", children: [
1997
- /* @__PURE__ */ l(Pt, { size: "xs", color: "fg.muted" }),
1998
- /* @__PURE__ */ l(F, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: c ?? "Setting up workspace..." })
1999
- ] }) : a === "error" ? /* @__PURE__ */ w(Me, { gap: "xs", minW: "0", children: [
2000
- /* @__PURE__ */ l(Xt, { size: 14, color: "var(--chakra-colors-fg-error)" }),
2001
- /* @__PURE__ */ l(F, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: c ?? "Workspace setup failed" })
2002
- ] }) : u ? /* @__PURE__ */ l(en, { label: n, additions: s, deletions: o, variant: "ghost", size: "small", _hover: {
2186
+ e[0] !== o || e[1] !== n || e[2] !== s || e[3] !== u || e[4] !== c || e[5] !== a ? (m = c === "loading" ? /* @__PURE__ */ w(Ee, { gap: "xs", minW: "0", children: [
2187
+ /* @__PURE__ */ l(vt, { size: "xs", color: "fg.muted" }),
2188
+ /* @__PURE__ */ l(q, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: a ?? "Setting up workspace..." })
2189
+ ] }) : c === "error" ? /* @__PURE__ */ w(Ee, { gap: "xs", minW: "0", children: [
2190
+ /* @__PURE__ */ l(tn, { size: 14, color: "var(--chakra-colors-fg-error)" }),
2191
+ /* @__PURE__ */ l(q, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: a ?? "Workspace setup failed" })
2192
+ ] }) : u ? /* @__PURE__ */ l(ln, { label: n, additions: o, deletions: s, variant: "ghost", size: "small", _hover: {
2003
2193
  background: "transparent"
2004
- } }) : /* @__PURE__ */ l(fe, { flex: "1" }), e[0] = s, e[1] = n, e[2] = o, e[3] = u, e[4] = a, e[5] = c, e[6] = m) : m = e[6];
2005
- let p;
2006
- e[7] !== r ? (p = r ? /* @__PURE__ */ l(fe, { flexShrink: 0, ml: "auto", children: r }) : null, e[7] = r, e[8] = p) : p = e[8];
2194
+ } }) : /* @__PURE__ */ l(Ce, { flex: "1" }), e[0] = o, e[1] = n, e[2] = s, e[3] = u, e[4] = c, e[5] = a, e[6] = m) : m = e[6];
2195
+ let f;
2196
+ e[7] !== r ? (f = r ? /* @__PURE__ */ l(Ce, { flexShrink: 0, ml: "auto", children: r }) : null, e[7] = r, e[8] = f) : f = e[8];
2007
2197
  let h;
2008
- return e[9] !== d || e[10] !== f || e[11] !== m || e[12] !== p ? (h = /* @__PURE__ */ w(fe, { align: "center", justify: "space-between", gap: "sm", minW: "0", px: "sm", py: "xs", borderWidth: "1px", borderColor: d, borderRadius: "xs", borderBottomRadius: "0", bg: f, children: [
2198
+ return e[9] !== d || e[10] !== p || e[11] !== m || e[12] !== f ? (h = /* @__PURE__ */ w(Ce, { align: "center", justify: "space-between", gap: "sm", minW: "0", px: "sm", py: "xs", borderWidth: "1px", borderColor: d, borderRadius: "xs", borderBottomRadius: "0", bg: p, children: [
2009
2199
  m,
2010
- p
2011
- ] }), e[9] = d, e[10] = f, e[11] = m, e[12] = p, e[13] = h) : h = e[13], h;
2200
+ f
2201
+ ] }), e[9] = d, e[10] = p, e[11] = m, e[12] = f, e[13] = h) : h = e[13], h;
2012
2202
  };
2013
2203
  export {
2014
- Ti as ApprovalPrompt,
2015
- _o as AutoScroll,
2016
- jo as ChatInput,
2017
- de as ChatMessage,
2018
- Ci as ChatPanel,
2019
- Ct as ChatPrimitives,
2020
- _i as ChatSkeleton,
2021
- Ai as ChatWorkspaceHub,
2022
- Ho as SendButton,
2023
- Go as createSerializedPromptState
2204
+ ji as ApprovalPrompt,
2205
+ Ps as AutoScroll,
2206
+ Xs as ChatInput,
2207
+ ke as ChatMessage,
2208
+ Ui as ChatPanel,
2209
+ At as ChatPrimitives,
2210
+ Ki as ChatSkeleton,
2211
+ Gi as ChatWorkspaceHub,
2212
+ Gs as SendButton,
2213
+ eo as createSerializedPromptState
2024
2214
  };
2025
2215
  //# sourceMappingURL=chat-ui.js.map