@assistant-ui/react 0.5.76 → 0.5.77

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.
package/dist/index.mjs CHANGED
@@ -1438,9 +1438,9 @@ var useIsHoveringRef = () => {
1438
1438
  );
1439
1439
  return useManagedRef(callbackRef);
1440
1440
  };
1441
- var MessagePrimitiveRoot = forwardRef12((props, forwardRef35) => {
1441
+ var MessagePrimitiveRoot = forwardRef12((props, forwardRef36) => {
1442
1442
  const isHoveringRef = useIsHoveringRef();
1443
- const ref = useComposedRefs(forwardRef35, isHoveringRef);
1443
+ const ref = useComposedRefs(forwardRef36, isHoveringRef);
1444
1444
  return /* @__PURE__ */ jsx18(Primitive9.div, { ...props, ref });
1445
1445
  });
1446
1446
  MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
@@ -5562,15 +5562,15 @@ var assistant_message_default = Object.assign(
5562
5562
  );
5563
5563
 
5564
5564
  // src/ui/assistant-modal.tsx
5565
- import { forwardRef as forwardRef34 } from "react";
5565
+ import { forwardRef as forwardRef35 } from "react";
5566
5566
  import { BotIcon, ChevronDownIcon } from "lucide-react";
5567
5567
 
5568
5568
  // src/ui/thread.tsx
5569
- import { forwardRef as forwardRef33 } from "react";
5569
+ import { forwardRef as forwardRef34 } from "react";
5570
5570
  import { ArrowDownIcon } from "lucide-react";
5571
5571
 
5572
5572
  // src/ui/composer.tsx
5573
- import { forwardRef as forwardRef28 } from "react";
5573
+ import { forwardRef as forwardRef29 } from "react";
5574
5574
  import { PaperclipIcon, SendHorizontalIcon } from "lucide-react";
5575
5575
 
5576
5576
  // src/ui/base/CircleStopIcon.tsx
@@ -5590,15 +5590,117 @@ var CircleStopIcon = () => {
5590
5590
  };
5591
5591
  CircleStopIcon.displayName = "CircleStopIcon";
5592
5592
 
5593
- // src/ui/composer-attachment.tsx
5594
- import { forwardRef as forwardRef27 } from "react";
5595
- import { CircleXIcon } from "lucide-react";
5593
+ // src/ui/attachment.tsx
5594
+ import {
5595
+ forwardRef as forwardRef28,
5596
+ useEffect as useEffect15,
5597
+ useState as useState14
5598
+ } from "react";
5599
+ import { CircleXIcon, FileIcon } from "lucide-react";
5600
+
5601
+ // src/ui/base/dialog.tsx
5602
+ import * as React from "react";
5603
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
5604
+ import classNames3 from "classnames";
5596
5605
  import { jsx as jsx45, jsxs as jsxs8 } from "react/jsx-runtime";
5597
- var ComposerAttachmentRoot = withDefaults(attachment_exports.Root, {
5606
+ var Dialog = DialogPrimitive.Root;
5607
+ var DialogTrigger = DialogPrimitive.Trigger;
5608
+ var DialogPortal = DialogPrimitive.Portal;
5609
+ var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx45(
5610
+ DialogPrimitive.Overlay,
5611
+ {
5612
+ ref,
5613
+ className: classNames3("aui-dialog-overlay", className),
5614
+ ...props
5615
+ }
5616
+ ));
5617
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
5618
+ var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs8(DialogPortal, { children: [
5619
+ /* @__PURE__ */ jsx45(DialogOverlay, {}),
5620
+ /* @__PURE__ */ jsx45(
5621
+ DialogPrimitive.Content,
5622
+ {
5623
+ ref,
5624
+ className: classNames3("aui-dialog-content", className),
5625
+ ...props,
5626
+ children
5627
+ }
5628
+ )
5629
+ ] }));
5630
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
5631
+
5632
+ // src/ui/attachment.tsx
5633
+ import { AvatarFallback as AvatarFallback2 } from "@radix-ui/react-avatar";
5634
+ import { jsx as jsx46, jsxs as jsxs9 } from "react/jsx-runtime";
5635
+ var AttachmentRoot = withDefaults(attachment_exports.Root, {
5598
5636
  className: "aui-attachment-root"
5599
5637
  });
5600
- ComposerAttachmentRoot.displayName = "ComposerAttachmentRoot";
5601
- var ComposerAttachment2 = () => {
5638
+ AttachmentRoot.displayName = "AttachmentRoot";
5639
+ var useFileSrc = (file) => {
5640
+ const [src, setSrc] = useState14(void 0);
5641
+ useEffect15(() => {
5642
+ if (!file) {
5643
+ setSrc(void 0);
5644
+ return;
5645
+ }
5646
+ const objectUrl = URL.createObjectURL(file);
5647
+ setSrc(objectUrl);
5648
+ return () => {
5649
+ URL.revokeObjectURL(objectUrl);
5650
+ };
5651
+ }, [file]);
5652
+ return src;
5653
+ };
5654
+ var useAttachmentSrc = () => {
5655
+ const { file, src } = useAttachment((a) => {
5656
+ if (a.type !== "image") return {};
5657
+ if (a.file) return { file: a.file };
5658
+ const src2 = a.content?.filter((c) => c.type === "image")[0]?.image;
5659
+ if (!src2) return {};
5660
+ return { src: src2 };
5661
+ });
5662
+ return useFileSrc(file) ?? src;
5663
+ };
5664
+ var AttachmentPreview = ({ src }) => {
5665
+ const [isLoaded, setIsLoaded] = useState14(false);
5666
+ return (
5667
+ // eslint-disable-next-line @next/next/no-img-element
5668
+ /* @__PURE__ */ jsx46(
5669
+ "img",
5670
+ {
5671
+ src,
5672
+ style: {
5673
+ width: "auto",
5674
+ height: "auto",
5675
+ maxWidth: "75dvh",
5676
+ maxHeight: "75dvh",
5677
+ display: isLoaded ? "block" : "none",
5678
+ overflow: "clip"
5679
+ },
5680
+ onLoad: () => setIsLoaded(true),
5681
+ alt: "Image Preview"
5682
+ }
5683
+ )
5684
+ );
5685
+ };
5686
+ var AttachmentPreviewDialog = ({ children }) => {
5687
+ const src = useAttachmentSrc();
5688
+ if (!src) return children;
5689
+ return /* @__PURE__ */ jsxs9(Dialog, { children: [
5690
+ /* @__PURE__ */ jsx46(DialogTrigger, { className: "aui-attachment-preview-trigger", asChild: true, children }),
5691
+ /* @__PURE__ */ jsx46(DialogContent, { children: /* @__PURE__ */ jsx46(AttachmentPreview, { src }) })
5692
+ ] });
5693
+ };
5694
+ var AttachmentThumb = () => {
5695
+ const isImage = useAttachment((a) => a.type === "image");
5696
+ const src = useAttachmentSrc();
5697
+ return /* @__PURE__ */ jsxs9(AvatarRoot, { className: "aui-attachment-thumb", children: [
5698
+ /* @__PURE__ */ jsx46(AvatarFallback2, { delayMs: isImage ? 200 : 0, children: /* @__PURE__ */ jsx46(FileIcon, {}) }),
5699
+ /* @__PURE__ */ jsx46(AvatarImage, { src })
5700
+ ] });
5701
+ };
5702
+ var Attachment = () => {
5703
+ const canRemove = useAttachment((a) => a.source !== "message");
5602
5704
  const typeLabel = useAttachment((a) => {
5603
5705
  const type = a.type;
5604
5706
  switch (type) {
@@ -5613,46 +5715,46 @@ var ComposerAttachment2 = () => {
5613
5715
  throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
5614
5716
  }
5615
5717
  });
5616
- return /* @__PURE__ */ jsxs8(ComposerAttachmentRoot, { children: [
5617
- /* @__PURE__ */ jsx45(attachment_exports.unstable_Thumb, { className: "aui-attachment-thumb" }),
5618
- /* @__PURE__ */ jsxs8("div", { className: "aui-attachment-text", children: [
5619
- /* @__PURE__ */ jsx45("p", { className: "aui-attachment-name", children: /* @__PURE__ */ jsx45(attachment_exports.Name, {}) }),
5620
- /* @__PURE__ */ jsx45("p", { className: "aui-attachment-type", children: typeLabel })
5621
- ] }),
5622
- /* @__PURE__ */ jsx45(ComposerAttachmentRemove, {})
5718
+ return /* @__PURE__ */ jsxs9(Tooltip, { children: [
5719
+ /* @__PURE__ */ jsx46(AttachmentPreviewDialog, { children: /* @__PURE__ */ jsx46(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(AttachmentRoot, { children: [
5720
+ /* @__PURE__ */ jsx46(AttachmentThumb, {}),
5721
+ /* @__PURE__ */ jsxs9("div", { className: "aui-attachment-text", children: [
5722
+ /* @__PURE__ */ jsx46("p", { className: "aui-attachment-name", children: /* @__PURE__ */ jsx46(attachment_exports.Name, {}) }),
5723
+ /* @__PURE__ */ jsx46("p", { className: "aui-attachment-type", children: typeLabel })
5724
+ ] }),
5725
+ canRemove && /* @__PURE__ */ jsx46(AttachmentRemove, {})
5726
+ ] }) }) }),
5727
+ /* @__PURE__ */ jsx46(TooltipContent, { side: "top", children: /* @__PURE__ */ jsx46(attachment_exports.Name, {}) })
5623
5728
  ] });
5624
5729
  };
5625
- ComposerAttachment2.displayName = "ComposerAttachment";
5626
- var ComposerAttachmentRemove = forwardRef27((props, ref) => {
5730
+ Attachment.displayName = "Attachment";
5731
+ var AttachmentRemove = forwardRef28((props, ref) => {
5627
5732
  const {
5628
5733
  strings: {
5629
5734
  composer: { removeAttachment: { tooltip = "Remove file" } = {} } = {}
5630
5735
  } = {}
5631
5736
  } = useThreadConfig();
5632
- return /* @__PURE__ */ jsx45(attachment_exports.Remove, { asChild: true, children: /* @__PURE__ */ jsx45(
5737
+ return /* @__PURE__ */ jsx46(attachment_exports.Remove, { asChild: true, children: /* @__PURE__ */ jsx46(
5633
5738
  TooltipIconButton,
5634
5739
  {
5635
5740
  tooltip,
5636
- className: "aui-composer-attachment-remove",
5741
+ className: "aui-attachment-remove",
5637
5742
  side: "top",
5638
5743
  ...props,
5639
5744
  ref,
5640
- children: props.children ?? /* @__PURE__ */ jsx45(CircleXIcon, {})
5745
+ children: props.children ?? /* @__PURE__ */ jsx46(CircleXIcon, {})
5641
5746
  }
5642
5747
  ) });
5643
5748
  });
5644
- ComposerAttachmentRemove.displayName = "ComposerAttachmentRemove";
5749
+ AttachmentRemove.displayName = "AttachmentRemove";
5645
5750
  var exports5 = {
5646
- Root: ComposerAttachmentRoot,
5647
- Remove: ComposerAttachmentRemove
5751
+ Root: AttachmentRoot,
5752
+ Remove: AttachmentRemove
5648
5753
  };
5649
- var composer_attachment_default = Object.assign(
5650
- ComposerAttachment2,
5651
- exports5
5652
- );
5754
+ var attachment_default = Object.assign(Attachment, exports5);
5653
5755
 
5654
5756
  // src/ui/composer.tsx
5655
- import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs9 } from "react/jsx-runtime";
5757
+ import { Fragment as Fragment6, jsx as jsx47, jsxs as jsxs10 } from "react/jsx-runtime";
5656
5758
  var useAllowAttachments = (ensureCapability = false) => {
5657
5759
  const { composer: { allowAttachments = true } = {} } = useThreadConfig();
5658
5760
  const attachmentsSupported = useThread((t) => t.capabilities.attachments);
@@ -5660,11 +5762,11 @@ var useAllowAttachments = (ensureCapability = false) => {
5660
5762
  };
5661
5763
  var Composer = () => {
5662
5764
  const allowAttachments = useAllowAttachments(true);
5663
- return /* @__PURE__ */ jsxs9(ComposerRoot, { children: [
5664
- allowAttachments && /* @__PURE__ */ jsx46(ComposerAttachments, {}),
5665
- allowAttachments && /* @__PURE__ */ jsx46(ComposerAddAttachment, {}),
5666
- /* @__PURE__ */ jsx46(ComposerInput, { autoFocus: true }),
5667
- /* @__PURE__ */ jsx46(ComposerAction, {})
5765
+ return /* @__PURE__ */ jsxs10(ComposerRoot, { children: [
5766
+ allowAttachments && /* @__PURE__ */ jsx47(ComposerAttachments, {}),
5767
+ allowAttachments && /* @__PURE__ */ jsx47(ComposerAddAttachment, {}),
5768
+ /* @__PURE__ */ jsx47(ComposerInput, { autoFocus: true }),
5769
+ /* @__PURE__ */ jsx47(ComposerAction, {})
5668
5770
  ] });
5669
5771
  };
5670
5772
  Composer.displayName = "Composer";
@@ -5677,14 +5779,14 @@ var ComposerInputStyled = withDefaults(composer_exports.Input, {
5677
5779
  autoFocus: true,
5678
5780
  className: "aui-composer-input"
5679
5781
  });
5680
- var ComposerInput = forwardRef28(
5782
+ var ComposerInput = forwardRef29(
5681
5783
  (props, ref) => {
5682
5784
  const {
5683
5785
  strings: {
5684
5786
  composer: { input: { placeholder = "Write a message..." } = {} } = {}
5685
5787
  } = {}
5686
5788
  } = useThreadConfig();
5687
- return /* @__PURE__ */ jsx46(ComposerInputStyled, { placeholder, ...props, ref });
5789
+ return /* @__PURE__ */ jsx47(ComposerInputStyled, { placeholder, ...props, ref });
5688
5790
  }
5689
5791
  );
5690
5792
  ComposerInput.displayName = "ComposerInput";
@@ -5692,12 +5794,12 @@ var ComposerAttachmentsContainer = withDefaults("div", {
5692
5794
  className: "aui-composer-attachments"
5693
5795
  });
5694
5796
  var ComposerAttachments = ({ components }) => {
5695
- return /* @__PURE__ */ jsx46(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx46(
5797
+ return /* @__PURE__ */ jsx47(ComposerAttachmentsContainer, { children: /* @__PURE__ */ jsx47(
5696
5798
  composer_exports.Attachments,
5697
5799
  {
5698
5800
  components: {
5699
5801
  ...components,
5700
- Attachment: components?.Attachment ?? composer_attachment_default
5802
+ Attachment: components?.Attachment ?? attachment_default
5701
5803
  }
5702
5804
  }
5703
5805
  ) });
@@ -5706,21 +5808,21 @@ var ComposerAttachButton = withDefaults(TooltipIconButton, {
5706
5808
  variant: "default",
5707
5809
  className: "aui-composer-attach"
5708
5810
  });
5709
- var ComposerAddAttachment = forwardRef28((props, ref) => {
5811
+ var ComposerAddAttachment = forwardRef29((props, ref) => {
5710
5812
  const {
5711
5813
  strings: {
5712
5814
  composer: { addAttachment: { tooltip = "Attach file" } = {} } = {}
5713
5815
  } = {}
5714
5816
  } = useThreadConfig();
5715
5817
  const allowAttachments = useAllowAttachments();
5716
- return /* @__PURE__ */ jsx46(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx46(
5818
+ return /* @__PURE__ */ jsx47(composer_exports.AddAttachment, { disabled: !allowAttachments, asChild: true, children: /* @__PURE__ */ jsx47(
5717
5819
  ComposerAttachButton,
5718
5820
  {
5719
5821
  tooltip,
5720
5822
  variant: "ghost",
5721
5823
  ...props,
5722
5824
  ref,
5723
- children: props.children ?? /* @__PURE__ */ jsx46(PaperclipIcon, {})
5825
+ children: props.children ?? /* @__PURE__ */ jsx47(PaperclipIcon, {})
5724
5826
  }
5725
5827
  ) });
5726
5828
  });
@@ -5731,10 +5833,10 @@ var useAllowCancel = () => {
5731
5833
  };
5732
5834
  var ComposerAction = () => {
5733
5835
  const allowCancel = useAllowCancel();
5734
- if (!allowCancel) return /* @__PURE__ */ jsx46(ComposerSend, {});
5735
- return /* @__PURE__ */ jsxs9(Fragment6, { children: [
5736
- /* @__PURE__ */ jsx46(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx46(ComposerSend, {}) }),
5737
- /* @__PURE__ */ jsx46(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx46(ComposerCancel, {}) })
5836
+ if (!allowCancel) return /* @__PURE__ */ jsx47(ComposerSend, {});
5837
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
5838
+ /* @__PURE__ */ jsx47(thread_exports.If, { running: false, children: /* @__PURE__ */ jsx47(ComposerSend, {}) }),
5839
+ /* @__PURE__ */ jsx47(thread_exports.If, { running: true, children: /* @__PURE__ */ jsx47(ComposerCancel, {}) })
5738
5840
  ] });
5739
5841
  };
5740
5842
  ComposerAction.displayName = "ComposerAction";
@@ -5742,12 +5844,12 @@ var ComposerSendButton = withDefaults(TooltipIconButton, {
5742
5844
  variant: "default",
5743
5845
  className: "aui-composer-send"
5744
5846
  });
5745
- var ComposerSend = forwardRef28(
5847
+ var ComposerSend = forwardRef29(
5746
5848
  (props, ref) => {
5747
5849
  const {
5748
5850
  strings: { composer: { send: { tooltip = "Send" } = {} } = {} } = {}
5749
5851
  } = useThreadConfig();
5750
- return /* @__PURE__ */ jsx46(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(SendHorizontalIcon, {}) }) });
5852
+ return /* @__PURE__ */ jsx47(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx47(ComposerSendButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx47(SendHorizontalIcon, {}) }) });
5751
5853
  }
5752
5854
  );
5753
5855
  ComposerSend.displayName = "ComposerSend";
@@ -5755,12 +5857,12 @@ var ComposerCancelButton = withDefaults(TooltipIconButton, {
5755
5857
  variant: "default",
5756
5858
  className: "aui-composer-cancel"
5757
5859
  });
5758
- var ComposerCancel = forwardRef28(
5860
+ var ComposerCancel = forwardRef29(
5759
5861
  (props, ref) => {
5760
5862
  const {
5761
5863
  strings: { composer: { cancel: { tooltip = "Cancel" } = {} } = {} } = {}
5762
5864
  } = useThreadConfig();
5763
- return /* @__PURE__ */ jsx46(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx46(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx46(CircleStopIcon, {}) }) });
5865
+ return /* @__PURE__ */ jsx47(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx47(ComposerCancelButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx47(CircleStopIcon, {}) }) });
5764
5866
  }
5765
5867
  );
5766
5868
  ComposerCancel.displayName = "ComposerCancel";
@@ -5776,15 +5878,15 @@ var exports6 = {
5776
5878
  var composer_default = Object.assign(Composer, exports6);
5777
5879
 
5778
5880
  // src/ui/thread-welcome.tsx
5779
- import { forwardRef as forwardRef29 } from "react";
5780
- import { jsx as jsx47, jsxs as jsxs10 } from "react/jsx-runtime";
5881
+ import { forwardRef as forwardRef30 } from "react";
5882
+ import { jsx as jsx48, jsxs as jsxs11 } from "react/jsx-runtime";
5781
5883
  var ThreadWelcome = () => {
5782
- return /* @__PURE__ */ jsxs10(ThreadWelcomeRoot, { children: [
5783
- /* @__PURE__ */ jsxs10(ThreadWelcomeCenter, { children: [
5784
- /* @__PURE__ */ jsx47(ThreadWelcomeAvatar, {}),
5785
- /* @__PURE__ */ jsx47(ThreadWelcomeMessage, {})
5884
+ return /* @__PURE__ */ jsxs11(ThreadWelcomeRoot, { children: [
5885
+ /* @__PURE__ */ jsxs11(ThreadWelcomeCenter, { children: [
5886
+ /* @__PURE__ */ jsx48(ThreadWelcomeAvatar, {}),
5887
+ /* @__PURE__ */ jsx48(ThreadWelcomeMessage, {})
5786
5888
  ] }),
5787
- /* @__PURE__ */ jsx47(ThreadWelcomeSuggestions, {})
5889
+ /* @__PURE__ */ jsx48(ThreadWelcomeSuggestions, {})
5788
5890
  ] });
5789
5891
  };
5790
5892
  ThreadWelcome.displayName = "ThreadWelcome";
@@ -5794,20 +5896,20 @@ var ThreadWelcomeRootStyled = withDefaults("div", {
5794
5896
  var ThreadWelcomeCenter = withDefaults("div", {
5795
5897
  className: "aui-thread-welcome-center"
5796
5898
  });
5797
- var ThreadWelcomeRoot = forwardRef29((props, ref) => {
5798
- return /* @__PURE__ */ jsx47(thread_exports.Empty, { children: /* @__PURE__ */ jsx47(ThreadWelcomeRootStyled, { ...props, ref }) });
5899
+ var ThreadWelcomeRoot = forwardRef30((props, ref) => {
5900
+ return /* @__PURE__ */ jsx48(thread_exports.Empty, { children: /* @__PURE__ */ jsx48(ThreadWelcomeRootStyled, { ...props, ref }) });
5799
5901
  });
5800
5902
  ThreadWelcomeRoot.displayName = "ThreadWelcomeRoot";
5801
5903
  var ThreadWelcomeAvatar = () => {
5802
5904
  const { assistantAvatar: avatar = { fallback: "A" } } = useThreadConfig();
5803
- return /* @__PURE__ */ jsx47(Avatar, { ...avatar });
5905
+ return /* @__PURE__ */ jsx48(Avatar, { ...avatar });
5804
5906
  };
5805
5907
  var ThreadWelcomeMessageStyled = withDefaults("p", {
5806
5908
  className: "aui-thread-welcome-message"
5807
5909
  });
5808
- var ThreadWelcomeMessage = forwardRef29(({ message: messageProp, ...rest }, ref) => {
5910
+ var ThreadWelcomeMessage = forwardRef30(({ message: messageProp, ...rest }, ref) => {
5809
5911
  const { welcome: { message = "How can I help you today?" } = {} } = useThreadConfig();
5810
- return /* @__PURE__ */ jsx47(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
5912
+ return /* @__PURE__ */ jsx48(ThreadWelcomeMessageStyled, { ...rest, ref, children: messageProp ?? message });
5811
5913
  });
5812
5914
  ThreadWelcomeMessage.displayName = "ThreadWelcomeMessage";
5813
5915
  var ThreadWelcomeSuggestionContainer = withDefaults("div", {
@@ -5819,15 +5921,15 @@ var ThreadWelcomeSuggestionStyled = withDefaults(thread_exports.Suggestion, {
5819
5921
  var ThreadWelcomeSuggestion = ({
5820
5922
  suggestion: { text, prompt }
5821
5923
  }) => {
5822
- return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx47("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
5924
+ return /* @__PURE__ */ jsx48(ThreadWelcomeSuggestionStyled, { prompt, method: "replace", autoSend: true, children: /* @__PURE__ */ jsx48("span", { className: "aui-thread-welcome-suggestion-text", children: text ?? prompt }) });
5823
5925
  };
5824
5926
  var ThreadWelcomeSuggestions = () => {
5825
5927
  const suggestions2 = useThread((t) => t.suggestions);
5826
5928
  const { welcome: { suggestions } = {} } = useThreadConfig();
5827
5929
  const finalSuggestions = suggestions2.length ? suggestions2 : suggestions;
5828
- return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
5930
+ return /* @__PURE__ */ jsx48(ThreadWelcomeSuggestionContainer, { children: finalSuggestions?.map((suggestion, idx) => {
5829
5931
  const key = `${suggestion.prompt}-${idx}`;
5830
- return /* @__PURE__ */ jsx47(ThreadWelcomeSuggestion, { suggestion }, key);
5932
+ return /* @__PURE__ */ jsx48(ThreadWelcomeSuggestion, { suggestion }, key);
5831
5933
  }) });
5832
5934
  };
5833
5935
  ThreadWelcomeSuggestions.displayName = "ThreadWelcomeSuggestions";
@@ -5842,12 +5944,12 @@ var exports7 = {
5842
5944
  var thread_welcome_default = Object.assign(ThreadWelcome, exports7);
5843
5945
 
5844
5946
  // src/ui/user-message.tsx
5845
- import { forwardRef as forwardRef31 } from "react";
5947
+ import { forwardRef as forwardRef32 } from "react";
5846
5948
 
5847
5949
  // src/ui/user-action-bar.tsx
5848
- import { forwardRef as forwardRef30 } from "react";
5950
+ import { forwardRef as forwardRef31 } from "react";
5849
5951
  import { PencilIcon } from "lucide-react";
5850
- import { jsx as jsx48 } from "react/jsx-runtime";
5952
+ import { jsx as jsx49 } from "react/jsx-runtime";
5851
5953
  var useAllowEdit = (ensureCapability = false) => {
5852
5954
  const { userMessage: { allowEdit = true } = {} } = useThreadConfig();
5853
5955
  const editSupported = useThread((t) => t.capabilities.edit);
@@ -5856,19 +5958,19 @@ var useAllowEdit = (ensureCapability = false) => {
5856
5958
  var UserActionBar = () => {
5857
5959
  const allowEdit = useAllowEdit(true);
5858
5960
  if (!allowEdit) return null;
5859
- return /* @__PURE__ */ jsx48(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx48(UserActionBarEdit, {}) });
5961
+ return /* @__PURE__ */ jsx49(UserActionBarRoot, { hideWhenRunning: true, autohide: "not-last", children: /* @__PURE__ */ jsx49(UserActionBarEdit, {}) });
5860
5962
  };
5861
5963
  UserActionBar.displayName = "UserActionBar";
5862
5964
  var UserActionBarRoot = withDefaults(actionBar_exports.Root, {
5863
5965
  className: "aui-user-action-bar-root"
5864
5966
  });
5865
5967
  UserActionBarRoot.displayName = "UserActionBarRoot";
5866
- var UserActionBarEdit = forwardRef30((props, ref) => {
5968
+ var UserActionBarEdit = forwardRef31((props, ref) => {
5867
5969
  const {
5868
5970
  strings: { userMessage: { edit: { tooltip = "Edit" } = {} } = {} } = {}
5869
5971
  } = useThreadConfig();
5870
5972
  const allowEdit = useAllowEdit();
5871
- return /* @__PURE__ */ jsx48(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx48(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx48(PencilIcon, {}) }) });
5973
+ return /* @__PURE__ */ jsx49(actionBar_exports.Edit, { disabled: !allowEdit, asChild: true, children: /* @__PURE__ */ jsx49(TooltipIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx49(PencilIcon, {}) }) });
5872
5974
  });
5873
5975
  UserActionBarEdit.displayName = "UserActionBarEdit";
5874
5976
  var exports8 = {
@@ -5877,44 +5979,6 @@ var exports8 = {
5877
5979
  };
5878
5980
  var user_action_bar_default = Object.assign(UserActionBar, exports8);
5879
5981
 
5880
- // src/ui/user-message-attachment.tsx
5881
- import { jsx as jsx49, jsxs as jsxs11 } from "react/jsx-runtime";
5882
- var UserMessageAttachmentRoot = withDefaults(attachment_exports.Root, {
5883
- className: "aui-attachment-root"
5884
- });
5885
- UserMessageAttachmentRoot.displayName = "UserMessageAttachmentRoot";
5886
- var UserMessageAttachment = () => {
5887
- const typeLabel = useAttachment((a) => {
5888
- const type = a.type;
5889
- switch (type) {
5890
- case "image":
5891
- return "Image";
5892
- case "document":
5893
- return "Document";
5894
- case "file":
5895
- return "File";
5896
- default:
5897
- const _exhaustiveCheck = type;
5898
- throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
5899
- }
5900
- });
5901
- return /* @__PURE__ */ jsxs11(UserMessageAttachmentRoot, { children: [
5902
- /* @__PURE__ */ jsx49(attachment_exports.unstable_Thumb, { className: "aui-attachment-thumb" }),
5903
- /* @__PURE__ */ jsxs11("div", { className: "aui-attachment-text", children: [
5904
- /* @__PURE__ */ jsx49("p", { className: "aui-attachment-name", children: /* @__PURE__ */ jsx49(attachment_exports.Name, {}) }),
5905
- /* @__PURE__ */ jsx49("p", { className: "aui-attachment-type", children: typeLabel })
5906
- ] })
5907
- ] });
5908
- };
5909
- UserMessageAttachment.displayName = "UserMessageAttachment";
5910
- var exports9 = {
5911
- Root: UserMessageAttachmentRoot
5912
- };
5913
- var user_message_attachment_default = Object.assign(
5914
- UserMessageAttachment,
5915
- exports9
5916
- );
5917
-
5918
5982
  // src/ui/user-message.tsx
5919
5983
  import { jsx as jsx50, jsxs as jsxs12 } from "react/jsx-runtime";
5920
5984
  var UserMessage = () => {
@@ -5935,7 +5999,7 @@ UserMessageRoot.displayName = "UserMessageRoot";
5935
5999
  var UserMessageContentWrapper = withDefaults("div", {
5936
6000
  className: "aui-user-message-content"
5937
6001
  });
5938
- var UserMessageContent = forwardRef31(({ components, ...props }, ref) => {
6002
+ var UserMessageContent = forwardRef32(({ components, ...props }, ref) => {
5939
6003
  return /* @__PURE__ */ jsx50(UserMessageContentWrapper, { ...props, ref, children: /* @__PURE__ */ jsx50(
5940
6004
  message_exports.Content,
5941
6005
  {
@@ -5958,20 +6022,20 @@ var UserMessageAttachments = ({
5958
6022
  {
5959
6023
  components: {
5960
6024
  ...components,
5961
- Attachment: components?.Attachment ?? user_message_attachment_default
6025
+ Attachment: components?.Attachment ?? attachment_default
5962
6026
  }
5963
6027
  }
5964
6028
  ) }) });
5965
6029
  };
5966
- var exports10 = {
6030
+ var exports9 = {
5967
6031
  Root: UserMessageRoot,
5968
6032
  Content: UserMessageContent,
5969
6033
  Attachments: UserMessageAttachments
5970
6034
  };
5971
- var user_message_default = Object.assign(UserMessage, exports10);
6035
+ var user_message_default = Object.assign(UserMessage, exports9);
5972
6036
 
5973
6037
  // src/ui/edit-composer.tsx
5974
- import { forwardRef as forwardRef32 } from "react";
6038
+ import { forwardRef as forwardRef33 } from "react";
5975
6039
  import { jsx as jsx51, jsxs as jsxs13 } from "react/jsx-runtime";
5976
6040
  var EditComposer = () => {
5977
6041
  return /* @__PURE__ */ jsxs13(EditComposerRoot, { children: [
@@ -5995,28 +6059,28 @@ var EditComposerFooter = withDefaults("div", {
5995
6059
  className: "aui-edit-composer-footer"
5996
6060
  });
5997
6061
  EditComposerFooter.displayName = "EditComposerFooter";
5998
- var EditComposerCancel = forwardRef32((props, ref) => {
6062
+ var EditComposerCancel = forwardRef33((props, ref) => {
5999
6063
  const {
6000
6064
  strings: { editComposer: { cancel: { label = "Cancel" } = {} } = {} } = {}
6001
6065
  } = useThreadConfig();
6002
6066
  return /* @__PURE__ */ jsx51(composer_exports.Cancel, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { variant: "ghost", ...props, ref, children: props.children ?? label }) });
6003
6067
  });
6004
6068
  EditComposerCancel.displayName = "EditComposerCancel";
6005
- var EditComposerSend = forwardRef32((props, ref) => {
6069
+ var EditComposerSend = forwardRef33((props, ref) => {
6006
6070
  const {
6007
6071
  strings: { editComposer: { send: { label = "Send" } = {} } = {} } = {}
6008
6072
  } = useThreadConfig();
6009
6073
  return /* @__PURE__ */ jsx51(composer_exports.Send, { asChild: true, children: /* @__PURE__ */ jsx51(Button, { ...props, ref, children: props.children ?? label }) });
6010
6074
  });
6011
6075
  EditComposerSend.displayName = "EditComposerSend";
6012
- var exports11 = {
6076
+ var exports10 = {
6013
6077
  Root: EditComposerRoot,
6014
6078
  Input: EditComposerInput,
6015
6079
  Footer: EditComposerFooter,
6016
6080
  Cancel: EditComposerCancel,
6017
6081
  Send: EditComposerSend
6018
6082
  };
6019
- var edit_composer_default = Object.assign(EditComposer, exports11);
6083
+ var edit_composer_default = Object.assign(EditComposer, exports10);
6020
6084
 
6021
6085
  // src/ui/thread.tsx
6022
6086
  import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -6040,7 +6104,7 @@ var Thread = (config) => {
6040
6104
  var ThreadRootStyled = withDefaults(thread_exports.Root, {
6041
6105
  className: "aui-root aui-thread-root"
6042
6106
  });
6043
- var ThreadRoot = forwardRef33(
6107
+ var ThreadRoot = forwardRef34(
6044
6108
  ({ config, ...props }, ref) => {
6045
6109
  return /* @__PURE__ */ jsx52(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx52(ThreadRootStyled, { ...props, ref }) });
6046
6110
  }
@@ -6091,7 +6155,7 @@ var ThreadScrollToBottomIconButton = withDefaults(TooltipIconButton, {
6091
6155
  variant: "outline",
6092
6156
  className: "aui-thread-scroll-to-bottom"
6093
6157
  });
6094
- var ThreadScrollToBottom = forwardRef33((props, ref) => {
6158
+ var ThreadScrollToBottom = forwardRef34((props, ref) => {
6095
6159
  const {
6096
6160
  strings: {
6097
6161
  thread: { scrollToBottom: { tooltip = "Scroll to bottom" } = {} } = {}
@@ -6100,7 +6164,7 @@ var ThreadScrollToBottom = forwardRef33((props, ref) => {
6100
6164
  return /* @__PURE__ */ jsx52(thread_exports.ScrollToBottom, { asChild: true, children: /* @__PURE__ */ jsx52(ThreadScrollToBottomIconButton, { tooltip, ...props, ref, children: props.children ?? /* @__PURE__ */ jsx52(ArrowDownIcon, {}) }) });
6101
6165
  });
6102
6166
  ThreadScrollToBottom.displayName = "ThreadScrollToBottom";
6103
- var exports12 = {
6167
+ var exports11 = {
6104
6168
  Root: ThreadRoot,
6105
6169
  Viewport: ThreadViewport,
6106
6170
  Messages: ThreadMessages,
@@ -6108,7 +6172,7 @@ var exports12 = {
6108
6172
  ScrollToBottom: ThreadScrollToBottom,
6109
6173
  ViewportFooter: ThreadViewportFooter
6110
6174
  };
6111
- var thread_default = Object.assign(Thread, exports12);
6175
+ var thread_default = Object.assign(Thread, exports11);
6112
6176
 
6113
6177
  // src/ui/assistant-modal.tsx
6114
6178
  import { Fragment as Fragment8, jsx as jsx53, jsxs as jsxs15 } from "react/jsx-runtime";
@@ -6126,7 +6190,7 @@ var AssistantModalRoot = ({
6126
6190
  return /* @__PURE__ */ jsx53(ThreadConfigProvider, { config, children: /* @__PURE__ */ jsx53(assistantModal_exports.Root, { ...props }) });
6127
6191
  };
6128
6192
  AssistantModalRoot.displayName = "AssistantModalRoot";
6129
- var AssistantModalTrigger = forwardRef34((props, ref) => {
6193
+ var AssistantModalTrigger = forwardRef35((props, ref) => {
6130
6194
  return /* @__PURE__ */ jsx53(AssistantModalAnchor, { children: /* @__PURE__ */ jsx53(assistantModal_exports.Trigger, { asChild: true, children: /* @__PURE__ */ jsx53(AssistantModalButton, { ...props, ref }) }) });
6131
6195
  });
6132
6196
  AssistantModalTrigger.displayName = "AssistantModalTrigger";
@@ -6138,7 +6202,7 @@ var ModalButtonStyled = withDefaults(TooltipIconButton, {
6138
6202
  variant: "default",
6139
6203
  className: "aui-modal-button"
6140
6204
  });
6141
- var AssistantModalButton = forwardRef34(({ "data-state": state, ...rest }, ref) => {
6205
+ var AssistantModalButton = forwardRef35(({ "data-state": state, ...rest }, ref) => {
6142
6206
  const {
6143
6207
  strings: {
6144
6208
  assistantModal: {
@@ -6185,14 +6249,14 @@ var AssistantModalContent = withDefaults(assistantModal_exports.Content, {
6185
6249
  sideOffset: 16
6186
6250
  });
6187
6251
  AssistantModalContent.displayName = "AssistantModalContent";
6188
- var exports13 = {
6252
+ var exports12 = {
6189
6253
  Root: AssistantModalRoot,
6190
6254
  Trigger: AssistantModalTrigger,
6191
6255
  Content: AssistantModalContent,
6192
6256
  Button: AssistantModalButton,
6193
6257
  Anchor: AssistantModalAnchor
6194
6258
  };
6195
- var assistant_modal_default = Object.assign(AssistantModal, exports13);
6259
+ var assistant_modal_default = Object.assign(AssistantModal, exports12);
6196
6260
  export {
6197
6261
  actionBar_exports as ActionBarPrimitive,
6198
6262
  assistant_action_bar_default as AssistantActionBar,
@@ -6201,10 +6265,11 @@ export {
6201
6265
  assistantModal_exports as AssistantModalPrimitive,
6202
6266
  AssistantRuntimeProvider,
6203
6267
  attachment_exports as AttachmentPrimitive,
6268
+ attachment_default as AttachmentUI,
6204
6269
  branch_picker_default as BranchPicker,
6205
6270
  branchPicker_exports as BranchPickerPrimitive,
6206
6271
  composer_default as Composer,
6207
- composer_attachment_default as ComposerAttachment,
6272
+ attachment_default as ComposerAttachment,
6208
6273
  composer_exports as ComposerPrimitive,
6209
6274
  CompositeAttachmentAdapter,
6210
6275
  content_part_default as ContentPart,
@@ -6222,7 +6287,7 @@ export {
6222
6287
  thread_welcome_default as ThreadWelcome,
6223
6288
  user_action_bar_default as UserActionBar,
6224
6289
  user_message_default as UserMessage,
6225
- user_message_attachment_default as UserMessageAttachment,
6290
+ attachment_default as UserMessageAttachment,
6226
6291
  WebSpeechSynthesisAdapter,
6227
6292
  fromCoreMessage,
6228
6293
  fromCoreMessages,