@timbal-ai/timbal-react 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +13 -7
  3. package/dist/app.cjs +1234 -867
  4. package/dist/app.d.cts +2 -2
  5. package/dist/app.d.ts +2 -2
  6. package/dist/app.esm.js +14 -6
  7. package/dist/{chart-artifact-CX-rh9nq.d.cts → chart-artifact-E58ve76I.d.cts} +29 -3
  8. package/dist/{chart-artifact-BZp7nmaf.d.ts → chart-artifact-_PEJgCpQ.d.ts} +29 -3
  9. package/dist/{chat-DCms8pJ_.d.cts → chat-ClmzWzCX.d.cts} +2 -0
  10. package/dist/{chat-DCms8pJ_.d.ts → chat-ClmzWzCX.d.ts} +2 -0
  11. package/dist/chat.cjs +868 -511
  12. package/dist/chat.d.cts +1 -1
  13. package/dist/chat.d.ts +1 -1
  14. package/dist/chat.esm.js +3 -3
  15. package/dist/{chunk-6HWMJNZT.esm.js → chunk-4VULP3CJ.esm.js} +1 -1
  16. package/dist/{chunk-XCM3V6RK.esm.js → chunk-AGJKK6R7.esm.js} +2 -2
  17. package/dist/{chunk-4AKJ6FKE.esm.js → chunk-BMXFXLVV.esm.js} +120 -22
  18. package/dist/{chunk-JEAUF54A.esm.js → chunk-FEYZUVBM.esm.js} +1 -1
  19. package/dist/{chunk-FRZOEYBO.esm.js → chunk-MTYXREHK.esm.js} +4 -4
  20. package/dist/{chunk-P3KDAYX6.esm.js → chunk-NAMKO2MU.esm.js} +1 -1
  21. package/dist/{chunk-YXZ22OJN.esm.js → chunk-UY7AKWJL.esm.js} +670 -402
  22. package/dist/{chunk-TK2AGIME.esm.js → chunk-XDIY2WSL.esm.js} +15 -13
  23. package/dist/index.cjs +1871 -1497
  24. package/dist/index.d.cts +5 -5
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.esm.js +21 -9
  27. package/dist/{pill-segmented-tabs-Ba5q0feL.d.cts → pill-segmented-tabs-BsIOW1Lo.d.cts} +32 -4
  28. package/dist/{pill-segmented-tabs-Ba5q0feL.d.ts → pill-segmented-tabs-BsIOW1Lo.d.ts} +32 -4
  29. package/dist/studio.cjs +1089 -732
  30. package/dist/studio.d.cts +2 -2
  31. package/dist/studio.d.ts +2 -2
  32. package/dist/studio.esm.js +5 -5
  33. package/dist/styles.css +14 -16
  34. package/dist/ui.cjs +122 -22
  35. package/dist/ui.d.cts +1 -1
  36. package/dist/ui.d.ts +1 -1
  37. package/dist/ui.esm.js +8 -4
  38. package/dist/{welcome-CRqOPKMp.d.cts → welcome-BFGRoNfK.d.cts} +1 -1
  39. package/dist/{welcome-DlHUa3OL.d.ts → welcome-DXqsGTwH.d.ts} +1 -1
  40. package/package.json +1 -1
  41. package/vite/local-dev.d.ts +5 -1
  42. package/vite/local-dev.mjs +17 -13
@@ -23,7 +23,7 @@ import {
23
23
  TooltipProvider,
24
24
  TooltipTrigger,
25
25
  cn
26
- } from "./chunk-4AKJ6FKE.esm.js";
26
+ } from "./chunk-BMXFXLVV.esm.js";
27
27
 
28
28
  // src/chat/tooltip-icon-button.tsx
29
29
  import { forwardRef } from "react";
@@ -207,7 +207,44 @@ var ComposerAddAttachment = () => {
207
207
  ) });
208
208
  };
209
209
 
210
+ // src/charts/line-area-chart-utils.ts
211
+ function resolveChartMargin(options) {
212
+ const { flush, showXAxis, showYAxis } = options;
213
+ if (!flush) {
214
+ return { top: 8, right: 12, bottom: 0, left: 0 };
215
+ }
216
+ const anyAxis = showXAxis || showYAxis;
217
+ if (!anyAxis) {
218
+ return { top: 8, right: 12, bottom: 8, left: 12 };
219
+ }
220
+ return {
221
+ top: 8,
222
+ right: 12,
223
+ bottom: showXAxis ? 24 : 8,
224
+ left: showYAxis ? 8 : 12
225
+ };
226
+ }
227
+ function flushBarCategoryGap(flush, showCategoryAxis) {
228
+ return flush && showCategoryAxis ? "0%" : void 0;
229
+ }
230
+ function flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis) {
231
+ return flush && (variant === "line" || variant === "area") && showXAxis && !showYAxis;
232
+ }
233
+ function resolveTooltipCategory(label, payload, xKey, data, formatX) {
234
+ const row = payload?.[0]?.payload;
235
+ if (row && xKey in row) {
236
+ const idx = data.indexOf(row);
237
+ return formatX(row[xKey], idx >= 0 ? idx : 0);
238
+ }
239
+ if (label != null && label !== "") {
240
+ const idx = typeof label === "number" ? label : data.findIndex((r) => r[xKey] === label || String(r[xKey]) === String(label));
241
+ return formatX(label, idx >= 0 ? idx : 0);
242
+ }
243
+ return "";
244
+ }
245
+
210
246
  // src/charts/line-area-chart.tsx
247
+ import { useId } from "react";
211
248
  import {
212
249
  Area,
213
250
  AreaChart,
@@ -220,6 +257,83 @@ import {
220
257
  YAxis
221
258
  } from "recharts";
222
259
 
260
+ // src/charts/chart-gradient-utils.ts
261
+ function barGradientId(scopeId, dataKey) {
262
+ return `bar-${scopeId}-${sanitizeId(dataKey)}`;
263
+ }
264
+ function pieGradientId(scopeId, key) {
265
+ return `pie-${scopeId}-${sanitizeId(key)}`;
266
+ }
267
+ function sanitizeId(key) {
268
+ return key.replace(/[^a-zA-Z0-9_-]/g, "_");
269
+ }
270
+ function truncateLabel(text, maxChars = 14) {
271
+ const s = String(text ?? "");
272
+ if (s.length <= maxChars) return s;
273
+ if (maxChars <= 1) return "\u2026";
274
+ return `${s.slice(0, maxChars - 1)}\u2026`;
275
+ }
276
+ function estimateYAxisWidth(labels, { min = 48, max = 112, charWidth = 6.5 } = {}) {
277
+ if (labels.length === 0) return min;
278
+ const longest = labels.reduce((a, b) => a.length >= b.length ? a : b, "");
279
+ return Math.min(max, Math.max(min, Math.ceil(longest.length * charWidth) + 12));
280
+ }
281
+
282
+ // src/charts/chart-axis-tick.tsx
283
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
284
+ var ChartAxisTick = ({
285
+ x = 0,
286
+ y = 0,
287
+ payload,
288
+ textAnchor = "end",
289
+ maxChars = 14,
290
+ clipTicks = true
291
+ }) => {
292
+ const raw = String(payload?.value ?? "");
293
+ const label = clipTicks ? truncateLabel(raw, maxChars) : raw;
294
+ return /* @__PURE__ */ jsxs3("g", { transform: `translate(${x},${y})`, children: [
295
+ /* @__PURE__ */ jsx3("title", { children: raw }),
296
+ /* @__PURE__ */ jsx3(
297
+ "text",
298
+ {
299
+ textAnchor,
300
+ fill: "currentColor",
301
+ className: "fill-muted-foreground",
302
+ dominantBaseline: "middle",
303
+ children: label
304
+ }
305
+ )
306
+ ] });
307
+ };
308
+
309
+ // src/charts/chart-gradients.tsx
310
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
311
+ var BarGradientDefs = ({
312
+ scopeId,
313
+ dataKeys,
314
+ horizontal
315
+ }) => /* @__PURE__ */ jsx4("defs", { children: dataKeys.map((dataKey) => {
316
+ const id = barGradientId(scopeId, dataKey);
317
+ const color = `var(--color-${dataKey})`;
318
+ if (horizontal) {
319
+ return /* @__PURE__ */ jsxs4("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "0", children: [
320
+ /* @__PURE__ */ jsx4("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
321
+ /* @__PURE__ */ jsx4("stop", { offset: "100%", stopColor: color, stopOpacity: 0.55 })
322
+ ] }, dataKey);
323
+ }
324
+ return /* @__PURE__ */ jsxs4("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
325
+ /* @__PURE__ */ jsx4("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
326
+ /* @__PURE__ */ jsx4("stop", { offset: "100%", stopColor: color, stopOpacity: 0.55 })
327
+ ] }, dataKey);
328
+ }) });
329
+ var PieGradientDefs = ({ scopeId, slices }) => /* @__PURE__ */ jsx4("defs", { children: slices.map(({ key, color }) => {
330
+ const id = pieGradientId(scopeId, key);
331
+ return /* @__PURE__ */ jsxs4("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
332
+ /* @__PURE__ */ jsx4("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }),
333
+ /* @__PURE__ */ jsx4("stop", { offset: "100%", stopColor: color, stopOpacity: 0.65 })
334
+ ] }, key);
335
+ }) });
336
+
223
337
  // src/charts/geometry.ts
224
338
  function toNum(value) {
225
339
  const n = typeof value === "number" ? value : Number(value);
@@ -303,14 +417,15 @@ function formatCompact(value, unit) {
303
417
  }
304
418
 
305
419
  // src/charts/line-area-chart.tsx
306
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
420
+ import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
421
+ var INDEX_X_KEY = "__index";
307
422
  var CHART_PALETTE = [
308
- "var(--chart-1, #6366f1)",
309
- "var(--chart-2, #10b981)",
310
- "var(--chart-3, #f59e0b)",
311
- "var(--chart-4, #a855f7)",
312
- "var(--chart-5, #ef4444)",
313
- "var(--chart-6, #06b6d4)"
423
+ "var(--chart-1, #4f46e5)",
424
+ "var(--chart-2, #3b82f6)",
425
+ "var(--chart-3, #0ea5e9)",
426
+ "var(--chart-4, #6366f1)",
427
+ "var(--chart-5, #60a5fa)",
428
+ "var(--chart-6, #2563eb)"
314
429
  ];
315
430
  var LineAreaChart = ({
316
431
  data = [],
@@ -335,9 +450,11 @@ var LineAreaChart = ({
335
450
  tooltipIndicator = "dot",
336
451
  formatValue,
337
452
  formatX,
453
+ clipTicks = true,
338
454
  className,
339
455
  ariaLabel = "Chart"
340
456
  }) => {
457
+ const gradientScopeId = useId().replace(/:/g, "");
341
458
  const xKey = xKeyProp ?? inferXKey(data);
342
459
  const series = resolveSeries(seriesProp, data, xKey);
343
460
  const flush = layout === "flush";
@@ -347,7 +464,7 @@ var LineAreaChart = ({
347
464
  const showLegend = showLegendProp ?? (!flush && series.length > 1);
348
465
  const grid = gridLines ?? (horizontal ? "vertical" : "horizontal");
349
466
  if (data.length === 0 || series.length === 0) {
350
- return /* @__PURE__ */ jsx3(ChartEmpty, { className, height, ariaLabel });
467
+ return /* @__PURE__ */ jsx5(ChartEmpty, { className, height, ariaLabel });
351
468
  }
352
469
  const config = {};
353
470
  series.forEach((s, i) => {
@@ -358,25 +475,52 @@ var LineAreaChart = ({
358
475
  });
359
476
  const valueFmt = (v) => formatValue ? formatValue(toNum(v)) : formatCompact(toNum(v), unit);
360
477
  const xFmt = (v, i) => formatX ? formatX(v, i) : String(v ?? "");
361
- const margin = flush ? { top: 8, right: 4, bottom: 0, left: 0 } : { top: 8, right: 12, bottom: 0, left: 0 };
478
+ const margin = resolveChartMargin({ flush, showXAxis, showYAxis });
479
+ const flushCategoryXAxisProps = flush && showXAxis && flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis) ? { scale: "point", padding: "no-gap", interval: 0 } : flush && showXAxis && variant === "bar" ? { interval: 0 } : {};
480
+ const useIndexX = flushLineAreaEdgeToEdge(flush, variant, showXAxis, showYAxis);
481
+ const chartData = useIndexX ? data.map((row, i) => ({ ...row, [INDEX_X_KEY]: i })) : data;
482
+ const chartXKey = useIndexX ? INDEX_X_KEY : xKey;
483
+ const categoryTick = (textAnchor) => /* @__PURE__ */ jsx5(ChartAxisTick, { textAnchor, clipTicks });
362
484
  const showVGrid = showGrid && (grid === "vertical" || grid === "both");
363
485
  const showHGrid = showGrid && (grid === "horizontal" || grid === "both");
364
- const tooltipEl = showTooltip ? /* @__PURE__ */ jsx3(
486
+ const tooltipEl = showTooltip ? /* @__PURE__ */ jsx5(
365
487
  ChartTooltip,
366
488
  {
367
489
  cursor: variant === "bar",
368
- content: /* @__PURE__ */ jsx3(ChartTooltipContent, { indicator: tooltipIndicator })
490
+ content: ({ active, payload, label }) => /* @__PURE__ */ jsx5(
491
+ ChartTooltipContent,
492
+ {
493
+ active,
494
+ payload,
495
+ label,
496
+ indicator: tooltipIndicator,
497
+ labelFormatter: (_value, items) => {
498
+ const category = resolveTooltipCategory(label, items, xKey, data, xFmt);
499
+ return category || null;
500
+ },
501
+ formatter: (value, name, item) => {
502
+ const key = String(item.dataKey ?? name ?? "value");
503
+ const seriesLabel = config[key]?.label ?? name;
504
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 items-center justify-between leading-none", children: [
505
+ /* @__PURE__ */ jsx5("span", { className: "text-muted-foreground", children: seriesLabel }),
506
+ value != null ? /* @__PURE__ */ jsx5("span", { className: "text-foreground font-mono font-medium tabular-nums", children: valueFmt(value) }) : null
507
+ ] });
508
+ }
509
+ }
510
+ )
369
511
  }
370
512
  ) : null;
371
- const legendEl = showLegend ? /* @__PURE__ */ jsx3(ChartLegend, { content: /* @__PURE__ */ jsx3(ChartLegendContent, {}) }) : null;
372
- const gridEl = showGrid && grid !== "none" ? /* @__PURE__ */ jsx3(CartesianGrid, { vertical: showVGrid, horizontal: showHGrid, strokeDasharray: "4 4" }) : null;
513
+ const legendEl = showLegend ? /* @__PURE__ */ jsx5(ChartLegend, { content: /* @__PURE__ */ jsx5(ChartLegendContent, {}) }) : null;
514
+ const gridEl = showGrid && grid !== "none" ? /* @__PURE__ */ jsx5(CartesianGrid, { vertical: showVGrid, horizontal: showHGrid, strokeDasharray: "4 4" }) : null;
373
515
  const yDomain = yMax != null ? [0, yMax] : void 0;
374
516
  if (variant === "bar") {
375
- const bars = series.map((s) => /* @__PURE__ */ jsx3(
517
+ const dataKeys = series.map((s) => s.dataKey);
518
+ const barDefs = /* @__PURE__ */ jsx5(BarGradientDefs, { scopeId: gradientScopeId, dataKeys, horizontal });
519
+ const bars = series.map((s) => /* @__PURE__ */ jsx5(
376
520
  Bar,
377
521
  {
378
522
  dataKey: s.dataKey,
379
- fill: `var(--color-${s.dataKey})`,
523
+ fill: `url(#${barGradientId(gradientScopeId, s.dataKey)})`,
380
524
  radius: barCornerRadius(barRadius, horizontal, stacked),
381
525
  stackId: stacked ? "stack" : void 0,
382
526
  isAnimationActive: true
@@ -384,149 +528,212 @@ var LineAreaChart = ({
384
528
  s.dataKey
385
529
  ));
386
530
  if (horizontal) {
387
- return /* @__PURE__ */ jsx3(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs3(BarChart, { accessibilityLayer: true, data, layout: "vertical", margin, children: [
388
- gridEl,
389
- /* @__PURE__ */ jsx3(
390
- XAxis,
391
- {
392
- type: "number",
393
- hide: !showXAxis,
394
- tickLine: false,
395
- axisLine: false,
396
- tickMargin: 8,
397
- tickFormatter: (v) => valueFmt(v),
398
- domain: yDomain
399
- }
400
- ),
401
- /* @__PURE__ */ jsx3(
402
- YAxis,
403
- {
404
- type: "category",
405
- dataKey: xKey,
406
- hide: !showYAxis,
407
- tickLine: false,
408
- axisLine: false,
409
- tickMargin: 8,
410
- width: showYAxis ? void 0 : 0,
411
- tickFormatter: (v, i) => xFmt(v, i)
412
- }
413
- ),
414
- tooltipEl,
415
- legendEl,
416
- bars
417
- ] }) });
418
- }
419
- return /* @__PURE__ */ jsx3(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs3(BarChart, { accessibilityLayer: true, data, margin, children: [
420
- gridEl,
421
- /* @__PURE__ */ jsx3(
422
- XAxis,
423
- {
424
- dataKey: xKey,
425
- hide: !showXAxis,
426
- tickLine: false,
427
- axisLine: false,
428
- tickMargin: 8,
429
- minTickGap: 16,
430
- tickFormatter: (v, i) => xFmt(v, i)
431
- }
432
- ),
433
- /* @__PURE__ */ jsx3(
434
- YAxis,
531
+ const categoryLabels = data.map((row, i) => xFmt(row[xKey], i));
532
+ const yAxisWidth = showYAxis ? estimateYAxisWidth(
533
+ clipTicks ? categoryLabels.map((l) => l.slice(0, 14)) : categoryLabels
534
+ ) : 0;
535
+ return /* @__PURE__ */ jsx5(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs5(
536
+ BarChart,
435
537
  {
436
- hide: !showYAxis,
437
- tickLine: false,
438
- axisLine: false,
439
- tickMargin: 8,
440
- width: showYAxis ? 44 : 0,
441
- tickFormatter: (v) => valueFmt(v),
442
- domain: yDomain
538
+ accessibilityLayer: true,
539
+ data,
540
+ layout: "vertical",
541
+ margin,
542
+ barCategoryGap: flushBarCategoryGap(flush, showYAxis),
543
+ children: [
544
+ barDefs,
545
+ gridEl,
546
+ showXAxis ? /* @__PURE__ */ jsx5(
547
+ XAxis,
548
+ {
549
+ type: "number",
550
+ tickLine: false,
551
+ axisLine: false,
552
+ tickMargin: 8,
553
+ tickFormatter: (v) => valueFmt(v),
554
+ domain: yDomain
555
+ }
556
+ ) : null,
557
+ showYAxis ? /* @__PURE__ */ jsx5(
558
+ YAxis,
559
+ {
560
+ type: "category",
561
+ dataKey: xKey,
562
+ tickLine: false,
563
+ axisLine: false,
564
+ tickMargin: 8,
565
+ width: yAxisWidth,
566
+ minTickGap: 16,
567
+ tick: categoryTick("end")
568
+ }
569
+ ) : /* @__PURE__ */ jsx5(YAxis, { type: "category", dataKey: xKey, hide: true, width: 0 }),
570
+ tooltipEl,
571
+ legendEl,
572
+ bars
573
+ ]
443
574
  }
444
- ),
445
- tooltipEl,
446
- legendEl,
447
- bars
448
- ] }) });
575
+ ) });
576
+ }
577
+ return /* @__PURE__ */ jsx5(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs5(
578
+ BarChart,
579
+ {
580
+ accessibilityLayer: true,
581
+ data,
582
+ margin,
583
+ barCategoryGap: flushBarCategoryGap(flush, showXAxis),
584
+ children: [
585
+ barDefs,
586
+ gridEl,
587
+ showXAxis ? /* @__PURE__ */ jsx5(
588
+ XAxis,
589
+ {
590
+ dataKey: xKey,
591
+ tickLine: false,
592
+ axisLine: false,
593
+ tickMargin: 8,
594
+ minTickGap: 16,
595
+ tick: categoryTick("middle"),
596
+ ...flushCategoryXAxisProps
597
+ }
598
+ ) : /* @__PURE__ */ jsx5(XAxis, { dataKey: xKey, hide: true }),
599
+ showYAxis ? /* @__PURE__ */ jsx5(
600
+ YAxis,
601
+ {
602
+ tickLine: false,
603
+ axisLine: false,
604
+ tickMargin: 8,
605
+ width: 44,
606
+ tickFormatter: (v) => valueFmt(v),
607
+ domain: yDomain
608
+ }
609
+ ) : null,
610
+ tooltipEl,
611
+ legendEl,
612
+ bars
613
+ ]
614
+ }
615
+ ) });
449
616
  }
450
- const axes = /* @__PURE__ */ jsxs3(Fragment, { children: [
451
- /* @__PURE__ */ jsx3(
617
+ const lineAreaAxes = /* @__PURE__ */ jsxs5(Fragment, { children: [
618
+ showXAxis && useIndexX ? /* @__PURE__ */ jsx5(
619
+ XAxis,
620
+ {
621
+ type: "number",
622
+ dataKey: INDEX_X_KEY,
623
+ domain: [0, Math.max(0, chartData.length - 1)],
624
+ allowDecimals: false,
625
+ ticks: chartData.map((_, i) => i),
626
+ tickLine: false,
627
+ axisLine: false,
628
+ tickMargin: 8,
629
+ tickFormatter: (i) => {
630
+ const row = chartData[Number(i)];
631
+ return row ? xFmt(row[xKey], Number(i)) : "";
632
+ }
633
+ }
634
+ ) : showXAxis ? /* @__PURE__ */ jsx5(
452
635
  XAxis,
453
636
  {
454
637
  dataKey: xKey,
455
- hide: !showXAxis,
456
638
  tickLine: false,
457
639
  axisLine: false,
458
640
  tickMargin: 8,
459
- minTickGap: 24,
460
- tickFormatter: (v, i) => xFmt(v, i)
641
+ minTickGap: flush ? 8 : 24,
642
+ tickFormatter: (v, i) => xFmt(v, i),
643
+ ...flushCategoryXAxisProps
461
644
  }
462
- ),
463
- /* @__PURE__ */ jsx3(
645
+ ) : /* @__PURE__ */ jsx5(XAxis, { dataKey: chartXKey, hide: true }),
646
+ showYAxis ? /* @__PURE__ */ jsx5(
464
647
  YAxis,
465
648
  {
466
- hide: !showYAxis,
467
649
  tickLine: false,
468
650
  axisLine: false,
469
651
  tickMargin: 8,
470
- width: showYAxis ? 44 : 0,
652
+ width: 44,
471
653
  tickFormatter: (v) => valueFmt(v),
472
654
  domain: yDomain
473
655
  }
474
- )
656
+ ) : null
475
657
  ] });
658
+ const chartA11y = flush ? {} : { accessibilityLayer: true };
476
659
  if (variant === "area") {
477
- return /* @__PURE__ */ jsx3(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs3(AreaChart, { accessibilityLayer: true, data, margin, children: [
478
- /* @__PURE__ */ jsx3("defs", { children: series.map((s) => /* @__PURE__ */ jsxs3("linearGradient", { id: `fill-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
479
- /* @__PURE__ */ jsx3("stop", { offset: "5%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.3 }),
480
- /* @__PURE__ */ jsx3("stop", { offset: "95%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.04 })
481
- ] }, s.dataKey)) }),
482
- gridEl,
483
- axes,
484
- tooltipEl,
485
- legendEl,
486
- series.map((s) => /* @__PURE__ */ jsx3(
487
- Area,
488
- {
489
- dataKey: s.dataKey,
490
- type: curve,
491
- stackId: stacked ? "stack" : void 0,
492
- stroke: `var(--color-${s.dataKey})`,
493
- strokeWidth: 2,
494
- fill: `url(#fill-${s.dataKey})`,
495
- dot: dots === true ? { r: 3 } : false,
496
- activeDot: { r: 4 },
497
- isAnimationActive: true
498
- },
499
- s.dataKey
500
- ))
501
- ] }) });
502
- }
503
- return /* @__PURE__ */ jsx3(ChartShell, { config, height, className, ariaLabel, children: /* @__PURE__ */ jsxs3(LineChart, { accessibilityLayer: true, data, margin, children: [
504
- gridEl,
505
- axes,
506
- tooltipEl,
507
- legendEl,
508
- series.map((s) => /* @__PURE__ */ jsx3(
509
- Line,
660
+ return /* @__PURE__ */ jsx5(
661
+ ChartShell,
510
662
  {
511
- dataKey: s.dataKey,
512
- type: curve,
513
- stroke: `var(--color-${s.dataKey})`,
514
- strokeWidth: 2,
515
- dot: dots === true ? { r: 3 } : false,
516
- activeDot: { r: 4 },
517
- isAnimationActive: true
518
- },
519
- s.dataKey
520
- ))
521
- ] }) });
663
+ config,
664
+ height,
665
+ className,
666
+ ariaLabel,
667
+ flush,
668
+ children: /* @__PURE__ */ jsxs5(AreaChart, { ...chartA11y, data: chartData, margin, children: [
669
+ /* @__PURE__ */ jsx5("defs", { children: series.map((s) => /* @__PURE__ */ jsxs5("linearGradient", { id: `fill-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
670
+ /* @__PURE__ */ jsx5("stop", { offset: "5%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.3 }),
671
+ /* @__PURE__ */ jsx5("stop", { offset: "95%", stopColor: `var(--color-${s.dataKey})`, stopOpacity: 0.04 })
672
+ ] }, s.dataKey)) }),
673
+ gridEl,
674
+ lineAreaAxes,
675
+ tooltipEl,
676
+ legendEl,
677
+ series.map((s) => /* @__PURE__ */ jsx5(
678
+ Area,
679
+ {
680
+ dataKey: s.dataKey,
681
+ type: curve,
682
+ stackId: stacked ? "stack" : void 0,
683
+ stroke: `var(--color-${s.dataKey})`,
684
+ strokeWidth: 2,
685
+ fill: `url(#fill-${s.dataKey})`,
686
+ dot: dots === true ? { r: 3 } : false,
687
+ activeDot: { r: 4 },
688
+ isAnimationActive: true
689
+ },
690
+ s.dataKey
691
+ ))
692
+ ] })
693
+ }
694
+ );
695
+ }
696
+ return /* @__PURE__ */ jsx5(
697
+ ChartShell,
698
+ {
699
+ config,
700
+ height,
701
+ className,
702
+ ariaLabel,
703
+ flush,
704
+ children: /* @__PURE__ */ jsxs5(LineChart, { ...chartA11y, data: chartData, margin, children: [
705
+ gridEl,
706
+ lineAreaAxes,
707
+ tooltipEl,
708
+ legendEl,
709
+ series.map((s) => /* @__PURE__ */ jsx5(
710
+ Line,
711
+ {
712
+ dataKey: s.dataKey,
713
+ type: curve,
714
+ stroke: `var(--color-${s.dataKey})`,
715
+ strokeWidth: 2,
716
+ dot: dots === true ? { r: 3 } : false,
717
+ activeDot: { r: 4 },
718
+ isAnimationActive: true
719
+ },
720
+ s.dataKey
721
+ ))
722
+ ] })
723
+ }
724
+ );
522
725
  };
523
- var ChartShell = ({ config, height, className, ariaLabel, children }) => /* @__PURE__ */ jsx3(
726
+ var ChartShell = ({ config, height, className, ariaLabel, flush = false, children }) => /* @__PURE__ */ jsx5(
524
727
  ChartContainer,
525
728
  {
526
729
  config,
527
730
  role: "img",
528
731
  "aria-label": ariaLabel,
529
- className: cn("aspect-auto w-full", className),
732
+ className: cn(
733
+ "aspect-auto w-full",
734
+ flush && "justify-start [&_.recharts-responsive-container]:!mx-0 [&_.recharts-responsive-container]:w-full",
735
+ className
736
+ ),
530
737
  style: { height },
531
738
  children
532
739
  }
@@ -535,7 +742,7 @@ var ChartEmpty = ({
535
742
  className,
536
743
  height,
537
744
  ariaLabel
538
- }) => /* @__PURE__ */ jsx3(
745
+ }) => /* @__PURE__ */ jsx5(
539
746
  "div",
540
747
  {
541
748
  className: cn(
@@ -568,8 +775,35 @@ function resolveSeries(seriesProp, data, xKey) {
568
775
  }
569
776
 
570
777
  // src/charts/pie-chart.tsx
778
+ import { useId as useId2 } from "react";
571
779
  import { Cell, Label, Pie, PieChart as RePieChart } from "recharts";
572
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
780
+
781
+ // src/charts/chart-center-label.tsx
782
+ import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
783
+ var CENTER_BOX_W = 96;
784
+ var CENTER_BOX_H = 52;
785
+ var ChartCenterLabel = ({ cx, cy, value, label }) => {
786
+ const hasValue = value != null && value !== "";
787
+ const hasLabel = label != null && label !== "";
788
+ if (!hasValue && !hasLabel) return null;
789
+ return /* @__PURE__ */ jsx6(
790
+ "foreignObject",
791
+ {
792
+ x: cx - CENTER_BOX_W / 2,
793
+ y: cy - CENTER_BOX_H / 2,
794
+ width: CENTER_BOX_W,
795
+ height: CENTER_BOX_H,
796
+ className: "overflow-visible",
797
+ children: /* @__PURE__ */ jsxs6("div", { className: "pointer-events-none flex h-full flex-col items-center justify-center gap-0.5 text-center", children: [
798
+ hasValue ? /* @__PURE__ */ jsx6("div", { className: "text-2xl font-normal leading-none tabular-nums text-foreground", children: value }) : null,
799
+ hasLabel ? /* @__PURE__ */ jsx6("div", { className: "text-[11px] leading-none text-muted-foreground", children: label }) : null
800
+ ] })
801
+ }
802
+ );
803
+ };
804
+
805
+ // src/charts/pie-chart.tsx
806
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
573
807
  var PieChart = ({
574
808
  data,
575
809
  nameKey: nameKeyProp,
@@ -586,10 +820,11 @@ var PieChart = ({
586
820
  className,
587
821
  ariaLabel = "Pie chart"
588
822
  }) => {
823
+ const gradientScopeId = useId2().replace(/:/g, "");
589
824
  const nameKey = nameKeyProp ?? inferNameKey(data, dataKey);
590
825
  const palette = colors ?? CHART_PALETTE;
591
826
  if (data.length === 0) {
592
- return /* @__PURE__ */ jsx4(PieEmpty, { className, height, ariaLabel });
827
+ return /* @__PURE__ */ jsx7(PieEmpty, { className, height, ariaLabel });
593
828
  }
594
829
  const slices = data.map((d, i) => ({
595
830
  name: String(d[nameKey] ?? i),
@@ -600,7 +835,7 @@ var PieChart = ({
600
835
  for (const s of slices) config[s.name] = { label: s.name };
601
836
  const innerPct = innerRadius > 0 ? `${Math.round(innerRadius * 75)}%` : 0;
602
837
  const hasCenter = innerRadius > 0 && (centerValue != null || centerLabel != null);
603
- return /* @__PURE__ */ jsx4(
838
+ return /* @__PURE__ */ jsx7(
604
839
  ChartContainer,
605
840
  {
606
841
  config,
@@ -608,14 +843,21 @@ var PieChart = ({
608
843
  "aria-label": ariaLabel,
609
844
  className: cn("aspect-auto w-full", className),
610
845
  style: { height },
611
- children: /* @__PURE__ */ jsxs4(RePieChart, { children: [
612
- showTooltip && /* @__PURE__ */ jsx4(
846
+ children: /* @__PURE__ */ jsxs7(RePieChart, { children: [
847
+ /* @__PURE__ */ jsx7(
848
+ PieGradientDefs,
849
+ {
850
+ scopeId: gradientScopeId,
851
+ slices: slices.map((s) => ({ key: s.name, color: s.fill }))
852
+ }
853
+ ),
854
+ showTooltip && /* @__PURE__ */ jsx7(
613
855
  ChartTooltip,
614
856
  {
615
- content: /* @__PURE__ */ jsx4(ChartTooltipContent, { nameKey: "name", indicator: tooltipIndicator, hideLabel: true })
857
+ content: /* @__PURE__ */ jsx7(ChartTooltipContent, { nameKey: "name", indicator: tooltipIndicator, hideLabel: true })
616
858
  }
617
859
  ),
618
- /* @__PURE__ */ jsxs4(
860
+ /* @__PURE__ */ jsxs7(
619
861
  Pie,
620
862
  {
621
863
  data: slices,
@@ -628,24 +870,30 @@ var PieChart = ({
628
870
  label: showLabels,
629
871
  isAnimationActive: true,
630
872
  children: [
631
- slices.map((s) => /* @__PURE__ */ jsx4(Cell, { fill: s.fill }, s.name)),
632
- hasCenter && /* @__PURE__ */ jsx4(
873
+ slices.map((s) => /* @__PURE__ */ jsx7(Cell, { fill: `url(#${pieGradientId(gradientScopeId, s.name)})` }, s.name)),
874
+ hasCenter && /* @__PURE__ */ jsx7(
633
875
  Label,
634
876
  {
877
+ position: "center",
635
878
  content: ({ viewBox }) => {
636
879
  if (!viewBox || !("cx" in viewBox)) return null;
637
880
  const { cx, cy } = viewBox;
638
- return /* @__PURE__ */ jsxs4("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
639
- centerValue != null && /* @__PURE__ */ jsx4("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
640
- centerLabel != null && /* @__PURE__ */ jsx4("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
641
- ] });
881
+ return /* @__PURE__ */ jsx7(
882
+ ChartCenterLabel,
883
+ {
884
+ cx,
885
+ cy,
886
+ value: centerValue,
887
+ label: centerLabel
888
+ }
889
+ );
642
890
  }
643
891
  }
644
892
  )
645
893
  ]
646
894
  }
647
895
  ),
648
- showLegend && /* @__PURE__ */ jsx4(ChartLegend, { content: /* @__PURE__ */ jsx4(ChartLegendContent, { nameKey: "name" }) })
896
+ showLegend && /* @__PURE__ */ jsx7(ChartLegend, { content: /* @__PURE__ */ jsx7(ChartLegendContent, { nameKey: "name" }) })
649
897
  ] })
650
898
  }
651
899
  );
@@ -654,7 +902,7 @@ var PieEmpty = ({
654
902
  className,
655
903
  height,
656
904
  ariaLabel
657
- }) => /* @__PURE__ */ jsx4(
905
+ }) => /* @__PURE__ */ jsx7(
658
906
  "div",
659
907
  {
660
908
  className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
@@ -673,6 +921,7 @@ function inferNameKey(data, dataKey) {
673
921
  }
674
922
 
675
923
  // src/charts/radial-chart.tsx
924
+ import { useId as useId3 } from "react";
676
925
  import {
677
926
  Cell as Cell2,
678
927
  Label as Label2,
@@ -681,7 +930,7 @@ import {
681
930
  RadialBar,
682
931
  RadialBarChart
683
932
  } from "recharts";
684
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
933
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
685
934
  var RadialChart = ({
686
935
  data,
687
936
  nameKey: nameKeyProp,
@@ -697,10 +946,11 @@ var RadialChart = ({
697
946
  className,
698
947
  ariaLabel = "Radial chart"
699
948
  }) => {
949
+ const gradientScopeId = useId3().replace(/:/g, "");
700
950
  const nameKey = nameKeyProp ?? inferNameKey2(data, dataKey);
701
951
  const palette = colors ?? CHART_PALETTE;
702
952
  if (data.length === 0) {
703
- return /* @__PURE__ */ jsx5(RadialEmpty, { className, height, ariaLabel });
953
+ return /* @__PURE__ */ jsx8(RadialEmpty, { className, height, ariaLabel });
704
954
  }
705
955
  const rows = data.map((d, i) => ({
706
956
  name: String(d[nameKey] ?? i),
@@ -711,8 +961,8 @@ var RadialChart = ({
711
961
  const config = {};
712
962
  for (const r of rows) config[r.name] = { label: r.name };
713
963
  const hasCenter = centerValue != null || centerLabel != null;
714
- return /* @__PURE__ */ jsxs5("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
715
- /* @__PURE__ */ jsx5(
964
+ return /* @__PURE__ */ jsxs8("div", { className: cn("flex w-full flex-col items-center gap-3", className), children: [
965
+ /* @__PURE__ */ jsx8(
716
966
  ChartContainer,
717
967
  {
718
968
  config,
@@ -720,7 +970,7 @@ var RadialChart = ({
720
970
  "aria-label": ariaLabel,
721
971
  className: "aspect-auto w-full",
722
972
  style: { height: height - (showLegend ? 32 : 0) },
723
- children: /* @__PURE__ */ jsxs5(
973
+ children: /* @__PURE__ */ jsxs8(
724
974
  RadialBarChart,
725
975
  {
726
976
  data: rows,
@@ -731,19 +981,32 @@ var RadialChart = ({
731
981
  barSize: ringWidth,
732
982
  barGap: ringGap,
733
983
  children: [
734
- /* @__PURE__ */ jsx5(PolarAngleAxis, { type: "number", domain: [0, max], tick: false, axisLine: false }),
735
- /* @__PURE__ */ jsx5(ChartTooltip, { content: /* @__PURE__ */ jsx5(ChartTooltipContent, { nameKey: "name", hideLabel: true }) }),
736
- /* @__PURE__ */ jsx5(RadialBar, { dataKey: "value", background: true, cornerRadius: ringWidth / 2, isAnimationActive: true, children: rows.map((r) => /* @__PURE__ */ jsx5(Cell2, { fill: r.fill }, r.name)) }),
737
- hasCenter && /* @__PURE__ */ jsx5(PolarRadiusAxis, { tick: false, tickLine: false, axisLine: false, children: /* @__PURE__ */ jsx5(
984
+ /* @__PURE__ */ jsx8(
985
+ PieGradientDefs,
986
+ {
987
+ scopeId: gradientScopeId,
988
+ slices: rows.map((r) => ({ key: r.name, color: r.fill }))
989
+ }
990
+ ),
991
+ /* @__PURE__ */ jsx8(PolarAngleAxis, { type: "number", domain: [0, max], tick: false, axisLine: false }),
992
+ /* @__PURE__ */ jsx8(ChartTooltip, { content: /* @__PURE__ */ jsx8(ChartTooltipContent, { nameKey: "name", hideLabel: true }) }),
993
+ /* @__PURE__ */ jsx8(RadialBar, { dataKey: "value", background: true, cornerRadius: ringWidth / 2, isAnimationActive: true, children: rows.map((r) => /* @__PURE__ */ jsx8(Cell2, { fill: `url(#${pieGradientId(gradientScopeId, r.name)})` }, r.name)) }),
994
+ hasCenter && /* @__PURE__ */ jsx8(PolarRadiusAxis, { tick: false, tickLine: false, axisLine: false, children: /* @__PURE__ */ jsx8(
738
995
  Label2,
739
996
  {
997
+ position: "center",
740
998
  content: ({ viewBox }) => {
741
999
  if (!viewBox || !("cx" in viewBox)) return null;
742
1000
  const { cx, cy } = viewBox;
743
- return /* @__PURE__ */ jsxs5("text", { x: cx, y: cy, textAnchor: "middle", dominantBaseline: "middle", children: [
744
- centerValue != null && /* @__PURE__ */ jsx5("tspan", { x: cx, y: cy - 2, className: "fill-foreground text-2xl tabular-nums", children: centerValue }),
745
- centerLabel != null && /* @__PURE__ */ jsx5("tspan", { x: cx, y: cy + 18, className: "fill-muted-foreground text-[11px]", children: centerLabel })
746
- ] });
1001
+ return /* @__PURE__ */ jsx8(
1002
+ ChartCenterLabel,
1003
+ {
1004
+ cx,
1005
+ cy,
1006
+ value: centerValue,
1007
+ label: centerLabel
1008
+ }
1009
+ );
747
1010
  }
748
1011
  }
749
1012
  ) })
@@ -752,8 +1015,8 @@ var RadialChart = ({
752
1015
  )
753
1016
  }
754
1017
  ),
755
- showLegend && /* @__PURE__ */ jsx5("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: rows.map((r) => /* @__PURE__ */ jsxs5("span", { className: "inline-flex items-center gap-1.5", children: [
756
- /* @__PURE__ */ jsx5("span", { className: "inline-block size-2.5 rounded-[3px]", style: { background: r.fill } }),
1018
+ showLegend && /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground", children: rows.map((r) => /* @__PURE__ */ jsxs8("span", { className: "inline-flex items-center gap-1.5", children: [
1019
+ /* @__PURE__ */ jsx8("span", { className: "inline-block size-2.5 rounded-[3px]", style: { background: r.fill } }),
757
1020
  r.name
758
1021
  ] }, r.name)) })
759
1022
  ] });
@@ -762,7 +1025,7 @@ var RadialEmpty = ({
762
1025
  className,
763
1026
  height,
764
1027
  ariaLabel
765
- }) => /* @__PURE__ */ jsx5(
1028
+ }) => /* @__PURE__ */ jsx8(
766
1029
  "div",
767
1030
  {
768
1031
  className: cn("flex w-full items-center justify-center text-xs text-muted-foreground", className),
@@ -787,7 +1050,7 @@ import {
787
1050
  Radar,
788
1051
  RadarChart as ReRadarChart
789
1052
  } from "recharts";
790
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
1053
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
791
1054
  var RadarChart = ({
792
1055
  data,
793
1056
  nameKey: nameKeyProp,
@@ -802,7 +1065,7 @@ var RadarChart = ({
802
1065
  const nameKey = nameKeyProp ?? inferNameKey3(data);
803
1066
  const series = resolveSeries2(seriesProp, data, nameKey);
804
1067
  if (data.length < 3 || series.length === 0) {
805
- return /* @__PURE__ */ jsx6(
1068
+ return /* @__PURE__ */ jsx9(
806
1069
  "div",
807
1070
  {
808
1071
  className: cn("flex items-center justify-center text-xs text-muted-foreground", className),
@@ -820,7 +1083,7 @@ var RadarChart = ({
820
1083
  color: s.color ?? CHART_PALETTE[i % CHART_PALETTE.length]
821
1084
  };
822
1085
  });
823
- return /* @__PURE__ */ jsx6(
1086
+ return /* @__PURE__ */ jsx9(
824
1087
  ChartContainer,
825
1088
  {
826
1089
  config,
@@ -828,17 +1091,17 @@ var RadarChart = ({
828
1091
  "aria-label": ariaLabel,
829
1092
  className: cn("mx-auto aspect-square", className),
830
1093
  style: { height },
831
- children: /* @__PURE__ */ jsxs6(ReRadarChart, { data, outerRadius: "70%", children: [
832
- /* @__PURE__ */ jsx6(ChartTooltip, { content: /* @__PURE__ */ jsx6(ChartTooltipContent, { indicator: "line" }) }),
833
- /* @__PURE__ */ jsx6(PolarGrid, {}),
834
- /* @__PURE__ */ jsx6(
1094
+ children: /* @__PURE__ */ jsxs9(ReRadarChart, { data, outerRadius: "70%", children: [
1095
+ /* @__PURE__ */ jsx9(ChartTooltip, { content: /* @__PURE__ */ jsx9(ChartTooltipContent, { indicator: "line" }) }),
1096
+ /* @__PURE__ */ jsx9(PolarGrid, {}),
1097
+ /* @__PURE__ */ jsx9(
835
1098
  PolarAngleAxis2,
836
1099
  {
837
1100
  dataKey: nameKey,
838
1101
  tick: { fontSize: 10, fill: "var(--color-muted-foreground)" }
839
1102
  }
840
1103
  ),
841
- series.map((s) => /* @__PURE__ */ jsx6(
1104
+ series.map((s) => /* @__PURE__ */ jsx9(
842
1105
  Radar,
843
1106
  {
844
1107
  dataKey: s.dataKey,
@@ -851,7 +1114,7 @@ var RadarChart = ({
851
1114
  },
852
1115
  s.dataKey
853
1116
  )),
854
- showLegend && series.length > 1 && /* @__PURE__ */ jsx6(ChartLegend, { content: /* @__PURE__ */ jsx6(ChartLegendContent, {}) })
1117
+ showLegend && series.length > 1 && /* @__PURE__ */ jsx9(ChartLegend, { content: /* @__PURE__ */ jsx9(ChartLegendContent, {}) })
855
1118
  ] })
856
1119
  }
857
1120
  );
@@ -872,10 +1135,10 @@ function resolveSeries2(seriesProp, data, nameKey) {
872
1135
  }
873
1136
 
874
1137
  // src/artifacts/artifact-card.tsx
875
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1138
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
876
1139
  var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }) => {
877
1140
  const hasHeader = Boolean(title || toolbar);
878
- return /* @__PURE__ */ jsxs7(
1141
+ return /* @__PURE__ */ jsxs10(
879
1142
  "div",
880
1143
  {
881
1144
  className: cn(
@@ -884,12 +1147,12 @@ var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }
884
1147
  ),
885
1148
  "data-artifact-kind": kind,
886
1149
  children: [
887
- hasHeader && /* @__PURE__ */ jsxs7("div", { className: "aui-artifact-header flex items-center gap-2 border-b border-border/40 bg-muted/30 px-3 py-1.5", children: [
888
- title && /* @__PURE__ */ jsx7("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
889
- !title && /* @__PURE__ */ jsx7("span", { className: "flex-1" }),
1150
+ hasHeader && /* @__PURE__ */ jsxs10("div", { className: "aui-artifact-header flex items-center gap-2 border-b border-border/40 bg-muted/30 px-3 py-1.5", children: [
1151
+ title && /* @__PURE__ */ jsx10("span", { className: "aui-artifact-title flex-1 truncate text-xs font-semibold text-foreground/80", children: title }),
1152
+ !title && /* @__PURE__ */ jsx10("span", { className: "flex-1" }),
890
1153
  toolbar
891
1154
  ] }),
892
- /* @__PURE__ */ jsx7("div", { className: cn("aui-artifact-body", bodyClassName), children })
1155
+ /* @__PURE__ */ jsx10("div", { className: cn("aui-artifact-body", bodyClassName), children })
893
1156
  ]
894
1157
  }
895
1158
  );
@@ -897,17 +1160,17 @@ var ArtifactCard = ({ title, kind, className, bodyClassName, toolbar, children }
897
1160
 
898
1161
  // src/artifacts/chart-artifact.tsx
899
1162
  import { useMemo } from "react";
900
- import { jsx as jsx8 } from "react/jsx-runtime";
1163
+ import { jsx as jsx11 } from "react/jsx-runtime";
901
1164
  var ChartArtifactView = ({
902
1165
  artifact,
903
1166
  embedded = false,
904
1167
  height = 300
905
1168
  }) => {
906
- const plot = /* @__PURE__ */ jsx8(ChartArtifactPlot, { artifact, height });
1169
+ const plot = /* @__PURE__ */ jsx11(ChartArtifactPlot, { artifact, height });
907
1170
  if (embedded) {
908
- return /* @__PURE__ */ jsx8("div", { className: "aui-artifact-chart w-full", children: plot });
1171
+ return /* @__PURE__ */ jsx11("div", { className: "aui-artifact-chart w-full", children: plot });
909
1172
  }
910
- return /* @__PURE__ */ jsx8(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ jsx8("div", { className: "aui-artifact-chart pt-2", children: plot }) });
1173
+ return /* @__PURE__ */ jsx11(ArtifactCard, { title: artifact.title, kind: "chart", children: /* @__PURE__ */ jsx11("div", { className: "aui-artifact-chart pt-2", children: plot }) });
911
1174
  };
912
1175
  function ChartArtifactPlot({
913
1176
  artifact,
@@ -933,7 +1196,7 @@ function ChartArtifactPlot({
933
1196
  const aria = typeof artifact.title === "string" ? artifact.title : "Chart";
934
1197
  if (chartType === "pie" || chartType === "donut") {
935
1198
  const total = data.reduce((sum, d) => sum + toNum(d[series[0]?.dataKey ?? "value"]), 0);
936
- return /* @__PURE__ */ jsx8("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx8(
1199
+ return /* @__PURE__ */ jsx11("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx11(
937
1200
  PieChart,
938
1201
  {
939
1202
  data,
@@ -950,7 +1213,7 @@ function ChartArtifactPlot({
950
1213
  ) });
951
1214
  }
952
1215
  if (chartType === "radial") {
953
- return /* @__PURE__ */ jsx8("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx8(
1216
+ return /* @__PURE__ */ jsx11("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx11(
954
1217
  RadialChart,
955
1218
  {
956
1219
  data,
@@ -963,10 +1226,11 @@ function ChartArtifactPlot({
963
1226
  ) });
964
1227
  }
965
1228
  if (chartType === "radar") {
966
- return /* @__PURE__ */ jsx8("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx8(RadarChart, { data, nameKey: xKey, series, height, ariaLabel: aria }) });
1229
+ return /* @__PURE__ */ jsx11("div", { className: "px-3 pb-3 pt-2", children: /* @__PURE__ */ jsx11(RadarChart, { data, nameKey: xKey, series, height, ariaLabel: aria }) });
967
1230
  }
968
1231
  const horizontal = chartType === "horizontalBar";
969
- return /* @__PURE__ */ jsx8(
1232
+ const showAxes = artifact.showAxes === true;
1233
+ return /* @__PURE__ */ jsx11(
970
1234
  LineAreaChart,
971
1235
  {
972
1236
  data,
@@ -980,8 +1244,8 @@ function ChartArtifactPlot({
980
1244
  curve: artifact.curve,
981
1245
  dots: artifact.dots,
982
1246
  tooltipIndicator: artifact.tooltipIndicator,
983
- showXAxis: true,
984
- showYAxis: horizontal,
1247
+ showXAxis: showAxes,
1248
+ showYAxis: showAxes && horizontal,
985
1249
  showLegend: artifact.legend ?? series.length > 1,
986
1250
  unit: artifact.unit,
987
1251
  ariaLabel: aria
@@ -1119,12 +1383,12 @@ var studioQuestionOptionSelectedClass = cn(
1119
1383
  );
1120
1384
 
1121
1385
  // src/artifacts/question-artifact.tsx
1122
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1386
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1123
1387
  function optionKey(option, index) {
1124
1388
  const id = option.id?.trim();
1125
1389
  return id ? id : `__option-${index}`;
1126
1390
  }
1127
- var OptionRadio = ({ selected }) => /* @__PURE__ */ jsx9(
1391
+ var OptionRadio = ({ selected }) => /* @__PURE__ */ jsx12(
1128
1392
  "span",
1129
1393
  {
1130
1394
  className: cn(
@@ -1132,7 +1396,7 @@ var OptionRadio = ({ selected }) => /* @__PURE__ */ jsx9(
1132
1396
  selected ? "border-foreground bg-foreground text-background" : "border-border bg-background"
1133
1397
  ),
1134
1398
  "aria-hidden": true,
1135
- children: selected ? /* @__PURE__ */ jsx9(CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
1399
+ children: selected ? /* @__PURE__ */ jsx12(CheckIcon, { className: "size-2.5 stroke-[3]" }) : null
1136
1400
  }
1137
1401
  );
1138
1402
  var QuestionArtifactView = ({
@@ -1171,12 +1435,12 @@ var QuestionArtifactView = ({
1171
1435
  const onConfirm = useCallback(() => {
1172
1436
  send(selected);
1173
1437
  }, [selected, send]);
1174
- return /* @__PURE__ */ jsx9("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ jsxs8("div", { className: "px-2.5 py-2", children: [
1175
- artifact.prompt ? /* @__PURE__ */ jsx9("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
1176
- /* @__PURE__ */ jsx9("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
1438
+ return /* @__PURE__ */ jsx12("div", { className: studioArtifactShellClass, "data-artifact-kind": "question", children: /* @__PURE__ */ jsxs11("div", { className: "px-2.5 py-2", children: [
1439
+ artifact.prompt ? /* @__PURE__ */ jsx12("p", { className: "mb-2 text-sm font-normal leading-snug text-foreground", children: artifact.prompt }) : null,
1440
+ /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-0.5", role: "list", children: artifact.options.map((option, index) => {
1177
1441
  const key = optionKey(option, index);
1178
1442
  const isSelected = submittedIds ? submittedIds.includes(key) : isMulti && selected.includes(key);
1179
- return /* @__PURE__ */ jsxs8(
1443
+ return /* @__PURE__ */ jsxs11(
1180
1444
  "button",
1181
1445
  {
1182
1446
  type: "button",
@@ -1188,17 +1452,17 @@ var QuestionArtifactView = ({
1188
1452
  isDisabled && (isSelected ? "cursor-default" : "cursor-not-allowed opacity-50")
1189
1453
  ),
1190
1454
  children: [
1191
- /* @__PURE__ */ jsx9(OptionRadio, { selected: isSelected }),
1192
- /* @__PURE__ */ jsxs8("span", { className: "min-w-0 flex-1 text-left", children: [
1193
- /* @__PURE__ */ jsx9("span", { className: "block font-normal text-foreground", children: option.label }),
1194
- option.description ? /* @__PURE__ */ jsx9("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
1455
+ /* @__PURE__ */ jsx12(OptionRadio, { selected: isSelected }),
1456
+ /* @__PURE__ */ jsxs11("span", { className: "min-w-0 flex-1 text-left", children: [
1457
+ /* @__PURE__ */ jsx12("span", { className: "block font-normal text-foreground", children: option.label }),
1458
+ option.description ? /* @__PURE__ */ jsx12("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: option.description }) : null
1195
1459
  ] })
1196
1460
  ]
1197
1461
  },
1198
1462
  key
1199
1463
  );
1200
1464
  }) }),
1201
- isMulti && !submittedIds ? /* @__PURE__ */ jsx9("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsx9(
1465
+ isMulti && !submittedIds ? /* @__PURE__ */ jsx12("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsx12(
1202
1466
  TimbalV2Button,
1203
1467
  {
1204
1468
  type: "button",
@@ -1213,12 +1477,12 @@ var QuestionArtifactView = ({
1213
1477
  };
1214
1478
 
1215
1479
  // src/artifacts/html-artifact.tsx
1216
- import { jsx as jsx10 } from "react/jsx-runtime";
1480
+ import { jsx as jsx13 } from "react/jsx-runtime";
1217
1481
  var HtmlArtifactView = ({ artifact }) => {
1218
1482
  const sandboxed = artifact.sandboxed !== false;
1219
1483
  const sandbox = sandboxed ? "allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock" : void 0;
1220
1484
  const height = artifact.height ?? "320px";
1221
- return /* @__PURE__ */ jsx10(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ jsx10(
1485
+ return /* @__PURE__ */ jsx13(ArtifactCard, { title: artifact.title, kind: "html", children: /* @__PURE__ */ jsx13(
1222
1486
  "iframe",
1223
1487
  {
1224
1488
  title: artifact.title ?? "HTML artifact",
@@ -1231,7 +1495,7 @@ var HtmlArtifactView = ({ artifact }) => {
1231
1495
  };
1232
1496
 
1233
1497
  // src/artifacts/json-artifact.tsx
1234
- import { jsx as jsx11 } from "react/jsx-runtime";
1498
+ import { jsx as jsx14 } from "react/jsx-runtime";
1235
1499
  var JsonArtifactView = ({
1236
1500
  artifact
1237
1501
  }) => {
@@ -1243,16 +1507,16 @@ var JsonArtifactView = ({
1243
1507
  } catch {
1244
1508
  body = String(data);
1245
1509
  }
1246
- return /* @__PURE__ */ jsx11(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ jsx11("pre", { className: "aui-artifact-json m-0 max-h-[420px] overflow-auto p-3 font-mono text-[12px] leading-relaxed text-foreground/85", children: body }) });
1510
+ return /* @__PURE__ */ jsx14(ArtifactCard, { title, kind: "json", children: /* @__PURE__ */ jsx14("pre", { className: "aui-artifact-json m-0 max-h-[420px] overflow-auto p-3 font-mono text-[12px] leading-relaxed text-foreground/85", children: body }) });
1247
1511
  };
1248
1512
 
1249
1513
  // src/artifacts/table-artifact.tsx
1250
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1514
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
1251
1515
  var TableArtifactView = ({ artifact }) => {
1252
1516
  const rows = artifact.rows ?? [];
1253
1517
  const columns = artifact.columns ?? deriveColumns(rows);
1254
- return /* @__PURE__ */ jsx12(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ jsx12("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ jsxs9("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
1255
- /* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsx12("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ jsx12(
1518
+ return /* @__PURE__ */ jsx15(ArtifactCard, { title: artifact.title, kind: "table", children: /* @__PURE__ */ jsx15("div", { className: "aui-artifact-table-wrap overflow-x-auto", children: /* @__PURE__ */ jsxs12("table", { className: "aui-artifact-table w-full border-collapse text-sm", children: [
1519
+ /* @__PURE__ */ jsx15("thead", { children: /* @__PURE__ */ jsx15("tr", { className: "border-b border-border/40 bg-muted/20", children: columns.map((col) => /* @__PURE__ */ jsx15(
1256
1520
  "th",
1257
1521
  {
1258
1522
  className: "px-3 py-2 text-left text-xs font-semibold uppercase tracking-wider text-muted-foreground",
@@ -1260,11 +1524,11 @@ var TableArtifactView = ({ artifact }) => {
1260
1524
  },
1261
1525
  col.key
1262
1526
  )) }) }),
1263
- /* @__PURE__ */ jsx12("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx12(
1527
+ /* @__PURE__ */ jsx15("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx15(
1264
1528
  "tr",
1265
1529
  {
1266
1530
  className: "border-b border-border/30 transition-colors last:border-b-0 hover:bg-muted/20",
1267
- children: columns.map((col) => /* @__PURE__ */ jsx12(
1531
+ children: columns.map((col) => /* @__PURE__ */ jsx15(
1268
1532
  "td",
1269
1533
  {
1270
1534
  className: "px-3 py-2 align-top text-foreground/85",
@@ -1351,11 +1615,11 @@ import {
1351
1615
  createContext,
1352
1616
  useContext
1353
1617
  } from "react";
1354
- import { jsx as jsx13 } from "react/jsx-runtime";
1618
+ import { jsx as jsx16 } from "react/jsx-runtime";
1355
1619
  var UiStateContext = createContext({});
1356
1620
  var UiDispatchContext = createContext(() => {
1357
1621
  });
1358
- var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ jsx13(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx13(UiDispatchContext.Provider, { value: dispatch, children }) });
1622
+ var UiStateProvider = ({ state, dispatch, children }) => /* @__PURE__ */ jsx16(UiStateContext.Provider, { value: state, children: /* @__PURE__ */ jsx16(UiDispatchContext.Provider, { value: dispatch, children }) });
1359
1623
  function useUiState() {
1360
1624
  return useContext(UiStateContext);
1361
1625
  }
@@ -1365,12 +1629,12 @@ function useUiDispatch() {
1365
1629
  var UiEventContext = createContext(
1366
1630
  null
1367
1631
  );
1368
- var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ jsx13(UiEventContext.Provider, { value: onEvent, children });
1632
+ var UiEventProvider = ({ onEvent, children }) => /* @__PURE__ */ jsx16(UiEventContext.Provider, { value: onEvent, children });
1369
1633
  function useUiEventEmitter() {
1370
1634
  return useContext(UiEventContext);
1371
1635
  }
1372
1636
  var UiCustomNodeRegistryContext = createContext({});
1373
- var UiCustomNodeRegistryProvider = ({ renderers, children }) => /* @__PURE__ */ jsx13(UiCustomNodeRegistryContext.Provider, { value: renderers, children });
1637
+ var UiCustomNodeRegistryProvider = ({ renderers, children }) => /* @__PURE__ */ jsx16(UiCustomNodeRegistryContext.Provider, { value: renderers, children });
1374
1638
  function useUiCustomNodeRegistry() {
1375
1639
  return useContext(UiCustomNodeRegistryContext);
1376
1640
  }
@@ -1379,29 +1643,29 @@ function useUiCustomNodeRegistry() {
1379
1643
  import { useCallback as useCallback2 } from "react";
1380
1644
  import { motion } from "motion/react";
1381
1645
  import { useThreadRuntime as useThreadRuntime2 } from "@assistant-ui/react";
1382
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
1646
+ import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1383
1647
  var UiNodeView = ({ node }) => {
1384
1648
  switch (node.kind) {
1385
1649
  case "box":
1386
- return /* @__PURE__ */ jsx14(BoxNode, { node });
1650
+ return /* @__PURE__ */ jsx17(BoxNode, { node });
1387
1651
  case "text":
1388
- return /* @__PURE__ */ jsx14(TextNode, { node });
1652
+ return /* @__PURE__ */ jsx17(TextNode, { node });
1389
1653
  case "heading":
1390
- return /* @__PURE__ */ jsx14(HeadingNode, { node });
1654
+ return /* @__PURE__ */ jsx17(HeadingNode, { node });
1391
1655
  case "badge":
1392
- return /* @__PURE__ */ jsx14(BadgeNode, { node });
1656
+ return /* @__PURE__ */ jsx17(BadgeNode, { node });
1393
1657
  case "button":
1394
- return /* @__PURE__ */ jsx14(ButtonNode, { node });
1658
+ return /* @__PURE__ */ jsx17(ButtonNode, { node });
1395
1659
  case "toggle":
1396
- return /* @__PURE__ */ jsx14(ToggleNode, { node });
1660
+ return /* @__PURE__ */ jsx17(ToggleNode, { node });
1397
1661
  case "slider":
1398
- return /* @__PURE__ */ jsx14(SliderNode, { node });
1662
+ return /* @__PURE__ */ jsx17(SliderNode, { node });
1399
1663
  case "tooltip":
1400
- return /* @__PURE__ */ jsx14(TooltipNode, { node });
1664
+ return /* @__PURE__ */ jsx17(TooltipNode, { node });
1401
1665
  case "draggable":
1402
- return /* @__PURE__ */ jsx14(DraggableNode, { node });
1666
+ return /* @__PURE__ */ jsx17(DraggableNode, { node });
1403
1667
  case "custom":
1404
- return /* @__PURE__ */ jsx14(CustomNode, { node });
1668
+ return /* @__PURE__ */ jsx17(CustomNode, { node });
1405
1669
  default:
1406
1670
  return null;
1407
1671
  }
@@ -1461,7 +1725,7 @@ var JUSTIFY_CLS = {
1461
1725
  };
1462
1726
  var BoxNode = ({ node }) => {
1463
1727
  const dir = node.direction ?? "col";
1464
- return /* @__PURE__ */ jsx14(
1728
+ return /* @__PURE__ */ jsx17(
1465
1729
  "div",
1466
1730
  {
1467
1731
  className: cn(
@@ -1476,7 +1740,7 @@ var BoxNode = ({ node }) => {
1476
1740
  gap: node.gap !== void 0 ? `${node.gap * 0.25}rem` : void 0,
1477
1741
  padding: node.padding !== void 0 ? `${node.padding * 0.25}rem` : void 0
1478
1742
  },
1479
- children: node.children?.map((child, i) => /* @__PURE__ */ jsx14(UiNodeView, { node: child }, child.id ?? i))
1743
+ children: node.children?.map((child, i) => /* @__PURE__ */ jsx17(UiNodeView, { node: child }, child.id ?? i))
1480
1744
  }
1481
1745
  );
1482
1746
  };
@@ -1495,7 +1759,7 @@ var TEXT_WEIGHT = {
1495
1759
  var TextNode = ({ node }) => {
1496
1760
  const state = useUiState();
1497
1761
  const value = resolveBindable(node.value, state);
1498
- return /* @__PURE__ */ jsx14(
1762
+ return /* @__PURE__ */ jsx17(
1499
1763
  "span",
1500
1764
  {
1501
1765
  className: cn(
@@ -1526,13 +1790,13 @@ var HeadingNode = ({ node }) => {
1526
1790
  );
1527
1791
  switch (level) {
1528
1792
  case 1:
1529
- return /* @__PURE__ */ jsx14("h1", { className: cls, children: value });
1793
+ return /* @__PURE__ */ jsx17("h1", { className: cls, children: value });
1530
1794
  case 2:
1531
- return /* @__PURE__ */ jsx14("h2", { className: cls, children: value });
1795
+ return /* @__PURE__ */ jsx17("h2", { className: cls, children: value });
1532
1796
  case 3:
1533
- return /* @__PURE__ */ jsx14("h3", { className: cls, children: value });
1797
+ return /* @__PURE__ */ jsx17("h3", { className: cls, children: value });
1534
1798
  case 4:
1535
- return /* @__PURE__ */ jsx14("h4", { className: cls, children: value });
1799
+ return /* @__PURE__ */ jsx17("h4", { className: cls, children: value });
1536
1800
  }
1537
1801
  };
1538
1802
  var BADGE_TONE = {
@@ -1545,7 +1809,7 @@ var BADGE_TONE = {
1545
1809
  var BadgeNode = ({ node }) => {
1546
1810
  const state = useUiState();
1547
1811
  const value = String(resolveBindable(node.value, state) ?? "");
1548
- return /* @__PURE__ */ jsx14(
1812
+ return /* @__PURE__ */ jsx17(
1549
1813
  "span",
1550
1814
  {
1551
1815
  className: cn(
@@ -1562,7 +1826,7 @@ var ButtonNode = ({ node }) => {
1562
1826
  const run = useActionRunner();
1563
1827
  const label = String(resolveBindable(node.label, state) ?? "");
1564
1828
  const disabled = node.disabled !== void 0 ? Boolean(resolveBindable(node.disabled, state)) : false;
1565
- return /* @__PURE__ */ jsx14(
1829
+ return /* @__PURE__ */ jsx17(
1566
1830
  Button,
1567
1831
  {
1568
1832
  variant: node.variant ?? "default",
@@ -1584,7 +1848,7 @@ var ToggleNode = ({ node }) => {
1584
1848
  dispatch({ type: "toggle", path: node.binding });
1585
1849
  run(node.onChange);
1586
1850
  };
1587
- return /* @__PURE__ */ jsxs10(
1851
+ return /* @__PURE__ */ jsxs13(
1588
1852
  "label",
1589
1853
  {
1590
1854
  className: cn(
@@ -1592,7 +1856,7 @@ var ToggleNode = ({ node }) => {
1592
1856
  node.className
1593
1857
  ),
1594
1858
  children: [
1595
- /* @__PURE__ */ jsx14(
1859
+ /* @__PURE__ */ jsx17(
1596
1860
  "button",
1597
1861
  {
1598
1862
  type: "button",
@@ -1603,7 +1867,7 @@ var ToggleNode = ({ node }) => {
1603
1867
  "relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-[background,box-shadow,border-color] duration-200",
1604
1868
  value ? "border-foreground/15 bg-gradient-to-b from-primary-fill-from to-primary-fill-to shadow-card" : cn(TIMBAL_V2_SWITCH_TRACK_OFF, "hover:from-secondary-fill-hover-from hover:to-secondary-fill-hover-to")
1605
1869
  ),
1606
- children: /* @__PURE__ */ jsx14(
1870
+ children: /* @__PURE__ */ jsx17(
1607
1871
  "span",
1608
1872
  {
1609
1873
  className: cn(
@@ -1616,7 +1880,7 @@ var ToggleNode = ({ node }) => {
1616
1880
  )
1617
1881
  }
1618
1882
  ),
1619
- label && /* @__PURE__ */ jsx14("span", { className: "text-foreground/85", children: label })
1883
+ label && /* @__PURE__ */ jsx17("span", { className: "text-foreground/85", children: label })
1620
1884
  ]
1621
1885
  }
1622
1886
  );
@@ -1636,12 +1900,12 @@ var SliderNode = ({ node }) => {
1636
1900
  const next = Number(e.target.value);
1637
1901
  dispatch({ type: "set", path: node.binding, value: next });
1638
1902
  };
1639
- return /* @__PURE__ */ jsxs10("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
1640
- (label || showValue) && /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
1641
- label && /* @__PURE__ */ jsx14("span", { children: label }),
1642
- showValue && /* @__PURE__ */ jsx14("span", { className: "font-mono", children: value })
1903
+ return /* @__PURE__ */ jsxs13("div", { className: cn("aui-ui-slider flex flex-col gap-1", node.className), children: [
1904
+ (label || showValue) && /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
1905
+ label && /* @__PURE__ */ jsx17("span", { children: label }),
1906
+ showValue && /* @__PURE__ */ jsx17("span", { className: "font-mono", children: value })
1643
1907
  ] }),
1644
- /* @__PURE__ */ jsx14(
1908
+ /* @__PURE__ */ jsx17(
1645
1909
  "input",
1646
1910
  {
1647
1911
  type: "range",
@@ -1663,9 +1927,9 @@ var SliderNode = ({ node }) => {
1663
1927
  var TooltipNode = ({ node }) => {
1664
1928
  const state = useUiState();
1665
1929
  const content = String(resolveBindable(node.content, state) ?? "");
1666
- return /* @__PURE__ */ jsx14(TooltipProvider, { children: /* @__PURE__ */ jsxs10(Tooltip, { children: [
1667
- /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ jsx14(UiNodeView, { node: node.child }) }) }),
1668
- /* @__PURE__ */ jsx14(TooltipContent, { side: node.side ?? "top", children: content })
1930
+ return /* @__PURE__ */ jsx17(TooltipProvider, { children: /* @__PURE__ */ jsxs13(Tooltip, { children: [
1931
+ /* @__PURE__ */ jsx17(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx17("span", { className: cn("aui-ui-tooltip-trigger inline-flex", node.className), children: /* @__PURE__ */ jsx17(UiNodeView, { node: node.child }) }) }),
1932
+ /* @__PURE__ */ jsx17(TooltipContent, { side: node.side ?? "top", children: content })
1669
1933
  ] }) });
1670
1934
  };
1671
1935
  var DraggableNode = ({ node }) => {
@@ -1673,7 +1937,7 @@ var DraggableNode = ({ node }) => {
1673
1937
  const snapBack = node.snapBack ?? true;
1674
1938
  const axis = node.axis ?? "both";
1675
1939
  const dragProp = axis === "both" ? true : axis;
1676
- return /* @__PURE__ */ jsx14(
1940
+ return /* @__PURE__ */ jsx17(
1677
1941
  motion.div,
1678
1942
  {
1679
1943
  drag: dragProp,
@@ -1685,7 +1949,7 @@ var DraggableNode = ({ node }) => {
1685
1949
  "aui-ui-draggable inline-block cursor-grab touch-none",
1686
1950
  node.className
1687
1951
  ),
1688
- children: /* @__PURE__ */ jsx14(UiNodeView, { node: node.child })
1952
+ children: /* @__PURE__ */ jsx17(UiNodeView, { node: node.child })
1689
1953
  }
1690
1954
  );
1691
1955
  };
@@ -1695,8 +1959,8 @@ var CustomNode = ({ node }) => {
1695
1959
  const Renderer = registry[node.name];
1696
1960
  if (!Renderer) return null;
1697
1961
  const resolvedProps = resolveProps(node.props ?? {}, state);
1698
- const children = node.children?.map((child, i) => /* @__PURE__ */ jsx14(UiNodeView, { node: child }, child.id ?? i));
1699
- return /* @__PURE__ */ jsx14(Renderer, { props: resolvedProps, children });
1962
+ const children = node.children?.map((child, i) => /* @__PURE__ */ jsx17(UiNodeView, { node: child }, child.id ?? i));
1963
+ return /* @__PURE__ */ jsx17(Renderer, { props: resolvedProps, children });
1700
1964
  };
1701
1965
  function resolveProps(props, state) {
1702
1966
  const out = {};
@@ -1708,18 +1972,18 @@ function resolveProps(props, state) {
1708
1972
 
1709
1973
  // src/artifacts/ui/ui-artifact.tsx
1710
1974
  import { useReducer } from "react";
1711
- import { jsx as jsx15 } from "react/jsx-runtime";
1975
+ import { jsx as jsx18 } from "react/jsx-runtime";
1712
1976
  var UiArtifactView = ({ artifact }) => {
1713
1977
  const [state, dispatch] = useReducer(
1714
1978
  uiStateReducer,
1715
1979
  artifact.initialState ?? {}
1716
1980
  );
1717
- return /* @__PURE__ */ jsx15(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ jsx15(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ jsx15("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ jsx15(UiNodeView, { node: artifact.root }) }) }) });
1981
+ return /* @__PURE__ */ jsx18(ArtifactCard, { title: artifact.title, kind: "ui", children: /* @__PURE__ */ jsx18(UiStateProvider, { state, dispatch, children: /* @__PURE__ */ jsx18("div", { className: "aui-ui-root p-3", children: /* @__PURE__ */ jsx18(UiNodeView, { node: artifact.root }) }) }) });
1718
1982
  };
1719
1983
 
1720
1984
  // src/artifacts/registry.tsx
1721
1985
  import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
1722
- import { jsx as jsx16 } from "react/jsx-runtime";
1986
+ import { jsx as jsx19 } from "react/jsx-runtime";
1723
1987
  var defaultArtifactRenderers = {
1724
1988
  chart: ChartArtifactView,
1725
1989
  question: QuestionArtifactView,
@@ -1737,7 +2001,7 @@ var ArtifactRegistryProvider = ({ renderers, override, children }) => {
1737
2001
  if (override) return renderers;
1738
2002
  return { ...defaultArtifactRenderers, ...renderers };
1739
2003
  }, [renderers, override]);
1740
- return /* @__PURE__ */ jsx16(ArtifactRegistryContext.Provider, { value: merged, children });
2004
+ return /* @__PURE__ */ jsx19(ArtifactRegistryContext.Provider, { value: merged, children });
1741
2005
  };
1742
2006
  function useArtifactRegistry() {
1743
2007
  return useContext2(ArtifactRegistryContext);
@@ -1746,7 +2010,7 @@ var ArtifactView = ({ artifact }) => {
1746
2010
  const registry = useArtifactRegistry();
1747
2011
  const Renderer = registry[artifact.type] ?? registry.json;
1748
2012
  if (!Renderer) return null;
1749
- return /* @__PURE__ */ jsx16(Renderer, { artifact });
2013
+ return /* @__PURE__ */ jsx19(Renderer, { artifact });
1750
2014
  };
1751
2015
 
1752
2016
  // src/artifacts/types.ts
@@ -1884,7 +2148,7 @@ import langC from "shiki/langs/c.mjs";
1884
2148
  import langCpp from "shiki/langs/cpp.mjs";
1885
2149
  import themeVitesseDark from "shiki/themes/vitesse-dark.mjs";
1886
2150
  import themeVitesseLight from "shiki/themes/vitesse-light.mjs";
1887
- import { jsx as jsx17 } from "react/jsx-runtime";
2151
+ import { jsx as jsx20 } from "react/jsx-runtime";
1888
2152
  var SHIKI_THEME_DARK = "vitesse-dark";
1889
2153
  var SHIKI_THEME_LIGHT = "vitesse-light";
1890
2154
  var highlighterPromise = null;
@@ -1953,13 +2217,13 @@ var ShikiSyntaxHighlighter = ({
1953
2217
  try {
1954
2218
  const parsed = JSON.parse(code);
1955
2219
  if (isArtifact(parsed)) {
1956
- return /* @__PURE__ */ jsx17(ArtifactView, { artifact: parsed });
2220
+ return /* @__PURE__ */ jsx20(ArtifactView, { artifact: parsed });
1957
2221
  }
1958
2222
  } catch {
1959
2223
  }
1960
2224
  }
1961
2225
  if (html) {
1962
- return /* @__PURE__ */ jsx17(
2226
+ return /* @__PURE__ */ jsx20(
1963
2227
  "div",
1964
2228
  {
1965
2229
  className: "shiki-wrapper [&>pre]:!m-0 [&>pre]:!rounded-t-none [&>pre]:!rounded-b-lg [&>pre]:!border [&>pre]:!border-t-0 [&>pre]:!border-border/50 [&>pre]:!p-3 [&>pre]:!text-xs [&>pre]:!leading-relaxed [&>pre]:overflow-x-auto",
@@ -1967,14 +2231,14 @@ var ShikiSyntaxHighlighter = ({
1967
2231
  }
1968
2232
  );
1969
2233
  }
1970
- return /* @__PURE__ */ jsx17(Pre, { children: /* @__PURE__ */ jsx17(Code2, { children: code }) });
2234
+ return /* @__PURE__ */ jsx20(Pre, { children: /* @__PURE__ */ jsx20(Code2, { children: code }) });
1971
2235
  };
1972
2236
  var syntax_highlighter_default = ShikiSyntaxHighlighter;
1973
2237
 
1974
2238
  // src/chat/markdown-text.tsx
1975
- import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2239
+ import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
1976
2240
  var MarkdownTextImpl = () => {
1977
- return /* @__PURE__ */ jsx18(
2241
+ return /* @__PURE__ */ jsx21(
1978
2242
  MarkdownTextPrimitive,
1979
2243
  {
1980
2244
  remarkPlugins: [remarkGfm, remarkMath],
@@ -1995,20 +2259,20 @@ var CodeHeader = ({ language, code }) => {
1995
2259
  if (!code || isCopied) return;
1996
2260
  copyToClipboard(code);
1997
2261
  };
1998
- return /* @__PURE__ */ jsxs11("div", { className: "aui-code-header flex items-center justify-between rounded-t-lg border border-b-0 border-border/50 bg-code-header-bg px-4 py-2", children: [
1999
- /* @__PURE__ */ jsxs11("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
2000
- /* @__PURE__ */ jsx18("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
2262
+ return /* @__PURE__ */ jsxs14("div", { className: "aui-code-header flex items-center justify-between rounded-t-lg border border-b-0 border-border/50 bg-code-header-bg px-4 py-2", children: [
2263
+ /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-2 text-xs font-semibold tracking-wide text-muted-foreground/80 uppercase", children: [
2264
+ /* @__PURE__ */ jsx21("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40" }),
2001
2265
  language
2002
2266
  ] }),
2003
- /* @__PURE__ */ jsxs11(
2267
+ /* @__PURE__ */ jsxs14(
2004
2268
  TooltipIconButton,
2005
2269
  {
2006
2270
  tooltip: isCopied ? "Copied!" : "Copy",
2007
2271
  onClick: onCopy,
2008
2272
  className: "transition-colors hover:text-foreground",
2009
2273
  children: [
2010
- !isCopied && /* @__PURE__ */ jsx18(CopyIcon, { className: "h-3.5 w-3.5" }),
2011
- isCopied && /* @__PURE__ */ jsx18(CheckIcon2, { className: "h-3.5 w-3.5 text-emerald-500" })
2274
+ !isCopied && /* @__PURE__ */ jsx21(CopyIcon, { className: "h-3.5 w-3.5" }),
2275
+ isCopied && /* @__PURE__ */ jsx21(CheckIcon2, { className: "h-3.5 w-3.5 text-emerald-500" })
2012
2276
  ]
2013
2277
  }
2014
2278
  )
@@ -2028,7 +2292,7 @@ var useCopyToClipboard = ({
2028
2292
  return { isCopied, copyToClipboard };
2029
2293
  };
2030
2294
  var defaultComponents = memoizeMarkdownComponents({
2031
- h1: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2295
+ h1: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2032
2296
  "h1",
2033
2297
  {
2034
2298
  className: cn(
@@ -2038,7 +2302,7 @@ var defaultComponents = memoizeMarkdownComponents({
2038
2302
  ...props
2039
2303
  }
2040
2304
  ),
2041
- h2: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2305
+ h2: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2042
2306
  "h2",
2043
2307
  {
2044
2308
  className: cn(
@@ -2048,7 +2312,7 @@ var defaultComponents = memoizeMarkdownComponents({
2048
2312
  ...props
2049
2313
  }
2050
2314
  ),
2051
- h3: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2315
+ h3: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2052
2316
  "h3",
2053
2317
  {
2054
2318
  className: cn(
@@ -2058,7 +2322,7 @@ var defaultComponents = memoizeMarkdownComponents({
2058
2322
  ...props
2059
2323
  }
2060
2324
  ),
2061
- h4: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2325
+ h4: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2062
2326
  "h4",
2063
2327
  {
2064
2328
  className: cn(
@@ -2068,7 +2332,7 @@ var defaultComponents = memoizeMarkdownComponents({
2068
2332
  ...props
2069
2333
  }
2070
2334
  ),
2071
- h5: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2335
+ h5: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2072
2336
  "h5",
2073
2337
  {
2074
2338
  className: cn(
@@ -2078,7 +2342,7 @@ var defaultComponents = memoizeMarkdownComponents({
2078
2342
  ...props
2079
2343
  }
2080
2344
  ),
2081
- h6: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2345
+ h6: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2082
2346
  "h6",
2083
2347
  {
2084
2348
  className: cn(
@@ -2088,7 +2352,7 @@ var defaultComponents = memoizeMarkdownComponents({
2088
2352
  ...props
2089
2353
  }
2090
2354
  ),
2091
- p: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2355
+ p: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2092
2356
  "p",
2093
2357
  {
2094
2358
  className: cn(
@@ -2098,7 +2362,7 @@ var defaultComponents = memoizeMarkdownComponents({
2098
2362
  ...props
2099
2363
  }
2100
2364
  ),
2101
- a: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2365
+ a: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2102
2366
  "a",
2103
2367
  {
2104
2368
  className: cn(
@@ -2110,7 +2374,7 @@ var defaultComponents = memoizeMarkdownComponents({
2110
2374
  ...props
2111
2375
  }
2112
2376
  ),
2113
- blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2377
+ blockquote: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2114
2378
  "blockquote",
2115
2379
  {
2116
2380
  className: cn(
@@ -2120,7 +2384,7 @@ var defaultComponents = memoizeMarkdownComponents({
2120
2384
  ...props
2121
2385
  }
2122
2386
  ),
2123
- ul: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2387
+ ul: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2124
2388
  "ul",
2125
2389
  {
2126
2390
  className: cn(
@@ -2130,7 +2394,7 @@ var defaultComponents = memoizeMarkdownComponents({
2130
2394
  ...props
2131
2395
  }
2132
2396
  ),
2133
- ol: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2397
+ ol: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2134
2398
  "ol",
2135
2399
  {
2136
2400
  className: cn(
@@ -2140,7 +2404,7 @@ var defaultComponents = memoizeMarkdownComponents({
2140
2404
  ...props
2141
2405
  }
2142
2406
  ),
2143
- hr: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2407
+ hr: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2144
2408
  "hr",
2145
2409
  {
2146
2410
  className: cn(
@@ -2150,14 +2414,14 @@ var defaultComponents = memoizeMarkdownComponents({
2150
2414
  ...props
2151
2415
  }
2152
2416
  ),
2153
- table: ({ className, ...props }) => /* @__PURE__ */ jsx18("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ jsx18(
2417
+ table: ({ className, ...props }) => /* @__PURE__ */ jsx21("div", { className: "my-4 w-full overflow-x-auto rounded-lg border border-border/50", children: /* @__PURE__ */ jsx21(
2154
2418
  "table",
2155
2419
  {
2156
2420
  className: cn("aui-md-table w-full border-collapse text-sm", className),
2157
2421
  ...props
2158
2422
  }
2159
2423
  ) }),
2160
- th: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2424
+ th: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2161
2425
  "th",
2162
2426
  {
2163
2427
  className: cn(
@@ -2167,7 +2431,7 @@ var defaultComponents = memoizeMarkdownComponents({
2167
2431
  ...props
2168
2432
  }
2169
2433
  ),
2170
- td: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2434
+ td: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2171
2435
  "td",
2172
2436
  {
2173
2437
  className: cn(
@@ -2177,7 +2441,7 @@ var defaultComponents = memoizeMarkdownComponents({
2177
2441
  ...props
2178
2442
  }
2179
2443
  ),
2180
- tr: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2444
+ tr: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2181
2445
  "tr",
2182
2446
  {
2183
2447
  className: cn(
@@ -2187,8 +2451,8 @@ var defaultComponents = memoizeMarkdownComponents({
2187
2451
  ...props
2188
2452
  }
2189
2453
  ),
2190
- li: ({ className, ...props }) => /* @__PURE__ */ jsx18("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
2191
- sup: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2454
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx21("li", { className: cn("aui-md-li leading-[1.7]", className), ...props }),
2455
+ sup: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2192
2456
  "sup",
2193
2457
  {
2194
2458
  className: cn(
@@ -2198,7 +2462,7 @@ var defaultComponents = memoizeMarkdownComponents({
2198
2462
  ...props
2199
2463
  }
2200
2464
  ),
2201
- pre: ({ className, ...props }) => /* @__PURE__ */ jsx18(
2465
+ pre: ({ className, ...props }) => /* @__PURE__ */ jsx21(
2202
2466
  "pre",
2203
2467
  {
2204
2468
  className: cn(
@@ -2210,7 +2474,7 @@ var defaultComponents = memoizeMarkdownComponents({
2210
2474
  ),
2211
2475
  code: function Code({ className, ...props }) {
2212
2476
  const isCodeBlock = useIsMarkdownCodeBlock();
2213
- return /* @__PURE__ */ jsx18(
2477
+ return /* @__PURE__ */ jsx21(
2214
2478
  "code",
2215
2479
  {
2216
2480
  className: cn(
@@ -2221,8 +2485,8 @@ var defaultComponents = memoizeMarkdownComponents({
2221
2485
  }
2222
2486
  );
2223
2487
  },
2224
- strong: ({ className, ...props }) => /* @__PURE__ */ jsx18("strong", { className: cn("font-semibold text-foreground", className), ...props }),
2225
- em: ({ className, ...props }) => /* @__PURE__ */ jsx18("em", { className: cn("italic", className), ...props }),
2488
+ strong: ({ className, ...props }) => /* @__PURE__ */ jsx21("strong", { className: cn("font-semibold text-foreground", className), ...props }),
2489
+ em: ({ className, ...props }) => /* @__PURE__ */ jsx21("em", { className: cn("italic", className), ...props }),
2226
2490
  CodeHeader
2227
2491
  });
2228
2492
 
@@ -2775,20 +3039,20 @@ function buildPromptBody({
2775
3039
 
2776
3040
  // src/runtime/attachments-context.tsx
2777
3041
  import { createContext as createContext3, useContext as useContext3 } from "react";
2778
- import { jsx as jsx19 } from "react/jsx-runtime";
3042
+ import { jsx as jsx22 } from "react/jsx-runtime";
2779
3043
  var TimbalAttachmentsEnabledContext = createContext3(false);
2780
3044
  function TimbalAttachmentsEnabledProvider({
2781
3045
  enabled,
2782
3046
  children
2783
3047
  }) {
2784
- return /* @__PURE__ */ jsx19(TimbalAttachmentsEnabledContext.Provider, { value: enabled, children });
3048
+ return /* @__PURE__ */ jsx22(TimbalAttachmentsEnabledContext.Provider, { value: enabled, children });
2785
3049
  }
2786
3050
  function useTimbalAttachmentsEnabled() {
2787
3051
  return useContext3(TimbalAttachmentsEnabledContext);
2788
3052
  }
2789
3053
 
2790
3054
  // src/runtime/provider.tsx
2791
- import { jsx as jsx20 } from "react/jsx-runtime";
3055
+ import { jsx as jsx23 } from "react/jsx-runtime";
2792
3056
  function projectAttachment(attachment) {
2793
3057
  const filename = attachment.name ?? "attachment";
2794
3058
  const mimeType = attachment.contentType ?? "application/octet-stream";
@@ -3094,7 +3358,7 @@ function TimbalRuntimeProvider({
3094
3358
  onCancel,
3095
3359
  ...attachmentAdapter ? { adapters: { attachments: attachmentAdapter } } : {}
3096
3360
  });
3097
- return /* @__PURE__ */ jsx20(TimbalStreamContext.Provider, { value: stream, children: /* @__PURE__ */ jsx20(TimbalAttachmentsEnabledProvider, { enabled: attachmentAdapter !== void 0, children: /* @__PURE__ */ jsx20(AssistantRuntimeProvider, { runtime, children }) }) });
3361
+ return /* @__PURE__ */ jsx23(TimbalStreamContext.Provider, { value: stream, children: /* @__PURE__ */ jsx23(TimbalAttachmentsEnabledProvider, { enabled: attachmentAdapter !== void 0, children: /* @__PURE__ */ jsx23(AssistantRuntimeProvider, { runtime, children }) }) });
3098
3362
  }
3099
3363
  function findParentIdFromAuiParent(messages, auiParentId) {
3100
3364
  const idx = messages.findIndex((m) => m.id === auiParentId);
@@ -3111,7 +3375,7 @@ import {
3111
3375
 
3112
3376
  // src/chat/motion.tsx
3113
3377
  import { AnimatePresence, motion as motion2, useReducedMotion } from "motion/react";
3114
- import { jsx as jsx21 } from "react/jsx-runtime";
3378
+ import { jsx as jsx24 } from "react/jsx-runtime";
3115
3379
  var luxuryEase = [0.16, 1, 0.3, 1];
3116
3380
  var TOOL_ENTER_MS = 0.78;
3117
3381
  var TOOL_EXIT_MS = 0.28;
@@ -3139,7 +3403,7 @@ function toolMotionState(reduced, entering, variant) {
3139
3403
  function ToolMotion({ children, className, motionKey }) {
3140
3404
  const reduced = useReducedMotion() ?? false;
3141
3405
  const { enter, exit } = toolPresenceTransition(reduced);
3142
- return /* @__PURE__ */ jsx21(
3406
+ return /* @__PURE__ */ jsx24(
3143
3407
  motion2.div,
3144
3408
  {
3145
3409
  className: cn("aui-tool-motion w-full min-w-0", className),
@@ -3162,7 +3426,7 @@ function ToolPresence({
3162
3426
  const reduced = useReducedMotion() ?? false;
3163
3427
  const { enter, exit } = toolPresenceTransition(reduced);
3164
3428
  const enterTransition = variant === "executing" ? { duration: reduced ? 0.3 : 0.52, ease: luxuryEase } : enter;
3165
- return /* @__PURE__ */ jsx21(AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ jsx21(
3429
+ return /* @__PURE__ */ jsx24(AnimatePresence, { mode: "wait", initial: true, children: /* @__PURE__ */ jsx24(
3166
3430
  motion2.div,
3167
3431
  {
3168
3432
  className: cn("aui-tool-presence w-full min-w-0", className),
@@ -3184,7 +3448,7 @@ function ToolBodyPresence({
3184
3448
  className
3185
3449
  }) {
3186
3450
  const reduced = useReducedMotion() ?? false;
3187
- return /* @__PURE__ */ jsx21(
3451
+ return /* @__PURE__ */ jsx24(
3188
3452
  "div",
3189
3453
  {
3190
3454
  className: cn(
@@ -3192,7 +3456,7 @@ function ToolBodyPresence({
3192
3456
  open ? reduced ? "duration-200 ease-out" : "duration-[340ms] ease-[cubic-bezier(0.16,1,0.3,1)]" : reduced ? "duration-150 ease-[cubic-bezier(0.4,0,0.2,1)]" : "duration-200 ease-[cubic-bezier(0.4,0,0.2,1)]"
3193
3457
  ),
3194
3458
  style: { gridTemplateRows: open ? "1fr" : "0fr" },
3195
- children: /* @__PURE__ */ jsx21("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx21(
3459
+ children: /* @__PURE__ */ jsx24("div", { className: "min-h-0 overflow-hidden", children: /* @__PURE__ */ jsx24(
3196
3460
  "div",
3197
3461
  {
3198
3462
  className: cn(
@@ -3208,7 +3472,7 @@ function ToolBodyPresence({
3208
3472
  }
3209
3473
 
3210
3474
  // src/chat/tool-fallback.tsx
3211
- import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3475
+ import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
3212
3476
  function detectRunning({
3213
3477
  status,
3214
3478
  result,
@@ -3240,8 +3504,8 @@ function formatToolResult(result) {
3240
3504
  return String(result);
3241
3505
  }
3242
3506
  }
3243
- var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ jsxs12("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3244
- action ? shimmer ? /* @__PURE__ */ jsx22(
3507
+ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__ */ jsxs15("span", { className: "inline-flex min-w-0 max-w-full items-baseline gap-1", children: [
3508
+ action ? shimmer ? /* @__PURE__ */ jsx25(
3245
3509
  Shimmer,
3246
3510
  {
3247
3511
  as: "span",
@@ -3250,10 +3514,10 @@ var TimelineActionLabel = ({ action, detail, shimmer = false }) => /* @__PURE__
3250
3514
  spread: 2.5,
3251
3515
  children: action
3252
3516
  }
3253
- ) : /* @__PURE__ */ jsx22("span", { className: studioTimelineActionClass, children: action }) : null,
3254
- detail ? /* @__PURE__ */ jsx22("span", { className: studioTimelineDetailClass, children: detail }) : null
3517
+ ) : /* @__PURE__ */ jsx25("span", { className: studioTimelineActionClass, children: action }) : null,
3518
+ detail ? /* @__PURE__ */ jsx25("span", { className: studioTimelineDetailClass, children: detail }) : null
3255
3519
  ] });
3256
- var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ jsx22(
3520
+ var TimelineHoverChevron = ({ expanded }) => /* @__PURE__ */ jsx25(
3257
3521
  ChevronRightIcon,
3258
3522
  {
3259
3523
  className: studioTimelineChevronClass(expanded),
@@ -3278,10 +3542,10 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3278
3542
  const hasBody = Boolean(formattedArgs || formattedResult);
3279
3543
  const action = isError ? "Failed" : "Used";
3280
3544
  if (!hasBody) {
3281
- return /* @__PURE__ */ jsx22("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ jsx22(TimelineActionLabel, { action, detail }) });
3545
+ return /* @__PURE__ */ jsx25("div", { className: "aui-tool-row w-full min-w-0", children: /* @__PURE__ */ jsx25(TimelineActionLabel, { action, detail }) });
3282
3546
  }
3283
- return /* @__PURE__ */ jsxs12("div", { className: "aui-tool-row w-full min-w-0", children: [
3284
- /* @__PURE__ */ jsx22(
3547
+ return /* @__PURE__ */ jsxs15("div", { className: "aui-tool-row w-full min-w-0", children: [
3548
+ /* @__PURE__ */ jsx25(
3285
3549
  "button",
3286
3550
  {
3287
3551
  type: "button",
@@ -3289,7 +3553,7 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3289
3553
  "aria-expanded": open,
3290
3554
  "aria-label": `${action} ${detail}`,
3291
3555
  className: studioTimelineRowButtonClass,
3292
- children: /* @__PURE__ */ jsxs12(
3556
+ children: /* @__PURE__ */ jsxs15(
3293
3557
  "span",
3294
3558
  {
3295
3559
  className: cn(
@@ -3298,37 +3562,37 @@ var ToolPanel = ({ toolName, argsText, result, isError }) => {
3298
3562
  "text-foreground"
3299
3563
  ),
3300
3564
  children: [
3301
- /* @__PURE__ */ jsx22(TimelineActionLabel, { action, detail }),
3302
- /* @__PURE__ */ jsx22(TimelineHoverChevron, { expanded: open })
3565
+ /* @__PURE__ */ jsx25(TimelineActionLabel, { action, detail }),
3566
+ /* @__PURE__ */ jsx25(TimelineHoverChevron, { expanded: open })
3303
3567
  ]
3304
3568
  }
3305
3569
  )
3306
3570
  }
3307
3571
  ),
3308
- /* @__PURE__ */ jsxs12(
3572
+ /* @__PURE__ */ jsxs15(
3309
3573
  ToolBodyPresence,
3310
3574
  {
3311
3575
  open,
3312
3576
  className: cn(studioTimelineBodyPadClass, "gap-2"),
3313
3577
  children: [
3314
- formattedArgs ? /* @__PURE__ */ jsx22(
3578
+ formattedArgs ? /* @__PURE__ */ jsx25(
3315
3579
  "div",
3316
3580
  {
3317
3581
  className: cn(
3318
3582
  studioComposerIoWellClass,
3319
3583
  "max-h-48 overflow-auto px-2.5 py-2"
3320
3584
  ),
3321
- children: /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3585
+ children: /* @__PURE__ */ jsx25("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedArgs })
3322
3586
  }
3323
3587
  ) : null,
3324
- formattedResult ? /* @__PURE__ */ jsx22(
3588
+ formattedResult ? /* @__PURE__ */ jsx25(
3325
3589
  "div",
3326
3590
  {
3327
3591
  className: cn(
3328
3592
  studioComposerIoWellClass,
3329
3593
  "max-h-48 overflow-auto px-2.5 py-2"
3330
3594
  ),
3331
- children: /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3595
+ children: /* @__PURE__ */ jsx25("pre", { className: "whitespace-pre-wrap break-words font-mono text-[11px] font-normal leading-relaxed text-foreground", children: formattedResult })
3332
3596
  }
3333
3597
  ) : null
3334
3598
  ]
@@ -3345,20 +3609,20 @@ var ToolFallbackImpl = ({
3345
3609
  const isRunning = useToolRunning({ status, result });
3346
3610
  const isError = status?.type === "incomplete" && status.reason !== "cancelled";
3347
3611
  const presenceKey = isRunning ? "running" : isError ? "error" : "complete";
3348
- return /* @__PURE__ */ jsx22(
3612
+ return /* @__PURE__ */ jsx25(
3349
3613
  ToolPresence,
3350
3614
  {
3351
3615
  presenceKey,
3352
3616
  variant: isRunning ? "executing" : "settled",
3353
3617
  className: "py-0.5",
3354
- children: isRunning ? /* @__PURE__ */ jsx22("div", { className: "aui-tool-running", children: /* @__PURE__ */ jsx22(
3618
+ children: isRunning ? /* @__PURE__ */ jsx25("div", { className: "aui-tool-running", children: /* @__PURE__ */ jsx25(
3355
3619
  TimelineActionLabel,
3356
3620
  {
3357
3621
  action: "Using",
3358
3622
  detail: formatToolLabel(toolName),
3359
3623
  shimmer: true
3360
3624
  }
3361
- ) }) : /* @__PURE__ */ jsx22(
3625
+ ) }) : /* @__PURE__ */ jsx25(
3362
3626
  ToolPanel,
3363
3627
  {
3364
3628
  toolName,
@@ -3376,7 +3640,7 @@ var ToolFallback = memo2(
3376
3640
  ToolFallback.displayName = "ToolFallback";
3377
3641
 
3378
3642
  // src/artifacts/tool-artifact.tsx
3379
- import { jsx as jsx23 } from "react/jsx-runtime";
3643
+ import { jsx as jsx26 } from "react/jsx-runtime";
3380
3644
  var ToolArtifactFallback = (props) => {
3381
3645
  const registry = useArtifactRegistry();
3382
3646
  const isRunning = useToolRunning({
@@ -3388,18 +3652,18 @@ var ToolArtifactFallback = (props) => {
3388
3652
  if (artifact) {
3389
3653
  const Renderer = registry[artifact.type];
3390
3654
  if (Renderer) {
3391
- return /* @__PURE__ */ jsx23(
3655
+ return /* @__PURE__ */ jsx26(
3392
3656
  ToolMotion,
3393
3657
  {
3394
3658
  motionKey: `artifact-${artifact.type}`,
3395
3659
  className: "aui-tool-artifact",
3396
- children: /* @__PURE__ */ jsx23(Renderer, { artifact })
3660
+ children: /* @__PURE__ */ jsx26(Renderer, { artifact })
3397
3661
  }
3398
3662
  );
3399
3663
  }
3400
3664
  }
3401
3665
  }
3402
- return /* @__PURE__ */ jsx23(ToolFallback, { ...props });
3666
+ return /* @__PURE__ */ jsx26(ToolFallback, { ...props });
3403
3667
  };
3404
3668
 
3405
3669
  // src/chat/composer.tsx
@@ -3409,7 +3673,7 @@ import {
3409
3673
  useComposerRuntime
3410
3674
  } from "@assistant-ui/react";
3411
3675
  import { ArrowUpIcon, SquareIcon } from "lucide-react";
3412
- import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
3676
+ import { Fragment as Fragment2, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
3413
3677
  var Composer = ({
3414
3678
  placeholder = "Send a message...",
3415
3679
  showAttachments,
@@ -3420,10 +3684,10 @@ var Composer = ({
3420
3684
  }) => {
3421
3685
  const attachmentsEnabled = useTimbalAttachmentsEnabled();
3422
3686
  const attachUi = showAttachments !== false && attachmentsEnabled;
3423
- const shell = /* @__PURE__ */ jsxs13(Fragment2, { children: [
3424
- attachUi && /* @__PURE__ */ jsx24(ComposerAttachments, {}),
3425
- /* @__PURE__ */ jsx24(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
3426
- /* @__PURE__ */ jsx24(
3687
+ const shell = /* @__PURE__ */ jsxs16(Fragment2, { children: [
3688
+ attachUi && /* @__PURE__ */ jsx27(ComposerAttachments, {}),
3689
+ /* @__PURE__ */ jsx27(ComposerInput, { placeholder, autoFocus: !noAutoFocus }),
3690
+ /* @__PURE__ */ jsx27(
3427
3691
  ComposerToolbar,
3428
3692
  {
3429
3693
  showAttachments: attachUi,
@@ -3432,14 +3696,14 @@ var Composer = ({
3432
3696
  }
3433
3697
  )
3434
3698
  ] });
3435
- return /* @__PURE__ */ jsx24(
3699
+ return /* @__PURE__ */ jsx27(
3436
3700
  ComposerPrimitive2.Root,
3437
3701
  {
3438
3702
  className: cn(
3439
3703
  "aui-composer-root relative flex w-full flex-col",
3440
3704
  className
3441
3705
  ),
3442
- children: attachUi ? /* @__PURE__ */ jsx24(
3706
+ children: attachUi ? /* @__PURE__ */ jsx27(
3443
3707
  ComposerPrimitive2.AttachmentDropzone,
3444
3708
  {
3445
3709
  className: cn(
@@ -3448,7 +3712,7 @@ var Composer = ({
3448
3712
  ),
3449
3713
  children: shell
3450
3714
  }
3451
- ) : /* @__PURE__ */ jsx24("div", { className: studioComposeInputShellClass, children: shell })
3715
+ ) : /* @__PURE__ */ jsx27("div", { className: studioComposeInputShellClass, children: shell })
3452
3716
  }
3453
3717
  );
3454
3718
  };
@@ -3468,7 +3732,7 @@ var ComposerInput = ({
3468
3732
  el.style.height = "auto";
3469
3733
  el.style.height = `${Math.min(el.scrollHeight, 240)}px`;
3470
3734
  };
3471
- return /* @__PURE__ */ jsx24(
3735
+ return /* @__PURE__ */ jsx27(
3472
3736
  ComposerPrimitive2.Input,
3473
3737
  {
3474
3738
  placeholder,
@@ -3482,17 +3746,17 @@ var ComposerInput = ({
3482
3746
  );
3483
3747
  };
3484
3748
  var ComposerToolbar = ({ showAttachments, toolbar, sendTooltip }) => {
3485
- return /* @__PURE__ */ jsxs13("div", { className: "aui-composer-action-wrapper relative z-[1] flex items-center justify-between gap-1 bg-composer-bg px-2.5 pb-2.5", children: [
3486
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
3487
- showAttachments && /* @__PURE__ */ jsx24(ComposerAddAttachment, {}),
3749
+ return /* @__PURE__ */ jsxs16("div", { className: "aui-composer-action-wrapper relative z-[1] flex items-center justify-between gap-1 bg-composer-bg px-2.5 pb-2.5", children: [
3750
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
3751
+ showAttachments && /* @__PURE__ */ jsx27(ComposerAddAttachment, {}),
3488
3752
  toolbar
3489
3753
  ] }),
3490
- /* @__PURE__ */ jsx24(ComposerSendOrCancel, { sendTooltip })
3754
+ /* @__PURE__ */ jsx27(ComposerSendOrCancel, { sendTooltip })
3491
3755
  ] });
3492
3756
  };
3493
3757
  var ComposerSendOrCancel = ({ sendTooltip }) => {
3494
- return /* @__PURE__ */ jsxs13(Fragment2, { children: [
3495
- /* @__PURE__ */ jsx24(AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ jsx24(ComposerPrimitive2.Send, { asChild: true, children: /* @__PURE__ */ jsx24(
3758
+ return /* @__PURE__ */ jsxs16(Fragment2, { children: [
3759
+ /* @__PURE__ */ jsx27(AuiIf, { condition: (s) => !s.thread.isRunning, children: /* @__PURE__ */ jsx27(ComposerPrimitive2.Send, { asChild: true, children: /* @__PURE__ */ jsx27(
3496
3760
  TooltipIconButton,
3497
3761
  {
3498
3762
  tooltip: sendTooltip,
@@ -3500,17 +3764,17 @@ var ComposerSendOrCancel = ({ sendTooltip }) => {
3500
3764
  type: "submit",
3501
3765
  className: "aui-composer-send shrink-0 disabled:opacity-30",
3502
3766
  "aria-label": "Send message",
3503
- children: /* @__PURE__ */ jsx24(ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
3767
+ children: /* @__PURE__ */ jsx27(ArrowUpIcon, { className: "aui-composer-send-icon size-4" })
3504
3768
  }
3505
3769
  ) }) }),
3506
- /* @__PURE__ */ jsx24(AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ jsx24(ComposerPrimitive2.Cancel, { asChild: true, children: /* @__PURE__ */ jsx24(
3770
+ /* @__PURE__ */ jsx27(AuiIf, { condition: (s) => s.thread.isRunning, children: /* @__PURE__ */ jsx27(ComposerPrimitive2.Cancel, { asChild: true, children: /* @__PURE__ */ jsx27(
3507
3771
  TooltipIconButton,
3508
3772
  {
3509
3773
  tooltip: "Stop generating",
3510
3774
  variant: "primary",
3511
3775
  className: "aui-composer-cancel shrink-0",
3512
3776
  "aria-label": "Stop generating",
3513
- children: /* @__PURE__ */ jsx24(SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
3777
+ children: /* @__PURE__ */ jsx27(SquareIcon, { className: "aui-composer-cancel-icon size-3 fill-current" })
3514
3778
  }
3515
3779
  ) }) })
3516
3780
  ] });
@@ -3524,14 +3788,14 @@ import {
3524
3788
  } from "react";
3525
3789
  import { useThreadRuntime as useThreadRuntime3 } from "@assistant-ui/react";
3526
3790
  import { ArrowUpIcon as ArrowUpIcon2 } from "lucide-react";
3527
- import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
3791
+ import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
3528
3792
  var Suggestions = ({
3529
3793
  suggestions,
3530
3794
  className
3531
3795
  }) => {
3532
3796
  const items = useResolvedSuggestions(suggestions);
3533
3797
  if (!items || items.length === 0) return null;
3534
- return /* @__PURE__ */ jsx25(
3798
+ return /* @__PURE__ */ jsx28(
3535
3799
  "div",
3536
3800
  {
3537
3801
  className: cn(
@@ -3540,7 +3804,7 @@ var Suggestions = ({
3540
3804
  ),
3541
3805
  role: "list",
3542
3806
  "aria-label": "Suggested prompts",
3543
- children: items.map((suggestion, i) => /* @__PURE__ */ jsx25(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
3807
+ children: items.map((suggestion, i) => /* @__PURE__ */ jsx28(SuggestionRow, { suggestion }, (suggestion.prompt ?? suggestion.title) + i))
3544
3808
  }
3545
3809
  );
3546
3810
  };
@@ -3550,7 +3814,7 @@ var SuggestionRow = ({ suggestion }) => {
3550
3814
  const text = suggestion.prompt ?? suggestion.title;
3551
3815
  runtime.append({ role: "user", content: [{ type: "text", text }] });
3552
3816
  };
3553
- return /* @__PURE__ */ jsxs14(
3817
+ return /* @__PURE__ */ jsxs17(
3554
3818
  "button",
3555
3819
  {
3556
3820
  type: "button",
@@ -3558,10 +3822,10 @@ var SuggestionRow = ({ suggestion }) => {
3558
3822
  onClick,
3559
3823
  className: cn("aui-thread-suggestion", studioListRowButtonClass),
3560
3824
  children: [
3561
- /* @__PURE__ */ jsx25("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ jsx25(ArrowUpIcon2, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
3562
- /* @__PURE__ */ jsxs14("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
3563
- /* @__PURE__ */ jsx25("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
3564
- suggestion.description && /* @__PURE__ */ jsx25("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
3825
+ /* @__PURE__ */ jsx28("span", { className: "aui-thread-suggestion-icon shrink-0 text-muted-foreground", children: suggestion.icon ?? /* @__PURE__ */ jsx28(ArrowUpIcon2, { className: "size-4", strokeWidth: 1.75, "aria-hidden": true }) }),
3826
+ /* @__PURE__ */ jsxs17("span", { className: "aui-thread-suggestion-text min-w-0 flex-1 text-left", children: [
3827
+ /* @__PURE__ */ jsx28("span", { className: "aui-thread-suggestion-text-1 block truncate text-sm font-normal text-foreground", children: suggestion.title }),
3828
+ suggestion.description && /* @__PURE__ */ jsx28("span", { className: "aui-thread-suggestion-text-2 mt-0.5 block truncate text-xs text-muted-foreground", children: suggestion.description })
3565
3829
  ] })
3566
3830
  ]
3567
3831
  }
@@ -3695,7 +3959,7 @@ function useThreadVariant() {
3695
3959
  }
3696
3960
 
3697
3961
  // src/chat/thread.tsx
3698
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
3962
+ import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
3699
3963
  var Thread = ({
3700
3964
  className,
3701
3965
  variant = "default",
@@ -3721,13 +3985,13 @@ var Thread = ({
3721
3985
  useEffect5(() => {
3722
3986
  scheduleThemeSanityCheck();
3723
3987
  }, []);
3724
- return /* @__PURE__ */ jsx26(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ jsx26(
3988
+ return /* @__PURE__ */ jsx29(ThreadVariantProvider, { value: variant, children: /* @__PURE__ */ jsx29(
3725
3989
  ArtifactRegistryProvider,
3726
3990
  {
3727
3991
  renderers: artifacts?.renderers,
3728
3992
  override: artifacts?.override,
3729
- children: /* @__PURE__ */ jsx26(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
3730
- }), children: /* @__PURE__ */ jsx26(
3993
+ children: /* @__PURE__ */ jsx29(UiEventProvider, { onEvent: onArtifactEvent ?? (() => {
3994
+ }), children: /* @__PURE__ */ jsx29(
3731
3995
  ThreadPrimitive.Root,
3732
3996
  {
3733
3997
  className: cn(
@@ -3737,7 +4001,7 @@ var Thread = ({
3737
4001
  ),
3738
4002
  style: { ["--thread-max-width"]: maxWidth },
3739
4003
  "data-thread-variant": variant,
3740
- children: /* @__PURE__ */ jsxs15(
4004
+ children: /* @__PURE__ */ jsxs18(
3741
4005
  ThreadPrimitive.Viewport,
3742
4006
  {
3743
4007
  turnAnchor: "bottom",
@@ -3746,7 +4010,7 @@ var Thread = ({
3746
4010
  isPanel ? "px-2 pt-2" : "px-4 pt-4"
3747
4011
  ),
3748
4012
  children: [
3749
- /* @__PURE__ */ jsx26(
4013
+ /* @__PURE__ */ jsx29(
3750
4014
  WelcomeSlot,
3751
4015
  {
3752
4016
  config: welcome,
@@ -3755,7 +4019,7 @@ var Thread = ({
3755
4019
  Suggestions: SuggestionsSlot
3756
4020
  }
3757
4021
  ),
3758
- /* @__PURE__ */ jsx26(
4022
+ /* @__PURE__ */ jsx29(
3759
4023
  ThreadPrimitive.Messages,
3760
4024
  {
3761
4025
  components: {
@@ -3765,14 +4029,14 @@ var Thread = ({
3765
4029
  }
3766
4030
  }
3767
4031
  ),
3768
- /* @__PURE__ */ jsx26(
4032
+ /* @__PURE__ */ jsx29(
3769
4033
  ThreadPrimitive.ViewportFooter,
3770
4034
  {
3771
4035
  className: cn(
3772
4036
  "aui-thread-viewport-footer sticky bottom-0 z-10 mt-auto w-full isolate pt-2",
3773
4037
  isPanel ? "bg-card pb-2" : "bg-background pb-4 md:pb-6"
3774
4038
  ),
3775
- children: /* @__PURE__ */ jsxs15(
4039
+ children: /* @__PURE__ */ jsxs18(
3776
4040
  "div",
3777
4041
  {
3778
4042
  className: cn(
@@ -3780,8 +4044,8 @@ var Thread = ({
3780
4044
  isPanel ? "gap-2" : "gap-4"
3781
4045
  ),
3782
4046
  children: [
3783
- /* @__PURE__ */ jsx26(ScrollToBottomSlot, {}),
3784
- /* @__PURE__ */ jsx26(ComposerSlot, { placeholder })
4047
+ /* @__PURE__ */ jsx29(ScrollToBottomSlot, {}),
4048
+ /* @__PURE__ */ jsx29(ComposerSlot, { placeholder })
3785
4049
  ]
3786
4050
  }
3787
4051
  )
@@ -3796,13 +4060,13 @@ var Thread = ({
3796
4060
  ) });
3797
4061
  };
3798
4062
  var ThreadScrollToBottom = () => {
3799
- return /* @__PURE__ */ jsx26(ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx26(
4063
+ return /* @__PURE__ */ jsx29(ThreadPrimitive.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx29(
3800
4064
  TooltipIconButton,
3801
4065
  {
3802
4066
  tooltip: "Scroll to bottom",
3803
4067
  variant: "secondary",
3804
4068
  className: "aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center disabled:invisible",
3805
- children: /* @__PURE__ */ jsx26(ArrowDownIcon, { className: "size-4" })
4069
+ children: /* @__PURE__ */ jsx29(ArrowDownIcon, { className: "size-4" })
3806
4070
  }
3807
4071
  ) });
3808
4072
  };
@@ -3841,8 +4105,8 @@ var ThreadWelcome = ({
3841
4105
  if (!isEmpty) return null;
3842
4106
  const defaultHeading = isPanel ? "Ask about this page" : "How can I help you today?";
3843
4107
  const defaultSubheading = isPanel ? "The assistant can use dashboard context from your app." : "Send a message to start a conversation.";
3844
- return /* @__PURE__ */ jsxs15("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
3845
- /* @__PURE__ */ jsx26("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs15(
4108
+ return /* @__PURE__ */ jsxs18("div", { className: "aui-thread-welcome-root mx-auto my-auto flex w-full max-w-(--thread-max-width) grow flex-col", children: [
4109
+ /* @__PURE__ */ jsx29("div", { className: "aui-thread-welcome-center flex w-full grow flex-col items-center justify-center", children: /* @__PURE__ */ jsxs18(
3846
4110
  motion3.div,
3847
4111
  {
3848
4112
  className: cn(
@@ -3853,8 +4117,8 @@ var ThreadWelcome = ({
3853
4117
  initial: "initial",
3854
4118
  animate: "animate",
3855
4119
  children: [
3856
- config?.icon && /* @__PURE__ */ jsx26(motion3.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
3857
- /* @__PURE__ */ jsx26(
4120
+ config?.icon && /* @__PURE__ */ jsx29(motion3.div, { variants: welcomeIcon, className: isPanel ? "mb-3" : "mb-5", children: config.icon }),
4121
+ /* @__PURE__ */ jsx29(
3858
4122
  motion3.h1,
3859
4123
  {
3860
4124
  variants: welcomeItem,
@@ -3865,7 +4129,7 @@ var ThreadWelcome = ({
3865
4129
  children: config?.heading ?? defaultHeading
3866
4130
  }
3867
4131
  ),
3868
- /* @__PURE__ */ jsx26(
4132
+ /* @__PURE__ */ jsx29(
3869
4133
  motion3.p,
3870
4134
  {
3871
4135
  variants: welcomeItem,
@@ -3876,15 +4140,15 @@ var ThreadWelcome = ({
3876
4140
  ]
3877
4141
  }
3878
4142
  ) }),
3879
- showWelcomeSuggestions && suggestions ? /* @__PURE__ */ jsx26("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ jsx26(SuggestionsSlot, { suggestions }) }) : null
4143
+ showWelcomeSuggestions && suggestions ? /* @__PURE__ */ jsx29("div", { className: "aui-thread-welcome-suggestions mx-auto w-full max-w-(--thread-max-width) px-2", children: /* @__PURE__ */ jsx29(SuggestionsSlot, { suggestions }) }) : null
3880
4144
  ] });
3881
4145
  };
3882
4146
  var MessageError = () => {
3883
- return /* @__PURE__ */ jsx26(MessagePrimitive2.Error, { children: /* @__PURE__ */ jsx26(ErrorPrimitive.Root, { className: "aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm", children: /* @__PURE__ */ jsx26(ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
4147
+ return /* @__PURE__ */ jsx29(MessagePrimitive2.Error, { children: /* @__PURE__ */ jsx29(ErrorPrimitive.Root, { className: "aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-destructive text-sm", children: /* @__PURE__ */ jsx29(ErrorPrimitive.Message, { className: "aui-message-error-message line-clamp-2" }) }) });
3884
4148
  };
3885
4149
  var AssistantMessage = () => {
3886
4150
  const isPanel = useThreadVariant() === "panel";
3887
- return /* @__PURE__ */ jsxs15(
4151
+ return /* @__PURE__ */ jsxs18(
3888
4152
  MessagePrimitive2.Root,
3889
4153
  {
3890
4154
  className: cn(
@@ -3893,7 +4157,7 @@ var AssistantMessage = () => {
3893
4157
  ),
3894
4158
  "data-role": "assistant",
3895
4159
  children: [
3896
- /* @__PURE__ */ jsxs15(
4160
+ /* @__PURE__ */ jsxs18(
3897
4161
  "div",
3898
4162
  {
3899
4163
  className: cn(
@@ -3901,7 +4165,7 @@ var AssistantMessage = () => {
3901
4165
  isPanel ? "px-1 text-sm" : "px-2"
3902
4166
  ),
3903
4167
  children: [
3904
- /* @__PURE__ */ jsx26(
4168
+ /* @__PURE__ */ jsx29(
3905
4169
  MessagePrimitive2.Parts,
3906
4170
  {
3907
4171
  components: {
@@ -3912,11 +4176,11 @@ var AssistantMessage = () => {
3912
4176
  }
3913
4177
  }
3914
4178
  ),
3915
- /* @__PURE__ */ jsx26(MessageError, {})
4179
+ /* @__PURE__ */ jsx29(MessageError, {})
3916
4180
  ]
3917
4181
  }
3918
4182
  ),
3919
- /* @__PURE__ */ jsx26("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ jsx26(AssistantActionBar, {}) })
4183
+ /* @__PURE__ */ jsx29("div", { className: "aui-assistant-message-footer mt-1 mb-3 ml-1 flex", children: /* @__PURE__ */ jsx29(AssistantActionBar, {}) })
3920
4184
  ]
3921
4185
  }
3922
4186
  );
@@ -3929,36 +4193,36 @@ var ASSISTANT_ACTION_ICON_CLASS = cn(
3929
4193
  "[&>span:first-child]:group-hover/tbv2:bg-ghost-fill-hover"
3930
4194
  );
3931
4195
  var AssistantActionBar = () => {
3932
- return /* @__PURE__ */ jsxs15(
4196
+ return /* @__PURE__ */ jsxs18(
3933
4197
  ActionBarPrimitive.Root,
3934
4198
  {
3935
4199
  hideWhenRunning: true,
3936
4200
  autohide: "never",
3937
4201
  className: "aui-assistant-action-bar-root flex items-center gap-0 bg-transparent px-0 py-0.5 text-muted-foreground/60",
3938
4202
  children: [
3939
- /* @__PURE__ */ jsx26(ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxs15(
4203
+ /* @__PURE__ */ jsx29(ActionBarPrimitive.Copy, { asChild: true, children: /* @__PURE__ */ jsxs18(
3940
4204
  TooltipIconButton,
3941
4205
  {
3942
4206
  tooltip: "Copy",
3943
4207
  variant: "ghost",
3944
4208
  className: ASSISTANT_ACTION_ICON_CLASS,
3945
4209
  children: [
3946
- /* @__PURE__ */ jsx26(AuiIf2, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx26(CheckIcon3, { className: "size-3" }) }),
3947
- /* @__PURE__ */ jsx26(AuiIf2, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx26(CopyIcon2, { className: "size-3" }) })
4210
+ /* @__PURE__ */ jsx29(AuiIf2, { condition: (s) => s.message.isCopied, children: /* @__PURE__ */ jsx29(CheckIcon3, { className: "size-3" }) }),
4211
+ /* @__PURE__ */ jsx29(AuiIf2, { condition: (s) => !s.message.isCopied, children: /* @__PURE__ */ jsx29(CopyIcon2, { className: "size-3" }) })
3948
4212
  ]
3949
4213
  }
3950
4214
  ) }),
3951
- /* @__PURE__ */ jsx26(ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ jsx26(
4215
+ /* @__PURE__ */ jsx29(ActionBarPrimitive.Reload, { asChild: true, children: /* @__PURE__ */ jsx29(
3952
4216
  TooltipIconButton,
3953
4217
  {
3954
4218
  tooltip: "Regenerate",
3955
4219
  variant: "ghost",
3956
4220
  className: ASSISTANT_ACTION_ICON_CLASS,
3957
- children: /* @__PURE__ */ jsx26(RefreshCwIcon, { className: "size-3" })
4221
+ children: /* @__PURE__ */ jsx29(RefreshCwIcon, { className: "size-3" })
3958
4222
  }
3959
4223
  ) }),
3960
- /* @__PURE__ */ jsxs15(ActionBarMorePrimitive.Root, { children: [
3961
- /* @__PURE__ */ jsx26(ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx26(
4224
+ /* @__PURE__ */ jsxs18(ActionBarMorePrimitive.Root, { children: [
4225
+ /* @__PURE__ */ jsx29(ActionBarMorePrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx29(
3962
4226
  TooltipIconButton,
3963
4227
  {
3964
4228
  tooltip: "More",
@@ -3967,17 +4231,17 @@ var AssistantActionBar = () => {
3967
4231
  ASSISTANT_ACTION_ICON_CLASS,
3968
4232
  "data-[state=open]:text-muted-foreground/80"
3969
4233
  ),
3970
- children: /* @__PURE__ */ jsx26(MoreHorizontalIcon, { className: "size-3" })
4234
+ children: /* @__PURE__ */ jsx29(MoreHorizontalIcon, { className: "size-3" })
3971
4235
  }
3972
4236
  ) }),
3973
- /* @__PURE__ */ jsx26(
4237
+ /* @__PURE__ */ jsx29(
3974
4238
  ActionBarMorePrimitive.Content,
3975
4239
  {
3976
4240
  side: "bottom",
3977
4241
  align: "start",
3978
4242
  className: "aui-action-bar-more-content z-50 min-w-36 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-card-elevated",
3979
- children: /* @__PURE__ */ jsx26(ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ jsxs15(ActionBarMorePrimitive.Item, { className: "aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none hover:bg-muted focus:bg-muted", children: [
3980
- /* @__PURE__ */ jsx26(DownloadIcon, { className: "size-4 shrink-0" }),
4243
+ children: /* @__PURE__ */ jsx29(ActionBarPrimitive.ExportMarkdown, { asChild: true, children: /* @__PURE__ */ jsxs18(ActionBarMorePrimitive.Item, { className: "aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none hover:bg-muted focus:bg-muted", children: [
4244
+ /* @__PURE__ */ jsx29(DownloadIcon, { className: "size-4 shrink-0" }),
3981
4245
  "Export as Markdown"
3982
4246
  ] }) })
3983
4247
  }
@@ -3988,11 +4252,11 @@ var AssistantActionBar = () => {
3988
4252
  );
3989
4253
  };
3990
4254
  var UserMessageText = () => {
3991
- return /* @__PURE__ */ jsx26("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ jsx26(MessagePartPrimitive.Text, { smooth: false }) });
4255
+ return /* @__PURE__ */ jsx29("span", { className: "whitespace-pre-wrap", children: /* @__PURE__ */ jsx29(MessagePartPrimitive.Text, { smooth: false }) });
3992
4256
  };
3993
4257
  var UserMessage = () => {
3994
4258
  const isPanel = useThreadVariant() === "panel";
3995
- return /* @__PURE__ */ jsxs15(
4259
+ return /* @__PURE__ */ jsxs18(
3996
4260
  MessagePrimitive2.Root,
3997
4261
  {
3998
4262
  className: cn(
@@ -4001,8 +4265,8 @@ var UserMessage = () => {
4001
4265
  ),
4002
4266
  "data-role": "user",
4003
4267
  children: [
4004
- /* @__PURE__ */ jsx26(UserMessageAttachments, {}),
4005
- /* @__PURE__ */ jsxs15(
4268
+ /* @__PURE__ */ jsx29(UserMessageAttachments, {}),
4269
+ /* @__PURE__ */ jsxs18(
4006
4270
  motion3.div,
4007
4271
  {
4008
4272
  className: cn(
@@ -4013,8 +4277,8 @@ var UserMessage = () => {
4013
4277
  animate: { opacity: 1, y: 0, scale: 1 },
4014
4278
  transition: { duration: 0.65, ease: luxuryEase },
4015
4279
  children: [
4016
- /* @__PURE__ */ jsx26(MessagePrimitive2.Parts, { components: { Text: UserMessageText } }),
4017
- /* @__PURE__ */ jsx26("div", { className: "aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2", children: /* @__PURE__ */ jsx26(UserActionBar, {}) })
4280
+ /* @__PURE__ */ jsx29(MessagePrimitive2.Parts, { components: { Text: UserMessageText } }),
4281
+ /* @__PURE__ */ jsx29("div", { className: "aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2", children: /* @__PURE__ */ jsx29(UserActionBar, {}) })
4018
4282
  ]
4019
4283
  }
4020
4284
  )
@@ -4023,42 +4287,42 @@ var UserMessage = () => {
4023
4287
  );
4024
4288
  };
4025
4289
  var UserActionBar = () => {
4026
- return /* @__PURE__ */ jsx26(
4290
+ return /* @__PURE__ */ jsx29(
4027
4291
  ActionBarPrimitive.Root,
4028
4292
  {
4029
4293
  hideWhenRunning: true,
4030
4294
  autohide: "always",
4031
4295
  className: "aui-user-action-bar-root flex flex-col items-end",
4032
- children: /* @__PURE__ */ jsx26(ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ jsx26(
4296
+ children: /* @__PURE__ */ jsx29(ActionBarPrimitive.Edit, { asChild: true, children: /* @__PURE__ */ jsx29(
4033
4297
  TooltipIconButton,
4034
4298
  {
4035
4299
  tooltip: "Edit",
4036
4300
  variant: "ghost",
4037
4301
  className: ASSISTANT_ACTION_ICON_CLASS,
4038
- children: /* @__PURE__ */ jsx26(PencilIcon, { className: "size-3" })
4302
+ children: /* @__PURE__ */ jsx29(PencilIcon, { className: "size-3" })
4039
4303
  }
4040
4304
  ) })
4041
4305
  }
4042
4306
  );
4043
4307
  };
4044
4308
  var EditComposer = () => {
4045
- return /* @__PURE__ */ jsx26(MessagePrimitive2.Root, { className: "aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3", children: /* @__PURE__ */ jsxs15(ComposerPrimitive3.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
4046
- /* @__PURE__ */ jsx26(
4309
+ return /* @__PURE__ */ jsx29(MessagePrimitive2.Root, { className: "aui-edit-composer-wrapper mx-auto flex w-full max-w-(--thread-max-width) flex-col px-2 py-3", children: /* @__PURE__ */ jsxs18(ComposerPrimitive3.Root, { className: "aui-edit-composer-root ml-auto flex w-full max-w-[85%] flex-col rounded-2xl bg-muted", children: [
4310
+ /* @__PURE__ */ jsx29(
4047
4311
  ComposerPrimitive3.Input,
4048
4312
  {
4049
4313
  className: "aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm outline-none",
4050
4314
  autoFocus: true
4051
4315
  }
4052
4316
  ),
4053
- /* @__PURE__ */ jsxs15("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4054
- /* @__PURE__ */ jsx26(ComposerPrimitive3.Cancel, { asChild: true, children: /* @__PURE__ */ jsx26(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4055
- /* @__PURE__ */ jsx26(ComposerPrimitive3.Send, { asChild: true, children: /* @__PURE__ */ jsx26(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4317
+ /* @__PURE__ */ jsxs18("div", { className: "aui-edit-composer-footer mx-3 mb-3 flex items-center gap-2 self-end", children: [
4318
+ /* @__PURE__ */ jsx29(ComposerPrimitive3.Cancel, { asChild: true, children: /* @__PURE__ */ jsx29(TimbalV2Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
4319
+ /* @__PURE__ */ jsx29(ComposerPrimitive3.Send, { asChild: true, children: /* @__PURE__ */ jsx29(TimbalV2Button, { variant: "primary", size: "sm", children: "Update" }) })
4056
4320
  ] })
4057
4321
  ] }) });
4058
4322
  };
4059
4323
 
4060
4324
  // src/chat/chat.tsx
4061
- import { jsx as jsx27 } from "react/jsx-runtime";
4325
+ import { jsx as jsx30 } from "react/jsx-runtime";
4062
4326
  function TimbalChat({
4063
4327
  workforceId,
4064
4328
  baseUrl,
@@ -4069,7 +4333,7 @@ function TimbalChat({
4069
4333
  debug,
4070
4334
  ...threadProps
4071
4335
  }) {
4072
- return /* @__PURE__ */ jsx27(
4336
+ return /* @__PURE__ */ jsx30(
4073
4337
  TimbalRuntimeProvider,
4074
4338
  {
4075
4339
  workforceId,
@@ -4079,7 +4343,7 @@ function TimbalChat({
4079
4343
  attachmentsUploadUrl,
4080
4344
  attachmentsAccept,
4081
4345
  debug,
4082
- children: /* @__PURE__ */ jsx27(Thread, { ...threadProps })
4346
+ children: /* @__PURE__ */ jsx30(Thread, { ...threadProps })
4083
4347
  }
4084
4348
  );
4085
4349
  }
@@ -4103,6 +4367,10 @@ export {
4103
4367
  toNum,
4104
4368
  monotoneLinePath,
4105
4369
  monotoneAreaPath,
4370
+ resolveChartMargin,
4371
+ flushBarCategoryGap,
4372
+ flushLineAreaEdgeToEdge,
4373
+ resolveTooltipCategory,
4106
4374
  CHART_PALETTE,
4107
4375
  LineAreaChart,
4108
4376
  PieChart,