@pstdio/ui 0.5.0 → 0.5.2

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