reachat 1.2.0 → 1.3.1

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("react"), require("reablocks"), require("@radix-ui/react-slot"), require("framer-motion"), require("react-markdown"), require("remark-gfm"), require("react-syntax-highlighter"), require("rehype-katex"), require("remark-math"), require("mdast-util-find-and-replace"), require("remark-youtube"), require("reakeys"), require("date-fns")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react", "reablocks", "@radix-ui/react-slot", "framer-motion", "react-markdown", "remark-gfm", "react-syntax-highlighter", "rehype-katex", "remark-math", "mdast-util-find-and-replace", "remark-youtube", "reakeys", "date-fns"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.React, global.reablocks, global.reactSlot, global.framerMotion, global.ReactMarkdown, global.remarkGfm, global.reactSyntaxHighlighter, global.rehypeKatex, global.remarkMath, global.mdastUtilFindAndReplace, global.remarkYoutube, global.reakeys, global.dateFns));
15
- })(this, function(exports2, jsxRuntime, React, reablocks, reactSlot, framerMotion, ReactMarkdown, remarkGfm, reactSyntaxHighlighter, rehypeKatex, remarkMath, mdastUtilFindAndReplace, remarkYoutube, reakeys, dateFns) {
14
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react"), require("reablocks"), require("@radix-ui/react-slot"), require("framer-motion"), require("react-markdown"), require("react-syntax-highlighter"), require("rehype-katex"), require("mdast-util-find-and-replace"), require("reakeys"), require("remark-gfm"), require("remark-youtube"), require("remark-math"), require("date-fns")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react", "reablocks", "@radix-ui/react-slot", "framer-motion", "react-markdown", "react-syntax-highlighter", "rehype-katex", "mdast-util-find-and-replace", "reakeys", "remark-gfm", "remark-youtube", "remark-math", "date-fns"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.reachat = {}, global.jsxRuntime, global.React, global.reablocks, global.reactSlot, global.framerMotion, global.ReactMarkdown, global.reactSyntaxHighlighter, global.rehypeKatex, global.mdastUtilFindAndReplace, global.reakeys, global.remarkGfm, global.remarkYoutube, global.remarkMath, global.dateFns));
15
+ })(this, function(exports2, jsxRuntime, React, reablocks, reactSlot, framerMotion, ReactMarkdown, reactSyntaxHighlighter, rehypeKatex, mdastUtilFindAndReplace, reakeys, remarkGfm, remarkYoutube, remarkMath, dateFns) {
16
16
  "use strict";
17
17
  function _interopNamespaceDefault(e) {
18
18
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -33,22 +33,64 @@
33
33
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
34
34
  const SvgSend = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { id: "send" }, /* @__PURE__ */ React__namespace.createElement("path", { id: "Vector", d: "M14.6111 2.33327C14.5349 2.3339 14.4598 2.35194 14.3917 2.386L2.39168 8.386C2.31456 8.42456 2.24872 8.4824 2.20055 8.55391C2.15238 8.62543 2.12352 8.70818 2.11677 8.79414C2.11002 8.88009 2.12561 8.96634 2.16203 9.04449C2.19845 9.12264 2.25446 9.19005 2.32462 9.24017L4.52514 10.8124L5.47371 13.6581C5.50257 13.7447 5.55457 13.8217 5.62406 13.8808C5.69355 13.9399 5.7779 13.9789 5.86796 13.9935C5.95802 14.0082 6.05036 13.9979 6.13499 13.9638C6.21962 13.9297 6.2933 13.873 6.34806 13.8001L7.05249 12.8606L10.3207 15.2376C10.3843 15.2839 10.4579 15.3146 10.5355 15.3271C10.6132 15.3396 10.6927 15.3336 10.7676 15.3097C10.8425 15.2857 10.9107 15.2444 10.9667 15.1891C11.0226 15.1338 11.0647 15.0661 11.0896 14.9915L15.0896 2.99147C15.1148 2.91597 15.1216 2.83555 15.1094 2.7569C15.0972 2.67825 15.0665 2.60363 15.0197 2.53926C14.9729 2.47488 14.9114 2.42261 14.8403 2.38678C14.7693 2.35096 14.6907 2.33261 14.6111 2.33327ZM13.2478 5.35345L10.3565 14.0266L7.67293 12.0755L13.2478 5.35345ZM10.684 5.35801L4.934 9.87559L3.58113 8.90879L10.684 5.35801ZM11.2784 6.16205L6.56746 11.843C6.56681 11.8437 6.56616 11.8443 6.56551 11.845L6.56355 11.8476C6.55841 11.8538 6.55342 11.8601 6.54858 11.8665C6.54319 11.8733 6.53798 11.8802 6.53295 11.8873L6.12085 12.4361L5.53426 10.6751L11.2784 6.16205Z", fill: "currentColor" })));
35
35
  const SvgStop = (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-octagon-x", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React__namespace.createElement("path", { d: "m9 9 6 6" }));
36
- 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" }));
37
36
  const ChatContext = React.createContext({
38
37
  sessions: [],
39
38
  activeSessionId: null
40
39
  });
41
- const ChatInput = ({
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
+ const FileInput = ({
42
+ allowedFiles,
43
+ onFileUpload,
44
+ isLoading,
45
+ disabled,
46
+ attachIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgPaperclip, {})
47
+ }) => {
48
+ const { theme } = React.useContext(ChatContext);
49
+ const fileInputRef = React.useRef(null);
50
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
51
+ /* @__PURE__ */ jsxRuntime.jsx(
52
+ "input",
53
+ {
54
+ type: "file",
55
+ ref: fileInputRef,
56
+ className: "hidden",
57
+ accept: allowedFiles.join(","),
58
+ onChange: onFileUpload
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsxRuntime.jsx(
62
+ reablocks.Button,
63
+ {
64
+ title: "Upload",
65
+ variant: "text",
66
+ disabled: isLoading || disabled,
67
+ className: reablocks.cn(theme.input.upload),
68
+ onClick: () => {
69
+ var _a;
70
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
71
+ },
72
+ children: attachIcon
73
+ }
74
+ )
75
+ ] });
76
+ };
77
+ const ChatInput = React.forwardRef(({
42
78
  allowedFiles,
43
79
  placeholder,
44
80
  defaultValue,
45
81
  sendIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgSend, {}),
46
82
  stopIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgStop, {}),
47
- attachIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgPaperclip, {})
48
- }) => {
83
+ attachIcon
84
+ }, ref) => {
49
85
  const { theme, isLoading, disabled, sendMessage, stopMessage, fileUpload } = React.useContext(ChatContext);
50
86
  const [message, setMessage] = React.useState("");
51
- const fileInputRef = React.useRef(null);
87
+ const inputRef = React.useRef(null);
88
+ React.useImperativeHandle(ref, () => ({
89
+ focus: () => {
90
+ var _a;
91
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
92
+ }
93
+ }));
52
94
  const handleSendMessage = () => {
53
95
  if (message.trim()) {
54
96
  sendMessage == null ? void 0 : sendMessage(message);
@@ -72,44 +114,29 @@
72
114
  /* @__PURE__ */ jsxRuntime.jsx(
73
115
  reablocks.Textarea,
74
116
  {
117
+ inputRef,
75
118
  containerClassName: reablocks.cn(theme.input.input),
76
119
  minRows: 1,
77
120
  autoFocus: true,
78
121
  value: message,
79
- onChange: (e) => setMessage(e.target.value),
80
122
  defaultValue,
81
123
  onKeyPress: handleKeyPress,
82
124
  placeholder,
83
- disabled: isLoading || disabled
125
+ disabled: isLoading || disabled,
126
+ onChange: (e) => setMessage(e.target.value)
84
127
  }
85
128
  ),
86
129
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.input.actions.base), children: [
87
- (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
88
- /* @__PURE__ */ jsxRuntime.jsx(
89
- "input",
90
- {
91
- type: "file",
92
- ref: fileInputRef,
93
- className: "hidden",
94
- accept: allowedFiles.join(","),
95
- onChange: handleFileUpload
96
- }
97
- ),
98
- /* @__PURE__ */ jsxRuntime.jsx(
99
- reablocks.Button,
100
- {
101
- title: "Upload",
102
- variant: "text",
103
- disabled: isLoading || disabled,
104
- className: reablocks.cn(theme.input.upload),
105
- onClick: () => {
106
- var _a;
107
- return (_a = fileInputRef.current) == null ? void 0 : _a.click();
108
- },
109
- children: attachIcon
110
- }
111
- )
112
- ] }),
130
+ (allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
131
+ FileInput,
132
+ {
133
+ allowedFiles,
134
+ onFileUpload: handleFileUpload,
135
+ isLoading,
136
+ disabled,
137
+ attachIcon
138
+ }
139
+ ),
113
140
  isLoading && /* @__PURE__ */ jsxRuntime.jsx(
114
141
  reablocks.Button,
115
142
  {
@@ -132,7 +159,7 @@
132
159
  )
133
160
  ] })
134
161
  ] });
135
- };
162
+ });
136
163
  const SessionEmpty = ({
137
164
  children
138
165
  }) => {
@@ -1245,7 +1272,7 @@
1245
1272
  const TableDataCell = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("td", { ...props, children });
1246
1273
  const Markdown = ({
1247
1274
  children,
1248
- remarkPlugins = [remarkGfm, remarkMath],
1275
+ remarkPlugins,
1249
1276
  rehypePlugins = [rehypeKatex]
1250
1277
  }) => {
1251
1278
  const { theme } = React.useContext(ChatContext);
@@ -1298,13 +1325,63 @@
1298
1325
  ];
1299
1326
  }
1300
1327
  }
1328
+ const SvgFile = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7036 1.37034C3.04741 1.02653 3.51373 0.833374 3.99996 0.833374H9.33329H9.33331C9.47275 0.833374 9.59885 0.890449 9.68954 0.98251L13.6843 4.97722C13.7763 5.0679 13.8333 5.19398 13.8333 5.33337L13.8333 5.3379V13.3334C13.8333 13.8196 13.6401 14.2859 13.2963 14.6297C12.9525 14.9736 12.4862 15.1667 12 15.1667H3.99996C3.51373 15.1667 3.04741 14.9736 2.7036 14.6297C2.35978 14.2859 2.16663 13.8196 2.16663 13.3334V2.66671C2.16663 2.18048 2.35978 1.71416 2.7036 1.37034ZM3.99996 1.83337H8.83331V5.33337C8.83331 5.60952 9.05717 5.83337 9.33331 5.83337H12.8333V13.3334C12.8333 13.5544 12.7455 13.7663 12.5892 13.9226C12.4329 14.0789 12.221 14.1667 12 14.1667H3.99996C3.77895 14.1667 3.56698 14.0789 3.4107 13.9226C3.25442 13.7663 3.16663 13.5544 3.16663 13.3334V2.66671C3.16663 2.44569 3.25442 2.23373 3.4107 2.07745C3.56698 1.92117 3.77895 1.83337 3.99996 1.83337ZM9.83331 2.5405L12.1262 4.83337H9.83331V2.5405ZM5.33331 8.16663C5.05717 8.16663 4.83331 8.39048 4.83331 8.66663C4.83331 8.94277 5.05717 9.16663 5.33331 9.16663H10.6666C10.9428 9.16663 11.1666 8.94277 11.1666 8.66663C11.1666 8.39048 10.9428 8.16663 10.6666 8.16663H5.33331ZM4.83331 11.3334C4.83331 11.0572 5.05717 10.8334 5.33331 10.8334H10.6666C10.9428 10.8334 11.1666 11.0572 11.1666 11.3334C11.1666 11.6095 10.9428 11.8334 10.6666 11.8334H5.33331C5.05717 11.8334 4.83331 11.6095 4.83331 11.3334ZM5.33331 5.5C5.05717 5.5 4.83331 5.72386 4.83331 6C4.83331 6.27614 5.05717 6.5 5.33331 6.5H6.66665C6.94279 6.5 7.16665 6.27614 7.16665 6C7.16665 5.72386 6.94279 5.5 6.66665 5.5H5.33331Z" }));
1329
+ const MessageFile = ({
1330
+ name,
1331
+ type,
1332
+ url,
1333
+ limit = 100,
1334
+ fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1335
+ }) => {
1336
+ const { theme } = React.useContext(ChatContext);
1337
+ const isImage = type == null ? void 0 : type.startsWith("image/");
1338
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1339
+ "figure",
1340
+ {
1341
+ className: reablocks.cn(theme.messages.message.files.file.base),
1342
+ onClick: () => {
1343
+ window.open(url, "_blank");
1344
+ },
1345
+ children: [
1346
+ isImage ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, className: "h-10 w-10" }) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fileIcon }),
1347
+ name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { children: name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: reablocks.cn(theme.messages.message.files.file.name), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) }) })
1348
+ ]
1349
+ }
1350
+ );
1351
+ };
1352
+ const MessageFiles = ({ files, children }) => {
1353
+ const { theme } = React.useContext(ChatContext);
1354
+ const Comp = children ? reactSlot.Slot : MessageFile;
1355
+ if (!files || files.length === 0) {
1356
+ return null;
1357
+ }
1358
+ return files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.files.base), children: files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...file, children }, index)) });
1359
+ };
1301
1360
  const MessageQuestion = ({
1302
1361
  question,
1362
+ files,
1303
1363
  children
1304
1364
  }) => {
1305
- const { theme, remarkPlugins = [remarkGfm, remarkYoutube] } = React.useContext(ChatContext);
1365
+ const { theme, remarkPlugins } = React.useContext(ChatContext);
1306
1366
  const Comp = children ? reactSlot.Slot : "div";
1307
- return /* @__PURE__ */ jsxRuntime.jsx(Comp, { className: reablocks.cn(theme.messages.message.question), children: children || /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }) });
1367
+ const [expanded, setExpanded] = React.useState(false);
1368
+ const isLong = question.length > 500;
1369
+ return /* @__PURE__ */ jsxRuntime.jsxs(Comp, { className: reablocks.cn(theme.messages.message.question, {
1370
+ [theme.messages.message.overlay]: isLong && !expanded
1371
+ }), children: [
1372
+ /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files }),
1373
+ children || /* @__PURE__ */ jsxRuntime.jsx(Markdown, { remarkPlugins, children: question }),
1374
+ isLong && !expanded && /* @__PURE__ */ jsxRuntime.jsx(
1375
+ reablocks.Button,
1376
+ {
1377
+ variant: "link",
1378
+ size: "small",
1379
+ className: theme.messages.message.expand,
1380
+ onClick: () => setExpanded(true),
1381
+ children: "Show more"
1382
+ }
1383
+ )
1384
+ ] });
1308
1385
  };
1309
1386
  const MessageResponse = ({
1310
1387
  response,
@@ -1314,7 +1391,7 @@
1314
1391
  const {
1315
1392
  theme,
1316
1393
  isCompact,
1317
- remarkPlugins = [remarkGfm, remarkYoutube]
1394
+ remarkPlugins
1318
1395
  } = React.useContext(ChatContext);
1319
1396
  const Comp = children ? reactSlot.Slot : "div";
1320
1397
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1340,38 +1417,6 @@
1340
1417
  }
1341
1418
  );
1342
1419
  };
1343
- const SvgFile = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2.7036 1.37034C3.04741 1.02653 3.51373 0.833374 3.99996 0.833374H9.33329H9.33331C9.47275 0.833374 9.59885 0.890449 9.68954 0.98251L13.6843 4.97722C13.7763 5.0679 13.8333 5.19398 13.8333 5.33337L13.8333 5.3379V13.3334C13.8333 13.8196 13.6401 14.2859 13.2963 14.6297C12.9525 14.9736 12.4862 15.1667 12 15.1667H3.99996C3.51373 15.1667 3.04741 14.9736 2.7036 14.6297C2.35978 14.2859 2.16663 13.8196 2.16663 13.3334V2.66671C2.16663 2.18048 2.35978 1.71416 2.7036 1.37034ZM3.99996 1.83337H8.83331V5.33337C8.83331 5.60952 9.05717 5.83337 9.33331 5.83337H12.8333V13.3334C12.8333 13.5544 12.7455 13.7663 12.5892 13.9226C12.4329 14.0789 12.221 14.1667 12 14.1667H3.99996C3.77895 14.1667 3.56698 14.0789 3.4107 13.9226C3.25442 13.7663 3.16663 13.5544 3.16663 13.3334V2.66671C3.16663 2.44569 3.25442 2.23373 3.4107 2.07745C3.56698 1.92117 3.77895 1.83337 3.99996 1.83337ZM9.83331 2.5405L12.1262 4.83337H9.83331V2.5405ZM5.33331 8.16663C5.05717 8.16663 4.83331 8.39048 4.83331 8.66663C4.83331 8.94277 5.05717 9.16663 5.33331 9.16663H10.6666C10.9428 9.16663 11.1666 8.94277 11.1666 8.66663C11.1666 8.39048 10.9428 8.16663 10.6666 8.16663H5.33331ZM4.83331 11.3334C4.83331 11.0572 5.05717 10.8334 5.33331 10.8334H10.6666C10.9428 10.8334 11.1666 11.0572 11.1666 11.3334C11.1666 11.6095 10.9428 11.8334 10.6666 11.8334H5.33331C5.05717 11.8334 4.83331 11.6095 4.83331 11.3334ZM5.33331 5.5C5.05717 5.5 4.83331 5.72386 4.83331 6C4.83331 6.27614 5.05717 6.5 5.33331 6.5H6.66665C6.94279 6.5 7.16665 6.27614 7.16665 6C7.16665 5.72386 6.94279 5.5 6.66665 5.5H5.33331Z" }));
1344
- const MessageFile = ({
1345
- name,
1346
- type,
1347
- url,
1348
- limit = 100,
1349
- fileIcon = /* @__PURE__ */ jsxRuntime.jsx(SvgFile, {})
1350
- }) => {
1351
- const { theme } = React.useContext(ChatContext);
1352
- const isImage = type == null ? void 0 : type.startsWith("image/");
1353
- return /* @__PURE__ */ jsxRuntime.jsxs(
1354
- "figure",
1355
- {
1356
- className: reablocks.cn(theme.messages.message.files.file.base),
1357
- onClick: () => {
1358
- window.open(url, "_blank");
1359
- },
1360
- children: [
1361
- isImage ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: url, className: "h-10 w-10" }) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fileIcon }),
1362
- name && /* @__PURE__ */ jsxRuntime.jsx("figcaption", { children: name && /* @__PURE__ */ jsxRuntime.jsx("span", { className: reablocks.cn(theme.messages.message.files.file.name), children: /* @__PURE__ */ jsxRuntime.jsx(reablocks.Ellipsis, { value: name, limit }) }) })
1363
- ]
1364
- }
1365
- );
1366
- };
1367
- const MessageFiles = ({ files, children }) => {
1368
- const { theme } = React.useContext(ChatContext);
1369
- const Comp = children ? reactSlot.Slot : MessageFile;
1370
- if (!files || files.length === 0) {
1371
- return null;
1372
- }
1373
- return files.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: reablocks.cn(theme.messages.message.files.base), children: files.map((file, index) => /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...file, children }, index)) });
1374
- };
1375
1420
  const MessageSource = ({ title, url, image, limit = 50 }) => {
1376
1421
  const { theme, isCompact } = React.useContext(ChatContext);
1377
1422
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -1503,8 +1548,7 @@ ${response}`),
1503
1548
  const { theme, isLoading } = React.useContext(ChatContext);
1504
1549
  return /* @__PURE__ */ jsxRuntime.jsxs(framerMotion.motion.div, { variants: messageVariants, children: [
1505
1550
  /* @__PURE__ */ jsxRuntime.jsx(reablocks.Card, { className: reablocks.cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1506
- /* @__PURE__ */ jsxRuntime.jsx(MessageFiles, { files: conversation.files }),
1507
- /* @__PURE__ */ jsxRuntime.jsx(MessageQuestion, { question: conversation.question }),
1551
+ /* @__PURE__ */ jsxRuntime.jsx(MessageQuestion, { question: conversation.question, files: conversation.files }),
1508
1552
  /* @__PURE__ */ jsxRuntime.jsx(
1509
1553
  MessageResponse,
1510
1554
  {
@@ -1635,11 +1679,13 @@ ${response}`),
1635
1679
  message: {
1636
1680
  base: "mt-4 mb-4 flex flex-col p-0 rounded border-none bg-transparent",
1637
1681
  question: [
1638
- "font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-gray-200 border-gray-300 text-gray-900",
1682
+ "relative font-semibold mb-4 px-4 py-4 pb-2 rounded-3xl rounded-br-none text-typography border bg-gray-200 border-gray-300 text-gray-900",
1639
1683
  "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1640
1684
  ].join(" "),
1641
- response: ["data-[compact=false]:px-4 text-gray-900", "dark:text-gray-100"].join(" "),
1685
+ response: ["relative data-[compact=false]:px-4 text-gray-900", "dark:text-gray-100"].join(" "),
1686
+ overlay: `overflow-y-hidden max-h-[350px] after:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:h-16 after:bg-gradient-to-b after:from-transparent dark:after:to-gray-900 after:to-gray-200`,
1642
1687
  cursor: "inline-block w-1 h-4 bg-current",
1688
+ expand: "absolute bottom-1 right-1 z-10",
1643
1689
  files: {
1644
1690
  base: "mb-2 flex flex-wrap gap-3 ",
1645
1691
  file: {
@@ -1738,7 +1784,7 @@ ${response}`),
1738
1784
  activeSessionId,
1739
1785
  theme: customTheme = chatTheme,
1740
1786
  onNewSession,
1741
- remarkPlugins,
1787
+ remarkPlugins = [remarkGfm, remarkYoutube, remarkMath],
1742
1788
  disabled,
1743
1789
  style,
1744
1790
  className
@@ -2004,6 +2050,7 @@ ${response}`),
2004
2050
  exports2.ChatContext = ChatContext;
2005
2051
  exports2.ChatInput = ChatInput;
2006
2052
  exports2.CodeHighlighter = CodeHighlighter;
2053
+ exports2.FileInput = FileInput;
2007
2054
  exports2.Markdown = Markdown;
2008
2055
  exports2.MessageActions = MessageActions;
2009
2056
  exports2.MessageFile = MessageFile;