@burtson-labs/bandit-engine 2.1.7 → 2.1.8
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.
- package/CHANGELOG.md +14 -0
- package/dist/AdvancedTab-HZTDXFST.mjs +229 -0
- package/dist/AdvancedTab-HZTDXFST.mjs.map +1 -0
- package/dist/CrewSection-YM26YD2N.mjs +12 -0
- package/dist/InstructionsTab-MKOGBQ5L.mjs +195 -0
- package/dist/InstructionsTab-MKOGBQ5L.mjs.map +1 -0
- package/dist/PersonalizationTab-2XHFTYYW.mjs +179 -0
- package/dist/PersonalizationTab-2XHFTYYW.mjs.map +1 -0
- package/dist/{ProjectsPane-E5D72PUG.mjs → ProjectsPane-KE5DGFN4.mjs} +9 -6
- package/dist/ProjectsPane-KE5DGFN4.mjs.map +1 -0
- package/dist/{SchedulesTab-AKJ6WFZV.mjs → SchedulesTab-AM5QP36K.mjs} +7 -5
- package/dist/SchedulesTab-AM5QP36K.mjs.map +1 -0
- package/dist/{aiProviderStore-ANPQVHGD.mjs → aiProviderStore-GH4JZTMW.mjs} +3 -2
- package/dist/chat-D66YM4MB.mjs +26 -0
- package/dist/{chunk-4NUQYUZH.mjs → chunk-2FI2IICG.mjs} +7 -569
- package/dist/chunk-2FI2IICG.mjs.map +1 -0
- package/dist/chunk-2THUYNVU.mjs +1203 -0
- package/dist/chunk-2THUYNVU.mjs.map +1 -0
- package/dist/{chunk-KWOUXBSF.mjs → chunk-5LXCZJLJ.mjs} +5 -213
- package/dist/chunk-5LXCZJLJ.mjs.map +1 -0
- package/dist/chunk-5WCKKD3S.mjs +1742 -0
- package/dist/chunk-5WCKKD3S.mjs.map +1 -0
- package/dist/{chunk-GX4FVZNA.mjs → chunk-DHXSFFLX.mjs} +4 -26
- package/dist/chunk-DHXSFFLX.mjs.map +1 -0
- package/dist/chunk-EKPPIS3X.mjs +336 -0
- package/dist/chunk-EKPPIS3X.mjs.map +1 -0
- package/dist/chunk-FBLITVVY.mjs +5845 -0
- package/dist/chunk-FBLITVVY.mjs.map +1 -0
- package/dist/chunk-H2XUGGKV.mjs +168 -0
- package/dist/chunk-H2XUGGKV.mjs.map +1 -0
- package/dist/chunk-K4AO466X.mjs +570 -0
- package/dist/chunk-K4AO466X.mjs.map +1 -0
- package/dist/chunk-KPT7NNNK.mjs +214 -0
- package/dist/chunk-KPT7NNNK.mjs.map +1 -0
- package/dist/{chunk-SQJ4OKWM.mjs → chunk-LAH6UL3Q.mjs} +10 -1726
- package/dist/chunk-LAH6UL3Q.mjs.map +1 -0
- package/dist/chunk-LC64VSDS.mjs +541 -0
- package/dist/chunk-LC64VSDS.mjs.map +1 -0
- package/dist/{chunk-DH5A2HT2.mjs → chunk-LY3O7UWA.mjs} +45 -1
- package/dist/chunk-LY3O7UWA.mjs.map +1 -0
- package/dist/{chunk-4NHPLHXU.mjs → chunk-WZGDQ4EA.mjs} +5176 -11535
- package/dist/chunk-WZGDQ4EA.mjs.map +1 -0
- package/dist/chunk-Y272M3D5.mjs +28 -0
- package/dist/chunk-Y272M3D5.mjs.map +1 -0
- package/dist/index.d.mts +121 -8
- package/dist/index.d.ts +121 -8
- package/dist/index.js +8732 -7511
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1243 -2243
- package/dist/index.mjs.map +1 -1
- package/dist/{modelStore-YNANSWCN.mjs → modelStore-KO45QAO2.mjs} +3 -2
- package/dist/modelStore-KO45QAO2.mjs.map +1 -0
- package/dist/{public-Tq2Pmw9m.d.ts → public-_W_Zew3C.d.mts} +14 -0
- package/dist/{public-Tq2Pmw9m.d.mts → public-_W_Zew3C.d.ts} +14 -0
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ProjectsPane-E5D72PUG.mjs.map +0 -1
- package/dist/SchedulesTab-AKJ6WFZV.mjs.map +0 -1
- package/dist/chat-MI4IL3WK.mjs +0 -19
- package/dist/chunk-4NHPLHXU.mjs.map +0 -1
- package/dist/chunk-4NUQYUZH.mjs.map +0 -1
- package/dist/chunk-DH5A2HT2.mjs.map +0 -1
- package/dist/chunk-GX4FVZNA.mjs.map +0 -1
- package/dist/chunk-KWOUXBSF.mjs.map +0 -1
- package/dist/chunk-SQJ4OKWM.mjs.map +0 -1
- /package/dist/{aiProviderStore-ANPQVHGD.mjs.map → CrewSection-YM26YD2N.mjs.map} +0 -0
- /package/dist/{chat-MI4IL3WK.mjs.map → aiProviderStore-GH4JZTMW.mjs.map} +0 -0
- /package/dist/{modelStore-YNANSWCN.mjs.map → chat-D66YM4MB.mjs.map} +0 -0
|
@@ -1,41 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
useModelStore
|
|
3
|
+
} from "./chunk-5LXCZJLJ.mjs";
|
|
4
|
+
import {
|
|
5
|
+
indexedDBService_default
|
|
6
|
+
} from "./chunk-KPT7NNNK.mjs";
|
|
6
7
|
import {
|
|
7
8
|
Archive,
|
|
8
9
|
Braces,
|
|
9
|
-
Check,
|
|
10
|
-
Edit,
|
|
11
10
|
File,
|
|
12
11
|
FileCode,
|
|
13
12
|
FileImage,
|
|
14
13
|
FilePdf,
|
|
15
14
|
FileText,
|
|
16
|
-
|
|
17
|
-
GripVertical,
|
|
18
|
-
Home,
|
|
19
|
-
Inbox,
|
|
20
|
-
LogOut,
|
|
21
|
-
MailOpen,
|
|
22
|
-
MessageSquarePlus,
|
|
23
|
-
MoreVertical,
|
|
24
|
-
Plus,
|
|
25
|
-
Search,
|
|
26
|
-
Settings,
|
|
27
|
-
Sheet,
|
|
28
|
-
Trash
|
|
15
|
+
Sheet
|
|
29
16
|
} from "./chunk-5URP2E5V.mjs";
|
|
30
|
-
import {
|
|
31
|
-
usePackageSettingsStore
|
|
32
|
-
} from "./chunk-K7SQWDNF.mjs";
|
|
33
17
|
import {
|
|
34
18
|
AUTH_TOKEN_CHANGED_EVENT,
|
|
35
19
|
TOKEN_KEY,
|
|
36
|
-
authenticationService
|
|
37
|
-
readPersistedToken,
|
|
38
|
-
useAuthenticationStore
|
|
20
|
+
authenticationService
|
|
39
21
|
} from "./chunk-S3DWWUBD.mjs";
|
|
40
22
|
import {
|
|
41
23
|
debugLogger
|
|
@@ -1829,1678 +1811,6 @@ function responseTokens(theme) {
|
|
|
1829
1811
|
};
|
|
1830
1812
|
}
|
|
1831
1813
|
|
|
1832
|
-
// src/chat/sidebar/sidebarState.ts
|
|
1833
|
-
import { create as create4 } from "zustand";
|
|
1834
|
-
var SIDEBAR_WIDTH = 300;
|
|
1835
|
-
var SIDEBAR_COLLAPSED_KEY = "bandit.sidebar.collapsed";
|
|
1836
|
-
var SIDEBAR_DEFAULT_OPEN_MIN_WIDTH = 1024;
|
|
1837
|
-
var CHAT_VIEW = { kind: "chat" };
|
|
1838
|
-
var readPersistedCollapsed = () => {
|
|
1839
|
-
try {
|
|
1840
|
-
const raw = localStorage.getItem(SIDEBAR_COLLAPSED_KEY);
|
|
1841
|
-
return raw === null ? null : raw === "1";
|
|
1842
|
-
} catch {
|
|
1843
|
-
return null;
|
|
1844
|
-
}
|
|
1845
|
-
};
|
|
1846
|
-
var writePersistedCollapsed = (collapsed) => {
|
|
1847
|
-
try {
|
|
1848
|
-
localStorage.setItem(SIDEBAR_COLLAPSED_KEY, collapsed ? "1" : "0");
|
|
1849
|
-
} catch {
|
|
1850
|
-
}
|
|
1851
|
-
};
|
|
1852
|
-
var initialSidebarOpen = (viewportWidth = typeof window === "undefined" ? 0 : window.innerWidth) => {
|
|
1853
|
-
const persisted = readPersistedCollapsed();
|
|
1854
|
-
if (persisted !== null) return !persisted;
|
|
1855
|
-
return viewportWidth >= SIDEBAR_DEFAULT_OPEN_MIN_WIDTH;
|
|
1856
|
-
};
|
|
1857
|
-
function viewFromSearch(search) {
|
|
1858
|
-
const params = new URLSearchParams(search);
|
|
1859
|
-
const projectId = params.get("project");
|
|
1860
|
-
if (projectId) return { kind: "project", projectId };
|
|
1861
|
-
if (params.get("view") === "projects") return { kind: "projects" };
|
|
1862
|
-
return CHAT_VIEW;
|
|
1863
|
-
}
|
|
1864
|
-
function searchWithView(search, view) {
|
|
1865
|
-
const params = new URLSearchParams(search);
|
|
1866
|
-
params.delete("view");
|
|
1867
|
-
params.delete("project");
|
|
1868
|
-
if (view.kind === "projects") params.set("view", "projects");
|
|
1869
|
-
if (view.kind === "project") params.set("project", view.projectId);
|
|
1870
|
-
const next = params.toString();
|
|
1871
|
-
return next ? `?${next}` : "";
|
|
1872
|
-
}
|
|
1873
|
-
var sameView = (a, b) => a.kind === b.kind && (a.kind !== "project" || b.kind !== "project" || a.projectId === b.projectId);
|
|
1874
|
-
var useSidebarStore = create4((set) => ({
|
|
1875
|
-
view: CHAT_VIEW,
|
|
1876
|
-
searchFocusRequest: 0,
|
|
1877
|
-
setView: (view) => set({ view }),
|
|
1878
|
-
showChat: () => set({ view: CHAT_VIEW }),
|
|
1879
|
-
showProjects: () => set({ view: { kind: "projects" } }),
|
|
1880
|
-
openProject: (projectId) => set({ view: { kind: "project", projectId } }),
|
|
1881
|
-
requestSearchFocus: () => set((state) => ({ searchFocusRequest: state.searchFocusRequest + 1 }))
|
|
1882
|
-
}));
|
|
1883
|
-
function syncViewWithUrl() {
|
|
1884
|
-
if (typeof window === "undefined") return () => {
|
|
1885
|
-
};
|
|
1886
|
-
const store = useSidebarStore;
|
|
1887
|
-
store.getState().setView(viewFromSearch(window.location.search));
|
|
1888
|
-
const onPop = () => store.getState().setView(viewFromSearch(window.location.search));
|
|
1889
|
-
window.addEventListener("popstate", onPop);
|
|
1890
|
-
const unsubscribe = store.subscribe((state, previous) => {
|
|
1891
|
-
if (sameView(state.view, previous.view)) return;
|
|
1892
|
-
const current = viewFromSearch(window.location.search);
|
|
1893
|
-
if (sameView(current, state.view)) return;
|
|
1894
|
-
const search = searchWithView(window.location.search, state.view);
|
|
1895
|
-
const url = `${window.location.pathname}${search}${window.location.hash}`;
|
|
1896
|
-
window.history.pushState(window.history.state, "", url);
|
|
1897
|
-
});
|
|
1898
|
-
return () => {
|
|
1899
|
-
window.removeEventListener("popstate", onPop);
|
|
1900
|
-
unsubscribe();
|
|
1901
|
-
};
|
|
1902
|
-
}
|
|
1903
|
-
var useSidebarLayout = () => usePackageSettingsStore((state) => state.settings?.navigation?.sidebar ?? "classic");
|
|
1904
|
-
var useSectionsLayout = () => useSidebarLayout() === "sections";
|
|
1905
|
-
|
|
1906
|
-
// src/services/branding/brandingService.ts
|
|
1907
|
-
var BrandingService = class {
|
|
1908
|
-
DB_NAME = "banditConfig";
|
|
1909
|
-
DB_VERSION = 1;
|
|
1910
|
-
STORE_NAME = "config";
|
|
1911
|
-
STORE_CONFIGS = [{ name: "config", keyPath: "id" }];
|
|
1912
|
-
async getBranding() {
|
|
1913
|
-
try {
|
|
1914
|
-
const data = await indexedDBService_default.get(
|
|
1915
|
-
this.DB_NAME,
|
|
1916
|
-
this.DB_VERSION,
|
|
1917
|
-
this.STORE_NAME,
|
|
1918
|
-
"main",
|
|
1919
|
-
this.STORE_CONFIGS
|
|
1920
|
-
);
|
|
1921
|
-
if (data?.branding && (data.branding.logoBase64 || data.branding.hasTransparentLogo !== void 0 || data.branding.brandingText)) {
|
|
1922
|
-
return {
|
|
1923
|
-
logoBase64: data.branding.logoBase64,
|
|
1924
|
-
hasTransparentLogo: data.branding.hasTransparentLogo,
|
|
1925
|
-
brandingText: data.branding.brandingText
|
|
1926
|
-
};
|
|
1927
|
-
}
|
|
1928
|
-
return null;
|
|
1929
|
-
} catch (error) {
|
|
1930
|
-
throw error;
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
async setBrandingFromConfig(config) {
|
|
1934
|
-
try {
|
|
1935
|
-
const existing = await indexedDBService_default.get(
|
|
1936
|
-
this.DB_NAME,
|
|
1937
|
-
this.DB_VERSION,
|
|
1938
|
-
this.STORE_NAME,
|
|
1939
|
-
"main",
|
|
1940
|
-
this.STORE_CONFIGS
|
|
1941
|
-
) || { id: "main" };
|
|
1942
|
-
if (existing.branding?.userSaved) {
|
|
1943
|
-
debugLogger.debug(
|
|
1944
|
-
"\u{1F6E1}\uFE0F BrandingService: User branding detected, blocking CDN config override"
|
|
1945
|
-
);
|
|
1946
|
-
return;
|
|
1947
|
-
}
|
|
1948
|
-
const hasUserBranding = existing.branding && (existing.branding.logoBase64 || existing.branding.brandingText || existing.branding.theme || existing.branding.hasTransparentLogo !== void 0);
|
|
1949
|
-
if (hasUserBranding) {
|
|
1950
|
-
debugLogger.debug(
|
|
1951
|
-
"\u{1F6E1}\uFE0F BrandingService: Detected user branding data, blocking CDN config override"
|
|
1952
|
-
);
|
|
1953
|
-
return;
|
|
1954
|
-
}
|
|
1955
|
-
debugLogger.debug(
|
|
1956
|
-
"\u{1F527} BrandingService: No user branding detected, applying CDN config"
|
|
1957
|
-
);
|
|
1958
|
-
const branding = config.branding || {};
|
|
1959
|
-
const updated = {
|
|
1960
|
-
...existing,
|
|
1961
|
-
branding: {
|
|
1962
|
-
...existing.branding,
|
|
1963
|
-
...branding
|
|
1964
|
-
}
|
|
1965
|
-
};
|
|
1966
|
-
await indexedDBService_default.put(
|
|
1967
|
-
this.DB_NAME,
|
|
1968
|
-
this.DB_VERSION,
|
|
1969
|
-
this.STORE_NAME,
|
|
1970
|
-
updated,
|
|
1971
|
-
this.STORE_CONFIGS
|
|
1972
|
-
);
|
|
1973
|
-
} catch (error) {
|
|
1974
|
-
throw error;
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
};
|
|
1978
|
-
var brandingService = new BrandingService();
|
|
1979
|
-
var brandingService_default = brandingService;
|
|
1980
|
-
|
|
1981
|
-
// src/hooks/useSafeNavigate.ts
|
|
1982
|
-
import { useRef } from "react";
|
|
1983
|
-
import { useNavigate } from "react-router-dom";
|
|
1984
|
-
var useSafeNavigate = () => {
|
|
1985
|
-
const warned = useRef(false);
|
|
1986
|
-
let navigate = null;
|
|
1987
|
-
try {
|
|
1988
|
-
navigate = useNavigate();
|
|
1989
|
-
} catch (error) {
|
|
1990
|
-
if (!warned.current) {
|
|
1991
|
-
debugLogger.warn("useSafeNavigate: no Router context; falling back to location", {
|
|
1992
|
-
error
|
|
1993
|
-
});
|
|
1994
|
-
warned.current = true;
|
|
1995
|
-
}
|
|
1996
|
-
navigate = null;
|
|
1997
|
-
}
|
|
1998
|
-
return (to) => {
|
|
1999
|
-
if (typeof window !== "undefined" && /^[a-z]+:\/\//i.test(to)) {
|
|
2000
|
-
window.location.href = to;
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
if (navigate) {
|
|
2004
|
-
navigate(to);
|
|
2005
|
-
return;
|
|
2006
|
-
}
|
|
2007
|
-
if (typeof window !== "undefined") {
|
|
2008
|
-
window.location.href = to;
|
|
2009
|
-
}
|
|
2010
|
-
};
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
|
-
// src/chat/move-conversation-modal.tsx
|
|
2014
|
-
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
2015
|
-
import {
|
|
2016
|
-
Dialog,
|
|
2017
|
-
DialogTitle,
|
|
2018
|
-
DialogContent,
|
|
2019
|
-
DialogActions,
|
|
2020
|
-
Button,
|
|
2021
|
-
List,
|
|
2022
|
-
ListItem,
|
|
2023
|
-
ListItemButton,
|
|
2024
|
-
ListItemText,
|
|
2025
|
-
ListItemIcon,
|
|
2026
|
-
Typography,
|
|
2027
|
-
Avatar,
|
|
2028
|
-
Radio,
|
|
2029
|
-
Box as Box2,
|
|
2030
|
-
Divider
|
|
2031
|
-
} from "@mui/material";
|
|
2032
|
-
import { useTheme } from "@mui/material/styles";
|
|
2033
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
2034
|
-
var MoveConversationModal = ({
|
|
2035
|
-
open,
|
|
2036
|
-
onClose,
|
|
2037
|
-
conversations,
|
|
2038
|
-
currentProjectId = null
|
|
2039
|
-
}) => {
|
|
2040
|
-
const theme = useTheme();
|
|
2041
|
-
const { projects, _hasHydrated, hydrate } = useProjectStore();
|
|
2042
|
-
const { moveConversationToProject } = useConversationStore();
|
|
2043
|
-
const [selectedProjectId, setSelectedProjectId] = useState2(
|
|
2044
|
-
currentProjectId
|
|
2045
|
-
);
|
|
2046
|
-
useEffect2(() => {
|
|
2047
|
-
if (open && !_hasHydrated) {
|
|
2048
|
-
hydrate();
|
|
2049
|
-
}
|
|
2050
|
-
}, [open, _hasHydrated, hydrate]);
|
|
2051
|
-
useEffect2(() => {
|
|
2052
|
-
setSelectedProjectId(currentProjectId);
|
|
2053
|
-
}, [currentProjectId, open]);
|
|
2054
|
-
const handleMove = async () => {
|
|
2055
|
-
try {
|
|
2056
|
-
await Promise.all(
|
|
2057
|
-
conversations.map(
|
|
2058
|
-
(conv) => moveConversationToProject(conv.id, selectedProjectId)
|
|
2059
|
-
)
|
|
2060
|
-
);
|
|
2061
|
-
onClose();
|
|
2062
|
-
} catch (error) {
|
|
2063
|
-
debugLogger.error("Failed to move conversations", {
|
|
2064
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2065
|
-
});
|
|
2066
|
-
}
|
|
2067
|
-
};
|
|
2068
|
-
const conversationCount = conversations.length;
|
|
2069
|
-
const isMultiple = conversationCount > 1;
|
|
2070
|
-
return /* @__PURE__ */ jsxs(
|
|
2071
|
-
Dialog,
|
|
2072
|
-
{
|
|
2073
|
-
open,
|
|
2074
|
-
onClose,
|
|
2075
|
-
maxWidth: "sm",
|
|
2076
|
-
fullWidth: true,
|
|
2077
|
-
PaperProps: {
|
|
2078
|
-
sx: {
|
|
2079
|
-
bgcolor: theme.palette.background.paper,
|
|
2080
|
-
backgroundImage: "none"
|
|
2081
|
-
}
|
|
2082
|
-
},
|
|
2083
|
-
children: [
|
|
2084
|
-
/* @__PURE__ */ jsxs(DialogTitle, { children: [
|
|
2085
|
-
"Move ",
|
|
2086
|
-
isMultiple ? `${conversationCount} Conversations` : "Conversation"
|
|
2087
|
-
] }),
|
|
2088
|
-
/* @__PURE__ */ jsxs(DialogContent, { sx: { px: 3 }, children: [
|
|
2089
|
-
/* @__PURE__ */ jsx3(Typography, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: isMultiple ? `Select a project to move ${conversationCount} conversations to:` : `Select a project to move "${conversations[0]?.name}" to:` }),
|
|
2090
|
-
/* @__PURE__ */ jsxs(List, { children: [
|
|
2091
|
-
/* @__PURE__ */ jsx3(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs(
|
|
2092
|
-
ListItemButton,
|
|
2093
|
-
{
|
|
2094
|
-
onClick: () => setSelectedProjectId(null),
|
|
2095
|
-
selected: selectedProjectId === null,
|
|
2096
|
-
children: [
|
|
2097
|
-
/* @__PURE__ */ jsx3(ListItemIcon, { children: /* @__PURE__ */ jsx3(
|
|
2098
|
-
Radio,
|
|
2099
|
-
{
|
|
2100
|
-
checked: selectedProjectId === null,
|
|
2101
|
-
onChange: () => setSelectedProjectId(null),
|
|
2102
|
-
size: "small"
|
|
2103
|
-
}
|
|
2104
|
-
) }),
|
|
2105
|
-
/* @__PURE__ */ jsx3(ListItemIcon, { children: /* @__PURE__ */ jsx3(
|
|
2106
|
-
Avatar,
|
|
2107
|
-
{
|
|
2108
|
-
sx: {
|
|
2109
|
-
bgcolor: theme.palette.grey[400],
|
|
2110
|
-
width: 32,
|
|
2111
|
-
height: 32
|
|
2112
|
-
},
|
|
2113
|
-
children: /* @__PURE__ */ jsx3(Inbox, {})
|
|
2114
|
-
}
|
|
2115
|
-
) }),
|
|
2116
|
-
/* @__PURE__ */ jsx3(
|
|
2117
|
-
ListItemText,
|
|
2118
|
-
{
|
|
2119
|
-
primary: "No Project",
|
|
2120
|
-
secondary: "Keep conversations ungrouped"
|
|
2121
|
-
}
|
|
2122
|
-
)
|
|
2123
|
-
]
|
|
2124
|
-
}
|
|
2125
|
-
) }),
|
|
2126
|
-
/* @__PURE__ */ jsx3(Divider, { sx: { my: 1 } }),
|
|
2127
|
-
projects.map((project) => /* @__PURE__ */ jsx3(ListItem, { disablePadding: true, children: /* @__PURE__ */ jsxs(
|
|
2128
|
-
ListItemButton,
|
|
2129
|
-
{
|
|
2130
|
-
onClick: () => setSelectedProjectId(project.id),
|
|
2131
|
-
selected: selectedProjectId === project.id,
|
|
2132
|
-
children: [
|
|
2133
|
-
/* @__PURE__ */ jsx3(ListItemIcon, { children: /* @__PURE__ */ jsx3(
|
|
2134
|
-
Radio,
|
|
2135
|
-
{
|
|
2136
|
-
checked: selectedProjectId === project.id,
|
|
2137
|
-
onChange: () => setSelectedProjectId(project.id),
|
|
2138
|
-
size: "small"
|
|
2139
|
-
}
|
|
2140
|
-
) }),
|
|
2141
|
-
/* @__PURE__ */ jsx3(ListItemIcon, { children: /* @__PURE__ */ jsx3(
|
|
2142
|
-
Avatar,
|
|
2143
|
-
{
|
|
2144
|
-
sx: {
|
|
2145
|
-
bgcolor: project.color,
|
|
2146
|
-
width: 32,
|
|
2147
|
-
height: 32
|
|
2148
|
-
},
|
|
2149
|
-
children: /* @__PURE__ */ jsx3(Folder, {})
|
|
2150
|
-
}
|
|
2151
|
-
) }),
|
|
2152
|
-
/* @__PURE__ */ jsx3(ListItemText, { primary: project.name, secondary: project.description })
|
|
2153
|
-
]
|
|
2154
|
-
}
|
|
2155
|
-
) }, project.id)),
|
|
2156
|
-
projects.length === 0 && /* @__PURE__ */ jsx3(
|
|
2157
|
-
Box2,
|
|
2158
|
-
{
|
|
2159
|
-
sx: {
|
|
2160
|
-
textAlign: "center",
|
|
2161
|
-
py: 2,
|
|
2162
|
-
color: theme.palette.text.secondary
|
|
2163
|
-
},
|
|
2164
|
-
children: /* @__PURE__ */ jsx3(Typography, { variant: "body2", children: "No projects available. Create a project first to organize conversations." })
|
|
2165
|
-
}
|
|
2166
|
-
)
|
|
2167
|
-
] })
|
|
2168
|
-
] }),
|
|
2169
|
-
/* @__PURE__ */ jsxs(DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
2170
|
-
/* @__PURE__ */ jsx3(Button, { onClick: onClose, children: "Cancel" }),
|
|
2171
|
-
/* @__PURE__ */ jsxs(
|
|
2172
|
-
Button,
|
|
2173
|
-
{
|
|
2174
|
-
onClick: handleMove,
|
|
2175
|
-
variant: "contained",
|
|
2176
|
-
disabled: selectedProjectId === currentProjectId,
|
|
2177
|
-
children: [
|
|
2178
|
-
"Move ",
|
|
2179
|
-
isMultiple ? "Conversations" : "Conversation"
|
|
2180
|
-
]
|
|
2181
|
-
}
|
|
2182
|
-
)
|
|
2183
|
-
] })
|
|
2184
|
-
]
|
|
2185
|
-
}
|
|
2186
|
-
);
|
|
2187
|
-
};
|
|
2188
|
-
var move_conversation_modal_default = MoveConversationModal;
|
|
2189
|
-
|
|
2190
|
-
// src/chat/simple-conversation-item.tsx
|
|
2191
|
-
import { useState as useState3, useRef as useRef2, useEffect as useEffect3 } from "react";
|
|
2192
|
-
import {
|
|
2193
|
-
Box as Box3,
|
|
2194
|
-
Typography as Typography2,
|
|
2195
|
-
IconButton as IconButton2,
|
|
2196
|
-
Menu,
|
|
2197
|
-
MenuItem,
|
|
2198
|
-
ListItemIcon as ListItemIcon2,
|
|
2199
|
-
ListItemText as ListItemText2,
|
|
2200
|
-
useMediaQuery,
|
|
2201
|
-
TextField,
|
|
2202
|
-
Dialog as Dialog2,
|
|
2203
|
-
DialogTitle as DialogTitle2,
|
|
2204
|
-
DialogContent as DialogContent2,
|
|
2205
|
-
DialogActions as DialogActions2,
|
|
2206
|
-
Button as Button2
|
|
2207
|
-
} from "@mui/material";
|
|
2208
|
-
import { useTheme as useTheme2, alpha as alpha2 } from "@mui/material/styles";
|
|
2209
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2210
|
-
var SimpleConversationItem = ({
|
|
2211
|
-
conversation,
|
|
2212
|
-
isSelected,
|
|
2213
|
-
onSelect,
|
|
2214
|
-
onDelete,
|
|
2215
|
-
onRename,
|
|
2216
|
-
onMove,
|
|
2217
|
-
projectColor,
|
|
2218
|
-
snippet,
|
|
2219
|
-
searchQuery,
|
|
2220
|
-
onTouchDragStart,
|
|
2221
|
-
onTouchDragMove,
|
|
2222
|
-
onTouchDragEnd,
|
|
2223
|
-
isTouchDragActive,
|
|
2224
|
-
dense = false
|
|
2225
|
-
}) => {
|
|
2226
|
-
const theme = useTheme2();
|
|
2227
|
-
const isMobile = useMediaQuery(theme.breakpoints.down("sm"));
|
|
2228
|
-
const [anchorEl, setAnchorEl] = useState3(null);
|
|
2229
|
-
const [isEditing, setIsEditing] = useState3(false);
|
|
2230
|
-
const [editName, setEditName] = useState3(conversation.name);
|
|
2231
|
-
const [isDragging, setIsDragging] = useState3(false);
|
|
2232
|
-
const [isTouchDragging, setIsTouchDragging] = useState3(false);
|
|
2233
|
-
const [showRenameDialog, setShowRenameDialog] = useState3(false);
|
|
2234
|
-
const longPressTimeoutRef = useRef2(null);
|
|
2235
|
-
const touchStartPointRef = useRef2(null);
|
|
2236
|
-
const activeTouchIdRef = useRef2(null);
|
|
2237
|
-
const suppressClickRef = useRef2(false);
|
|
2238
|
-
const highlightText = (text, query) => {
|
|
2239
|
-
if (!query || !query.trim()) {
|
|
2240
|
-
return text;
|
|
2241
|
-
}
|
|
2242
|
-
const regex = new RegExp(`(${query.trim()})`, "gi");
|
|
2243
|
-
const parts = text.split(regex);
|
|
2244
|
-
return parts.map(
|
|
2245
|
-
(part, index) => regex.test(part) ? /* @__PURE__ */ jsx4(
|
|
2246
|
-
Box3,
|
|
2247
|
-
{
|
|
2248
|
-
component: "span",
|
|
2249
|
-
sx: {
|
|
2250
|
-
bgcolor: alpha2(theme.palette.warning.main, 0.3),
|
|
2251
|
-
color: theme.palette.text.primary,
|
|
2252
|
-
fontWeight: 600,
|
|
2253
|
-
borderRadius: 0.5,
|
|
2254
|
-
px: 0.25
|
|
2255
|
-
},
|
|
2256
|
-
children: part
|
|
2257
|
-
},
|
|
2258
|
-
index
|
|
2259
|
-
) : part
|
|
2260
|
-
);
|
|
2261
|
-
};
|
|
2262
|
-
const handleMenuOpen = (event) => {
|
|
2263
|
-
event.stopPropagation();
|
|
2264
|
-
event.preventDefault();
|
|
2265
|
-
setAnchorEl(event.currentTarget);
|
|
2266
|
-
};
|
|
2267
|
-
const handleMenuClose = () => {
|
|
2268
|
-
setAnchorEl(null);
|
|
2269
|
-
};
|
|
2270
|
-
const handleEdit = () => {
|
|
2271
|
-
setEditName(conversation.name);
|
|
2272
|
-
if (isMobile) {
|
|
2273
|
-
setShowRenameDialog(true);
|
|
2274
|
-
} else {
|
|
2275
|
-
setIsEditing(true);
|
|
2276
|
-
}
|
|
2277
|
-
handleMenuClose();
|
|
2278
|
-
};
|
|
2279
|
-
const handleMove = () => {
|
|
2280
|
-
if (onMove) {
|
|
2281
|
-
onMove();
|
|
2282
|
-
}
|
|
2283
|
-
handleMenuClose();
|
|
2284
|
-
};
|
|
2285
|
-
const handleDelete = () => {
|
|
2286
|
-
onDelete();
|
|
2287
|
-
handleMenuClose();
|
|
2288
|
-
};
|
|
2289
|
-
const commitRename = () => {
|
|
2290
|
-
const trimmed = editName.trim();
|
|
2291
|
-
if (!trimmed) {
|
|
2292
|
-
return;
|
|
2293
|
-
}
|
|
2294
|
-
if (trimmed !== conversation.name) {
|
|
2295
|
-
onRename?.(trimmed);
|
|
2296
|
-
}
|
|
2297
|
-
setEditName(trimmed);
|
|
2298
|
-
};
|
|
2299
|
-
const handleSaveEdit = () => {
|
|
2300
|
-
commitRename();
|
|
2301
|
-
setIsEditing(false);
|
|
2302
|
-
};
|
|
2303
|
-
const handleCancelEdit = () => {
|
|
2304
|
-
setIsEditing(false);
|
|
2305
|
-
setEditName(conversation.name);
|
|
2306
|
-
};
|
|
2307
|
-
const handleDragStart = (e) => {
|
|
2308
|
-
setIsDragging(true);
|
|
2309
|
-
e.dataTransfer.setData("text/plain", conversation.id);
|
|
2310
|
-
e.dataTransfer.effectAllowed = "move";
|
|
2311
|
-
};
|
|
2312
|
-
const handleDragEnd = () => {
|
|
2313
|
-
setIsDragging(false);
|
|
2314
|
-
};
|
|
2315
|
-
const cancelLongPress = () => {
|
|
2316
|
-
if (longPressTimeoutRef.current !== null) {
|
|
2317
|
-
window.clearTimeout(longPressTimeoutRef.current);
|
|
2318
|
-
longPressTimeoutRef.current = null;
|
|
2319
|
-
}
|
|
2320
|
-
};
|
|
2321
|
-
const handleTouchStart = (e) => {
|
|
2322
|
-
if (!isMobile || isEditing) return;
|
|
2323
|
-
if (e.touches.length === 0) return;
|
|
2324
|
-
const touch = e.touches[0];
|
|
2325
|
-
touchStartPointRef.current = { x: touch.clientX, y: touch.clientY };
|
|
2326
|
-
activeTouchIdRef.current = touch.identifier;
|
|
2327
|
-
suppressClickRef.current = false;
|
|
2328
|
-
cancelLongPress();
|
|
2329
|
-
const initialTouch = touch;
|
|
2330
|
-
longPressTimeoutRef.current = window.setTimeout(() => {
|
|
2331
|
-
if (activeTouchIdRef.current !== null) {
|
|
2332
|
-
setIsTouchDragging(true);
|
|
2333
|
-
onTouchDragStart?.(conversation, initialTouch);
|
|
2334
|
-
}
|
|
2335
|
-
}, 350);
|
|
2336
|
-
};
|
|
2337
|
-
const handleTouchMove = (e) => {
|
|
2338
|
-
if (!isMobile) return;
|
|
2339
|
-
const targetTouch = activeTouchIdRef.current !== null ? Array.from(e.touches).find((t) => t.identifier === activeTouchIdRef.current) : e.touches[0];
|
|
2340
|
-
if (!targetTouch) return;
|
|
2341
|
-
if (isTouchDragging) {
|
|
2342
|
-
if (e.cancelable) {
|
|
2343
|
-
e.preventDefault();
|
|
2344
|
-
}
|
|
2345
|
-
onTouchDragMove?.(targetTouch);
|
|
2346
|
-
return;
|
|
2347
|
-
}
|
|
2348
|
-
const startPoint = touchStartPointRef.current;
|
|
2349
|
-
if (startPoint) {
|
|
2350
|
-
const deltaX = Math.abs(targetTouch.clientX - startPoint.x);
|
|
2351
|
-
const deltaY = Math.abs(targetTouch.clientY - startPoint.y);
|
|
2352
|
-
if (deltaX > 8 || deltaY > 8) {
|
|
2353
|
-
cancelLongPress();
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
};
|
|
2357
|
-
const finalizeTouchDrag = (touch) => {
|
|
2358
|
-
if (isTouchDragging) {
|
|
2359
|
-
onTouchDragEnd?.(touch);
|
|
2360
|
-
suppressClickRef.current = true;
|
|
2361
|
-
}
|
|
2362
|
-
setIsTouchDragging(false);
|
|
2363
|
-
activeTouchIdRef.current = null;
|
|
2364
|
-
touchStartPointRef.current = null;
|
|
2365
|
-
cancelLongPress();
|
|
2366
|
-
};
|
|
2367
|
-
const handleTouchEnd = (e) => {
|
|
2368
|
-
if (!isMobile) return;
|
|
2369
|
-
const touch = activeTouchIdRef.current !== null ? Array.from(e.changedTouches).find(
|
|
2370
|
-
(t) => t.identifier === activeTouchIdRef.current
|
|
2371
|
-
) : e.changedTouches[0];
|
|
2372
|
-
finalizeTouchDrag(touch);
|
|
2373
|
-
};
|
|
2374
|
-
const handleTouchCancel = () => {
|
|
2375
|
-
if (!isMobile) return;
|
|
2376
|
-
finalizeTouchDrag();
|
|
2377
|
-
};
|
|
2378
|
-
useEffect3(() => {
|
|
2379
|
-
if (!isTouchDragActive && isTouchDragging) {
|
|
2380
|
-
setIsTouchDragging(false);
|
|
2381
|
-
}
|
|
2382
|
-
}, [isTouchDragActive, isTouchDragging]);
|
|
2383
|
-
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2384
|
-
/* @__PURE__ */ jsxs2(
|
|
2385
|
-
Box3,
|
|
2386
|
-
{
|
|
2387
|
-
"data-project-id": conversation.projectId ?? "__ungrouped",
|
|
2388
|
-
draggable: !isMobile && !isEditing,
|
|
2389
|
-
onDragStart: handleDragStart,
|
|
2390
|
-
onDragEnd: handleDragEnd,
|
|
2391
|
-
onTouchStart: handleTouchStart,
|
|
2392
|
-
onTouchMove: handleTouchMove,
|
|
2393
|
-
onTouchEnd: handleTouchEnd,
|
|
2394
|
-
onTouchCancel: handleTouchCancel,
|
|
2395
|
-
onClick: isEditing || isTouchDragging ? void 0 : (event) => {
|
|
2396
|
-
if (suppressClickRef.current) {
|
|
2397
|
-
suppressClickRef.current = false;
|
|
2398
|
-
event.preventDefault();
|
|
2399
|
-
event.stopPropagation();
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
onSelect();
|
|
2403
|
-
},
|
|
2404
|
-
sx: {
|
|
2405
|
-
display: "flex",
|
|
2406
|
-
alignItems: "center",
|
|
2407
|
-
px: 2,
|
|
2408
|
-
py: dense ? 0.5 : 1.5,
|
|
2409
|
-
mx: 1,
|
|
2410
|
-
borderRadius: 1,
|
|
2411
|
-
cursor: isEditing || isTouchDragging ? "default" : "pointer",
|
|
2412
|
-
bgcolor: isSelected ? alpha2(projectColor || theme.palette.primary.main, 0.15) : "transparent",
|
|
2413
|
-
border: isSelected ? `1px solid ${alpha2(projectColor || theme.palette.primary.main, 0.3)}` : "1px solid transparent",
|
|
2414
|
-
opacity: isDragging || isTouchDragActive ? 0.55 : 1,
|
|
2415
|
-
transition: "all 0.2s ease",
|
|
2416
|
-
transform: isTouchDragActive ? "scale(0.98)" : "none",
|
|
2417
|
-
boxShadow: isTouchDragActive ? `0 12px 24px ${alpha2(theme.palette.common.black, 0.25)}` : void 0,
|
|
2418
|
-
touchAction: isTouchDragActive ? "none" : void 0,
|
|
2419
|
-
userSelect: isTouchDragging || isTouchDragActive ? "none" : void 0,
|
|
2420
|
-
WebkitUserSelect: isTouchDragging || isTouchDragActive ? "none" : void 0,
|
|
2421
|
-
"&:hover": !isEditing && !isTouchDragging ? {
|
|
2422
|
-
bgcolor: alpha2(theme.palette.text.primary, 0.04)
|
|
2423
|
-
} : {},
|
|
2424
|
-
// Better touch handling on mobile
|
|
2425
|
-
...isMobile && {
|
|
2426
|
-
minHeight: dense ? 44 : 48,
|
|
2427
|
-
// Larger touch target
|
|
2428
|
-
userSelect: "none",
|
|
2429
|
-
WebkitUserSelect: "none",
|
|
2430
|
-
WebkitTouchCallout: "none",
|
|
2431
|
-
"&:active": {
|
|
2432
|
-
bgcolor: alpha2(theme.palette.text.primary, 0.08)
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
|
-
},
|
|
2436
|
-
children: [
|
|
2437
|
-
!isMobile && !isEditing && /* @__PURE__ */ jsx4(
|
|
2438
|
-
GripVertical,
|
|
2439
|
-
{
|
|
2440
|
-
size: 16,
|
|
2441
|
-
color: theme.palette.text.disabled,
|
|
2442
|
-
style: { marginRight: 4, cursor: "grab" }
|
|
2443
|
-
}
|
|
2444
|
-
),
|
|
2445
|
-
/* @__PURE__ */ jsxs2(Box3, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
2446
|
-
isEditing ? /* @__PURE__ */ jsx4(
|
|
2447
|
-
TextField,
|
|
2448
|
-
{
|
|
2449
|
-
value: editName,
|
|
2450
|
-
onChange: (e) => setEditName(e.target.value),
|
|
2451
|
-
onBlur: handleSaveEdit,
|
|
2452
|
-
onKeyDown: (e) => {
|
|
2453
|
-
if (e.key === "Enter") {
|
|
2454
|
-
handleSaveEdit();
|
|
2455
|
-
} else if (e.key === "Escape") {
|
|
2456
|
-
handleCancelEdit();
|
|
2457
|
-
}
|
|
2458
|
-
},
|
|
2459
|
-
size: "small",
|
|
2460
|
-
variant: "standard",
|
|
2461
|
-
autoFocus: true,
|
|
2462
|
-
fullWidth: true,
|
|
2463
|
-
sx: {
|
|
2464
|
-
"& .MuiInput-root": {
|
|
2465
|
-
fontSize: "0.875rem"
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
}
|
|
2469
|
-
) : /* @__PURE__ */ jsx4(
|
|
2470
|
-
Typography2,
|
|
2471
|
-
{
|
|
2472
|
-
variant: "body2",
|
|
2473
|
-
sx: {
|
|
2474
|
-
fontWeight: isSelected ? 600 : 400,
|
|
2475
|
-
color: isSelected ? projectColor || theme.palette.primary.main : theme.palette.text.primary,
|
|
2476
|
-
overflow: "hidden",
|
|
2477
|
-
textOverflow: "ellipsis",
|
|
2478
|
-
whiteSpace: "nowrap",
|
|
2479
|
-
fontSize: "0.875rem"
|
|
2480
|
-
},
|
|
2481
|
-
children: highlightText(conversation.name, searchQuery)
|
|
2482
|
-
}
|
|
2483
|
-
),
|
|
2484
|
-
!isEditing && snippet && /* @__PURE__ */ jsx4(
|
|
2485
|
-
Typography2,
|
|
2486
|
-
{
|
|
2487
|
-
variant: "caption",
|
|
2488
|
-
sx: {
|
|
2489
|
-
display: "-webkit-box",
|
|
2490
|
-
WebkitLineClamp: 2,
|
|
2491
|
-
WebkitBoxOrient: "vertical",
|
|
2492
|
-
overflow: "hidden",
|
|
2493
|
-
color: alpha2(theme.palette.text.secondary, 0.9),
|
|
2494
|
-
mt: 0.25,
|
|
2495
|
-
lineHeight: 1.3,
|
|
2496
|
-
fontSize: "0.72rem"
|
|
2497
|
-
},
|
|
2498
|
-
title: snippet,
|
|
2499
|
-
children: highlightText(snippet, searchQuery)
|
|
2500
|
-
}
|
|
2501
|
-
)
|
|
2502
|
-
] }),
|
|
2503
|
-
!isEditing && /* @__PURE__ */ jsx4(
|
|
2504
|
-
IconButton2,
|
|
2505
|
-
{
|
|
2506
|
-
onClick: handleMenuOpen,
|
|
2507
|
-
size: "small",
|
|
2508
|
-
sx: {
|
|
2509
|
-
opacity: isMobile ? 1 : isSelected ? 1 : 0,
|
|
2510
|
-
// Always visible on mobile
|
|
2511
|
-
color: theme.palette.text.secondary,
|
|
2512
|
-
ml: 1,
|
|
2513
|
-
minWidth: 32,
|
|
2514
|
-
minHeight: 32,
|
|
2515
|
-
transition: "opacity 0.2s ease",
|
|
2516
|
-
".MuiBox-root:hover &": {
|
|
2517
|
-
opacity: 1
|
|
2518
|
-
},
|
|
2519
|
-
// Larger touch target on mobile
|
|
2520
|
-
...isMobile && {
|
|
2521
|
-
padding: 1,
|
|
2522
|
-
"&:before": {
|
|
2523
|
-
content: '""',
|
|
2524
|
-
position: "absolute",
|
|
2525
|
-
top: -8,
|
|
2526
|
-
left: -8,
|
|
2527
|
-
right: -8,
|
|
2528
|
-
bottom: -8
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
},
|
|
2532
|
-
children: /* @__PURE__ */ jsx4(MoreVertical, { size: 16 })
|
|
2533
|
-
}
|
|
2534
|
-
),
|
|
2535
|
-
/* @__PURE__ */ jsxs2(
|
|
2536
|
-
Menu,
|
|
2537
|
-
{
|
|
2538
|
-
anchorEl,
|
|
2539
|
-
open: Boolean(anchorEl),
|
|
2540
|
-
onClose: handleMenuClose,
|
|
2541
|
-
onClick: (e) => e.stopPropagation(),
|
|
2542
|
-
transformOrigin: {
|
|
2543
|
-
vertical: "top",
|
|
2544
|
-
horizontal: "right"
|
|
2545
|
-
},
|
|
2546
|
-
anchorOrigin: {
|
|
2547
|
-
vertical: "top",
|
|
2548
|
-
horizontal: "right"
|
|
2549
|
-
},
|
|
2550
|
-
PaperProps: {
|
|
2551
|
-
sx: {
|
|
2552
|
-
// Larger menu items on mobile for easier touch
|
|
2553
|
-
...isMobile && {
|
|
2554
|
-
"& .MuiMenuItem-root": {
|
|
2555
|
-
minHeight: 48,
|
|
2556
|
-
fontSize: "1rem"
|
|
2557
|
-
}
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
},
|
|
2561
|
-
children: [
|
|
2562
|
-
onRename && /* @__PURE__ */ jsxs2(MenuItem, { onClick: handleEdit, children: [
|
|
2563
|
-
/* @__PURE__ */ jsx4(ListItemIcon2, { children: /* @__PURE__ */ jsx4(Edit, { size: 16 }) }),
|
|
2564
|
-
/* @__PURE__ */ jsx4(ListItemText2, { children: "Rename" })
|
|
2565
|
-
] }),
|
|
2566
|
-
onMove && /* @__PURE__ */ jsxs2(MenuItem, { onClick: handleMove, children: [
|
|
2567
|
-
/* @__PURE__ */ jsx4(ListItemIcon2, { children: /* @__PURE__ */ jsx4(MailOpen, { size: 16 }) }),
|
|
2568
|
-
/* @__PURE__ */ jsx4(ListItemText2, { children: "Move to Project" })
|
|
2569
|
-
] }),
|
|
2570
|
-
/* @__PURE__ */ jsxs2(MenuItem, { onClick: handleDelete, children: [
|
|
2571
|
-
/* @__PURE__ */ jsx4(ListItemIcon2, { children: /* @__PURE__ */ jsx4(Trash, { size: 16 }) }),
|
|
2572
|
-
/* @__PURE__ */ jsx4(ListItemText2, { children: "Delete" })
|
|
2573
|
-
] })
|
|
2574
|
-
]
|
|
2575
|
-
}
|
|
2576
|
-
)
|
|
2577
|
-
]
|
|
2578
|
-
}
|
|
2579
|
-
),
|
|
2580
|
-
isMobile && /* @__PURE__ */ jsxs2(
|
|
2581
|
-
Dialog2,
|
|
2582
|
-
{
|
|
2583
|
-
open: showRenameDialog,
|
|
2584
|
-
onClose: () => {
|
|
2585
|
-
setShowRenameDialog(false);
|
|
2586
|
-
setEditName(conversation.name);
|
|
2587
|
-
},
|
|
2588
|
-
fullWidth: true,
|
|
2589
|
-
PaperProps: {
|
|
2590
|
-
sx: {
|
|
2591
|
-
borderRadius: 3,
|
|
2592
|
-
pb: 1
|
|
2593
|
-
}
|
|
2594
|
-
},
|
|
2595
|
-
children: [
|
|
2596
|
-
/* @__PURE__ */ jsx4(DialogTitle2, { sx: { pb: 1 }, children: "Rename Conversation" }),
|
|
2597
|
-
/* @__PURE__ */ jsx4(DialogContent2, { children: /* @__PURE__ */ jsx4(
|
|
2598
|
-
TextField,
|
|
2599
|
-
{
|
|
2600
|
-
value: editName,
|
|
2601
|
-
onChange: (e) => setEditName(e.target.value),
|
|
2602
|
-
autoFocus: true,
|
|
2603
|
-
fullWidth: true,
|
|
2604
|
-
placeholder: "Enter a new name",
|
|
2605
|
-
InputProps: {
|
|
2606
|
-
sx: { fontSize: "1rem" }
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
) }),
|
|
2610
|
-
/* @__PURE__ */ jsxs2(DialogActions2, { sx: { px: 3, pb: 2 }, children: [
|
|
2611
|
-
/* @__PURE__ */ jsx4(
|
|
2612
|
-
Button2,
|
|
2613
|
-
{
|
|
2614
|
-
onClick: () => {
|
|
2615
|
-
setShowRenameDialog(false);
|
|
2616
|
-
setEditName(conversation.name);
|
|
2617
|
-
},
|
|
2618
|
-
children: "Cancel"
|
|
2619
|
-
}
|
|
2620
|
-
),
|
|
2621
|
-
/* @__PURE__ */ jsx4(
|
|
2622
|
-
Button2,
|
|
2623
|
-
{
|
|
2624
|
-
onClick: () => {
|
|
2625
|
-
commitRename();
|
|
2626
|
-
setShowRenameDialog(false);
|
|
2627
|
-
},
|
|
2628
|
-
variant: "contained",
|
|
2629
|
-
disabled: !editName.trim() || editName.trim() === conversation.name,
|
|
2630
|
-
children: "Save"
|
|
2631
|
-
}
|
|
2632
|
-
)
|
|
2633
|
-
] })
|
|
2634
|
-
]
|
|
2635
|
-
}
|
|
2636
|
-
)
|
|
2637
|
-
] });
|
|
2638
|
-
};
|
|
2639
|
-
var simple_conversation_item_default = SimpleConversationItem;
|
|
2640
|
-
|
|
2641
|
-
// src/chat/sidebar/ProjectDialog.tsx
|
|
2642
|
-
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
2643
|
-
import {
|
|
2644
|
-
Box as Box4,
|
|
2645
|
-
Button as Button3,
|
|
2646
|
-
Dialog as Dialog3,
|
|
2647
|
-
DialogActions as DialogActions3,
|
|
2648
|
-
DialogContent as DialogContent3,
|
|
2649
|
-
DialogTitle as DialogTitle3,
|
|
2650
|
-
TextField as TextField2,
|
|
2651
|
-
alpha as alpha3
|
|
2652
|
-
} from "@mui/material";
|
|
2653
|
-
import { useTheme as useTheme3 } from "@mui/material/styles";
|
|
2654
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2655
|
-
var ProjectDialog = ({
|
|
2656
|
-
open,
|
|
2657
|
-
onClose,
|
|
2658
|
-
project,
|
|
2659
|
-
onCreated
|
|
2660
|
-
}) => {
|
|
2661
|
-
const theme = useTheme3();
|
|
2662
|
-
const { createProject, renameProject, updateProjectColor, projects } = useProjectStore();
|
|
2663
|
-
const [name, setName] = useState4("");
|
|
2664
|
-
const [color, setColor] = useState4(PROJECT_COLORS[0]);
|
|
2665
|
-
const [saving, setSaving] = useState4(false);
|
|
2666
|
-
const [error, setError] = useState4(null);
|
|
2667
|
-
useEffect4(() => {
|
|
2668
|
-
if (!open) return;
|
|
2669
|
-
setName(project?.name ?? "");
|
|
2670
|
-
setColor(project?.color ?? PROJECT_COLORS[projects.length % PROJECT_COLORS.length]);
|
|
2671
|
-
setError(null);
|
|
2672
|
-
}, [open, project, projects.length]);
|
|
2673
|
-
const trimmed = name.trim();
|
|
2674
|
-
const canSave = trimmed.length > 0 && !saving;
|
|
2675
|
-
const save = async () => {
|
|
2676
|
-
if (!canSave) return;
|
|
2677
|
-
setSaving(true);
|
|
2678
|
-
setError(null);
|
|
2679
|
-
try {
|
|
2680
|
-
if (project) {
|
|
2681
|
-
if (trimmed !== project.name)
|
|
2682
|
-
await renameProject(project.id, trimmed, project.description);
|
|
2683
|
-
if (color !== project.color) await updateProjectColor(project.id, color);
|
|
2684
|
-
} else {
|
|
2685
|
-
const created = await createProject(trimmed, void 0, color);
|
|
2686
|
-
onCreated?.(created);
|
|
2687
|
-
}
|
|
2688
|
-
onClose();
|
|
2689
|
-
} catch (cause) {
|
|
2690
|
-
debugLogger.error("Saving the project failed", {
|
|
2691
|
-
error: cause instanceof Error ? cause.message : String(cause)
|
|
2692
|
-
});
|
|
2693
|
-
setError("The project could not be saved. Try again.");
|
|
2694
|
-
} finally {
|
|
2695
|
-
setSaving(false);
|
|
2696
|
-
}
|
|
2697
|
-
};
|
|
2698
|
-
return /* @__PURE__ */ jsxs3(Dialog3, { open, onClose, maxWidth: "xs", fullWidth: true, children: [
|
|
2699
|
-
/* @__PURE__ */ jsx5(DialogTitle3, { children: project ? "Edit project" : "New project" }),
|
|
2700
|
-
/* @__PURE__ */ jsxs3(DialogContent3, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
|
|
2701
|
-
/* @__PURE__ */ jsx5(
|
|
2702
|
-
TextField2,
|
|
2703
|
-
{
|
|
2704
|
-
autoFocus: true,
|
|
2705
|
-
label: "Name",
|
|
2706
|
-
value: name,
|
|
2707
|
-
onChange: (event) => setName(event.target.value),
|
|
2708
|
-
onKeyDown: (event) => {
|
|
2709
|
-
if (event.key === "Enter") {
|
|
2710
|
-
event.preventDefault();
|
|
2711
|
-
void save();
|
|
2712
|
-
}
|
|
2713
|
-
},
|
|
2714
|
-
error: Boolean(error),
|
|
2715
|
-
helperText: error ?? " ",
|
|
2716
|
-
fullWidth: true,
|
|
2717
|
-
size: "small",
|
|
2718
|
-
inputProps: { maxLength: 80 }
|
|
2719
|
-
}
|
|
2720
|
-
),
|
|
2721
|
-
/* @__PURE__ */ jsx5(
|
|
2722
|
-
Box4,
|
|
2723
|
-
{
|
|
2724
|
-
role: "radiogroup",
|
|
2725
|
-
"aria-label": "Colour",
|
|
2726
|
-
sx: { display: "flex", gap: 1, flexWrap: "wrap" },
|
|
2727
|
-
children: PROJECT_COLORS.map((swatch) => {
|
|
2728
|
-
const selected = swatch === color;
|
|
2729
|
-
return /* @__PURE__ */ jsx5(
|
|
2730
|
-
Box4,
|
|
2731
|
-
{
|
|
2732
|
-
component: "button",
|
|
2733
|
-
type: "button",
|
|
2734
|
-
role: "radio",
|
|
2735
|
-
"aria-checked": selected,
|
|
2736
|
-
"aria-label": `Colour ${swatch}`,
|
|
2737
|
-
onClick: () => setColor(swatch),
|
|
2738
|
-
sx: {
|
|
2739
|
-
width: 28,
|
|
2740
|
-
height: 28,
|
|
2741
|
-
p: 0,
|
|
2742
|
-
borderRadius: "50%",
|
|
2743
|
-
border: `2px solid ${selected ? theme.palette.text.primary : "transparent"}`,
|
|
2744
|
-
bgcolor: swatch,
|
|
2745
|
-
cursor: "pointer",
|
|
2746
|
-
display: "grid",
|
|
2747
|
-
placeItems: "center",
|
|
2748
|
-
color: theme.palette.getContrastText(swatch),
|
|
2749
|
-
"&:focus-visible": {
|
|
2750
|
-
outline: `2px solid ${theme.palette.primary.main}`,
|
|
2751
|
-
outlineOffset: "2px"
|
|
2752
|
-
},
|
|
2753
|
-
"&:hover": { boxShadow: `0 0 0 3px ${alpha3(swatch, 0.35)}` }
|
|
2754
|
-
},
|
|
2755
|
-
children: selected && /* @__PURE__ */ jsx5(Check, { size: 14, "aria-hidden": true })
|
|
2756
|
-
},
|
|
2757
|
-
swatch
|
|
2758
|
-
);
|
|
2759
|
-
})
|
|
2760
|
-
}
|
|
2761
|
-
)
|
|
2762
|
-
] }),
|
|
2763
|
-
/* @__PURE__ */ jsxs3(DialogActions3, { children: [
|
|
2764
|
-
/* @__PURE__ */ jsx5(Button3, { onClick: onClose, children: "Cancel" }),
|
|
2765
|
-
/* @__PURE__ */ jsx5(Button3, { variant: "contained", onClick: () => void save(), disabled: !canSave, children: project ? "Save" : "Create" })
|
|
2766
|
-
] })
|
|
2767
|
-
] });
|
|
2768
|
-
};
|
|
2769
|
-
|
|
2770
|
-
// src/chat/sidebar/recents.ts
|
|
2771
|
-
var BUCKET_LABELS = {
|
|
2772
|
-
today: "Today",
|
|
2773
|
-
week: "Previous 7 days",
|
|
2774
|
-
older: "Older"
|
|
2775
|
-
};
|
|
2776
|
-
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
2777
|
-
var asTime = (value) => {
|
|
2778
|
-
if (!value) return 0;
|
|
2779
|
-
const time = value instanceof Date ? value.getTime() : new Date(value).getTime();
|
|
2780
|
-
return Number.isNaN(time) ? 0 : time;
|
|
2781
|
-
};
|
|
2782
|
-
var lastActivity = (conversation) => asTime(conversation.updatedAt) || asTime(conversation.createdAt);
|
|
2783
|
-
var startOfDay = (now) => {
|
|
2784
|
-
const date = new Date(now);
|
|
2785
|
-
date.setHours(0, 0, 0, 0);
|
|
2786
|
-
return date.getTime();
|
|
2787
|
-
};
|
|
2788
|
-
function groupByRecency(conversations, now = Date.now()) {
|
|
2789
|
-
const today = startOfDay(now);
|
|
2790
|
-
const weekAgo = today - 7 * DAY_MS;
|
|
2791
|
-
const sorted = [...conversations].sort((a, b) => lastActivity(b) - lastActivity(a));
|
|
2792
|
-
const buckets = { today: [], week: [], older: [] };
|
|
2793
|
-
for (const conversation of sorted) {
|
|
2794
|
-
const time = lastActivity(conversation);
|
|
2795
|
-
if (time >= today) buckets.today.push(conversation);
|
|
2796
|
-
else if (time >= weekAgo) buckets.week.push(conversation);
|
|
2797
|
-
else buckets.older.push(conversation);
|
|
2798
|
-
}
|
|
2799
|
-
return ["today", "week", "older"].filter((id) => buckets[id].length > 0).map((id) => ({ id, label: BUCKET_LABELS[id], items: buckets[id] }));
|
|
2800
|
-
}
|
|
2801
|
-
var buildSnippet = (text, query, index) => {
|
|
2802
|
-
const start = Math.max(0, index - 40);
|
|
2803
|
-
const end = Math.min(text.length, index + query.length + 60);
|
|
2804
|
-
return text.slice(start, end).replace(/\s+/g, " ").trim();
|
|
2805
|
-
};
|
|
2806
|
-
function searchConversations(conversations, query) {
|
|
2807
|
-
const needle = query.trim().toLowerCase();
|
|
2808
|
-
if (!needle) return [];
|
|
2809
|
-
const matches = [];
|
|
2810
|
-
for (const conversation of conversations) {
|
|
2811
|
-
if (conversation.name.toLowerCase().includes(needle)) {
|
|
2812
|
-
matches.push({ conversation });
|
|
2813
|
-
continue;
|
|
2814
|
-
}
|
|
2815
|
-
for (const entry of conversation.history) {
|
|
2816
|
-
const body = `${entry.question || ""} ${entry.answer || ""}`;
|
|
2817
|
-
const index = body.toLowerCase().indexOf(needle);
|
|
2818
|
-
if (index !== -1) {
|
|
2819
|
-
matches.push({ conversation, snippet: buildSnippet(body, needle, index) });
|
|
2820
|
-
break;
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
return matches;
|
|
2825
|
-
}
|
|
2826
|
-
var listable = (conversations) => conversations.filter((conversation) => !conversation.incognito);
|
|
2827
|
-
function formatRelative(time, now = Date.now()) {
|
|
2828
|
-
if (!time) return "";
|
|
2829
|
-
const diff = Math.max(0, now - time);
|
|
2830
|
-
const minute = 60 * 1e3;
|
|
2831
|
-
const hour = 60 * minute;
|
|
2832
|
-
if (diff < minute) return "just now";
|
|
2833
|
-
if (diff < hour) return `${Math.floor(diff / minute)} min ago`;
|
|
2834
|
-
if (diff < DAY_MS) return `${Math.floor(diff / hour)} h ago`;
|
|
2835
|
-
const days = Math.floor((startOfDay(now) - startOfDay(time)) / DAY_MS);
|
|
2836
|
-
if (days <= 1) return "yesterday";
|
|
2837
|
-
if (days < 7) return `${days} days ago`;
|
|
2838
|
-
const date = new Date(time);
|
|
2839
|
-
const sameYear = date.getFullYear() === new Date(now).getFullYear();
|
|
2840
|
-
return date.toLocaleDateString(void 0, {
|
|
2841
|
-
month: "short",
|
|
2842
|
-
day: "numeric",
|
|
2843
|
-
...sameYear ? {} : { year: "numeric" }
|
|
2844
|
-
});
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
// src/chat/sidebar/SidebarProjects.tsx
|
|
2848
|
-
import { useMemo } from "react";
|
|
2849
|
-
import { Box as Box6, IconButton as IconButton3, Tooltip, Typography as Typography4 } from "@mui/material";
|
|
2850
|
-
import { useTheme as useTheme5 } from "@mui/material/styles";
|
|
2851
|
-
|
|
2852
|
-
// src/chat/sidebar/SectionRow.tsx
|
|
2853
|
-
import { forwardRef } from "react";
|
|
2854
|
-
import { Box as Box5, ButtonBase, Typography as Typography3, alpha as alpha4 } from "@mui/material";
|
|
2855
|
-
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
2856
|
-
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2857
|
-
var IS_MAC = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform ?? "");
|
|
2858
|
-
var shortcutLabel = (combo) => {
|
|
2859
|
-
if (IS_MAC) {
|
|
2860
|
-
return combo.map((key) => key === "mod" ? "\u2318" : key === "shift" ? "\u21E7" : key).join("");
|
|
2861
|
-
}
|
|
2862
|
-
return combo.map((key) => key === "mod" ? "Ctrl" : key === "shift" ? "Shift" : key).join("+");
|
|
2863
|
-
};
|
|
2864
|
-
var SidebarKbd = ({ children }) => {
|
|
2865
|
-
const theme = useTheme4();
|
|
2866
|
-
return /* @__PURE__ */ jsx6(
|
|
2867
|
-
Box5,
|
|
2868
|
-
{
|
|
2869
|
-
component: "kbd",
|
|
2870
|
-
"aria-hidden": true,
|
|
2871
|
-
sx: {
|
|
2872
|
-
ml: "auto",
|
|
2873
|
-
px: 0.6,
|
|
2874
|
-
py: 0.1,
|
|
2875
|
-
borderRadius: 0.75,
|
|
2876
|
-
border: `1px solid ${alpha4(theme.palette.text.primary, 0.14)}`,
|
|
2877
|
-
color: theme.palette.text.secondary,
|
|
2878
|
-
fontFamily: "inherit",
|
|
2879
|
-
fontSize: "0.68rem",
|
|
2880
|
-
lineHeight: 1.4,
|
|
2881
|
-
whiteSpace: "nowrap",
|
|
2882
|
-
opacity: 0.9
|
|
2883
|
-
},
|
|
2884
|
-
children
|
|
2885
|
-
}
|
|
2886
|
-
);
|
|
2887
|
-
};
|
|
2888
|
-
var SidebarCaption = ({
|
|
2889
|
-
children,
|
|
2890
|
-
action,
|
|
2891
|
-
component = "h2"
|
|
2892
|
-
}) => {
|
|
2893
|
-
const theme = useTheme4();
|
|
2894
|
-
return /* @__PURE__ */ jsxs4(
|
|
2895
|
-
Box5,
|
|
2896
|
-
{
|
|
2897
|
-
sx: {
|
|
2898
|
-
display: "flex",
|
|
2899
|
-
alignItems: "center",
|
|
2900
|
-
gap: 1,
|
|
2901
|
-
px: 2,
|
|
2902
|
-
pt: 1.5,
|
|
2903
|
-
pb: 0.5,
|
|
2904
|
-
minHeight: 32
|
|
2905
|
-
},
|
|
2906
|
-
children: [
|
|
2907
|
-
/* @__PURE__ */ jsx6(
|
|
2908
|
-
Typography3,
|
|
2909
|
-
{
|
|
2910
|
-
component,
|
|
2911
|
-
sx: {
|
|
2912
|
-
m: 0,
|
|
2913
|
-
flex: 1,
|
|
2914
|
-
color: theme.palette.text.secondary,
|
|
2915
|
-
fontSize: "0.7rem",
|
|
2916
|
-
fontWeight: 600,
|
|
2917
|
-
letterSpacing: "0.5px",
|
|
2918
|
-
textTransform: "uppercase",
|
|
2919
|
-
lineHeight: 1.4
|
|
2920
|
-
},
|
|
2921
|
-
children
|
|
2922
|
-
}
|
|
2923
|
-
),
|
|
2924
|
-
action
|
|
2925
|
-
]
|
|
2926
|
-
}
|
|
2927
|
-
);
|
|
2928
|
-
};
|
|
2929
|
-
var SectionRow = forwardRef(function SectionRow2({
|
|
2930
|
-
icon,
|
|
2931
|
-
label,
|
|
2932
|
-
trailing,
|
|
2933
|
-
active = false,
|
|
2934
|
-
href,
|
|
2935
|
-
external,
|
|
2936
|
-
onClick,
|
|
2937
|
-
size = "regular",
|
|
2938
|
-
swatch,
|
|
2939
|
-
...rest
|
|
2940
|
-
}, ref) {
|
|
2941
|
-
const theme = useTheme4();
|
|
2942
|
-
const anchorProps = href ? {
|
|
2943
|
-
component: "a",
|
|
2944
|
-
href,
|
|
2945
|
-
...external ? { rel: "noopener" } : {}
|
|
2946
|
-
} : { component: "button", type: "button" };
|
|
2947
|
-
return /* @__PURE__ */ jsxs4(
|
|
2948
|
-
ButtonBase,
|
|
2949
|
-
{
|
|
2950
|
-
ref,
|
|
2951
|
-
...anchorProps,
|
|
2952
|
-
onClick,
|
|
2953
|
-
"aria-current": active ? "page" : void 0,
|
|
2954
|
-
"aria-label": rest["aria-label"],
|
|
2955
|
-
"data-section": rest["data-section"],
|
|
2956
|
-
"data-external": external ? "" : void 0,
|
|
2957
|
-
sx: {
|
|
2958
|
-
width: "calc(100% - 16px)",
|
|
2959
|
-
mx: 1,
|
|
2960
|
-
minHeight: size === "touch" ? 44 : 36,
|
|
2961
|
-
px: 1.25,
|
|
2962
|
-
py: 0.5,
|
|
2963
|
-
display: "flex",
|
|
2964
|
-
alignItems: "center",
|
|
2965
|
-
justifyContent: "flex-start",
|
|
2966
|
-
gap: 1.25,
|
|
2967
|
-
borderRadius: 1,
|
|
2968
|
-
textAlign: "left",
|
|
2969
|
-
textDecoration: "none",
|
|
2970
|
-
font: "inherit",
|
|
2971
|
-
fontSize: "0.875rem",
|
|
2972
|
-
fontWeight: active ? 600 : 500,
|
|
2973
|
-
color: active ? theme.palette.text.primary : theme.palette.text.secondary,
|
|
2974
|
-
bgcolor: active ? alpha4(theme.palette.text.primary, 0.08) : "transparent",
|
|
2975
|
-
transition: theme.transitions.create(["background-color", "color"], {
|
|
2976
|
-
duration: theme.transitions.duration.shorter
|
|
2977
|
-
}),
|
|
2978
|
-
"@media (pointer: coarse)": { minHeight: 44 },
|
|
2979
|
-
"&:hover": {
|
|
2980
|
-
color: theme.palette.text.primary,
|
|
2981
|
-
bgcolor: alpha4(theme.palette.text.primary, active ? 0.1 : 0.04)
|
|
2982
|
-
},
|
|
2983
|
-
"&:focus-visible": {
|
|
2984
|
-
outline: `2px solid ${theme.palette.primary.main}`,
|
|
2985
|
-
outlineOffset: "-2px"
|
|
2986
|
-
},
|
|
2987
|
-
"& svg": { flexShrink: 0 }
|
|
2988
|
-
},
|
|
2989
|
-
children: [
|
|
2990
|
-
swatch ? /* @__PURE__ */ jsx6(
|
|
2991
|
-
Box5,
|
|
2992
|
-
{
|
|
2993
|
-
"aria-hidden": true,
|
|
2994
|
-
sx: {
|
|
2995
|
-
width: 10,
|
|
2996
|
-
height: 10,
|
|
2997
|
-
mx: "4px",
|
|
2998
|
-
borderRadius: "50%",
|
|
2999
|
-
bgcolor: swatch,
|
|
3000
|
-
flexShrink: 0
|
|
3001
|
-
}
|
|
3002
|
-
}
|
|
3003
|
-
) : icon,
|
|
3004
|
-
/* @__PURE__ */ jsx6(
|
|
3005
|
-
Box5,
|
|
3006
|
-
{
|
|
3007
|
-
component: "span",
|
|
3008
|
-
sx: {
|
|
3009
|
-
flex: 1,
|
|
3010
|
-
minWidth: 0,
|
|
3011
|
-
overflow: "hidden",
|
|
3012
|
-
textOverflow: "ellipsis",
|
|
3013
|
-
whiteSpace: "nowrap"
|
|
3014
|
-
},
|
|
3015
|
-
children: label
|
|
3016
|
-
}
|
|
3017
|
-
),
|
|
3018
|
-
trailing
|
|
3019
|
-
]
|
|
3020
|
-
}
|
|
3021
|
-
);
|
|
3022
|
-
});
|
|
3023
|
-
|
|
3024
|
-
// src/chat/sidebar/SidebarProjects.tsx
|
|
3025
|
-
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3026
|
-
var SIDEBAR_PROJECT_LIMIT = 6;
|
|
3027
|
-
function summarizeProjects(projects, conversations) {
|
|
3028
|
-
return projects.map((project) => {
|
|
3029
|
-
const chats = conversations.filter((c) => c.projectId === project.id);
|
|
3030
|
-
const newest = chats.reduce((max, c) => Math.max(max, lastActivity(c)), 0);
|
|
3031
|
-
return {
|
|
3032
|
-
project,
|
|
3033
|
-
chatCount: chats.length,
|
|
3034
|
-
activeAt: newest || project.updatedAt.getTime()
|
|
3035
|
-
};
|
|
3036
|
-
}).sort((a, b) => b.activeAt - a.activeAt || a.project.order - b.project.order);
|
|
3037
|
-
}
|
|
3038
|
-
var SidebarProjects = ({
|
|
3039
|
-
activeProjectId,
|
|
3040
|
-
onOpenProject,
|
|
3041
|
-
onAllProjects,
|
|
3042
|
-
onNewProject,
|
|
3043
|
-
size
|
|
3044
|
-
}) => {
|
|
3045
|
-
const theme = useTheme5();
|
|
3046
|
-
const projects = useProjectStore((state) => state.projects);
|
|
3047
|
-
const conversations = useConversationStore((state) => state.conversations);
|
|
3048
|
-
const summaries = useMemo(
|
|
3049
|
-
() => summarizeProjects(projects, listable(conversations)),
|
|
3050
|
-
[projects, conversations]
|
|
3051
|
-
);
|
|
3052
|
-
const shown = summaries.slice(0, SIDEBAR_PROJECT_LIMIT);
|
|
3053
|
-
return /* @__PURE__ */ jsxs5(Box6, { component: "section", "aria-labelledby": "bandit-sidebar-projects", children: [
|
|
3054
|
-
/* @__PURE__ */ jsx7(
|
|
3055
|
-
SidebarCaption,
|
|
3056
|
-
{
|
|
3057
|
-
action: /* @__PURE__ */ jsx7(Tooltip, { title: "New project", arrow: true, children: /* @__PURE__ */ jsx7(
|
|
3058
|
-
IconButton3,
|
|
3059
|
-
{
|
|
3060
|
-
size: "small",
|
|
3061
|
-
"aria-label": "New project",
|
|
3062
|
-
onClick: onNewProject,
|
|
3063
|
-
sx: { color: theme.palette.text.secondary, width: 28, height: 28 },
|
|
3064
|
-
children: /* @__PURE__ */ jsx7(Plus, { size: 16 })
|
|
3065
|
-
}
|
|
3066
|
-
) }),
|
|
3067
|
-
children: /* @__PURE__ */ jsx7("span", { id: "bandit-sidebar-projects", children: "Projects" })
|
|
3068
|
-
}
|
|
3069
|
-
),
|
|
3070
|
-
shown.length === 0 && /* @__PURE__ */ jsx7(
|
|
3071
|
-
Typography4,
|
|
3072
|
-
{
|
|
3073
|
-
variant: "caption",
|
|
3074
|
-
sx: { display: "block", px: 2.25, pb: 1, color: theme.palette.text.secondary },
|
|
3075
|
-
children: "No projects yet."
|
|
3076
|
-
}
|
|
3077
|
-
),
|
|
3078
|
-
shown.map(({ project, chatCount }) => /* @__PURE__ */ jsx7(
|
|
3079
|
-
SectionRow,
|
|
3080
|
-
{
|
|
3081
|
-
"data-section": `project:${project.id}`,
|
|
3082
|
-
swatch: project.color || theme.palette.text.disabled,
|
|
3083
|
-
label: project.name,
|
|
3084
|
-
size,
|
|
3085
|
-
active: activeProjectId === project.id,
|
|
3086
|
-
onClick: () => onOpenProject(project.id),
|
|
3087
|
-
trailing: chatCount > 0 ? /* @__PURE__ */ jsx7(
|
|
3088
|
-
Typography4,
|
|
3089
|
-
{
|
|
3090
|
-
component: "span",
|
|
3091
|
-
variant: "caption",
|
|
3092
|
-
"aria-label": `${chatCount} ${chatCount === 1 ? "chat" : "chats"}`,
|
|
3093
|
-
sx: {
|
|
3094
|
-
color: theme.palette.text.disabled,
|
|
3095
|
-
fontVariantNumeric: "tabular-nums"
|
|
3096
|
-
},
|
|
3097
|
-
children: chatCount
|
|
3098
|
-
}
|
|
3099
|
-
) : null
|
|
3100
|
-
},
|
|
3101
|
-
project.id
|
|
3102
|
-
)),
|
|
3103
|
-
summaries.length > SIDEBAR_PROJECT_LIMIT && /* @__PURE__ */ jsx7(
|
|
3104
|
-
SectionRow,
|
|
3105
|
-
{
|
|
3106
|
-
"data-section": "all-projects",
|
|
3107
|
-
label: `All projects (${summaries.length})`,
|
|
3108
|
-
size,
|
|
3109
|
-
onClick: onAllProjects,
|
|
3110
|
-
icon: /* @__PURE__ */ jsx7(Box6, { "aria-hidden": true, sx: { width: 18 } })
|
|
3111
|
-
}
|
|
3112
|
-
)
|
|
3113
|
-
] });
|
|
3114
|
-
};
|
|
3115
|
-
|
|
3116
|
-
// src/chat/sidebar/SidebarSections.tsx
|
|
3117
|
-
import { Box as Box7 } from "@mui/material";
|
|
3118
|
-
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3119
|
-
var NEW_CHAT_SHORTCUT = ["mod", "shift", "O"];
|
|
3120
|
-
var SEARCH_SHORTCUT = ["mod", "K"];
|
|
3121
|
-
var TOGGLE_SIDEBAR_SHORTCUT = ["mod", "shift", "S"];
|
|
3122
|
-
var useNoSections = () => [];
|
|
3123
|
-
function useHostSections() {
|
|
3124
|
-
const useSections = usePackageSettingsStore(
|
|
3125
|
-
(state) => state.settings?.navigation?.useSections
|
|
3126
|
-
);
|
|
3127
|
-
return (useSections ?? useNoSections)();
|
|
3128
|
-
}
|
|
3129
|
-
var isPlainLeftClick = (event) => event.button === 0 && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey;
|
|
3130
|
-
var SidebarSections = ({
|
|
3131
|
-
onNewChat,
|
|
3132
|
-
onSearch,
|
|
3133
|
-
searchOpen,
|
|
3134
|
-
onProjects,
|
|
3135
|
-
projectsActive,
|
|
3136
|
-
showHints = false,
|
|
3137
|
-
size = "regular",
|
|
3138
|
-
onAfterNavigate
|
|
3139
|
-
}) => {
|
|
3140
|
-
const hostSections = useHostSections();
|
|
3141
|
-
const safeNavigate = useSafeNavigate();
|
|
3142
|
-
const iconSize = 18;
|
|
3143
|
-
const follow = (section) => (event) => {
|
|
3144
|
-
if (!isPlainLeftClick(event)) return;
|
|
3145
|
-
section.onSelect?.(event);
|
|
3146
|
-
if (event.defaultPrevented) {
|
|
3147
|
-
onAfterNavigate?.();
|
|
3148
|
-
return;
|
|
3149
|
-
}
|
|
3150
|
-
if (section.external) {
|
|
3151
|
-
onAfterNavigate?.();
|
|
3152
|
-
return;
|
|
3153
|
-
}
|
|
3154
|
-
event.preventDefault();
|
|
3155
|
-
safeNavigate(section.href);
|
|
3156
|
-
onAfterNavigate?.();
|
|
3157
|
-
};
|
|
3158
|
-
return /* @__PURE__ */ jsxs6(
|
|
3159
|
-
Box7,
|
|
3160
|
-
{
|
|
3161
|
-
component: "nav",
|
|
3162
|
-
"aria-label": "Chat navigation",
|
|
3163
|
-
sx: { display: "flex", flexDirection: "column", gap: 0.25, pt: 0.5, pb: 1 },
|
|
3164
|
-
children: [
|
|
3165
|
-
/* @__PURE__ */ jsx8(
|
|
3166
|
-
SectionRow,
|
|
3167
|
-
{
|
|
3168
|
-
"data-section": "new-chat",
|
|
3169
|
-
icon: /* @__PURE__ */ jsx8(MessageSquarePlus, { size: iconSize }),
|
|
3170
|
-
label: "New chat",
|
|
3171
|
-
size,
|
|
3172
|
-
onClick: onNewChat,
|
|
3173
|
-
trailing: showHints ? /* @__PURE__ */ jsx8(SidebarKbd, { children: shortcutLabel(NEW_CHAT_SHORTCUT) }) : null
|
|
3174
|
-
}
|
|
3175
|
-
),
|
|
3176
|
-
/* @__PURE__ */ jsx8(
|
|
3177
|
-
SectionRow,
|
|
3178
|
-
{
|
|
3179
|
-
"data-section": "search",
|
|
3180
|
-
icon: /* @__PURE__ */ jsx8(Search, { size: iconSize }),
|
|
3181
|
-
label: "Search chats",
|
|
3182
|
-
size,
|
|
3183
|
-
active: searchOpen,
|
|
3184
|
-
onClick: onSearch,
|
|
3185
|
-
"aria-label": searchOpen ? "Close search" : "Search chats",
|
|
3186
|
-
trailing: showHints ? /* @__PURE__ */ jsx8(SidebarKbd, { children: shortcutLabel(SEARCH_SHORTCUT) }) : null
|
|
3187
|
-
}
|
|
3188
|
-
),
|
|
3189
|
-
/* @__PURE__ */ jsx8(
|
|
3190
|
-
SectionRow,
|
|
3191
|
-
{
|
|
3192
|
-
"data-section": "projects",
|
|
3193
|
-
icon: /* @__PURE__ */ jsx8(Folder, { size: iconSize }),
|
|
3194
|
-
label: "Projects",
|
|
3195
|
-
size,
|
|
3196
|
-
active: projectsActive,
|
|
3197
|
-
onClick: onProjects
|
|
3198
|
-
}
|
|
3199
|
-
),
|
|
3200
|
-
hostSections.map((section) => /* @__PURE__ */ jsx8(
|
|
3201
|
-
SectionRow,
|
|
3202
|
-
{
|
|
3203
|
-
"data-section": section.id,
|
|
3204
|
-
icon: section.icon,
|
|
3205
|
-
label: section.label,
|
|
3206
|
-
size,
|
|
3207
|
-
href: section.href,
|
|
3208
|
-
external: section.external,
|
|
3209
|
-
active: section.active,
|
|
3210
|
-
onClick: follow(section)
|
|
3211
|
-
},
|
|
3212
|
-
section.id
|
|
3213
|
-
))
|
|
3214
|
-
]
|
|
3215
|
-
}
|
|
3216
|
-
);
|
|
3217
|
-
};
|
|
3218
|
-
|
|
3219
|
-
// src/chat/sidebar/SidebarUserCard.tsx
|
|
3220
|
-
import { Avatar as Avatar2, Box as Box8, IconButton as IconButton4, Tooltip as Tooltip2, Typography as Typography5, alpha as alpha5 } from "@mui/material";
|
|
3221
|
-
import { useTheme as useTheme6 } from "@mui/material/styles";
|
|
3222
|
-
|
|
3223
|
-
// src/utils/installedApp.ts
|
|
3224
|
-
var isNativeShell = () => {
|
|
3225
|
-
if (typeof window === "undefined") return false;
|
|
3226
|
-
const cap = window.Capacitor;
|
|
3227
|
-
return typeof cap?.isNativePlatform === "function" && cap.isNativePlatform() === true;
|
|
3228
|
-
};
|
|
3229
|
-
var isStandalonePwa = () => {
|
|
3230
|
-
if (typeof window === "undefined") return false;
|
|
3231
|
-
const nav = window.navigator;
|
|
3232
|
-
return window.matchMedia?.("(display-mode: standalone)").matches || nav.standalone === true;
|
|
3233
|
-
};
|
|
3234
|
-
|
|
3235
|
-
// src/chat/sidebar/useSidebarUser.ts
|
|
3236
|
-
import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useState as useState5 } from "react";
|
|
3237
|
-
var BANDIT_AVATAR = "https://cdn.burtson.ai/images/bandit-head.png";
|
|
3238
|
-
var optionalString = (value) => {
|
|
3239
|
-
if (typeof value !== "string") return void 0;
|
|
3240
|
-
const trimmed = value.trim();
|
|
3241
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
3242
|
-
};
|
|
3243
|
-
var deriveInitials = (value) => {
|
|
3244
|
-
const sanitized = (value || "").trim();
|
|
3245
|
-
if (!sanitized) return "B";
|
|
3246
|
-
const words = sanitized.split(/\s+/).filter(Boolean);
|
|
3247
|
-
if (words.length >= 2) {
|
|
3248
|
-
const initials = `${words[0]?.charAt(0) ?? ""}${words[words.length - 1]?.charAt(0) ?? ""}`;
|
|
3249
|
-
return (initials.trim() || sanitized.slice(0, 2)).toUpperCase();
|
|
3250
|
-
}
|
|
3251
|
-
const alphanumeric = sanitized.replace(/[^A-Za-z0-9]/g, "");
|
|
3252
|
-
if (alphanumeric.length >= 1) return alphanumeric.slice(0, 2).toUpperCase();
|
|
3253
|
-
return sanitized.slice(0, 2).toUpperCase();
|
|
3254
|
-
};
|
|
3255
|
-
function useSidebarUser() {
|
|
3256
|
-
const { user } = useAuthenticationStore();
|
|
3257
|
-
const [avatarSrc, setAvatarSrc] = useState5(BANDIT_AVATAR);
|
|
3258
|
-
const claim = useCallback2(
|
|
3259
|
-
(key) => user ? optionalString(user[key]) : void 0,
|
|
3260
|
-
[user]
|
|
3261
|
-
);
|
|
3262
|
-
const displayName = useMemo2(() => {
|
|
3263
|
-
if (!user) return void 0;
|
|
3264
|
-
const candidates = [
|
|
3265
|
-
optionalString(user.name),
|
|
3266
|
-
optionalString(user.preferred_username),
|
|
3267
|
-
user.given_name && user.family_name ? optionalString(`${user.given_name} ${user.family_name}`) : void 0,
|
|
3268
|
-
claim("full_name"),
|
|
3269
|
-
claim("displayName")
|
|
3270
|
-
];
|
|
3271
|
-
return candidates.find(Boolean) ?? optionalString(user.email) ?? user.sub;
|
|
3272
|
-
}, [user, claim]);
|
|
3273
|
-
const secondaryText = useMemo2(() => {
|
|
3274
|
-
if (!user) return void 0;
|
|
3275
|
-
const email = optionalString(user.email);
|
|
3276
|
-
if (email && email !== displayName) return email;
|
|
3277
|
-
const sub = optionalString(user.sub);
|
|
3278
|
-
return sub && sub !== displayName ? sub : void 0;
|
|
3279
|
-
}, [user, displayName]);
|
|
3280
|
-
useEffect5(() => {
|
|
3281
|
-
const fresh = readPersistedToken();
|
|
3282
|
-
const store = useAuthenticationStore.getState();
|
|
3283
|
-
if (fresh && fresh !== store.token) store.setToken(fresh);
|
|
3284
|
-
}, []);
|
|
3285
|
-
useEffect5(() => {
|
|
3286
|
-
let active = true;
|
|
3287
|
-
let objectUrl = null;
|
|
3288
|
-
const resolve = async () => {
|
|
3289
|
-
try {
|
|
3290
|
-
const avatarId = claim("avatarUrl");
|
|
3291
|
-
const fileStorageApiUrl = usePackageSettingsStore.getState().settings?.fileStorageApiUrl;
|
|
3292
|
-
const token = useAuthenticationStore.getState().token;
|
|
3293
|
-
if (avatarId && fileStorageApiUrl && token) {
|
|
3294
|
-
const base = fileStorageApiUrl.replace(/\/$/, "");
|
|
3295
|
-
const response = await fetch(
|
|
3296
|
-
`${base}/app-asset/download/${encodeURIComponent(avatarId)}`,
|
|
3297
|
-
{ headers: { Authorization: `Bearer ${token}` } }
|
|
3298
|
-
);
|
|
3299
|
-
if (response.ok) {
|
|
3300
|
-
const blob = await response.blob();
|
|
3301
|
-
if (active) {
|
|
3302
|
-
objectUrl = URL.createObjectURL(blob);
|
|
3303
|
-
setAvatarSrc(objectUrl);
|
|
3304
|
-
}
|
|
3305
|
-
return;
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3308
|
-
} catch {
|
|
3309
|
-
}
|
|
3310
|
-
try {
|
|
3311
|
-
const branding = await brandingService_default.getBranding();
|
|
3312
|
-
if (active) setAvatarSrc(branding?.logoBase64 || BANDIT_AVATAR);
|
|
3313
|
-
} catch (error) {
|
|
3314
|
-
debugLogger.error("Failed to load branding avatar", {
|
|
3315
|
-
error: error instanceof Error ? error.message : String(error)
|
|
3316
|
-
});
|
|
3317
|
-
if (active) setAvatarSrc(BANDIT_AVATAR);
|
|
3318
|
-
}
|
|
3319
|
-
};
|
|
3320
|
-
void resolve();
|
|
3321
|
-
return () => {
|
|
3322
|
-
active = false;
|
|
3323
|
-
if (objectUrl) URL.revokeObjectURL(objectUrl);
|
|
3324
|
-
};
|
|
3325
|
-
}, [claim]);
|
|
3326
|
-
const label = displayName || user?.email || "Bandit";
|
|
3327
|
-
return {
|
|
3328
|
-
signedIn: Boolean(user),
|
|
3329
|
-
displayName,
|
|
3330
|
-
secondaryText,
|
|
3331
|
-
avatarSrc,
|
|
3332
|
-
initials: deriveInitials(label)
|
|
3333
|
-
};
|
|
3334
|
-
}
|
|
3335
|
-
|
|
3336
|
-
// src/chat/sidebar/SidebarUserCard.tsx
|
|
3337
|
-
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3338
|
-
function goHome(safeNavigate, preferencesHomeUrl) {
|
|
3339
|
-
const homeUrl = preferencesHomeUrl?.trim() || usePackageSettingsStore.getState().settings?.homeUrl?.trim() || "";
|
|
3340
|
-
if (homeUrl) {
|
|
3341
|
-
window.location.href = homeUrl;
|
|
3342
|
-
return;
|
|
3343
|
-
}
|
|
3344
|
-
if (isNativeShell()) {
|
|
3345
|
-
safeNavigate("/chat");
|
|
3346
|
-
return;
|
|
3347
|
-
}
|
|
3348
|
-
if (isStandalonePwa()) {
|
|
3349
|
-
try {
|
|
3350
|
-
sessionStorage.setItem("banditPwaStayOnHome", "true");
|
|
3351
|
-
} catch {
|
|
3352
|
-
}
|
|
3353
|
-
window.location.href = "/?mode=home";
|
|
3354
|
-
return;
|
|
3355
|
-
}
|
|
3356
|
-
window.location.href = "/";
|
|
3357
|
-
}
|
|
3358
|
-
var managementPathFor = (pathname) => pathname.startsWith("/playground") ? "/playground/management" : "/management";
|
|
3359
|
-
var SidebarUserCard = ({ safeAreaBottom }) => {
|
|
3360
|
-
const theme = useTheme6();
|
|
3361
|
-
const user = useSidebarUser();
|
|
3362
|
-
const safeNavigate = useSafeNavigate();
|
|
3363
|
-
const { preferences } = usePreferencesStore();
|
|
3364
|
-
const { showLimitedAdminPanel } = useFeatureVisibility();
|
|
3365
|
-
const managementPath = managementPathFor(
|
|
3366
|
-
typeof window === "undefined" ? "/" : window.location.pathname
|
|
3367
|
-
);
|
|
3368
|
-
const roundButton = {
|
|
3369
|
-
flexShrink: 0,
|
|
3370
|
-
width: 32,
|
|
3371
|
-
height: 32,
|
|
3372
|
-
border: `1px solid ${alpha5(theme.palette.divider, 0.8)}`,
|
|
3373
|
-
color: theme.palette.text.secondary,
|
|
3374
|
-
"&:hover": {
|
|
3375
|
-
color: theme.palette.text.primary,
|
|
3376
|
-
bgcolor: alpha5(theme.palette.text.primary, 0.06)
|
|
3377
|
-
},
|
|
3378
|
-
"&:focus-visible": {
|
|
3379
|
-
outline: `2px solid ${theme.palette.primary.main}`,
|
|
3380
|
-
outlineOffset: "2px"
|
|
3381
|
-
}
|
|
3382
|
-
};
|
|
3383
|
-
return /* @__PURE__ */ jsxs7(
|
|
3384
|
-
Box8,
|
|
3385
|
-
{
|
|
3386
|
-
sx: {
|
|
3387
|
-
mt: "auto",
|
|
3388
|
-
px: 1.5,
|
|
3389
|
-
py: 1.25,
|
|
3390
|
-
pb: safeAreaBottom ? `calc(${theme.spacing(1.25)} + env(safe-area-inset-bottom, 0px))` : 1.25,
|
|
3391
|
-
borderTop: `1px solid ${alpha5(theme.palette.divider, 0.6)}`,
|
|
3392
|
-
display: "flex",
|
|
3393
|
-
alignItems: "center",
|
|
3394
|
-
gap: 1
|
|
3395
|
-
},
|
|
3396
|
-
children: [
|
|
3397
|
-
/* @__PURE__ */ jsxs7(
|
|
3398
|
-
Box8,
|
|
3399
|
-
{
|
|
3400
|
-
component: user.signedIn ? "button" : "div",
|
|
3401
|
-
type: user.signedIn ? "button" : void 0,
|
|
3402
|
-
onClick: user.signedIn ? () => safeNavigate("/profile") : void 0,
|
|
3403
|
-
"aria-label": user.signedIn ? "Profile and account" : void 0,
|
|
3404
|
-
sx: {
|
|
3405
|
-
flex: 1,
|
|
3406
|
-
minWidth: 0,
|
|
3407
|
-
display: "flex",
|
|
3408
|
-
alignItems: "center",
|
|
3409
|
-
gap: 1.25,
|
|
3410
|
-
p: 0.5,
|
|
3411
|
-
m: -0.5,
|
|
3412
|
-
border: 0,
|
|
3413
|
-
borderRadius: 1,
|
|
3414
|
-
bgcolor: "transparent",
|
|
3415
|
-
color: "inherit",
|
|
3416
|
-
font: "inherit",
|
|
3417
|
-
textAlign: "left",
|
|
3418
|
-
cursor: user.signedIn ? "pointer" : "default",
|
|
3419
|
-
"&:hover": user.signedIn ? { bgcolor: alpha5(theme.palette.text.primary, 0.04) } : void 0,
|
|
3420
|
-
"&:focus-visible": {
|
|
3421
|
-
outline: `2px solid ${theme.palette.primary.main}`,
|
|
3422
|
-
outlineOffset: "-2px"
|
|
3423
|
-
}
|
|
3424
|
-
},
|
|
3425
|
-
children: [
|
|
3426
|
-
/* @__PURE__ */ jsx9(
|
|
3427
|
-
Avatar2,
|
|
3428
|
-
{
|
|
3429
|
-
src: user.avatarSrc,
|
|
3430
|
-
alt: "",
|
|
3431
|
-
sx: {
|
|
3432
|
-
width: 34,
|
|
3433
|
-
height: 34,
|
|
3434
|
-
fontSize: "0.9rem",
|
|
3435
|
-
bgcolor: alpha5(theme.palette.primary.main, 0.12),
|
|
3436
|
-
color: theme.palette.primary.main
|
|
3437
|
-
},
|
|
3438
|
-
children: user.initials
|
|
3439
|
-
}
|
|
3440
|
-
),
|
|
3441
|
-
/* @__PURE__ */ jsxs7(Box8, { sx: { minWidth: 0, display: "flex", flexDirection: "column" }, children: [
|
|
3442
|
-
/* @__PURE__ */ jsx9(
|
|
3443
|
-
Typography5,
|
|
3444
|
-
{
|
|
3445
|
-
variant: "subtitle2",
|
|
3446
|
-
noWrap: true,
|
|
3447
|
-
sx: { fontWeight: 600, lineHeight: 1.3 },
|
|
3448
|
-
children: user.signedIn ? user.displayName : "Not signed in"
|
|
3449
|
-
}
|
|
3450
|
-
),
|
|
3451
|
-
/* @__PURE__ */ jsx9(
|
|
3452
|
-
Typography5,
|
|
3453
|
-
{
|
|
3454
|
-
variant: "caption",
|
|
3455
|
-
noWrap: true,
|
|
3456
|
-
sx: { color: theme.palette.text.secondary, lineHeight: 1.3 },
|
|
3457
|
-
children: user.signedIn ? user.secondaryText || "Profile and account" : "Sign in to sync chats"
|
|
3458
|
-
}
|
|
3459
|
-
)
|
|
3460
|
-
] })
|
|
3461
|
-
]
|
|
3462
|
-
}
|
|
3463
|
-
),
|
|
3464
|
-
/* @__PURE__ */ jsx9(Tooltip2, { title: "Home", arrow: true, children: /* @__PURE__ */ jsx9(
|
|
3465
|
-
IconButton4,
|
|
3466
|
-
{
|
|
3467
|
-
"aria-label": "Home",
|
|
3468
|
-
onClick: () => goHome(safeNavigate, preferences.homeUrl),
|
|
3469
|
-
sx: roundButton,
|
|
3470
|
-
children: /* @__PURE__ */ jsx9(Home, { size: 16 })
|
|
3471
|
-
}
|
|
3472
|
-
) }),
|
|
3473
|
-
user.signedIn && showLimitedAdminPanel() && /* @__PURE__ */ jsx9(Tooltip2, { title: "Settings", arrow: true, children: /* @__PURE__ */ jsx9(
|
|
3474
|
-
IconButton4,
|
|
3475
|
-
{
|
|
3476
|
-
"aria-label": "Settings",
|
|
3477
|
-
onClick: () => safeNavigate(managementPath),
|
|
3478
|
-
sx: roundButton,
|
|
3479
|
-
children: /* @__PURE__ */ jsx9(Settings, { size: 16 })
|
|
3480
|
-
}
|
|
3481
|
-
) }),
|
|
3482
|
-
user.signedIn && /* @__PURE__ */ jsx9(Tooltip2, { title: "Sign out", arrow: true, children: /* @__PURE__ */ jsx9(
|
|
3483
|
-
IconButton4,
|
|
3484
|
-
{
|
|
3485
|
-
"aria-label": "Sign out",
|
|
3486
|
-
onClick: () => {
|
|
3487
|
-
authenticationService.clearToken();
|
|
3488
|
-
window.location.href = "/login";
|
|
3489
|
-
},
|
|
3490
|
-
sx: {
|
|
3491
|
-
...roundButton,
|
|
3492
|
-
border: `1px solid ${alpha5(theme.palette.error.main, 0.4)}`,
|
|
3493
|
-
color: theme.palette.error.main,
|
|
3494
|
-
"&:hover": { bgcolor: alpha5(theme.palette.error.main, 0.1) }
|
|
3495
|
-
},
|
|
3496
|
-
children: /* @__PURE__ */ jsx9(LogOut, { size: 16 })
|
|
3497
|
-
}
|
|
3498
|
-
) })
|
|
3499
|
-
]
|
|
3500
|
-
}
|
|
3501
|
-
);
|
|
3502
|
-
};
|
|
3503
|
-
|
|
3504
1814
|
export {
|
|
3505
1815
|
newId,
|
|
3506
1816
|
useAIQueryStore,
|
|
@@ -3511,6 +1821,7 @@ export {
|
|
|
3511
1821
|
sanitizeConversationName,
|
|
3512
1822
|
useConversationStore,
|
|
3513
1823
|
useProjectStore,
|
|
1824
|
+
PROJECT_COLORS,
|
|
3514
1825
|
DEFAULT_TIER_FEATURES,
|
|
3515
1826
|
OSS_DEFAULT_FEATURES,
|
|
3516
1827
|
FeatureFlagContext,
|
|
@@ -3518,7 +1829,6 @@ export {
|
|
|
3518
1829
|
useFeatureFlag,
|
|
3519
1830
|
useFeatures,
|
|
3520
1831
|
useFeatureVisibility,
|
|
3521
|
-
brandingService_default,
|
|
3522
1832
|
light,
|
|
3523
1833
|
dark,
|
|
3524
1834
|
radius,
|
|
@@ -3536,32 +1846,6 @@ export {
|
|
|
3536
1846
|
fileExtensionLabel,
|
|
3537
1847
|
ComposerControl,
|
|
3538
1848
|
appBarTokens,
|
|
3539
|
-
responseTokens
|
|
3540
|
-
isNativeShell,
|
|
3541
|
-
isStandalonePwa,
|
|
3542
|
-
useSafeNavigate,
|
|
3543
|
-
move_conversation_modal_default,
|
|
3544
|
-
simple_conversation_item_default,
|
|
3545
|
-
ProjectDialog,
|
|
3546
|
-
lastActivity,
|
|
3547
|
-
groupByRecency,
|
|
3548
|
-
searchConversations,
|
|
3549
|
-
listable,
|
|
3550
|
-
formatRelative,
|
|
3551
|
-
shortcutLabel,
|
|
3552
|
-
SidebarCaption,
|
|
3553
|
-
summarizeProjects,
|
|
3554
|
-
SidebarProjects,
|
|
3555
|
-
TOGGLE_SIDEBAR_SHORTCUT,
|
|
3556
|
-
useHostSections,
|
|
3557
|
-
SidebarSections,
|
|
3558
|
-
SIDEBAR_WIDTH,
|
|
3559
|
-
writePersistedCollapsed,
|
|
3560
|
-
initialSidebarOpen,
|
|
3561
|
-
useSidebarStore,
|
|
3562
|
-
syncViewWithUrl,
|
|
3563
|
-
useSectionsLayout,
|
|
3564
|
-
managementPathFor,
|
|
3565
|
-
SidebarUserCard
|
|
1849
|
+
responseTokens
|
|
3566
1850
|
};
|
|
3567
|
-
//# sourceMappingURL=chunk-
|
|
1851
|
+
//# sourceMappingURL=chunk-LAH6UL3Q.mjs.map
|