@hex-core/components 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +3105 -0
  2. package/dist/accordion.d.ts +4 -13
  3. package/dist/alert-dialog.d.ts +11 -34
  4. package/dist/alert.d.ts +4 -17
  5. package/dist/aspect-ratio.d.ts +1 -7
  6. package/dist/avatar.d.ts +3 -11
  7. package/dist/badge.d.ts +3 -22
  8. package/dist/breadcrumb.d.ts +7 -27
  9. package/dist/button.d.ts +3 -13
  10. package/dist/calendar.d.ts +1 -17
  11. package/dist/card.d.ts +6 -16
  12. package/dist/checkbox.d.ts +2 -11
  13. package/dist/citation.d.ts +2 -0
  14. package/dist/citation.js +70 -0
  15. package/dist/citation.js.map +1 -0
  16. package/dist/cluster.d.ts +3 -34
  17. package/dist/code-block-copy.d.ts +2 -0
  18. package/dist/code-block-copy.js +108 -0
  19. package/dist/code-block-copy.js.map +1 -0
  20. package/dist/code-block.d.ts +3 -0
  21. package/dist/code-block.js +90 -0
  22. package/dist/code-block.js.map +1 -0
  23. package/dist/collapsible.d.ts +3 -11
  24. package/dist/color-picker.d.ts +2 -44
  25. package/dist/combobox.d.ts +3 -45
  26. package/dist/command.d.ts +9 -111
  27. package/dist/composer.d.ts +2 -0
  28. package/dist/composer.js +75 -0
  29. package/dist/composer.js.map +1 -0
  30. package/dist/container.d.ts +3 -41
  31. package/dist/context-menu.d.ts +12 -37
  32. package/dist/data-table.d.ts +2 -33
  33. package/dist/date-picker.d.ts +2 -43
  34. package/dist/dialog.d.ts +11 -46
  35. package/dist/drawer.d.ts +10 -41
  36. package/dist/dropdown-menu.d.ts +13 -39
  37. package/dist/dropzone.d.ts +3 -54
  38. package/dist/file-tree.d.ts +3 -53
  39. package/dist/form.d.ts +8 -45
  40. package/dist/grid.d.ts +3 -50
  41. package/dist/hover-card.d.ts +3 -11
  42. package/dist/index.d.ts +298 -179
  43. package/dist/index.js +674 -1
  44. package/dist/index.js.map +1 -1
  45. package/dist/input-otp.d.ts +5 -19
  46. package/dist/input.d.ts +2 -6
  47. package/dist/label.d.ts +2 -11
  48. package/dist/loading-indicator.d.ts +3 -0
  49. package/dist/loading-indicator.js +64 -0
  50. package/dist/loading-indicator.js.map +1 -0
  51. package/dist/markdown.d.ts +2 -0
  52. package/dist/markdown.js +28 -0
  53. package/dist/markdown.js.map +1 -0
  54. package/dist/menubar.d.ts +11 -35
  55. package/dist/message-actions.d.ts +2 -0
  56. package/dist/message-actions.js +28 -0
  57. package/dist/message-actions.js.map +1 -0
  58. package/dist/message-list.d.ts +2 -0
  59. package/dist/message-list.js +49 -0
  60. package/dist/message-list.js.map +1 -0
  61. package/dist/message.d.ts +3 -0
  62. package/dist/message.js +35 -0
  63. package/dist/message.js.map +1 -0
  64. package/dist/multi-combobox.d.ts +3 -51
  65. package/dist/navigation-menu.d.ts +9 -23
  66. package/dist/pagination.d.ts +7 -40
  67. package/dist/popover.d.ts +4 -13
  68. package/dist/progress.d.ts +1 -10
  69. package/dist/radio-group.d.ts +2 -9
  70. package/dist/reasoning.d.ts +2 -0
  71. package/dist/reasoning.js +90 -0
  72. package/dist/reasoning.js.map +1 -0
  73. package/dist/resizable.d.ts +3 -28
  74. package/dist/schemas.d.ts +72 -121
  75. package/dist/schemas.js +849 -1
  76. package/dist/schemas.js.map +1 -1
  77. package/dist/scroll-area.d.ts +3 -18
  78. package/dist/select.d.ts +8 -21
  79. package/dist/separator.d.ts +2 -11
  80. package/dist/sheet.d.ts +10 -39
  81. package/dist/sidebar.d.ts +8 -75
  82. package/dist/skeleton.d.ts +1 -11
  83. package/dist/slider.d.ts +2 -20
  84. package/dist/sonner.d.ts +2 -14
  85. package/dist/spacer.d.ts +3 -38
  86. package/dist/stack.d.ts +3 -34
  87. package/dist/stepper.d.ts +4 -48
  88. package/dist/suggestion.d.ts +2 -0
  89. package/dist/suggestion.js +55 -0
  90. package/dist/suggestion.js.map +1 -0
  91. package/dist/switch.d.ts +2 -11
  92. package/dist/table.d.ts +8 -24
  93. package/dist/tabs.d.ts +4 -13
  94. package/dist/textarea.d.ts +2 -10
  95. package/dist/time-picker.d.ts +2 -34
  96. package/dist/timeline.d.ts +4 -42
  97. package/dist/toggle-group.d.ts +2 -17
  98. package/dist/toggle.d.ts +2 -19
  99. package/dist/tool-call.d.ts +2 -0
  100. package/dist/tool-call.js +133 -0
  101. package/dist/tool-call.js.map +1 -0
  102. package/dist/tooltip.d.ts +4 -13
  103. package/package.json +4 -1
  104. package/dist/button-variants-Bx6gCUFp.d.ts +0 -19
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { Slot } from '@radix-ui/react-slot';
3
3
  import * as React44 from 'react';
4
+ import { cache } from 'react';
4
5
  import { clsx } from 'clsx';
5
6
  import { twMerge } from 'tailwind-merge';
6
7
  import { cva } from 'class-variance-authority';
@@ -40,6 +41,9 @@ import { OTPInput, OTPInputContext } from 'input-otp';
40
41
  import { Command as Command$1 } from 'cmdk';
41
42
  import { Drawer as Drawer$1 } from 'vaul';
42
43
  import { Panel, Group, Separator as Separator$1 } from 'react-resizable-panels';
44
+ import { Streamdown } from 'streamdown';
45
+ import { codeToHtml } from 'shiki';
46
+ import { CodeBlockCopy } from './code-block-copy.js';
43
47
 
44
48
  // src/primitives/button/button.tsx
45
49
  function cn(...inputs) {
@@ -4199,7 +4203,676 @@ var SidebarItem = React44.forwardRef(
4199
4203
  }
4200
4204
  );
4201
4205
  SidebarItem.displayName = "SidebarItem";
4206
+ var messageVariants = cva(
4207
+ [
4208
+ "flex w-full gap-3 px-4 py-3 text-sm",
4209
+ "transition-colors duration-[var(--duration-normal,200ms)] ease-out"
4210
+ ].join(" "),
4211
+ {
4212
+ variants: {
4213
+ role: {
4214
+ user: "bg-secondary/40 text-foreground",
4215
+ assistant: "bg-card text-card-foreground",
4216
+ system: "bg-muted text-muted-foreground italic",
4217
+ tool: "bg-accent/15 text-accent-foreground border-l-2 border-accent"
4218
+ }
4219
+ },
4220
+ defaultVariants: {
4221
+ role: "assistant"
4222
+ }
4223
+ }
4224
+ );
4225
+ function Message({ role, className, children, ...props }) {
4226
+ return /* @__PURE__ */ jsx("div", { "data-role": role, className: cn(messageVariants({ role }), className), ...props, children });
4227
+ }
4228
+ var NEAR_BOTTOM_THRESHOLD_PX = 80;
4229
+ function MessageList({
4230
+ autoScroll = true,
4231
+ className,
4232
+ children,
4233
+ ...props
4234
+ }) {
4235
+ const ref = React44.useRef(null);
4236
+ const stickToBottomRef = React44.useRef(true);
4237
+ React44.useEffect(() => {
4238
+ const el = ref.current;
4239
+ if (!el || !autoScroll) return;
4240
+ if (stickToBottomRef.current) {
4241
+ el.scrollTop = el.scrollHeight;
4242
+ }
4243
+ }, [autoScroll, children]);
4244
+ function handleScroll(event) {
4245
+ const el = event.currentTarget;
4246
+ const distance = el.scrollHeight - el.scrollTop - el.clientHeight;
4247
+ stickToBottomRef.current = distance < NEAR_BOTTOM_THRESHOLD_PX;
4248
+ props.onScroll?.(event);
4249
+ }
4250
+ return /* @__PURE__ */ jsx(
4251
+ "div",
4252
+ {
4253
+ ref,
4254
+ role: "log",
4255
+ "aria-live": "polite",
4256
+ "aria-relevant": "additions",
4257
+ className: cn("flex flex-col overflow-y-auto", className),
4258
+ ...props,
4259
+ onScroll: handleScroll,
4260
+ children
4261
+ }
4262
+ );
4263
+ }
4264
+ function Composer({
4265
+ value,
4266
+ onValueChange,
4267
+ onSubmit,
4268
+ disabled,
4269
+ placeholder,
4270
+ submitOnEnter = true,
4271
+ textareaAriaLabel,
4272
+ children,
4273
+ className,
4274
+ ...rest
4275
+ }) {
4276
+ function trySubmit() {
4277
+ const trimmed = value.trim();
4278
+ if (!trimmed || disabled) return;
4279
+ onSubmit(trimmed);
4280
+ }
4281
+ function handleKeyDown(event) {
4282
+ if (!submitOnEnter) return;
4283
+ if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
4284
+ event.preventDefault();
4285
+ trySubmit();
4286
+ }
4287
+ }
4288
+ function handleSubmit(event) {
4289
+ event.preventDefault();
4290
+ trySubmit();
4291
+ }
4292
+ return /* @__PURE__ */ jsxs(
4293
+ "form",
4294
+ {
4295
+ ...rest,
4296
+ onSubmit: handleSubmit,
4297
+ className: cn(
4298
+ "flex items-end gap-2 rounded-lg border bg-background p-2",
4299
+ "focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
4300
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4301
+ className
4302
+ ),
4303
+ children: [
4304
+ /* @__PURE__ */ jsx(
4305
+ "textarea",
4306
+ {
4307
+ value,
4308
+ onChange: (event) => onValueChange(event.target.value),
4309
+ onKeyDown: handleKeyDown,
4310
+ disabled,
4311
+ placeholder,
4312
+ "aria-label": textareaAriaLabel ?? placeholder ?? "Message",
4313
+ rows: 1,
4314
+ className: cn(
4315
+ "flex-1 resize-none bg-transparent px-2 py-1.5 text-sm leading-6",
4316
+ "placeholder:text-muted-foreground focus:outline-none",
4317
+ "disabled:cursor-not-allowed disabled:opacity-50",
4318
+ "max-h-48 min-h-[2.25rem] overflow-y-auto"
4319
+ )
4320
+ }
4321
+ ),
4322
+ children
4323
+ ]
4324
+ }
4325
+ );
4326
+ }
4327
+ var loadingIndicatorVariants = cva("inline-flex items-center gap-2 text-muted-foreground", {
4328
+ variants: {
4329
+ size: {
4330
+ sm: "text-xs",
4331
+ md: "text-sm"
4332
+ }
4333
+ },
4334
+ defaultVariants: { size: "md" }
4335
+ });
4336
+ function LoadingIndicator({
4337
+ variant = "dots",
4338
+ size,
4339
+ label,
4340
+ className,
4341
+ ...props
4342
+ }) {
4343
+ const ariaLabel = label ?? "Loading";
4344
+ return /* @__PURE__ */ jsxs(
4345
+ "div",
4346
+ {
4347
+ role: "status",
4348
+ "aria-live": "polite",
4349
+ className: cn(loadingIndicatorVariants({ size }), className),
4350
+ ...props,
4351
+ children: [
4352
+ variant === "dots" ? /* @__PURE__ */ jsx(Dots, {}) : null,
4353
+ variant === "pulse" ? /* @__PURE__ */ jsx(Pulse, {}) : null,
4354
+ variant === "bar" ? /* @__PURE__ */ jsx(Bar, {}) : null,
4355
+ label ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: label }) : null,
4356
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: ariaLabel })
4357
+ ]
4358
+ }
4359
+ );
4360
+ }
4361
+ function Dots() {
4362
+ return /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
4363
+ /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-current [animation-delay:-0.3s]" }),
4364
+ /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-current [animation-delay:-0.15s]" }),
4365
+ /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full bg-current" })
4366
+ ] });
4367
+ }
4368
+ function Pulse() {
4369
+ return /* @__PURE__ */ jsx("span", { className: "h-2 w-2 animate-pulse rounded-full bg-current" });
4370
+ }
4371
+ function Bar() {
4372
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", children: [
4373
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-2 animate-pulse rounded-full bg-current [animation-delay:-0.4s]" }),
4374
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-3 animate-pulse rounded-full bg-current [animation-delay:-0.2s]" }),
4375
+ /* @__PURE__ */ jsx("span", { className: "h-0.5 w-4 animate-pulse rounded-full bg-current" })
4376
+ ] });
4377
+ }
4378
+ function Suggestion({
4379
+ value,
4380
+ onSelect,
4381
+ children,
4382
+ className,
4383
+ type = "button",
4384
+ onClick,
4385
+ ...props
4386
+ }) {
4387
+ function handleClick(event) {
4388
+ const payload = value ?? extractText(children);
4389
+ onSelect(payload);
4390
+ onClick?.(event);
4391
+ }
4392
+ return /* @__PURE__ */ jsx(
4393
+ "button",
4394
+ {
4395
+ type,
4396
+ onClick: handleClick,
4397
+ className: cn(
4398
+ "inline-flex items-center rounded-full border border-foreground/15 bg-background px-3 py-1.5 text-sm",
4399
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4400
+ "hover:border-foreground/30 hover:bg-secondary/40 hover:shadow-sm",
4401
+ "active:scale-[0.98]",
4402
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4403
+ "disabled:cursor-not-allowed disabled:opacity-50",
4404
+ className
4405
+ ),
4406
+ ...props,
4407
+ children
4408
+ }
4409
+ );
4410
+ }
4411
+ function extractText(node) {
4412
+ if (node == null || typeof node === "boolean") return "";
4413
+ if (typeof node === "string" || typeof node === "number") return String(node);
4414
+ if (Array.isArray(node)) return node.map(extractText).join(" ").replace(/\s+/g, " ").trim();
4415
+ if (React44.isValidElement(node)) {
4416
+ return extractText(node.props.children);
4417
+ }
4418
+ return "";
4419
+ }
4420
+ var STATE_LABEL = {
4421
+ pending: "Pending",
4422
+ running: "Running",
4423
+ result: "Done",
4424
+ error: "Error"
4425
+ };
4426
+ var STATE_CLASSES = {
4427
+ pending: "bg-muted text-muted-foreground",
4428
+ running: "bg-primary/15 text-primary animate-pulse",
4429
+ result: "bg-accent/30 text-accent-foreground",
4430
+ error: "bg-destructive/15 text-destructive"
4431
+ };
4432
+ function ToolCall({
4433
+ name,
4434
+ state,
4435
+ args,
4436
+ result,
4437
+ defaultOpen = false,
4438
+ className
4439
+ }) {
4440
+ return /* @__PURE__ */ jsxs(
4441
+ CollapsiblePrimitive.Root,
4442
+ {
4443
+ defaultOpen,
4444
+ className: cn(
4445
+ "overflow-hidden rounded-md border bg-card text-card-foreground",
4446
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4447
+ "data-[state=open]:shadow-sm",
4448
+ className
4449
+ ),
4450
+ children: [
4451
+ /* @__PURE__ */ jsxs(
4452
+ CollapsiblePrimitive.Trigger,
4453
+ {
4454
+ className: cn(
4455
+ "group flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-sm",
4456
+ "hover:bg-muted/40",
4457
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4458
+ ),
4459
+ children: [
4460
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
4461
+ /* @__PURE__ */ jsx(ToolGlyph, {}),
4462
+ /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-xs text-foreground", children: name }),
4463
+ /* @__PURE__ */ jsx(
4464
+ "span",
4465
+ {
4466
+ className: cn(
4467
+ "inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium",
4468
+ STATE_CLASSES[state]
4469
+ ),
4470
+ children: STATE_LABEL[state]
4471
+ }
4472
+ )
4473
+ ] }),
4474
+ /* @__PURE__ */ jsx(Chevron2, {})
4475
+ ]
4476
+ }
4477
+ ),
4478
+ /* @__PURE__ */ jsxs(CollapsiblePrimitive.Content, { className: "overflow-hidden border-t bg-muted/20 px-3 py-2 text-xs", children: [
4479
+ args !== void 0 ? /* @__PURE__ */ jsx(CodeSection, { label: "Arguments", value: args }) : null,
4480
+ result !== void 0 ? /* @__PURE__ */ jsx(CodeSection, { label: "Result", value: result }) : null,
4481
+ args === void 0 && result === void 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "No arguments or result yet." }) : null
4482
+ ] })
4483
+ ]
4484
+ }
4485
+ );
4486
+ }
4487
+ function CodeSection({ label, value }) {
4488
+ const text = typeof value === "string" ? value : safeStringify(value);
4489
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-1 py-1", children: [
4490
+ /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: label }),
4491
+ /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto rounded bg-background/60 p-2 font-mono text-[11px] leading-snug", children: text })
4492
+ ] });
4493
+ }
4494
+ function safeStringify(value) {
4495
+ try {
4496
+ return JSON.stringify(value, null, 2);
4497
+ } catch {
4498
+ return String(value);
4499
+ }
4500
+ }
4501
+ function ToolGlyph() {
4502
+ return /* @__PURE__ */ jsxs(
4503
+ "svg",
4504
+ {
4505
+ "aria-hidden": true,
4506
+ viewBox: "0 0 16 16",
4507
+ width: "14",
4508
+ height: "14",
4509
+ fill: "none",
4510
+ stroke: "currentColor",
4511
+ strokeWidth: "1.5",
4512
+ strokeLinecap: "round",
4513
+ strokeLinejoin: "round",
4514
+ className: "shrink-0 text-muted-foreground",
4515
+ children: [
4516
+ /* @__PURE__ */ jsx("path", { d: "M11.5 1.5l3 3-2.5 2.5-3-3 2.5-2.5z" }),
4517
+ /* @__PURE__ */ jsx("path", { d: "M9 4l-7 7v3h3l7-7" })
4518
+ ]
4519
+ }
4520
+ );
4521
+ }
4522
+ function Chevron2() {
4523
+ return /* @__PURE__ */ jsx(
4524
+ "svg",
4525
+ {
4526
+ "aria-hidden": true,
4527
+ viewBox: "0 0 16 16",
4528
+ width: "14",
4529
+ height: "14",
4530
+ fill: "none",
4531
+ stroke: "currentColor",
4532
+ strokeWidth: "1.5",
4533
+ strokeLinecap: "round",
4534
+ strokeLinejoin: "round",
4535
+ className: "shrink-0 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180",
4536
+ children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4" })
4537
+ }
4538
+ );
4539
+ }
4540
+ function Reasoning({
4541
+ children,
4542
+ defaultOpen = false,
4543
+ durationMs,
4544
+ label,
4545
+ className
4546
+ }) {
4547
+ const headerLabel = label ?? (typeof durationMs === "number" ? formatThoughtFor(durationMs) : "Thinking");
4548
+ return /* @__PURE__ */ jsxs(
4549
+ CollapsiblePrimitive.Root,
4550
+ {
4551
+ defaultOpen,
4552
+ className: cn("overflow-hidden rounded-md border-l-2 border-foreground/15 bg-muted/20", className),
4553
+ children: [
4554
+ /* @__PURE__ */ jsxs(
4555
+ CollapsiblePrimitive.Trigger,
4556
+ {
4557
+ className: cn(
4558
+ "group flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-muted-foreground",
4559
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4560
+ "hover:text-foreground",
4561
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4562
+ ),
4563
+ children: [
4564
+ /* @__PURE__ */ jsx(SparkleGlyph, {}),
4565
+ /* @__PURE__ */ jsx("span", { className: "font-medium italic", children: headerLabel }),
4566
+ /* @__PURE__ */ jsx(Chevron3, {})
4567
+ ]
4568
+ }
4569
+ ),
4570
+ /* @__PURE__ */ jsx(CollapsiblePrimitive.Content, { className: "overflow-hidden border-t border-foreground/[0.06] px-3 py-2 text-sm text-muted-foreground", children })
4571
+ ]
4572
+ }
4573
+ );
4574
+ }
4575
+ function formatThoughtFor(ms) {
4576
+ if (ms < 1e3) return `Thought for ${ms}ms`;
4577
+ const seconds = ms / 1e3;
4578
+ const formatted = seconds >= 10 ? Math.round(seconds).toString() : seconds.toFixed(1);
4579
+ return `Thought for ${formatted}s`;
4580
+ }
4581
+ function SparkleGlyph() {
4582
+ return /* @__PURE__ */ jsx(
4583
+ "svg",
4584
+ {
4585
+ "aria-hidden": true,
4586
+ viewBox: "0 0 16 16",
4587
+ width: "12",
4588
+ height: "12",
4589
+ fill: "none",
4590
+ stroke: "currentColor",
4591
+ strokeWidth: "1.5",
4592
+ strokeLinecap: "round",
4593
+ strokeLinejoin: "round",
4594
+ className: "shrink-0",
4595
+ children: /* @__PURE__ */ jsx("path", { d: "M8 1.5l1.5 4 4 1.5-4 1.5L8 12.5 6.5 8.5l-4-1.5 4-1.5L8 1.5z" })
4596
+ }
4597
+ );
4598
+ }
4599
+ function Chevron3() {
4600
+ return /* @__PURE__ */ jsx(
4601
+ "svg",
4602
+ {
4603
+ "aria-hidden": true,
4604
+ viewBox: "0 0 16 16",
4605
+ width: "12",
4606
+ height: "12",
4607
+ fill: "none",
4608
+ stroke: "currentColor",
4609
+ strokeWidth: "1.5",
4610
+ strokeLinecap: "round",
4611
+ strokeLinejoin: "round",
4612
+ className: "ml-auto shrink-0 transition-transform duration-200 group-data-[state=open]:rotate-180",
4613
+ children: /* @__PURE__ */ jsx("path", { d: "M4 6l4 4 4-4" })
4614
+ }
4615
+ );
4616
+ }
4617
+ function MessageActions({ className, children, ...props }) {
4618
+ return /* @__PURE__ */ jsx(
4619
+ "div",
4620
+ {
4621
+ className: cn(
4622
+ "mt-2 flex items-center gap-1 opacity-60",
4623
+ "transition-opacity duration-[var(--duration-normal,200ms)] ease-out",
4624
+ "group-hover/message:opacity-100 hover:opacity-100 focus-within:opacity-100",
4625
+ className
4626
+ ),
4627
+ ...props,
4628
+ children
4629
+ }
4630
+ );
4631
+ }
4632
+ function Citation({ title, url, page, index, className, children }) {
4633
+ const baseClasses = cn(
4634
+ "inline-flex items-center gap-1.5 rounded-md border border-foreground/15 bg-card px-2 py-0.5 text-xs",
4635
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4636
+ className
4637
+ );
4638
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
4639
+ typeof index === "number" ? /* @__PURE__ */ jsxs("span", { className: "font-mono text-[10px] font-semibold text-muted-foreground", children: [
4640
+ "[",
4641
+ index,
4642
+ "]"
4643
+ ] }) : /* @__PURE__ */ jsx(DocGlyph, {}),
4644
+ /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: title }),
4645
+ typeof page === "number" ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
4646
+ "p.",
4647
+ page
4648
+ ] }) : null,
4649
+ children
4650
+ ] });
4651
+ if (url) {
4652
+ return /* @__PURE__ */ jsx(
4653
+ "a",
4654
+ {
4655
+ href: url,
4656
+ target: "_blank",
4657
+ rel: "noreferrer noopener",
4658
+ className: cn(
4659
+ baseClasses,
4660
+ "hover:border-foreground/30 hover:bg-secondary/40 hover:shadow-sm",
4661
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
4662
+ ),
4663
+ children: body
4664
+ }
4665
+ );
4666
+ }
4667
+ return /* @__PURE__ */ jsx("span", { className: baseClasses, children: body });
4668
+ }
4669
+ function DocGlyph() {
4670
+ return /* @__PURE__ */ jsxs(
4671
+ "svg",
4672
+ {
4673
+ "aria-hidden": true,
4674
+ viewBox: "0 0 16 16",
4675
+ width: "11",
4676
+ height: "11",
4677
+ fill: "none",
4678
+ stroke: "currentColor",
4679
+ strokeWidth: "1.5",
4680
+ strokeLinecap: "round",
4681
+ strokeLinejoin: "round",
4682
+ className: "shrink-0 text-muted-foreground",
4683
+ children: [
4684
+ /* @__PURE__ */ jsx("path", { d: "M9 1.5H4.5A1.5 1.5 0 0 0 3 3v10a1.5 1.5 0 0 0 1.5 1.5h7A1.5 1.5 0 0 0 13 13V5.5L9 1.5z" }),
4685
+ /* @__PURE__ */ jsx("path", { d: "M9 1.5V5.5h4" })
4686
+ ]
4687
+ }
4688
+ );
4689
+ }
4690
+ function Markdown({ children, className }) {
4691
+ return /* @__PURE__ */ jsx(
4692
+ Streamdown,
4693
+ {
4694
+ className: cn(
4695
+ "prose prose-sm max-w-none text-foreground",
4696
+ "prose-headings:text-foreground prose-strong:text-foreground",
4697
+ "prose-a:text-primary prose-a:underline-offset-4 hover:prose-a:underline",
4698
+ "prose-code:text-foreground prose-code:before:content-none prose-code:after:content-none",
4699
+ className
4700
+ ),
4701
+ children
4702
+ }
4703
+ );
4704
+ }
4705
+ var LABEL_TO_LANG = {
4706
+ pnpm: "bash",
4707
+ npm: "bash",
4708
+ yarn: "bash",
4709
+ bun: "bash",
4710
+ bash: "bash",
4711
+ sh: "bash",
4712
+ shell: "bash",
4713
+ zsh: "bash",
4714
+ ts: "ts",
4715
+ typescript: "ts",
4716
+ tsx: "tsx",
4717
+ js: "js",
4718
+ javascript: "js",
4719
+ jsx: "jsx",
4720
+ json: "json",
4721
+ css: "css",
4722
+ html: "html",
4723
+ md: "md",
4724
+ markdown: "md",
4725
+ py: "py",
4726
+ python: "py",
4727
+ text: "text",
4728
+ prompt: "text",
4729
+ plain: "text"
4730
+ };
4731
+ var DEFAULT_THEMES = { light: "github-light", dark: "github-dark" };
4732
+ var cachedCodeToHtml = cache(
4733
+ async (code, lang, themesKey, themes) => {
4734
+ return codeToHtml(code, { lang, themes, defaultColor: false });
4735
+ }
4736
+ );
4737
+ function resolveLang(label, language) {
4738
+ if (language) return language;
4739
+ if (label) {
4740
+ const fromLabel = LABEL_TO_LANG[label.toLowerCase()];
4741
+ if (fromLabel) return fromLabel;
4742
+ }
4743
+ return "text";
4744
+ }
4745
+ async function CodeBlock({
4746
+ code,
4747
+ label,
4748
+ language,
4749
+ themes = DEFAULT_THEMES,
4750
+ className
4751
+ }) {
4752
+ const lang = resolveLang(label, language);
4753
+ const themesKey = `${themes.light}|${themes.dark}`;
4754
+ const html = await cachedCodeToHtml(code, lang, themesKey, themes);
4755
+ const displayLabel = label ?? lang;
4756
+ return /* @__PURE__ */ jsxs(
4757
+ "div",
4758
+ {
4759
+ className: cn(
4760
+ "group relative overflow-hidden rounded-lg border bg-card text-card-foreground",
4761
+ className
4762
+ ),
4763
+ children: [
4764
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b bg-muted/40 px-3 py-1.5", children: [
4765
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-medium text-muted-foreground", children: displayLabel }),
4766
+ /* @__PURE__ */ jsx(CodeBlockCopy, { code })
4767
+ ] }),
4768
+ /* @__PURE__ */ jsx(
4769
+ "div",
4770
+ {
4771
+ "data-shiki": "",
4772
+ className: "overflow-x-auto p-4 font-mono text-sm [&_pre]:!bg-transparent",
4773
+ dangerouslySetInnerHTML: { __html: html }
4774
+ }
4775
+ )
4776
+ ]
4777
+ }
4778
+ );
4779
+ }
4780
+ var RESET_DELAY_MS = 1500;
4781
+ function CodeBlockCopy2({ code, className, ...props }) {
4782
+ const [state, setState] = React44.useState("idle");
4783
+ React44.useEffect(() => {
4784
+ if (state === "idle") return;
4785
+ const id = window.setTimeout(() => setState("idle"), RESET_DELAY_MS);
4786
+ return () => window.clearTimeout(id);
4787
+ }, [state]);
4788
+ async function handleClick() {
4789
+ try {
4790
+ await navigator.clipboard.writeText(code);
4791
+ setState("copied");
4792
+ } catch {
4793
+ setState("error");
4794
+ }
4795
+ }
4796
+ const ariaLabel = state === "copied" ? "Copied" : state === "error" ? "Copy failed" : "Copy code";
4797
+ return /* @__PURE__ */ jsx(
4798
+ "button",
4799
+ {
4800
+ type: "button",
4801
+ onClick: handleClick,
4802
+ "aria-label": ariaLabel,
4803
+ title: ariaLabel,
4804
+ className: cn(
4805
+ "inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground",
4806
+ "transition-all duration-[var(--duration-normal,200ms)] ease-out",
4807
+ "hover:bg-foreground/10 hover:text-foreground",
4808
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
4809
+ className
4810
+ ),
4811
+ ...props,
4812
+ children: state === "copied" ? /* @__PURE__ */ jsx(CheckGlyph, {}) : state === "error" ? /* @__PURE__ */ jsx(ErrorGlyph, {}) : /* @__PURE__ */ jsx(CopyGlyph, {})
4813
+ }
4814
+ );
4815
+ }
4816
+ function CopyGlyph() {
4817
+ return /* @__PURE__ */ jsxs(
4818
+ "svg",
4819
+ {
4820
+ "aria-hidden": true,
4821
+ viewBox: "0 0 16 16",
4822
+ width: "13",
4823
+ height: "13",
4824
+ fill: "none",
4825
+ stroke: "currentColor",
4826
+ strokeWidth: "1.5",
4827
+ strokeLinecap: "round",
4828
+ strokeLinejoin: "round",
4829
+ children: [
4830
+ /* @__PURE__ */ jsx("rect", { x: "5", y: "5", width: "9", height: "9", rx: "1.5" }),
4831
+ /* @__PURE__ */ jsx("path", { d: "M11 5V3.5A1.5 1.5 0 0 0 9.5 2h-6A1.5 1.5 0 0 0 2 3.5v6A1.5 1.5 0 0 0 3.5 11H5" })
4832
+ ]
4833
+ }
4834
+ );
4835
+ }
4836
+ function CheckGlyph() {
4837
+ return /* @__PURE__ */ jsx(
4838
+ "svg",
4839
+ {
4840
+ "aria-hidden": true,
4841
+ viewBox: "0 0 16 16",
4842
+ width: "13",
4843
+ height: "13",
4844
+ fill: "none",
4845
+ stroke: "currentColor",
4846
+ strokeWidth: "1.5",
4847
+ strokeLinecap: "round",
4848
+ strokeLinejoin: "round",
4849
+ className: "text-emerald-500",
4850
+ children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 5" })
4851
+ }
4852
+ );
4853
+ }
4854
+ function ErrorGlyph() {
4855
+ return /* @__PURE__ */ jsxs(
4856
+ "svg",
4857
+ {
4858
+ "aria-hidden": true,
4859
+ viewBox: "0 0 16 16",
4860
+ width: "13",
4861
+ height: "13",
4862
+ fill: "none",
4863
+ stroke: "currentColor",
4864
+ strokeWidth: "1.5",
4865
+ strokeLinecap: "round",
4866
+ strokeLinejoin: "round",
4867
+ className: "text-destructive",
4868
+ children: [
4869
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.5" }),
4870
+ /* @__PURE__ */ jsx("path", { d: "M8 5v3.5M8 11v.01" })
4871
+ ]
4872
+ }
4873
+ );
4874
+ }
4202
4875
 
4203
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Cluster, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, Dropzone, FileTree, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, Menubar, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarSeparator, MenubarShortcut, MenubarTrigger, MultiCombobox, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarProvider, SidebarTrigger, Skeleton, Slider, Spacer, Stack, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TimePicker, Timeline, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, clusterVariants, cn, containerVariants, formatHslTriplet, gridVariants, hexToHslTriplet, hslToRgb, hslTripletToHex, navigationMenuTriggerStyle, parseHslTriplet, rgbToHsl, spacerVariants, stackVariants, toggleVariants, useFormField, useSidebar };
4876
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Citation, Cluster, CodeBlock, CodeBlockCopy2 as CodeBlockCopy, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, ColorPicker, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Composer, Container, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuTrigger, DataTable, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuTrigger, Dropzone, FileTree, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Grid, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Label, LoadingIndicator, Markdown, Menubar, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarSeparator, MenubarShortcut, MenubarTrigger, Message, MessageActions, MessageList, MultiCombobox, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, RadioGroup, RadioGroupItem, Reasoning, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarProvider, SidebarTrigger, Skeleton, Slider, Spacer, Stack, Stepper, Suggestion, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TimePicker, Timeline, Toaster, Toggle, ToggleGroup, ToggleGroupItem, ToolCall, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, alertVariants, badgeVariants, buttonVariants, clusterVariants, cn, containerVariants, formatHslTriplet, gridVariants, hexToHslTriplet, hslToRgb, hslTripletToHex, loadingIndicatorVariants, messageVariants, navigationMenuTriggerStyle, parseHslTriplet, rgbToHsl, spacerVariants, stackVariants, toggleVariants, useFormField, useSidebar };
4204
4877
  //# sourceMappingURL=index.js.map
4205
4878
  //# sourceMappingURL=index.js.map