@superxd-studio/adptr 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/GENERATIVE.md +101 -0
  2. package/INTERACTIONS.md +51 -0
  3. package/LICENSE +21 -0
  4. package/README.md +57 -0
  5. package/REUSE.md +170 -0
  6. package/REVIEW.md +68 -0
  7. package/THIRD-PARTY-NOTICES.md +28 -0
  8. package/ai-sdk/index.js +96 -0
  9. package/assets/ibm-plex-mono-cyrillic-400-normal.woff2 +0 -0
  10. package/assets/ibm-plex-mono-cyrillic-500-normal.woff2 +0 -0
  11. package/assets/ibm-plex-mono-cyrillic-ext-400-normal.woff2 +0 -0
  12. package/assets/ibm-plex-mono-cyrillic-ext-500-normal.woff2 +0 -0
  13. package/assets/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  14. package/assets/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  15. package/assets/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  16. package/assets/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  17. package/assets/ibm-plex-mono-vietnamese-400-normal.woff2 +0 -0
  18. package/assets/ibm-plex-mono-vietnamese-500-normal.woff2 +0 -0
  19. package/assets/instrument-sans-latin-ext-wght-normal.woff2 +0 -0
  20. package/assets/instrument-sans-latin-wght-normal.woff2 +0 -0
  21. package/assistant-ui/index.js +139 -0
  22. package/chunks/callout-DKMHSnjc.js +342 -0
  23. package/chunks/canvas-BJ15-XxE.js +598 -0
  24. package/chunks/controller-Cfpg0C7v.js +180 -0
  25. package/chunks/core-BCqVRLUy.js +312 -0
  26. package/chunks/text-field-BLtoaZFn.js +41 -0
  27. package/chunks/types-BGF7r1my.js +115 -0
  28. package/chunks/ui-9DyNsYXY.js +967 -0
  29. package/core/index.js +4 -0
  30. package/custom/index.js +64 -0
  31. package/examples/ai-sdk-backend/package.json +11 -0
  32. package/examples/ai-sdk-backend/server.mjs +316 -0
  33. package/examples/custom-backend/copy.mjs +7 -0
  34. package/examples/custom-backend/server.mjs +118 -0
  35. package/examples/generative/specs.json +2094 -0
  36. package/examples/review-backend/copy.mjs +27 -0
  37. package/examples/review-backend/package.json +11 -0
  38. package/examples/review-backend/server.mjs +276 -0
  39. package/examples/web-ai-sdk/index.html +12 -0
  40. package/examples/web-ai-sdk/package.json +21 -0
  41. package/examples/web-ai-sdk/src/copy.ts +1 -0
  42. package/examples/web-ai-sdk/src/main.tsx +64 -0
  43. package/examples/web-ai-sdk/tsconfig.json +13 -0
  44. package/examples/web-generative/index.html +12 -0
  45. package/examples/web-generative/package.json +23 -0
  46. package/examples/web-generative/src/copy.ts +42 -0
  47. package/examples/web-generative/src/main.tsx +74 -0
  48. package/examples/web-generative/tsconfig.json +14 -0
  49. package/examples/web-independent/index.html +12 -0
  50. package/examples/web-independent/package.json +20 -0
  51. package/examples/web-independent/src/main.tsx +32 -0
  52. package/examples/web-independent/tsconfig.json +14 -0
  53. package/examples/web-interactions/index.html +12 -0
  54. package/examples/web-interactions/package.json +21 -0
  55. package/examples/web-interactions/src/copy.ts +215 -0
  56. package/examples/web-interactions/src/examples.tsx +628 -0
  57. package/examples/web-interactions/src/main.tsx +116 -0
  58. package/examples/web-interactions/tsconfig.json +14 -0
  59. package/examples/web-review/index.html +12 -0
  60. package/examples/web-review/package.json +20 -0
  61. package/examples/web-review/src/main.tsx +59 -0
  62. package/examples/web-review/tsconfig.json +14 -0
  63. package/fonts.css +117 -0
  64. package/generative/index.js +1560 -0
  65. package/interactions/index.js +1591 -0
  66. package/langgraph-review/index.js +36 -0
  67. package/licenses/ai-sdk.txt +13 -0
  68. package/licenses/assistant-ui-generative.txt +21 -0
  69. package/licenses/assistant-ui.txt +23 -0
  70. package/licenses/ibm-plex-mono.txt +93 -0
  71. package/licenses/instrument-sans.txt +93 -0
  72. package/licenses/internationalized-date.txt +201 -0
  73. package/licenses/langgraph.txt +21 -0
  74. package/licenses/lucide.txt +43 -0
  75. package/licenses/react-markdown.txt +21 -0
  76. package/licenses/remark-gfm.txt +22 -0
  77. package/licenses/zod.txt +21 -0
  78. package/package.json +138 -0
  79. package/review/index.js +31 -0
  80. package/source/components/avatar.tsx +50 -0
  81. package/source/components/button.tsx +155 -0
  82. package/source/components/callout.tsx +65 -0
  83. package/source/components/canvas/connector.tsx +14 -0
  84. package/source/components/canvas/copy.ts +34 -0
  85. package/source/components/canvas/index.tsx +257 -0
  86. package/source/components/canvas/recorder.ts +36 -0
  87. package/source/components/date-time-field.tsx +77 -0
  88. package/source/components/flow-motion.tsx +109 -0
  89. package/source/components/icons.tsx +275 -0
  90. package/source/components/responsive-overlay.tsx +91 -0
  91. package/source/components/scenario-picker/copy.ts +5 -0
  92. package/source/components/scenario-picker/index.tsx +142 -0
  93. package/source/components/scroll-area.tsx +59 -0
  94. package/source/components/search-picker.tsx +127 -0
  95. package/source/components/segmented-control.tsx +123 -0
  96. package/source/components/skeleton.tsx +11 -0
  97. package/source/components/spinner.tsx +19 -0
  98. package/source/components/superxd-arrow.tsx +22 -0
  99. package/source/components/switch.tsx +45 -0
  100. package/source/components/text-field.tsx +81 -0
  101. package/source/components/thinking.tsx +16 -0
  102. package/source/components/ui/copy.ts +12 -0
  103. package/source/components/ui/display.tsx +276 -0
  104. package/source/components/ui/navigation.tsx +346 -0
  105. package/source/components/ui/portal-theme.tsx +28 -0
  106. package/source/components/ui/selection.tsx +336 -0
  107. package/source/lib/cn.ts +23 -0
  108. package/source/reusable/ai-sdk/index.ts +114 -0
  109. package/source/reusable/assistant-ui/index.tsx +266 -0
  110. package/source/reusable/core/attachments.ts +163 -0
  111. package/source/reusable/core/index.ts +417 -0
  112. package/source/reusable/custom/index.ts +90 -0
  113. package/source/reusable/generative/actions.ts +188 -0
  114. package/source/reusable/generative/copy.ts +47 -0
  115. package/source/reusable/generative/data.tsx +126 -0
  116. package/source/reusable/generative/index.tsx +517 -0
  117. package/source/reusable/generative/schema.ts +327 -0
  118. package/source/reusable/generative/timeline.tsx +214 -0
  119. package/source/reusable/generative/vocabulary.tsx +847 -0
  120. package/source/reusable/interactions/agent.ts +259 -0
  121. package/source/reusable/interactions/artifact.ts +236 -0
  122. package/source/reusable/interactions/context.tsx +38 -0
  123. package/source/reusable/interactions/copy.ts +117 -0
  124. package/source/reusable/interactions/feedback.ts +73 -0
  125. package/source/reusable/interactions/index.ts +11 -0
  126. package/source/reusable/interactions/presentation.tsx +483 -0
  127. package/source/reusable/interactions/store.ts +74 -0
  128. package/source/reusable/interactions/threads.ts +126 -0
  129. package/source/reusable/interactions/web.tsx +574 -0
  130. package/source/reusable/langgraph-review/index.ts +73 -0
  131. package/source/reusable/review/controller.ts +263 -0
  132. package/source/reusable/review/index.ts +47 -0
  133. package/source/reusable/review/types.ts +189 -0
  134. package/source/reusable/ui/index.ts +25 -0
  135. package/source/reusable/uploads/index.ts +48 -0
  136. package/source/reusable/web/attachments/copy.ts +23 -0
  137. package/source/reusable/web/attachments/index.tsx +233 -0
  138. package/source/reusable/web/copy.ts +22 -0
  139. package/source/reusable/web/index.tsx +470 -0
  140. package/source/reusable/web/message/copy.ts +26 -0
  141. package/source/reusable/web/message/index.tsx +388 -0
  142. package/source/reusable/web/message/streaming.ts +64 -0
  143. package/source/reusable/web/message/styles.css +21 -0
  144. package/source/reusable/web/review/copy.ts +78 -0
  145. package/source/reusable/web/review/flow.ts +24 -0
  146. package/source/reusable/web/review/index.tsx +506 -0
  147. package/source/reusable/web/styles.ts +2 -0
  148. package/source/styles/library.css +612 -0
  149. package/source/styles/theme.css +228 -0
  150. package/styles.css +3 -0
  151. package/styles.d.ts +1 -0
  152. package/types/components/avatar.d.ts +14 -0
  153. package/types/components/button.d.ts +36 -0
  154. package/types/components/callout.d.ts +19 -0
  155. package/types/components/canvas/connector.d.ts +2 -0
  156. package/types/components/canvas/copy.d.ts +34 -0
  157. package/types/components/canvas/index.d.ts +33 -0
  158. package/types/components/canvas/recorder.d.ts +10 -0
  159. package/types/components/date-time-field.d.ts +11 -0
  160. package/types/components/flow-motion.d.ts +38 -0
  161. package/types/components/icons.d.ts +138 -0
  162. package/types/components/responsive-overlay.d.ts +15 -0
  163. package/types/components/scenario-picker/copy.d.ts +5 -0
  164. package/types/components/scenario-picker/index.d.ts +14 -0
  165. package/types/components/scroll-area.d.ts +14 -0
  166. package/types/components/search-picker.d.ts +27 -0
  167. package/types/components/segmented-control.d.ts +23 -0
  168. package/types/components/skeleton.d.ts +4 -0
  169. package/types/components/spinner.d.ts +4 -0
  170. package/types/components/superxd-arrow.d.ts +5 -0
  171. package/types/components/switch.d.ts +8 -0
  172. package/types/components/text-field.d.ts +19 -0
  173. package/types/components/thinking.d.ts +8 -0
  174. package/types/components/ui/copy.d.ts +12 -0
  175. package/types/components/ui/display.d.ts +50 -0
  176. package/types/components/ui/navigation.d.ts +63 -0
  177. package/types/components/ui/portal-theme.d.ts +8 -0
  178. package/types/components/ui/selection.d.ts +37 -0
  179. package/types/lib/cn.d.ts +3 -0
  180. package/types/reusable/ai-sdk/index.d.ts +15 -0
  181. package/types/reusable/assistant-ui/index.d.ts +12 -0
  182. package/types/reusable/core/attachments.d.ts +54 -0
  183. package/types/reusable/core/index.d.ts +107 -0
  184. package/types/reusable/custom/index.d.ts +14 -0
  185. package/types/reusable/generative/actions.d.ts +45 -0
  186. package/types/reusable/generative/copy.d.ts +48 -0
  187. package/types/reusable/generative/data.d.ts +4 -0
  188. package/types/reusable/generative/index.d.ts +30 -0
  189. package/types/reusable/generative/schema.d.ts +303 -0
  190. package/types/reusable/generative/timeline.d.ts +21 -0
  191. package/types/reusable/generative/vocabulary.d.ts +34 -0
  192. package/types/reusable/interactions/agent.d.ts +98 -0
  193. package/types/reusable/interactions/artifact.d.ts +118 -0
  194. package/types/reusable/interactions/context.d.ts +130 -0
  195. package/types/reusable/interactions/copy.d.ts +115 -0
  196. package/types/reusable/interactions/feedback.d.ts +34 -0
  197. package/types/reusable/interactions/index.d.ts +10 -0
  198. package/types/reusable/interactions/presentation.d.ts +97 -0
  199. package/types/reusable/interactions/store.d.ts +29 -0
  200. package/types/reusable/interactions/threads.d.ts +38 -0
  201. package/types/reusable/interactions/web.d.ts +22 -0
  202. package/types/reusable/langgraph-review/index.d.ts +5 -0
  203. package/types/reusable/review/controller.d.ts +52 -0
  204. package/types/reusable/review/index.d.ts +12 -0
  205. package/types/reusable/review/types.d.ts +61 -0
  206. package/types/reusable/ui/index.d.ts +19 -0
  207. package/types/reusable/uploads/index.d.ts +11 -0
  208. package/types/reusable/web/attachments/copy.d.ts +25 -0
  209. package/types/reusable/web/attachments/index.d.ts +24 -0
  210. package/types/reusable/web/copy.d.ts +24 -0
  211. package/types/reusable/web/index.d.ts +41 -0
  212. package/types/reusable/web/message/copy.d.ts +27 -0
  213. package/types/reusable/web/message/index.d.ts +56 -0
  214. package/types/reusable/web/message/streaming.d.ts +27 -0
  215. package/types/reusable/web/review/copy.d.ts +72 -0
  216. package/types/reusable/web/review/flow.d.ts +3 -0
  217. package/types/reusable/web/review/index.d.ts +38 -0
  218. package/types/reusable/web/styles.d.ts +2 -0
  219. package/ui/index.js +4 -0
  220. package/uploads/index.js +34 -0
  221. package/web/index.js +931 -0
package/web/index.js ADDED
@@ -0,0 +1,931 @@
1
+ "use client";
2
+ import { i as e } from "../chunks/core-BCqVRLUy.js";
3
+ import { D as t, O as n, S as r, _ as i, c as a, d as o, n as s, o as c, s as l, t as u, u as d, v as f, w as p, x as m } from "../chunks/callout-DKMHSnjc.js";
4
+ import { c as h, d as g, f as _, h as v, l as y, m as b, n as x, p as S, r as C, u as w } from "../chunks/canvas-BJ15-XxE.js";
5
+ import { ViewTransition as T, addTransitionType as E, createContext as D, startTransition as O, useEffect as k, useId as A, useLayoutEffect as ee, useRef as j, useState as M, useSyncExternalStore as N } from "react";
6
+ import { Button as P, Checkbox as F, Disclosure as I, DisclosurePanel as L, FileTrigger as te, Label as ne, TextArea as re, TextField as ie } from "react-aria-components";
7
+ import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
8
+ //#region src/components/thinking.tsx
9
+ function ae({ className: e }) {
10
+ return /* @__PURE__ */ z("span", {
11
+ "aria-hidden": "true",
12
+ className: n("thinking-matrix", e),
13
+ children: Array.from({ length: 9 }, (e, t) => /* @__PURE__ */ z("i", {}, t))
14
+ });
15
+ }
16
+ //#endregion
17
+ //#region src/reusable/web/attachments/copy.ts
18
+ var V = {
19
+ label: "Attachments",
20
+ add: "Add files",
21
+ empty: "No files attached",
22
+ uploading: "Uploading",
23
+ ready: "Ready",
24
+ error: "Upload failed",
25
+ cancelled: "Upload stopped",
26
+ rejected: "Can’t attach this file",
27
+ remove: "Remove",
28
+ retry: "Retry upload",
29
+ cancel: "Stop upload",
30
+ type: "Choose a supported file type.",
31
+ size: "This file is empty or exceeds the size limit.",
32
+ count: "The file limit is reached. Remove a file before adding more.",
33
+ failed: "The file couldn’t upload. Retry or remove it; your message is still here.",
34
+ unavailable: "File uploads aren’t available in this connection.",
35
+ selected: "files selected",
36
+ image: "Image",
37
+ document: "Document",
38
+ file: "File"
39
+ };
40
+ //#endregion
41
+ //#region src/reusable/web/attachments/index.tsx
42
+ function H(e) {
43
+ return N(e.subscribe, e.getSnapshot, e.getSnapshot);
44
+ }
45
+ function U({ items: i, variant: a = "list", className: o, copy: l = V, previewImages: u = !1, onRemove: d, onRetry: p, onCancel: m }) {
46
+ return i.length ? /* @__PURE__ */ z("ul", {
47
+ "aria-label": l.label,
48
+ className: n("min-w-0 list-none p-0", a === "grid" ? "flex flex-wrap gap-3" : a === "inline" ? "flex flex-wrap gap-2" : "flex flex-col gap-2", o),
49
+ children: i.map((i) => {
50
+ let o = ["image/png", "image/jpeg"].includes(i.mediaType), h;
51
+ if (u && o && i.file) try {
52
+ h = e(i.file).url;
53
+ } catch {}
54
+ let g = o ? l.image : ["application/pdf", "text/plain"].includes(i.mediaType) ? l.document : l.file, _ = i.size < 1e3 ? `${i.size} B` : i.size < 1e6 ? `${Math.ceil(i.size / 1e3)} KB` : `${(i.size / 1e6).toFixed(1)} MB`;
55
+ return /* @__PURE__ */ B("li", {
56
+ className: n("flex min-w-0 flex-wrap gap-3 rounded-control border bg-surface px-control-md-x py-control-y", a === "inline" && "max-w-full", a === "grid" && "max-w-full grow basis-64 flex-col flex-nowrap", ["error", "rejected"].includes(i.status) ? "border-error-line" : "border-line-subtle"),
57
+ children: [
58
+ h ? /* @__PURE__ */ z("img", {
59
+ src: h,
60
+ alt: "",
61
+ loading: "lazy",
62
+ referrerPolicy: "no-referrer",
63
+ className: n("size-12 shrink-0 rounded-cell object-cover", a === "grid" && "h-32 w-full")
64
+ }) : /* @__PURE__ */ z("span", {
65
+ className: "flex size-control-sm shrink-0 items-center justify-center rounded-cell bg-surface-muted text-fg-subtle",
66
+ children: /* @__PURE__ */ z(f, {})
67
+ }),
68
+ /* @__PURE__ */ B("div", {
69
+ className: n("flex min-w-32 flex-1 flex-col gap-1", a === "grid" && "w-full min-w-0"),
70
+ children: [
71
+ /* @__PURE__ */ z("p", {
72
+ title: i.name,
73
+ className: "truncate type-label text-fg-emphasis",
74
+ children: i.name
75
+ }),
76
+ /* @__PURE__ */ B("p", {
77
+ className: "type-caption text-fg-subtle",
78
+ children: [
79
+ g,
80
+ " · ",
81
+ _
82
+ ]
83
+ }),
84
+ /* @__PURE__ */ B("p", {
85
+ className: "flex items-center gap-2 type-caption text-fg-subtle",
86
+ children: [i.status === "uploading" ? /* @__PURE__ */ z(c, {}) : null, l[i.status]]
87
+ }),
88
+ i.issue ? /* @__PURE__ */ z("p", {
89
+ className: "type-caption wrap-anywhere text-error",
90
+ children: l[i.issue]
91
+ }) : null
92
+ ]
93
+ }),
94
+ d || p && ["error", "cancelled"].includes(i.status) || m && i.status === "uploading" ? /* @__PURE__ */ B("div", {
95
+ className: "ml-auto flex shrink-0 items-start gap-1",
96
+ children: [
97
+ m && i.status === "uploading" ? /* @__PURE__ */ z(s, {
98
+ size: "sm",
99
+ variant: "ghost",
100
+ "aria-label": `${l.cancel}: ${i.name}`,
101
+ onPress: () => m(i.id),
102
+ children: l.cancel
103
+ }) : null,
104
+ p && ["error", "cancelled"].includes(i.status) ? /* @__PURE__ */ z(s, {
105
+ size: "icon-sm",
106
+ variant: "ghost",
107
+ "aria-label": `${l.retry}: ${i.name}`,
108
+ onPress: () => p(i.id),
109
+ children: /* @__PURE__ */ z(r, {})
110
+ }) : null,
111
+ d ? /* @__PURE__ */ z(s, {
112
+ size: "icon-sm",
113
+ variant: "ghost",
114
+ "aria-label": `${l.remove}: ${i.name}`,
115
+ onPress: () => d(i.id),
116
+ children: /* @__PURE__ */ z(t, {})
117
+ }) : null
118
+ ]
119
+ }) : null
120
+ ]
121
+ }, i.id);
122
+ })
123
+ }) : /* @__PURE__ */ z("p", {
124
+ className: n("type-caption text-fg-subtle", o),
125
+ children: l.empty
126
+ });
127
+ }
128
+ function W({ controller: e, isDisabled: t, description: r, copy: i = V, className: a }) {
129
+ let o = H(e), c = j(null);
130
+ return /* @__PURE__ */ B("div", {
131
+ className: n("flex min-w-0 flex-col gap-3", a),
132
+ children: [
133
+ /* @__PURE__ */ B("div", {
134
+ className: "flex flex-wrap items-center gap-3",
135
+ children: [/* @__PURE__ */ z(te, {
136
+ acceptedFileTypes: [...e.policy.mediaTypes],
137
+ allowsMultiple: !0,
138
+ onSelect: (n) => {
139
+ n && !t && e.add(Array.from(n).map((e) => ({
140
+ name: e.name,
141
+ mediaType: e.type,
142
+ size: e.size,
143
+ data: e
144
+ })));
145
+ },
146
+ children: /* @__PURE__ */ B(s, {
147
+ ref: c,
148
+ size: "sm",
149
+ isDisabled: t,
150
+ children: [/* @__PURE__ */ z(m, {}), i.add]
151
+ })
152
+ }), /* @__PURE__ */ z("p", {
153
+ className: "type-caption text-fg-subtle",
154
+ children: r
155
+ })]
156
+ }),
157
+ o.items.length ? /* @__PURE__ */ z(U, {
158
+ items: o.items,
159
+ onRemove: (t) => {
160
+ e.remove(t), c.current?.focus();
161
+ },
162
+ onRetry: (t) => {
163
+ e.retry(t), c.current?.focus();
164
+ },
165
+ onCancel: (t) => {
166
+ e.cancel(t), c.current?.focus();
167
+ }
168
+ }) : null,
169
+ /* @__PURE__ */ z("p", {
170
+ role: "status",
171
+ "aria-live": "polite",
172
+ className: n("type-caption text-error", !o.issue && "sr-only"),
173
+ children: o.issue ? i[o.issue] : o.items.length ? `${o.items.length} ${i.selected}. ${o.items.map((e) => `${e.name}: ${i[e.status]}`).join(". ")}` : ""
174
+ })
175
+ ]
176
+ });
177
+ }
178
+ //#endregion
179
+ //#region src/reusable/web/copy.ts
180
+ var oe = {
181
+ label: "Conversation",
182
+ emptyTitle: "What are you working on?",
183
+ emptyNote: "Start with a question, an idea or something you want to make clearer.",
184
+ user: "You",
185
+ assistant: "Assistant",
186
+ input: "Message",
187
+ placeholder: "Ask a question or describe what you need",
188
+ send: "Send message",
189
+ stop: "Stop response",
190
+ retry: "Restart response",
191
+ hint: "Enter to send · Shift + Enter for a new line",
192
+ touchHint: "Use Send to submit your message",
193
+ idle: "",
194
+ waiting: "Preparing a response",
195
+ streaming: "Responding",
196
+ complete: "Response ready",
197
+ cancelled: "Response stopped. Your partial response is still here.",
198
+ error: "The response couldn’t finish. Your message is still here.",
199
+ interrupted: "The connection ended before the response finished. Restart to try again."
200
+ }, G = {
201
+ forward: "flow-forward",
202
+ back: "flow-back",
203
+ swap: "flow-swap"
204
+ };
205
+ function K(e, t) {
206
+ return t > e ? G.forward : t < e ? G.back : null;
207
+ }
208
+ function q(e, t, n = O) {
209
+ if (!e) return t();
210
+ n(() => {
211
+ E(e), t();
212
+ });
213
+ }
214
+ var J = (e, t) => ({
215
+ [G.forward]: `flow-motion ${e}`,
216
+ [G.back]: `flow-motion ${e}`,
217
+ [G.swap]: `flow-motion ${t}`,
218
+ default: "none"
219
+ });
220
+ function Y({ children: e }) {
221
+ return /* @__PURE__ */ z(T, {
222
+ default: "none",
223
+ update: J("flow-card", "flow-card"),
224
+ children: e
225
+ });
226
+ }
227
+ function X({ children: e }) {
228
+ return /* @__PURE__ */ z(T, {
229
+ default: "none",
230
+ enter: J("flow-in", "flow-in-swap"),
231
+ exit: J("flow-out", "flow-out-swap"),
232
+ children: e
233
+ });
234
+ }
235
+ D(null);
236
+ //#endregion
237
+ //#region src/reusable/web/review/copy.ts
238
+ var Z = {
239
+ proposed: "Proposed changes",
240
+ before: "Current",
241
+ after: "Proposed",
242
+ reason: "Why this change",
243
+ applied: "Applied",
244
+ unchanged: "Unchanged",
245
+ viewChange: (e) => `View change: ${e}`,
246
+ selectChange: (e) => `Select change: ${e}`,
247
+ selected: (e, t) => `${e} of ${t} selected`,
248
+ review: (e) => `Review ${e} change${e === 1 ? "" : "s"}`,
249
+ apply: (e) => `Apply ${e} change${e === 1 ? "" : "s"}`,
250
+ complete: (e) => `${e} change${e === 1 ? "" : "s"} applied`,
251
+ kept: (e) => `${e} change${e === 1 ? "" : "s"} left unchanged.`,
252
+ confirm: "Confirm your decision",
253
+ summary: "Your selection",
254
+ target: "Apply to",
255
+ applying: "Applying",
256
+ checking: "Checking status",
257
+ noSelection: "Choose the changes you want to keep.",
258
+ approvalNote: "Only these changes will be applied. The rest stay as they are.",
259
+ deny: "Decline all",
260
+ declineRemaining: "Decline remaining",
261
+ declineRemainingTitle: "Decline the remaining changes?",
262
+ declineRemainingNote: "Applied changes are kept. The remaining changes will stay as they were.",
263
+ denyConfirm: "Decline these changes?",
264
+ denyAction: "Decline changes",
265
+ denyNote: "The current draft will stay as it is.",
266
+ denied: "Changes declined",
267
+ deniedNote: "The draft is unchanged.",
268
+ back: "Back to review",
269
+ retry: "Try again",
270
+ check: "Check status",
271
+ reload: "Review latest draft",
272
+ loading: "Preparing your review",
273
+ loadingNote: "The proposed changes are being loaded.",
274
+ loadError: "The review couldn’t be loaded.",
275
+ loadErrorNote: "Try again to see the proposed changes.",
276
+ uncertain: "Let’s check what happened.",
277
+ uncertainNote: "Your decision may have reached the server. Check its status before trying again. Your choices are kept.",
278
+ notApplied: "No changes recorded yet.",
279
+ notAppliedNote: "Your choices are kept. You can check again or confirm the same decision.",
280
+ conflict: "The draft has changed.",
281
+ conflictNote: "Nothing from this decision was applied. Review the latest draft before deciding again.",
282
+ blocked: "You can view this review.",
283
+ blockedNote: "You don’t have permission to apply or decline these changes.",
284
+ partial: (e, t) => `${e} applied · ${t} still to review`,
285
+ partialNote: "The applied changes are kept. Review the remaining changes before trying them again.",
286
+ empty: "No changes to review",
287
+ emptyNote: "The current draft is unchanged.",
288
+ unavailable: "Review not available",
289
+ announcement: {
290
+ ready: "Changes ready to review.",
291
+ confirming: "Decision ready to confirm.",
292
+ submitting: "Applying your decision.",
293
+ checking: "Checking your decision’s status.",
294
+ partial: "Some changes were applied. Review the remaining changes.",
295
+ complete: "Selected changes applied.",
296
+ denied: "Changes declined. The draft is unchanged.",
297
+ conflict: "The draft changed. Review it again.",
298
+ blocked: "You do not have permission to decide.",
299
+ uncertain: "Check status before retrying your decision.",
300
+ "load-error": "The review could not be loaded.",
301
+ loading: "Preparing your review.",
302
+ idle: ""
303
+ }
304
+ }, Q = {
305
+ idle: 0,
306
+ loading: 0,
307
+ "load-error": 0,
308
+ ready: 1,
309
+ partial: 1,
310
+ conflict: 1,
311
+ blocked: 1,
312
+ confirming: 2,
313
+ submitting: 2,
314
+ checking: 2,
315
+ uncertain: 2,
316
+ complete: 3,
317
+ denied: 3
318
+ }, $ = /* @__PURE__ */ new Set([
319
+ "ready",
320
+ "confirming",
321
+ "complete",
322
+ "denied"
323
+ ]);
324
+ function se(e, t) {
325
+ return $.has(t) ? K(Q[e], Q[t]) : null;
326
+ }
327
+ //#endregion
328
+ //#region src/reusable/web/review/index.tsx
329
+ function ce({ change: e, isSelected: t = !1, onSelectionChange: r, isDisabled: i = !1, isApplied: a = !1, isExpanded: s = !0, onExpandedChange: c, comparison: l = "stacked", copy: u = Z }) {
330
+ return /* @__PURE__ */ B(I, {
331
+ isExpanded: s,
332
+ onExpandedChange: c,
333
+ className: n("min-w-0 overflow-hidden rounded-surface border bg-surface shadow-control", t ? "border-line-emphasis" : "border-line-subtle"),
334
+ children: [/* @__PURE__ */ B("div", {
335
+ className: "flex min-w-0 items-center gap-3 px-5 py-4",
336
+ children: [
337
+ /* @__PURE__ */ B(F, {
338
+ isSelected: a || t,
339
+ onChange: r,
340
+ isDisabled: i || a || !r,
341
+ "aria-label": u.selectChange(e.title),
342
+ className: "group flex min-h-control-md min-w-0 flex-1 cursor-pointer items-center gap-3 rounded-control type-label text-fg-emphasis outline-none data-disabled:cursor-default data-focus-visible:focus-ring",
343
+ children: [/* @__PURE__ */ z("span", {
344
+ className: n("grid size-5 shrink-0 place-items-center rounded-control border", t ? "border-brand bg-brand text-on-brand" : "border-line-emphasis bg-surface", a && "border-success-line bg-success-subtle text-success"),
345
+ children: a || t ? /* @__PURE__ */ z(d, { className: "size-3.5" }) : null
346
+ }), /* @__PURE__ */ z("span", {
347
+ className: "min-w-0 break-words",
348
+ children: e.title
349
+ })]
350
+ }),
351
+ a ? /* @__PURE__ */ z("span", {
352
+ className: "rounded-pill bg-success-subtle px-2.5 py-1 type-caption text-success",
353
+ children: u.applied
354
+ }) : null,
355
+ /* @__PURE__ */ z(P, {
356
+ slot: "trigger",
357
+ "aria-label": u.viewChange(e.title),
358
+ className: "grid size-control-md shrink-0 place-items-center rounded-control text-fg-subtle outline-none data-focus-visible:focus-ring data-hovered:bg-surface-muted",
359
+ children: /* @__PURE__ */ z(o, { className: n("transition-transform duration-(--duration-fast) ease-standard", s && "rotate-180") })
360
+ })
361
+ ]
362
+ }), /* @__PURE__ */ B(L, {
363
+ className: "border-t border-line-subtle",
364
+ children: [/* @__PURE__ */ B("div", {
365
+ className: n("grid min-w-0", l === "columns" && "grid-cols-2"),
366
+ children: [/* @__PURE__ */ z(le, {
367
+ label: u.before,
368
+ muted: !0,
369
+ children: e.before
370
+ }), /* @__PURE__ */ z(le, {
371
+ label: u.after,
372
+ children: e.after
373
+ })]
374
+ }), /* @__PURE__ */ B("p", {
375
+ className: "border-t border-line-subtle px-5 py-3 type-caption text-fg-subtle",
376
+ children: [/* @__PURE__ */ B("span", {
377
+ className: "sr-only",
378
+ children: [u.reason, ": "]
379
+ }), e.reason]
380
+ })]
381
+ })]
382
+ });
383
+ }
384
+ function le({ label: e, children: t, muted: r = !1 }) {
385
+ return /* @__PURE__ */ B("div", {
386
+ className: n("min-w-0 px-5 py-4", r ? "bg-surface-muted" : "bg-surface"),
387
+ children: [/* @__PURE__ */ z("p", {
388
+ className: "mb-2 font-mono type-caption text-fg-subtle",
389
+ children: e
390
+ }), /* @__PURE__ */ z("p", {
391
+ className: "type-body break-words text-fg",
392
+ children: t
393
+ })]
394
+ });
395
+ }
396
+ function ue({ snapshot: e, headingLevel: t = 2, onReview: n, onDecline: r, onConfirm: i, onBack: a, onRecover: o, onReload: c, copy: l = Z }) {
397
+ let f = t === 2 ? "h2" : "h3", { record: p, decision: m, status: h } = e, g = m?.changeIds ?? e.selectedIds, _ = p?.remainingIds.length ?? 0, v = h === "confirming" || h === "submitting", y = m?.choice === "deny", b = v ? y ? p?.appliedIds.length ? l.declineRemainingTitle : l.denyConfirm : l.confirm : h === "complete" ? l.complete(p?.appliedIds.length ?? 0) : h === "denied" ? l.denied : l.summary, x = h === "ready" || h === "partial", S = h === "complete", C = v ? "confirm" : S || h === "denied" ? "outcome" : "choose";
398
+ return /* @__PURE__ */ z(Y, { children: /* @__PURE__ */ z("section", {
399
+ "aria-label": l.summary,
400
+ className: "min-w-0 rounded-surface border border-line-subtle bg-surface p-5",
401
+ children: /* @__PURE__ */ z(X, { children: /* @__PURE__ */ B("div", {
402
+ className: "flex min-w-0 flex-col gap-5",
403
+ children: [
404
+ /* @__PURE__ */ B("div", {
405
+ className: "flex items-center gap-3",
406
+ children: [S ? /* @__PURE__ */ z("span", {
407
+ className: "flex size-8 shrink-0 animate-done-in items-center justify-center rounded-pill bg-done text-on-done",
408
+ children: /* @__PURE__ */ z(d, { className: "animate-done-in [animation-delay:var(--duration-pop)]" })
409
+ }) : null, /* @__PURE__ */ z(f, {
410
+ tabIndex: -1,
411
+ "data-review-focus": !0,
412
+ className: "type-heading text-fg-emphasis outline-none",
413
+ children: b
414
+ })]
415
+ }),
416
+ p && !["complete", "denied"].includes(h) ? /* @__PURE__ */ B("div", {
417
+ className: "flex min-w-0 flex-col gap-1",
418
+ children: [/* @__PURE__ */ z("p", {
419
+ className: "font-mono type-caption text-fg-subtle",
420
+ children: l.target
421
+ }), /* @__PURE__ */ z("p", {
422
+ className: "type-label break-words text-fg-emphasis",
423
+ children: p.proposal.destination
424
+ })]
425
+ }) : null,
426
+ x || v && !y ? /* @__PURE__ */ B("div", {
427
+ className: "flex flex-col gap-3",
428
+ children: [
429
+ /* @__PURE__ */ z("p", {
430
+ className: "type-label text-fg-emphasis",
431
+ children: l.selected(g.length, _)
432
+ }),
433
+ g.length ? /* @__PURE__ */ z("ul", {
434
+ className: "flex flex-col gap-2 type-body text-fg",
435
+ children: p?.proposal.changes.filter((e) => g.includes(e.id)).map((e) => /* @__PURE__ */ B("li", {
436
+ className: "flex items-start gap-2",
437
+ children: [/* @__PURE__ */ z(d, { className: "mt-0.5" }), /* @__PURE__ */ z("span", {
438
+ className: "min-w-0 break-words",
439
+ children: e.title
440
+ })]
441
+ }, e.id))
442
+ }) : /* @__PURE__ */ z("p", {
443
+ className: "type-body text-fg-subtle",
444
+ children: l.noSelection
445
+ }),
446
+ v ? /* @__PURE__ */ z("p", {
447
+ className: "type-body text-fg-subtle",
448
+ children: l.approvalNote
449
+ }) : null
450
+ ]
451
+ }) : null,
452
+ v && y ? /* @__PURE__ */ z("p", {
453
+ className: "type-body text-fg-subtle",
454
+ children: p?.appliedIds.length ? l.declineRemainingNote : l.denyNote
455
+ }) : null,
456
+ e.issue === "not-applied" ? /* @__PURE__ */ z(u, {
457
+ tone: "attention",
458
+ title: l.notApplied,
459
+ children: l.notAppliedNote
460
+ }) : null,
461
+ h === "uncertain" || h === "checking" ? /* @__PURE__ */ z(u, {
462
+ tone: "attention",
463
+ title: l.uncertain,
464
+ children: l.uncertainNote
465
+ }) : null,
466
+ h === "conflict" ? /* @__PURE__ */ z(u, {
467
+ tone: "attention",
468
+ title: l.conflict,
469
+ children: l.conflictNote
470
+ }) : null,
471
+ h === "blocked" ? /* @__PURE__ */ z(u, {
472
+ title: l.blocked,
473
+ children: l.blockedNote
474
+ }) : null,
475
+ h === "partial" ? /* @__PURE__ */ z(u, {
476
+ tone: "attention",
477
+ title: l.partial(p?.appliedIds.length ?? 0, _),
478
+ children: l.partialNote
479
+ }) : null,
480
+ h === "complete" ? /* @__PURE__ */ z(u, {
481
+ tone: "success",
482
+ children: l.kept((p?.proposal.changes.length ?? 0) - (p?.appliedIds.length ?? 0))
483
+ }) : null,
484
+ h === "denied" ? /* @__PURE__ */ z("p", {
485
+ className: "type-body text-fg-subtle",
486
+ children: l.deniedNote
487
+ }) : null,
488
+ /* @__PURE__ */ B("div", {
489
+ className: "flex flex-col gap-2",
490
+ children: [
491
+ x ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(s, {
492
+ variant: "primary",
493
+ isDisabled: !e.selectedIds.length,
494
+ onPress: n,
495
+ children: l.review(e.selectedIds.length)
496
+ }), /* @__PURE__ */ z(s, {
497
+ variant: "ghost",
498
+ onPress: r,
499
+ children: p?.appliedIds.length ? l.declineRemaining : l.deny
500
+ })] }) : null,
501
+ v ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z(s, {
502
+ variant: "primary",
503
+ isPending: h === "submitting",
504
+ pendingLabel: l.applying,
505
+ onPress: i,
506
+ children: y ? l.denyAction : l.apply(g.length)
507
+ }), e.issue === "not-applied" ? /* @__PURE__ */ z(s, {
508
+ variant: "secondary",
509
+ onPress: o,
510
+ children: l.check
511
+ }) : /* @__PURE__ */ z(s, {
512
+ variant: "ghost",
513
+ isDisabled: h === "submitting",
514
+ onPress: a,
515
+ children: l.back
516
+ })] }) : null,
517
+ h === "uncertain" || h === "checking" ? /* @__PURE__ */ z(s, {
518
+ isPending: h === "checking",
519
+ pendingLabel: l.checking,
520
+ onPress: o,
521
+ children: l.check
522
+ }) : null,
523
+ h === "conflict" ? /* @__PURE__ */ z(s, {
524
+ onPress: c,
525
+ children: l.reload
526
+ }) : null
527
+ ]
528
+ })
529
+ ]
530
+ }) }, C)
531
+ }) });
532
+ }
533
+ function de(e) {
534
+ let t = N(e.subscribe, e.getSnapshot, e.getSnapshot);
535
+ return k(() => {
536
+ e.load();
537
+ }, [e]), t;
538
+ }
539
+ function fe(e) {
540
+ let [t, n] = M(e.getSnapshot);
541
+ return k(() => {
542
+ let t = e.getSnapshot(), r = () => {
543
+ let r = e.getSnapshot(), i = se(t.status, r.status);
544
+ t = r, q(i, () => n(r));
545
+ }, i = e.subscribe(r);
546
+ return r(), e.load(), i;
547
+ }, [e]), t;
548
+ }
549
+ function pe(e) {
550
+ return /* @__PURE__ */ z(x, { children: /* @__PURE__ */ z(me, { ...e }) });
551
+ }
552
+ function me({ controller: e, copy: t = Z, className: r }) {
553
+ let i = fe(e), a = j(null), o = j(!1), [l, d] = M(!1), [f, p] = M({}), m = A();
554
+ k(() => {
555
+ if (!a.current) return;
556
+ let e = a.current, t = new ResizeObserver(([t]) => {
557
+ let n = Number.parseFloat(getComputedStyle(document.documentElement).fontSize), r = Number.parseFloat(getComputedStyle(e).getPropertyValue("--breakpoint-md")) || 48;
558
+ d((t?.contentRect.width ?? 0) >= r * n);
559
+ });
560
+ return t.observe(e), () => t.disconnect();
561
+ }, []), ee(() => {
562
+ o.current && ![
563
+ "submitting",
564
+ "checking",
565
+ "loading"
566
+ ].includes(i.status) && ((a.current?.contains(document.activeElement) || document.activeElement === document.body) && a.current?.querySelector("[data-review-focus]")?.focus(), o.current = !1);
567
+ }, [i.status]);
568
+ function g(e) {
569
+ e() && (o.current = !0);
570
+ }
571
+ let { record: _, status: v } = i, y = v === "idle" || v === "loading" ? "loading" : v === "load-error" ? "error" : "review", b = [
572
+ "idle",
573
+ "loading",
574
+ "submitting",
575
+ "checking"
576
+ ].includes(v), x = {
577
+ idle: h.loading,
578
+ loading: h.loading,
579
+ ready: h.review,
580
+ confirming: h.confirm,
581
+ submitting: h.applying,
582
+ checking: h.checking,
583
+ "load-error": h.failed,
584
+ uncertain: h.uncertain,
585
+ conflict: h.conflict,
586
+ blocked: h.blocked,
587
+ partial: h.partial,
588
+ complete: h.complete,
589
+ denied: h.denied
590
+ }[v];
591
+ return /* @__PURE__ */ z(C, {
592
+ phase: `review-${v}-${i.issue ?? ""}`,
593
+ frameClassName: r,
594
+ label: x,
595
+ terminal: v === "complete" || v === "denied",
596
+ children: /* @__PURE__ */ B("div", {
597
+ ref: a,
598
+ className: n("@container w-full min-w-0 text-fg", r),
599
+ "aria-busy": b,
600
+ "data-review-status": v,
601
+ children: [
602
+ /* @__PURE__ */ z("p", {
603
+ className: "sr-only",
604
+ role: "status",
605
+ "aria-live": "polite",
606
+ children: t.announcement[v]
607
+ }),
608
+ /* @__PURE__ */ B("header", {
609
+ className: "mb-6 flex flex-col gap-2",
610
+ children: [/* @__PURE__ */ z("p", {
611
+ className: "font-mono type-caption text-fg-subtle",
612
+ children: t.proposed
613
+ }), /* @__PURE__ */ z("h2", {
614
+ id: m,
615
+ className: "type-title text-fg-emphasis",
616
+ children: _?.proposal.title ?? t.loading
617
+ })]
618
+ }),
619
+ /* @__PURE__ */ z(X, { children: /* @__PURE__ */ z("div", {
620
+ className: "min-w-0",
621
+ children: v === "idle" || v === "loading" ? /* @__PURE__ */ B("div", {
622
+ className: "flex min-h-64 items-center justify-center gap-3 rounded-surface border border-line-subtle bg-surface",
623
+ children: [/* @__PURE__ */ z(c, {}), /* @__PURE__ */ z("p", {
624
+ className: "type-body text-fg-subtle",
625
+ children: t.loadingNote
626
+ })]
627
+ }) : v === "load-error" ? /* @__PURE__ */ z(u, {
628
+ tone: "error",
629
+ title: t.loadError,
630
+ actions: /* @__PURE__ */ z(s, {
631
+ onPress: () => g(e.load),
632
+ children: t.retry
633
+ }),
634
+ children: t.loadErrorNote
635
+ }) : _ && !_.proposal.changes.length ? /* @__PURE__ */ z(u, {
636
+ title: t.empty,
637
+ children: t.emptyNote
638
+ }) : /* @__PURE__ */ B("div", {
639
+ className: "grid min-w-0 items-start gap-6 @3xl:grid-cols-3",
640
+ children: [/* @__PURE__ */ z("div", {
641
+ className: "flex min-w-0 flex-col gap-3 @3xl:col-span-2",
642
+ children: /* @__PURE__ */ z("ul", {
643
+ "aria-labelledby": m,
644
+ className: "flex min-w-0 flex-col gap-3",
645
+ children: _?.proposal.changes.map((n) => /* @__PURE__ */ z("li", { children: /* @__PURE__ */ z(ce, {
646
+ change: n,
647
+ isSelected: i.selectedIds.includes(n.id),
648
+ isApplied: _.appliedIds.includes(n.id),
649
+ isDisabled: !["ready", "partial"].includes(v) || !_.remainingIds.includes(n.id),
650
+ onSelectionChange: (t) => e.select(n.id, t),
651
+ isExpanded: f[n.id] ?? !0,
652
+ onExpandedChange: (e) => p((t) => ({
653
+ ...t,
654
+ [n.id]: e
655
+ })),
656
+ comparison: l ? "columns" : "stacked",
657
+ copy: t
658
+ }) }, `${_.proposal.id}-${n.id}`))
659
+ })
660
+ }), /* @__PURE__ */ z("div", {
661
+ className: "min-w-0 @3xl:sticky @3xl:top-6",
662
+ children: /* @__PURE__ */ z(ue, {
663
+ snapshot: i,
664
+ headingLevel: 3,
665
+ onReview: () => g(() => e.prepare("approve")),
666
+ onDecline: () => g(() => e.prepare("deny")),
667
+ onConfirm: () => g(e.submit),
668
+ onBack: () => g(e.back),
669
+ onRecover: () => g(e.recover),
670
+ onReload: () => g(e.load),
671
+ copy: t
672
+ })
673
+ })]
674
+ })
675
+ }) }, y)
676
+ ]
677
+ })
678
+ });
679
+ }
680
+ //#endregion
681
+ //#region src/reusable/web/index.tsx
682
+ function he(e) {
683
+ return N(e.subscribe, e.getSnapshot, e.getSnapshot);
684
+ }
685
+ function ge({ snapshot: e, actions: t, copy: o = oe, className: c, renderMessage: d, footer: f, attachmentPicker: m, draftFiles: h = [], isAttachmentBlocked: x = !1, onSent: C, messageCopy: w = v, writeText: T, scrollable: E = !1, autoScroll: D = !0, suggestions: O = [], defaultDraft: k = "", defaultEditing: N }) {
686
+ let [P, F] = M(k), [I, L] = M(N), [te, R] = M(!1), V = j(null), H = j(null), W = j(D), [G, K] = M(!1);
687
+ ee(() => {
688
+ E && D && W.current && H.current && (H.current.scrollTop = H.current.scrollHeight);
689
+ }, [
690
+ e.messages,
691
+ e.status,
692
+ E,
693
+ D
694
+ ]);
695
+ let q = () => {
696
+ W.current = !0, K(!1), H.current && (H.current.scrollTop = H.current.scrollHeight);
697
+ }, J = () => V.current?.querySelector("[data-chat-composer] textarea")?.focus({ preventScroll: !0 }), Y = () => {
698
+ L(void 0), window.requestAnimationFrame(J);
699
+ }, X = A(), Z = A(), Q = e.status === "waiting" || e.status === "streaming", $ = [
700
+ "error",
701
+ "interrupted",
702
+ "cancelled"
703
+ ].includes(e.status), se = () => {
704
+ x || Q || t.send(P, h) && (F(""), q(), C?.());
705
+ };
706
+ return /* @__PURE__ */ B("section", {
707
+ ref: V,
708
+ "aria-labelledby": X,
709
+ className: n("relative flex min-w-0 flex-col gap-6 rounded-surface bg-surface p-4 sm:p-6", E && "h-conversation", c),
710
+ children: [
711
+ /* @__PURE__ */ z("h2", {
712
+ id: X,
713
+ className: "sr-only",
714
+ children: o.label
715
+ }),
716
+ /* @__PURE__ */ z("div", {
717
+ ref: H,
718
+ role: E ? "region" : void 0,
719
+ "aria-label": E ? `${w.transcript}: ${o.label}` : void 0,
720
+ tabIndex: E ? 0 : void 0,
721
+ onScroll: () => {
722
+ let e = H.current;
723
+ if (!e) return;
724
+ let t = e.scrollHeight - e.scrollTop - e.clientHeight < 24;
725
+ W.current = t, K(!t);
726
+ },
727
+ className: n("min-w-0", E && "min-h-0 flex-1 overflow-x-hidden overflow-y-auto rounded-cell outline-none focus-visible:focus-ring"),
728
+ children: e.messages.length ? /* @__PURE__ */ z("ol", {
729
+ className: "flex min-w-0 list-none flex-col gap-6 p-0",
730
+ children: e.messages.map((a, c) => /* @__PURE__ */ B("li", {
731
+ "aria-label": a.role === "user" ? o.user : o.assistant,
732
+ className: "flex min-w-0 flex-col gap-2",
733
+ children: [
734
+ /* @__PURE__ */ z("p", {
735
+ className: "font-mono type-caption text-fg-subtle",
736
+ children: a.role === "user" ? o.user : o.assistant
737
+ }),
738
+ I === a.id && t.edit ? /* @__PURE__ */ z(_, {
739
+ autoFocus: te,
740
+ text: a.text,
741
+ hasFiles: !!a.files?.length,
742
+ isDisabled: Q,
743
+ onCancel: Y,
744
+ copy: w,
745
+ onSave: (e) => {
746
+ let n = t.edit?.(a.id, e) ?? !1;
747
+ return n && (Y(), q()), n;
748
+ }
749
+ }) : /* @__PURE__ */ B("div", {
750
+ className: n("min-w-0 type-body wrap-anywhere whitespace-pre-wrap text-fg-emphasis", a.role === "user" && "self-end rounded-surface bg-surface-muted px-control-md-x py-control-y"),
751
+ children: [d ? d(a) : a.role === "assistant" && e.status === "streaming" && c === e.messages.length - 1 ? /* @__PURE__ */ z(b, {
752
+ text: a.text,
753
+ copy: w,
754
+ writeText: T
755
+ }) : a.role === "assistant" ? /* @__PURE__ */ z(S, {
756
+ text: a.text,
757
+ isStreaming: Q,
758
+ copy: w,
759
+ writeText: T
760
+ }) : a.text, a.role === "assistant" && !a.text && Q ? /* @__PURE__ */ z(ae, {}) : null]
761
+ }),
762
+ a.files?.length ? /* @__PURE__ */ z(U, {
763
+ items: a.files.map((e) => ({
764
+ id: e.id,
765
+ name: e.name,
766
+ mediaType: e.mediaType,
767
+ size: e.size,
768
+ status: "ready",
769
+ file: e
770
+ })),
771
+ variant: "inline"
772
+ }) : null,
773
+ I === a.id ? null : /* @__PURE__ */ B("div", {
774
+ className: "flex min-w-0 flex-wrap items-center gap-1",
775
+ children: [
776
+ a.role === "assistant" && a.text ? /* @__PURE__ */ z(g, {
777
+ text: a.text,
778
+ iconOnly: !0,
779
+ isDisabled: Q,
780
+ copy: w,
781
+ writeText: T
782
+ }) : null,
783
+ a.role === "user" && e.capabilities.edit && t.edit ? /* @__PURE__ */ z(s, {
784
+ size: "icon-sm",
785
+ variant: "ghost",
786
+ "aria-label": w.edit,
787
+ isDisabled: Q,
788
+ onPress: () => {
789
+ R(!0), L(a.id);
790
+ },
791
+ children: /* @__PURE__ */ z(i, {})
792
+ }) : null,
793
+ a.role === "assistant" && e.capabilities.regenerate && t.regenerate ? /* @__PURE__ */ z(s, {
794
+ size: "icon-sm",
795
+ variant: "ghost",
796
+ "aria-label": w.regenerate,
797
+ isDisabled: Q,
798
+ onPress: () => {
799
+ t.regenerate?.(a.id) && (J(), q());
800
+ },
801
+ children: /* @__PURE__ */ z(r, {})
802
+ }) : null,
803
+ e.capabilities.branches && e.branches?.[a.id] && t.selectBranch ? /* @__PURE__ */ z(y, {
804
+ branch: e.branches[a.id] ?? {
805
+ index: 0,
806
+ count: 0
807
+ },
808
+ isDisabled: Q,
809
+ copy: w,
810
+ onPrevious: () => {
811
+ t.selectBranch?.(a.id, "previous") && J();
812
+ },
813
+ onNext: () => {
814
+ t.selectBranch?.(a.id, "next") && J();
815
+ }
816
+ }) : null
817
+ ]
818
+ })
819
+ ]
820
+ }, a.id))
821
+ }) : /* @__PURE__ */ B("div", {
822
+ className: "flex min-h-48 flex-col items-center justify-center gap-2 text-center",
823
+ children: [
824
+ /* @__PURE__ */ z("h3", {
825
+ className: "type-heading text-fg-emphasis",
826
+ children: o.emptyTitle
827
+ }),
828
+ /* @__PURE__ */ z("p", {
829
+ className: "max-w-sm type-body text-fg-subtle",
830
+ children: o.emptyNote
831
+ }),
832
+ O.length ? /* @__PURE__ */ z("div", {
833
+ className: "mt-3 flex flex-wrap justify-center gap-2",
834
+ children: O.map((t) => /* @__PURE__ */ z(s, {
835
+ size: "sm",
836
+ isDisabled: !e.capabilities.send,
837
+ className: "h-auto min-h-control-sm max-w-full py-2 whitespace-normal",
838
+ onPress: () => {
839
+ F(t), window.requestAnimationFrame(J);
840
+ },
841
+ children: t
842
+ }, t))
843
+ }) : null
844
+ ]
845
+ })
846
+ }),
847
+ E && G ? /* @__PURE__ */ B(s, {
848
+ size: "sm",
849
+ className: "self-center shadow-control",
850
+ onPress: () => {
851
+ q(), J();
852
+ },
853
+ children: [/* @__PURE__ */ z(l, {}), w.latest]
854
+ }) : null,
855
+ /* @__PURE__ */ B("p", {
856
+ role: "status",
857
+ "aria-live": "polite",
858
+ className: n("flex items-center gap-2 font-mono type-caption text-fg-subtle", $ && "sr-only"),
859
+ children: [e.status === "complete" ? /* @__PURE__ */ z("span", {
860
+ "aria-hidden": "true",
861
+ className: "size-1.5 shrink-0 rounded-pill bg-done"
862
+ }) : null, o[e.status]]
863
+ }),
864
+ e.capabilities.attachments ? m : null,
865
+ $ ? /* @__PURE__ */ z(u, {
866
+ tone: e.status === "cancelled" ? "neutral" : "attention",
867
+ actions: e.capabilities.retry ? /* @__PURE__ */ z(s, {
868
+ size: "sm",
869
+ onPress: () => {
870
+ t.retry() && J();
871
+ },
872
+ children: o.retry
873
+ }) : void 0,
874
+ children: o[e.status]
875
+ }) : null,
876
+ /* @__PURE__ */ B("div", {
877
+ "data-chat-composer": !0,
878
+ className: "conversation-composer min-w-0 rounded-surface border border-line-input bg-surface shadow-control focus-within:border-line-emphasis has-data-focus-visible:border-focus has-data-focus-visible:ring-2 has-data-focus-visible:ring-focus/15",
879
+ children: [/* @__PURE__ */ B(ie, {
880
+ value: P,
881
+ onChange: F,
882
+ isDisabled: !e.capabilities.send || !!I,
883
+ className: "min-w-0",
884
+ children: [/* @__PURE__ */ z(ne, {
885
+ className: "sr-only",
886
+ children: o.input
887
+ }), /* @__PURE__ */ z(re, {
888
+ rows: 3,
889
+ maxLength: 2e4,
890
+ "aria-describedby": Z,
891
+ placeholder: o.placeholder,
892
+ className: "max-h-48 min-h-24 w-full resize-none rounded-surface bg-transparent px-control-md-x pt-control-y pb-2 type-body text-fg-emphasis outline-none placeholder:text-fg-subtle",
893
+ onKeyDown: (e) => {
894
+ e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && !window.matchMedia("(pointer: coarse)").matches && (e.preventDefault(), !Q && !I && se());
895
+ }
896
+ })]
897
+ }), /* @__PURE__ */ B("div", {
898
+ className: "flex flex-wrap items-center justify-between gap-3 px-3 pb-3",
899
+ children: [/* @__PURE__ */ B("p", {
900
+ id: Z,
901
+ className: "conversation-key-hint type-caption text-fg-subtle",
902
+ children: [/* @__PURE__ */ z("span", {
903
+ className: "conversation-desktop-hint",
904
+ children: o.hint
905
+ }), /* @__PURE__ */ z("span", {
906
+ className: "conversation-touch-hint",
907
+ children: o.touchHint
908
+ })]
909
+ }), Q && e.capabilities.cancel ? /* @__PURE__ */ B(s, {
910
+ size: "sm",
911
+ className: "ml-auto",
912
+ onPress: () => {
913
+ t.cancel(), J();
914
+ },
915
+ children: [/* @__PURE__ */ z(p, {}), o.stop]
916
+ }) : /* @__PURE__ */ B(s, {
917
+ variant: "primary",
918
+ className: "ml-auto",
919
+ size: "sm",
920
+ isDisabled: Q || !!I || x || !P.trim() && !h.length || !e.capabilities.send,
921
+ onPress: se,
922
+ children: [/* @__PURE__ */ z(a, {}), o.send]
923
+ })]
924
+ })]
925
+ }),
926
+ f
927
+ ]
928
+ });
929
+ }
930
+ //#endregion
931
+ export { U as AttachmentList, W as AttachmentPicker, y as BranchPicker, ge as Chat, w as CodeBlock, g as CopyButton, pe as DraftReview, _ as MessageEditor, S as MessageMarkdown, ce as ReviewChangeCard, ue as ReviewDecisionPanel, b as StreamingMessage, V as attachmentCopy, v as messageCopy, Z as reviewCopy, H as useAttachments, he as useChatController, de as useReview };