@aigentyc/chat-sdk 0.4.0 → 0.5.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.
Files changed (118) hide show
  1. package/context7.json +1 -1
  2. package/dist/{ChatInterface-0rq8D5-8.d.cts → ChatInterface-DrzYAWnG.d.cts} +1 -1
  3. package/dist/{ChatInterface--yaDB5yp.d.ts → ChatInterface-qiVhkmx3.d.ts} +1 -1
  4. package/dist/{SlotsContext-CWTjP0mA.d.ts → SlotsContext-B_087V7B.d.ts} +99 -5
  5. package/dist/{SlotsContext-u5CFB7MS.d.cts → SlotsContext-DAQiASVu.d.cts} +99 -5
  6. package/dist/ai-elements.cjs +164 -567
  7. package/dist/ai-elements.cjs.map +1 -1
  8. package/dist/ai-elements.d.cts +10 -2
  9. package/dist/ai-elements.d.ts +10 -2
  10. package/dist/ai-elements.js +17 -462
  11. package/dist/ai-elements.js.map +1 -1
  12. package/dist/{chunk-LSKOJ7SH.js → chunk-3H4CX3MS.js} +8 -5
  13. package/dist/chunk-3H4CX3MS.js.map +1 -0
  14. package/dist/{chunk-4WOBNRRB.cjs → chunk-6CVBJ4EI.cjs} +594 -10
  15. package/dist/chunk-6CVBJ4EI.cjs.map +1 -0
  16. package/dist/{chunk-3MP2EGEJ.cjs → chunk-72QJ2ORD.cjs} +4 -2
  17. package/dist/chunk-72QJ2ORD.cjs.map +1 -0
  18. package/dist/chunk-BYTPAQ7F.js +70 -0
  19. package/dist/chunk-BYTPAQ7F.js.map +1 -0
  20. package/dist/{chunk-P3RPAI4F.cjs → chunk-BYX6IOGX.cjs} +4 -4
  21. package/dist/{chunk-P3RPAI4F.cjs.map → chunk-BYX6IOGX.cjs.map} +1 -1
  22. package/dist/{chunk-B27JIQ4Z.js → chunk-CNGIOCLR.js} +577 -7
  23. package/dist/chunk-CNGIOCLR.js.map +1 -0
  24. package/dist/chunk-CNPYBLLT.js +81 -0
  25. package/dist/chunk-CNPYBLLT.js.map +1 -0
  26. package/dist/{chunk-6ZZTTD5E.js → chunk-CW6LCVNC.js} +3 -3
  27. package/dist/{chunk-6ZZTTD5E.js.map → chunk-CW6LCVNC.js.map} +1 -1
  28. package/dist/chunk-DDATCJ3O.cjs +75 -0
  29. package/dist/chunk-DDATCJ3O.cjs.map +1 -0
  30. package/dist/{chunk-LVWSWTI3.cjs → chunk-DTOOWY2S.cjs} +184 -74
  31. package/dist/chunk-DTOOWY2S.cjs.map +1 -0
  32. package/dist/{chunk-NYQSM3EB.cjs → chunk-DVWX2UGY.cjs} +16 -2
  33. package/dist/chunk-DVWX2UGY.cjs.map +1 -0
  34. package/dist/{chunk-TZ7EM3EG.cjs → chunk-EMVZ7HWM.cjs} +44 -2
  35. package/dist/chunk-EMVZ7HWM.cjs.map +1 -0
  36. package/dist/{chunk-3EN3DMUL.js → chunk-JAEXKKSE.js} +47 -38
  37. package/dist/chunk-JAEXKKSE.js.map +1 -0
  38. package/dist/{chunk-JHWSG5IB.js → chunk-JAOD6CNW.js} +38 -3
  39. package/dist/chunk-JAOD6CNW.js.map +1 -0
  40. package/dist/{chunk-OEEDYJTV.cjs → chunk-JEK2V5I3.cjs} +6 -6
  41. package/dist/{chunk-OEEDYJTV.cjs.map → chunk-JEK2V5I3.cjs.map} +1 -1
  42. package/dist/{chunk-QYCEHFAB.js → chunk-LDQVDUUJ.js} +4 -2
  43. package/dist/chunk-LDQVDUUJ.js.map +1 -0
  44. package/dist/{chunk-AWRQSM42.cjs → chunk-NBZDBH4M.cjs} +8 -5
  45. package/dist/chunk-NBZDBH4M.cjs.map +1 -0
  46. package/dist/{chunk-5F3O3ZJH.js → chunk-P7UR37HP.js} +17 -4
  47. package/dist/chunk-P7UR37HP.js.map +1 -0
  48. package/dist/{chunk-3KSMOHNY.js → chunk-R3TYC66R.js} +46 -81
  49. package/dist/chunk-R3TYC66R.js.map +1 -0
  50. package/dist/{chunk-RAQVW2D7.js → chunk-UTEGHMBN.js} +142 -33
  51. package/dist/chunk-UTEGHMBN.js.map +1 -0
  52. package/dist/{chunk-46MUOYPR.cjs → chunk-UXVOUC2A.cjs} +47 -38
  53. package/dist/chunk-UXVOUC2A.cjs.map +1 -0
  54. package/dist/{chunk-IU7Q7O5G.js → chunk-VQPOUMBC.js} +3 -3
  55. package/dist/{chunk-IU7Q7O5G.js.map → chunk-VQPOUMBC.js.map} +1 -1
  56. package/dist/chunk-VYBHYFG3.cjs +87 -0
  57. package/dist/chunk-VYBHYFG3.cjs.map +1 -0
  58. package/dist/{chunk-OU5OZKYH.cjs → chunk-Y4B45DW4.cjs} +48 -90
  59. package/dist/chunk-Y4B45DW4.cjs.map +1 -0
  60. package/dist/components.cjs +22 -21
  61. package/dist/components.cjs.map +1 -1
  62. package/dist/components.d.cts +3 -3
  63. package/dist/components.d.ts +3 -3
  64. package/dist/components.js +10 -9
  65. package/dist/components.js.map +1 -1
  66. package/dist/core.cjs +21 -82
  67. package/dist/core.cjs.map +1 -1
  68. package/dist/core.d.cts +2 -2
  69. package/dist/core.d.ts +2 -2
  70. package/dist/core.js +2 -78
  71. package/dist/core.js.map +1 -1
  72. package/dist/hooks.cjs +36 -14
  73. package/dist/hooks.cjs.map +1 -1
  74. package/dist/hooks.d.cts +2 -2
  75. package/dist/hooks.d.ts +2 -2
  76. package/dist/hooks.js +7 -5
  77. package/dist/hooks.js.map +1 -1
  78. package/dist/i18n.cjs +5 -5
  79. package/dist/i18n.d.cts +2 -2
  80. package/dist/i18n.d.ts +2 -2
  81. package/dist/i18n.js +1 -1
  82. package/dist/index.cjs +61 -35
  83. package/dist/index.cjs.map +1 -1
  84. package/dist/index.d.cts +15 -5
  85. package/dist/index.d.ts +15 -5
  86. package/dist/index.js +16 -14
  87. package/dist/index.js.map +1 -1
  88. package/dist/llms-full.txt +10 -10
  89. package/dist/styles.css +1 -1
  90. package/dist/theme.cjs +4 -4
  91. package/dist/theme.d.cts +1 -1
  92. package/dist/theme.d.ts +1 -1
  93. package/dist/theme.js +2 -2
  94. package/dist/tools.cjs +6 -5
  95. package/dist/tools.d.cts +2 -2
  96. package/dist/tools.d.ts +2 -2
  97. package/dist/tools.js +3 -2
  98. package/dist/{types-DQCjs81O.d.cts → types-DRa1zFlN.d.cts} +33 -1
  99. package/dist/{types-DQCjs81O.d.ts → types-DRa1zFlN.d.ts} +33 -1
  100. package/dist/ui.cjs +52 -52
  101. package/dist/ui.js +2 -2
  102. package/package.json +2 -2
  103. package/dist/chunk-3EN3DMUL.js.map +0 -1
  104. package/dist/chunk-3KSMOHNY.js.map +0 -1
  105. package/dist/chunk-3MP2EGEJ.cjs.map +0 -1
  106. package/dist/chunk-46MUOYPR.cjs.map +0 -1
  107. package/dist/chunk-4WOBNRRB.cjs.map +0 -1
  108. package/dist/chunk-5F3O3ZJH.js.map +0 -1
  109. package/dist/chunk-AWRQSM42.cjs.map +0 -1
  110. package/dist/chunk-B27JIQ4Z.js.map +0 -1
  111. package/dist/chunk-JHWSG5IB.js.map +0 -1
  112. package/dist/chunk-LSKOJ7SH.js.map +0 -1
  113. package/dist/chunk-LVWSWTI3.cjs.map +0 -1
  114. package/dist/chunk-NYQSM3EB.cjs.map +0 -1
  115. package/dist/chunk-OU5OZKYH.cjs.map +0 -1
  116. package/dist/chunk-QYCEHFAB.js.map +0 -1
  117. package/dist/chunk-RAQVW2D7.js.map +0 -1
  118. package/dist/chunk-TZ7EM3EG.cjs.map +0 -1
@@ -1,13 +1,17 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk3MP2EGEJ_cjs = require('./chunk-3MP2EGEJ.cjs');
5
- var chunkTZ7EM3EG_cjs = require('./chunk-TZ7EM3EG.cjs');
4
+ var chunk72QJ2ORD_cjs = require('./chunk-72QJ2ORD.cjs');
5
+ var chunkEMVZ7HWM_cjs = require('./chunk-EMVZ7HWM.cjs');
6
6
  var chunk525KS5HM_cjs = require('./chunk-525KS5HM.cjs');
7
7
  var lucideReact = require('lucide-react');
8
8
  var react = require('react');
9
9
  var useStickToBottom = require('use-stick-to-bottom');
10
10
  var jsxRuntime = require('react/jsx-runtime');
11
+ var reactSlot = require('@radix-ui/react-slot');
12
+ var classVarianceAuthority = require('class-variance-authority');
13
+ var reactDom = require('react-dom');
14
+ var streamdown = require('streamdown');
11
15
 
12
16
  var Conversation = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
13
17
  useStickToBottom.StickToBottom,
@@ -62,7 +66,7 @@ var ConversationScrollButton = ({
62
66
  scrollToBottom();
63
67
  }, [scrollToBottom]);
64
68
  return !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
65
- chunkTZ7EM3EG_cjs.Button,
69
+ chunkEMVZ7HWM_cjs.Button,
66
70
  {
67
71
  className: chunk525KS5HM_cjs.cn(
68
72
  "absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",
@@ -153,7 +157,7 @@ function MessageFeedback({
153
157
  classNames,
154
158
  renderActions
155
159
  }) {
156
- const { t } = chunk3MP2EGEJ_cjs.useI18n();
160
+ const { t } = chunk72QJ2ORD_cjs.useI18n();
157
161
  const [feedback, setFeedback] = react.useState(null);
158
162
  const [showReviewForm, setShowReviewForm] = react.useState(false);
159
163
  const [reviewType, setReviewType] = react.useState(null);
@@ -336,7 +340,7 @@ function MessageFeedback({
336
340
  type.value
337
341
  )) }),
338
342
  /* @__PURE__ */ jsxRuntime.jsx(
339
- chunkTZ7EM3EG_cjs.Textarea,
343
+ chunkEMVZ7HWM_cjs.Textarea,
340
344
  {
341
345
  placeholder: t("addDetails"),
342
346
  value: reviewText,
@@ -385,6 +389,572 @@ function MessageFeedback({
385
389
  ` })
386
390
  ] });
387
391
  }
392
+ var buttonGroupVariants = classVarianceAuthority.cva(
393
+ "flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
394
+ {
395
+ variants: {
396
+ orientation: {
397
+ horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
398
+ vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"
399
+ }
400
+ },
401
+ defaultVariants: {
402
+ orientation: "horizontal"
403
+ }
404
+ }
405
+ );
406
+ function ButtonGroup({
407
+ className,
408
+ orientation,
409
+ ...props
410
+ }) {
411
+ return /* @__PURE__ */ jsxRuntime.jsx(
412
+ "div",
413
+ {
414
+ role: "group",
415
+ "data-slot": "button-group",
416
+ "data-orientation": orientation,
417
+ className: chunk525KS5HM_cjs.cn(buttonGroupVariants({ orientation }), className),
418
+ ...props
419
+ }
420
+ );
421
+ }
422
+ function ButtonGroupText({
423
+ className,
424
+ asChild = false,
425
+ ...props
426
+ }) {
427
+ const Comp = asChild ? reactSlot.Slot : "div";
428
+ return /* @__PURE__ */ jsxRuntime.jsx(
429
+ Comp,
430
+ {
431
+ className: chunk525KS5HM_cjs.cn(
432
+ "bg-muted shadow-xs flex items-center gap-2 rounded-md border px-4 text-sm font-medium [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
433
+ className
434
+ ),
435
+ ...props
436
+ }
437
+ );
438
+ }
439
+ var Message = ({ className, from, fullWidth, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
440
+ "div",
441
+ {
442
+ className: chunk525KS5HM_cjs.cn(
443
+ "group flex w-full flex-col gap-2",
444
+ fullWidth ? "" : from === "assistant" ? "max-w-[var(--ac-assistant-max-width,95%)]" : "max-w-[95%]",
445
+ from === "user" ? "is-user justify-end" : "is-assistant",
446
+ className
447
+ ),
448
+ ...props
449
+ }
450
+ );
451
+ var MessageContent = ({
452
+ children,
453
+ className,
454
+ fullWidth,
455
+ ...props
456
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
457
+ "div",
458
+ {
459
+ className: chunk525KS5HM_cjs.cn(
460
+ "flex min-w-0 flex-col gap-2 overflow-hidden",
461
+ fullWidth ? "w-full" : "w-fit max-w-full",
462
+ "group-[.is-user]:ml-auto group-[.is-user]:px-6 group-[.is-user]:py-4 group-[.is-user]:text-foreground group-[.is-user]:rounded-bl-[24px] group-[.is-user]:rounded-br-[24px] group-[.is-user]:rounded-tl-[4px] group-[.is-user]:rounded-tr-[24px] group-[.is-user]:bg-[var(--ac-user-bubble-bg,#f0f4f8)]",
463
+ "group-[.is-assistant]:text-foreground group-[.is-assistant]:w-full",
464
+ className
465
+ ),
466
+ ...props,
467
+ children
468
+ }
469
+ );
470
+ var MessageActions = ({
471
+ className,
472
+ children,
473
+ ...props
474
+ }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunk525KS5HM_cjs.cn("flex items-center gap-1", className), ...props, children });
475
+ var MessageAction = ({
476
+ tooltip,
477
+ children,
478
+ label,
479
+ variant = "ghost",
480
+ size = "icon-sm",
481
+ ...props
482
+ }) => {
483
+ const button = /* @__PURE__ */ jsxRuntime.jsxs(chunkEMVZ7HWM_cjs.Button, { size, type: "button", variant, ...props, children: [
484
+ children,
485
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: label || tooltip })
486
+ ] });
487
+ if (tooltip) {
488
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkEMVZ7HWM_cjs.Tooltip, { children: [
489
+ /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipTrigger, { asChild: true, children: button }),
490
+ /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip }) })
491
+ ] }) });
492
+ }
493
+ return button;
494
+ };
495
+ var MessageBranchContext = react.createContext(
496
+ null
497
+ );
498
+ var useMessageBranch = () => {
499
+ const context = react.useContext(MessageBranchContext);
500
+ if (!context) {
501
+ throw new Error(
502
+ "MessageBranch components must be used within MessageBranch"
503
+ );
504
+ }
505
+ return context;
506
+ };
507
+ var MessageBranch = ({
508
+ defaultBranch = 0,
509
+ onBranchChange,
510
+ className,
511
+ ...props
512
+ }) => {
513
+ const [currentBranch, setCurrentBranch] = react.useState(defaultBranch);
514
+ const [branches, setBranches] = react.useState([]);
515
+ const handleBranchChange = (newBranch) => {
516
+ setCurrentBranch(newBranch);
517
+ onBranchChange?.(newBranch);
518
+ };
519
+ const goToPrevious = () => {
520
+ const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
521
+ handleBranchChange(newBranch);
522
+ };
523
+ const goToNext = () => {
524
+ const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
525
+ handleBranchChange(newBranch);
526
+ };
527
+ const contextValue = {
528
+ currentBranch,
529
+ totalBranches: branches.length,
530
+ goToPrevious,
531
+ goToNext,
532
+ branches,
533
+ setBranches
534
+ };
535
+ return /* @__PURE__ */ jsxRuntime.jsx(MessageBranchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
536
+ "div",
537
+ {
538
+ className: chunk525KS5HM_cjs.cn("grid w-full gap-2 [&>div]:pb-0", className),
539
+ ...props
540
+ }
541
+ ) });
542
+ };
543
+ var MessageBranchContent = ({
544
+ children,
545
+ ...props
546
+ }) => {
547
+ const { currentBranch, setBranches, branches } = useMessageBranch();
548
+ const childrenArray = Array.isArray(children) ? children : [children];
549
+ react.useEffect(() => {
550
+ if (branches.length !== childrenArray.length) {
551
+ setBranches(childrenArray);
552
+ }
553
+ }, [childrenArray, branches, setBranches]);
554
+ return childrenArray.map((branch, index) => /* @__PURE__ */ jsxRuntime.jsx(
555
+ "div",
556
+ {
557
+ className: chunk525KS5HM_cjs.cn(
558
+ "grid gap-2 overflow-hidden [&>div]:pb-0",
559
+ index === currentBranch ? "block" : "hidden"
560
+ ),
561
+ ...props,
562
+ children: branch
563
+ },
564
+ branch.key
565
+ ));
566
+ };
567
+ var MessageBranchSelector = ({
568
+ className,
569
+ from,
570
+ ...props
571
+ }) => {
572
+ const { totalBranches } = useMessageBranch();
573
+ if (totalBranches <= 1) {
574
+ return null;
575
+ }
576
+ return /* @__PURE__ */ jsxRuntime.jsx(
577
+ ButtonGroup,
578
+ {
579
+ className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
580
+ orientation: "horizontal",
581
+ ...props
582
+ }
583
+ );
584
+ };
585
+ var MessageBranchPrevious = ({
586
+ children,
587
+ ...props
588
+ }) => {
589
+ const { goToPrevious, totalBranches } = useMessageBranch();
590
+ return /* @__PURE__ */ jsxRuntime.jsx(
591
+ chunkEMVZ7HWM_cjs.Button,
592
+ {
593
+ "aria-label": "Previous branch",
594
+ disabled: totalBranches <= 1,
595
+ onClick: goToPrevious,
596
+ size: "icon-sm",
597
+ type: "button",
598
+ variant: "ghost",
599
+ ...props,
600
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeftIcon, { size: 14 })
601
+ }
602
+ );
603
+ };
604
+ var MessageBranchNext = ({
605
+ children,
606
+ className,
607
+ ...props
608
+ }) => {
609
+ const { goToNext, totalBranches } = useMessageBranch();
610
+ return /* @__PURE__ */ jsxRuntime.jsx(
611
+ chunkEMVZ7HWM_cjs.Button,
612
+ {
613
+ "aria-label": "Next branch",
614
+ disabled: totalBranches <= 1,
615
+ onClick: goToNext,
616
+ size: "icon-sm",
617
+ type: "button",
618
+ variant: "ghost",
619
+ ...props,
620
+ children: children ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRightIcon, { size: 14 })
621
+ }
622
+ );
623
+ };
624
+ var MessageBranchPage = ({
625
+ className,
626
+ ...props
627
+ }) => {
628
+ const { currentBranch, totalBranches } = useMessageBranch();
629
+ return /* @__PURE__ */ jsxRuntime.jsxs(
630
+ ButtonGroupText,
631
+ {
632
+ className: chunk525KS5HM_cjs.cn(
633
+ "border-none bg-transparent text-muted-foreground shadow-none",
634
+ className
635
+ ),
636
+ ...props,
637
+ children: [
638
+ currentBranch + 1,
639
+ " of ",
640
+ totalBranches
641
+ ]
642
+ }
643
+ );
644
+ };
645
+ function addUtmParams(url) {
646
+ try {
647
+ const urlObj = new URL(url);
648
+ urlObj.searchParams.set("utm_source", "chat");
649
+ urlObj.searchParams.set("utm_medium", "referral");
650
+ return urlObj.toString();
651
+ } catch {
652
+ return url;
653
+ }
654
+ }
655
+ var CustomLink = ({ href, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
656
+ "a",
657
+ {
658
+ href: href ? addUtmParams(href) : href,
659
+ target: "_blank",
660
+ rel: "noopener noreferrer",
661
+ className: "hover:underline hover:opacity-80 transition-opacity font-medium",
662
+ ...props,
663
+ children
664
+ }
665
+ );
666
+ var CustomImage = ({ src, alt, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
667
+ "img",
668
+ {
669
+ src,
670
+ alt: alt || "",
671
+ loading: "lazy",
672
+ className: "rounded-xl max-w-full h-auto my-4",
673
+ ...props
674
+ }
675
+ );
676
+ var CustomTable = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
677
+ "table",
678
+ {
679
+ className: "w-full text-sm rounded-xl border border-black/[0.08] overflow-hidden",
680
+ ...props,
681
+ children
682
+ }
683
+ ) });
684
+ var CustomThead = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-black/[0.04]", ...props, children });
685
+ var CustomTh = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
686
+ "th",
687
+ {
688
+ className: "px-4 py-3 text-start text-xs font-medium uppercase tracking-wider opacity-60 border-b border-black/[0.08]",
689
+ ...props,
690
+ children
691
+ }
692
+ );
693
+ var CustomTd = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
694
+ "td",
695
+ {
696
+ className: "px-4 py-3 border-b border-black/[0.08]",
697
+ ...props,
698
+ children
699
+ }
700
+ );
701
+ var CustomTr = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
702
+ "tr",
703
+ {
704
+ className: "hover:bg-black/[0.02] transition-colors",
705
+ ...props,
706
+ children
707
+ }
708
+ );
709
+ var MessageResponse = react.memo(
710
+ ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
711
+ streamdown.Streamdown,
712
+ {
713
+ className: chunk525KS5HM_cjs.cn(
714
+ "message-response size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
715
+ className
716
+ ),
717
+ components: {
718
+ a: CustomLink,
719
+ img: CustomImage,
720
+ table: CustomTable,
721
+ thead: CustomThead,
722
+ th: CustomTh,
723
+ td: CustomTd,
724
+ tr: CustomTr
725
+ },
726
+ linkSafety: { enabled: false },
727
+ ...props
728
+ }
729
+ ),
730
+ (prevProps, nextProps) => prevProps.children === nextProps.children
731
+ );
732
+ MessageResponse.displayName = "MessageResponse";
733
+ function MessageAttachmentLightbox({
734
+ url,
735
+ alt,
736
+ onClose
737
+ }) {
738
+ const [container, setContainer] = react.useState(
739
+ null
740
+ );
741
+ const anchorRef = react.useRef(null);
742
+ react.useEffect(() => {
743
+ const root = anchorRef.current?.getRootNode();
744
+ if (!root) return;
745
+ const host = root instanceof ShadowRoot ? root : root.body ?? null;
746
+ if (!host) return;
747
+ const node = document.createElement("div");
748
+ node.setAttribute("data-aigentyc-chat", "");
749
+ host.appendChild(node);
750
+ setContainer(node);
751
+ return () => {
752
+ node.remove();
753
+ };
754
+ }, []);
755
+ react.useEffect(() => {
756
+ const onKey = (e) => {
757
+ if (e.key === "Escape") onClose();
758
+ };
759
+ document.addEventListener("keydown", onKey);
760
+ return () => document.removeEventListener("keydown", onKey);
761
+ }, [onClose]);
762
+ const overlay = /* @__PURE__ */ jsxRuntime.jsxs(
763
+ "div",
764
+ {
765
+ "aria-label": alt,
766
+ "aria-modal": "true",
767
+ className: "ac-lightbox",
768
+ onClick: onClose,
769
+ role: "dialog",
770
+ style: {
771
+ position: "fixed",
772
+ inset: 0,
773
+ zIndex: 2147483001,
774
+ display: "flex",
775
+ alignItems: "center",
776
+ justifyContent: "center",
777
+ padding: 24,
778
+ background: "rgba(8, 12, 16, 0.82)",
779
+ pointerEvents: "auto",
780
+ cursor: "zoom-out"
781
+ },
782
+ children: [
783
+ /* @__PURE__ */ jsxRuntime.jsx(
784
+ "img",
785
+ {
786
+ alt,
787
+ onClick: (e) => e.stopPropagation(),
788
+ src: url,
789
+ style: {
790
+ maxWidth: "100%",
791
+ maxHeight: "100%",
792
+ objectFit: "contain",
793
+ borderRadius: 12,
794
+ boxShadow: "0 24px 64px rgba(0, 0, 0, 0.45)",
795
+ cursor: "default"
796
+ }
797
+ }
798
+ ),
799
+ /* @__PURE__ */ jsxRuntime.jsx(
800
+ "button",
801
+ {
802
+ "aria-label": "Close",
803
+ onClick: onClose,
804
+ style: {
805
+ position: "absolute",
806
+ top: 16,
807
+ insetInlineEnd: 16,
808
+ width: 36,
809
+ height: 36,
810
+ display: "flex",
811
+ alignItems: "center",
812
+ justifyContent: "center",
813
+ border: "none",
814
+ borderRadius: "50%",
815
+ background: "rgba(255, 255, 255, 0.14)",
816
+ color: "#fff",
817
+ cursor: "pointer"
818
+ },
819
+ type: "button",
820
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: 18 })
821
+ }
822
+ )
823
+ ]
824
+ }
825
+ );
826
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
827
+ /* @__PURE__ */ jsxRuntime.jsx("span", { ref: anchorRef, style: { display: "none" } }),
828
+ container ? reactDom.createPortal(overlay, container) : null
829
+ ] });
830
+ }
831
+ function MessageAttachment({
832
+ data,
833
+ className,
834
+ onRemove,
835
+ ...props
836
+ }) {
837
+ const [zoomed, setZoomed] = react.useState(false);
838
+ const filename = data.filename || "";
839
+ const mediaType = data.mediaType?.startsWith("image/") && data.url ? "image" : "file";
840
+ const isImage = mediaType === "image";
841
+ const attachmentLabel = filename || (isImage ? "Image" : "Attachment");
842
+ return /* @__PURE__ */ jsxRuntime.jsx(
843
+ "div",
844
+ {
845
+ className: chunk525KS5HM_cjs.cn(
846
+ "group relative size-24 overflow-hidden rounded-lg",
847
+ className
848
+ ),
849
+ ...props,
850
+ children: isImage ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
851
+ /* @__PURE__ */ jsxRuntime.jsx(
852
+ "button",
853
+ {
854
+ "aria-label": `View ${attachmentLabel} full size`,
855
+ className: "block size-full cursor-zoom-in",
856
+ onClick: () => setZoomed(true),
857
+ title: "View full size",
858
+ type: "button",
859
+ children: /* @__PURE__ */ jsxRuntime.jsx(
860
+ "img",
861
+ {
862
+ alt: filename || "attachment",
863
+ className: "size-full object-cover transition-transform duration-200 group-hover:scale-105",
864
+ height: 100,
865
+ src: data.url,
866
+ width: 100
867
+ }
868
+ )
869
+ }
870
+ ),
871
+ zoomed && /* @__PURE__ */ jsxRuntime.jsx(
872
+ MessageAttachmentLightbox,
873
+ {
874
+ alt: attachmentLabel,
875
+ onClose: () => setZoomed(false),
876
+ url: data.url
877
+ }
878
+ ),
879
+ onRemove && /* @__PURE__ */ jsxRuntime.jsxs(
880
+ chunkEMVZ7HWM_cjs.Button,
881
+ {
882
+ "aria-label": "Remove attachment",
883
+ className: "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3",
884
+ onClick: (e) => {
885
+ e.stopPropagation();
886
+ onRemove();
887
+ },
888
+ type: "button",
889
+ variant: "ghost",
890
+ children: [
891
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
892
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Remove" })
893
+ ]
894
+ }
895
+ )
896
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
897
+ /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkEMVZ7HWM_cjs.Tooltip, { children: [
898
+ /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PaperclipIcon, { className: "size-4" }) }) }),
899
+ /* @__PURE__ */ jsxRuntime.jsx(chunkEMVZ7HWM_cjs.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: attachmentLabel }) })
900
+ ] }) }),
901
+ onRemove && /* @__PURE__ */ jsxRuntime.jsxs(
902
+ chunkEMVZ7HWM_cjs.Button,
903
+ {
904
+ "aria-label": "Remove attachment",
905
+ className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 [&>svg]:size-3",
906
+ onClick: (e) => {
907
+ e.stopPropagation();
908
+ onRemove();
909
+ },
910
+ type: "button",
911
+ variant: "ghost",
912
+ children: [
913
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
914
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Remove" })
915
+ ]
916
+ }
917
+ )
918
+ ] })
919
+ }
920
+ );
921
+ }
922
+ function MessageAttachments({
923
+ children,
924
+ className,
925
+ ...props
926
+ }) {
927
+ const isEmpty = !children || Array.isArray(children) && children.flat().filter(Boolean).length === 0;
928
+ if (isEmpty) {
929
+ return null;
930
+ }
931
+ return /* @__PURE__ */ jsxRuntime.jsx(
932
+ "div",
933
+ {
934
+ className: chunk525KS5HM_cjs.cn(
935
+ "ml-auto flex w-fit flex-wrap items-start gap-2",
936
+ className
937
+ ),
938
+ ...props,
939
+ children
940
+ }
941
+ );
942
+ }
943
+ var MessageToolbar = ({
944
+ className,
945
+ children,
946
+ ...props
947
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
948
+ "div",
949
+ {
950
+ className: chunk525KS5HM_cjs.cn(
951
+ "mt-4 flex w-full items-center justify-between gap-4",
952
+ className
953
+ ),
954
+ ...props,
955
+ children
956
+ }
957
+ );
388
958
  var Loader = ({ className, text = "Thinking...", ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(
389
959
  "div",
390
960
  {
@@ -470,7 +1040,7 @@ var SpinnerLoader = ({ className, size = 16, ...props }) => /* @__PURE__ */ jsxR
470
1040
  }
471
1041
  );
472
1042
  var Sources = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
473
- chunkTZ7EM3EG_cjs.Collapsible,
1043
+ chunkEMVZ7HWM_cjs.Collapsible,
474
1044
  {
475
1045
  className: chunk525KS5HM_cjs.cn("not-prose mb-4 text-primary text-xs", className),
476
1046
  ...props
@@ -482,7 +1052,7 @@ var SourcesTrigger = ({
482
1052
  children,
483
1053
  ...props
484
1054
  }) => /* @__PURE__ */ jsxRuntime.jsx(
485
- chunkTZ7EM3EG_cjs.CollapsibleTrigger,
1055
+ chunkEMVZ7HWM_cjs.CollapsibleTrigger,
486
1056
  {
487
1057
  className: chunk525KS5HM_cjs.cn("flex items-center gap-2", className),
488
1058
  ...props,
@@ -500,7 +1070,7 @@ var SourcesContent = ({
500
1070
  className,
501
1071
  ...props
502
1072
  }) => /* @__PURE__ */ jsxRuntime.jsx(
503
- chunkTZ7EM3EG_cjs.CollapsibleContent,
1073
+ chunkEMVZ7HWM_cjs.CollapsibleContent,
504
1074
  {
505
1075
  className: chunk525KS5HM_cjs.cn(
506
1076
  "mt-3 flex w-fit flex-col gap-2",
@@ -530,11 +1100,25 @@ exports.ConversationContent = ConversationContent;
530
1100
  exports.ConversationEmptyState = ConversationEmptyState;
531
1101
  exports.ConversationScrollButton = ConversationScrollButton;
532
1102
  exports.Loader = Loader;
1103
+ exports.Message = Message;
1104
+ exports.MessageAction = MessageAction;
1105
+ exports.MessageActions = MessageActions;
1106
+ exports.MessageAttachment = MessageAttachment;
1107
+ exports.MessageAttachments = MessageAttachments;
1108
+ exports.MessageBranch = MessageBranch;
1109
+ exports.MessageBranchContent = MessageBranchContent;
1110
+ exports.MessageBranchNext = MessageBranchNext;
1111
+ exports.MessageBranchPage = MessageBranchPage;
1112
+ exports.MessageBranchPrevious = MessageBranchPrevious;
1113
+ exports.MessageBranchSelector = MessageBranchSelector;
1114
+ exports.MessageContent = MessageContent;
533
1115
  exports.MessageFeedback = MessageFeedback;
1116
+ exports.MessageResponse = MessageResponse;
1117
+ exports.MessageToolbar = MessageToolbar;
534
1118
  exports.Source = Source;
535
1119
  exports.Sources = Sources;
536
1120
  exports.SourcesContent = SourcesContent;
537
1121
  exports.SourcesTrigger = SourcesTrigger;
538
1122
  exports.SpinnerLoader = SpinnerLoader;
539
- //# sourceMappingURL=chunk-4WOBNRRB.cjs.map
540
- //# sourceMappingURL=chunk-4WOBNRRB.cjs.map
1123
+ //# sourceMappingURL=chunk-6CVBJ4EI.cjs.map
1124
+ //# sourceMappingURL=chunk-6CVBJ4EI.cjs.map