reachat 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/AppBar/AppBar.d.ts +13 -0
  2. package/dist/AppBar/index.d.ts +1 -0
  3. package/dist/CSVFileRenderer-Cio05GLC.js +148 -0
  4. package/dist/CSVFileRenderer-Cio05GLC.js.map +1 -0
  5. package/dist/Chat.d.ts +2 -3
  6. package/dist/ChatBubble/ChatBubble.d.ts +31 -0
  7. package/dist/ChatBubble/index.d.ts +1 -0
  8. package/dist/ChatContext.d.ts +2 -3
  9. package/dist/ChatInput/ChatInput.d.ts +0 -1
  10. package/dist/ChatInput/FileInput.d.ts +0 -1
  11. package/dist/{DefaultFileRenderer-DZL5GRed.js → DefaultFileRenderer-C-vGWeXN.js} +2 -2
  12. package/dist/{DefaultFileRenderer-DZL5GRed.js.map → DefaultFileRenderer-C-vGWeXN.js.map} +1 -1
  13. package/dist/Markdown/CodeHighlighter.d.ts +0 -1
  14. package/dist/Markdown/Markdown.d.ts +3 -4
  15. package/dist/Markdown/Table.d.ts +0 -1
  16. package/dist/PDFFileRenderer-DQdFS2l6.js.map +1 -1
  17. package/dist/SessionMessages/SessionEmpty.d.ts +0 -1
  18. package/dist/SessionMessages/SessionMessage/MessageActions.d.ts +0 -1
  19. package/dist/SessionMessages/SessionMessage/MessageFile/MessageFile.d.ts +0 -1
  20. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/CSVFileRenderer.d.ts +0 -1
  21. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/DefaultFileRenderer.d.ts +0 -1
  22. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/ImageFileRenderer.d.ts +0 -1
  23. package/dist/SessionMessages/SessionMessage/MessageFile/renderers/PDFFileRenderer.d.ts +0 -1
  24. package/dist/SessionMessages/SessionMessage/MessageFiles.d.ts +0 -1
  25. package/dist/SessionMessages/SessionMessage/MessageQuestion.d.ts +0 -1
  26. package/dist/SessionMessages/SessionMessage/MessageResponse.d.ts +0 -1
  27. package/dist/SessionMessages/SessionMessage/MessageSource.d.ts +0 -1
  28. package/dist/SessionMessages/SessionMessage/MessageSources.d.ts +0 -1
  29. package/dist/SessionMessages/SessionMessage/SessionMessage.d.ts +0 -1
  30. package/dist/SessionMessages/SessionMessagePanel.d.ts +5 -2
  31. package/dist/SessionMessages/SessionMessages.d.ts +0 -1
  32. package/dist/SessionMessages/SessionMessagesHeader.d.ts +0 -1
  33. package/dist/SessionsList/NewSessionButton.d.ts +0 -1
  34. package/dist/SessionsList/SessionGroups.d.ts +0 -1
  35. package/dist/SessionsList/SessionListItem.d.ts +0 -1
  36. package/dist/SessionsList/SessionsGroup.d.ts +0 -1
  37. package/dist/SessionsList/SessionsList.d.ts +8 -2
  38. package/dist/docs.json +221 -5
  39. package/dist/{index-D-JgMn3h.js → index-B4HlLXxa.js} +98 -48
  40. package/dist/index-B4HlLXxa.js.map +1 -0
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +4 -2
  43. package/dist/index.js.map +1 -1
  44. package/dist/index.umd.cjs +252 -7523
  45. package/dist/index.umd.cjs.map +1 -1
  46. package/dist/theme.d.ts +1 -0
  47. package/dist/types.d.ts +19 -0
  48. package/dist/utils/grouping.d.ts +0 -1
  49. package/package.json +13 -12
  50. package/dist/CSVFileRenderer-6glCQ4gs.js +0 -7468
  51. package/dist/CSVFileRenderer-6glCQ4gs.js.map +0 -1
  52. package/dist/index-D-JgMn3h.js.map +0 -1
package/dist/docs.json CHANGED
@@ -140,7 +140,7 @@
140
140
  ],
141
141
  "required": false,
142
142
  "type": {
143
- "name": "PluggableList[]"
143
+ "name": "Plugin<[], Node, Node>[]"
144
144
  }
145
145
  },
146
146
  "isLoading": {
@@ -297,6 +297,180 @@
297
297
  }
298
298
  }
299
299
  },
300
+ {
301
+ "tags": {},
302
+ "filePath": "src/AppBar/AppBar.tsx",
303
+ "description": "",
304
+ "displayName": "AppBar",
305
+ "methods": [],
306
+ "props": {
307
+ "content": {
308
+ "defaultValue": null,
309
+ "description": "Content to display in the header",
310
+ "name": "content",
311
+ "parent": {
312
+ "fileName": "src/AppBar/AppBar.tsx",
313
+ "name": "AppBarProps"
314
+ },
315
+ "declarations": [
316
+ {
317
+ "fileName": "src/AppBar/AppBar.tsx",
318
+ "name": "AppBarProps"
319
+ }
320
+ ],
321
+ "required": false,
322
+ "type": {
323
+ "name": "ReactNode"
324
+ }
325
+ },
326
+ "theme": {
327
+ "defaultValue": null,
328
+ "description": "Custom theme for the appbar",
329
+ "name": "theme",
330
+ "parent": {
331
+ "fileName": "src/AppBar/AppBar.tsx",
332
+ "name": "AppBarProps"
333
+ },
334
+ "declarations": [
335
+ {
336
+ "fileName": "src/AppBar/AppBar.tsx",
337
+ "name": "AppBarProps"
338
+ }
339
+ ],
340
+ "required": false,
341
+ "type": {
342
+ "name": "ChatTheme"
343
+ }
344
+ }
345
+ }
346
+ },
347
+ {
348
+ "tags": {},
349
+ "filePath": "src/ChatBubble/ChatBubble.tsx",
350
+ "description": "",
351
+ "displayName": "ChatBubble",
352
+ "methods": [],
353
+ "props": {
354
+ "children": {
355
+ "defaultValue": null,
356
+ "description": "The main content to be rendered.",
357
+ "name": "children",
358
+ "parent": {
359
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
360
+ "name": "ChatBubbleProps"
361
+ },
362
+ "declarations": [
363
+ {
364
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
365
+ "name": "ChatBubbleProps"
366
+ }
367
+ ],
368
+ "required": true,
369
+ "type": {
370
+ "name": "ReactNode"
371
+ }
372
+ },
373
+ "bubbleContent": {
374
+ "defaultValue": null,
375
+ "description": "The content to be rendered in the trigger bubble.",
376
+ "name": "bubbleContent",
377
+ "parent": {
378
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
379
+ "name": "ChatBubbleProps"
380
+ },
381
+ "declarations": [
382
+ {
383
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
384
+ "name": "ChatBubbleProps"
385
+ }
386
+ ],
387
+ "required": true,
388
+ "type": {
389
+ "name": "ReactNode"
390
+ }
391
+ },
392
+ "position": {
393
+ "defaultValue": {
394
+ "value": "'bottom-left'"
395
+ },
396
+ "description": "The position of the chat bubble on the screen.",
397
+ "name": "position",
398
+ "parent": {
399
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
400
+ "name": "ChatBubbleProps"
401
+ },
402
+ "declarations": [
403
+ {
404
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
405
+ "name": "ChatBubbleProps"
406
+ }
407
+ ],
408
+ "required": false,
409
+ "type": {
410
+ "name": "Position"
411
+ }
412
+ },
413
+ "customPosition": {
414
+ "defaultValue": null,
415
+ "description": "Custom CSS styles to override the default positioning.",
416
+ "name": "customPosition",
417
+ "parent": {
418
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
419
+ "name": "ChatBubbleProps"
420
+ },
421
+ "declarations": [
422
+ {
423
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
424
+ "name": "ChatBubbleProps"
425
+ }
426
+ ],
427
+ "required": false,
428
+ "type": {
429
+ "name": "CSSProperties"
430
+ }
431
+ },
432
+ "portalTarget": {
433
+ "defaultValue": {
434
+ "value": "document.body"
435
+ },
436
+ "description": "The DOM element where the chat bubble should be rendered.",
437
+ "name": "portalTarget",
438
+ "parent": {
439
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
440
+ "name": "ChatBubbleProps"
441
+ },
442
+ "declarations": [
443
+ {
444
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
445
+ "name": "ChatBubbleProps"
446
+ }
447
+ ],
448
+ "required": false,
449
+ "type": {
450
+ "name": "HTMLElement"
451
+ }
452
+ },
453
+ "className": {
454
+ "defaultValue": null,
455
+ "description": "Additional CSS classes to apply to the chat bubble.",
456
+ "name": "className",
457
+ "parent": {
458
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
459
+ "name": "ChatBubbleProps"
460
+ },
461
+ "declarations": [
462
+ {
463
+ "fileName": "src/ChatBubble/ChatBubble.tsx",
464
+ "name": "ChatBubbleProps"
465
+ }
466
+ ],
467
+ "required": false,
468
+ "type": {
469
+ "name": "string"
470
+ }
471
+ }
472
+ }
473
+ },
300
474
  {
301
475
  "tags": {},
302
476
  "filePath": "src/ChatInput/ChatInput.tsx",
@@ -680,7 +854,7 @@
680
854
  ],
681
855
  "required": false,
682
856
  "type": {
683
- "name": "PluggableList[]"
857
+ "name": "Plugin<[], Node, Node>[]"
684
858
  }
685
859
  },
686
860
  "rehypePlugins": {
@@ -701,7 +875,7 @@
701
875
  ],
702
876
  "required": false,
703
877
  "type": {
704
- "name": "PluggableList[]"
878
+ "name": "Plugin<[], Node, Node>[]"
705
879
  }
706
880
  }
707
881
  }
@@ -744,7 +918,29 @@
744
918
  "description": "",
745
919
  "displayName": "SessionMessagePanel",
746
920
  "methods": [],
747
- "props": {}
921
+ "props": {
922
+ "allowBack": {
923
+ "defaultValue": {
924
+ "value": "true"
925
+ },
926
+ "description": "",
927
+ "name": "allowBack",
928
+ "parent": {
929
+ "fileName": "src/SessionMessages/SessionMessagePanel.tsx",
930
+ "name": "SessionMessagePanelProps"
931
+ },
932
+ "declarations": [
933
+ {
934
+ "fileName": "src/SessionMessages/SessionMessagePanel.tsx",
935
+ "name": "SessionMessagePanelProps"
936
+ }
937
+ ],
938
+ "required": false,
939
+ "type": {
940
+ "name": "boolean"
941
+ }
942
+ }
943
+ }
748
944
  },
749
945
  {
750
946
  "tags": {},
@@ -1047,7 +1243,27 @@
1047
1243
  "description": "",
1048
1244
  "displayName": "SessionsList",
1049
1245
  "methods": [],
1050
- "props": {}
1246
+ "props": {
1247
+ "templates": {
1248
+ "defaultValue": null,
1249
+ "description": "Templates to show when no session is active",
1250
+ "name": "templates",
1251
+ "parent": {
1252
+ "fileName": "src/SessionsList/SessionsList.tsx",
1253
+ "name": "SessionsListProps"
1254
+ },
1255
+ "declarations": [
1256
+ {
1257
+ "fileName": "src/SessionsList/SessionsList.tsx",
1258
+ "name": "SessionsListProps"
1259
+ }
1260
+ ],
1261
+ "required": false,
1262
+ "type": {
1263
+ "name": "Template[]"
1264
+ }
1265
+ }
1266
+ }
1051
1267
  },
1052
1268
  {
1053
1269
  "tags": {},
@@ -1,7 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { createContext, useContext, useRef, forwardRef, useState, useEffect, useImperativeHandle, lazy, useMemo, Suspense, useCallback } from "react";
4
- import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, List, ListItem } from "reablocks";
4
+ import { Button, cn, Textarea, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, ListItem, List } from "reablocks";
5
5
  import { Slot } from "@radix-ui/react-slot";
6
6
  import { motion, AnimatePresence } from "motion/react";
7
7
  import ReactMarkdown from "react-markdown";
@@ -12,7 +12,7 @@ import { useHotkeys } from "reakeys";
12
12
  import remarkGfm from "remark-gfm";
13
13
  import remarkYoutube from "remark-youtube";
14
14
  import remarkMath from "remark-math";
15
- import { isToday, isYesterday, isThisWeek, isThisMonth, isThisYear, format } from "date-fns";
15
+ import { isToday, isYesterday, isThisWeek, differenceInYears, format } from "date-fns";
16
16
  const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "send" }, /* @__PURE__ */ React.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" })));
17
17
  const SvgStop = (props) => /* @__PURE__ */ React.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.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React.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.createElement("path", { d: "m9 9 6 6" }));
18
18
  const ChatContext = createContext({
@@ -171,7 +171,10 @@ const SessionMessagesHeader = ({ children }) => {
171
171
  ] }) });
172
172
  };
173
173
  const SvgBack = (props) => /* @__PURE__ */ React.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-chevron-left", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m15 18-6-6 6-6" }));
174
- const SessionMessagePanel = ({ children }) => {
174
+ const SessionMessagePanel = ({
175
+ children,
176
+ allowBack = true
177
+ }) => {
175
178
  const { activeSessionId, theme, isCompact, selectSession, viewType } = useContext(ChatContext);
176
179
  const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
177
180
  return isVisible && /* @__PURE__ */ jsx(
@@ -193,7 +196,7 @@ const SessionMessagePanel = ({ children }) => {
193
196
  [theme.messages.console]: !isCompact
194
197
  }),
195
198
  children: /* @__PURE__ */ jsxs("div", { className: cn(theme.messages.inner), children: [
196
- isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
199
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
197
200
  Button,
198
201
  {
199
202
  variant: "text",
@@ -1279,9 +1282,27 @@ const Markdown = ({
1279
1282
  toolbarClassName: cn(theme.messages.message.markdown.toolbar)
1280
1283
  }
1281
1284
  ),
1282
- table: (props) => /* @__PURE__ */ jsx(TableComponent, { ...props, className: cn(theme.messages.message.markdown.table) }),
1283
- th: (props) => /* @__PURE__ */ jsx(TableHeaderCell, { ...props, className: cn(theme.messages.message.markdown.th) }),
1284
- td: (props) => /* @__PURE__ */ jsx(TableDataCell, { ...props, className: cn(theme.messages.message.markdown.td) }),
1285
+ table: (props) => /* @__PURE__ */ jsx(
1286
+ TableComponent,
1287
+ {
1288
+ ...props,
1289
+ className: cn(theme.messages.message.markdown.table)
1290
+ }
1291
+ ),
1292
+ th: (props) => /* @__PURE__ */ jsx(
1293
+ TableHeaderCell,
1294
+ {
1295
+ ...props,
1296
+ className: cn(theme.messages.message.markdown.th)
1297
+ }
1298
+ ),
1299
+ td: (props) => /* @__PURE__ */ jsx(
1300
+ TableDataCell,
1301
+ {
1302
+ ...props,
1303
+ className: cn(theme.messages.message.markdown.td)
1304
+ }
1305
+ ),
1285
1306
  a: (props) => /* @__PURE__ */ jsx("a", { ...props, className: cn(theme.messages.message.markdown.a) }),
1286
1307
  p: (props) => /* @__PURE__ */ jsx("p", { ...props, className: cn(theme.messages.message.markdown.p) }),
1287
1308
  li: (props) => /* @__PURE__ */ jsx("li", { ...props, className: cn(theme.messages.message.markdown.li) }),
@@ -1313,8 +1334,8 @@ function remarkCve() {
1313
1334
  }
1314
1335
  }
1315
1336
  const SvgFile = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", ...props }, /* @__PURE__ */ React.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" }));
1316
- const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-DZL5GRed.js"));
1317
- const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-6glCQ4gs.js"));
1337
+ const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-C-vGWeXN.js"));
1338
+ const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-Cio05GLC.js"));
1318
1339
  const ImageFileRenderer = lazy(() => import("./ImageFileRenderer-C8tVW3I8.js"));
1319
1340
  const PDFFileRenderer = lazy(() => import("./PDFFileRenderer-DQdFS2l6.js"));
1320
1341
  const FILE_TYPE_RENDERER_MAP = {
@@ -1447,11 +1468,7 @@ const MessageResponse = ({
1447
1468
  isLoading,
1448
1469
  children
1449
1470
  }) => {
1450
- const {
1451
- theme,
1452
- isCompact,
1453
- remarkPlugins
1454
- } = useContext(ChatContext);
1471
+ const { theme, isCompact, remarkPlugins } = useContext(ChatContext);
1455
1472
  const Comp = children ? Slot : "div";
1456
1473
  return /* @__PURE__ */ jsx(
1457
1474
  Comp,
@@ -1707,6 +1724,7 @@ const chatTheme = {
1707
1724
  console: "flex w-full gap-4 h-full",
1708
1725
  companion: "w-full h-full overflow-hidden",
1709
1726
  empty: "text-center flex-1",
1727
+ appbar: "flex p-5",
1710
1728
  sessions: {
1711
1729
  base: "overflow-auto",
1712
1730
  console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
@@ -1748,7 +1766,10 @@ const chatTheme = {
1748
1766
  "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",
1749
1767
  "dark:bg-gray-900/60 dark:border-gray-700/50 dark:text-gray-100"
1750
1768
  ].join(" "),
1751
- response: ["relative data-[compact=false]:px-4 text-gray-900", "dark:text-gray-100"].join(" "),
1769
+ response: [
1770
+ "relative data-[compact=false]:px-4 text-gray-900",
1771
+ "dark:text-gray-100"
1772
+ ].join(" "),
1752
1773
  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`,
1753
1774
  cursor: "inline-block w-1 h-4 bg-current",
1754
1775
  expand: "absolute bottom-1 right-1 z-10",
@@ -1944,31 +1965,6 @@ const Chat = ({
1944
1965
  }
1945
1966
  ) }) });
1946
1967
  };
1947
- const SessionsList = ({ children }) => {
1948
- const { theme, isCompact, activeSessionId } = useContext(ChatContext);
1949
- const isVisible = isCompact && !activeSessionId;
1950
- return (!isCompact || isVisible) && /* @__PURE__ */ jsx(
1951
- motion.div,
1952
- {
1953
- initial: { translateX: "-100%" },
1954
- animate: {
1955
- translateX: "0%",
1956
- transition: {
1957
- type: "tween",
1958
- ease: "linear",
1959
- duration: 0.2,
1960
- when: "beforeChildren"
1961
- }
1962
- },
1963
- exit: { translateX: "-100%" },
1964
- className: cn(theme.sessions.base, {
1965
- [theme.sessions.companion]: isCompact,
1966
- [theme.sessions.console]: !isCompact
1967
- }),
1968
- children: /* @__PURE__ */ jsx(List, { children })
1969
- }
1970
- );
1971
- };
1972
1968
  const SvgTrash = (props) => /* @__PURE__ */ React.createElement("svg", { width: 14, height: 14, viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "Delete" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M5.97905 1.16666C5.90859 1.16576 5.83895 1.18189 5.77605 1.21368C5.71316 1.24547 5.65888 1.29199 5.61783 1.34926C5.57677 1.40654 5.55016 1.47288 5.54025 1.54265C5.53034 1.61242 5.53743 1.68355 5.56092 1.75H4.27007C3.7342 1.75 3.2324 2.01817 2.93535 2.46435L2.24492 3.5H2.18738C2.12941 3.49918 2.07185 3.50989 2.01805 3.5315C1.96425 3.55312 1.91529 3.58522 1.874 3.62593C1.83271 3.66663 1.79993 3.71514 1.77755 3.76863C1.75518 3.82211 1.74365 3.87952 1.74365 3.9375C1.74365 3.99548 1.75518 4.05288 1.77755 4.10636C1.79993 4.15985 1.83271 4.20836 1.874 4.24907C1.91529 4.28977 1.96425 4.32187 2.01805 4.34349C2.07185 4.3651 2.12941 4.37582 2.18738 4.375H2.41012C2.44765 4.38067 2.48576 4.38143 2.52348 4.37727L3.24468 11.1084C3.33169 11.9199 4.02367 12.5417 4.83973 12.5417H9.15947C9.97553 12.5417 10.6675 11.9199 10.7545 11.1084L11.4763 4.37727C11.5133 4.38124 11.5506 4.38047 11.5874 4.375H11.8124C11.8704 4.37582 11.9279 4.3651 11.9817 4.34349C12.0355 4.32187 12.0845 4.28977 12.1258 4.24907C12.1671 4.20836 12.1998 4.15985 12.2222 4.10636C12.2446 4.05288 12.2561 3.99548 12.2561 3.9375C12.2561 3.87952 12.2446 3.82211 12.2222 3.76863C12.1998 3.71514 12.1671 3.66663 12.1258 3.62593C12.0845 3.58522 12.0355 3.55312 11.9817 3.5315C11.9279 3.50989 11.8704 3.49918 11.8124 3.5H11.7548L11.0644 2.46435C10.7671 2.01841 10.2654 1.75 9.7297 1.75H8.43885C8.46234 1.68355 8.46943 1.61242 8.45952 1.54265C8.44961 1.47288 8.423 1.40654 8.38194 1.34926C8.34089 1.29199 8.2866 1.24547 8.22371 1.21368C8.16082 1.18189 8.09118 1.16576 8.02072 1.16666H5.97905ZM4.27007 2.625H9.7297C9.97394 2.625 10.2009 2.74639 10.3364 2.9497L10.7033 3.5H3.29651L3.66338 2.9497L3.66395 2.94913C3.79913 2.74608 4.02543 2.625 4.27007 2.625ZM3.40361 4.375H10.5962L9.88465 11.015C9.8445 11.3894 9.53575 11.6667 9.15947 11.6667H4.83973C4.46345 11.6667 4.15527 11.3894 4.11512 11.015L3.40361 4.375Z", fill: "currentColor" })));
1973
1969
  const SvgChat = (props) => /* @__PURE__ */ React.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
1974
1970
  const SessionListItem = ({
@@ -2009,6 +2005,48 @@ const SessionListItem = ({
2009
2005
  }
2010
2006
  );
2011
2007
  };
2008
+ const SessionsList = ({
2009
+ children,
2010
+ templates
2011
+ }) => {
2012
+ const { theme, isCompact, activeSessionId, createSession } = useContext(ChatContext);
2013
+ const isVisible = isCompact && !activeSessionId;
2014
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxs(
2015
+ motion.div,
2016
+ {
2017
+ initial: { translateX: "-100%" },
2018
+ animate: {
2019
+ translateX: "0%",
2020
+ transition: {
2021
+ type: "tween",
2022
+ ease: "linear",
2023
+ duration: 0.2,
2024
+ when: "beforeChildren"
2025
+ }
2026
+ },
2027
+ exit: { translateX: "-100%" },
2028
+ className: cn(theme.sessions.base, {
2029
+ [theme.sessions.companion]: isCompact,
2030
+ [theme.sessions.console]: !isCompact
2031
+ }),
2032
+ children: [
2033
+ /* @__PURE__ */ jsx(List, { children }),
2034
+ templates && !activeSessionId && /* @__PURE__ */ jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsx(
2035
+ SessionListItem,
2036
+ {
2037
+ session: {
2038
+ id: template.id,
2039
+ title: template.title,
2040
+ conversations: []
2041
+ },
2042
+ chatIcon: template.icon,
2043
+ deletable: false
2044
+ }
2045
+ ) }, template.id)) })
2046
+ ]
2047
+ }
2048
+ );
2049
+ };
2012
2050
  const SvgPlus = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "add" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M13.1667 9.16658H9.16671V13.1666H7.83337V9.16658H3.83337V7.83325H7.83337V3.83325H9.16671V7.83325H13.1667V9.16658Z", fill: "currentColor" })));
2013
2051
  const NewSessionButton = ({
2014
2052
  children,
@@ -2053,6 +2091,7 @@ function groupSessionsByDate(sessions) {
2053
2091
  const grouped = {};
2054
2092
  sessions.forEach((session) => {
2055
2093
  const createdAt = new Date(session.createdAt);
2094
+ const now = /* @__PURE__ */ new Date();
2056
2095
  if (isToday(createdAt)) {
2057
2096
  if (!grouped["Today"]) grouped["Today"] = [];
2058
2097
  grouped["Today"].push(session);
@@ -2062,13 +2101,16 @@ function groupSessionsByDate(sessions) {
2062
2101
  } else if (isThisWeek(createdAt)) {
2063
2102
  if (!grouped["Last Week"]) grouped["Last Week"] = [];
2064
2103
  grouped["Last Week"].push(session);
2065
- } else if (isThisMonth(createdAt)) {
2066
- if (!grouped["Last Month"]) grouped["Last Month"] = [];
2067
- grouped["Last Month"].push(session);
2068
- } else if (isThisYear(createdAt)) {
2069
- const monthName = format(createdAt, "MMMM");
2070
- if (!grouped[monthName]) grouped[monthName] = [];
2071
- grouped[monthName].push(session);
2104
+ } else if (differenceInYears(now, createdAt) === 0) {
2105
+ const monthDiff = now.getMonth() - createdAt.getMonth();
2106
+ if (monthDiff === 1 || monthDiff === 0 && now.getDate() > createdAt.getDate()) {
2107
+ if (!grouped["Last Month"]) grouped["Last Month"] = [];
2108
+ grouped["Last Month"].push(session);
2109
+ } else {
2110
+ const monthName = format(createdAt, "MMMM");
2111
+ if (!grouped[monthName]) grouped[monthName] = [];
2112
+ grouped[monthName].push(session);
2113
+ }
2072
2114
  } else {
2073
2115
  if (!grouped["Last Year"]) grouped["Last Year"] = [];
2074
2116
  grouped["Last Year"].push(session);
@@ -2112,7 +2154,15 @@ const SessionGroups = ({ children }) => {
2112
2154
  const groups = useMemo(() => groupSessionsByDate(sessions), [sessions]);
2113
2155
  return /* @__PURE__ */ jsx(Fragment, { children: children ? children(groups) : groups.map(({ heading, sessions: sessions2 }) => /* @__PURE__ */ jsx(SessionsGroup, { heading, children: sessions2.map((session) => /* @__PURE__ */ jsx(SessionListItem, { session }, session.id)) })) });
2114
2156
  };
2157
+ const AppBar = ({
2158
+ content,
2159
+ theme: customTheme = chatTheme
2160
+ }) => {
2161
+ const theme = useComponentTheme("chat", customTheme);
2162
+ return /* @__PURE__ */ jsx("div", { className: cn(theme.appbar), children: content });
2163
+ };
2115
2164
  export {
2165
+ AppBar as A,
2116
2166
  ChatInput as C,
2117
2167
  FileInput as F,
2118
2168
  MessageSource as M,
@@ -2146,4 +2196,4 @@ export {
2146
2196
  light as y,
2147
2197
  ChatContext as z
2148
2198
  };
2149
- //# sourceMappingURL=index-D-JgMn3h.js.map
2199
+ //# sourceMappingURL=index-B4HlLXxa.js.map