@actioneer/ads 0.5.4 → 0.5.6

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 (93) hide show
  1. package/components/accordion.js +15 -15
  2. package/components/agent-icon.d.ts +64 -0
  3. package/components/agent-icon.js +251 -0
  4. package/components/ai-elements/agent-trace.d.ts +8 -1
  5. package/components/ai-elements/agent-trace.js +164 -129
  6. package/components/ai-elements/chain-of-thought-icon.d.ts +42 -0
  7. package/components/ai-elements/chain-of-thought-icon.js +283 -0
  8. package/components/ai-elements/chain-of-thought.js +7 -7
  9. package/components/ai-elements/chart.js +38 -35
  10. package/components/ai-elements/index.d.ts +1 -0
  11. package/components/ai-elements/inline-citation.js +40 -40
  12. package/components/ai-elements/message.js +5 -5
  13. package/components/ai-elements/queue.js +1 -1
  14. package/components/ai-elements/research-activity.d.ts +2 -0
  15. package/components/ai-elements/research-activity.js +79 -81
  16. package/components/ai-elements/task-progress.js +2 -2
  17. package/components/ai-elements/tool.d.ts +4 -2
  18. package/components/ai-elements/tool.js +74 -54
  19. package/components/ai-elements/transcript.js +1 -1
  20. package/components/alert.js +1 -1
  21. package/components/answer.d.ts +2644 -311
  22. package/components/answer.js +1776 -371
  23. package/components/assistant-ui/answer-tool-ui.js +27 -28
  24. package/components/assistant-ui/chain-of-thought.d.ts +7 -2
  25. package/components/assistant-ui/composer-harness.js +20 -16
  26. package/components/assistant-ui/follow-up-suggestions.d.ts +5 -1
  27. package/components/assistant-ui/follow-up-suggestions.js +47 -19
  28. package/components/assistant-ui/reasoning.js +35 -31
  29. package/components/assistant-ui/tool-fallback.js +125 -122
  30. package/components/assistant-ui/tool-group.d.ts +3 -1
  31. package/components/assistant-ui/tool-group.js +48 -43
  32. package/components/audio-waveform.js +14 -14
  33. package/components/autocomplete.js +52 -48
  34. package/components/avatar.js +58 -44
  35. package/components/badge.js +3 -3
  36. package/components/brand-texture.js +1 -1
  37. package/components/breadcrumbs.d.ts +27 -1
  38. package/components/breadcrumbs.js +94 -42
  39. package/components/button.js +15 -15
  40. package/components/carousel.js +10 -10
  41. package/components/chart.js +77 -77
  42. package/components/chip.js +3 -3
  43. package/components/code-block.d.ts +39 -17
  44. package/components/code-block.js +153 -104
  45. package/components/command-palette.js +27 -25
  46. package/components/connector-card.js +2 -2
  47. package/components/dropdown.js +65 -61
  48. package/components/empty-state.js +15 -15
  49. package/components/field.js +16 -16
  50. package/components/index.d.ts +4 -0
  51. package/components/index.js +525 -478
  52. package/components/infinite-canvas.js +60 -60
  53. package/components/kbd.js +6 -6
  54. package/components/link.js +6 -6
  55. package/components/modal.js +22 -20
  56. package/components/page-header.js +1 -1
  57. package/components/pagination.js +22 -22
  58. package/components/pixel-blast-svg.js +1 -1
  59. package/components/pixel-icon.d.ts +31 -0
  60. package/components/pixel-icon.js +733 -0
  61. package/components/popover.js +46 -42
  62. package/components/ripple.d.ts +29 -0
  63. package/components/ripple.js +17 -0
  64. package/components/segmented.js +24 -23
  65. package/components/select.js +71 -67
  66. package/components/selection-action-bar.js +22 -22
  67. package/components/sidebar.d.ts +11 -3
  68. package/components/sidebar.js +161 -148
  69. package/components/stepper.d.ts +2 -0
  70. package/components/stepper.js +80 -43
  71. package/components/table.d.ts +7 -0
  72. package/components/table.js +223 -155
  73. package/components/tabs.d.ts +3 -1
  74. package/components/tabs.js +165 -144
  75. package/components/textarea.js +10 -8
  76. package/components/toast.js +48 -46
  77. package/components/tooltip.js +61 -59
  78. package/components/tree.js +44 -41
  79. package/components/typography.d.ts +1 -1
  80. package/components/typography.js +25 -25
  81. package/components/viz-charts.js +133 -133
  82. package/fonts/aribau-grotesk-500.otf +0 -0
  83. package/fonts/aribau-grotesk-600.woff2 +0 -0
  84. package/fonts.css +6 -4
  85. package/lib/icons.d.ts +411 -402
  86. package/lib/icons.js +109 -107
  87. package/llms.txt +98 -8
  88. package/manifest.json +1012 -96
  89. package/package.json +5 -5
  90. package/styles.css +206 -81
  91. package/theme.css +200 -77
  92. package/fonts/aribau-grotesk-400.otf +0 -0
  93. package/fonts/aribau-grotesk-700.otf +0 -0
@@ -1,56 +1,88 @@
1
1
  "use client";
2
- import { jsxs as i, jsx as a } from "react/jsx-runtime";
3
- import * as u from "react";
4
- import { cva as L } from "class-variance-authority";
2
+ import { jsxs as n, jsx as t, Fragment as D } from "react/jsx-runtime";
3
+ import * as p from "react";
4
+ import { cva as H } from "class-variance-authority";
5
5
  import { z as e } from "zod/v4";
6
- import { Alert as E, AlertTitle as B, AlertDescription as $ } from "./alert.js";
7
- import { Badge as p } from "./badge.js";
8
- import { Button as z } from "./button.js";
9
- import { FollowUpSuggestion as O } from "./assistant-ui/follow-up-suggestions.js";
10
- import { Source as P, SourceTitle as V } from "./assistant-ui/sources.js";
11
- import { AreaChart as _, BarChart as M, LineChart as W } from "./chart.js";
12
- import { Progress as I } from "./progress.js";
13
- import { cn as c } from "../lib/cn.js";
14
- const K = "render_answer", H = "Render the final answer with one curated ADS template. Choose the semantic kind that best matches the answer and provide only validated data; the application owns the layout.", x = e.enum([
6
+ import { Alert as T, AlertTitle as O, AlertDescription as L } from "./alert.js";
7
+ import { Badge as w } from "./badge.js";
8
+ import { Button as Ne } from "./button.js";
9
+ import { CodeBlock as R } from "./code-block.js";
10
+ import { Popover as we, PopoverTrigger as ve, PopoverContent as ke } from "./popover.js";
11
+ import { FollowUpQuestion as Ae } from "./assistant-ui/follow-up-suggestions.js";
12
+ import { Source as je, SourceTitle as Se } from "./assistant-ui/sources.js";
13
+ import { AreaChart as Ce, BarChart as Re, LineChart as Te } from "./chart.js";
14
+ import { Progress as Oe } from "./progress.js";
15
+ import { Skeleton as u } from "./skeleton.js";
16
+ import { Table as Le, TableHeader as ze, TableRow as B, TableColumn as De, TableBody as qe, TableCell as M } from "./table.js";
17
+ import { Check as q, Minus as Be, WarningCircle as Ke, Clock as Ee, Database as Fe } from "../lib/icons.js";
18
+ import { cn as g } from "../lib/cn.js";
19
+ const We = "render_answer", Pe = "Render the final answer with one curated ADS template. Choose the semantic kind that best matches the answer — data kinds (fact, table, ranking, trend, comparison, breakdown, report), narrative kinds (explanation, knowledge, decision, status), task kinds (confirmation), and situation kinds (clarification, empty, error, refusal) — and provide only validated data; the application owns the layout.", N = e.enum([
15
20
  "default",
16
21
  "primary",
17
22
  "success",
18
23
  "warning",
19
24
  "danger",
20
25
  "info"
21
- ]), F = e.object({
26
+ ]), $e = e.object({
22
27
  id: e.string().min(1),
23
28
  label: e.string().min(1),
24
29
  prompt: e.string().min(1).optional()
25
- }), q = e.object({
30
+ }), Ve = e.object({
26
31
  id: e.string().min(1),
27
32
  label: e.string().min(1),
28
33
  description: e.string().optional(),
29
- href: e.string().min(1).refine((t) => {
30
- if (t.startsWith("/") || t.startsWith("#")) return !0;
34
+ prompt: e.string().min(1).optional()
35
+ }), Me = e.object({
36
+ id: e.string().min(1),
37
+ label: e.string().min(1),
38
+ description: e.string().optional(),
39
+ href: e.string().min(1).refine((a) => {
40
+ if (a.startsWith("/") || a.startsWith("#")) return !0;
31
41
  try {
32
- const r = new URL(t).protocol;
33
- return r === "http:" || r === "https:";
42
+ const l = new URL(a).protocol;
43
+ return l === "http:" || l === "https:";
34
44
  } catch {
35
45
  return !1;
36
46
  }
37
- }, "Source link must be HTTP(S) or app-relative").optional().describe("Destination opened in a new tab when the source is selected")
38
- }), b = e.object({
47
+ }, "Source link must be HTTP(S) or app-relative").optional().describe(
48
+ "Fallback destination when the host does not handle source selection in its inspector"
49
+ )
50
+ }), v = e.object({
39
51
  label: e.string().optional(),
40
52
  text: e.string().min(1),
41
- tone: x.optional()
42
- }), f = {
53
+ tone: N.optional()
54
+ }), _e = e.union([
55
+ e.string().min(1),
56
+ e.object({
57
+ label: e.string().min(1),
58
+ query: e.string().optional().describe("The SQL that produced the cited value — shown when opened"),
59
+ source: e.string().optional().describe("Connection or table the query ran against"),
60
+ rows: e.number().int().nonnegative().optional().describe("Row count the query returned")
61
+ })
62
+ ]), S = e.array(_e).max(6), P = e.object({
63
+ label: e.string().min(1),
64
+ value: e.string().min(1),
65
+ code: e.boolean().optional().describe("Render the value monospace — table paths, filters, identifiers"),
66
+ tone: N.optional()
67
+ }), Q = e.object({
68
+ label: e.string().min(1),
69
+ value: e.string().min(1),
70
+ change: e.string().optional(),
71
+ tone: N.optional()
72
+ }), x = {
43
73
  eyebrow: e.string().optional(),
44
74
  headline: e.string().min(1),
45
75
  summary: e.string().optional(),
46
- followUps: e.array(F).max(3).optional(),
47
- sources: e.array(q).max(8).optional()
48
- }, A = e.object({
76
+ method: e.string().optional().describe("One-line methodology note — how the number was computed"),
77
+ caveats: e.array(e.string().min(1)).max(4).optional().describe("Assumptions, limitations, freshness or partial-period notes"),
78
+ followUps: e.array($e).max(3).optional(),
79
+ sources: e.array(Me).max(8).optional()
80
+ }, _ = e.object({
49
81
  value: e.string().min(1),
50
82
  detail: e.string().optional(),
51
- tone: x.optional()
52
- }), G = e.object({
53
- ...f,
83
+ tone: N.optional()
84
+ }), Ie = e.object({
85
+ ...x,
54
86
  kind: e.literal("comparison"),
55
87
  subjects: e.tuple([
56
88
  e.object({ label: e.string().min(1), description: e.string().optional() }),
@@ -60,27 +92,27 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
60
92
  e.object({
61
93
  label: e.string().min(1),
62
94
  description: e.string().min(1).optional().describe("Methodology, grain, or scope shown beneath the measure"),
63
- values: e.tuple([A, A]),
95
+ values: e.tuple([_, _]),
64
96
  delta: e.object({
65
97
  value: e.string().min(1),
66
- tone: x.optional()
98
+ tone: N.optional()
67
99
  }).optional()
68
100
  })
69
101
  ).min(1).max(8),
70
- takeaway: b.optional()
71
- }), k = e.enum([
102
+ takeaway: v.optional()
103
+ }), K = e.enum([
72
104
  "primary",
73
105
  "success",
74
106
  "warning",
75
107
  "danger",
76
108
  "info"
77
- ]), J = e.discriminatedUnion("kind", [
109
+ ]), He = e.discriminatedUnion("kind", [
78
110
  e.object({
79
111
  kind: e.literal("line"),
80
112
  value: e.union([e.number(), e.string()]),
81
113
  axis: e.enum(["x", "y"]).optional(),
82
114
  label: e.string().optional(),
83
- color: k.optional()
115
+ color: K.optional()
84
116
  }),
85
117
  e.object({
86
118
  kind: e.literal("band"),
@@ -88,7 +120,7 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
88
120
  to: e.union([e.number(), e.string()]),
89
121
  axis: e.enum(["x", "y"]).optional(),
90
122
  label: e.string().optional(),
91
- color: k.optional()
123
+ color: K.optional()
92
124
  }),
93
125
  e.object({
94
126
  kind: e.literal("point"),
@@ -96,38 +128,39 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
96
128
  y: e.number(),
97
129
  label: e.string().min(1),
98
130
  description: e.string().optional(),
99
- color: k.optional()
131
+ color: K.optional()
100
132
  })
101
- ]), Q = e.record(
133
+ ]), Qe = e.record(
102
134
  e.string(),
103
135
  e.union([e.string(), e.number(), e.null()])
104
- ), U = e.object({
105
- ...f,
136
+ ), Y = e.object({
137
+ type: e.enum(["line", "area", "bar"]),
138
+ data: e.array(Qe).min(1).max(100),
139
+ categoryKey: e.string().min(1),
140
+ series: e.array(e.string().min(1)).min(1).max(4),
141
+ seriesLabels: e.record(e.string(), e.string()).optional(),
142
+ highlight: e.string().optional(),
143
+ forecastKeys: e.array(e.string().min(1)).max(2).optional().describe("Series keys drawn dashed as projections (line and area only)"),
144
+ unit: e.string().optional(),
145
+ annotations: e.array(He).max(8).optional()
146
+ }), Ye = e.object({
147
+ ...x,
106
148
  kind: e.literal("trend"),
107
149
  metric: e.object({
108
150
  label: e.string().min(1),
109
151
  value: e.string().min(1),
110
152
  change: e.string().optional(),
111
- tone: x.optional()
153
+ tone: N.optional()
112
154
  }).optional(),
113
- chart: e.object({
114
- type: e.enum(["line", "area", "bar"]),
115
- data: e.array(Q).min(1).max(100),
116
- categoryKey: e.string().min(1),
117
- series: e.array(e.string().min(1)).min(1).max(4),
118
- seriesLabels: e.record(e.string(), e.string()).optional(),
119
- highlight: e.string().optional(),
120
- unit: e.string().optional(),
121
- annotations: e.array(J).max(8).optional()
122
- }),
123
- insight: b.optional()
124
- }), X = e.object({
125
- ...f,
155
+ chart: Y,
156
+ insight: v.optional()
157
+ }), Ge = e.object({
158
+ ...x,
126
159
  kind: e.literal("status"),
127
160
  overall: e.object({
128
161
  label: e.string().min(1),
129
162
  value: e.string().min(1),
130
- tone: x.optional()
163
+ tone: N.optional()
131
164
  }).optional(),
132
165
  items: e.array(
133
166
  e.object({
@@ -135,12 +168,12 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
135
168
  status: e.string().min(1),
136
169
  detail: e.string().optional(),
137
170
  meta: e.string().optional(),
138
- tone: x.optional()
171
+ tone: N.optional()
139
172
  })
140
173
  ).min(1).max(12),
141
- recommendation: b.optional()
142
- }), Y = e.object({
143
- ...f,
174
+ recommendation: v.optional()
175
+ }), Xe = e.object({
176
+ ...x,
144
177
  kind: e.literal("breakdown"),
145
178
  total: e.object({ label: e.string().min(1), value: e.string().min(1) }).optional(),
146
179
  items: e.array(
@@ -149,32 +182,286 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
149
182
  value: e.string().min(1),
150
183
  share: e.number().min(0).max(100),
151
184
  detail: e.string().optional(),
152
- tone: x.optional()
185
+ tone: N.optional()
153
186
  })
154
187
  ).min(1).max(12),
155
- insight: b.optional()
156
- }), Z = e.object({
157
- ...f,
188
+ insight: v.optional()
189
+ }), Je = e.object({
190
+ ...x,
158
191
  kind: e.literal("explanation"),
159
192
  sections: e.array(
160
193
  e.object({
161
194
  title: e.string().min(1),
162
195
  body: e.string().optional(),
163
- bullets: e.array(e.string().min(1)).max(5).optional()
196
+ bullets: e.array(e.string().min(1)).max(5).optional(),
197
+ code: e.string().optional().describe("A formula or query illustrating the section"),
198
+ codeLanguage: e.string().optional()
199
+ })
200
+ ).min(1).max(6),
201
+ takeaway: v.optional()
202
+ }), Ze = e.object({
203
+ ...x,
204
+ kind: e.literal("narrative"),
205
+ lead: e.string().optional().describe("The opening framing paragraph — supports blank-line breaks"),
206
+ blocks: e.array(
207
+ e.object({
208
+ heading: e.string().optional(),
209
+ lead: e.string().optional().describe("Bold lead phrase before the body — the finding, the claim"),
210
+ body: e.string().min(1).describe("Prose; blank lines (\\n\\n) split into paragraphs"),
211
+ bullets: e.array(e.string().min(1)).max(6).optional(),
212
+ citations: S.optional(),
213
+ tone: N.optional()
214
+ })
215
+ ).min(1).max(10),
216
+ takeaways: e.array(
217
+ e.object({ lead: e.string().optional(), body: e.string().min(1) })
218
+ ).max(6).optional().describe("Key-takeaways tail — bold lead, then elaboration"),
219
+ bottomLine: v.optional().describe(
220
+ "The emphasized closing verdict"
221
+ )
222
+ }), Ue = e.object({
223
+ ...x,
224
+ kind: e.literal("fact"),
225
+ value: e.object({
226
+ label: e.string().min(1),
227
+ value: e.string().min(1),
228
+ change: e.string().optional(),
229
+ asOf: e.string().optional().describe('Freshness qualifier, e.g. "as of Apr 18, latest ingested"'),
230
+ tone: N.optional()
231
+ }),
232
+ facts: e.array(Q).max(6).optional(),
233
+ citations: S.optional(),
234
+ insight: v.optional()
235
+ }), ea = e.union([
236
+ e.string(),
237
+ e.object({ value: e.string(), tone: N.optional() })
238
+ ]), G = {
239
+ columns: e.array(
240
+ e.object({
241
+ key: e.string().min(1),
242
+ label: e.string().min(1),
243
+ align: e.enum(["left", "right"]).optional()
244
+ })
245
+ ).min(2).max(6),
246
+ rows: e.array(
247
+ e.object({
248
+ cells: e.record(e.string(), ea),
249
+ emphasis: e.boolean().optional().describe("Bold the row — the winner, the current period")
250
+ })
251
+ ).min(1).max(12),
252
+ totals: e.object({
253
+ label: e.string().min(1).optional(),
254
+ cells: e.record(e.string(), e.string())
255
+ }).optional(),
256
+ note: e.string().optional().describe(
257
+ 'Footnote under the table — row caps ("showing 10 of 1,000"), provenance, partial periods'
258
+ ),
259
+ citations: S.optional()
260
+ }, aa = e.object({
261
+ ...x,
262
+ kind: e.literal("table"),
263
+ ...G,
264
+ insight: v.optional()
265
+ }), ta = e.object({
266
+ ...x,
267
+ kind: e.literal("ranking"),
268
+ metricLabel: e.string().optional().describe('What the ranked value measures, e.g. "Total fee · EUR"'),
269
+ items: e.array(
270
+ e.object({
271
+ label: e.string().min(1),
272
+ value: e.string().min(1),
273
+ detail: e.string().optional().describe("Secondary metric, coverage, or an ineligibility reason"),
274
+ delta: e.object({
275
+ value: e.string().min(1),
276
+ tone: N.optional()
277
+ }).optional(),
278
+ highlight: e.boolean().optional().describe("Mark the winner — set on every member of a tie group"),
279
+ tone: N.optional()
280
+ })
281
+ ).min(1).max(10),
282
+ tiebreak: e.string().optional().describe("How a tie between highlighted items resolves"),
283
+ citations: S.optional(),
284
+ insight: v.optional()
285
+ }), na = e.object({
286
+ ...x,
287
+ kind: e.literal("confirmation"),
288
+ outcome: e.object({
289
+ label: e.string().min(1).describe('The receipt verdict, e.g. "Deployed"'),
290
+ detail: e.string().optional().describe('e.g. "schema version 62"'),
291
+ tone: N.optional()
292
+ }),
293
+ changes: e.array(P).max(8).optional().describe("What was added or configured, as label–value pairs"),
294
+ steps: e.array(
295
+ e.object({
296
+ label: e.string().min(1),
297
+ status: e.enum(["done", "pending", "failed", "skipped"]),
298
+ detail: e.string().optional()
299
+ })
300
+ ).max(10).optional(),
301
+ safety: e.string().optional().describe('The no-side-effects line, e.g. "No existing cubes were modified."'),
302
+ next: e.string().optional().describe("Forward behavior or the step the system takes next"),
303
+ warning: v.optional()
304
+ }), ra = e.object({
305
+ ...x,
306
+ kind: e.literal("clarification"),
307
+ findings: e.array(P).max(6).optional().describe("What was already established — the facts that framed the ask"),
308
+ question: e.string().min(1),
309
+ options: e.array(Ve).min(1).max(4).optional()
310
+ }), ia = e.object({
311
+ ...x,
312
+ kind: e.literal("empty"),
313
+ checks: e.array(
314
+ e.object({
315
+ label: e.string().min(1),
316
+ result: e.string().min(1).describe('e.g. "0 rows"'),
317
+ tone: N.optional()
318
+ })
319
+ ).max(8).optional().describe("What was searched, with each probe's outcome — the proof of absence"),
320
+ reason: e.string().optional().describe("Why the result is empty — cause hypothesis or table semantics"),
321
+ baseline: e.object({ label: e.string().min(1), value: e.string().min(1) }).optional().describe("An adjacent known-good value for calibration"),
322
+ citations: S.optional(),
323
+ alternative: v.optional()
324
+ }), la = e.object({
325
+ ...x,
326
+ kind: e.literal("error"),
327
+ failure: e.object({
328
+ summary: e.string().min(1),
329
+ tally: e.string().optional().describe('Repeat-attempt tally, e.g. "12+ attempts over 7 weeks"'),
330
+ detail: e.string().optional().describe("The verbatim error, rendered monospace")
331
+ }),
332
+ attempts: e.array(
333
+ e.object({
334
+ label: e.string().min(1).describe("What was tried — a path, a query"),
335
+ result: e.string().min(1)
336
+ })
337
+ ).max(6).optional(),
338
+ resolution: e.array(
339
+ e.object({
340
+ action: e.string().min(1),
341
+ owner: e.enum(["user", "admin", "platform", "agent"]).optional()
342
+ })
343
+ ).max(5).optional(),
344
+ preserved: e.object({
345
+ label: e.string().optional(),
346
+ code: e.string().min(1),
347
+ language: e.string().optional()
348
+ }).optional().describe("Prepared work that survives the failure — ready-to-run SQL, a chart config")
349
+ }), sa = e.object({
350
+ ...x,
351
+ kind: e.literal("refusal"),
352
+ reason: e.string().min(1),
353
+ scope: e.string().optional().describe('The role statement, e.g. "read-only data analysis assistant"'),
354
+ completed: e.string().optional().describe("The allowed portion that WAS carried out before declining"),
355
+ alternatives: e.array(
356
+ e.object({
357
+ label: e.string().min(1),
358
+ description: e.string().optional()
359
+ })
360
+ ).max(4).optional()
361
+ }), oa = e.object({
362
+ ...x,
363
+ kind: e.literal("knowledge"),
364
+ entries: e.array(
365
+ e.object({
366
+ term: e.string().min(1),
367
+ category: e.string().optional().describe('e.g. "Formula", "Field", "Rule"'),
368
+ body: e.string().optional(),
369
+ formula: e.string().optional(),
370
+ items: e.array(P).max(6).optional()
164
371
  })
165
372
  ).min(1).max(6),
166
- takeaway: b.optional()
167
- }), ee = e.discriminatedUnion("kind", [
168
- G,
169
- U,
170
- X,
171
- Y,
172
- Z
173
- ]), pe = {
174
- name: K,
175
- description: H,
176
- inputSchema: ee
177
- }, v = L("font-semibold tabular-nums text-foreground", {
373
+ gaps: e.array(e.string().min(1)).max(5).optional().describe("What the knowledge base does NOT cover"),
374
+ compliance: e.string().optional().describe('The constraint honored, e.g. "No SQL was executed."'),
375
+ citations: S.optional()
376
+ }), da = e.object({
377
+ ...x,
378
+ kind: e.literal("decision"),
379
+ options: e.array(
380
+ e.object({
381
+ name: e.string().min(1),
382
+ tag: e.string().optional().describe('e.g. "Forward-looking", "Requires input"'),
383
+ description: e.string().optional(),
384
+ pros: e.array(e.string().min(1)).max(5).optional(),
385
+ cons: e.array(e.string().min(1)).max(5).optional(),
386
+ recommended: e.boolean().optional()
387
+ })
388
+ ).min(2).max(4),
389
+ guidance: e.array(e.object({ when: e.string().min(1), choose: e.string().min(1) })).max(5).optional().describe('Goal-to-option mapping — "if you want X, pick Y"')
390
+ }), ca = e.discriminatedUnion("type", [
391
+ e.object({
392
+ type: e.literal("text"),
393
+ title: e.string().optional(),
394
+ body: e.string().min(1)
395
+ }),
396
+ e.object({
397
+ type: e.literal("metrics"),
398
+ title: e.string().optional(),
399
+ items: e.array(Q).min(2).max(4)
400
+ }),
401
+ e.object({
402
+ type: e.literal("table"),
403
+ title: e.string().optional(),
404
+ ...G
405
+ }),
406
+ e.object({
407
+ type: e.literal("chart"),
408
+ title: e.string().optional(),
409
+ chart: Y,
410
+ note: e.string().optional()
411
+ }),
412
+ e.object({
413
+ type: e.literal("list"),
414
+ title: e.string().optional(),
415
+ items: e.array(
416
+ e.object({ lead: e.string().optional(), body: e.string().min(1) })
417
+ ).min(1).max(6)
418
+ })
419
+ ]), ma = e.object({
420
+ ...x,
421
+ kind: e.literal("report"),
422
+ sections: e.array(ca).min(2).max(8),
423
+ definitions: e.array(e.object({ term: e.string().min(1), meaning: e.string().min(1) })).max(8).optional()
424
+ }), ha = e.discriminatedUnion("kind", [
425
+ Ie,
426
+ Ye,
427
+ Ge,
428
+ Xe,
429
+ Je,
430
+ Ze,
431
+ Ue,
432
+ aa,
433
+ ta,
434
+ na,
435
+ ra,
436
+ ia,
437
+ la,
438
+ sa,
439
+ oa,
440
+ da,
441
+ ma
442
+ ]), Fa = [
443
+ "comparison",
444
+ "trend",
445
+ "status",
446
+ "breakdown",
447
+ "explanation",
448
+ "narrative",
449
+ "fact",
450
+ "table",
451
+ "ranking",
452
+ "confirmation",
453
+ "clarification",
454
+ "empty",
455
+ "error",
456
+ "refusal",
457
+ "knowledge",
458
+ "decision",
459
+ "report"
460
+ ], Wa = {
461
+ name: We,
462
+ description: Pe,
463
+ inputSchema: ha
464
+ }, A = H("font-semibold tabular-nums text-foreground", {
178
465
  variants: {
179
466
  tone: {
180
467
  default: "text-foreground",
@@ -186,421 +473,1539 @@ const K = "render_answer", H = "Render the final answer with one curated ADS tem
186
473
  }
187
474
  },
188
475
  defaultVariants: { tone: "default" }
189
- }), te = new Intl.NumberFormat("en-US", {
476
+ }), $ = H("", {
477
+ variants: {
478
+ tone: {
479
+ default: "text-secondary",
480
+ primary: "text-brand",
481
+ success: "text-success-700",
482
+ warning: "text-warning-700",
483
+ danger: "text-danger-700",
484
+ info: "text-info-700"
485
+ }
486
+ },
487
+ defaultVariants: { tone: "default" }
488
+ }), ga = new Intl.NumberFormat("en-US", {
190
489
  notation: "compact",
191
490
  maximumFractionDigits: 1
192
- }), ae = (t) => t === "success" || t === "warning" || t === "danger" || t === "info" ? t : "default", ne = (t) => t === "success" || t === "warning" || t === "danger" || t === "info" ? t : "primary";
193
- function y({ spec: t }) {
194
- return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
195
- t.eyebrow && /* @__PURE__ */ a("p", { className: "text-xs font-semibold uppercase tracking-wider text-tertiary", children: t.eyebrow }),
196
- /* @__PURE__ */ a("h2", { className: "max-w-2xl text-xl font-bold leading-tight tracking-tight text-foreground", children: t.headline }),
197
- t.summary && /* @__PURE__ */ a("p", { className: "max-w-2xl text-sm leading-6 text-secondary", children: t.summary })
198
- ] });
491
+ }), X = (a) => a === "success" || a === "warning" || a === "danger" || a === "info" ? a : "default", ba = (a) => a === "success" || a === "warning" || a === "danger" || a === "info" ? a : "primary", J = p.createContext(void 0);
492
+ function f({ spec: a }) {
493
+ return (
494
+ // `flex-1 min-w-0` lets the header fill its available width, including in
495
+ // answer kinds that intentionally pair it with a trailing metric.
496
+ /* @__PURE__ */ n("div", { className: "min-w-0 flex-1 space-y-3", children: [
497
+ a.eyebrow && /* @__PURE__ */ t("p", { className: "text-base font-normal text-tertiary", children: a.eyebrow }),
498
+ /* @__PURE__ */ t("h2", { className: "text-xl font-normal leading-tight tracking-tight text-foreground", children: a.headline }),
499
+ a.summary && /* @__PURE__ */ t("p", { className: "text-base leading-6 text-secondary", children: a.summary })
500
+ ] })
501
+ );
199
502
  }
200
- function w({ signal: t }) {
201
- return /* @__PURE__ */ i(E, { variant: ae(t.tone), children: [
202
- /* @__PURE__ */ a(B, { children: t.label ?? "Takeaway" }),
203
- /* @__PURE__ */ a($, { children: t.text })
204
- ] });
503
+ function k({ signal: a }) {
504
+ return /* @__PURE__ */ n(
505
+ T,
506
+ {
507
+ variant: X(a.tone),
508
+ className: "border border-border bg-card",
509
+ children: [
510
+ /* @__PURE__ */ t(O, { children: a.label ?? "Takeaway" }),
511
+ /* @__PURE__ */ t(L, { className: "text-base leading-6", children: a.text })
512
+ ]
513
+ }
514
+ );
205
515
  }
206
- function N({
207
- followUps: t,
208
- sources: r,
209
- onFollowUp: s,
210
- onSourceSelect: o
516
+ function W({
517
+ text: a,
518
+ lead: l,
519
+ className: c
211
520
  }) {
212
- return !(t != null && t.length) && !(r != null && r.length) ? null : /* @__PURE__ */ i("div", { className: "space-y-3 pt-1", children: [
213
- !!(r != null && r.length) && /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", children: [
214
- /* @__PURE__ */ a("span", { className: "mr-1 text-xs font-medium text-tertiary", children: "Sources" }),
215
- r.map(
216
- (l) => l.href ? /* @__PURE__ */ i(
217
- P,
218
- {
219
- href: l.href,
220
- variant: "muted",
221
- size: "sm",
222
- title: l.description,
223
- className: "h-6 rounded-full px-2",
224
- children: [
225
- /* @__PURE__ */ a(V, { children: l.label }),
226
- /* @__PURE__ */ a("span", { className: "sr-only", children: " (opens in a new tab)" })
227
- ]
228
- },
229
- l.id
230
- ) : o ? /* @__PURE__ */ a(
231
- z,
232
- {
233
- type: "button",
234
- size: "xs",
235
- variant: "ghost",
236
- title: l.description,
237
- className: "h-6 rounded-full px-2 text-muted-foreground",
238
- onClick: () => o(l),
239
- children: l.label
240
- },
241
- l.id
242
- ) : /* @__PURE__ */ a(p, { variant: "soft", title: l.description, children: l.label }, l.id)
243
- )
521
+ const d = a.split(/\n{2,}/).map((m) => m.trim()).filter(Boolean);
522
+ return /* @__PURE__ */ t("div", { className: g("space-y-2 text-sm leading-6 text-secondary", c), children: d.map((m, o) => /* @__PURE__ */ n("p", { children: [
523
+ o === 0 && l && /* @__PURE__ */ n("span", { className: "font-semibold text-foreground", children: [
524
+ l,
525
+ " — "
244
526
  ] }),
245
- !!(t != null && t.length) && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: t.map((l) => /* @__PURE__ */ a(
246
- O,
527
+ m
528
+ ] }, o)) });
529
+ }
530
+ const Z = (a) => typeof a == "string" ? { label: a } : a, pa = (a) => a == null ? void 0 : a.split(" · ")[0], E = "inline-flex items-center gap-1 rounded-md px-2 py-0.5 font-mono text-xs tabular-nums", I = "cursor-pointer bg-info-50 text-info-700 outline-none transition-colors hover:bg-info-100 focus-visible:ring-3 focus-visible:ring-info/40 active:scale-(--scale-press)";
531
+ function F({ citation: a }) {
532
+ const l = pa(a.source);
533
+ return /* @__PURE__ */ n(D, { children: [
534
+ /* @__PURE__ */ t(Fe, { "aria-hidden": !0, className: "size-3 shrink-0 opacity-70" }),
535
+ /* @__PURE__ */ t("span", { children: a.label }),
536
+ l && /* @__PURE__ */ n("span", { className: "max-w-[12ch] truncate font-normal opacity-70", children: [
537
+ "· ",
538
+ l
539
+ ] }),
540
+ a.rows != null && /* @__PURE__ */ n("span", { className: "font-normal opacity-60", children: [
541
+ "· ",
542
+ a.rows.toLocaleString()
543
+ ] })
544
+ ] });
545
+ }
546
+ function U({ citation: a }) {
547
+ const l = p.useContext(J), c = !!(a.query || a.source || a.rows != null);
548
+ return l ? /* @__PURE__ */ t(
549
+ "button",
550
+ {
551
+ type: "button",
552
+ className: g(E, I),
553
+ "aria-label": `Inspect the query behind ${a.label}`,
554
+ onClick: () => l(a),
555
+ children: /* @__PURE__ */ t(F, { citation: a })
556
+ }
557
+ ) : c ? /* @__PURE__ */ n(we, { children: [
558
+ /* @__PURE__ */ t(ve, { children: /* @__PURE__ */ t(
559
+ "button",
247
560
  {
248
561
  type: "button",
249
- disabled: !s,
250
- onClick: () => s == null ? void 0 : s(l),
251
- children: l.label
252
- },
253
- l.id
254
- )) })
562
+ className: g(E, I),
563
+ "aria-label": `Show the query behind ${a.label}`,
564
+ children: /* @__PURE__ */ t(F, { citation: a })
565
+ }
566
+ ) }),
567
+ /* @__PURE__ */ n(
568
+ ke,
569
+ {
570
+ align: "start",
571
+ className: "w-80 max-w-[calc(100vw-1rem)] overflow-hidden p-0",
572
+ children: [
573
+ /* @__PURE__ */ n("div", { className: "space-y-1 px-3 pb-2 pt-3", children: [
574
+ /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-3", children: [
575
+ /* @__PURE__ */ t("span", { className: "font-mono text-xs font-semibold text-foreground", children: a.label }),
576
+ a.rows != null && /* @__PURE__ */ n("span", { className: "text-xs tabular-nums text-tertiary", children: [
577
+ a.rows.toLocaleString(),
578
+ " ",
579
+ a.rows === 1 ? "row" : "rows"
580
+ ] })
581
+ ] }),
582
+ a.source && /* @__PURE__ */ t("p", { className: "text-xs text-tertiary", children: a.source })
583
+ ] }),
584
+ a.query && /* @__PURE__ */ t(
585
+ R,
586
+ {
587
+ language: "sql",
588
+ className: "max-h-56 rounded-none",
589
+ children: a.query
590
+ }
591
+ )
592
+ ]
593
+ }
594
+ )
595
+ ] }) : /* @__PURE__ */ t("span", { className: g(E, "bg-surface text-tertiary"), children: /* @__PURE__ */ t(F, { citation: a }) });
596
+ }
597
+ function z({
598
+ citations: a,
599
+ className: l
600
+ }) {
601
+ return a != null && a.length ? /* @__PURE__ */ t("div", { className: g("flex flex-wrap items-center gap-1", l), children: a.map((c, d) => {
602
+ const m = Z(c);
603
+ return /* @__PURE__ */ t(U, { citation: m }, `${m.label}-${d}`);
604
+ }) }) : null;
605
+ }
606
+ function ee({
607
+ items: a,
608
+ className: l
609
+ }) {
610
+ return /* @__PURE__ */ t("dl", { className: g("rounded-2xl border border-border bg-card px-4 py-2", l), children: a.map((c) => /* @__PURE__ */ n(
611
+ "div",
612
+ {
613
+ className: "flex items-baseline justify-between gap-4 py-1.5",
614
+ children: [
615
+ /* @__PURE__ */ t("dt", { className: "text-sm font-normal text-secondary", children: c.label }),
616
+ /* @__PURE__ */ t(
617
+ "dd",
618
+ {
619
+ className: g(
620
+ "min-w-0 text-right text-sm",
621
+ c.code ? "break-all font-mono text-xs text-foreground" : A({ tone: c.tone })
622
+ ),
623
+ children: c.value
624
+ }
625
+ )
626
+ ]
627
+ },
628
+ c.label
629
+ )) });
630
+ }
631
+ function ua({ items: a }) {
632
+ return /* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-2 @lg:grid-cols-3", children: a.map((l) => /* @__PURE__ */ n("div", { className: "rounded-xl border border-border bg-card px-4 py-3", children: [
633
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: l.label }),
634
+ /* @__PURE__ */ t(
635
+ "p",
636
+ {
637
+ className: g(
638
+ A({ tone: l.tone }),
639
+ "mt-1 text-lg tracking-tight"
640
+ ),
641
+ children: l.value
642
+ }
643
+ ),
644
+ l.change && /* @__PURE__ */ t("p", { className: "mt-0.5 text-xs text-secondary", children: l.change })
645
+ ] }, l.label)) });
646
+ }
647
+ function ae({
648
+ table: a,
649
+ caption: l
650
+ }) {
651
+ const c = (o) => o === void 0 ? void 0 : typeof o == "string" ? o : o.value, d = (o) => o !== void 0 && typeof o == "object" ? o.tone : void 0, m = (o, h, { first: r, emphasis: i }) => o === void 0 || o === "" ? /* @__PURE__ */ t("span", { "aria-label": "Not available", className: "text-tertiary", children: "—" }) : /* @__PURE__ */ t(
652
+ "span",
653
+ {
654
+ className: g(
655
+ r ? g("text-secondary", i && "font-semibold text-foreground") : g(
656
+ "tabular-nums",
657
+ h ? $({ tone: h }) : "text-foreground",
658
+ i && "font-semibold"
659
+ )
660
+ ),
661
+ children: o
662
+ }
663
+ );
664
+ return /* @__PURE__ */ n("div", { className: "space-y-3", children: [
665
+ /* @__PURE__ */ n(Le, { "aria-label": l, isStatic: !0, children: [
666
+ /* @__PURE__ */ t(ze, { children: /* @__PURE__ */ t(B, { children: a.columns.map((o) => /* @__PURE__ */ t(De, { align: o.align, children: o.label }, o.key)) }) }),
667
+ /* @__PURE__ */ n(qe, { children: [
668
+ a.rows.map((o, h) => /* @__PURE__ */ t(B, { children: a.columns.map((r, i) => /* @__PURE__ */ t(M, { align: r.align, children: m(
669
+ c(o.cells[r.key]),
670
+ d(o.cells[r.key]),
671
+ { first: i === 0, emphasis: o.emphasis }
672
+ ) }, r.key)) }, h)),
673
+ a.totals && /* @__PURE__ */ t(B, { children: a.columns.map((o, h) => {
674
+ var i, s;
675
+ const r = ((i = a.totals) == null ? void 0 : i.cells[o.key]) ?? (h === 0 ? ((s = a.totals) == null ? void 0 : s.label) ?? "Total" : "");
676
+ return /* @__PURE__ */ t(M, { align: o.align, children: /* @__PURE__ */ t(
677
+ "span",
678
+ {
679
+ className: g(
680
+ "font-semibold text-foreground",
681
+ h > 0 && "tabular-nums"
682
+ ),
683
+ children: r
684
+ }
685
+ ) }, o.key);
686
+ }) })
687
+ ] })
688
+ ] }),
689
+ a.note && /* @__PURE__ */ t("p", { className: "text-base leading-6 text-tertiary", children: a.note }),
690
+ /* @__PURE__ */ t(z, { citations: a.citations })
255
691
  ] });
256
692
  }
257
- const j = u.forwardRef(({ spec: t, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
693
+ function te({ chart: a }) {
694
+ const l = p.useMemo(
695
+ () => a.unit ? (d) => `${ga.format(d)}${a.unit}` : void 0,
696
+ [a.unit]
697
+ ), c = {
698
+ data: a.data,
699
+ categoryKey: a.categoryKey,
700
+ series: a.series,
701
+ seriesLabels: a.seriesLabels,
702
+ highlight: a.highlight,
703
+ annotations: a.annotations,
704
+ formatValue: l,
705
+ height: 224
706
+ };
707
+ return /* @__PURE__ */ t("div", { className: "rounded-2xl border border-border bg-card px-3 pb-2 pt-4 @md:px-4", children: a.type === "area" ? /* @__PURE__ */ t(Ce, { ...c, forecastKeys: a.forecastKeys }) : a.type === "bar" ? /* @__PURE__ */ t(Re, { ...c }) : /* @__PURE__ */ t(Te, { ...c, forecastKeys: a.forecastKeys }) });
708
+ }
709
+ function y({
710
+ spec: a,
711
+ citations: l,
712
+ onFollowUp: c,
713
+ onSourceSelect: d
714
+ }) {
715
+ const { method: m, caveats: o, followUps: h, sources: r } = a, i = !!(m || o != null && o.length || l != null && l.length || r != null && r.length);
716
+ return !i && !(h != null && h.length) ? null : /* @__PURE__ */ n("div", { className: "space-y-4 pt-1", children: [
717
+ i && /* @__PURE__ */ n("div", { className: "space-y-3", children: [
718
+ (m || !!(l != null && l.length)) && /* @__PURE__ */ n("p", { className: "text-base leading-6 text-tertiary", children: [
719
+ m && /* @__PURE__ */ n(D, { children: [
720
+ /* @__PURE__ */ t("span", { className: "font-semibold", children: "How computed" }),
721
+ " · ",
722
+ m
723
+ ] }),
724
+ l == null ? void 0 : l.map((s, b) => /* @__PURE__ */ n(p.Fragment, { children: [
725
+ " ",
726
+ /* @__PURE__ */ t(U, { citation: Z(s) })
727
+ ] }, b))
728
+ ] }),
729
+ !!(o != null && o.length) && /* @__PURE__ */ t("ul", { className: "space-y-1", children: o.map((s) => /* @__PURE__ */ n(
730
+ "li",
731
+ {
732
+ className: "flex items-start gap-2 text-base leading-6 text-tertiary",
733
+ children: [
734
+ /* @__PURE__ */ t(
735
+ "span",
736
+ {
737
+ "aria-hidden": !0,
738
+ className: "mt-2.5 size-1 shrink-0 rounded-dot bg-muted-foreground"
739
+ }
740
+ ),
741
+ /* @__PURE__ */ t("span", { children: s })
742
+ ]
743
+ },
744
+ s
745
+ )) }),
746
+ !!(r != null && r.length) && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: [
747
+ /* @__PURE__ */ t("span", { className: "mx-0.5 text-xs font-normal text-tertiary", children: "Sources" }),
748
+ r == null ? void 0 : r.map(
749
+ (s) => d ? /* @__PURE__ */ t(
750
+ Ne,
751
+ {
752
+ type: "button",
753
+ size: "xs",
754
+ variant: "ghost",
755
+ title: s.description,
756
+ className: "h-6 rounded-full bg-info-50 px-2 text-info-700 hover:bg-info-100 focus-visible:ring-info/40",
757
+ onClick: () => d(s),
758
+ children: s.label
759
+ },
760
+ s.id
761
+ ) : s.href ? /* @__PURE__ */ n(
762
+ je,
763
+ {
764
+ href: s.href,
765
+ variant: "info",
766
+ size: "sm",
767
+ title: s.description,
768
+ className: "h-6 rounded-full px-2",
769
+ children: [
770
+ /* @__PURE__ */ t(Se, { children: s.label }),
771
+ /* @__PURE__ */ t("span", { className: "sr-only", children: " (opens in a new tab)" })
772
+ ]
773
+ },
774
+ s.id
775
+ ) : /* @__PURE__ */ t(w, { variant: "soft", title: s.description, children: s.label }, s.id)
776
+ )
777
+ ] })
778
+ ] }),
779
+ !!(h != null && h.length) && /* @__PURE__ */ n("div", { className: "space-y-3", children: [
780
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: "Ask a follow-up" }),
781
+ /* @__PURE__ */ t("div", { className: "flex flex-col gap-2", children: h.map((s) => /* @__PURE__ */ t(
782
+ Ae,
783
+ {
784
+ type: "button",
785
+ disabled: !c,
786
+ onClick: () => c == null ? void 0 : c(s),
787
+ children: s.prompt ?? s.label
788
+ },
789
+ s.id
790
+ )) })
791
+ ] })
792
+ ] });
793
+ }
794
+ const ne = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
258
795
  "div",
259
796
  {
260
- ref: m,
261
- "data-answer-kind": t.kind,
262
- className: c("w-full max-w-2xl space-y-5", o),
263
- ...l,
797
+ ref: h,
798
+ "data-answer-kind": a.kind,
799
+ className: g("@container w-full max-w-2xl space-y-5", m),
800
+ ...o,
264
801
  children: [
265
- /* @__PURE__ */ a(y, { spec: t }),
266
- /* @__PURE__ */ a("div", { className: "overflow-x-auto rounded-2xl bg-surface p-2", children: /* @__PURE__ */ i("table", { className: "w-full min-w-[32rem] border-separate border-spacing-y-1 text-left", children: [
267
- /* @__PURE__ */ a("caption", { className: "sr-only", children: t.headline }),
268
- /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ i("tr", { children: [
269
- /* @__PURE__ */ a(
802
+ /* @__PURE__ */ t(f, { spec: a }),
803
+ /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ n("table", { className: "w-full min-w-[32rem] border-separate border-spacing-y-1 text-left", children: [
804
+ /* @__PURE__ */ t("caption", { className: "sr-only", children: a.headline }),
805
+ /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ n("tr", { children: [
806
+ /* @__PURE__ */ t(
270
807
  "th",
271
808
  {
272
809
  scope: "col",
273
- className: "w-1/3 px-3 py-2 text-xs font-medium text-tertiary",
810
+ className: "w-1/3 px-3 py-2 text-base font-normal text-tertiary",
274
811
  children: "Measure"
275
812
  }
276
813
  ),
277
- t.subjects.map((n) => /* @__PURE__ */ i(
814
+ a.subjects.map((r) => /* @__PURE__ */ n(
278
815
  "th",
279
816
  {
280
817
  scope: "col",
281
818
  className: "px-3 py-2 align-bottom",
282
819
  children: [
283
- /* @__PURE__ */ a("span", { className: "block text-sm font-semibold text-foreground", children: n.label }),
284
- n.description && /* @__PURE__ */ a("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: n.description })
820
+ /* @__PURE__ */ t("span", { className: "block text-base font-semibold text-foreground", children: r.label }),
821
+ r.description && /* @__PURE__ */ t("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: r.description })
285
822
  ]
286
823
  },
287
- n.label
824
+ r.label
288
825
  )),
289
- /* @__PURE__ */ i("th", { scope: "col", className: "px-3 py-2 align-bottom", children: [
290
- /* @__PURE__ */ a("span", { className: "block text-sm font-semibold text-foreground", children: "Difference" }),
291
- /* @__PURE__ */ i("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: [
292
- t.subjects[1].label,
826
+ /* @__PURE__ */ n("th", { scope: "col", className: "px-3 py-2 align-bottom", children: [
827
+ /* @__PURE__ */ t("span", { className: "block text-sm font-semibold text-foreground", children: "Difference" }),
828
+ /* @__PURE__ */ n("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: [
829
+ a.subjects[1].label,
293
830
  " − ",
294
- t.subjects[0].label
831
+ a.subjects[0].label
295
832
  ] })
296
833
  ] })
297
834
  ] }) }),
298
- /* @__PURE__ */ a("tbody", { children: t.rows.map((n) => {
299
- const d = n.values[0].detail === n.values[1].detail ? n.values[0].detail : void 0, h = n.description ?? d;
300
- return /* @__PURE__ */ i("tr", { className: "[&>*]:bg-muted/60", children: [
301
- /* @__PURE__ */ i(
835
+ /* @__PURE__ */ t("tbody", { children: a.rows.map((r) => {
836
+ const i = r.values[0].detail === r.values[1].detail ? r.values[0].detail : void 0, s = r.description ?? i;
837
+ return /* @__PURE__ */ n("tr", { className: "[&>*]:bg-surface", children: [
838
+ /* @__PURE__ */ n(
302
839
  "th",
303
840
  {
304
841
  scope: "row",
305
842
  className: "rounded-l-xl px-3 py-3 align-top text-left",
306
843
  children: [
307
- /* @__PURE__ */ a("span", { className: "block text-sm font-medium text-secondary", children: n.label }),
308
- h && /* @__PURE__ */ a("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: h })
844
+ /* @__PURE__ */ t("span", { className: "block text-base font-normal text-secondary", children: r.label }),
845
+ s && /* @__PURE__ */ t("span", { className: "mt-0.5 block text-xs font-normal text-tertiary", children: s })
309
846
  ]
310
847
  }
311
848
  ),
312
- n.values.map((g, D) => /* @__PURE__ */ a(
849
+ r.values.map((b, j) => /* @__PURE__ */ t(
313
850
  "td",
314
851
  {
315
852
  className: "px-3 py-3 align-top",
316
- children: /* @__PURE__ */ a(
853
+ children: /* @__PURE__ */ t(
317
854
  "span",
318
855
  {
319
- className: c(
320
- v({ tone: g.tone }),
321
- "block text-sm"
856
+ className: g(
857
+ A({ tone: b.tone }),
858
+ "block text-base"
322
859
  ),
323
- children: g.value
860
+ children: b.value
324
861
  }
325
862
  )
326
863
  },
327
- `${n.label}-${t.subjects[D].label}`
864
+ `${r.label}-${a.subjects[j].label}`
328
865
  )),
329
- /* @__PURE__ */ a("td", { className: "rounded-r-xl px-3 py-3 align-top", children: n.delta ? /* @__PURE__ */ a(
866
+ /* @__PURE__ */ t("td", { className: "rounded-r-xl px-3 py-3 align-top", children: r.delta ? /* @__PURE__ */ t(
330
867
  "span",
331
868
  {
332
- className: c(
333
- v({ tone: n.delta.tone }),
334
- "block text-sm"
869
+ className: g(
870
+ A({ tone: r.delta.tone }),
871
+ "block text-base"
335
872
  ),
336
- children: n.delta.value
873
+ children: r.delta.value
337
874
  }
338
- ) : /* @__PURE__ */ a("span", { "aria-label": "Not provided", className: "text-sm text-tertiary", children: "—" }) })
339
- ] }, n.label);
875
+ ) : /* @__PURE__ */ t("span", { "aria-label": "Not provided", className: "text-base text-tertiary", children: "—" }) })
876
+ ] }, r.label);
340
877
  }) })
341
878
  ] }) }),
342
- t.takeaway && /* @__PURE__ */ a(w, { signal: t.takeaway }),
343
- /* @__PURE__ */ a(
344
- N,
879
+ a.takeaway && /* @__PURE__ */ t(k, { signal: a.takeaway }),
880
+ /* @__PURE__ */ t(
881
+ y,
345
882
  {
346
- followUps: t.followUps,
347
- sources: t.sources,
348
- onFollowUp: r,
349
- onSourceSelect: s
883
+ spec: a,
884
+ onFollowUp: l,
885
+ onSourceSelect: d
350
886
  }
351
887
  )
352
888
  ]
353
889
  }
354
890
  ));
355
- j.displayName = "ComparisonAnswer";
356
- const S = u.forwardRef(
357
- ({ spec: t, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => {
358
- const n = u.useMemo(
359
- () => t.chart.unit ? (h) => `${te.format(h)}${t.chart.unit}` : void 0,
360
- [t.chart.unit]
361
- ), d = {
362
- data: t.chart.data,
363
- categoryKey: t.chart.categoryKey,
364
- series: t.chart.series,
365
- seriesLabels: t.chart.seriesLabels,
366
- highlight: t.chart.highlight,
367
- annotations: t.chart.annotations,
368
- formatValue: n,
369
- height: 224
370
- };
371
- return /* @__PURE__ */ i(
372
- "div",
373
- {
374
- ref: m,
375
- "data-answer-kind": t.kind,
376
- className: c("w-full max-w-2xl space-y-5", o),
377
- ...l,
378
- children: [
379
- /* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-4 sm:flex-row sm:items-end", children: [
380
- /* @__PURE__ */ a(y, { spec: t }),
381
- t.metric && /* @__PURE__ */ i("div", { className: "shrink-0 rounded-xl bg-muted px-4 py-3 text-left", children: [
382
- /* @__PURE__ */ a("p", { className: "text-xs font-medium text-tertiary", children: t.metric.label }),
383
- /* @__PURE__ */ a(
384
- "p",
385
- {
386
- className: c(
387
- v({ tone: t.metric.tone }),
388
- "mt-1 text-2xl tracking-tight"
389
- ),
390
- children: t.metric.value
391
- }
392
- ),
393
- t.metric.change && /* @__PURE__ */ a("p", { className: "mt-0.5 text-xs text-secondary", children: t.metric.change })
394
- ] })
395
- ] }),
396
- /* @__PURE__ */ a("div", { className: "rounded-2xl bg-surface px-3 pb-2 pt-4 sm:px-4", children: t.chart.type === "area" ? /* @__PURE__ */ a(_, { ...d }) : t.chart.type === "bar" ? /* @__PURE__ */ a(M, { ...d }) : /* @__PURE__ */ a(W, { ...d }) }),
397
- t.insight && /* @__PURE__ */ a(w, { signal: t.insight }),
398
- /* @__PURE__ */ a(
399
- N,
400
- {
401
- followUps: t.followUps,
402
- sources: t.sources,
403
- onFollowUp: r,
404
- onSourceSelect: s
405
- }
406
- )
407
- ]
408
- }
409
- );
410
- }
411
- );
412
- S.displayName = "TrendAnswer";
413
- const C = u.forwardRef(
414
- ({ spec: t, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
891
+ ne.displayName = "ComparisonAnswer";
892
+ const re = p.forwardRef(
893
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
415
894
  "div",
416
895
  {
417
- ref: m,
418
- "data-answer-kind": t.kind,
419
- className: c("w-full max-w-2xl space-y-5", o),
420
- ...l,
896
+ ref: h,
897
+ "data-answer-kind": a.kind,
898
+ className: g("@container w-full max-w-2xl space-y-5", m),
899
+ ...o,
421
900
  children: [
422
- /* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-3 sm:flex-row sm:items-start", children: [
423
- /* @__PURE__ */ a(y, { spec: t }),
424
- t.overall && /* @__PURE__ */ i(
425
- p,
426
- {
427
- variant: "soft",
428
- color: t.overall.tone ?? "default",
429
- className: "self-start",
430
- children: [
431
- t.overall.label,
432
- " · ",
433
- t.overall.value
434
- ]
435
- }
436
- )
901
+ /* @__PURE__ */ n("div", { className: "flex flex-col justify-between gap-4 @md:flex-row @md:items-end", children: [
902
+ /* @__PURE__ */ t(f, { spec: a }),
903
+ a.metric && /* @__PURE__ */ n("div", { className: "shrink-0 rounded-xl border border-border bg-card px-4 py-3 text-left", children: [
904
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: a.metric.label }),
905
+ /* @__PURE__ */ t(
906
+ "p",
907
+ {
908
+ className: g(
909
+ A({ tone: a.metric.tone }),
910
+ "mt-1 text-2xl tracking-tight"
911
+ ),
912
+ children: a.metric.value
913
+ }
914
+ ),
915
+ a.metric.change && /* @__PURE__ */ t("p", { className: "mt-0.5 text-xs text-secondary", children: a.metric.change })
916
+ ] })
437
917
  ] }),
438
- /* @__PURE__ */ a("ul", { className: "space-y-2", children: t.items.map((n) => /* @__PURE__ */ i(
918
+ /* @__PURE__ */ t(te, { chart: a.chart }),
919
+ a.insight && /* @__PURE__ */ t(k, { signal: a.insight }),
920
+ /* @__PURE__ */ t(
921
+ y,
922
+ {
923
+ spec: a,
924
+ onFollowUp: l,
925
+ onSourceSelect: d
926
+ }
927
+ )
928
+ ]
929
+ }
930
+ )
931
+ );
932
+ re.displayName = "TrendAnswer";
933
+ const ie = p.forwardRef(
934
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
935
+ "div",
936
+ {
937
+ ref: h,
938
+ "data-answer-kind": a.kind,
939
+ className: g("@container w-full max-w-2xl space-y-6", m),
940
+ ...o,
941
+ children: [
942
+ /* @__PURE__ */ t(f, { spec: a }),
943
+ /* @__PURE__ */ t("div", { className: "space-y-3", children: /* @__PURE__ */ t("ul", { className: "space-y-2", children: a.items.map((r) => /* @__PURE__ */ n(
439
944
  "li",
440
945
  {
441
- className: "flex items-start justify-between gap-4 rounded-xl bg-surface px-4 py-3",
946
+ className: "flex items-start justify-between gap-4 rounded-xl border border-border bg-card px-4 py-3",
442
947
  children: [
443
- /* @__PURE__ */ i("div", { className: "min-w-0", children: [
444
- /* @__PURE__ */ a("p", { className: "text-sm font-medium text-foreground", children: n.label }),
445
- n.detail && /* @__PURE__ */ a("p", { className: "mt-1 text-xs leading-5 text-secondary", children: n.detail })
948
+ /* @__PURE__ */ n("div", { className: "min-w-0", children: [
949
+ /* @__PURE__ */ t("p", { className: "text-sm font-normal text-foreground", children: r.label }),
950
+ r.detail && /* @__PURE__ */ t("p", { className: "mt-1 text-xs leading-5 text-secondary", children: r.detail })
446
951
  ] }),
447
- /* @__PURE__ */ i("div", { className: "shrink-0 text-right", children: [
448
- /* @__PURE__ */ a(p, { variant: "dot", color: n.tone ?? "default", children: n.status }),
449
- n.meta && /* @__PURE__ */ a("p", { className: "mt-1 text-xs tabular-nums text-tertiary", children: n.meta })
952
+ /* @__PURE__ */ n("div", { className: "shrink-0 text-right", children: [
953
+ /* @__PURE__ */ t(w, { variant: "dot", color: r.tone ?? "default", children: r.status }),
954
+ r.meta && /* @__PURE__ */ t("p", { className: "mt-1 text-xs tabular-nums text-tertiary", children: r.meta })
450
955
  ] })
451
956
  ]
452
957
  },
453
- n.label
454
- )) }),
455
- t.recommendation && /* @__PURE__ */ a(w, { signal: t.recommendation }),
456
- /* @__PURE__ */ a(
457
- N,
958
+ r.label
959
+ )) }) }),
960
+ a.recommendation && /* @__PURE__ */ t(k, { signal: a.recommendation }),
961
+ /* @__PURE__ */ t(
962
+ y,
458
963
  {
459
- followUps: t.followUps,
460
- sources: t.sources,
461
- onFollowUp: r,
462
- onSourceSelect: s
964
+ spec: a,
965
+ onFollowUp: l,
966
+ onSourceSelect: d
463
967
  }
464
968
  )
465
969
  ]
466
970
  }
467
971
  )
468
972
  );
469
- C.displayName = "StatusAnswer";
470
- const T = u.forwardRef(({ spec: t, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
973
+ ie.displayName = "StatusAnswer";
974
+ const le = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
471
975
  "div",
472
976
  {
473
- ref: m,
474
- "data-answer-kind": t.kind,
475
- className: c("w-full max-w-2xl space-y-5", o),
476
- ...l,
977
+ ref: h,
978
+ "data-answer-kind": a.kind,
979
+ className: g("@container w-full max-w-2xl space-y-5", m),
980
+ ...o,
477
981
  children: [
478
- /* @__PURE__ */ i("div", { className: "flex flex-col justify-between gap-3 sm:flex-row sm:items-end", children: [
479
- /* @__PURE__ */ a(y, { spec: t }),
480
- t.total && /* @__PURE__ */ i("div", { className: "shrink-0 sm:text-right", children: [
481
- /* @__PURE__ */ a("p", { className: "text-xs font-medium text-tertiary", children: t.total.label }),
482
- /* @__PURE__ */ a("p", { className: "mt-1 text-2xl font-semibold tabular-nums tracking-tight text-foreground", children: t.total.value })
982
+ /* @__PURE__ */ n("div", { className: "flex flex-col justify-between gap-3 @md:flex-row @md:items-end", children: [
983
+ /* @__PURE__ */ t(f, { spec: a }),
984
+ a.total && /* @__PURE__ */ n("div", { className: "shrink-0 @md:text-right", children: [
985
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: a.total.label }),
986
+ /* @__PURE__ */ t("p", { className: "mt-1 text-2xl font-semibold tabular-nums tracking-tight text-foreground", children: a.total.value })
483
987
  ] })
484
988
  ] }),
485
- /* @__PURE__ */ a("ol", { className: "space-y-2", children: t.items.map((n, d) => /* @__PURE__ */ i("li", { className: "rounded-xl bg-surface px-4 py-3", children: [
486
- /* @__PURE__ */ i("div", { className: "mb-2 flex items-start justify-between gap-4", children: [
487
- /* @__PURE__ */ i("div", { className: "flex min-w-0 items-start gap-2.5", children: [
488
- /* @__PURE__ */ a(p, { variant: "soft", className: "mt-0.5 tabular-nums", children: d + 1 }),
489
- /* @__PURE__ */ i("div", { className: "min-w-0", children: [
490
- /* @__PURE__ */ a("p", { className: "text-sm font-medium text-foreground", children: n.label }),
491
- n.detail && /* @__PURE__ */ a("p", { className: "mt-0.5 text-xs text-tertiary", children: n.detail })
989
+ /* @__PURE__ */ t("ol", { className: "space-y-2", children: a.items.map((r, i) => /* @__PURE__ */ n("li", { className: "rounded-xl border border-border bg-card px-4 py-3", children: [
990
+ /* @__PURE__ */ n("div", { className: "mb-2 flex items-start justify-between gap-4", children: [
991
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 items-start gap-2.5", children: [
992
+ /* @__PURE__ */ t(w, { variant: "soft", className: "mt-0.5 tabular-nums", children: i + 1 }),
993
+ /* @__PURE__ */ n("div", { className: "min-w-0", children: [
994
+ /* @__PURE__ */ t("p", { className: "text-sm font-normal text-foreground", children: r.label }),
995
+ r.detail && /* @__PURE__ */ t("p", { className: "mt-0.5 text-xs text-tertiary", children: r.detail })
492
996
  ] })
493
997
  ] }),
494
- /* @__PURE__ */ i("div", { className: "shrink-0 text-right", children: [
495
- /* @__PURE__ */ a("p", { className: c(v({ tone: n.tone }), "text-sm"), children: n.value }),
496
- /* @__PURE__ */ i("p", { className: "mt-0.5 text-xs tabular-nums text-tertiary", children: [
497
- n.share,
998
+ /* @__PURE__ */ n("div", { className: "shrink-0 text-right", children: [
999
+ /* @__PURE__ */ t("p", { className: g(A({ tone: r.tone }), "text-sm"), children: r.value }),
1000
+ /* @__PURE__ */ n("p", { className: "mt-0.5 text-xs tabular-nums text-tertiary", children: [
1001
+ r.share,
498
1002
  "%"
499
1003
  ] })
500
1004
  ] })
501
1005
  ] }),
502
- /* @__PURE__ */ a(
503
- I,
1006
+ /* @__PURE__ */ t(
1007
+ Oe,
504
1008
  {
505
- value: n.share,
1009
+ value: r.share,
506
1010
  size: "sm",
507
- color: ne(n.tone),
508
- label: `${n.label}: ${n.share}%`
1011
+ color: ba(r.tone),
1012
+ label: `${r.label}: ${r.share}%`
509
1013
  }
510
1014
  )
511
- ] }, n.label)) }),
512
- t.insight && /* @__PURE__ */ a(w, { signal: t.insight }),
513
- /* @__PURE__ */ a(
514
- N,
1015
+ ] }, r.label)) }),
1016
+ a.insight && /* @__PURE__ */ t(k, { signal: a.insight }),
1017
+ /* @__PURE__ */ t(
1018
+ y,
515
1019
  {
516
- followUps: t.followUps,
517
- sources: t.sources,
518
- onFollowUp: r,
519
- onSourceSelect: s
1020
+ spec: a,
1021
+ onFollowUp: l,
1022
+ onSourceSelect: d
520
1023
  }
521
1024
  )
522
1025
  ]
523
1026
  }
524
1027
  ));
525
- T.displayName = "BreakdownAnswer";
526
- const R = u.forwardRef(({ spec: t, onFollowUp: r, onSourceSelect: s, className: o, ...l }, m) => /* @__PURE__ */ i(
1028
+ le.displayName = "BreakdownAnswer";
1029
+ const se = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
527
1030
  "div",
528
1031
  {
529
- ref: m,
530
- "data-answer-kind": t.kind,
531
- className: c("w-full max-w-2xl space-y-5", o),
532
- ...l,
1032
+ ref: h,
1033
+ "data-answer-kind": a.kind,
1034
+ className: g("@container w-full max-w-2xl space-y-5", m),
1035
+ ...o,
533
1036
  children: [
534
- /* @__PURE__ */ a(y, { spec: t }),
535
- /* @__PURE__ */ a("ol", { className: "space-y-2", children: t.sections.map((n, d) => {
536
- var h;
537
- return /* @__PURE__ */ i("li", { className: "flex gap-3 rounded-xl bg-surface px-4 py-3.5", children: [
538
- /* @__PURE__ */ a(p, { variant: "soft", className: "mt-0.5 h-fit tabular-nums", children: d + 1 }),
539
- /* @__PURE__ */ i("div", { className: "min-w-0", children: [
540
- /* @__PURE__ */ a("h3", { className: "text-sm font-semibold text-foreground", children: n.title }),
541
- n.body && /* @__PURE__ */ a("p", { className: "mt-1 text-sm leading-6 text-secondary", children: n.body }),
542
- !!((h = n.bullets) != null && h.length) && /* @__PURE__ */ a("ul", { className: "mt-2 space-y-1.5", children: n.bullets.map((g) => /* @__PURE__ */ i("li", { className: "flex items-start gap-2 text-xs leading-5 text-secondary", children: [
543
- /* @__PURE__ */ a(
1037
+ /* @__PURE__ */ t(f, { spec: a }),
1038
+ /* @__PURE__ */ t("ol", { className: "space-y-2", children: a.sections.map((r, i) => {
1039
+ var s;
1040
+ return /* @__PURE__ */ n("li", { className: "flex gap-3 rounded-xl border border-border bg-card px-4 py-3.5", children: [
1041
+ /* @__PURE__ */ t(w, { variant: "soft", className: "mt-0.5 h-fit tabular-nums", children: i + 1 }),
1042
+ /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
1043
+ /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-foreground", children: r.title }),
1044
+ r.body && /* @__PURE__ */ t("p", { className: "mt-1 text-sm leading-6 text-secondary", children: r.body }),
1045
+ !!((s = r.bullets) != null && s.length) && /* @__PURE__ */ t("ul", { className: "mt-2 space-y-1.5", children: r.bullets.map((b) => /* @__PURE__ */ n("li", { className: "flex items-start gap-2 text-xs leading-5 text-secondary", children: [
1046
+ /* @__PURE__ */ t(
544
1047
  "span",
545
1048
  {
546
1049
  "aria-hidden": !0,
547
1050
  className: "mt-2 size-1 shrink-0 rounded-dot bg-muted-foreground"
548
1051
  }
549
1052
  ),
550
- /* @__PURE__ */ a("span", { children: g })
551
- ] }, g)) })
1053
+ /* @__PURE__ */ t("span", { children: b })
1054
+ ] }, b)) }),
1055
+ r.code && /* @__PURE__ */ t(
1056
+ R,
1057
+ {
1058
+ language: r.codeLanguage,
1059
+ isCopyable: !1,
1060
+ className: "mt-2",
1061
+ children: r.code
1062
+ }
1063
+ )
552
1064
  ] })
553
- ] }, n.title);
1065
+ ] }, r.title);
554
1066
  }) }),
555
- t.takeaway && /* @__PURE__ */ a(w, { signal: t.takeaway }),
556
- /* @__PURE__ */ a(
557
- N,
1067
+ a.takeaway && /* @__PURE__ */ t(k, { signal: a.takeaway }),
1068
+ /* @__PURE__ */ t(
1069
+ y,
558
1070
  {
559
- followUps: t.followUps,
560
- sources: t.sources,
561
- onFollowUp: r,
562
- onSourceSelect: s
1071
+ spec: a,
1072
+ onFollowUp: l,
1073
+ onSourceSelect: d
563
1074
  }
564
1075
  )
565
1076
  ]
566
1077
  }
567
1078
  ));
568
- R.displayName = "ExplanationAnswer";
569
- const ie = u.forwardRef(
570
- ({ spec: t, ...r }, s) => {
571
- switch (t.kind) {
572
- case "comparison":
573
- return /* @__PURE__ */ a(j, { ref: s, spec: t, ...r });
574
- case "trend":
575
- return /* @__PURE__ */ a(S, { ref: s, spec: t, ...r });
576
- case "status":
577
- return /* @__PURE__ */ a(C, { ref: s, spec: t, ...r });
578
- case "breakdown":
579
- return /* @__PURE__ */ a(T, { ref: s, spec: t, ...r });
580
- case "explanation":
581
- return /* @__PURE__ */ a(R, { ref: s, spec: t, ...r });
1079
+ se.displayName = "ExplanationAnswer";
1080
+ const oe = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1081
+ var r;
1082
+ return /* @__PURE__ */ n(
1083
+ "div",
1084
+ {
1085
+ ref: h,
1086
+ "data-answer-kind": a.kind,
1087
+ className: g("@container w-full max-w-2xl space-y-5", m),
1088
+ ...o,
1089
+ children: [
1090
+ /* @__PURE__ */ t(f, { spec: a }),
1091
+ a.lead && /* @__PURE__ */ t(W, { text: a.lead, className: "text-base" }),
1092
+ /* @__PURE__ */ t("div", { className: "space-y-5", children: a.blocks.map((i, s) => {
1093
+ var b;
1094
+ return /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1095
+ i.heading && /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-foreground", children: i.heading }),
1096
+ i.tone && i.tone !== "default" ? /* @__PURE__ */ n(
1097
+ T,
1098
+ {
1099
+ variant: X(i.tone),
1100
+ className: "border border-border bg-card",
1101
+ children: [
1102
+ i.lead && /* @__PURE__ */ t(O, { children: i.lead }),
1103
+ /* @__PURE__ */ t(L, { className: "text-base leading-6", children: i.body })
1104
+ ]
1105
+ }
1106
+ ) : /* @__PURE__ */ t(W, { text: i.body, lead: i.lead }),
1107
+ !!((b = i.bullets) != null && b.length) && /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: i.bullets.map((j) => /* @__PURE__ */ n(
1108
+ "li",
1109
+ {
1110
+ className: "flex items-start gap-2 text-sm leading-6 text-secondary",
1111
+ children: [
1112
+ /* @__PURE__ */ t(
1113
+ "span",
1114
+ {
1115
+ "aria-hidden": !0,
1116
+ className: "mt-2.5 size-1 shrink-0 rounded-dot bg-muted-foreground"
1117
+ }
1118
+ ),
1119
+ /* @__PURE__ */ t("span", { children: j })
1120
+ ]
1121
+ },
1122
+ j
1123
+ )) }),
1124
+ /* @__PURE__ */ t(z, { citations: i.citations })
1125
+ ] }, s);
1126
+ }) }),
1127
+ !!((r = a.takeaways) != null && r.length) && /* @__PURE__ */ n("div", { className: "space-y-2 rounded-2xl border border-border bg-card px-4 py-3.5", children: [
1128
+ /* @__PURE__ */ t("p", { className: "text-xs font-semibold uppercase tracking-wider text-tertiary", children: "Key takeaways" }),
1129
+ /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: a.takeaways.map((i, s) => /* @__PURE__ */ n(
1130
+ "li",
1131
+ {
1132
+ className: "flex items-start gap-2 text-sm leading-6 text-secondary",
1133
+ children: [
1134
+ /* @__PURE__ */ t(
1135
+ "span",
1136
+ {
1137
+ "aria-hidden": !0,
1138
+ className: "mt-2.5 size-1 shrink-0 rounded-dot bg-muted-foreground"
1139
+ }
1140
+ ),
1141
+ /* @__PURE__ */ n("span", { children: [
1142
+ i.lead && /* @__PURE__ */ n("span", { className: "font-semibold text-foreground", children: [
1143
+ i.lead,
1144
+ " —",
1145
+ " "
1146
+ ] }),
1147
+ i.body
1148
+ ] })
1149
+ ]
1150
+ },
1151
+ s
1152
+ )) })
1153
+ ] }),
1154
+ a.bottomLine && /* @__PURE__ */ t(k, { signal: a.bottomLine }),
1155
+ /* @__PURE__ */ t(
1156
+ y,
1157
+ {
1158
+ spec: a,
1159
+ onFollowUp: l,
1160
+ onSourceSelect: d
1161
+ }
1162
+ )
1163
+ ]
1164
+ }
1165
+ );
1166
+ });
1167
+ oe.displayName = "NarrativeAnswer";
1168
+ const de = p.forwardRef(
1169
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1170
+ var i;
1171
+ const r = [a.value.change, a.value.asOf].filter(Boolean).join(" · ");
1172
+ return /* @__PURE__ */ n(
1173
+ "div",
1174
+ {
1175
+ ref: h,
1176
+ "data-answer-kind": a.kind,
1177
+ className: g("@container w-full max-w-2xl space-y-5", m),
1178
+ ...o,
1179
+ children: [
1180
+ /* @__PURE__ */ t(f, { spec: a }),
1181
+ /* @__PURE__ */ n("div", { className: "rounded-2xl border border-border px-5 py-4", children: [
1182
+ /* @__PURE__ */ t("p", { className: "text-base font-normal text-tertiary", children: a.value.label }),
1183
+ /* @__PURE__ */ t(
1184
+ "p",
1185
+ {
1186
+ className: g(
1187
+ A({ tone: a.value.tone }),
1188
+ "mt-1 text-3xl font-normal tracking-tight"
1189
+ ),
1190
+ children: a.value.value
1191
+ }
1192
+ ),
1193
+ r && /* @__PURE__ */ t("p", { className: "mt-1 text-base text-secondary", children: r }),
1194
+ !!((i = a.facts) != null && i.length) && /* @__PURE__ */ t("dl", { className: "mt-4 flex flex-wrap items-baseline gap-x-6 gap-y-1.5 border-t border-border pt-3", children: a.facts.map((s) => /* @__PURE__ */ n("div", { className: "flex items-baseline gap-1.5", children: [
1195
+ /* @__PURE__ */ t("dt", { className: "text-xs font-normal text-tertiary", children: s.label }),
1196
+ /* @__PURE__ */ t(
1197
+ "dd",
1198
+ {
1199
+ className: g(
1200
+ A({ tone: s.tone }),
1201
+ "text-base font-normal tabular-nums"
1202
+ ),
1203
+ children: s.value
1204
+ }
1205
+ ),
1206
+ s.change && /* @__PURE__ */ t("dd", { className: "text-xs text-secondary", children: s.change })
1207
+ ] }, s.label)) })
1208
+ ] }),
1209
+ a.insight && /* @__PURE__ */ t(k, { signal: a.insight }),
1210
+ /* @__PURE__ */ t(
1211
+ y,
1212
+ {
1213
+ spec: a,
1214
+ citations: a.citations,
1215
+ onFollowUp: l,
1216
+ onSourceSelect: d
1217
+ }
1218
+ )
1219
+ ]
1220
+ }
1221
+ );
1222
+ }
1223
+ );
1224
+ de.displayName = "FactAnswer";
1225
+ const ce = p.forwardRef(
1226
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
1227
+ "div",
1228
+ {
1229
+ ref: h,
1230
+ "data-answer-kind": a.kind,
1231
+ className: g("@container w-full max-w-2xl space-y-5", m),
1232
+ ...o,
1233
+ children: [
1234
+ /* @__PURE__ */ t(f, { spec: a }),
1235
+ /* @__PURE__ */ t(ae, { table: a, caption: a.headline }),
1236
+ a.insight && /* @__PURE__ */ t(k, { signal: a.insight }),
1237
+ /* @__PURE__ */ t(
1238
+ y,
1239
+ {
1240
+ spec: a,
1241
+ onFollowUp: l,
1242
+ onSourceSelect: d
1243
+ }
1244
+ )
1245
+ ]
1246
+ }
1247
+ )
1248
+ );
1249
+ ce.displayName = "TableAnswer";
1250
+ const me = p.forwardRef(
1251
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => /* @__PURE__ */ n(
1252
+ "div",
1253
+ {
1254
+ ref: h,
1255
+ "data-answer-kind": a.kind,
1256
+ className: g("@container w-full max-w-2xl space-y-5", m),
1257
+ ...o,
1258
+ children: [
1259
+ /* @__PURE__ */ t(f, { spec: a }),
1260
+ /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1261
+ a.metricLabel && /* @__PURE__ */ t("p", { className: "text-base font-normal text-tertiary", children: a.metricLabel }),
1262
+ /* @__PURE__ */ t("ol", { className: "space-y-2", children: a.items.map((r, i) => /* @__PURE__ */ n(
1263
+ "li",
1264
+ {
1265
+ className: "flex items-start justify-between gap-4 rounded-xl border border-border bg-card px-4 py-3",
1266
+ children: [
1267
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 items-start gap-2.5", children: [
1268
+ /* @__PURE__ */ t(
1269
+ w,
1270
+ {
1271
+ variant: "soft",
1272
+ color: r.highlight ? "primary" : "default",
1273
+ className: "mt-0.5 tabular-nums",
1274
+ children: i + 1
1275
+ }
1276
+ ),
1277
+ /* @__PURE__ */ n("div", { className: "min-w-0", children: [
1278
+ /* @__PURE__ */ t(
1279
+ "p",
1280
+ {
1281
+ className: g(
1282
+ "text-base font-normal text-foreground",
1283
+ r.highlight && "font-semibold"
1284
+ ),
1285
+ children: r.label
1286
+ }
1287
+ ),
1288
+ r.detail && /* @__PURE__ */ t("p", { className: "mt-0.5 text-base text-tertiary", children: r.detail })
1289
+ ] })
1290
+ ] }),
1291
+ /* @__PURE__ */ n("div", { className: "shrink-0 text-right", children: [
1292
+ /* @__PURE__ */ t(
1293
+ "p",
1294
+ {
1295
+ className: g(
1296
+ A({ tone: r.tone }),
1297
+ "text-base",
1298
+ r.value === "—" && "font-normal text-tertiary"
1299
+ ),
1300
+ children: r.value
1301
+ }
1302
+ ),
1303
+ r.delta && /* @__PURE__ */ t(
1304
+ "p",
1305
+ {
1306
+ className: g(
1307
+ $({ tone: r.delta.tone }),
1308
+ "mt-0.5 text-xs tabular-nums"
1309
+ ),
1310
+ children: r.delta.value
1311
+ }
1312
+ )
1313
+ ] })
1314
+ ]
1315
+ },
1316
+ r.label
1317
+ )) }),
1318
+ a.tiebreak && /* @__PURE__ */ t("p", { className: "text-base leading-6 text-tertiary", children: a.tiebreak }),
1319
+ /* @__PURE__ */ t(z, { citations: a.citations })
1320
+ ] }),
1321
+ a.insight && /* @__PURE__ */ t(k, { signal: a.insight }),
1322
+ /* @__PURE__ */ t(
1323
+ y,
1324
+ {
1325
+ spec: a,
1326
+ onFollowUp: l,
1327
+ onSourceSelect: d
1328
+ }
1329
+ )
1330
+ ]
1331
+ }
1332
+ )
1333
+ );
1334
+ me.displayName = "RankingAnswer";
1335
+ const xa = {
1336
+ done: /* @__PURE__ */ t(q, { "aria-hidden": !0, className: "text-success-700" }),
1337
+ pending: /* @__PURE__ */ t(Ee, { "aria-hidden": !0, className: "text-tertiary" }),
1338
+ failed: /* @__PURE__ */ t(Ke, { "aria-hidden": !0, className: "text-danger-700" }),
1339
+ skipped: /* @__PURE__ */ t(Be, { "aria-hidden": !0, className: "text-tertiary" })
1340
+ }, fa = {
1341
+ done: "Done",
1342
+ pending: "Pending",
1343
+ failed: "Failed",
1344
+ skipped: "Skipped"
1345
+ }, he = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1346
+ var r, i;
1347
+ return /* @__PURE__ */ n(
1348
+ "div",
1349
+ {
1350
+ ref: h,
1351
+ "data-answer-kind": a.kind,
1352
+ className: g("@container w-full max-w-2xl space-y-5", m),
1353
+ ...o,
1354
+ children: [
1355
+ /* @__PURE__ */ n("div", { className: "flex flex-col justify-between gap-3 @md:flex-row @md:items-start", children: [
1356
+ /* @__PURE__ */ t(f, { spec: a }),
1357
+ /* @__PURE__ */ n(
1358
+ w,
1359
+ {
1360
+ variant: "soft",
1361
+ color: a.outcome.tone ?? "success",
1362
+ className: "self-start",
1363
+ children: [
1364
+ a.outcome.label,
1365
+ a.outcome.detail && ` · ${a.outcome.detail}`
1366
+ ]
1367
+ }
1368
+ )
1369
+ ] }),
1370
+ !!((r = a.changes) != null && r.length) && /* @__PURE__ */ t(ee, { items: a.changes }),
1371
+ !!((i = a.steps) != null && i.length) && /* @__PURE__ */ t("ul", { className: "space-y-2", children: a.steps.map((s) => /* @__PURE__ */ n(
1372
+ "li",
1373
+ {
1374
+ className: "flex items-start gap-3 rounded-xl border border-border bg-card px-4 py-3",
1375
+ children: [
1376
+ /* @__PURE__ */ t("span", { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center [&_svg]:size-4", children: xa[s.status] }),
1377
+ /* @__PURE__ */ n("div", { className: "min-w-0", children: [
1378
+ /* @__PURE__ */ n(
1379
+ "p",
1380
+ {
1381
+ className: g(
1382
+ "text-sm font-normal",
1383
+ s.status === "skipped" ? "text-tertiary" : "text-foreground"
1384
+ ),
1385
+ children: [
1386
+ s.label,
1387
+ /* @__PURE__ */ n("span", { className: "sr-only", children: [
1388
+ " — ",
1389
+ fa[s.status]
1390
+ ] })
1391
+ ]
1392
+ }
1393
+ ),
1394
+ s.detail && /* @__PURE__ */ t("p", { className: "mt-0.5 text-xs leading-5 text-secondary", children: s.detail })
1395
+ ] })
1396
+ ]
1397
+ },
1398
+ s.label
1399
+ )) }),
1400
+ a.safety && /* @__PURE__ */ n("p", { className: "flex items-center gap-1.5 text-xs text-tertiary", children: [
1401
+ /* @__PURE__ */ t(q, { "aria-hidden": !0, className: "size-3.5 shrink-0 text-success-700" }),
1402
+ a.safety
1403
+ ] }),
1404
+ a.next && /* @__PURE__ */ t("p", { className: "text-sm leading-6 text-secondary", children: a.next }),
1405
+ a.warning && /* @__PURE__ */ t(k, { signal: a.warning }),
1406
+ /* @__PURE__ */ t(
1407
+ y,
1408
+ {
1409
+ spec: a,
1410
+ onFollowUp: l,
1411
+ onSourceSelect: d
1412
+ }
1413
+ )
1414
+ ]
1415
+ }
1416
+ );
1417
+ });
1418
+ he.displayName = "ConfirmationAnswer";
1419
+ const ge = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1420
+ var i, s;
1421
+ const r = c ?? l;
1422
+ return /* @__PURE__ */ n(
1423
+ "div",
1424
+ {
1425
+ ref: h,
1426
+ "data-answer-kind": a.kind,
1427
+ className: g("@container w-full max-w-2xl space-y-5", m),
1428
+ ...o,
1429
+ children: [
1430
+ /* @__PURE__ */ t(f, { spec: a }),
1431
+ !!((i = a.findings) != null && i.length) && /* @__PURE__ */ t(ee, { items: a.findings }),
1432
+ /* @__PURE__ */ t("p", { className: "text-sm font-semibold leading-6 text-foreground", children: a.question }),
1433
+ !!((s = a.options) != null && s.length) && /* @__PURE__ */ t("div", { className: "space-y-2", children: a.options.map((b) => /* @__PURE__ */ n(
1434
+ "button",
1435
+ {
1436
+ type: "button",
1437
+ disabled: !r,
1438
+ onClick: () => r == null ? void 0 : r(b),
1439
+ className: g(
1440
+ "w-full rounded-xl bg-card px-4 py-3 text-left shadow-elevation",
1441
+ "transition-[background,transform,box-shadow] duration-(--duration-fast) ease-out motion-reduce:transition-none",
1442
+ "outline-none focus-visible:ring-3 focus-visible:ring-ring",
1443
+ "hover:bg-surface active:scale-(--scale-press)",
1444
+ "disabled:pointer-events-none"
1445
+ ),
1446
+ children: [
1447
+ /* @__PURE__ */ t("span", { className: "block text-sm font-semibold text-foreground", children: b.label }),
1448
+ b.description && /* @__PURE__ */ t("span", { className: "mt-0.5 block text-xs leading-5 text-secondary", children: b.description })
1449
+ ]
1450
+ },
1451
+ b.id
1452
+ )) }),
1453
+ /* @__PURE__ */ t(
1454
+ y,
1455
+ {
1456
+ spec: a,
1457
+ onFollowUp: l,
1458
+ onSourceSelect: d
1459
+ }
1460
+ )
1461
+ ]
1462
+ }
1463
+ );
1464
+ });
1465
+ ge.displayName = "ClarificationAnswer";
1466
+ const be = p.forwardRef(
1467
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1468
+ var r;
1469
+ return /* @__PURE__ */ n(
1470
+ "div",
1471
+ {
1472
+ ref: h,
1473
+ "data-answer-kind": a.kind,
1474
+ className: g("@container w-full max-w-2xl space-y-5", m),
1475
+ ...o,
1476
+ children: [
1477
+ /* @__PURE__ */ t(f, { spec: a }),
1478
+ !!((r = a.checks) != null && r.length) && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1479
+ /* @__PURE__ */ t("ul", { className: "space-y-2", children: a.checks.map((i) => /* @__PURE__ */ n(
1480
+ "li",
1481
+ {
1482
+ className: "flex items-start justify-between gap-4 rounded-xl border border-border bg-card px-4 py-2.5",
1483
+ children: [
1484
+ /* @__PURE__ */ t("span", { className: "min-w-0 text-sm font-normal text-foreground", children: i.label }),
1485
+ /* @__PURE__ */ t(
1486
+ "span",
1487
+ {
1488
+ className: g(
1489
+ "shrink-0 text-sm tabular-nums",
1490
+ i.tone ? $({ tone: i.tone }) : "text-tertiary"
1491
+ ),
1492
+ children: i.result
1493
+ }
1494
+ )
1495
+ ]
1496
+ },
1497
+ i.label
1498
+ )) }),
1499
+ /* @__PURE__ */ t(z, { citations: a.citations })
1500
+ ] }),
1501
+ a.reason && /* @__PURE__ */ t("p", { className: "text-sm leading-6 text-secondary", children: a.reason }),
1502
+ a.baseline && /* @__PURE__ */ n("div", { className: "rounded-xl border border-border bg-card px-4 py-3", children: [
1503
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: a.baseline.label }),
1504
+ /* @__PURE__ */ t("p", { className: "mt-1 text-lg font-semibold tabular-nums tracking-tight text-foreground", children: a.baseline.value })
1505
+ ] }),
1506
+ a.alternative && /* @__PURE__ */ t(k, { signal: a.alternative }),
1507
+ /* @__PURE__ */ t(
1508
+ y,
1509
+ {
1510
+ spec: a,
1511
+ onFollowUp: l,
1512
+ onSourceSelect: d
1513
+ }
1514
+ )
1515
+ ]
1516
+ }
1517
+ );
1518
+ }
1519
+ );
1520
+ be.displayName = "EmptyAnswer";
1521
+ const ya = {
1522
+ user: "You",
1523
+ admin: "Workspace admin",
1524
+ platform: "Platform team",
1525
+ agent: "Agent"
1526
+ }, pe = p.forwardRef(
1527
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1528
+ var r, i;
1529
+ return /* @__PURE__ */ n(
1530
+ "div",
1531
+ {
1532
+ ref: h,
1533
+ "data-answer-kind": a.kind,
1534
+ className: g("@container w-full max-w-2xl space-y-5", m),
1535
+ ...o,
1536
+ children: [
1537
+ /* @__PURE__ */ t(f, { spec: a }),
1538
+ /* @__PURE__ */ n(T, { variant: "danger", className: "border border-border bg-card", children: [
1539
+ /* @__PURE__ */ t(O, { children: a.failure.summary }),
1540
+ a.failure.tally && /* @__PURE__ */ t(L, { className: "text-base leading-6", children: a.failure.tally })
1541
+ ] }),
1542
+ a.failure.detail && /* @__PURE__ */ t(R, { isCopyable: !1, children: a.failure.detail }),
1543
+ !!((r = a.attempts) != null && r.length) && /* @__PURE__ */ t("ul", { className: "space-y-2", children: a.attempts.map((s) => /* @__PURE__ */ n(
1544
+ "li",
1545
+ {
1546
+ className: "flex items-start justify-between gap-4 rounded-xl border border-border bg-card px-4 py-2.5",
1547
+ children: [
1548
+ /* @__PURE__ */ t("span", { className: "min-w-0 break-all font-mono text-xs leading-5 text-foreground", children: s.label }),
1549
+ /* @__PURE__ */ t("span", { className: "shrink-0 text-xs text-danger-700", children: s.result })
1550
+ ]
1551
+ },
1552
+ s.label
1553
+ )) }),
1554
+ !!((i = a.resolution) != null && i.length) && /* @__PURE__ */ t("ol", { className: "space-y-2", children: a.resolution.map((s, b) => /* @__PURE__ */ n(
1555
+ "li",
1556
+ {
1557
+ className: "flex items-start justify-between gap-4 rounded-xl border border-border bg-card px-4 py-3",
1558
+ children: [
1559
+ /* @__PURE__ */ n("div", { className: "flex min-w-0 items-start gap-2.5", children: [
1560
+ /* @__PURE__ */ t(w, { variant: "soft", className: "mt-0.5 tabular-nums", children: b + 1 }),
1561
+ /* @__PURE__ */ t("p", { className: "text-sm leading-6 text-foreground", children: s.action })
1562
+ ] }),
1563
+ s.owner && /* @__PURE__ */ t(w, { variant: "soft", className: "shrink-0", children: ya[s.owner] })
1564
+ ]
1565
+ },
1566
+ s.action
1567
+ )) }),
1568
+ a.preserved && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1569
+ /* @__PURE__ */ t("p", { className: "text-xs font-normal text-tertiary", children: "Ready to run once the connection is back" }),
1570
+ /* @__PURE__ */ t(
1571
+ R,
1572
+ {
1573
+ language: a.preserved.language,
1574
+ filename: a.preserved.label,
1575
+ className: "max-h-64",
1576
+ children: a.preserved.code
1577
+ }
1578
+ )
1579
+ ] }),
1580
+ /* @__PURE__ */ t(
1581
+ y,
1582
+ {
1583
+ spec: a,
1584
+ onFollowUp: l,
1585
+ onSourceSelect: d
1586
+ }
1587
+ )
1588
+ ]
1589
+ }
1590
+ );
1591
+ }
1592
+ );
1593
+ pe.displayName = "ErrorAnswer";
1594
+ const ue = p.forwardRef(
1595
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1596
+ var r;
1597
+ return /* @__PURE__ */ n(
1598
+ "div",
1599
+ {
1600
+ ref: h,
1601
+ "data-answer-kind": a.kind,
1602
+ className: g("@container w-full max-w-2xl space-y-5", m),
1603
+ ...o,
1604
+ children: [
1605
+ /* @__PURE__ */ t(f, { spec: a }),
1606
+ a.completed && /* @__PURE__ */ n("p", { className: "flex items-start gap-2 text-sm leading-6 text-secondary", children: [
1607
+ /* @__PURE__ */ t(q, { "aria-hidden": !0, className: "mt-1 size-4 shrink-0 text-success-700" }),
1608
+ /* @__PURE__ */ t("span", { children: a.completed })
1609
+ ] }),
1610
+ /* @__PURE__ */ n(T, { variant: "warning", className: "border border-border bg-card", children: [
1611
+ /* @__PURE__ */ t(O, { children: "Declined" }),
1612
+ /* @__PURE__ */ t(L, { className: "text-base leading-6", children: a.reason })
1613
+ ] }),
1614
+ a.scope && /* @__PURE__ */ t("p", { className: "text-xs leading-5 text-tertiary", children: a.scope }),
1615
+ !!((r = a.alternatives) != null && r.length) && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1616
+ /* @__PURE__ */ t("p", { className: "text-xs font-semibold uppercase tracking-wider text-tertiary", children: "Available instead" }),
1617
+ /* @__PURE__ */ t("ul", { className: "space-y-2", children: a.alternatives.map((i) => /* @__PURE__ */ n(
1618
+ "li",
1619
+ {
1620
+ className: "rounded-xl border border-border bg-card px-4 py-3",
1621
+ children: [
1622
+ /* @__PURE__ */ t("p", { className: "text-sm font-semibold text-foreground", children: i.label }),
1623
+ i.description && /* @__PURE__ */ t("p", { className: "mt-0.5 text-xs leading-5 text-secondary", children: i.description })
1624
+ ]
1625
+ },
1626
+ i.label
1627
+ )) })
1628
+ ] }),
1629
+ /* @__PURE__ */ t(
1630
+ y,
1631
+ {
1632
+ spec: a,
1633
+ onFollowUp: l,
1634
+ onSourceSelect: d
1635
+ }
1636
+ )
1637
+ ]
1638
+ }
1639
+ );
1640
+ }
1641
+ );
1642
+ ue.displayName = "RefusalAnswer";
1643
+ const xe = p.forwardRef(({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1644
+ var r;
1645
+ return /* @__PURE__ */ n(
1646
+ "div",
1647
+ {
1648
+ ref: h,
1649
+ "data-answer-kind": a.kind,
1650
+ className: g("@container w-full max-w-2xl space-y-5", m),
1651
+ ...o,
1652
+ children: [
1653
+ /* @__PURE__ */ t(f, { spec: a }),
1654
+ /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1655
+ a.entries.map((i) => {
1656
+ var s;
1657
+ return /* @__PURE__ */ n("div", { className: "rounded-xl border border-border bg-card px-4 py-3.5", children: [
1658
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
1659
+ /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-foreground", children: i.term }),
1660
+ i.category && /* @__PURE__ */ t(w, { variant: "soft", children: i.category })
1661
+ ] }),
1662
+ i.body && /* @__PURE__ */ t("p", { className: "mt-1 text-sm leading-6 text-secondary", children: i.body }),
1663
+ i.formula && /* @__PURE__ */ t(R, { isCopyable: !1, className: "mt-2", children: i.formula }),
1664
+ !!((s = i.items) != null && s.length) && /* @__PURE__ */ t("ul", { className: "mt-2 space-y-1.5", children: i.items.map((b) => /* @__PURE__ */ n(
1665
+ "li",
1666
+ {
1667
+ className: "flex items-baseline justify-between gap-4 text-xs leading-5",
1668
+ children: [
1669
+ /* @__PURE__ */ t("span", { className: "font-normal text-secondary", children: b.label }),
1670
+ /* @__PURE__ */ t(
1671
+ "span",
1672
+ {
1673
+ className: g(
1674
+ "min-w-0 text-right text-foreground",
1675
+ b.code ? "break-all font-mono" : "tabular-nums"
1676
+ ),
1677
+ children: b.value
1678
+ }
1679
+ )
1680
+ ]
1681
+ },
1682
+ b.label
1683
+ )) })
1684
+ ] }, i.term);
1685
+ }),
1686
+ /* @__PURE__ */ t(z, { citations: a.citations })
1687
+ ] }),
1688
+ !!((r = a.gaps) != null && r.length) && /* @__PURE__ */ n(T, { variant: "warning", className: "border border-border bg-card", children: [
1689
+ /* @__PURE__ */ t(O, { children: "Not found" }),
1690
+ /* @__PURE__ */ t(L, { className: "text-base leading-6", children: a.gaps.map((i) => /* @__PURE__ */ t("span", { className: "mt-1 block first:mt-0", children: i }, i)) })
1691
+ ] }),
1692
+ a.compliance && /* @__PURE__ */ n("p", { className: "flex items-center gap-1.5 text-xs text-tertiary", children: [
1693
+ /* @__PURE__ */ t(q, { "aria-hidden": !0, className: "size-3.5 shrink-0 text-success-700" }),
1694
+ a.compliance
1695
+ ] }),
1696
+ /* @__PURE__ */ t(
1697
+ y,
1698
+ {
1699
+ spec: a,
1700
+ onFollowUp: l,
1701
+ onSourceSelect: d
1702
+ }
1703
+ )
1704
+ ]
582
1705
  }
1706
+ );
1707
+ });
1708
+ xe.displayName = "KnowledgeAnswer";
1709
+ const fe = p.forwardRef(
1710
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1711
+ var r;
1712
+ return /* @__PURE__ */ n(
1713
+ "div",
1714
+ {
1715
+ ref: h,
1716
+ "data-answer-kind": a.kind,
1717
+ className: g("@container w-full max-w-2xl space-y-5", m),
1718
+ ...o,
1719
+ children: [
1720
+ /* @__PURE__ */ t(f, { spec: a }),
1721
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: a.options.map((i) => {
1722
+ var s, b, j, V;
1723
+ return /* @__PURE__ */ n("div", { className: "rounded-2xl border border-border bg-card p-4", children: [
1724
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
1725
+ /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-foreground", children: i.name }),
1726
+ i.tag && /* @__PURE__ */ t(w, { variant: "soft", children: i.tag }),
1727
+ i.recommended && /* @__PURE__ */ t(w, { variant: "soft", color: "primary", children: "Recommended" })
1728
+ ] }),
1729
+ i.description && /* @__PURE__ */ t("p", { className: "mt-1 text-sm leading-6 text-secondary", children: i.description }),
1730
+ (!!((s = i.pros) != null && s.length) || !!((b = i.cons) != null && b.length)) && /* @__PURE__ */ n("div", { className: "mt-3 grid gap-x-6 gap-y-1.5 @lg:grid-cols-2", children: [
1731
+ !!((j = i.pros) != null && j.length) && /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: i.pros.map((C) => /* @__PURE__ */ n(
1732
+ "li",
1733
+ {
1734
+ className: "flex items-start gap-2 text-xs leading-5 text-secondary",
1735
+ children: [
1736
+ /* @__PURE__ */ t(
1737
+ "span",
1738
+ {
1739
+ "aria-hidden": !0,
1740
+ className: "mt-1.5 size-1 shrink-0 rounded-dot bg-success-700"
1741
+ }
1742
+ ),
1743
+ /* @__PURE__ */ t("span", { children: C })
1744
+ ]
1745
+ },
1746
+ C
1747
+ )) }),
1748
+ !!((V = i.cons) != null && V.length) && /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: i.cons.map((C) => /* @__PURE__ */ n(
1749
+ "li",
1750
+ {
1751
+ className: "flex items-start gap-2 text-xs leading-5 text-secondary",
1752
+ children: [
1753
+ /* @__PURE__ */ t(
1754
+ "span",
1755
+ {
1756
+ "aria-hidden": !0,
1757
+ className: "mt-1.5 size-1 shrink-0 rounded-dot bg-danger-700"
1758
+ }
1759
+ ),
1760
+ /* @__PURE__ */ t("span", { children: C })
1761
+ ]
1762
+ },
1763
+ C
1764
+ )) })
1765
+ ] })
1766
+ ] }, i.name);
1767
+ }) }),
1768
+ !!((r = a.guidance) != null && r.length) && /* @__PURE__ */ t("dl", { className: "rounded-2xl border border-border bg-card px-4 py-2", children: a.guidance.map((i) => /* @__PURE__ */ n(
1769
+ "div",
1770
+ {
1771
+ className: "flex items-baseline justify-between gap-4 py-1.5",
1772
+ children: [
1773
+ /* @__PURE__ */ t("dt", { className: "text-sm font-normal text-secondary", children: i.when }),
1774
+ /* @__PURE__ */ t("dd", { className: "text-right text-sm font-semibold text-foreground", children: i.choose })
1775
+ ]
1776
+ },
1777
+ i.when
1778
+ )) }),
1779
+ /* @__PURE__ */ t(
1780
+ y,
1781
+ {
1782
+ spec: a,
1783
+ onFollowUp: l,
1784
+ onSourceSelect: d
1785
+ }
1786
+ )
1787
+ ]
1788
+ }
1789
+ );
1790
+ }
1791
+ );
1792
+ fe.displayName = "DecisionAnswer";
1793
+ const ye = p.forwardRef(
1794
+ ({ spec: a, onFollowUp: l, onOptionSelect: c, onSourceSelect: d, className: m, ...o }, h) => {
1795
+ var r;
1796
+ return /* @__PURE__ */ n(
1797
+ "div",
1798
+ {
1799
+ ref: h,
1800
+ "data-answer-kind": a.kind,
1801
+ className: g("@container w-full max-w-2xl space-y-5", m),
1802
+ ...o,
1803
+ children: [
1804
+ /* @__PURE__ */ t(f, { spec: a }),
1805
+ a.sections.map((i, s) => /* @__PURE__ */ n("section", { className: "space-y-2", children: [
1806
+ i.title && /* @__PURE__ */ t("h3", { className: "text-sm font-semibold text-foreground", children: i.title }),
1807
+ i.type === "text" && /* @__PURE__ */ t(W, { text: i.body }),
1808
+ i.type === "metrics" && /* @__PURE__ */ t(ua, { items: i.items }),
1809
+ i.type === "table" && /* @__PURE__ */ t(
1810
+ ae,
1811
+ {
1812
+ table: i,
1813
+ caption: i.title ?? a.headline
1814
+ }
1815
+ ),
1816
+ i.type === "chart" && /* @__PURE__ */ n(D, { children: [
1817
+ /* @__PURE__ */ t(te, { chart: i.chart }),
1818
+ i.note && /* @__PURE__ */ t("p", { className: "text-xs text-tertiary", children: i.note })
1819
+ ] }),
1820
+ i.type === "list" && /* @__PURE__ */ t("ul", { className: "space-y-1.5", children: i.items.map((b) => /* @__PURE__ */ n(
1821
+ "li",
1822
+ {
1823
+ className: "flex items-start gap-2 text-sm leading-6 text-secondary",
1824
+ children: [
1825
+ /* @__PURE__ */ t(
1826
+ "span",
1827
+ {
1828
+ "aria-hidden": !0,
1829
+ className: "mt-2.5 size-1 shrink-0 rounded-dot bg-muted-foreground"
1830
+ }
1831
+ ),
1832
+ /* @__PURE__ */ n("span", { children: [
1833
+ b.lead && /* @__PURE__ */ n("span", { className: "font-semibold text-foreground", children: [
1834
+ b.lead,
1835
+ " —",
1836
+ " "
1837
+ ] }),
1838
+ b.body
1839
+ ] })
1840
+ ]
1841
+ },
1842
+ b.body
1843
+ )) })
1844
+ ] }, s)),
1845
+ !!((r = a.definitions) != null && r.length) && /* @__PURE__ */ n("div", { className: "space-y-1.5 pt-1", children: [
1846
+ /* @__PURE__ */ t("p", { className: "text-xs font-semibold uppercase tracking-wider text-tertiary", children: "Definitions" }),
1847
+ /* @__PURE__ */ t("dl", { className: "space-y-1", children: a.definitions.map((i) => /* @__PURE__ */ n("div", { className: "text-xs leading-5", children: [
1848
+ /* @__PURE__ */ t("dt", { className: "inline font-semibold text-secondary", children: i.term }),
1849
+ " ",
1850
+ /* @__PURE__ */ n("dd", { className: "inline text-tertiary", children: [
1851
+ "— ",
1852
+ i.meaning
1853
+ ] })
1854
+ ] }, i.term)) })
1855
+ ] }),
1856
+ /* @__PURE__ */ t(
1857
+ y,
1858
+ {
1859
+ spec: a,
1860
+ onFollowUp: l,
1861
+ onSourceSelect: d
1862
+ }
1863
+ )
1864
+ ]
1865
+ }
1866
+ );
1867
+ }
1868
+ );
1869
+ ye.displayName = "ReportAnswer";
1870
+ const Na = p.forwardRef(
1871
+ ({ kind: a, className: l, ...c }, d) => {
1872
+ const m = a === "trend" ? "chart" : a === "fact" ? "tiles" : a === "table" || a === "comparison" || a === "report" ? "table" : a === "narrative" || a === "explanation" || a === "refusal" ? "prose" : a ? "rows" : "block";
1873
+ return /* @__PURE__ */ n(
1874
+ "div",
1875
+ {
1876
+ ref: d,
1877
+ "data-answer-kind": a,
1878
+ "aria-label": "Building answer",
1879
+ className: g("w-full max-w-2xl space-y-4", l),
1880
+ ...c,
1881
+ children: [
1882
+ /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1883
+ /* @__PURE__ */ t(u, { className: "h-3 w-24" }),
1884
+ /* @__PURE__ */ t(u, { className: "h-7 w-4/5" }),
1885
+ /* @__PURE__ */ t(u, { className: "h-4 w-full" })
1886
+ ] }),
1887
+ m === "chart" && /* @__PURE__ */ t(u, { className: "h-56 w-full rounded-2xl" }),
1888
+ m === "tiles" && /* @__PURE__ */ n(D, { children: [
1889
+ /* @__PURE__ */ t(u, { className: "h-24 w-full rounded-2xl" }),
1890
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-2", children: [
1891
+ /* @__PURE__ */ t(u, { className: "h-16 rounded-xl" }),
1892
+ /* @__PURE__ */ t(u, { className: "h-16 rounded-xl" })
1893
+ ] })
1894
+ ] }),
1895
+ m === "table" && /* @__PURE__ */ t(u, { className: "h-48 w-full rounded-2xl" }),
1896
+ m === "rows" && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1897
+ /* @__PURE__ */ t(u, { className: "h-12 w-full rounded-xl" }),
1898
+ /* @__PURE__ */ t(u, { className: "h-12 w-full rounded-xl" }),
1899
+ /* @__PURE__ */ t(u, { className: "h-12 w-full rounded-xl" })
1900
+ ] }),
1901
+ m === "prose" && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1902
+ /* @__PURE__ */ t(u, { className: "h-4 w-full" }),
1903
+ /* @__PURE__ */ t(u, { className: "h-4 w-full" }),
1904
+ /* @__PURE__ */ t(u, { className: "h-4 w-11/12" }),
1905
+ /* @__PURE__ */ t(u, { className: "h-4 w-full" }),
1906
+ /* @__PURE__ */ t(u, { className: "h-4 w-4/5" })
1907
+ ] }),
1908
+ m === "block" && /* @__PURE__ */ t(u, { className: "h-48 w-full rounded-2xl" })
1909
+ ]
1910
+ }
1911
+ );
1912
+ }
1913
+ );
1914
+ Na.displayName = "AnswerSkeleton";
1915
+ const wa = p.forwardRef(
1916
+ ({ spec: a, onCitationSelect: l, ...c }, d) => {
1917
+ const m = (() => {
1918
+ switch (a.kind) {
1919
+ case "comparison":
1920
+ return /* @__PURE__ */ t(ne, { ref: d, spec: a, ...c });
1921
+ case "trend":
1922
+ return /* @__PURE__ */ t(re, { ref: d, spec: a, ...c });
1923
+ case "status":
1924
+ return /* @__PURE__ */ t(ie, { ref: d, spec: a, ...c });
1925
+ case "breakdown":
1926
+ return /* @__PURE__ */ t(le, { ref: d, spec: a, ...c });
1927
+ case "explanation":
1928
+ return /* @__PURE__ */ t(se, { ref: d, spec: a, ...c });
1929
+ case "narrative":
1930
+ return /* @__PURE__ */ t(oe, { ref: d, spec: a, ...c });
1931
+ case "fact":
1932
+ return /* @__PURE__ */ t(de, { ref: d, spec: a, ...c });
1933
+ case "table":
1934
+ return /* @__PURE__ */ t(ce, { ref: d, spec: a, ...c });
1935
+ case "ranking":
1936
+ return /* @__PURE__ */ t(me, { ref: d, spec: a, ...c });
1937
+ case "confirmation":
1938
+ return /* @__PURE__ */ t(he, { ref: d, spec: a, ...c });
1939
+ case "clarification":
1940
+ return /* @__PURE__ */ t(ge, { ref: d, spec: a, ...c });
1941
+ case "empty":
1942
+ return /* @__PURE__ */ t(be, { ref: d, spec: a, ...c });
1943
+ case "error":
1944
+ return /* @__PURE__ */ t(pe, { ref: d, spec: a, ...c });
1945
+ case "refusal":
1946
+ return /* @__PURE__ */ t(ue, { ref: d, spec: a, ...c });
1947
+ case "knowledge":
1948
+ return /* @__PURE__ */ t(xe, { ref: d, spec: a, ...c });
1949
+ case "decision":
1950
+ return /* @__PURE__ */ t(fe, { ref: d, spec: a, ...c });
1951
+ case "report":
1952
+ return /* @__PURE__ */ t(ye, { ref: d, spec: a, ...c });
1953
+ }
1954
+ })();
1955
+ return /* @__PURE__ */ t(J.Provider, { value: l, children: m });
583
1956
  }
584
1957
  );
585
- ie.displayName = "AnswerRenderer";
1958
+ wa.displayName = "AnswerRenderer";
586
1959
  export {
587
- H as ANSWER_TOOL_DESCRIPTION,
588
- K as ANSWER_TOOL_NAME,
589
- F as AnswerFollowUpSchema,
590
- ie as AnswerRenderer,
591
- b as AnswerSignalSchema,
592
- q as AnswerSourceSchema,
593
- ee as AnswerSpecSchema,
594
- x as AnswerToneSchema,
595
- T as BreakdownAnswer,
596
- Y as BreakdownAnswerSchema,
597
- j as ComparisonAnswer,
598
- G as ComparisonAnswerSchema,
599
- R as ExplanationAnswer,
600
- Z as ExplanationAnswerSchema,
601
- C as StatusAnswer,
602
- X as StatusAnswerSchema,
603
- S as TrendAnswer,
604
- U as TrendAnswerSchema,
605
- pe as answerTool
1960
+ Fa as ANSWER_KINDS,
1961
+ Pe as ANSWER_TOOL_DESCRIPTION,
1962
+ We as ANSWER_TOOL_NAME,
1963
+ Y as AnswerChartSchema,
1964
+ _e as AnswerCitationSchema,
1965
+ S as AnswerCitationsSchema,
1966
+ $e as AnswerFollowUpSchema,
1967
+ P as AnswerKeyValueSchema,
1968
+ Q as AnswerMetricSchema,
1969
+ Ve as AnswerOptionSchema,
1970
+ wa as AnswerRenderer,
1971
+ v as AnswerSignalSchema,
1972
+ Na as AnswerSkeleton,
1973
+ Me as AnswerSourceSchema,
1974
+ ha as AnswerSpecSchema,
1975
+ N as AnswerToneSchema,
1976
+ le as BreakdownAnswer,
1977
+ Xe as BreakdownAnswerSchema,
1978
+ ge as ClarificationAnswer,
1979
+ ra as ClarificationAnswerSchema,
1980
+ ne as ComparisonAnswer,
1981
+ Ie as ComparisonAnswerSchema,
1982
+ he as ConfirmationAnswer,
1983
+ na as ConfirmationAnswerSchema,
1984
+ fe as DecisionAnswer,
1985
+ da as DecisionAnswerSchema,
1986
+ be as EmptyAnswer,
1987
+ ia as EmptyAnswerSchema,
1988
+ pe as ErrorAnswer,
1989
+ la as ErrorAnswerSchema,
1990
+ se as ExplanationAnswer,
1991
+ Je as ExplanationAnswerSchema,
1992
+ de as FactAnswer,
1993
+ Ue as FactAnswerSchema,
1994
+ xe as KnowledgeAnswer,
1995
+ oa as KnowledgeAnswerSchema,
1996
+ oe as NarrativeAnswer,
1997
+ Ze as NarrativeAnswerSchema,
1998
+ me as RankingAnswer,
1999
+ ta as RankingAnswerSchema,
2000
+ ue as RefusalAnswer,
2001
+ sa as RefusalAnswerSchema,
2002
+ ye as ReportAnswer,
2003
+ ma as ReportAnswerSchema,
2004
+ ie as StatusAnswer,
2005
+ Ge as StatusAnswerSchema,
2006
+ ce as TableAnswer,
2007
+ aa as TableAnswerSchema,
2008
+ re as TrendAnswer,
2009
+ Ye as TrendAnswerSchema,
2010
+ Wa as answerTool
606
2011
  };