reachat 3.0.0 → 3.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.
@@ -11,8 +11,8 @@
11
11
  }
12
12
  })();
13
13
  (function(global, factory) {
14
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@tiptap/react"), require("@floating-ui/dom"), require("@tiptap/extension-document"), require("@tiptap/extension-paragraph"), require("@tiptap/extension-text"), require("@tiptap/extension-hard-break"), require("@tiptap/extension-placeholder"), require("@tiptap/extension-mention"), require("@radix-ui/react-slot"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("rehype-raw"), require("reaviz"), require("mdast-util-find-and-replace"), require("lodash/debounce.js"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@tiptap/react", "@floating-ui/dom", "@tiptap/extension-document", "@tiptap/extension-paragraph", "@tiptap/extension-text", "@tiptap/extension-hard-break", "@tiptap/extension-placeholder", "@tiptap/extension-mention", "@radix-ui/react-slot", "react-markdown", "react-syntax-highlighter", "rehype-katex", "rehype-raw", "reaviz", "mdast-util-find-and-replace", "lodash/debounce.js", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react$1, global.react, global.dom, global.Document, global.Paragraph, global.Text, global.HardBreak, global.Placeholder, global.Mention, global.reactSlot, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.rehypeRaw, global.reaviz, global.mdastUtilFindAndReplace, global.debounce, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$2, global.zod));
15
- })(this, function(exports2, jsxRuntime, reablocks, React, react$1, react, dom, Document, Paragraph, Text, HardBreak, Placeholder, Mention, reactSlot, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, rehypeRaw, reaviz, mdastUtilFindAndReplace, debounce, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$2, zod) {
14
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("reablocks"), require("react"), require("motion/react"), require("@tiptap/react"), require("@floating-ui/dom"), require("@tiptap/extension-document"), require("@tiptap/extension-paragraph"), require("@tiptap/extension-text"), require("@tiptap/extension-hard-break"), require("@tiptap/extension-placeholder"), require("@tiptap/extension-mention"), require("@radix-ui/react-slot"), require("react-markdown"), require("rehype-katex"), require("rehype-raw"), require("react-syntax-highlighter"), require("reaviz"), require("mdast-util-find-and-replace"), require("lodash/debounce.js"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns"), require("@floating-ui/react"), require("zod")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "reablocks", "react", "motion/react", "@tiptap/react", "@floating-ui/dom", "@tiptap/extension-document", "@tiptap/extension-paragraph", "@tiptap/extension-text", "@tiptap/extension-hard-break", "@tiptap/extension-placeholder", "@tiptap/extension-mention", "@radix-ui/react-slot", "react-markdown", "rehype-katex", "rehype-raw", "react-syntax-highlighter", "reaviz", "mdast-util-find-and-replace", "lodash/debounce.js", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns", "@floating-ui/react", "zod"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.reablocks, global.React, global.react$1, global.react, global.dom, global.Document, global.Paragraph, global.Text, global.HardBreak, global.Placeholder, global.Mention, global.reactSlot, global.ReactMarkdown, global.rehypeKatex, global.rehypeRaw, global.reactSyntaxHighlighter, global.reaviz, global.mdastUtilFindAndReplace, global.debounce, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns, global.react$2, global.zod));
15
+ })(this, (function(exports2, jsxRuntime, reablocks, React, react$1, react, dom, Document, Paragraph, Text, HardBreak, Placeholder, Mention, reactSlot, ReactMarkdown, rehypeKatex, rehypeRaw, reactSyntaxHighlighter, reaviz, mdastUtilFindAndReplace, debounce, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns, react$2, zod) {
16
16
  "use strict";
17
17
  function _interopNamespaceDefault(e) {
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -40,6 +40,7 @@
40
40
  const SvgPaperclip = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-paperclip", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }));
41
41
  const FileInput = ({
42
42
  allowedFiles,
43
+ multiple,
43
44
  onFileUpload,
44
45
  isLoading,
45
46
  disabled,
@@ -55,6 +56,7 @@
55
56
  ref: fileInputRef,
56
57
  className: "hidden",
57
58
  accept: allowedFiles.join(","),
59
+ multiple,
58
60
  onChange: (e) => {
59
61
  onFileUpload(e);
60
62
  if (fileInputRef.current) {
@@ -70,10 +72,7 @@
70
72
  variant: "text",
71
73
  disabled: isLoading || disabled,
72
74
  className: reablocks.cn(theme.input.upload),
73
- onClick: () => {
74
- var _a;
75
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
76
- },
75
+ onClick: () => fileInputRef.current?.click(),
77
76
  children: attachIcon
78
77
  }
79
78
  )
@@ -188,17 +187,25 @@
188
187
  }
189
188
  },
190
189
  markdown: {
190
+ hr: "my-4 border-t border-stroke-neutral-4",
191
191
  copy: "sticky py-1 [&>svg]:w-4 [&>svg]:h-4 opacity-50",
192
192
  p: "mb-2",
193
- a: "text-blue-400 underline",
193
+ a: "text-buttons-colors-link-primary-text-resting underline",
194
194
  table: "table-auto w-full m-2",
195
- th: "px-4 py-2 text-left font-bold border-b border-gray-500",
195
+ th: "px-4 py-2 text-left font-bold border-b border-stroke-neutral-4",
196
196
  td: "px-4 py-2",
197
197
  code: "m-2 rounded-b relative",
198
- toolbar: "text-xs dark:bg-gray-700/50 flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gray-200 ",
198
+ inlineCode: "bg-gradient-neutral-200 p-1 rounded",
199
+ toolbar: "text-xs flex items-center justify-between px-2 py-1 rounded-t sticky top-0 backdrop-blur-md bg-gradient-neutral-500/50",
199
200
  li: "mb-2 ml-6",
200
201
  ul: "mb-4 list-disc",
201
- ol: "mb-4 list-decimal"
202
+ ol: "mb-4 list-decimal",
203
+ h1: "text-4xl font-bold mb-4 mt-6",
204
+ h2: "text-3xl font-bold mb-3 mt-5",
205
+ h3: "text-2xl font-bold mb-3 mt-4",
206
+ h4: "text-xl font-bold mb-2 mt-3",
207
+ h5: "text-lg font-bold mb-2 mt-2",
208
+ h6: "text-base font-bold mb-2 mt-2"
202
209
  },
203
210
  footer: {
204
211
  base: "mt-3 flex gap-1.5",
@@ -328,18 +335,16 @@
328
335
  const POPUP_STYLE = { zIndex: 9999 };
329
336
  const MentionList = React.forwardRef(
330
337
  ({ items, command, triggerChar, config, query }, ref) => {
331
- var _a;
332
338
  const [selectedIndex, setSelectedIndex] = React.useState(0);
333
339
  const itemRefs = React.useRef([]);
334
340
  const { theme } = React.useContext(ChatContext);
335
- const popupTheme = ((_a = theme == null ? void 0 : theme.input) == null ? void 0 : _a.popup) || chatTheme.input.popup;
341
+ const popupTheme = theme?.input?.popup || chatTheme.input.popup;
336
342
  React.useEffect(() => {
337
343
  setSelectedIndex(0);
338
344
  }, [items]);
339
345
  React.useEffect(() => {
340
- var _a2;
341
346
  if (itemRefs.current[selectedIndex]) {
342
- (_a2 = itemRefs.current[selectedIndex]) == null ? void 0 : _a2.scrollIntoView({
347
+ itemRefs.current[selectedIndex]?.scrollIntoView({
343
348
  block: "nearest",
344
349
  behavior: "smooth"
345
350
  });
@@ -470,10 +475,7 @@
470
475
  if (!query) return config.items.slice(0, config.maxResults || 10);
471
476
  const lowerQuery = query.toLowerCase();
472
477
  return config.items.filter(
473
- (item) => {
474
- var _a;
475
- return item.label.toLowerCase().includes(lowerQuery) || ((_a = item.description) == null ? void 0 : _a.toLowerCase().includes(lowerQuery));
476
- }
478
+ (item) => item.label.toLowerCase().includes(lowerQuery) || item.description?.toLowerCase().includes(lowerQuery)
477
479
  ).slice(0, config.maxResults || 10);
478
480
  },
479
481
  // Render callbacks for managing the popup lifecycle
@@ -500,7 +502,7 @@
500
502
  },
501
503
  // Called when query or items change
502
504
  onUpdate: (props) => {
503
- component == null ? void 0 : component.updateProps({
505
+ component?.updateProps({
504
506
  ...props,
505
507
  triggerChar,
506
508
  config
@@ -508,25 +510,23 @@
508
510
  if (!props.clientRect) {
509
511
  return;
510
512
  }
511
- if (component == null ? void 0 : component.element) {
513
+ if (component?.element) {
512
514
  updatePopupPosition(props.editor, component.element);
513
515
  }
514
516
  },
515
517
  // Handle keyboard navigation (Escape closes popup)
516
518
  onKeyDown: (props) => {
517
- var _a;
518
519
  if (props.event.key === "Escape") {
519
- component == null ? void 0 : component.destroy();
520
+ component?.destroy();
520
521
  return true;
521
522
  }
522
- return ((_a = component == null ? void 0 : component.ref) == null ? void 0 : _a.onKeyDown(props)) ?? false;
523
+ return component?.ref?.onKeyDown(props) ?? false;
523
524
  },
524
525
  // Cleanup when suggestion is dismissed
525
526
  onExit: () => {
526
- var _a;
527
527
  suggestionActiveRef.current = false;
528
- (_a = component == null ? void 0 : component.element) == null ? void 0 : _a.remove();
529
- component == null ? void 0 : component.destroy();
528
+ component?.element?.remove();
529
+ component?.destroy();
530
530
  }
531
531
  };
532
532
  }
@@ -546,12 +546,10 @@
546
546
  onSubmit,
547
547
  onChange
548
548
  }, ref) => {
549
- var _a, _b, _c, _d;
550
549
  const { theme } = React.useContext(ChatContext);
551
550
  const containerRef = React.useRef(null);
552
551
  const suggestionActiveRef = React.useRef(false);
553
552
  const extensions = React.useMemo(() => {
554
- var _a2, _b2, _c2, _d2, _e, _f, _g, _h;
555
553
  const exts = [
556
554
  Document,
557
555
  Paragraph.configure({
@@ -570,7 +568,7 @@
570
568
  exts.push(
571
569
  Mention.configure({
572
570
  HTMLAttributes: {
573
- class: reablocks.cn((_b2 = (_a2 = theme == null ? void 0 : theme.input) == null ? void 0 : _a2.tag) == null ? void 0 : _b2.base, (_d2 = (_c2 = theme == null ? void 0 : theme.input) == null ? void 0 : _c2.tag) == null ? void 0 : _d2.mention)
571
+ class: reablocks.cn(theme?.input?.tag?.base, theme?.input?.tag?.mention)
574
572
  },
575
573
  suggestion: createSuggestionConfig(
576
574
  mentions,
@@ -586,7 +584,7 @@
586
584
  exts.push(
587
585
  Mention.configure({
588
586
  HTMLAttributes: {
589
- class: reablocks.cn((_f = (_e = theme == null ? void 0 : theme.input) == null ? void 0 : _e.tag) == null ? void 0 : _f.base, (_h = (_g = theme == null ? void 0 : theme.input) == null ? void 0 : _g.tag) == null ? void 0 : _h.command)
587
+ class: reablocks.cn(theme?.input?.tag?.base, theme?.input?.tag?.command)
590
588
  },
591
589
  suggestion: createSuggestionConfig(
592
590
  commands,
@@ -607,13 +605,13 @@
607
605
  immediatelyRender: false,
608
606
  onUpdate: ({ editor: editor2 }) => {
609
607
  const text = editor2.getText();
610
- onChange == null ? void 0 : onChange(text);
608
+ onChange?.(text);
611
609
  },
612
610
  editorProps: {
613
611
  attributes: {
614
612
  class: reablocks.cn(
615
- (_b = (_a = theme == null ? void 0 : theme.input) == null ? void 0 : _a.editor) == null ? void 0 : _b.base,
616
- (_d = (_c = theme == null ? void 0 : theme.input) == null ? void 0 : _c.editor) == null ? void 0 : _d.placeholder
613
+ theme?.input?.editor?.base,
614
+ theme?.input?.editor?.placeholder
617
615
  ),
618
616
  style: `min-height: ${minHeight}px; max-height: ${maxHeight}px;`,
619
617
  role: "textbox",
@@ -631,7 +629,7 @@
631
629
  if (text.trim() && onSubmit) {
632
630
  event.preventDefault();
633
631
  onSubmit(text);
634
- editor == null ? void 0 : editor.commands.clearContent();
632
+ editor?.commands.clearContent();
635
633
  return true;
636
634
  }
637
635
  }
@@ -648,16 +646,16 @@
648
646
  }, [editor, autoFocus]);
649
647
  React.useImperativeHandle(ref, () => ({
650
648
  focus: () => {
651
- editor == null ? void 0 : editor.commands.focus();
649
+ editor?.commands.focus();
652
650
  },
653
651
  getValue: () => {
654
- return (editor == null ? void 0 : editor.getText()) || "";
652
+ return editor?.getText() || "";
655
653
  },
656
654
  setValue: (newValue) => {
657
- editor == null ? void 0 : editor.commands.setContent(newValue ? `<p>${newValue}</p>` : "");
655
+ editor?.commands.setContent(newValue ? `<p>${newValue}</p>` : "");
658
656
  },
659
657
  insertText: (text) => {
660
- editor == null ? void 0 : editor.commands.insertContent(text);
658
+ editor?.commands.insertContent(text);
661
659
  }
662
660
  }));
663
661
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: reablocks.cn("relative w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor }) });
@@ -668,6 +666,7 @@
668
666
  ({
669
667
  allowedFiles,
670
668
  placeholder = "Type a message...",
669
+ allowMultipleFiles = false,
671
670
  defaultValue,
672
671
  sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
673
672
  stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
@@ -691,43 +690,37 @@
691
690
  const inputRef = React.useRef(null);
692
691
  const containerRef = React.useRef(null);
693
692
  React.useEffect(() => {
694
- var _a;
695
693
  if (autoFocus) {
696
- (_a = inputRef.current) == null ? void 0 : _a.focus();
694
+ inputRef.current?.focus();
697
695
  }
698
696
  }, [activeSessionId, autoFocus]);
699
697
  React.useImperativeHandle(ref, () => ({
700
698
  focus: () => {
701
- var _a;
702
- (_a = inputRef.current) == null ? void 0 : _a.focus();
699
+ inputRef.current?.focus();
703
700
  },
704
701
  getValue: () => {
705
- var _a;
706
- return ((_a = inputRef.current) == null ? void 0 : _a.getValue()) || "";
702
+ return inputRef.current?.getValue() || "";
707
703
  },
708
704
  setValue: (value) => {
709
- var _a;
710
705
  setMessage(value);
711
- (_a = inputRef.current) == null ? void 0 : _a.setValue(value);
706
+ inputRef.current?.setValue(value);
712
707
  },
713
708
  insertText: (text) => {
714
- var _a;
715
- (_a = inputRef.current) == null ? void 0 : _a.insertText(text);
709
+ inputRef.current?.insertText(text);
716
710
  }
717
711
  }));
718
712
  const handleSendMessage = React.useCallback(() => {
719
- var _a, _b;
720
- const currentMessage = (_a = inputRef.current) == null ? void 0 : _a.getValue();
713
+ const currentMessage = inputRef.current?.getValue();
721
714
  if (currentMessage.trim()) {
722
- sendMessage == null ? void 0 : sendMessage(currentMessage);
715
+ sendMessage?.(currentMessage);
723
716
  setMessage("");
724
- (_b = inputRef.current) == null ? void 0 : _b.setValue("");
717
+ inputRef.current?.setValue("");
725
718
  }
726
719
  }, [sendMessage]);
727
720
  const handleSubmit = React.useCallback(
728
721
  (value) => {
729
722
  if (value.trim()) {
730
- sendMessage == null ? void 0 : sendMessage(value);
723
+ sendMessage?.(value);
731
724
  setMessage("");
732
725
  }
733
726
  },
@@ -736,16 +729,12 @@
736
729
  const handleChange = React.useCallback((value) => {
737
730
  setMessage(value);
738
731
  }, []);
739
- const handleFileUpload = React.useCallback(
740
- (event) => {
741
- var _a;
742
- const file = (_a = event.target.files) == null ? void 0 : _a[0];
743
- if (file && fileUpload) {
744
- fileUpload(file);
745
- }
746
- },
747
- [fileUpload]
748
- );
732
+ const handleFileUpload = (event) => {
733
+ const files = event.target.files;
734
+ if (files?.length && fileUpload) {
735
+ fileUpload(allowMultipleFiles ? Array.from(files) : files[0]);
736
+ }
737
+ };
749
738
  const mentionsConfig = React.useMemo(
750
739
  () => mentions ? { ...mentions, trigger: mentions.trigger || "@" } : void 0,
751
740
  [mentions]
@@ -773,10 +762,11 @@
773
762
  }
774
763
  ),
775
764
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
776
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
765
+ allowedFiles?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
777
766
  FileInput,
778
767
  {
779
768
  allowedFiles,
769
+ multiple: allowMultipleFiles,
780
770
  onFileUpload: handleFileUpload,
781
771
  isLoading,
782
772
  disabled,
@@ -1877,14 +1867,17 @@
1877
1867
  const CodeHighlighter = ({
1878
1868
  className,
1879
1869
  children,
1870
+ inlineClassName,
1880
1871
  copyClassName,
1881
1872
  copyIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgCopy, {}),
1882
1873
  language,
1883
1874
  toolbarClassName,
1884
- theme = dark
1875
+ theme = dark,
1876
+ ...props
1885
1877
  }) => {
1886
- const match = language == null ? void 0 : language.match(/language-(\w+)/);
1878
+ const match = language?.match(/language-(\w+)/);
1887
1879
  const lang = match ? match[1] : "text";
1880
+ const isInline = !match;
1888
1881
  const handleCopy = (text) => {
1889
1882
  navigator.clipboard.writeText(text).then(() => {
1890
1883
  console.log("Text copied to clipboard");
@@ -1892,6 +1885,9 @@
1892
1885
  console.error("Could not copy text: ", err);
1893
1886
  });
1894
1887
  };
1888
+ if (isInline) {
1889
+ return /* @__PURE__ */ jsxRuntime.jsx("code", { className: reablocks.cn(inlineClassName), ...props, children });
1890
+ }
1895
1891
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative", className), children: [
1896
1892
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(toolbarClassName), children: [
1897
1893
  /* @__PURE__ */ jsxRuntime.jsx("div", { children: lang }),
@@ -1907,14 +1903,7 @@
1907
1903
  }
1908
1904
  )
1909
1905
  ] }),
1910
- /* @__PURE__ */ jsxRuntime.jsx(
1911
- reactSyntaxHighlighter.Prism,
1912
- {
1913
- language: lang,
1914
- style: theme,
1915
- children
1916
- }
1917
- )
1906
+ /* @__PURE__ */ jsxRuntime.jsx(reactSyntaxHighlighter.Prism, { language: lang, style: theme, children })
1918
1907
  ] });
1919
1908
  };
1920
1909
  const TableComponent = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("table", { ...props, children });
@@ -1924,16 +1913,19 @@
1924
1913
  children,
1925
1914
  remarkPlugins,
1926
1915
  rehypePlugins = [rehypeRaw, rehypeKatex],
1916
+ theme: themeProp,
1927
1917
  customComponents
1928
1918
  }) => {
1929
- const { theme, markdownComponents } = React.useContext(ChatContext);
1919
+ const { theme: contextTheme, markdownComponents } = React.useContext(ChatContext);
1920
+ const theme = themeProp || contextTheme;
1930
1921
  const components = React.useMemo(() => {
1931
1922
  const defaultComponents = {
1932
1923
  code: ({ className, children: children2, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1933
1924
  CodeHighlighter,
1934
1925
  {
1935
1926
  ...props,
1936
- language: className,
1927
+ language: reablocks.cn(className),
1928
+ inlineClassName: reablocks.cn(theme.messages.message.markdown.inlineCode),
1937
1929
  className: reablocks.cn(theme.messages.message.markdown.code, className),
1938
1930
  copyClassName: reablocks.cn(theme.messages.message.markdown.copy),
1939
1931
  toolbarClassName: reablocks.cn(theme.messages.message.markdown.toolbar),
@@ -1962,20 +1954,27 @@
1962
1954
  }
1963
1955
  ),
1964
1956
  a: (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props, className: reablocks.cn(theme.messages.message.markdown.a) }),
1957
+ hr: (props) => /* @__PURE__ */ jsxRuntime.jsx("hr", { ...props, className: reablocks.cn(theme.messages.message.markdown.hr) }),
1965
1958
  p: (props) => /* @__PURE__ */ jsxRuntime.jsx("p", { ...props, className: reablocks.cn(theme.messages.message.markdown.p) }),
1966
1959
  li: (props) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: reablocks.cn(theme.messages.message.markdown.li) }),
1967
1960
  ul: (props) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: reablocks.cn(theme.messages.message.markdown.ul) }),
1968
1961
  ol: (props) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: reablocks.cn(theme.messages.message.markdown.ol) }),
1962
+ h1: (props) => /* @__PURE__ */ jsxRuntime.jsx("h1", { ...props, className: reablocks.cn(theme.messages.message.markdown.h1) }),
1963
+ h2: (props) => /* @__PURE__ */ jsxRuntime.jsx("h2", { ...props, className: reablocks.cn(theme.messages.message.markdown.h2) }),
1964
+ h3: (props) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ...props, className: reablocks.cn(theme.messages.message.markdown.h3) }),
1965
+ h4: (props) => /* @__PURE__ */ jsxRuntime.jsx("h4", { ...props, className: reablocks.cn(theme.messages.message.markdown.h4) }),
1966
+ h5: (props) => /* @__PURE__ */ jsxRuntime.jsx("h5", { ...props, className: reablocks.cn(theme.messages.message.markdown.h5) }),
1967
+ h6: (props) => /* @__PURE__ */ jsxRuntime.jsx("h6", { ...props, className: reablocks.cn(theme.messages.message.markdown.h6) }),
1969
1968
  // 'redact' is a custom element created by remarkRedact, not a standard
1970
1969
  // HTML tag, so it falls outside react-markdown's Components type.
1971
- redact: (props) => /* @__PURE__ */ jsxRuntime.jsx(
1970
+ redact: ((props) => /* @__PURE__ */ jsxRuntime.jsx(
1972
1971
  reablocks.Redact,
1973
1972
  {
1974
1973
  value: props["data-redact-value"] || props.children,
1975
1974
  allowToggle: true,
1976
1975
  tooltipText: `${props["data-redact-name"] || "Sensitive"} information - Click to toggle`
1977
1976
  }
1978
- )
1977
+ ))
1979
1978
  };
1980
1979
  return {
1981
1980
  ...defaultComponents,
@@ -2202,7 +2201,7 @@
2202
2201
  }) => {
2203
2202
  const { theme } = React.useContext(ChatContext);
2204
2203
  const FileRenderer = React.useMemo(() => {
2205
- const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type == null ? void 0 : type.startsWith(key)) ?? "default";
2204
+ const Renderer = Object.keys(FILE_TYPE_RENDERER_MAP).find((key) => type?.startsWith(key)) ?? "default";
2206
2205
  return FILE_TYPE_RENDERER_MAP[Renderer] || DefaultFileRenderer$2;
2207
2206
  }, [type]);
2208
2207
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -2386,8 +2385,7 @@
2386
2385
  }
2387
2386
  return files.reduce(
2388
2387
  (acc, file) => {
2389
- var _a;
2390
- if ((_a = file.type) == null ? void 0 : _a.startsWith("image/")) {
2388
+ if (file.type?.startsWith("image/")) {
2391
2389
  acc.imageFiles.push(file);
2392
2390
  } else {
2393
2391
  acc.otherFiles.push(file);
@@ -2466,7 +2464,7 @@
2466
2464
  ...props,
2467
2465
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2468
2466
  /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
2469
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }),
2467
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: question }),
2470
2468
  isLong && !expanded && /* @__PURE__ */ jsxRuntime.jsx(
2471
2469
  reablocks.Button,
2472
2470
  {
@@ -2493,7 +2491,7 @@
2493
2491
  "data-compact": isCompact,
2494
2492
  className: reablocks.cn(theme.messages.message.response),
2495
2493
  children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2496
- /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: response }),
2494
+ /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, theme, children: response }),
2497
2495
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(
2498
2496
  react$1.motion.div,
2499
2497
  {
@@ -2511,7 +2509,6 @@
2511
2509
  );
2512
2510
  }
2513
2511
  );
2514
- MessageResponse.displayName = "MessageResponse";
2515
2512
  const MessageSource = ({ title, url, image, limit = 50 }) => {
2516
2513
  const { theme, isCompact } = React.useContext(ChatContext);
2517
2514
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2643,9 +2640,9 @@ ${response}` : ""}`);
2643
2640
  }
2644
2641
  };
2645
2642
  const SessionMessage = React.memo(
2646
- ({ conversation, isLast, children }) => {
2643
+ ({ conversation, isLast, children, className }) => {
2647
2644
  const { theme, isLoading } = React.useContext(ChatContext);
2648
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.motion.div, { variants: messageVariants, children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2645
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.motion.div, { variants: messageVariants, children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base, className), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2649
2646
  /* @__PURE__ */ jsxRuntime.jsx(
2650
2647
  MessageQuestion,
2651
2648
  {
@@ -2686,10 +2683,15 @@ ${response}` : ""}`);
2686
2683
  children,
2687
2684
  newSessionContent,
2688
2685
  limit = 10,
2686
+ className,
2689
2687
  showMoreText = "Show more",
2690
- showScrollBottomButton = false
2688
+ autoScroll = true,
2689
+ showLoadMoreButton = false,
2690
+ showScrollBottomButton,
2691
+ loadMoreButtonDisabled,
2692
+ onScroll,
2693
+ onLoadMore
2691
2694
  }) => {
2692
- var _a, _b, _c, _d, _e, _f;
2693
2695
  const { activeSession, theme } = React.useContext(ChatContext);
2694
2696
  const contentRef = React.useRef(null);
2695
2697
  const messagesRef = React.useRef(null);
@@ -2711,12 +2713,12 @@ ${response}` : ""}`);
2711
2713
  return () => currentRef.removeEventListener("scroll", handleScroll);
2712
2714
  }, [showScrollBottomButton]);
2713
2715
  React.useEffect(() => {
2714
- if (contentRef.current) {
2716
+ if (contentRef.current && autoScroll) {
2715
2717
  requestAnimationFrame(
2716
2718
  () => contentRef.current.scrollTop = contentRef.current.scrollHeight
2717
2719
  );
2718
2720
  }
2719
- }, [activeSession, isAnimating]);
2721
+ }, [activeSession, autoScroll, isAnimating]);
2720
2722
  const handleShowMore = () => {
2721
2723
  showNext(limit);
2722
2724
  requestAnimationFrame(() => contentRef.current.scrollTop = 0);
@@ -2730,7 +2732,7 @@ ${response}` : ""}`);
2730
2732
  }
2731
2733
  };
2732
2734
  const reversedConvos = React.useMemo(
2733
- () => [...(activeSession == null ? void 0 : activeSession.conversations) ?? []].reverse(),
2735
+ () => [...activeSession?.conversations ?? []].reverse(),
2734
2736
  [activeSession]
2735
2737
  );
2736
2738
  const { data, hasMore, showNext } = reablocks.useInfinityList({
@@ -2738,25 +2740,27 @@ ${response}` : ""}`);
2738
2740
  size: limit
2739
2741
  });
2740
2742
  const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
2741
- const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
2743
+ const convosToRender = limit ? reReversedConvo : activeSession?.conversations;
2742
2744
  if (!activeSession) {
2743
2745
  return /* @__PURE__ */ jsxRuntime.jsx(SessionEmpty, { children: newSessionContent });
2744
2746
  }
2745
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 overflow-y-hidden", children: [
2747
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn("relative flex-1 overflow-y-hidden", className), children: [
2746
2748
  /* @__PURE__ */ jsxRuntime.jsxs(
2747
2749
  "div",
2748
2750
  {
2749
- className: reablocks.cn(theme.messages.content, "h-full"),
2751
+ className: reablocks.cn(theme.messages.content, className, "h-full"),
2750
2752
  ref: contentRef,
2751
- id: activeSession == null ? void 0 : activeSession.id,
2753
+ id: activeSession?.id,
2754
+ onScrollCapture: onScroll,
2752
2755
  children: [
2753
- hasMore && /* @__PURE__ */ jsxRuntime.jsx(
2756
+ (showLoadMoreButton || hasMore) && /* @__PURE__ */ jsxRuntime.jsx(
2754
2757
  reablocks.Button,
2755
2758
  {
2759
+ disabled: loadMoreButtonDisabled,
2756
2760
  variant: "outline",
2757
2761
  className: reablocks.cn(theme.messages.showMore),
2758
2762
  fullWidth: true,
2759
- onClick: handleShowMore,
2763
+ onClick: onLoadMore ?? handleShowMore,
2760
2764
  children: showMoreText
2761
2765
  }
2762
2766
  ),
@@ -2769,7 +2773,7 @@ ${response}` : ""}`);
2769
2773
  animate: "visible",
2770
2774
  onAnimationComplete: () => requestAnimationFrame(() => {
2771
2775
  setIsAnimating(false);
2772
- if (contentRef.current) {
2776
+ if (contentRef.current && autoScroll) {
2773
2777
  contentRef.current.scrollTop = contentRef.current.scrollHeight;
2774
2778
  }
2775
2779
  }),
@@ -2782,7 +2786,7 @@ ${response}` : ""}`);
2782
2786
  conversation.id
2783
2787
  ))
2784
2788
  },
2785
- activeSession == null ? void 0 : activeSession.id
2789
+ activeSession?.id
2786
2790
  ) })
2787
2791
  ]
2788
2792
  }
@@ -2794,13 +2798,13 @@ ${response}` : ""}`);
2794
2798
  animate: { y: 0, opacity: 1 },
2795
2799
  exit: { y: 100, opacity: 0 },
2796
2800
  transition: { duration: 0.3, ease: "easeOut" },
2797
- className: (_c = (_b = (_a = theme.messages) == null ? void 0 : _a.message) == null ? void 0 : _b.scrollToBottom) == null ? void 0 : _c.container,
2801
+ className: theme.messages?.message?.scrollToBottom?.container,
2798
2802
  children: /* @__PURE__ */ jsxRuntime.jsx(
2799
2803
  reablocks.IconButton,
2800
2804
  {
2801
2805
  onClick: handleScrollToBottom,
2802
- className: (_f = (_e = (_d = theme.messages) == null ? void 0 : _d.message) == null ? void 0 : _e.scrollToBottom) == null ? void 0 : _f.button,
2803
- size: "sm",
2806
+ className: theme.messages?.message?.scrollToBottom?.button,
2807
+ size: "small",
2804
2808
  children: /* @__PURE__ */ jsxRuntime.jsx(SvgArrowDown, {})
2805
2809
  }
2806
2810
  )
@@ -2870,20 +2874,20 @@ ${response}` : ""}`);
2870
2874
  const handleSelectSession = React.useCallback(
2871
2875
  (sessionId) => {
2872
2876
  setInternalActiveSessionID(sessionId);
2873
- onSelectSession == null ? void 0 : onSelectSession(sessionId);
2877
+ onSelectSession?.(sessionId);
2874
2878
  },
2875
2879
  [onSelectSession]
2876
2880
  );
2877
2881
  const handleDeleteSession = React.useCallback(
2878
2882
  (sessionId) => {
2879
2883
  setInternalActiveSessionID(void 0);
2880
- onDeleteSession == null ? void 0 : onDeleteSession(sessionId);
2884
+ onDeleteSession?.(sessionId);
2881
2885
  },
2882
2886
  [onDeleteSession]
2883
2887
  );
2884
2888
  const handleCreateNewSession = React.useCallback(() => {
2885
2889
  setInternalActiveSessionID(void 0);
2886
- onNewSession == null ? void 0 : onNewSession();
2890
+ onNewSession?.();
2887
2891
  }, [onNewSession]);
2888
2892
  reakeys.useHotkeys([
2889
2893
  {
@@ -2976,7 +2980,7 @@ ${response}` : ""}`);
2976
2980
  const { activeSessionId, selectSession, deleteSession, theme } = React.useContext(ChatContext);
2977
2981
  const Comp = children ? reactSlot.Slot : reablocks.ListItem;
2978
2982
  const handleSelect = React.useCallback(() => {
2979
- selectSession == null ? void 0 : selectSession(session.id);
2983
+ selectSession?.(session.id);
2980
2984
  }, [selectSession, session.id]);
2981
2985
  const handleDelete = React.useCallback(
2982
2986
  (e) => {
@@ -3038,7 +3042,7 @@ ${response}` : ""}`);
3038
3042
  }),
3039
3043
  children: [
3040
3044
  /* @__PURE__ */ jsxRuntime.jsx(reablocks.List, { children }),
3041
- templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsxRuntime.jsx(
3045
+ templates && !activeSessionId && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: () => createSession?.(), children: /* @__PURE__ */ jsxRuntime.jsx(
3042
3046
  SessionListItem,
3043
3047
  {
3044
3048
  session: {
@@ -3067,7 +3071,7 @@ ${response}` : ""}`);
3067
3071
  fullWidth: true,
3068
3072
  disableMargins: true,
3069
3073
  color: "primary",
3070
- startAdornment: /* @__PURE__ */ jsxRuntime.jsx(SvgPlus, {}),
3074
+ start: /* @__PURE__ */ jsxRuntime.jsx(SvgPlus, {}),
3071
3075
  className: reablocks.cn(theme.sessions.create),
3072
3076
  disabled,
3073
3077
  onClick: createSession,
@@ -3203,7 +3207,7 @@ ${response}` : ""}`);
3203
3207
  const { theme, disabled, isLoading } = React.useContext(ChatContext);
3204
3208
  const handleClick = () => {
3205
3209
  if (disabled || isLoading) return;
3206
- onClick == null ? void 0 : onClick(content);
3210
+ onClick?.(content);
3207
3211
  };
3208
3212
  return /* @__PURE__ */ jsxRuntime.jsx(
3209
3213
  reablocks.Button,
@@ -3456,8 +3460,7 @@ ${response}` : ""}`);
3456
3460
  return null;
3457
3461
  }
3458
3462
  async function* parseSSE(response, signal) {
3459
- var _a;
3460
- const reader = (_a = response.body) == null ? void 0 : _a.getReader();
3463
+ const reader = response.body?.getReader();
3461
3464
  if (!reader) {
3462
3465
  throw new Error("Response body is not readable");
3463
3466
  }
@@ -3509,8 +3512,7 @@ ${response}` : ""}`);
3509
3512
  onEventRef.current = onEvent;
3510
3513
  React.useEffect(() => {
3511
3514
  return () => {
3512
- var _a;
3513
- (_a = abortRef.current) == null ? void 0 : _a.abort();
3515
+ abortRef.current?.abort();
3514
3516
  };
3515
3517
  }, []);
3516
3518
  const selectSession = React.useCallback((sessionId) => {
@@ -3538,15 +3540,13 @@ ${response}` : ""}`);
3538
3540
  setActiveSessionId(id);
3539
3541
  }, []);
3540
3542
  const stopMessage = React.useCallback(() => {
3541
- var _a;
3542
- (_a = abortRef.current) == null ? void 0 : _a.abort();
3543
+ abortRef.current?.abort();
3543
3544
  abortRef.current = null;
3544
3545
  setIsLoading(false);
3545
3546
  }, []);
3546
3547
  const sendMessage = React.useCallback(
3547
3548
  async (message) => {
3548
- var _a, _b, _c, _d, _e, _f;
3549
- (_a = abortRef.current) == null ? void 0 : _a.abort();
3549
+ abortRef.current?.abort();
3550
3550
  const abortController = new AbortController();
3551
3551
  abortRef.current = abortController;
3552
3552
  let sessionId = activeSessionId;
@@ -3573,7 +3573,7 @@ ${response}` : ""}`);
3573
3573
  );
3574
3574
  setIsLoading(true);
3575
3575
  const currentSession = [
3576
- ...((_b = sessions.find((s) => s.id === sessionId)) == null ? void 0 : _b.conversations) ?? []
3576
+ ...sessions.find((s) => s.id === sessionId)?.conversations ?? []
3577
3577
  ];
3578
3578
  const historyMessages = sessionsToAgUiMessages({
3579
3579
  conversations: currentSession
@@ -3621,11 +3621,11 @@ ${response}` : ""}`);
3621
3621
  abortController.signal
3622
3622
  )) {
3623
3623
  if (eventOrError instanceof Error) {
3624
- (_c = onErrorRef.current) == null ? void 0 : _c.call(onErrorRef, eventOrError);
3624
+ onErrorRef.current?.(eventOrError);
3625
3625
  continue;
3626
3626
  }
3627
3627
  const event = eventOrError;
3628
- (_d = onEventRef.current) == null ? void 0 : _d.call(onEventRef, event);
3628
+ onEventRef.current?.(event);
3629
3629
  switch (event.type) {
3630
3630
  case AgUiEventType.TEXT_MESSAGE_CONTENT: {
3631
3631
  responseText += event.delta;
@@ -3670,7 +3670,7 @@ ${response}` : ""}`);
3670
3670
  }
3671
3671
  case AgUiEventType.RUN_ERROR: {
3672
3672
  const err = new Error(event.message);
3673
- (_e = onErrorRef.current) == null ? void 0 : _e.call(onErrorRef, err);
3673
+ onErrorRef.current?.(err);
3674
3674
  break;
3675
3675
  }
3676
3676
  case AgUiEventType.RUN_FINISHED: {
@@ -3683,7 +3683,7 @@ ${response}` : ""}`);
3683
3683
  return;
3684
3684
  }
3685
3685
  const error = err instanceof Error ? err : new Error(String(err));
3686
- (_f = onErrorRef.current) == null ? void 0 : _f.call(onErrorRef, error);
3686
+ onErrorRef.current?.(error);
3687
3687
  } finally {
3688
3688
  if (abortRef.current === abortController) {
3689
3689
  abortRef.current = null;
@@ -3817,7 +3817,6 @@ ${response}` : ""}`);
3817
3817
  definitions,
3818
3818
  options
3819
3819
  }) => {
3820
- var _a, _b;
3821
3820
  const { theme, sendMessage } = React.useContext(ChatContext);
3822
3821
  const result = React.useMemo(
3823
3822
  () => validateSpec(raw, definitions),
@@ -3825,7 +3824,7 @@ ${response}` : ""}`);
3825
3824
  );
3826
3825
  if (!result.ok) {
3827
3826
  const error = result.error;
3828
- const custom = (_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error);
3827
+ const custom = options?.onError?.(error);
3829
3828
  if (custom !== void 0) {
3830
3829
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: custom });
3831
3830
  }
@@ -3839,7 +3838,7 @@ ${response}` : ""}`);
3839
3838
  );
3840
3839
  }
3841
3840
  const specs = result.specs;
3842
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: (_b = theme.component) == null ? void 0 : _b.base, children: specs.map((spec, index) => /* @__PURE__ */ jsxRuntime.jsx(
3841
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: theme.component?.base, children: specs.map((spec, index) => /* @__PURE__ */ jsxRuntime.jsx(
3843
3842
  SpecRenderer,
3844
3843
  {
3845
3844
  spec,
@@ -3856,7 +3855,6 @@ ${response}` : ""}`);
3856
3855
  options,
3857
3856
  sendMessage
3858
3857
  }) => {
3859
- var _a, _b;
3860
3858
  const definition = definitions[spec.type];
3861
3859
  if (!definition) {
3862
3860
  const error = {
@@ -3865,14 +3863,14 @@ ${response}` : ""}`);
3865
3863
  raw: JSON.stringify(spec),
3866
3864
  componentType: spec.type
3867
3865
  };
3868
- const custom = (_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error);
3866
+ const custom = options?.onError?.(error);
3869
3867
  if (custom !== void 0) {
3870
3868
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: custom });
3871
3869
  }
3872
3870
  return /* @__PURE__ */ jsxRuntime.jsx(ComponentError, { title: errorTitle(error.type), message: error.message });
3873
3871
  }
3874
3872
  const RenderedComponent = definition.component;
3875
- const children = (_b = spec.children) == null ? void 0 : _b.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
3873
+ const children = spec.children?.map((child, index) => /* @__PURE__ */ jsxRuntime.jsx(
3876
3874
  SpecRenderer,
3877
3875
  {
3878
3876
  spec: child,
@@ -3893,7 +3891,6 @@ ${response}` : ""}`);
3893
3891
  return { error };
3894
3892
  }
3895
3893
  render() {
3896
- var _a;
3897
3894
  if (this.state.error) {
3898
3895
  const { spec, options } = this.props;
3899
3896
  const catalogError = {
@@ -3902,7 +3899,7 @@ ${response}` : ""}`);
3902
3899
  raw: JSON.stringify(spec),
3903
3900
  componentType: spec.type
3904
3901
  };
3905
- const custom = (_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, catalogError);
3902
+ const custom = options?.onError?.(catalogError);
3906
3903
  if (custom !== void 0) {
3907
3904
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: custom });
3908
3905
  }
@@ -3963,14 +3960,13 @@ ${response}` : ""}`);
3963
3960
  return "";
3964
3961
  }
3965
3962
  function createComponentPre(definitions, options) {
3966
- const language = (options == null ? void 0 : options.language) ?? "component";
3963
+ const language = options?.language ?? "component";
3967
3964
  const className = `language-${language}`;
3968
3965
  const ComponentPre = ({ children, ...props }) => {
3969
- var _a, _b;
3970
3966
  if (children && typeof children === "object" && "props" in children) {
3971
3967
  const codeElement = children;
3972
- if (((_a = codeElement.props) == null ? void 0 : _a.className) === className) {
3973
- const codeContent = getChildText((_b = codeElement.props) == null ? void 0 : _b.children);
3968
+ if (codeElement.props?.className === className) {
3969
+ const codeContent = getChildText(codeElement.props?.children);
3974
3970
  if (codeContent) {
3975
3971
  return /* @__PURE__ */ jsxRuntime.jsx(
3976
3972
  ComponentRenderer,
@@ -4082,7 +4078,7 @@ Available components:
4082
4078
  ${componentDocs}`;
4083
4079
  }
4084
4080
  function componentCatalog(definitions, options) {
4085
- const language = (options == null ? void 0 : options.language) ?? "component";
4081
+ const language = options?.language ?? "component";
4086
4082
  const plugin = remarkComponent.bind(void 0, {
4087
4083
  language
4088
4084
  });
@@ -4168,6 +4164,7 @@ ${componentDocs}`;
4168
4164
  exports2.creditCardMatcher = creditCardMatcher;
4169
4165
  exports2.dark = dark;
4170
4166
  exports2.generatePrompt = generatePrompt;
4167
+ exports2.groupSessionsByDate = groupSessionsByDate;
4171
4168
  exports2.light = light;
4172
4169
  exports2.remarkComponent = remarkComponent;
4173
4170
  exports2.remarkCve = remarkCve;
@@ -4176,5 +4173,5 @@ ${componentDocs}`;
4176
4173
  exports2.useAgUi = useAgUi;
4177
4174
  exports2.validateSpec = validateSpec;
4178
4175
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
4179
- });
4176
+ }));
4180
4177
  //# sourceMappingURL=index.umd.cjs.map