reachat 2.0.0-beta.0 → 2.0.0-beta.2

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.
@@ -1,7 +1,7 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
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";
3
+ import { createContext, useContext, useRef, forwardRef, useState, useEffect, useImperativeHandle, lazy, useMemo, Suspense, useCallback, memo } from "react";
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";
@@ -13,6 +13,7 @@ import remarkGfm from "remark-gfm";
13
13
  import remarkYoutube from "remark-youtube";
14
14
  import remarkMath from "remark-math";
15
15
  import { isToday, isYesterday, isThisWeek, differenceInYears, format } from "date-fns";
16
+ import { createPortal } from "react-dom";
16
17
  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
18
  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
19
  const ChatContext = createContext({
@@ -171,7 +172,10 @@ const SessionMessagesHeader = ({ children }) => {
171
172
  ] }) });
172
173
  };
173
174
  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 }) => {
175
+ const SessionMessagePanel = ({
176
+ children,
177
+ allowBack = true
178
+ }) => {
175
179
  const { activeSessionId, theme, isCompact, selectSession, viewType } = useContext(ChatContext);
176
180
  const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
177
181
  return isVisible && /* @__PURE__ */ jsx(
@@ -193,7 +197,7 @@ const SessionMessagePanel = ({ children }) => {
193
197
  [theme.messages.console]: !isCompact
194
198
  }),
195
199
  children: /* @__PURE__ */ jsxs("div", { className: cn(theme.messages.inner), children: [
196
- isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
200
+ allowBack && isCompact && viewType !== "chat" && /* @__PURE__ */ jsxs(
197
201
  Button,
198
202
  {
199
203
  variant: "text",
@@ -1331,8 +1335,8 @@ function remarkCve() {
1331
1335
  }
1332
1336
  }
1333
1337
  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" }));
1334
- const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-CSWfBI1o.js"));
1335
- const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-Bn_xBvPJ.js"));
1338
+ const DefaultFileRenderer = lazy(() => import("./DefaultFileRenderer-Chpp-Qiu.js"));
1339
+ const CSVFileRenderer = lazy(() => import("./CSVFileRenderer-C95MrG0M.js"));
1336
1340
  const ImageFileRenderer = lazy(() => import("./ImageFileRenderer-C8tVW3I8.js"));
1337
1341
  const PDFFileRenderer = lazy(() => import("./PDFFileRenderer-DQdFS2l6.js"));
1338
1342
  const FILE_TYPE_RENDERER_MAP = {
@@ -1721,6 +1725,7 @@ const chatTheme = {
1721
1725
  console: "flex w-full gap-4 h-full",
1722
1726
  companion: "w-full h-full overflow-hidden",
1723
1727
  empty: "text-center flex-1",
1728
+ appbar: "flex p-5",
1724
1729
  sessions: {
1725
1730
  base: "overflow-auto",
1726
1731
  console: "min-w-[150px] w-[30%] max-w-[300px] dark:bg-[#11111F] bg-[#F2F3F7] p-5 rounded-3xl",
@@ -1961,31 +1966,6 @@ const Chat = ({
1961
1966
  }
1962
1967
  ) }) });
1963
1968
  };
1964
- const SessionsList = ({ children }) => {
1965
- const { theme, isCompact, activeSessionId } = useContext(ChatContext);
1966
- const isVisible = isCompact && !activeSessionId;
1967
- return (!isCompact || isVisible) && /* @__PURE__ */ jsx(
1968
- motion.div,
1969
- {
1970
- initial: { translateX: "-100%" },
1971
- animate: {
1972
- translateX: "0%",
1973
- transition: {
1974
- type: "tween",
1975
- ease: "linear",
1976
- duration: 0.2,
1977
- when: "beforeChildren"
1978
- }
1979
- },
1980
- exit: { translateX: "-100%" },
1981
- className: cn(theme.sessions.base, {
1982
- [theme.sessions.companion]: isCompact,
1983
- [theme.sessions.console]: !isCompact
1984
- }),
1985
- children: /* @__PURE__ */ jsx(List, { children })
1986
- }
1987
- );
1988
- };
1989
1969
  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" })));
1990
1970
  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" }));
1991
1971
  const SessionListItem = ({
@@ -2026,6 +2006,48 @@ const SessionListItem = ({
2026
2006
  }
2027
2007
  );
2028
2008
  };
2009
+ const SessionsList = ({
2010
+ children,
2011
+ templates
2012
+ }) => {
2013
+ const { theme, isCompact, activeSessionId, createSession } = useContext(ChatContext);
2014
+ const isVisible = isCompact && !activeSessionId;
2015
+ return (!isCompact || isVisible) && /* @__PURE__ */ jsxs(
2016
+ motion.div,
2017
+ {
2018
+ initial: { translateX: "-100%" },
2019
+ animate: {
2020
+ translateX: "0%",
2021
+ transition: {
2022
+ type: "tween",
2023
+ ease: "linear",
2024
+ duration: 0.2,
2025
+ when: "beforeChildren"
2026
+ }
2027
+ },
2028
+ exit: { translateX: "-100%" },
2029
+ className: cn(theme.sessions.base, {
2030
+ [theme.sessions.companion]: isCompact,
2031
+ [theme.sessions.console]: !isCompact
2032
+ }),
2033
+ children: [
2034
+ /* @__PURE__ */ jsx(List, { children }),
2035
+ templates && !activeSessionId && /* @__PURE__ */ jsx("div", { className: "mt-4", children: templates.map((template) => /* @__PURE__ */ jsx("div", { onClick: () => createSession == null ? void 0 : createSession(), children: /* @__PURE__ */ jsx(
2036
+ SessionListItem,
2037
+ {
2038
+ session: {
2039
+ id: template.id,
2040
+ title: template.title,
2041
+ conversations: []
2042
+ },
2043
+ chatIcon: template.icon,
2044
+ deletable: false
2045
+ }
2046
+ ) }, template.id)) })
2047
+ ]
2048
+ }
2049
+ );
2050
+ };
2029
2051
  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" })));
2030
2052
  const NewSessionButton = ({
2031
2053
  children,
@@ -2133,7 +2155,156 @@ const SessionGroups = ({ children }) => {
2133
2155
  const groups = useMemo(() => groupSessionsByDate(sessions), [sessions]);
2134
2156
  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)) })) });
2135
2157
  };
2158
+ const AppBar = ({
2159
+ content,
2160
+ theme: customTheme = chatTheme
2161
+ }) => {
2162
+ const theme = useComponentTheme("chat", customTheme);
2163
+ return /* @__PURE__ */ jsx("div", { className: cn(theme.appbar), children: content });
2164
+ };
2165
+ const defaultPositions = {
2166
+ "bottom-left": "bottom-5 left-5",
2167
+ "bottom-right": "bottom-5 right-5",
2168
+ "top-left": "top-5 left-5",
2169
+ "top-right": "top-5 right-5"
2170
+ };
2171
+ const ChatBubble = memo(
2172
+ ({
2173
+ children,
2174
+ bubbleContent,
2175
+ position = "bottom-left",
2176
+ customPosition,
2177
+ portalTarget = typeof document !== "undefined" ? document.body : null,
2178
+ className
2179
+ }) => {
2180
+ const [isOpen, setIsOpen] = useState(false);
2181
+ const bubbleRef = useRef(null);
2182
+ const contentRef = useRef(null);
2183
+ const [bubbleRect, setBubbleRect] = useState(null);
2184
+ useEffect(() => {
2185
+ if (bubbleRef.current) {
2186
+ setBubbleRect(bubbleRef.current.getBoundingClientRect());
2187
+ }
2188
+ }, [isOpen]);
2189
+ const handleClose = useCallback(() => {
2190
+ setIsOpen(false);
2191
+ }, []);
2192
+ const handleToggle = useCallback(() => {
2193
+ setIsOpen((prev) => !prev);
2194
+ }, []);
2195
+ const getContentPosition = () => {
2196
+ if (!bubbleRect) return {};
2197
+ const positions = {
2198
+ "bottom-left": {
2199
+ bottom: `calc(100vh - ${bubbleRect.top}px)`,
2200
+ left: `${bubbleRect.right}px`
2201
+ },
2202
+ "bottom-right": {
2203
+ bottom: `calc(100vh - ${bubbleRect.top}px)`,
2204
+ right: `calc(100vw - ${bubbleRect.left}px)`
2205
+ },
2206
+ "top-left": {
2207
+ top: `${bubbleRect.bottom}px`,
2208
+ left: `${bubbleRect.right}px`
2209
+ },
2210
+ "top-right": {
2211
+ top: `${bubbleRect.bottom}px`,
2212
+ right: `calc(100vw - ${bubbleRect.left}px)`
2213
+ }
2214
+ };
2215
+ return positions[position];
2216
+ };
2217
+ const content = useMemo(
2218
+ () => /* @__PURE__ */ jsxs(Fragment, { children: [
2219
+ /* @__PURE__ */ jsx(
2220
+ "div",
2221
+ {
2222
+ ref: bubbleRef,
2223
+ style: {
2224
+ ...customPosition,
2225
+ ...portalTarget ? { position: "absolute" } : {}
2226
+ },
2227
+ onClick: handleToggle,
2228
+ className: cn(
2229
+ "z-[1000]",
2230
+ !portalTarget && "fixed",
2231
+ defaultPositions[position],
2232
+ "cursor-pointer",
2233
+ className
2234
+ ),
2235
+ role: "button",
2236
+ tabIndex: 0,
2237
+ "aria-label": "Open chat",
2238
+ children: bubbleContent
2239
+ }
2240
+ ),
2241
+ /* @__PURE__ */ jsx(AnimatePresence, { children: children && isOpen && bubbleRect && /* @__PURE__ */ jsxs(Fragment, { children: [
2242
+ /* @__PURE__ */ jsx(
2243
+ motion.div,
2244
+ {
2245
+ initial: { opacity: 0 },
2246
+ animate: { opacity: 0.5 },
2247
+ exit: { opacity: 0 },
2248
+ className: "fixed inset-0 z-[998]",
2249
+ onClick: handleClose
2250
+ }
2251
+ ),
2252
+ /* @__PURE__ */ jsx(
2253
+ motion.div,
2254
+ {
2255
+ ref: contentRef,
2256
+ initial: false,
2257
+ animate: {
2258
+ opacity: 1,
2259
+ scale: 1,
2260
+ x: 0,
2261
+ pointerEvents: "auto"
2262
+ },
2263
+ exit: {
2264
+ opacity: 0,
2265
+ scale: 0.8,
2266
+ x: position.includes("right") ? 20 : -20,
2267
+ pointerEvents: "none"
2268
+ },
2269
+ transition: { type: "spring", duration: 0.5 },
2270
+ className: cn(
2271
+ "fixed z-[999]",
2272
+ position.includes("right") ? "origin-right" : "origin-left",
2273
+ position.includes("top") ? "origin-top" : "origin-bottom"
2274
+ ),
2275
+ style: getContentPosition(),
2276
+ children
2277
+ }
2278
+ )
2279
+ ] }) })
2280
+ ] }),
2281
+ [
2282
+ children,
2283
+ customPosition,
2284
+ portalTarget,
2285
+ position,
2286
+ className,
2287
+ bubbleContent,
2288
+ isOpen,
2289
+ handleClose,
2290
+ handleToggle,
2291
+ bubbleRect
2292
+ ]
2293
+ );
2294
+ if (!portalTarget) {
2295
+ return content;
2296
+ }
2297
+ try {
2298
+ return createPortal(content, portalTarget);
2299
+ } catch (error) {
2300
+ console.error("Failed to create portal for ChatBubble:", error);
2301
+ return content;
2302
+ }
2303
+ }
2304
+ );
2136
2305
  export {
2306
+ AppBar as A,
2307
+ ChatBubble as B,
2137
2308
  ChatInput as C,
2138
2309
  FileInput as F,
2139
2310
  MessageSource as M,
@@ -2167,4 +2338,4 @@ export {
2167
2338
  light as y,
2168
2339
  ChatContext as z
2169
2340
  };
2170
- //# sourceMappingURL=index-9RlgGcc-.js.map
2341
+ //# sourceMappingURL=index-B1krf7tH.js.map