@burtson-labs/bandit-engine 2.0.44 → 2.0.50

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 (57) hide show
  1. package/README.md +7 -5
  2. package/dist/{aiProviderStore-UQI33C5E.mjs → aiProviderStore-3N3VE6D4.mjs} +2 -2
  3. package/dist/chat-CQWZOJH4.mjs +16 -0
  4. package/dist/chat-provider.js +45 -10
  5. package/dist/chat-provider.js.map +1 -1
  6. package/dist/chat-provider.mjs +6 -6
  7. package/dist/{chunk-UXE67LR7.mjs → chunk-6WZUQHZT.mjs} +11 -7
  8. package/dist/chunk-6WZUQHZT.mjs.map +1 -0
  9. package/dist/{chunk-XUBYA5I7.mjs → chunk-7ZDS33S2.mjs} +34 -6
  10. package/dist/chunk-7ZDS33S2.mjs.map +1 -0
  11. package/dist/{chunk-SBNENBUQ.mjs → chunk-AXFX2HUK.mjs} +12 -12
  12. package/dist/{chunk-SBNENBUQ.mjs.map → chunk-AXFX2HUK.mjs.map} +1 -1
  13. package/dist/{chunk-54ZQ3FSN.mjs → chunk-BENL3EF2.mjs} +7 -4
  14. package/dist/chunk-BENL3EF2.mjs.map +1 -0
  15. package/dist/{chunk-RTQDQ6TC.mjs → chunk-EHNWQ4T3.mjs} +2 -2
  16. package/dist/{chunk-KBKWVG7X.mjs → chunk-HKJTRBWC.mjs} +5 -5
  17. package/dist/chunk-KHKWYHXD.mjs +482 -0
  18. package/dist/chunk-KHKWYHXD.mjs.map +1 -0
  19. package/dist/{chunk-QV4ELNLP.mjs → chunk-Q2N7CCZI.mjs} +881 -1289
  20. package/dist/chunk-Q2N7CCZI.mjs.map +1 -0
  21. package/dist/{chunk-ERV7GLY3.mjs → chunk-TVF45U7B.mjs} +5 -5
  22. package/dist/{chunk-H4PBQ5LJ.mjs → chunk-VL3CMSDO.mjs} +4 -4
  23. package/dist/{chunk-JRGCRBWE.mjs → chunk-ZTTGERUG.mjs} +2201 -615
  24. package/dist/chunk-ZTTGERUG.mjs.map +1 -0
  25. package/dist/cli.js +46 -46
  26. package/dist/cli.js.map +1 -1
  27. package/dist/{gateway-5yt_3QDP.d.mts → gateway-oScD5tvE.d.mts} +4 -3
  28. package/dist/{gateway-5yt_3QDP.d.ts → gateway-oScD5tvE.d.ts} +4 -3
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +2178 -507
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +11 -10
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/management/management.js +3462 -1791
  36. package/dist/management/management.js.map +1 -1
  37. package/dist/management/management.mjs +9 -8
  38. package/dist/modals/chat-modal/chat-modal.js +53 -18
  39. package/dist/modals/chat-modal/chat-modal.js.map +1 -1
  40. package/dist/modals/chat-modal/chat-modal.mjs +5 -5
  41. package/dist/{modelStore-UMJBDSEF.mjs → modelStore-XWFHNTBT.mjs} +2 -2
  42. package/dist/public-types.d.mts +2 -1
  43. package/dist/public-types.d.ts +2 -1
  44. package/package.json +3 -3
  45. package/dist/chat-7U633EWN.mjs +0 -15
  46. package/dist/chunk-54ZQ3FSN.mjs.map +0 -1
  47. package/dist/chunk-JRGCRBWE.mjs.map +0 -1
  48. package/dist/chunk-QV4ELNLP.mjs.map +0 -1
  49. package/dist/chunk-UXE67LR7.mjs.map +0 -1
  50. package/dist/chunk-XUBYA5I7.mjs.map +0 -1
  51. /package/dist/{aiProviderStore-UQI33C5E.mjs.map → aiProviderStore-3N3VE6D4.mjs.map} +0 -0
  52. /package/dist/{chat-7U633EWN.mjs.map → chat-CQWZOJH4.mjs.map} +0 -0
  53. /package/dist/{chunk-RTQDQ6TC.mjs.map → chunk-EHNWQ4T3.mjs.map} +0 -0
  54. /package/dist/{chunk-KBKWVG7X.mjs.map → chunk-HKJTRBWC.mjs.map} +0 -0
  55. /package/dist/{chunk-ERV7GLY3.mjs.map → chunk-TVF45U7B.mjs.map} +0 -0
  56. /package/dist/{chunk-H4PBQ5LJ.mjs.map → chunk-VL3CMSDO.mjs.map} +0 -0
  57. /package/dist/{modelStore-UMJBDSEF.mjs.map → modelStore-XWFHNTBT.mjs.map} +0 -0
@@ -1,12 +1,15 @@
1
+ import {
2
+ StreamingMarkdown_default
3
+ } from "./chunk-KHKWYHXD.mjs";
1
4
  import {
2
5
  aiProviderInitService
3
- } from "./chunk-H4PBQ5LJ.mjs";
6
+ } from "./chunk-VL3CMSDO.mjs";
4
7
  import {
5
8
  useMCPToolsStore
6
- } from "./chunk-RTQDQ6TC.mjs";
9
+ } from "./chunk-EHNWQ4T3.mjs";
7
10
  import {
8
11
  chat_modal_default
9
- } from "./chunk-ERV7GLY3.mjs";
12
+ } from "./chunk-TVF45U7B.mjs";
10
13
  import {
11
14
  DocumentCard_default,
12
15
  banditDarkTheme,
@@ -14,7 +17,7 @@ import {
14
17
  predefinedThemes,
15
18
  useNotificationService,
16
19
  useVoiceStore
17
- } from "./chunk-SBNENBUQ.mjs";
20
+ } from "./chunk-AXFX2HUK.mjs";
18
21
  import {
19
22
  authenticationService,
20
23
  brandingService_default,
@@ -27,39 +30,39 @@ import {
27
30
  useFeatures,
28
31
  useKnowledgeStore2 as useKnowledgeStore,
29
32
  useVectorStore
30
- } from "./chunk-UXE67LR7.mjs";
33
+ } from "./chunk-6WZUQHZT.mjs";
31
34
  import {
32
35
  indexedDBService_default,
33
36
  models,
34
37
  useModelStore,
35
38
  usePackageSettingsStore,
36
39
  usePreferencesStore
37
- } from "./chunk-XUBYA5I7.mjs";
40
+ } from "./chunk-7ZDS33S2.mjs";
38
41
  import {
39
42
  AIProviderFactory,
40
43
  GatewayService,
41
44
  useAIProviderStore
42
- } from "./chunk-54ZQ3FSN.mjs";
45
+ } from "./chunk-BENL3EF2.mjs";
43
46
  import {
44
47
  debugLogger
45
48
  } from "./chunk-KCI46M23.mjs";
46
49
 
47
50
  // src/management/management.tsx
48
- import { useState as useState12, useEffect as useEffect9, useCallback as useCallback7 } from "react";
49
- import useMediaQuery6 from "@mui/material/useMediaQuery";
50
- import { alpha as alpha2 } from "@mui/material/styles";
51
+ import { useState as useState14, useEffect as useEffect11, useCallback as useCallback8, useMemo as useMemo6 } from "react";
52
+ import useMediaQuery7 from "@mui/material/useMediaQuery";
53
+ import { alpha as alpha2, createTheme } from "@mui/material/styles";
51
54
  import {
52
- Box as Box11,
53
- Button as Button9,
54
- Typography as Typography11,
55
+ Box as Box13,
56
+ Button as Button10,
57
+ Typography as Typography12,
55
58
  ThemeProvider,
56
59
  CssBaseline,
57
60
  Fab,
58
- List as List2,
59
- ListItemButton,
61
+ List as List3,
62
+ ListItemButton as ListItemButton2,
60
63
  ListItemIcon as ListItemIcon2,
61
64
  ListItemText as ListItemText2,
62
- Divider,
65
+ Divider as Divider2,
63
66
  SwipeableDrawer
64
67
  } from "@mui/material";
65
68
  import FaceRetouchingNaturalIcon from "@mui/icons-material/FaceRetouchingNatural";
@@ -2303,7 +2306,7 @@ var PreferencesTab = ({
2303
2306
  await setAdvancedVectorFeaturesEnabled(enabled);
2304
2307
  if (showSnackbar) {
2305
2308
  showSnackbar(
2306
- enabled ? "Advanced vector features enabled for this account." : "Advanced vector features disabled.",
2309
+ enabled ? "Advanced knowledge sync enabled for this account." : "Advanced knowledge sync disabled.",
2307
2310
  "success"
2308
2311
  );
2309
2312
  }
@@ -2588,8 +2591,8 @@ var PreferencesTab = ({
2588
2591
  }
2589
2592
  ),
2590
2593
  label: /* @__PURE__ */ jsxs3(Box3, { textAlign: "left", children: [
2591
- /* @__PURE__ */ jsx3(Typography3, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Advanced vector features" }),
2592
- /* @__PURE__ */ jsx3(Typography3, { variant: "body2", color: "text.secondary", children: "Keep semantic search, vector memories, and related context in sync across devices" })
2594
+ /* @__PURE__ */ jsx3(Typography3, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Advanced knowledge sync" }),
2595
+ /* @__PURE__ */ jsx3(Typography3, { variant: "body2", color: "text.secondary", children: "Keep richer search, saved memories, and context in sync across devices" })
2593
2596
  ] }),
2594
2597
  sx: { alignSelf: { xs: "flex-start", sm: "center" } }
2595
2598
  }
@@ -3190,6 +3193,7 @@ var LogoCropper = ({
3190
3193
  canvas.width = outputWidth;
3191
3194
  canvas.height = outputHeight;
3192
3195
  ctx.save();
3196
+ ctx.clearRect(0, 0, outputWidth, outputHeight);
3193
3197
  const scaleX = outputWidth / cropDims.width;
3194
3198
  const scaleY = outputHeight / cropDims.height;
3195
3199
  ctx.translate(outputWidth / 2, outputHeight / 2);
@@ -4161,6 +4165,12 @@ var BrandingTab = ({
4161
4165
  };
4162
4166
  var BrandingTab_default = BrandingTab;
4163
4167
 
4168
+ // src/management/components/KnowledgeHubTab.tsx
4169
+ import { useEffect as useEffect7, useState as useState10 } from "react";
4170
+ import { Box as Box9, Tab as Tab2, Tabs as Tabs2, useMediaQuery as useMediaQuery5, useTheme as useTheme6 } from "@mui/material";
4171
+ import DescriptionIcon3 from "@mui/icons-material/Description";
4172
+ import AutoStoriesIcon from "@mui/icons-material/AutoStories";
4173
+
4164
4174
  // src/management/components/KnowledgeTab.tsx
4165
4175
  import { useState as useState8, useMemo as useMemo2, useCallback as useCallback5, useEffect as useEffect5 } from "react";
4166
4176
  import { v4 as uuidv4 } from "uuid";
@@ -4266,30 +4276,29 @@ var defaultSteps = [
4266
4276
  },
4267
4277
  {
4268
4278
  id: "embed",
4269
- title: "Creating Vectors",
4270
- description: "Neural networks are encoding knowledge into searchable vectors...",
4279
+ title: "Making It Searchable",
4280
+ description: "We turn the content into a private, searchable index...",
4271
4281
  icon: /* @__PURE__ */ jsx6(Memory, {}),
4272
4282
  duration: 10
4273
4283
  },
4274
4284
  {
4275
4285
  id: "optimize",
4276
4286
  title: "Optimizing Search",
4277
- description: "AI algorithms are organizing data for lightning-fast retrieval...",
4287
+ description: "Organizing everything for quick, reliable answers...",
4278
4288
  icon: /* @__PURE__ */ jsx6(AutoAwesome, {}),
4279
4289
  duration: 8
4280
4290
  }
4281
4291
  ];
4282
4292
  var cleverMessages = [
4283
- "\u{1F977} Digital ninjas are working their magic...",
4284
- "\u{1F916} AI robots are crunching your data...",
4285
- "\u26A1 Neural networks firing at maximum capacity...",
4286
- "\u{1F9E0} Machine learning models deep in thought...",
4287
- "\u{1F52E} AI wizards casting knowledge spells...",
4288
- "\u2699\uFE0F Quantum processors spinning up...",
4289
- "\u{1F680} Algorithms achieving warp speed...",
4290
- "\u{1F4AB} Creating digital memories from your content...",
4291
- "\u{1F3AF} Precision-targeting knowledge patterns...",
4292
- "\u{1F31F} Transforming text into searchable stardust..."
4293
+ "\u{1F977} Keeping your content safe while we set things up...",
4294
+ "\u{1F916} Getting everything ready for fast answers...",
4295
+ "\u26A1 Tidying the data so responses stay consistent...",
4296
+ "\u{1F9E0} Remembering the important parts for you...",
4297
+ "\u{1F512} Locking in privacy before we share results...",
4298
+ "\u{1F680} Optimizing for quick, reliable lookups...",
4299
+ "\u{1F4AB} Turning this into searchable knowledge...",
4300
+ "\u{1F3AF} Focusing on the details that matter to you...",
4301
+ "\u{1F31F} Making sure it stays available when you need it..."
4293
4302
  ];
4294
4303
  var ProcessingOverlay = ({
4295
4304
  open,
@@ -4877,16 +4886,16 @@ var KnowledgeTab = ({
4877
4886
  const handleDocumentUpload = async (files) => {
4878
4887
  if (shouldUseVector) {
4879
4888
  showProcessing(
4880
- "Uploading to Vector Database",
4889
+ "Uploading to Secure Workspace",
4881
4890
  [
4882
- "\u{1F977} Digital ninjas securing your documents...",
4883
- "\u{1F916} AI robots reading and understanding content...",
4884
- "\u26A1 Neural networks encoding knowledge vectors...",
4885
- "\u{1F9E0} Machine learning creating searchable memories...",
4886
- "\u{1F52E} AI wizards optimizing semantic search...",
4887
- "\u{1F680} Vector embeddings achieving light speed...",
4888
- "\u{1F4AB} Transforming documents into intelligent data...",
4889
- "\u{1F3AF} Precision-targeting knowledge patterns..."
4891
+ "\u{1F977} Keeping your documents private while we prepare them...",
4892
+ "\u{1F916} Reading the content so answers stay accurate...",
4893
+ "\u26A1 Turning pages into a searchable index...",
4894
+ "\u{1F9E0} Remembering highlights for quick recall...",
4895
+ "\u{1F52E} Organizing everything so search feels instant...",
4896
+ "\u{1F680} Optimizing for fast, consistent responses...",
4897
+ "\u{1F4AB} Transforming documents into trusted knowledge...",
4898
+ "\u{1F3AF} Focusing on the details that matter most..."
4890
4899
  ]
4891
4900
  );
4892
4901
  try {
@@ -4960,7 +4969,7 @@ var KnowledgeTab = ({
4960
4969
  progress: 100,
4961
4970
  status: "success"
4962
4971
  })));
4963
- const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to vector database` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
4972
+ const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to your secure workspace` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
4964
4973
  setSnackbarMessage(message);
4965
4974
  setSnackbarSeverity(result.error ? "warning" : "success");
4966
4975
  setShowSnackbar(true);
@@ -5021,7 +5030,7 @@ var KnowledgeTab = ({
5021
5030
  progress: 100,
5022
5031
  status: "success"
5023
5032
  })));
5024
- const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to vector database` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
5033
+ const message = result.usedVector ? `Successfully uploaded ${files.length} document(s) to your secure workspace` : result.error ? `Upload completed with warnings: ${result.error}` : `Successfully uploaded ${files.length} document(s)`;
5025
5034
  setSnackbarMessage(message);
5026
5035
  setSnackbarSeverity(result.error ? "warning" : "success");
5027
5036
  setShowSnackbar(true);
@@ -5199,7 +5208,7 @@ var KnowledgeTab = ({
5199
5208
  shouldUseVector && /* @__PURE__ */ jsx7(
5200
5209
  Chip5,
5201
5210
  {
5202
- label: "Vector DB",
5211
+ label: "Synced",
5203
5212
  color: "primary",
5204
5213
  size: "small",
5205
5214
  sx: { ml: 1 }
@@ -5216,7 +5225,7 @@ var KnowledgeTab = ({
5216
5225
  sx: { fontSize: { xs: "0.95rem", sm: "1rem" }, lineHeight: 1.5 },
5217
5226
  children: [
5218
5227
  "Add documents to your private knowledge base. Files are securely stored ",
5219
- shouldUseVector ? "in the vector database" : "locally in your browser",
5228
+ shouldUseVector ? "in your private workspace" : "locally in your browser",
5220
5229
  "."
5221
5230
  ]
5222
5231
  }
@@ -5552,7 +5561,7 @@ var KnowledgeTab = ({
5552
5561
  filteredAndSortedDocuments.length === 0 ? /* @__PURE__ */ jsx7(Card3, { sx: { textAlign: "center", py: 8 }, children: /* @__PURE__ */ jsxs7(CardContent3, { children: [
5553
5562
  /* @__PURE__ */ jsx7(FolderIcon, { sx: { fontSize: 64, color: "text.secondary", mb: 2 } }),
5554
5563
  /* @__PURE__ */ jsx7(Typography7, { variant: "h6", color: "text.secondary", gutterBottom: true, children: "No Documents Yet" }),
5555
- /* @__PURE__ */ jsx7(Typography7, { variant: "body2", color: "text.secondary", children: shouldUseVector ? "Upload and embed your first document to get started with advanced vector search" : "Upload your first document to get started" })
5564
+ /* @__PURE__ */ jsx7(Typography7, { variant: "body2", color: "text.secondary", children: shouldUseVector ? "Upload and embed your first document to get started with advanced search" : "Upload your first document to get started" })
5556
5565
  ] }) }) : /* @__PURE__ */ jsxs7(Box7, { children: [
5557
5566
  /* @__PURE__ */ jsxs7(Typography7, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: [
5558
5567
  "Showing ",
@@ -5561,7 +5570,7 @@ var KnowledgeTab = ({
5561
5570
  shouldUseVector ? vectorDocuments.length : documents.length,
5562
5571
  " documents",
5563
5572
  searchQuery && ` for "${searchQuery}"`,
5564
- shouldUseVector && ` (Vector Database)`
5573
+ shouldUseVector && ` (Synced workspace)`
5565
5574
  ] }),
5566
5575
  viewMode === "grid" ? /* @__PURE__ */ jsx7(
5567
5576
  Box7,
@@ -5919,214 +5928,1694 @@ var KnowledgeTab = ({
5919
5928
  };
5920
5929
  var KnowledgeTab_default = KnowledgeTab;
5921
5930
 
5922
- // src/management/components/StorageTab.tsx
5923
- import { useState as useState9, useEffect as useEffect6, useMemo as useMemo3 } from "react";
5931
+ // src/management/components/SeedPacksTab.tsx
5932
+ import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo3, useRef as useRef5, useState as useState9 } from "react";
5924
5933
  import {
5934
+ Alert as Alert7,
5925
5935
  Box as Box8,
5926
- Typography as Typography8,
5927
5936
  Button as Button7,
5928
5937
  Card as Card4,
5929
5938
  CardContent as CardContent4,
5930
- LinearProgress as LinearProgress3,
5939
+ Chip as Chip6,
5931
5940
  Dialog as Dialog6,
5932
- DialogTitle as DialogTitle5,
5941
+ DialogActions as DialogActions5,
5933
5942
  DialogContent as DialogContent6,
5934
5943
  DialogContentText as DialogContentText3,
5935
- DialogActions as DialogActions5,
5936
- Alert as Alert7,
5937
- Stack as Stack3,
5938
- Chip as Chip6,
5939
- Accordion,
5940
- AccordionSummary,
5941
- AccordionDetails,
5944
+ DialogTitle as DialogTitle5,
5945
+ Divider,
5946
+ IconButton as IconButton5,
5947
+ LinearProgress as LinearProgress3,
5942
5948
  List,
5943
- ListItem,
5944
- ListItemIcon,
5945
- ListItemText,
5946
- CircularProgress,
5949
+ ListItemButton,
5947
5950
  Snackbar as Snackbar3,
5948
- useTheme as useTheme6
5951
+ Stack as Stack3,
5952
+ TextField as TextField5,
5953
+ Tooltip as Tooltip2,
5954
+ Typography as Typography8
5949
5955
  } from "@mui/material";
5950
- import StorageIcon from "@mui/icons-material/Storage";
5956
+ import AddIcon from "@mui/icons-material/Add";
5957
+ import ArchiveIcon from "@mui/icons-material/Archive";
5951
5958
  import DeleteIcon3 from "@mui/icons-material/Delete";
5952
- import RefreshIcon2 from "@mui/icons-material/Refresh";
5953
- import WarningIcon from "@mui/icons-material/Warning";
5954
- import InfoIcon from "@mui/icons-material/Info";
5955
- import CleaningServicesIcon from "@mui/icons-material/CleaningServices";
5956
5959
  import DescriptionIcon2 from "@mui/icons-material/Description";
5960
+ import GroupIcon2 from "@mui/icons-material/Group";
5957
5961
  import PersonIcon2 from "@mui/icons-material/Person";
5958
- import ChatIcon from "@mui/icons-material/Chat";
5959
- import SettingsIcon from "@mui/icons-material/Settings";
5960
- import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
5961
- import CheckCircleIcon3 from "@mui/icons-material/CheckCircle";
5962
- import ErrorIcon3 from "@mui/icons-material/Error";
5963
- import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
5964
- var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
5965
- var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
5966
- var formatBytes = (bytes) => {
5967
- if (bytes === 0) return "0 B";
5968
- const k = 1024;
5969
- const sizes = ["B", "KB", "MB", "GB", "TB"];
5970
- const i = Math.floor(Math.log(bytes) / Math.log(k));
5971
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
5962
+ import PublishIcon from "@mui/icons-material/Publish";
5963
+ import RefreshIcon2 from "@mui/icons-material/Refresh";
5964
+ import SaveIcon2 from "@mui/icons-material/Save";
5965
+ import SearchIcon2 from "@mui/icons-material/Search";
5966
+ import UploadFileIcon2 from "@mui/icons-material/UploadFile";
5967
+
5968
+ // src/services/seedPacks/seedPackService.ts
5969
+ var HttpResponseError = class extends Error {
5970
+ constructor(message, status, payload, code) {
5971
+ super(message);
5972
+ this.status = status;
5973
+ this.payload = payload;
5974
+ this.code = code;
5975
+ this.name = "HttpResponseError";
5976
+ }
5972
5977
  };
5973
- var getStorageQuota = async () => {
5974
- try {
5975
- if ("storage" in navigator && "estimate" in navigator.storage) {
5976
- const estimate = await navigator.storage.estimate();
5977
- return {
5978
- used: estimate.usage || 0,
5979
- quota: estimate.quota || 0
5980
- };
5978
+ var isRecord = (value) => typeof value === "object" && value !== null;
5979
+ var getString = (record, key) => {
5980
+ const value = record[key];
5981
+ return typeof value === "string" ? value : void 0;
5982
+ };
5983
+ var getNumber = (record, key) => {
5984
+ const value = record[key];
5985
+ if (typeof value === "number") {
5986
+ return value;
5987
+ }
5988
+ if (typeof value === "string") {
5989
+ const parsed = Number(value);
5990
+ if (!Number.isNaN(parsed)) {
5991
+ return parsed;
5981
5992
  }
5993
+ }
5994
+ return void 0;
5995
+ };
5996
+ var getStringArray = (record, key) => {
5997
+ const value = record[key];
5998
+ if (Array.isArray(value)) {
5999
+ return value.filter((item) => typeof item === "string");
6000
+ }
6001
+ if (typeof value === "string") {
6002
+ return value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
6003
+ }
6004
+ return void 0;
6005
+ };
6006
+ var toSeedPackStatus = (value) => {
6007
+ if (value === "draft" || value === "published" || value === "archived") {
6008
+ return value;
6009
+ }
6010
+ return "draft";
6011
+ };
6012
+ var toSeedPackScope = (value) => {
6013
+ if (value === "team" || value === "user") {
6014
+ return value;
6015
+ }
6016
+ return void 0;
6017
+ };
6018
+ var normalizeSeedPack = (record) => {
6019
+ const sid = getString(record, "sid") ?? getString(record, "id") ?? "";
6020
+ return {
6021
+ sid,
6022
+ name: getString(record, "name") ?? "Untitled Seed Pack",
6023
+ description: getString(record, "description"),
6024
+ status: toSeedPackStatus(getString(record, "status")),
6025
+ version: getNumber(record, "version"),
6026
+ contentType: getString(record, "contentType") ?? "markdown",
6027
+ content: getString(record, "content"),
6028
+ summary: getString(record, "summary"),
6029
+ tags: getStringArray(record, "tags"),
6030
+ scopeType: toSeedPackScope(getString(record, "scopeType")),
6031
+ scopeSid: getString(record, "scopeSid"),
6032
+ createdBySid: getString(record, "createdBySid"),
6033
+ updatedBySid: getString(record, "updatedBySid"),
6034
+ publishedBySid: getString(record, "publishedBySid"),
6035
+ createdAt: getString(record, "createdAt"),
6036
+ updatedAt: getString(record, "updatedAt"),
6037
+ publishedAt: getString(record, "publishedAt")
6038
+ };
6039
+ };
6040
+ var extractSeedPack = (payload) => {
6041
+ if (!isRecord(payload)) {
6042
+ return null;
6043
+ }
6044
+ const candidate = isRecord(payload.seedPack) && payload.seedPack || isRecord(payload.data) && payload.data || payload;
6045
+ if (!isRecord(candidate)) {
6046
+ return null;
6047
+ }
6048
+ const pack = normalizeSeedPack(candidate);
6049
+ if (!pack.sid) {
6050
+ return null;
6051
+ }
6052
+ return pack;
6053
+ };
6054
+ var extractSeedPackList = (payload) => {
6055
+ if (Array.isArray(payload)) {
6056
+ return payload.map((item) => isRecord(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
6057
+ }
6058
+ if (!isRecord(payload)) {
6059
+ return [];
6060
+ }
6061
+ const candidates = [
6062
+ payload.seedPacks,
6063
+ payload.items,
6064
+ payload.results,
6065
+ payload.data
6066
+ ];
6067
+ const list = candidates.find(Array.isArray);
6068
+ if (!Array.isArray(list)) {
6069
+ return [];
6070
+ }
6071
+ return list.map((item) => isRecord(item) ? normalizeSeedPack(item) : null).filter((item) => Boolean(item?.sid));
6072
+ };
6073
+ var buildUrl = (path) => {
6074
+ const base = usePackageSettingsStore.getState().settings?.gatewayApiUrl?.replace(/\/$/, "");
6075
+ if (!base) {
6076
+ throw new Error("Gateway API is not configured");
6077
+ }
6078
+ const normalized = path.startsWith("/") ? path : `/${path}`;
6079
+ return `${base}${normalized}`;
6080
+ };
6081
+ var buildHeaders = () => {
6082
+ const headers = {
6083
+ "Content-Type": "application/json"
6084
+ };
6085
+ const token = authenticationService.getToken();
6086
+ if (token) {
6087
+ headers.Authorization = `Bearer ${token}`;
6088
+ }
6089
+ return headers;
6090
+ };
6091
+ var handleJsonResponse = async (response, fallbackMessage) => {
6092
+ let data = null;
6093
+ try {
6094
+ data = await response.json();
5982
6095
  } catch (error) {
5983
- debugLogger.warn("Could not get storage estimate", { error });
6096
+ debugLogger.warn("seedPackService: failed to parse JSON response", { error });
5984
6097
  }
5985
- return { used: 0, quota: 0 };
6098
+ if (!response.ok) {
6099
+ const record = isRecord(data) ? data : {};
6100
+ const message = getString(record, "error") || getString(record, "message") || getString(record, "detail") || fallbackMessage;
6101
+ const code = getString(record, "code") || getString(record, "error_code");
6102
+ throw new HttpResponseError(message, response.status, data, code);
6103
+ }
6104
+ return data;
5986
6105
  };
5987
- var getIndexedDBSize = async () => {
5988
- const categories = [];
6106
+ var buildDraftPayload = (draft) => {
6107
+ const payload = {
6108
+ name: draft.name,
6109
+ contentType: draft.contentType ?? "markdown"
6110
+ };
6111
+ if (draft.description !== void 0) {
6112
+ payload.description = draft.description;
6113
+ }
6114
+ if (draft.content !== void 0) {
6115
+ payload.content = draft.content;
6116
+ }
6117
+ if (draft.tags) {
6118
+ payload.tags = draft.tags;
6119
+ }
6120
+ return payload;
6121
+ };
6122
+ var listSeedPacks = async () => {
6123
+ const url = buildUrl("/seed-packs");
5989
6124
  try {
5990
- debugLogger.info("Starting IndexedDB size estimation");
5991
- try {
5992
- const databases = await indexedDB.databases();
5993
- debugLogger.info("Available IndexedDB databases:", {
5994
- databases: databases.map((db) => ({ name: db.name, version: db.version }))
5995
- });
5996
- } catch (error) {
5997
- debugLogger.warn("Could not list databases", { error });
5998
- }
5999
- const conversationDbNames = ["bandit-conversations", "banditConversations", "conversations"];
6000
- let chatSize = { size: 0, count: 0 };
6001
- let foundConversationDb = "";
6002
- for (const dbName of conversationDbNames) {
6003
- try {
6004
- const result = await estimateStoreSize(dbName, "conversations");
6005
- if (result.count > 0) {
6006
- chatSize = result;
6007
- foundConversationDb = dbName;
6008
- debugLogger.info(`Found conversations in database: ${dbName}`);
6009
- break;
6010
- }
6011
- } catch (error) {
6012
- debugLogger.warn(`Failed to check conversations in ${dbName}`, { error });
6013
- }
6125
+ const response = await fetch(url, { method: "GET", headers: buildHeaders() });
6126
+ const payload = await handleJsonResponse(response, "Failed to load seed packs");
6127
+ return extractSeedPackList(payload);
6128
+ } catch (error) {
6129
+ debugLogger.error("seedPackService: failed to list seed packs", {
6130
+ error: error instanceof Error ? error.message : String(error)
6131
+ });
6132
+ throw error;
6133
+ }
6134
+ };
6135
+ var getSeedPack = async (sid) => {
6136
+ const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}`);
6137
+ try {
6138
+ const response = await fetch(url, { method: "GET", headers: buildHeaders() });
6139
+ const payload = await handleJsonResponse(response, "Failed to load seed pack");
6140
+ const pack = extractSeedPack(payload);
6141
+ if (!pack) {
6142
+ throw new Error("Seed pack response was empty");
6014
6143
  }
6015
- categories.push({
6016
- name: "Chat History",
6017
- icon: ChatIcon,
6018
- color: "#4caf50",
6019
- size: chatSize.size,
6020
- itemCount: chatSize.count,
6021
- description: "Conversation history and messages",
6022
- stores: foundConversationDb ? [`${foundConversationDb}.conversations`] : [],
6023
- canClear: chatSize.count > 0,
6024
- clearWarning: "This will permanently delete all your chat conversations and message history."
6144
+ return pack;
6145
+ } catch (error) {
6146
+ debugLogger.error("seedPackService: failed to load seed pack", {
6147
+ sid,
6148
+ error: error instanceof Error ? error.message : String(error)
6025
6149
  });
6026
- debugLogger.info(`Chat History category created:`, {
6027
- itemCount: chatSize.count,
6028
- size: chatSize.size,
6029
- canClear: chatSize.count > 0,
6030
- foundDb: foundConversationDb
6150
+ throw error;
6151
+ }
6152
+ };
6153
+ var createSeedPack = async (draft) => {
6154
+ const url = buildUrl("/seed-packs");
6155
+ try {
6156
+ const response = await fetch(url, {
6157
+ method: "POST",
6158
+ headers: buildHeaders(),
6159
+ body: JSON.stringify(buildDraftPayload(draft))
6031
6160
  });
6032
- const knowledgeDbNames = ["bandit-knowledge", "banditKnowledge", "knowledge"];
6033
- let knowledgeSize = { size: 0, count: 0 };
6034
- let foundKnowledgeDb = "";
6035
- for (const dbName of knowledgeDbNames) {
6036
- try {
6037
- const result = await estimateStoreSize(dbName, "documents");
6038
- debugLogger.info(`Knowledge database ${dbName} check result:`, {
6039
- size: result.size,
6040
- count: result.count,
6041
- sizeFormatted: `${(result.size / 1024).toFixed(2)} KB`
6042
- });
6043
- if (result.count > 0) {
6044
- knowledgeSize = result;
6045
- foundKnowledgeDb = dbName;
6046
- debugLogger.info(`Found knowledge documents in database: ${dbName}`, {
6047
- totalSize: result.size,
6048
- itemCount: result.count
6049
- });
6050
- break;
6051
- }
6052
- } catch (error) {
6053
- debugLogger.warn(`Failed to check knowledge in ${dbName}`, { error });
6054
- }
6161
+ const payload = await handleJsonResponse(response, "Failed to create seed pack");
6162
+ const pack = extractSeedPack(payload);
6163
+ if (!pack) {
6164
+ throw new Error("Seed pack response was empty");
6055
6165
  }
6056
- categories.push({
6057
- name: "Knowledge Documents",
6058
- icon: DescriptionIcon2,
6059
- color: "#2196f3",
6060
- size: knowledgeSize.size,
6061
- itemCount: knowledgeSize.count,
6062
- description: "Uploaded documents and their embeddings",
6063
- stores: foundKnowledgeDb ? [`${foundKnowledgeDb}.documents`] : [],
6064
- canClear: knowledgeSize.count > 0,
6065
- clearWarning: "This will remove all uploaded documents and their AI embeddings. You will need to re-upload documents."
6166
+ return pack;
6167
+ } catch (error) {
6168
+ debugLogger.error("seedPackService: failed to create seed pack", {
6169
+ error: error instanceof Error ? error.message : String(error)
6066
6170
  });
6067
- debugLogger.info(`Knowledge Documents category created:`, {
6068
- itemCount: knowledgeSize.count,
6069
- size: knowledgeSize.size,
6070
- sizeFormatted: `${(knowledgeSize.size / 1024).toFixed(2)} KB`,
6071
- canClear: knowledgeSize.count > 0,
6072
- foundDb: foundKnowledgeDb
6171
+ throw error;
6172
+ }
6173
+ };
6174
+ var updateSeedPack = async (sid, draft) => {
6175
+ const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}`);
6176
+ try {
6177
+ const response = await fetch(url, {
6178
+ method: "PUT",
6179
+ headers: buildHeaders(),
6180
+ body: JSON.stringify(buildDraftPayload(draft))
6073
6181
  });
6074
- const memoryDbNames = ["bandit-memory-db", "banditMemories", "bandit-memories"];
6075
- let memorySize = { size: 0, count: 0 };
6076
- let foundMemoryDb = "";
6077
- for (const dbName of memoryDbNames) {
6078
- try {
6079
- const result = await estimateStoreSize(dbName, "memories");
6080
- if (result.count > 0) {
6081
- memorySize = result;
6082
- foundMemoryDb = dbName;
6083
- debugLogger.info(`Found memories in database: ${dbName}`);
6084
- break;
6085
- }
6086
- } catch (error) {
6087
- debugLogger.warn(`Failed to check memories in ${dbName}`, { error });
6088
- }
6182
+ const payload = await handleJsonResponse(response, "Failed to update seed pack");
6183
+ const pack = extractSeedPack(payload);
6184
+ if (!pack) {
6185
+ throw new Error("Seed pack response was empty");
6089
6186
  }
6090
- categories.push({
6091
- name: "AI Memories",
6092
- icon: PersonIcon2,
6093
- color: "#ff9800",
6094
- size: memorySize.size,
6095
- itemCount: memorySize.count,
6096
- description: "AI memory entries and learned patterns",
6097
- stores: foundMemoryDb ? [`${foundMemoryDb}.memories`] : [],
6098
- canClear: memorySize.count > 0,
6099
- clearWarning: "This will delete all AI memory entries and learned conversation patterns."
6187
+ return pack;
6188
+ } catch (error) {
6189
+ debugLogger.error("seedPackService: failed to update seed pack", {
6190
+ sid,
6191
+ error: error instanceof Error ? error.message : String(error)
6100
6192
  });
6101
- const configDbNames = ["banditConfig", "bandit-config"];
6102
- let configSize = { size: 0, count: 0 };
6103
- let foundConfigDb = "";
6104
- for (const dbName of configDbNames) {
6105
- try {
6106
- const result = await estimateStoreSize(dbName, "config");
6107
- if (result.count > 0) {
6108
- configSize = result;
6109
- foundConfigDb = dbName;
6110
- debugLogger.info(`Found config in database: ${dbName}`);
6111
- break;
6112
- }
6113
- } catch (error) {
6114
- debugLogger.warn(`Failed to check config in ${dbName}`, { error });
6115
- }
6193
+ throw error;
6194
+ }
6195
+ };
6196
+ var publishSeedPack = async (sid) => {
6197
+ const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}/publish`);
6198
+ try {
6199
+ const response = await fetch(url, { method: "POST", headers: buildHeaders() });
6200
+ const payload = await handleJsonResponse(response, "Failed to publish seed pack");
6201
+ const pack = extractSeedPack(payload);
6202
+ if (!pack) {
6203
+ throw new Error("Seed pack response was empty");
6116
6204
  }
6117
- categories.push({
6118
- name: "App Settings & Models",
6119
- icon: SettingsIcon,
6120
- color: "#9c27b0",
6121
- size: configSize.size,
6122
- itemCount: configSize.count,
6123
- description: "Custom models, app settings, and user preferences",
6124
- stores: foundConfigDb ? [`${foundConfigDb}.config`] : [],
6125
- canClear: configSize.count > 0,
6126
- clearWarning: "This will delete all custom AI models, app settings, themes, and preferences. The app will reset to defaults."
6205
+ return pack;
6206
+ } catch (error) {
6207
+ debugLogger.error("seedPackService: failed to publish seed pack", {
6208
+ sid,
6209
+ error: error instanceof Error ? error.message : String(error)
6127
6210
  });
6128
- const queryDbNames = ["banditAIQuery", "ai-query-db"];
6129
- let querySize = { size: 0, count: 0 };
6211
+ throw error;
6212
+ }
6213
+ };
6214
+ var archiveSeedPack = async (sid) => {
6215
+ const url = buildUrl(`/seed-packs/${encodeURIComponent(sid)}/archive`);
6216
+ try {
6217
+ const response = await fetch(url, { method: "POST", headers: buildHeaders() });
6218
+ const payload = await handleJsonResponse(response, "Failed to archive seed pack");
6219
+ const pack = extractSeedPack(payload);
6220
+ if (!pack) {
6221
+ throw new Error("Seed pack response was empty");
6222
+ }
6223
+ return pack;
6224
+ } catch (error) {
6225
+ debugLogger.error("seedPackService: failed to archive seed pack", {
6226
+ sid,
6227
+ error: error instanceof Error ? error.message : String(error)
6228
+ });
6229
+ throw error;
6230
+ }
6231
+ };
6232
+
6233
+ // src/management/components/SeedPacksTab.tsx
6234
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
6235
+ var parseTags = (value) => value.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0);
6236
+ var normalizeTags = (tags) => (tags ?? []).map((tag) => tag.trim()).filter((tag) => tag.length > 0);
6237
+ var areArraysEqual = (a, b) => {
6238
+ if (a.length !== b.length) {
6239
+ return false;
6240
+ }
6241
+ return a.every((value, index) => value === b[index]);
6242
+ };
6243
+ var formatTimestamp = (value) => {
6244
+ if (!value) {
6245
+ return "Not set";
6246
+ }
6247
+ const parsed = Date.parse(value);
6248
+ if (Number.isNaN(parsed)) {
6249
+ return value;
6250
+ }
6251
+ return new Date(parsed).toLocaleString();
6252
+ };
6253
+ var formatFileSize2 = (bytes) => {
6254
+ if (bytes === 0) return "0 B";
6255
+ const k = 1024;
6256
+ const sizes = ["B", "KB", "MB", "GB"];
6257
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
6258
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
6259
+ };
6260
+ var getPreviewSnippet = (content) => {
6261
+ const trimmed = content.trim();
6262
+ if (!trimmed) {
6263
+ return "No preview available";
6264
+ }
6265
+ return trimmed.length > 120 ? `${trimmed.slice(0, 120)}...` : trimmed;
6266
+ };
6267
+ var mergeMarkdownFiles = (existing, incoming) => {
6268
+ const next = [...existing];
6269
+ incoming.forEach((file) => {
6270
+ const index = next.findIndex((item) => item.name === file.name);
6271
+ if (index >= 0) {
6272
+ next[index] = file;
6273
+ } else {
6274
+ next.push(file);
6275
+ }
6276
+ });
6277
+ return next;
6278
+ };
6279
+ var buildMarkdownContent = (files) => {
6280
+ return files.map((file) => file.content.trim()).filter((content) => content.length > 0).join("\n\n---\n\n");
6281
+ };
6282
+ var readMarkdownFiles = async (files) => {
6283
+ const list = Array.from(files);
6284
+ const markdownFiles = list.filter((file) => file.name.toLowerCase().endsWith(".md"));
6285
+ const imported = await Promise.all(
6286
+ markdownFiles.map(async (file) => ({
6287
+ id: `${file.name}-${file.lastModified}`,
6288
+ name: file.name,
6289
+ size: file.size,
6290
+ content: await file.text(),
6291
+ lastModified: file.lastModified
6292
+ }))
6293
+ );
6294
+ return { imported, skipped: list.length - markdownFiles.length };
6295
+ };
6296
+ var getStatusChip = (status) => {
6297
+ switch (status) {
6298
+ case "published":
6299
+ return { label: "Published", color: "success" };
6300
+ case "archived":
6301
+ return { label: "Archived", color: "default" };
6302
+ case "draft":
6303
+ default:
6304
+ return { label: "Draft", color: "warning" };
6305
+ }
6306
+ };
6307
+ var getSeedPackTimestamp = (pack) => {
6308
+ const candidate = pack.updatedAt ?? pack.publishedAt ?? pack.createdAt;
6309
+ if (!candidate) {
6310
+ return 0;
6311
+ }
6312
+ const parsed = Date.parse(candidate);
6313
+ return Number.isNaN(parsed) ? 0 : parsed;
6314
+ };
6315
+ var SeedPackFileCard = ({ file, onPreview, onRemove, isReadOnly }) => /* @__PURE__ */ jsx8(
6316
+ Card4,
6317
+ {
6318
+ sx: {
6319
+ position: "relative",
6320
+ height: { xs: 240, sm: 260, md: 280 },
6321
+ cursor: "pointer",
6322
+ transition: "all 0.3s ease-in-out",
6323
+ border: "1px solid",
6324
+ borderColor: "divider",
6325
+ bgcolor: "background.paper",
6326
+ display: "flex",
6327
+ flexDirection: "column",
6328
+ "&:hover": {
6329
+ boxShadow: 6,
6330
+ transform: "translateY(-2px)"
6331
+ }
6332
+ },
6333
+ onClick: onPreview,
6334
+ children: /* @__PURE__ */ jsxs8(
6335
+ CardContent4,
6336
+ {
6337
+ sx: {
6338
+ p: { xs: 1.5, sm: 2 },
6339
+ height: "100%",
6340
+ display: "flex",
6341
+ flexDirection: "column",
6342
+ overflow: "hidden"
6343
+ },
6344
+ children: [
6345
+ /* @__PURE__ */ jsxs8(
6346
+ Box8,
6347
+ {
6348
+ sx: {
6349
+ display: "flex",
6350
+ justifyContent: "space-between",
6351
+ alignItems: "flex-start",
6352
+ mb: 1,
6353
+ height: 32
6354
+ },
6355
+ children: [
6356
+ /* @__PURE__ */ jsx8(DescriptionIcon2, { sx: { fontSize: 32, color: "#388e3c", flexShrink: 0 } }),
6357
+ !isReadOnly && /* @__PURE__ */ jsx8(
6358
+ IconButton5,
6359
+ {
6360
+ size: "small",
6361
+ color: "error",
6362
+ onClick: (event) => {
6363
+ event.stopPropagation();
6364
+ onRemove();
6365
+ },
6366
+ sx: { width: 24, height: 24 },
6367
+ children: /* @__PURE__ */ jsx8(DeleteIcon3, { fontSize: "small" })
6368
+ }
6369
+ )
6370
+ ]
6371
+ }
6372
+ ),
6373
+ /* @__PURE__ */ jsx8(
6374
+ Box8,
6375
+ {
6376
+ sx: {
6377
+ mb: 1.5,
6378
+ p: { xs: 1, sm: 1.5 },
6379
+ borderRadius: 1.5,
6380
+ bgcolor: "background.paper",
6381
+ border: "1px solid",
6382
+ borderColor: "divider",
6383
+ overflow: "hidden",
6384
+ position: "relative",
6385
+ height: { xs: 60, sm: 70, md: 80 },
6386
+ display: "flex",
6387
+ alignItems: "center"
6388
+ },
6389
+ children: /* @__PURE__ */ jsx8(
6390
+ Typography8,
6391
+ {
6392
+ variant: "body2",
6393
+ sx: {
6394
+ display: "-webkit-box",
6395
+ WebkitLineClamp: 3,
6396
+ WebkitBoxOrient: "vertical",
6397
+ overflow: "hidden",
6398
+ textOverflow: "ellipsis",
6399
+ color: "text.secondary",
6400
+ lineHeight: 1.3,
6401
+ fontSize: "0.8rem"
6402
+ },
6403
+ children: getPreviewSnippet(file.content)
6404
+ }
6405
+ )
6406
+ }
6407
+ ),
6408
+ /* @__PURE__ */ jsx8(Tooltip2, { title: file.name, arrow: true, children: /* @__PURE__ */ jsx8(
6409
+ Typography8,
6410
+ {
6411
+ variant: "body2",
6412
+ sx: {
6413
+ fontWeight: 600,
6414
+ whiteSpace: "nowrap",
6415
+ overflow: "hidden",
6416
+ textOverflow: "ellipsis",
6417
+ mb: 1,
6418
+ color: "text.primary",
6419
+ fontSize: { xs: "0.8rem", sm: "0.875rem" },
6420
+ height: { xs: "1.2rem", sm: "1.3rem" }
6421
+ },
6422
+ children: file.name
6423
+ }
6424
+ ) }),
6425
+ /* @__PURE__ */ jsxs8(
6426
+ Box8,
6427
+ {
6428
+ sx: {
6429
+ display: "flex",
6430
+ justifyContent: "space-between",
6431
+ alignItems: "flex-start",
6432
+ mb: 1,
6433
+ minHeight: 40
6434
+ },
6435
+ children: [
6436
+ /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", gap: 0.5, flexWrap: "wrap", flex: 1, mr: 1 }, children: [
6437
+ /* @__PURE__ */ jsx8(
6438
+ Chip6,
6439
+ {
6440
+ icon: /* @__PURE__ */ jsx8(PersonIcon2, { sx: { fontSize: "0.9rem !important" } }),
6441
+ label: "Local",
6442
+ size: "small",
6443
+ sx: {
6444
+ bgcolor: "#388e3c20",
6445
+ color: "#388e3c",
6446
+ fontWeight: 700,
6447
+ fontSize: "0.75rem",
6448
+ border: "2px solid #388e3c60",
6449
+ "& .MuiChip-icon": {
6450
+ color: "#388e3c !important"
6451
+ },
6452
+ boxShadow: "0 2px 4px #388e3c20"
6453
+ }
6454
+ }
6455
+ ),
6456
+ /* @__PURE__ */ jsx8(
6457
+ Chip6,
6458
+ {
6459
+ icon: /* @__PURE__ */ jsx8(DescriptionIcon2, { sx: { fontSize: "0.85rem !important" } }),
6460
+ label: "Markdown",
6461
+ size: "small",
6462
+ sx: {
6463
+ bgcolor: "#388e3c15",
6464
+ color: "#388e3c",
6465
+ fontWeight: 500,
6466
+ fontSize: "0.65rem"
6467
+ }
6468
+ }
6469
+ )
6470
+ ] }),
6471
+ /* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", sx: { flexShrink: 0 }, children: formatFileSize2(file.size) })
6472
+ ]
6473
+ }
6474
+ ),
6475
+ /* @__PURE__ */ jsx8(Box8, { sx: { mt: "auto" }, children: /* @__PURE__ */ jsx8(
6476
+ Button7,
6477
+ {
6478
+ variant: "outlined",
6479
+ size: "small",
6480
+ fullWidth: true,
6481
+ sx: {
6482
+ textTransform: "none",
6483
+ height: { xs: 32, sm: 36, md: 40 },
6484
+ flexShrink: 0,
6485
+ borderWidth: 2,
6486
+ fontSize: { xs: "0.75rem", sm: "0.8rem", md: "0.875rem" },
6487
+ fontWeight: 600,
6488
+ "&:hover": {
6489
+ borderWidth: 2,
6490
+ bgcolor: "primary.main",
6491
+ color: "primary.contrastText",
6492
+ transform: "translateY(-1px)",
6493
+ boxShadow: 2
6494
+ }
6495
+ },
6496
+ onClick: (event) => {
6497
+ event.stopPropagation();
6498
+ onPreview();
6499
+ },
6500
+ startIcon: /* @__PURE__ */ jsx8(SearchIcon2, { sx: { fontSize: { xs: "1rem", sm: "1.1rem" } } }),
6501
+ children: "Preview"
6502
+ }
6503
+ ) })
6504
+ ]
6505
+ }
6506
+ )
6507
+ }
6508
+ );
6509
+ var SeedPacksTab = () => {
6510
+ const { settings } = usePackageSettingsStore();
6511
+ const authStore = useAuthenticationStore();
6512
+ const gatewayConfigured = Boolean(settings?.gatewayApiUrl);
6513
+ const isTeamScope = Boolean(authStore.user?.teamSid);
6514
+ const seedPackAdminRoles = /* @__PURE__ */ new Set(["admin", "super-user", "team_admin", "team_owner"]);
6515
+ const userRoles = authStore.user?.roles ?? [];
6516
+ const canManage = userRoles.some((role) => seedPackAdminRoles.has(role));
6517
+ const [seedPacks, setSeedPacks] = useState9([]);
6518
+ const [selectedSid, setSelectedSid] = useState9(null);
6519
+ const [selectedSeedPack, setSelectedSeedPack] = useState9(null);
6520
+ const [draft, setDraft] = useState9({
6521
+ name: "",
6522
+ description: "",
6523
+ content: ""
6524
+ });
6525
+ const [tagsInput, setTagsInput] = useState9("");
6526
+ const [importedFiles, setImportedFiles] = useState9([]);
6527
+ const [createImportedFiles, setCreateImportedFiles] = useState9([]);
6528
+ const [previewFile, setPreviewFile] = useState9(null);
6529
+ const fileInputRef = useRef5(null);
6530
+ const createFileInputRef = useRef5(null);
6531
+ const [isLoadingList, setIsLoadingList] = useState9(false);
6532
+ const [isLoadingDetail, setIsLoadingDetail] = useState9(false);
6533
+ const [isSaving, setIsSaving] = useState9(false);
6534
+ const [isPublishing, setIsPublishing] = useState9(false);
6535
+ const [isArchiving, setIsArchiving] = useState9(false);
6536
+ const [isCreating, setIsCreating] = useState9(false);
6537
+ const [createDialogOpen, setCreateDialogOpen] = useState9(false);
6538
+ const [publishDialogOpen, setPublishDialogOpen] = useState9(false);
6539
+ const [archiveDialogOpen, setArchiveDialogOpen] = useState9(false);
6540
+ const [newPackName, setNewPackName] = useState9("");
6541
+ const [newPackDescription, setNewPackDescription] = useState9("");
6542
+ const [newPackTags, setNewPackTags] = useState9("");
6543
+ const [snackbarOpen, setSnackbarOpen] = useState9(false);
6544
+ const [snackbarMessage, setSnackbarMessage] = useState9("");
6545
+ const [snackbarSeverity, setSnackbarSeverity] = useState9("success");
6546
+ const parsedTags = useMemo3(() => parseTags(tagsInput), [tagsInput]);
6547
+ const normalizedSelectedTags = useMemo3(
6548
+ () => normalizeTags(selectedSeedPack?.tags),
6549
+ [selectedSeedPack?.tags]
6550
+ );
6551
+ const isDirty = useMemo3(() => {
6552
+ if (!selectedSeedPack) {
6553
+ return false;
6554
+ }
6555
+ const nameChanged = draft.name.trim() !== (selectedSeedPack.name ?? "").trim();
6556
+ const descriptionChanged = draft.description.trim() !== (selectedSeedPack.description ?? "").trim();
6557
+ const contentChanged = draft.content !== (selectedSeedPack.content ?? "");
6558
+ const tagsChanged = !areArraysEqual(parsedTags, normalizedSelectedTags);
6559
+ return nameChanged || descriptionChanged || contentChanged || tagsChanged;
6560
+ }, [draft, parsedTags, normalizedSelectedTags, selectedSeedPack]);
6561
+ const isReadOnly = !canManage || selectedSeedPack?.status === "archived";
6562
+ const sortedSeedPacks = useMemo3(() => {
6563
+ return [...seedPacks].sort((a, b) => getSeedPackTimestamp(b) - getSeedPackTimestamp(a));
6564
+ }, [seedPacks]);
6565
+ const scopeLabel = isTeamScope ? "Team scope" : "Personal scope";
6566
+ const scopeDescription = isTeamScope ? "Applies to all members of your team." : "Applies only to your account.";
6567
+ const showSnackbar = useCallback6((message, severity) => {
6568
+ setSnackbarMessage(message);
6569
+ setSnackbarSeverity(severity);
6570
+ setSnackbarOpen(true);
6571
+ }, []);
6572
+ const hydrateDraft = useCallback6((pack) => {
6573
+ setDraft({
6574
+ name: pack.name ?? "",
6575
+ description: pack.description ?? "",
6576
+ content: pack.content ?? ""
6577
+ });
6578
+ setTagsInput((pack.tags ?? []).join(", "));
6579
+ setImportedFiles([]);
6580
+ setPreviewFile(null);
6581
+ }, []);
6582
+ const resetCreateDialog = useCallback6(() => {
6583
+ setCreateDialogOpen(false);
6584
+ setNewPackName("");
6585
+ setNewPackDescription("");
6586
+ setNewPackTags("");
6587
+ setCreateImportedFiles([]);
6588
+ }, []);
6589
+ const refreshSeedPacks = useCallback6(
6590
+ async (nextSelectedSid) => {
6591
+ if (!gatewayConfigured) {
6592
+ return;
6593
+ }
6594
+ setIsLoadingList(true);
6595
+ try {
6596
+ const packs = await listSeedPacks();
6597
+ setSeedPacks(packs);
6598
+ const activeSid = nextSelectedSid ?? selectedSid;
6599
+ if (activeSid && !packs.some((pack) => pack.sid === activeSid)) {
6600
+ setSelectedSid(null);
6601
+ setSelectedSeedPack(null);
6602
+ }
6603
+ } catch (error) {
6604
+ showSnackbar("Failed to load seed packs.", "error");
6605
+ debugLogger.error("SeedPacksTab: failed to load seed packs", {
6606
+ error: error instanceof Error ? error.message : String(error)
6607
+ });
6608
+ } finally {
6609
+ setIsLoadingList(false);
6610
+ }
6611
+ },
6612
+ [gatewayConfigured, selectedSid, showSnackbar]
6613
+ );
6614
+ const loadSeedPackDetail = useCallback6(
6615
+ async (sid) => {
6616
+ if (!gatewayConfigured) {
6617
+ return;
6618
+ }
6619
+ setIsLoadingDetail(true);
6620
+ try {
6621
+ const pack = await getSeedPack(sid);
6622
+ setSelectedSeedPack(pack);
6623
+ hydrateDraft(pack);
6624
+ } catch (error) {
6625
+ showSnackbar("Failed to load seed pack details.", "error");
6626
+ debugLogger.error("SeedPacksTab: failed to load seed pack details", {
6627
+ sid,
6628
+ error: error instanceof Error ? error.message : String(error)
6629
+ });
6630
+ } finally {
6631
+ setIsLoadingDetail(false);
6632
+ }
6633
+ },
6634
+ [gatewayConfigured, hydrateDraft, showSnackbar]
6635
+ );
6636
+ useEffect6(() => {
6637
+ void refreshSeedPacks();
6638
+ }, [refreshSeedPacks, authStore.token]);
6639
+ useEffect6(() => {
6640
+ if (selectedSid) {
6641
+ void loadSeedPackDetail(selectedSid);
6642
+ }
6643
+ }, [selectedSid, loadSeedPackDetail]);
6644
+ const handleSelectPack = (pack) => {
6645
+ setSelectedSid(pack.sid);
6646
+ setSelectedSeedPack(pack);
6647
+ hydrateDraft(pack);
6648
+ };
6649
+ const handleImportFiles = useCallback6(
6650
+ async (files) => {
6651
+ if (!files || files.length === 0) {
6652
+ return;
6653
+ }
6654
+ const { imported, skipped } = await readMarkdownFiles(files);
6655
+ if (skipped > 0) {
6656
+ showSnackbar("Only .md files are supported for seed packs.", "error");
6657
+ }
6658
+ if (imported.length === 0) {
6659
+ return;
6660
+ }
6661
+ try {
6662
+ const newlyAdded = imported.filter(
6663
+ (file) => !importedFiles.some((existing) => existing.name === file.name)
6664
+ );
6665
+ setImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
6666
+ const combined = buildMarkdownContent(newlyAdded);
6667
+ if (combined.length > 0) {
6668
+ setDraft((prev) => {
6669
+ const current = prev.content.trim();
6670
+ const nextContent = current ? `${current}
6671
+
6672
+ ---
6673
+
6674
+ ${combined}` : combined;
6675
+ return { ...prev, content: nextContent };
6676
+ });
6677
+ }
6678
+ showSnackbar(
6679
+ `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} into the editor.`,
6680
+ "success"
6681
+ );
6682
+ } catch (error) {
6683
+ showSnackbar("Failed to import markdown files.", "error");
6684
+ debugLogger.error("SeedPacksTab: failed to import markdown files", {
6685
+ error: error instanceof Error ? error.message : String(error)
6686
+ });
6687
+ }
6688
+ },
6689
+ [importedFiles, showSnackbar]
6690
+ );
6691
+ const handleFileInputChange = useCallback6(
6692
+ async (event) => {
6693
+ await handleImportFiles(event.target.files);
6694
+ event.target.value = "";
6695
+ },
6696
+ [handleImportFiles]
6697
+ );
6698
+ const handleRemoveImportedFile = useCallback6((id) => {
6699
+ setImportedFiles((prev) => prev.filter((file) => file.id !== id));
6700
+ }, []);
6701
+ const handleCreateImportFiles = useCallback6(
6702
+ async (files) => {
6703
+ if (!files || files.length === 0) {
6704
+ return;
6705
+ }
6706
+ const { imported, skipped } = await readMarkdownFiles(files);
6707
+ if (skipped > 0) {
6708
+ showSnackbar("Only .md files are supported for seed packs.", "error");
6709
+ }
6710
+ if (imported.length === 0) {
6711
+ return;
6712
+ }
6713
+ setCreateImportedFiles((prev) => mergeMarkdownFiles(prev, imported));
6714
+ showSnackbar(
6715
+ `Imported ${imported.length} markdown file${imported.length === 1 ? "" : "s"} for this seed pack.`,
6716
+ "success"
6717
+ );
6718
+ },
6719
+ [showSnackbar]
6720
+ );
6721
+ const handleCreateFileInputChange = useCallback6(
6722
+ async (event) => {
6723
+ await handleCreateImportFiles(event.target.files);
6724
+ event.target.value = "";
6725
+ },
6726
+ [handleCreateImportFiles]
6727
+ );
6728
+ const handleRemoveCreateImportedFile = useCallback6((id) => {
6729
+ setCreateImportedFiles((prev) => prev.filter((file) => file.id !== id));
6730
+ }, []);
6731
+ const buildDraftPayload2 = useCallback6(() => {
6732
+ const name = draft.name.trim();
6733
+ if (!name) {
6734
+ showSnackbar("Seed pack name is required.", "error");
6735
+ return null;
6736
+ }
6737
+ return {
6738
+ name,
6739
+ description: draft.description.trim(),
6740
+ content: draft.content,
6741
+ tags: parsedTags,
6742
+ contentType: "markdown"
6743
+ };
6744
+ }, [draft, parsedTags, showSnackbar]);
6745
+ const saveDraft = useCallback6(async () => {
6746
+ if (!selectedSeedPack) {
6747
+ return null;
6748
+ }
6749
+ const payload = buildDraftPayload2();
6750
+ if (!payload) {
6751
+ return null;
6752
+ }
6753
+ setIsSaving(true);
6754
+ try {
6755
+ const updated = await updateSeedPack(selectedSeedPack.sid, payload);
6756
+ setSelectedSeedPack(updated);
6757
+ hydrateDraft(updated);
6758
+ await refreshSeedPacks(updated.sid);
6759
+ return updated;
6760
+ } catch (error) {
6761
+ showSnackbar("Failed to save seed pack.", "error");
6762
+ debugLogger.error("SeedPacksTab: failed to save seed pack", {
6763
+ sid: selectedSeedPack.sid,
6764
+ error: error instanceof Error ? error.message : String(error)
6765
+ });
6766
+ return null;
6767
+ } finally {
6768
+ setIsSaving(false);
6769
+ }
6770
+ }, [selectedSeedPack, buildDraftPayload2, hydrateDraft, refreshSeedPacks, showSnackbar]);
6771
+ const handleSaveDraft = async () => {
6772
+ const updated = await saveDraft();
6773
+ if (updated) {
6774
+ showSnackbar("Seed pack saved.", "success");
6775
+ }
6776
+ };
6777
+ const handleResetDraft = () => {
6778
+ if (selectedSeedPack) {
6779
+ hydrateDraft(selectedSeedPack);
6780
+ }
6781
+ };
6782
+ const handleCreateSeedPack = async () => {
6783
+ const name = newPackName.trim();
6784
+ if (!name) {
6785
+ showSnackbar("Seed pack name is required.", "error");
6786
+ return;
6787
+ }
6788
+ const importedContent = buildMarkdownContent(createImportedFiles);
6789
+ const payload = {
6790
+ name,
6791
+ description: newPackDescription.trim(),
6792
+ tags: parseTags(newPackTags),
6793
+ content: importedContent,
6794
+ contentType: "markdown"
6795
+ };
6796
+ setIsCreating(true);
6797
+ try {
6798
+ const created = await createSeedPack(payload);
6799
+ resetCreateDialog();
6800
+ await refreshSeedPacks(created.sid);
6801
+ setSelectedSid(created.sid);
6802
+ setSelectedSeedPack(created);
6803
+ hydrateDraft(created);
6804
+ if (createImportedFiles.length > 0) {
6805
+ setImportedFiles(createImportedFiles);
6806
+ }
6807
+ setCreateImportedFiles([]);
6808
+ showSnackbar("Seed pack created.", "success");
6809
+ } catch (error) {
6810
+ showSnackbar("Failed to create seed pack.", "error");
6811
+ debugLogger.error("SeedPacksTab: failed to create seed pack", {
6812
+ error: error instanceof Error ? error.message : String(error)
6813
+ });
6814
+ } finally {
6815
+ setIsCreating(false);
6816
+ }
6817
+ };
6818
+ const handlePublish = async () => {
6819
+ if (!selectedSeedPack) {
6820
+ return;
6821
+ }
6822
+ setPublishDialogOpen(false);
6823
+ setIsPublishing(true);
6824
+ try {
6825
+ if (isDirty) {
6826
+ const saved = await saveDraft();
6827
+ if (!saved) {
6828
+ return;
6829
+ }
6830
+ }
6831
+ const published = await publishSeedPack(selectedSeedPack.sid);
6832
+ setSelectedSeedPack(published);
6833
+ hydrateDraft(published);
6834
+ await refreshSeedPacks(published.sid);
6835
+ showSnackbar("Seed pack published.", "success");
6836
+ } catch (error) {
6837
+ showSnackbar("Failed to publish seed pack.", "error");
6838
+ debugLogger.error("SeedPacksTab: failed to publish seed pack", {
6839
+ sid: selectedSeedPack.sid,
6840
+ error: error instanceof Error ? error.message : String(error)
6841
+ });
6842
+ } finally {
6843
+ setIsPublishing(false);
6844
+ }
6845
+ };
6846
+ const handleArchive = async () => {
6847
+ if (!selectedSeedPack) {
6848
+ return;
6849
+ }
6850
+ setArchiveDialogOpen(false);
6851
+ setIsArchiving(true);
6852
+ try {
6853
+ const archived = await archiveSeedPack(selectedSeedPack.sid);
6854
+ setSelectedSeedPack(archived);
6855
+ hydrateDraft(archived);
6856
+ await refreshSeedPacks(archived.sid);
6857
+ showSnackbar("Seed pack archived.", "success");
6858
+ } catch (error) {
6859
+ showSnackbar("Failed to archive seed pack.", "error");
6860
+ debugLogger.error("SeedPacksTab: failed to archive seed pack", {
6861
+ sid: selectedSeedPack.sid,
6862
+ error: error instanceof Error ? error.message : String(error)
6863
+ });
6864
+ } finally {
6865
+ setIsArchiving(false);
6866
+ }
6867
+ };
6868
+ const previewContent = draft.content.trim().length > 0 ? draft.content : "Preview will appear here as you type.";
6869
+ const selectedStatus = selectedSeedPack?.status ?? "draft";
6870
+ const statusChip = getStatusChip(selectedStatus);
6871
+ return /* @__PURE__ */ jsxs8(Box8, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
6872
+ /* @__PURE__ */ jsxs8(Box8, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
6873
+ /* @__PURE__ */ jsxs8(
6874
+ Stack3,
6875
+ {
6876
+ direction: { xs: "column", md: "row" },
6877
+ spacing: { xs: 1.5, md: 2 },
6878
+ alignItems: { xs: "flex-start", md: "center" },
6879
+ justifyContent: "space-between",
6880
+ children: [
6881
+ /* @__PURE__ */ jsxs8(Box8, { children: [
6882
+ /* @__PURE__ */ jsx8(
6883
+ Typography8,
6884
+ {
6885
+ variant: "h5",
6886
+ color: "text.primary",
6887
+ sx: { mb: 1, fontWeight: 600, fontSize: { xs: "1.55rem", md: "1.8rem" } },
6888
+ children: "Seed Packs"
6889
+ }
6890
+ ),
6891
+ /* @__PURE__ */ jsx8(Typography8, { variant: "body1", color: "text.secondary", children: "Curated internal knowledge that is always available to assistants, without showing up as visible sources." })
6892
+ ] }),
6893
+ /* @__PURE__ */ jsx8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: /* @__PURE__ */ jsx8(
6894
+ Chip6,
6895
+ {
6896
+ icon: isTeamScope ? /* @__PURE__ */ jsx8(GroupIcon2, {}) : /* @__PURE__ */ jsx8(PersonIcon2, {}),
6897
+ label: scopeLabel,
6898
+ color: "info",
6899
+ variant: "outlined"
6900
+ }
6901
+ ) })
6902
+ ]
6903
+ }
6904
+ ),
6905
+ /* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", children: scopeDescription })
6906
+ ] }),
6907
+ !gatewayConfigured && /* @__PURE__ */ jsx8(Alert7, { severity: "warning", sx: { mb: 2 }, children: "Gateway API is not configured. Seed packs require a gateway URL in package settings." }),
6908
+ gatewayConfigured && !canManage && /* @__PURE__ */ jsx8(Alert7, { severity: "info", sx: { mb: 2 }, children: "You have view-only access. Admin rights are required to create, publish, or archive team seed packs." }),
6909
+ /* @__PURE__ */ jsxs8(
6910
+ Box8,
6911
+ {
6912
+ sx: {
6913
+ display: "grid",
6914
+ gridTemplateColumns: { xs: "1fr", md: "320px 1fr" },
6915
+ gap: { xs: 2, md: 3 }
6916
+ },
6917
+ children: [
6918
+ /* @__PURE__ */ jsxs8(Card4, { sx: { height: "fit-content" }, children: [
6919
+ /* @__PURE__ */ jsx8(CardContent4, { sx: { pb: 1.5 }, children: /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
6920
+ /* @__PURE__ */ jsx8(Typography8, { variant: "h6", sx: { fontWeight: 600 }, children: "Packs" }),
6921
+ /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, children: [
6922
+ /* @__PURE__ */ jsx8(
6923
+ Button7,
6924
+ {
6925
+ size: "small",
6926
+ variant: "outlined",
6927
+ onClick: () => refreshSeedPacks(),
6928
+ startIcon: /* @__PURE__ */ jsx8(RefreshIcon2, {}),
6929
+ disabled: !gatewayConfigured || isLoadingList,
6930
+ children: "Refresh"
6931
+ }
6932
+ ),
6933
+ canManage && /* @__PURE__ */ jsx8(
6934
+ Button7,
6935
+ {
6936
+ size: "small",
6937
+ variant: "contained",
6938
+ startIcon: /* @__PURE__ */ jsx8(AddIcon, {}),
6939
+ onClick: () => setCreateDialogOpen(true),
6940
+ disabled: !gatewayConfigured,
6941
+ children: "New"
6942
+ }
6943
+ )
6944
+ ] })
6945
+ ] }) }),
6946
+ /* @__PURE__ */ jsx8(Divider, {}),
6947
+ /* @__PURE__ */ jsxs8(Box8, { sx: { px: 2, pb: 2 }, children: [
6948
+ isLoadingList && /* @__PURE__ */ jsx8(LinearProgress3, { sx: { mb: 2 } }),
6949
+ sortedSeedPacks.length === 0 ? /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: "No seed packs yet. Create one to start sharing internal knowledge." }) : /* @__PURE__ */ jsx8(List, { sx: { px: 0 }, children: sortedSeedPacks.map((pack) => {
6950
+ const status = getStatusChip(pack.status);
6951
+ const tags = normalizeTags(pack.tags);
6952
+ return /* @__PURE__ */ jsx8(
6953
+ ListItemButton,
6954
+ {
6955
+ selected: pack.sid === selectedSid,
6956
+ onClick: () => handleSelectPack(pack),
6957
+ sx: {
6958
+ mb: 1,
6959
+ borderRadius: 2,
6960
+ alignItems: "flex-start",
6961
+ border: pack.sid === selectedSid ? "1px solid" : "1px solid transparent",
6962
+ borderColor: pack.sid === selectedSid ? "primary.main" : "transparent"
6963
+ },
6964
+ children: /* @__PURE__ */ jsxs8(Box8, { sx: { flex: 1 }, children: [
6965
+ /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", sx: { mb: 0.5 }, children: [
6966
+ /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle1", sx: { fontWeight: 600 }, children: pack.name }),
6967
+ /* @__PURE__ */ jsx8(Chip6, { size: "small", label: status.label, color: status.color })
6968
+ ] }),
6969
+ /* @__PURE__ */ jsxs8(Typography8, { variant: "caption", color: "text.secondary", children: [
6970
+ pack.version ? `v${pack.version}` : "v0",
6971
+ " | Last published:",
6972
+ " ",
6973
+ formatTimestamp(pack.publishedAt)
6974
+ ] }),
6975
+ tags.length > 0 && /* @__PURE__ */ jsx8(Stack3, { direction: "row", spacing: 0.5, flexWrap: "wrap", sx: { mt: 1 }, children: tags.map((tag) => /* @__PURE__ */ jsx8(Chip6, { size: "small", label: tag, variant: "outlined" }, tag)) })
6976
+ ] })
6977
+ },
6978
+ pack.sid
6979
+ );
6980
+ }) })
6981
+ ] })
6982
+ ] }),
6983
+ /* @__PURE__ */ jsx8(Card4, { children: /* @__PURE__ */ jsxs8(CardContent4, { children: [
6984
+ /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
6985
+ /* @__PURE__ */ jsxs8(Box8, { children: [
6986
+ /* @__PURE__ */ jsx8(Typography8, { variant: "h6", sx: { fontWeight: 600 }, children: selectedSeedPack ? "Seed Pack Editor" : "Seed Pack Details" }),
6987
+ /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: "Draft content stays internal and is never shown as user-facing sources." })
6988
+ ] }),
6989
+ selectedSeedPack && /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
6990
+ isDirty && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: "Unsaved changes", color: "warning" }),
6991
+ /* @__PURE__ */ jsx8(Chip6, { size: "small", label: statusChip.label, color: statusChip.color })
6992
+ ] })
6993
+ ] }),
6994
+ /* @__PURE__ */ jsx8(Divider, { sx: { my: 2 } }),
6995
+ !selectedSeedPack && /* @__PURE__ */ jsxs8(Box8, { children: [
6996
+ /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", sx: { mb: 2 }, children: "Select a seed pack from the list or create a new one to begin editing." }),
6997
+ canManage && /* @__PURE__ */ jsx8(
6998
+ Button7,
6999
+ {
7000
+ variant: "contained",
7001
+ startIcon: /* @__PURE__ */ jsx8(AddIcon, {}),
7002
+ onClick: () => setCreateDialogOpen(true),
7003
+ disabled: !gatewayConfigured,
7004
+ children: "Create seed pack"
7005
+ }
7006
+ )
7007
+ ] }),
7008
+ selectedSeedPack && /* @__PURE__ */ jsxs8(Stack3, { spacing: 2, children: [
7009
+ isLoadingDetail && /* @__PURE__ */ jsx8(LinearProgress3, {}),
7010
+ /* @__PURE__ */ jsx8(
7011
+ TextField5,
7012
+ {
7013
+ label: "Name",
7014
+ value: draft.name,
7015
+ onChange: (event) => setDraft((prev) => ({ ...prev, name: event.target.value })),
7016
+ fullWidth: true,
7017
+ disabled: isReadOnly
7018
+ }
7019
+ ),
7020
+ /* @__PURE__ */ jsx8(
7021
+ TextField5,
7022
+ {
7023
+ label: "Description",
7024
+ value: draft.description,
7025
+ onChange: (event) => setDraft((prev) => ({ ...prev, description: event.target.value })),
7026
+ fullWidth: true,
7027
+ multiline: true,
7028
+ minRows: 2,
7029
+ disabled: isReadOnly
7030
+ }
7031
+ ),
7032
+ /* @__PURE__ */ jsx8(
7033
+ TextField5,
7034
+ {
7035
+ label: "Tags (comma separated)",
7036
+ value: tagsInput,
7037
+ onChange: (event) => setTagsInput(event.target.value),
7038
+ fullWidth: true,
7039
+ disabled: isReadOnly
7040
+ }
7041
+ ),
7042
+ /* @__PURE__ */ jsxs8(Stack3, { direction: "row", spacing: 1, flexWrap: "wrap", children: [
7043
+ /* @__PURE__ */ jsx8(Chip6, { size: "small", label: scopeLabel, icon: isTeamScope ? /* @__PURE__ */ jsx8(GroupIcon2, {}) : /* @__PURE__ */ jsx8(PersonIcon2, {}) }),
7044
+ selectedSeedPack.version && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: `Version ${selectedSeedPack.version}`, variant: "outlined" }),
7045
+ selectedSeedPack.updatedAt && /* @__PURE__ */ jsx8(Chip6, { size: "small", label: `Updated ${formatTimestamp(selectedSeedPack.updatedAt)}`, variant: "outlined" })
7046
+ ] }),
7047
+ /* @__PURE__ */ jsx8(Alert7, { severity: "info", children: "Treat seed pack content as internal knowledge. Do not include instructions that override system or developer messages." }),
7048
+ /* @__PURE__ */ jsxs8(
7049
+ Box8,
7050
+ {
7051
+ sx: {
7052
+ display: "grid",
7053
+ gridTemplateColumns: { xs: "1fr", md: "1fr 1fr" },
7054
+ gap: 2,
7055
+ alignItems: "start"
7056
+ },
7057
+ children: [
7058
+ /* @__PURE__ */ jsxs8(Box8, { children: [
7059
+ /* @__PURE__ */ jsxs8(
7060
+ Stack3,
7061
+ {
7062
+ direction: { xs: "column", sm: "row" },
7063
+ spacing: 1,
7064
+ alignItems: { xs: "flex-start", sm: "center" },
7065
+ justifyContent: "space-between",
7066
+ sx: { mb: 1 },
7067
+ children: [
7068
+ /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", children: "Markdown content" }),
7069
+ /* @__PURE__ */ jsx8(
7070
+ Button7,
7071
+ {
7072
+ size: "small",
7073
+ variant: "outlined",
7074
+ startIcon: /* @__PURE__ */ jsx8(UploadFileIcon2, {}),
7075
+ onClick: () => fileInputRef.current?.click(),
7076
+ disabled: isReadOnly,
7077
+ children: "Import .md"
7078
+ }
7079
+ ),
7080
+ /* @__PURE__ */ jsx8(
7081
+ "input",
7082
+ {
7083
+ ref: fileInputRef,
7084
+ type: "file",
7085
+ accept: ".md",
7086
+ multiple: true,
7087
+ onChange: handleFileInputChange,
7088
+ style: { display: "none" }
7089
+ }
7090
+ )
7091
+ ]
7092
+ }
7093
+ ),
7094
+ /* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", sx: { mb: 1, display: "block" }, children: "Paste or import markdown files. Imports copy content into the editor." }),
7095
+ /* @__PURE__ */ jsx8(
7096
+ TextField5,
7097
+ {
7098
+ label: "Content",
7099
+ value: draft.content,
7100
+ onChange: (event) => setDraft((prev) => ({ ...prev, content: event.target.value })),
7101
+ fullWidth: true,
7102
+ multiline: true,
7103
+ minRows: 12,
7104
+ disabled: isReadOnly
7105
+ }
7106
+ ),
7107
+ importedFiles.length > 0 && /* @__PURE__ */ jsxs8(Box8, { sx: { mt: 2 }, children: [
7108
+ /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
7109
+ /* @__PURE__ */ jsx8(
7110
+ Box8,
7111
+ {
7112
+ sx: {
7113
+ display: "grid",
7114
+ gridTemplateColumns: {
7115
+ xs: "1fr",
7116
+ sm: "repeat(2, minmax(0, 1fr))",
7117
+ md: "repeat(3, minmax(0, 1fr))"
7118
+ },
7119
+ gap: 2
7120
+ },
7121
+ children: importedFiles.map((file) => /* @__PURE__ */ jsx8(
7122
+ SeedPackFileCard,
7123
+ {
7124
+ file,
7125
+ isReadOnly,
7126
+ onPreview: () => setPreviewFile(file),
7127
+ onRemove: () => handleRemoveImportedFile(file.id)
7128
+ },
7129
+ file.id
7130
+ ))
7131
+ }
7132
+ )
7133
+ ] })
7134
+ ] }),
7135
+ /* @__PURE__ */ jsx8(Card4, { variant: "outlined", children: /* @__PURE__ */ jsxs8(CardContent4, { children: [
7136
+ /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Preview" }),
7137
+ /* @__PURE__ */ jsx8(StreamingMarkdown_default, { content: previewContent })
7138
+ ] }) })
7139
+ ]
7140
+ }
7141
+ ),
7142
+ selectedSeedPack.summary && /* @__PURE__ */ jsx8(
7143
+ TextField5,
7144
+ {
7145
+ label: "Summary (auto-generated)",
7146
+ value: selectedSeedPack.summary,
7147
+ fullWidth: true,
7148
+ multiline: true,
7149
+ minRows: 3,
7150
+ InputProps: { readOnly: true }
7151
+ }
7152
+ ),
7153
+ canManage && /* @__PURE__ */ jsxs8(Stack3, { direction: { xs: "column", sm: "row" }, spacing: 1, flexWrap: "wrap", children: [
7154
+ /* @__PURE__ */ jsx8(
7155
+ Button7,
7156
+ {
7157
+ variant: "outlined",
7158
+ startIcon: /* @__PURE__ */ jsx8(SaveIcon2, {}),
7159
+ onClick: handleSaveDraft,
7160
+ disabled: isReadOnly || !isDirty || isSaving,
7161
+ children: isSaving ? "Saving..." : "Save draft"
7162
+ }
7163
+ ),
7164
+ /* @__PURE__ */ jsx8(
7165
+ Button7,
7166
+ {
7167
+ variant: "outlined",
7168
+ onClick: handleResetDraft,
7169
+ disabled: !isDirty || isReadOnly,
7170
+ children: "Reset changes"
7171
+ }
7172
+ ),
7173
+ /* @__PURE__ */ jsx8(
7174
+ Button7,
7175
+ {
7176
+ variant: "contained",
7177
+ startIcon: /* @__PURE__ */ jsx8(PublishIcon, {}),
7178
+ onClick: () => setPublishDialogOpen(true),
7179
+ disabled: isReadOnly || isPublishing,
7180
+ children: isPublishing ? "Publishing..." : "Publish"
7181
+ }
7182
+ ),
7183
+ /* @__PURE__ */ jsx8(
7184
+ Button7,
7185
+ {
7186
+ variant: "text",
7187
+ color: "error",
7188
+ startIcon: /* @__PURE__ */ jsx8(ArchiveIcon, {}),
7189
+ onClick: () => setArchiveDialogOpen(true),
7190
+ disabled: isReadOnly || isArchiving,
7191
+ children: isArchiving ? "Archiving..." : "Archive"
7192
+ }
7193
+ )
7194
+ ] })
7195
+ ] })
7196
+ ] }) })
7197
+ ]
7198
+ }
7199
+ ),
7200
+ /* @__PURE__ */ jsxs8(Dialog6, { open: createDialogOpen, onClose: resetCreateDialog, maxWidth: "sm", fullWidth: true, children: [
7201
+ /* @__PURE__ */ jsx8(DialogTitle5, { children: "Create seed pack" }),
7202
+ /* @__PURE__ */ jsxs8(DialogContent6, { children: [
7203
+ /* @__PURE__ */ jsxs8(DialogContentText3, { sx: { mb: 2 }, children: [
7204
+ "Seed packs are scoped automatically based on your sign-in. ",
7205
+ scopeLabel,
7206
+ " - ",
7207
+ scopeDescription
7208
+ ] }),
7209
+ /* @__PURE__ */ jsxs8(Stack3, { spacing: 2, children: [
7210
+ /* @__PURE__ */ jsx8(
7211
+ TextField5,
7212
+ {
7213
+ label: "Name",
7214
+ value: newPackName,
7215
+ onChange: (event) => setNewPackName(event.target.value),
7216
+ fullWidth: true,
7217
+ autoFocus: true
7218
+ }
7219
+ ),
7220
+ /* @__PURE__ */ jsx8(
7221
+ TextField5,
7222
+ {
7223
+ label: "Description",
7224
+ value: newPackDescription,
7225
+ onChange: (event) => setNewPackDescription(event.target.value),
7226
+ fullWidth: true,
7227
+ multiline: true,
7228
+ minRows: 2
7229
+ }
7230
+ ),
7231
+ /* @__PURE__ */ jsx8(
7232
+ TextField5,
7233
+ {
7234
+ label: "Tags (comma separated)",
7235
+ value: newPackTags,
7236
+ onChange: (event) => setNewPackTags(event.target.value),
7237
+ fullWidth: true
7238
+ }
7239
+ ),
7240
+ /* @__PURE__ */ jsx8(Divider, {}),
7241
+ /* @__PURE__ */ jsxs8(Stack3, { direction: { xs: "column", sm: "row" }, spacing: 1, alignItems: "center", children: [
7242
+ /* @__PURE__ */ jsx8(
7243
+ Button7,
7244
+ {
7245
+ size: "small",
7246
+ variant: "outlined",
7247
+ startIcon: /* @__PURE__ */ jsx8(UploadFileIcon2, {}),
7248
+ onClick: () => createFileInputRef.current?.click(),
7249
+ disabled: !canManage,
7250
+ children: "Import .md files"
7251
+ }
7252
+ ),
7253
+ /* @__PURE__ */ jsx8(Typography8, { variant: "caption", color: "text.secondary", children: "Optional. Files are merged into the draft content." }),
7254
+ /* @__PURE__ */ jsx8(
7255
+ "input",
7256
+ {
7257
+ ref: createFileInputRef,
7258
+ type: "file",
7259
+ accept: ".md",
7260
+ multiple: true,
7261
+ onChange: handleCreateFileInputChange,
7262
+ style: { display: "none" }
7263
+ }
7264
+ )
7265
+ ] }),
7266
+ createImportedFiles.length > 0 && /* @__PURE__ */ jsxs8(Box8, { children: [
7267
+ /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", sx: { mb: 1 }, children: "Imported markdown files" }),
7268
+ /* @__PURE__ */ jsx8(
7269
+ Box8,
7270
+ {
7271
+ sx: {
7272
+ display: "grid",
7273
+ gridTemplateColumns: {
7274
+ xs: "1fr",
7275
+ sm: "repeat(2, minmax(0, 1fr))"
7276
+ },
7277
+ gap: 2
7278
+ },
7279
+ children: createImportedFiles.map((file) => /* @__PURE__ */ jsx8(
7280
+ SeedPackFileCard,
7281
+ {
7282
+ file,
7283
+ isReadOnly: !canManage,
7284
+ onPreview: () => setPreviewFile(file),
7285
+ onRemove: () => handleRemoveCreateImportedFile(file.id)
7286
+ },
7287
+ file.id
7288
+ ))
7289
+ }
7290
+ )
7291
+ ] })
7292
+ ] })
7293
+ ] }),
7294
+ /* @__PURE__ */ jsxs8(DialogActions5, { children: [
7295
+ /* @__PURE__ */ jsx8(Button7, { onClick: resetCreateDialog, children: "Cancel" }),
7296
+ /* @__PURE__ */ jsx8(
7297
+ Button7,
7298
+ {
7299
+ variant: "contained",
7300
+ onClick: handleCreateSeedPack,
7301
+ disabled: !gatewayConfigured || isCreating,
7302
+ children: isCreating ? "Creating..." : "Create"
7303
+ }
7304
+ )
7305
+ ] })
7306
+ ] }),
7307
+ /* @__PURE__ */ jsxs8(Dialog6, { open: publishDialogOpen, onClose: () => setPublishDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
7308
+ /* @__PURE__ */ jsx8(DialogTitle5, { children: "Publish seed pack" }),
7309
+ /* @__PURE__ */ jsxs8(DialogContent6, { children: [
7310
+ /* @__PURE__ */ jsx8(DialogContentText3, { children: "Publishing locks a new version and makes it available for internal retrieval. This content is never shown as a user-facing source." }),
7311
+ isDirty && /* @__PURE__ */ jsx8(Alert7, { severity: "info", sx: { mt: 2 }, children: "You have unsaved changes. They will be included in the published version." })
7312
+ ] }),
7313
+ /* @__PURE__ */ jsxs8(DialogActions5, { children: [
7314
+ /* @__PURE__ */ jsx8(Button7, { onClick: () => setPublishDialogOpen(false), children: "Cancel" }),
7315
+ /* @__PURE__ */ jsx8(Button7, { variant: "contained", onClick: handlePublish, disabled: isPublishing, children: isPublishing ? "Publishing..." : "Publish" })
7316
+ ] })
7317
+ ] }),
7318
+ /* @__PURE__ */ jsxs8(Dialog6, { open: archiveDialogOpen, onClose: () => setArchiveDialogOpen(false), maxWidth: "sm", fullWidth: true, children: [
7319
+ /* @__PURE__ */ jsx8(DialogTitle5, { children: "Archive seed pack" }),
7320
+ /* @__PURE__ */ jsx8(DialogContent6, { children: /* @__PURE__ */ jsx8(DialogContentText3, { children: "Archiving stops this seed pack from being used in new conversations. You can keep it for reference or audit history." }) }),
7321
+ /* @__PURE__ */ jsxs8(DialogActions5, { children: [
7322
+ /* @__PURE__ */ jsx8(Button7, { onClick: () => setArchiveDialogOpen(false), children: "Cancel" }),
7323
+ /* @__PURE__ */ jsx8(Button7, { variant: "contained", color: "error", onClick: handleArchive, disabled: isArchiving, children: isArchiving ? "Archiving..." : "Archive" })
7324
+ ] })
7325
+ ] }),
7326
+ /* @__PURE__ */ jsxs8(
7327
+ Dialog6,
7328
+ {
7329
+ open: Boolean(previewFile),
7330
+ onClose: () => setPreviewFile(null),
7331
+ maxWidth: "md",
7332
+ fullWidth: true,
7333
+ children: [
7334
+ /* @__PURE__ */ jsx8(DialogTitle5, { children: previewFile?.name ?? "Markdown preview" }),
7335
+ /* @__PURE__ */ jsx8(DialogContent6, { dividers: true, children: /* @__PURE__ */ jsx8(StreamingMarkdown_default, { content: previewFile?.content ?? "" }) }),
7336
+ /* @__PURE__ */ jsx8(DialogActions5, { children: /* @__PURE__ */ jsx8(Button7, { onClick: () => setPreviewFile(null), children: "Close" }) })
7337
+ ]
7338
+ }
7339
+ ),
7340
+ /* @__PURE__ */ jsx8(
7341
+ Snackbar3,
7342
+ {
7343
+ open: snackbarOpen,
7344
+ autoHideDuration: 4e3,
7345
+ onClose: () => setSnackbarOpen(false),
7346
+ anchorOrigin: { vertical: "bottom", horizontal: "center" },
7347
+ children: /* @__PURE__ */ jsx8(Alert7, { onClose: () => setSnackbarOpen(false), severity: snackbarSeverity, sx: { width: "100%" }, children: snackbarMessage })
7348
+ }
7349
+ )
7350
+ ] });
7351
+ };
7352
+ var SeedPacksTab_default = SeedPacksTab;
7353
+
7354
+ // src/management/components/KnowledgeHubTab.tsx
7355
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
7356
+ var KnowledgeHubTab = (props) => {
7357
+ const theme = useTheme6();
7358
+ const isMobile = useMediaQuery5(theme.breakpoints.down("sm"));
7359
+ const { seedPacksEnabled = false } = props;
7360
+ const [tabIndex, setTabIndex] = useState10(0);
7361
+ const effectiveTabIndex = seedPacksEnabled ? tabIndex : 0;
7362
+ useEffect7(() => {
7363
+ if (!seedPacksEnabled && tabIndex !== 0) {
7364
+ setTabIndex(0);
7365
+ }
7366
+ }, [seedPacksEnabled, tabIndex]);
7367
+ return /* @__PURE__ */ jsxs9(Box9, { children: [
7368
+ /* @__PURE__ */ jsx9(Box9, { sx: { px: { xs: 1.5, sm: 3, md: 4 }, pt: { xs: 1.5, md: 2 } }, children: /* @__PURE__ */ jsxs9(
7369
+ Tabs2,
7370
+ {
7371
+ value: effectiveTabIndex,
7372
+ onChange: (_, newValue) => setTabIndex(newValue),
7373
+ variant: isMobile ? "fullWidth" : "standard",
7374
+ sx: {
7375
+ borderBottom: 1,
7376
+ borderColor: "divider",
7377
+ "& .MuiTab-root": {
7378
+ textTransform: "none",
7379
+ fontWeight: 600,
7380
+ fontSize: { xs: "0.95rem", sm: "1rem" },
7381
+ minWidth: { xs: "auto", md: 160 },
7382
+ px: { xs: 1.2, sm: 1.5 }
7383
+ }
7384
+ },
7385
+ children: [
7386
+ /* @__PURE__ */ jsx9(
7387
+ Tab2,
7388
+ {
7389
+ icon: /* @__PURE__ */ jsx9(DescriptionIcon3, { fontSize: isMobile ? "small" : "medium" }),
7390
+ iconPosition: isMobile ? "top" : "start",
7391
+ label: "Documents"
7392
+ }
7393
+ ),
7394
+ seedPacksEnabled && /* @__PURE__ */ jsx9(
7395
+ Tab2,
7396
+ {
7397
+ icon: /* @__PURE__ */ jsx9(AutoStoriesIcon, { fontSize: isMobile ? "small" : "medium" }),
7398
+ iconPosition: isMobile ? "top" : "start",
7399
+ label: "Seed Packs"
7400
+ }
7401
+ )
7402
+ ]
7403
+ }
7404
+ ) }),
7405
+ /* @__PURE__ */ jsx9(Box9, { sx: { display: effectiveTabIndex === 0 ? "block" : "none" }, children: /* @__PURE__ */ jsx9(KnowledgeTab_default, { ...props }) }),
7406
+ seedPacksEnabled && /* @__PURE__ */ jsx9(Box9, { sx: { display: effectiveTabIndex === 1 ? "block" : "none" }, children: /* @__PURE__ */ jsx9(SeedPacksTab_default, {}) })
7407
+ ] });
7408
+ };
7409
+ var KnowledgeHubTab_default = KnowledgeHubTab;
7410
+
7411
+ // src/management/components/StorageTab.tsx
7412
+ import { useState as useState11, useEffect as useEffect8, useMemo as useMemo4 } from "react";
7413
+ import {
7414
+ Box as Box10,
7415
+ Typography as Typography9,
7416
+ Button as Button8,
7417
+ Card as Card5,
7418
+ CardContent as CardContent5,
7419
+ LinearProgress as LinearProgress4,
7420
+ Dialog as Dialog7,
7421
+ DialogTitle as DialogTitle6,
7422
+ DialogContent as DialogContent7,
7423
+ DialogContentText as DialogContentText4,
7424
+ DialogActions as DialogActions6,
7425
+ Alert as Alert8,
7426
+ Stack as Stack4,
7427
+ Chip as Chip7,
7428
+ Accordion,
7429
+ AccordionSummary,
7430
+ AccordionDetails,
7431
+ List as List2,
7432
+ ListItem,
7433
+ ListItemIcon,
7434
+ ListItemText,
7435
+ CircularProgress,
7436
+ Snackbar as Snackbar4,
7437
+ useTheme as useTheme7
7438
+ } from "@mui/material";
7439
+ import StorageIcon from "@mui/icons-material/Storage";
7440
+ import DeleteIcon4 from "@mui/icons-material/Delete";
7441
+ import RefreshIcon3 from "@mui/icons-material/Refresh";
7442
+ import WarningIcon from "@mui/icons-material/Warning";
7443
+ import InfoIcon from "@mui/icons-material/Info";
7444
+ import CleaningServicesIcon from "@mui/icons-material/CleaningServices";
7445
+ import DescriptionIcon4 from "@mui/icons-material/Description";
7446
+ import PersonIcon3 from "@mui/icons-material/Person";
7447
+ import ChatIcon from "@mui/icons-material/Chat";
7448
+ import SettingsIcon from "@mui/icons-material/Settings";
7449
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
7450
+ import CheckCircleIcon3 from "@mui/icons-material/CheckCircle";
7451
+ import ErrorIcon3 from "@mui/icons-material/Error";
7452
+ import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
7453
+ var DEFAULT_DISPLAY_QUOTA_BYTES = 1024 * 1024 * 1024;
7454
+ var MAX_DISPLAY_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
7455
+ var formatBytes = (bytes) => {
7456
+ if (bytes === 0) return "0 B";
7457
+ const k = 1024;
7458
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
7459
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
7460
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
7461
+ };
7462
+ var getStorageQuota = async () => {
7463
+ try {
7464
+ if ("storage" in navigator && "estimate" in navigator.storage) {
7465
+ const estimate = await navigator.storage.estimate();
7466
+ return {
7467
+ used: estimate.usage || 0,
7468
+ quota: estimate.quota || 0
7469
+ };
7470
+ }
7471
+ } catch (error) {
7472
+ debugLogger.warn("Could not get storage estimate", { error });
7473
+ }
7474
+ return { used: 0, quota: 0 };
7475
+ };
7476
+ var getIndexedDBSize = async () => {
7477
+ const categories = [];
7478
+ try {
7479
+ debugLogger.info("Starting IndexedDB size estimation");
7480
+ try {
7481
+ const databases = await indexedDB.databases();
7482
+ debugLogger.info("Available IndexedDB databases:", {
7483
+ databases: databases.map((db) => ({ name: db.name, version: db.version }))
7484
+ });
7485
+ } catch (error) {
7486
+ debugLogger.warn("Could not list databases", { error });
7487
+ }
7488
+ const conversationDbNames = ["bandit-conversations", "banditConversations", "conversations"];
7489
+ let chatSize = { size: 0, count: 0 };
7490
+ let foundConversationDb = "";
7491
+ for (const dbName of conversationDbNames) {
7492
+ try {
7493
+ const result = await estimateStoreSize(dbName, "conversations");
7494
+ if (result.count > 0) {
7495
+ chatSize = result;
7496
+ foundConversationDb = dbName;
7497
+ debugLogger.info(`Found conversations in database: ${dbName}`);
7498
+ break;
7499
+ }
7500
+ } catch (error) {
7501
+ debugLogger.warn(`Failed to check conversations in ${dbName}`, { error });
7502
+ }
7503
+ }
7504
+ categories.push({
7505
+ name: "Chat History",
7506
+ icon: ChatIcon,
7507
+ color: "#4caf50",
7508
+ size: chatSize.size,
7509
+ itemCount: chatSize.count,
7510
+ description: "Conversation history and messages",
7511
+ stores: foundConversationDb ? [`${foundConversationDb}.conversations`] : [],
7512
+ canClear: chatSize.count > 0,
7513
+ clearWarning: "This will permanently delete all your chat conversations and message history."
7514
+ });
7515
+ debugLogger.info(`Chat History category created:`, {
7516
+ itemCount: chatSize.count,
7517
+ size: chatSize.size,
7518
+ canClear: chatSize.count > 0,
7519
+ foundDb: foundConversationDb
7520
+ });
7521
+ const knowledgeDbNames = ["bandit-knowledge", "banditKnowledge", "knowledge"];
7522
+ let knowledgeSize = { size: 0, count: 0 };
7523
+ let foundKnowledgeDb = "";
7524
+ for (const dbName of knowledgeDbNames) {
7525
+ try {
7526
+ const result = await estimateStoreSize(dbName, "documents");
7527
+ debugLogger.info(`Knowledge database ${dbName} check result:`, {
7528
+ size: result.size,
7529
+ count: result.count,
7530
+ sizeFormatted: `${(result.size / 1024).toFixed(2)} KB`
7531
+ });
7532
+ if (result.count > 0) {
7533
+ knowledgeSize = result;
7534
+ foundKnowledgeDb = dbName;
7535
+ debugLogger.info(`Found knowledge documents in database: ${dbName}`, {
7536
+ totalSize: result.size,
7537
+ itemCount: result.count
7538
+ });
7539
+ break;
7540
+ }
7541
+ } catch (error) {
7542
+ debugLogger.warn(`Failed to check knowledge in ${dbName}`, { error });
7543
+ }
7544
+ }
7545
+ categories.push({
7546
+ name: "Knowledge Documents",
7547
+ icon: DescriptionIcon4,
7548
+ color: "#2196f3",
7549
+ size: knowledgeSize.size,
7550
+ itemCount: knowledgeSize.count,
7551
+ description: "Uploaded documents and their embeddings",
7552
+ stores: foundKnowledgeDb ? [`${foundKnowledgeDb}.documents`] : [],
7553
+ canClear: knowledgeSize.count > 0,
7554
+ clearWarning: "This will remove all uploaded documents and their AI embeddings. You will need to re-upload documents."
7555
+ });
7556
+ debugLogger.info(`Knowledge Documents category created:`, {
7557
+ itemCount: knowledgeSize.count,
7558
+ size: knowledgeSize.size,
7559
+ sizeFormatted: `${(knowledgeSize.size / 1024).toFixed(2)} KB`,
7560
+ canClear: knowledgeSize.count > 0,
7561
+ foundDb: foundKnowledgeDb
7562
+ });
7563
+ const memoryDbNames = ["bandit-memory-db", "banditMemories", "bandit-memories"];
7564
+ let memorySize = { size: 0, count: 0 };
7565
+ let foundMemoryDb = "";
7566
+ for (const dbName of memoryDbNames) {
7567
+ try {
7568
+ const result = await estimateStoreSize(dbName, "memories");
7569
+ if (result.count > 0) {
7570
+ memorySize = result;
7571
+ foundMemoryDb = dbName;
7572
+ debugLogger.info(`Found memories in database: ${dbName}`);
7573
+ break;
7574
+ }
7575
+ } catch (error) {
7576
+ debugLogger.warn(`Failed to check memories in ${dbName}`, { error });
7577
+ }
7578
+ }
7579
+ categories.push({
7580
+ name: "AI Memories",
7581
+ icon: PersonIcon3,
7582
+ color: "#ff9800",
7583
+ size: memorySize.size,
7584
+ itemCount: memorySize.count,
7585
+ description: "AI memory entries and learned patterns",
7586
+ stores: foundMemoryDb ? [`${foundMemoryDb}.memories`] : [],
7587
+ canClear: memorySize.count > 0,
7588
+ clearWarning: "This will delete all AI memory entries and learned conversation patterns."
7589
+ });
7590
+ const configDbNames = ["banditConfig", "bandit-config"];
7591
+ let configSize = { size: 0, count: 0 };
7592
+ let foundConfigDb = "";
7593
+ for (const dbName of configDbNames) {
7594
+ try {
7595
+ const result = await estimateStoreSize(dbName, "config");
7596
+ if (result.count > 0) {
7597
+ configSize = result;
7598
+ foundConfigDb = dbName;
7599
+ debugLogger.info(`Found config in database: ${dbName}`);
7600
+ break;
7601
+ }
7602
+ } catch (error) {
7603
+ debugLogger.warn(`Failed to check config in ${dbName}`, { error });
7604
+ }
7605
+ }
7606
+ categories.push({
7607
+ name: "App Settings & Models",
7608
+ icon: SettingsIcon,
7609
+ color: "#9c27b0",
7610
+ size: configSize.size,
7611
+ itemCount: configSize.count,
7612
+ description: "Custom models, app settings, and user preferences",
7613
+ stores: foundConfigDb ? [`${foundConfigDb}.config`] : [],
7614
+ canClear: configSize.count > 0,
7615
+ clearWarning: "This will delete all custom AI models, app settings, themes, and preferences. The app will reset to defaults."
7616
+ });
7617
+ const queryDbNames = ["banditAIQuery", "ai-query-db"];
7618
+ let querySize = { size: 0, count: 0 };
6130
7619
  let foundQueryDb = "";
6131
7620
  for (const dbName of queryDbNames) {
6132
7621
  try {
@@ -6144,7 +7633,7 @@ var getIndexedDBSize = async () => {
6144
7633
  if (querySize.count > 0) {
6145
7634
  categories.push({
6146
7635
  name: "AI Query Cache",
6147
- icon: PersonIcon2,
7636
+ icon: PersonIcon3,
6148
7637
  color: "#ff5722",
6149
7638
  size: querySize.size,
6150
7639
  itemCount: querySize.count,
@@ -6256,21 +7745,21 @@ var clearEntireDatabase = async (dbName) => {
6256
7745
  });
6257
7746
  };
6258
7747
  var StorageTab = ({ currentTheme }) => {
6259
- const theme = useTheme6();
6260
- const [storageQuota, setStorageQuota] = useState9({
7748
+ const theme = useTheme7();
7749
+ const [storageQuota, setStorageQuota] = useState11({
6261
7750
  used: 0,
6262
7751
  quota: 0,
6263
7752
  available: 0,
6264
7753
  browserQuotaEstimate: 0
6265
7754
  });
6266
- const [storageCategories, setStorageCategories] = useState9([]);
6267
- const [loading, setLoading] = useState9(true);
6268
- const [clearAllDialogOpen, setClearAllDialogOpen] = useState9(false);
6269
- const [clearCategoryDialog, setClearCategoryDialog] = useState9(null);
6270
- const [clearing, setClearing] = useState9(false);
6271
- const [snackbarMessage, setSnackbarMessage] = useState9("");
6272
- const [showSnackbar, setShowSnackbar] = useState9(false);
6273
- const [snackbarSeverity, setSnackbarSeverity] = useState9("success");
7755
+ const [storageCategories, setStorageCategories] = useState11([]);
7756
+ const [loading, setLoading] = useState11(true);
7757
+ const [clearAllDialogOpen, setClearAllDialogOpen] = useState11(false);
7758
+ const [clearCategoryDialog, setClearCategoryDialog] = useState11(null);
7759
+ const [clearing, setClearing] = useState11(false);
7760
+ const [snackbarMessage, setSnackbarMessage] = useState11("");
7761
+ const [showSnackbar, setShowSnackbar] = useState11(false);
7762
+ const [snackbarSeverity, setSnackbarSeverity] = useState11("success");
6274
7763
  const { syncEnabled, isAdvancedVectorFeaturesEnabled } = useConversationSyncStore((state) => ({
6275
7764
  syncEnabled: state.syncEnabled,
6276
7765
  isAdvancedVectorFeaturesEnabled: state.isAdvancedVectorFeaturesEnabled
@@ -6322,18 +7811,18 @@ var StorageTab = ({ currentTheme }) => {
6322
7811
  setLoading(false);
6323
7812
  }
6324
7813
  };
6325
- useEffect6(() => {
7814
+ useEffect8(() => {
6326
7815
  loadStorageData();
6327
7816
  }, []);
6328
- const totalUsed = useMemo3(() => {
7817
+ const totalUsed = useMemo4(() => {
6329
7818
  return storageCategories.reduce((sum, cat) => sum + cat.size, 0);
6330
7819
  }, [storageCategories]);
6331
- const usagePercentage = useMemo3(() => {
7820
+ const usagePercentage = useMemo4(() => {
6332
7821
  if (storageQuota.quota === 0) return 0;
6333
7822
  const percentage = Math.min(storageQuota.used / storageQuota.quota * 100, 100);
6334
7823
  return percentage > 0 && percentage < 0.1 ? 0.1 : percentage;
6335
7824
  }, [storageQuota]);
6336
- const clearableCategories = useMemo3(() => {
7825
+ const clearableCategories = useMemo4(() => {
6337
7826
  return storageCategories.filter((cat) => cat.canClear);
6338
7827
  }, [storageCategories]);
6339
7828
  const handleClearCategory = async (category) => {
@@ -6418,13 +7907,13 @@ var StorageTab = ({ currentTheme }) => {
6418
7907
  }
6419
7908
  };
6420
7909
  if (loading) {
6421
- return /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 8 }, children: [
6422
- /* @__PURE__ */ jsx8(CircularProgress, {}),
6423
- /* @__PURE__ */ jsx8(Typography8, { variant: "body1", color: "text.secondary", sx: { ml: 2 }, children: "Analyzing storage usage..." })
7910
+ return /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", justifyContent: "center", alignItems: "center", py: 8 }, children: [
7911
+ /* @__PURE__ */ jsx10(CircularProgress, {}),
7912
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body1", color: "text.secondary", sx: { ml: 2 }, children: "Analyzing storage usage..." })
6424
7913
  ] });
6425
7914
  }
6426
- return /* @__PURE__ */ jsx8(Box8, { children: /* @__PURE__ */ jsxs8(Box8, { sx: { px: { xs: 2, sm: 4, md: 6 }, pt: 3, pb: 5 }, children: [
6427
- /* @__PURE__ */ jsx8(Box8, { sx: { mb: 4 }, children: /* @__PURE__ */ jsxs8(Box8, { sx: {
7915
+ return /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { px: { xs: 2, sm: 4, md: 6 }, pt: 3, pb: 5 }, children: [
7916
+ /* @__PURE__ */ jsx10(Box10, { sx: { mb: 4 }, children: /* @__PURE__ */ jsxs10(Box10, { sx: {
6428
7917
  display: "flex",
6429
7918
  flexDirection: { xs: "column", sm: "row" },
6430
7919
  justifyContent: "space-between",
@@ -6432,19 +7921,19 @@ var StorageTab = ({ currentTheme }) => {
6432
7921
  gap: { xs: 2, sm: 0 },
6433
7922
  mb: 2
6434
7923
  }, children: [
6435
- /* @__PURE__ */ jsxs8(Box8, { sx: { flex: 1 }, children: [
6436
- /* @__PURE__ */ jsx8(Typography8, { variant: "h5", color: "text.primary", sx: { mb: 1, fontWeight: 600 }, children: "Storage Management" }),
6437
- /* @__PURE__ */ jsx8(Typography8, { variant: "body1", color: "text.secondary", children: "Monitor and manage your local browser storage usage" })
7924
+ /* @__PURE__ */ jsxs10(Box10, { sx: { flex: 1 }, children: [
7925
+ /* @__PURE__ */ jsx10(Typography9, { variant: "h5", color: "text.primary", sx: { mb: 1, fontWeight: 600 }, children: "Storage Management" }),
7926
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body1", color: "text.secondary", children: "Monitor and manage your local browser storage usage" })
6438
7927
  ] }),
6439
- /* @__PURE__ */ jsxs8(Box8, { sx: {
7928
+ /* @__PURE__ */ jsxs10(Box10, { sx: {
6440
7929
  display: "flex",
6441
7930
  gap: 1,
6442
7931
  flexWrap: { xs: "wrap", sm: "nowrap" },
6443
7932
  justifyContent: { xs: "stretch", sm: "flex-end" },
6444
7933
  width: { xs: "100%", sm: "auto" }
6445
7934
  }, children: [
6446
- /* @__PURE__ */ jsxs8(
6447
- Button7,
7935
+ /* @__PURE__ */ jsxs10(
7936
+ Button8,
6448
7937
  {
6449
7938
  variant: "outlined",
6450
7939
  size: "small",
@@ -6456,22 +7945,22 @@ var StorageTab = ({ currentTheme }) => {
6456
7945
  minHeight: 36
6457
7946
  },
6458
7947
  children: [
6459
- /* @__PURE__ */ jsxs8(Box8, { sx: { display: { xs: "none", sm: "flex" }, alignItems: "center", gap: 1 }, children: [
6460
- /* @__PURE__ */ jsx8(RefreshIcon2, { fontSize: "medium" }),
7948
+ /* @__PURE__ */ jsxs10(Box10, { sx: { display: { xs: "none", sm: "flex" }, alignItems: "center", gap: 1 }, children: [
7949
+ /* @__PURE__ */ jsx10(RefreshIcon3, { fontSize: "medium" }),
6461
7950
  "Refresh"
6462
7951
  ] }),
6463
- /* @__PURE__ */ jsx8(Box8, { sx: { display: { xs: "flex", sm: "none" }, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx8(RefreshIcon2, { fontSize: "medium" }) })
7952
+ /* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "flex", sm: "none" }, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx10(RefreshIcon3, { fontSize: "medium" }) })
6464
7953
  ]
6465
7954
  }
6466
7955
  ),
6467
- clearableCategories.length > 0 && /* @__PURE__ */ jsxs8(Fragment5, { children: [
6468
- /* @__PURE__ */ jsxs8(
6469
- Button7,
7956
+ clearableCategories.length > 0 && /* @__PURE__ */ jsxs10(Fragment5, { children: [
7957
+ /* @__PURE__ */ jsxs10(
7958
+ Button8,
6470
7959
  {
6471
7960
  variant: "outlined",
6472
7961
  color: "error",
6473
7962
  size: "small",
6474
- startIcon: /* @__PURE__ */ jsx8(CleaningServicesIcon, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
7963
+ startIcon: /* @__PURE__ */ jsx10(CleaningServicesIcon, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
6475
7964
  onClick: () => setClearAllDialogOpen(true),
6476
7965
  sx: {
6477
7966
  minWidth: { xs: "auto", sm: "fit-content" },
@@ -6479,18 +7968,18 @@ var StorageTab = ({ currentTheme }) => {
6479
7968
  px: { xs: 1, sm: 2 }
6480
7969
  },
6481
7970
  children: [
6482
- /* @__PURE__ */ jsx8(Box8, { sx: { display: { xs: "none", sm: "inline" } }, children: "Clear All Data" }),
6483
- /* @__PURE__ */ jsx8(Box8, { sx: { display: { xs: "inline", sm: "none" } }, children: "Clear All" })
7971
+ /* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "none", sm: "inline" } }, children: "Clear All Data" }),
7972
+ /* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "inline", sm: "none" } }, children: "Clear All" })
6484
7973
  ]
6485
7974
  }
6486
7975
  ),
6487
- /* @__PURE__ */ jsxs8(
6488
- Button7,
7976
+ /* @__PURE__ */ jsxs10(
7977
+ Button8,
6489
7978
  {
6490
7979
  variant: "outlined",
6491
7980
  color: "error",
6492
7981
  size: "small",
6493
- startIcon: /* @__PURE__ */ jsx8(DeleteIcon3, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
7982
+ startIcon: /* @__PURE__ */ jsx10(DeleteIcon4, { sx: { display: { xs: "none", sm: "inline-flex" } } }),
6494
7983
  onClick: () => handleNuclearClear(),
6495
7984
  sx: {
6496
7985
  minWidth: { xs: "auto", sm: "fit-content" },
@@ -6498,28 +7987,28 @@ var StorageTab = ({ currentTheme }) => {
6498
7987
  px: { xs: 1, sm: 2 }
6499
7988
  },
6500
7989
  children: [
6501
- /* @__PURE__ */ jsx8(Box8, { sx: { display: { xs: "none", sm: "inline" } }, children: "Nuclear Clear" }),
6502
- /* @__PURE__ */ jsx8(Box8, { sx: { display: { xs: "inline", sm: "none" } }, children: "Nuclear" })
7990
+ /* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "none", sm: "inline" } }, children: "Nuclear Clear" }),
7991
+ /* @__PURE__ */ jsx10(Box10, { sx: { display: { xs: "inline", sm: "none" } }, children: "Nuclear" })
6503
7992
  ]
6504
7993
  }
6505
7994
  )
6506
7995
  ] })
6507
7996
  ] })
6508
7997
  ] }) }),
6509
- /* @__PURE__ */ jsxs8(Box8, { sx: { mb: 4 }, children: [
6510
- /* @__PURE__ */ jsx8(Card4, { sx: { mb: 3 }, children: /* @__PURE__ */ jsxs8(CardContent4, { sx: {
7998
+ /* @__PURE__ */ jsxs10(Box10, { sx: { mb: 4 }, children: [
7999
+ /* @__PURE__ */ jsx10(Card5, { sx: { mb: 3 }, children: /* @__PURE__ */ jsxs10(CardContent5, { sx: {
6511
8000
  display: "flex",
6512
8001
  flexDirection: "column",
6513
8002
  minHeight: 180
6514
8003
  }, children: [
6515
- /* @__PURE__ */ jsxs8(Typography8, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
6516
- /* @__PURE__ */ jsx8(StorageIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
8004
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
8005
+ /* @__PURE__ */ jsx10(StorageIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
6517
8006
  "Storage Quota"
6518
8007
  ] }),
6519
- /* @__PURE__ */ jsxs8(Box8, { sx: { mb: 2, flex: 1 }, children: [
6520
- /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
6521
- /* @__PURE__ */ jsx8(
6522
- Chip6,
8008
+ /* @__PURE__ */ jsxs10(Box10, { sx: { mb: 2, flex: 1 }, children: [
8009
+ /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
8010
+ /* @__PURE__ */ jsx10(
8011
+ Chip7,
6523
8012
  {
6524
8013
  label: `${formatBytes(storageQuota.used)} Used`,
6525
8014
  color: "warning",
@@ -6527,8 +8016,8 @@ var StorageTab = ({ currentTheme }) => {
6527
8016
  variant: "outlined"
6528
8017
  }
6529
8018
  ),
6530
- /* @__PURE__ */ jsx8(
6531
- Chip6,
8019
+ /* @__PURE__ */ jsx10(
8020
+ Chip7,
6532
8021
  {
6533
8022
  label: `${formatBytes(storageQuota.available)} Available`,
6534
8023
  color: "success",
@@ -6536,8 +8025,8 @@ var StorageTab = ({ currentTheme }) => {
6536
8025
  variant: "outlined"
6537
8026
  }
6538
8027
  ),
6539
- /* @__PURE__ */ jsx8(
6540
- Chip6,
8028
+ /* @__PURE__ */ jsx10(
8029
+ Chip7,
6541
8030
  {
6542
8031
  label: `${formatBytes(storageQuota.quota)} Total`,
6543
8032
  color: "info",
@@ -6545,8 +8034,8 @@ var StorageTab = ({ currentTheme }) => {
6545
8034
  variant: "outlined"
6546
8035
  }
6547
8036
  ),
6548
- storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ jsx8(
6549
- Chip6,
8037
+ storageQuota.browserQuotaEstimate > 0 && storageQuota.quota > 0 && Math.abs(storageQuota.browserQuotaEstimate - storageQuota.quota) > storageQuota.quota * 0.05 && /* @__PURE__ */ jsx10(
8038
+ Chip7,
6550
8039
  {
6551
8040
  label: `\u2248${formatBytes(storageQuota.browserQuotaEstimate)} Browser Estimate`,
6552
8041
  color: "default",
@@ -6555,8 +8044,8 @@ var StorageTab = ({ currentTheme }) => {
6555
8044
  }
6556
8045
  )
6557
8046
  ] }),
6558
- /* @__PURE__ */ jsx8(
6559
- LinearProgress3,
8047
+ /* @__PURE__ */ jsx10(
8048
+ LinearProgress4,
6560
8049
  {
6561
8050
  variant: "determinate",
6562
8051
  value: usagePercentage,
@@ -6571,38 +8060,38 @@ var StorageTab = ({ currentTheme }) => {
6571
8060
  }
6572
8061
  }
6573
8062
  ),
6574
- /* @__PURE__ */ jsxs8(Typography8, { variant: "caption", color: "text.secondary", sx: { mt: 0.5, display: "block" }, children: [
8063
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "caption", color: "text.secondary", sx: { mt: 0.5, display: "block" }, children: [
6575
8064
  usagePercentage.toFixed(1),
6576
8065
  "% used"
6577
8066
  ] })
6578
8067
  ] }),
6579
- usagePercentage > 80 && /* @__PURE__ */ jsx8(Alert7, { severity: "warning", sx: { mt: "auto" }, children: "Storage usage is high. Consider clearing unused data." })
8068
+ usagePercentage > 80 && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: "auto" }, children: "Storage usage is high. Consider clearing unused data." })
6580
8069
  ] }) }),
6581
- /* @__PURE__ */ jsx8(Card4, { children: /* @__PURE__ */ jsxs8(CardContent4, { sx: {
8070
+ /* @__PURE__ */ jsx10(Card5, { children: /* @__PURE__ */ jsxs10(CardContent5, { sx: {
6582
8071
  display: "flex",
6583
8072
  flexDirection: "column",
6584
8073
  minHeight: 140
6585
8074
  }, children: [
6586
- /* @__PURE__ */ jsx8(Typography8, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: "Usage Summary" }),
6587
- /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
6588
- /* @__PURE__ */ jsx8(
6589
- Chip6,
8075
+ /* @__PURE__ */ jsx10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: "Usage Summary" }),
8076
+ /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mb: 2 }, children: [
8077
+ /* @__PURE__ */ jsx10(
8078
+ Chip7,
6590
8079
  {
6591
8080
  label: `${storageCategories.length} Categories`,
6592
8081
  color: "primary",
6593
8082
  size: "small"
6594
8083
  }
6595
8084
  ),
6596
- /* @__PURE__ */ jsx8(
6597
- Chip6,
8085
+ /* @__PURE__ */ jsx10(
8086
+ Chip7,
6598
8087
  {
6599
8088
  label: `${storageCategories.reduce((sum, cat) => sum + cat.itemCount, 0)} Items`,
6600
8089
  color: "secondary",
6601
8090
  size: "small"
6602
8091
  }
6603
8092
  ),
6604
- /* @__PURE__ */ jsx8(
6605
- Chip6,
8093
+ /* @__PURE__ */ jsx10(
8094
+ Chip7,
6606
8095
  {
6607
8096
  label: `${formatBytes(totalUsed)} Used`,
6608
8097
  color: "info",
@@ -6610,11 +8099,11 @@ var StorageTab = ({ currentTheme }) => {
6610
8099
  }
6611
8100
  )
6612
8101
  ] }),
6613
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
8102
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", sx: { mt: "auto" }, children: usageSummaryMessage })
6614
8103
  ] }) })
6615
8104
  ] }),
6616
- /* @__PURE__ */ jsx8(Typography8, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
6617
- /* @__PURE__ */ jsx8(Box8, { sx: {
8105
+ /* @__PURE__ */ jsx10(Typography9, { variant: "h6", gutterBottom: true, sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Storage Categories" }),
8106
+ /* @__PURE__ */ jsx10(Box10, { sx: {
6618
8107
  maxHeight: "60vh",
6619
8108
  overflow: "auto",
6620
8109
  "&::-webkit-scrollbar": {
@@ -6622,15 +8111,15 @@ var StorageTab = ({ currentTheme }) => {
6622
8111
  },
6623
8112
  msOverflowStyle: "none",
6624
8113
  scrollbarWidth: "none"
6625
- }, children: storageCategories.length === 0 ? /* @__PURE__ */ jsxs8(Alert7, { severity: "info", sx: { mt: 2 }, children: [
6626
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", children: "No storage data found. This could mean:" }),
6627
- /* @__PURE__ */ jsxs8(Typography8, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
6628
- /* @__PURE__ */ jsx8("li", { children: "All databases are empty" }),
6629
- /* @__PURE__ */ jsx8("li", { children: "Data is stored under different names" }),
6630
- /* @__PURE__ */ jsx8("li", { children: "There was an error accessing the databases" })
8114
+ }, children: storageCategories.length === 0 ? /* @__PURE__ */ jsxs10(Alert8, { severity: "info", sx: { mt: 2 }, children: [
8115
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", children: "No storage data found. This could mean:" }),
8116
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "body2", component: "ul", sx: { mt: 1, pl: 2 }, children: [
8117
+ /* @__PURE__ */ jsx10("li", { children: "All databases are empty" }),
8118
+ /* @__PURE__ */ jsx10("li", { children: "Data is stored under different names" }),
8119
+ /* @__PURE__ */ jsx10("li", { children: "There was an error accessing the databases" })
6631
8120
  ] }),
6632
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", sx: { mt: 1 }, children: 'Try clicking "Refresh" or check the browser console for more details.' })
6633
- ] }) : /* @__PURE__ */ jsx8(Stack3, { spacing: 2, children: storageCategories.map((category) => {
8121
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", sx: { mt: 1 }, children: 'Try clicking "Refresh" or check the browser console for more details.' })
8122
+ ] }) : /* @__PURE__ */ jsx10(Stack4, { spacing: 2, children: storageCategories.map((category) => {
6634
8123
  const IconComponent = category.icon;
6635
8124
  const categoryPercentage = storageQuota.quota > 0 ? category.size / storageQuota.quota * 100 : 0;
6636
8125
  const categoryRelativePercentage = totalUsed > 0 ? category.size / totalUsed * 100 : 0;
@@ -6641,18 +8130,18 @@ var StorageTab = ({ currentTheme }) => {
6641
8130
  categoryPercentage: categoryPercentage.toFixed(2),
6642
8131
  categoryRelativePercentage: categoryRelativePercentage.toFixed(2)
6643
8132
  });
6644
- return /* @__PURE__ */ jsxs8(Accordion, { sx: { bgcolor: "background.paper" }, children: [
6645
- /* @__PURE__ */ jsx8(
8133
+ return /* @__PURE__ */ jsxs10(Accordion, { sx: { bgcolor: "background.paper" }, children: [
8134
+ /* @__PURE__ */ jsx10(
6646
8135
  AccordionSummary,
6647
8136
  {
6648
- expandIcon: /* @__PURE__ */ jsx8(ExpandMoreIcon, {}),
8137
+ expandIcon: /* @__PURE__ */ jsx10(ExpandMoreIcon, {}),
6649
8138
  "aria-controls": `${category.name}-content`,
6650
8139
  id: `${category.name}-header`,
6651
- children: /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", alignItems: "center", width: "100%", pr: 2 }, children: [
6652
- /* @__PURE__ */ jsx8(IconComponent, { sx: { color: category.color, mr: 2 } }),
6653
- /* @__PURE__ */ jsxs8(Box8, { sx: { flex: 1 }, children: [
6654
- /* @__PURE__ */ jsx8(
6655
- Typography8,
8140
+ children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", width: "100%", pr: 2 }, children: [
8141
+ /* @__PURE__ */ jsx10(IconComponent, { sx: { color: category.color, mr: 2 } }),
8142
+ /* @__PURE__ */ jsxs10(Box10, { sx: { flex: 1 }, children: [
8143
+ /* @__PURE__ */ jsx10(
8144
+ Typography9,
6656
8145
  {
6657
8146
  variant: "body1",
6658
8147
  style: {
@@ -6662,18 +8151,18 @@ var StorageTab = ({ currentTheme }) => {
6662
8151
  children: category.name
6663
8152
  }
6664
8153
  ),
6665
- /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", alignItems: "center", gap: 2, mt: 0.5 }, children: [
6666
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: formatBytes(category.size) }),
6667
- /* @__PURE__ */ jsx8(
6668
- Chip6,
8154
+ /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 2, mt: 0.5 }, children: [
8155
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", children: formatBytes(category.size) }),
8156
+ /* @__PURE__ */ jsx10(
8157
+ Chip7,
6669
8158
  {
6670
8159
  label: `${category.itemCount} items`,
6671
8160
  size: "small",
6672
8161
  variant: "outlined"
6673
8162
  }
6674
8163
  ),
6675
- /* @__PURE__ */ jsx8(Box8, { sx: { flex: 1, mx: 2 }, children: /* @__PURE__ */ jsx8(
6676
- LinearProgress3,
8164
+ /* @__PURE__ */ jsx10(Box10, { sx: { flex: 1, mx: 2 }, children: /* @__PURE__ */ jsx10(
8165
+ LinearProgress4,
6677
8166
  {
6678
8167
  variant: "determinate",
6679
8168
  value: Math.min(categoryRelativePercentage, 100),
@@ -6688,7 +8177,7 @@ var StorageTab = ({ currentTheme }) => {
6688
8177
  }
6689
8178
  }
6690
8179
  ) }),
6691
- /* @__PURE__ */ jsxs8(Typography8, { variant: "caption", color: "text.secondary", children: [
8180
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "caption", color: "text.secondary", children: [
6692
8181
  categoryRelativePercentage.toFixed(1),
6693
8182
  "%"
6694
8183
  ] })
@@ -6697,12 +8186,12 @@ var StorageTab = ({ currentTheme }) => {
6697
8186
  ] })
6698
8187
  }
6699
8188
  ),
6700
- /* @__PURE__ */ jsx8(AccordionDetails, { children: /* @__PURE__ */ jsxs8(Box8, { sx: { pl: 5 }, children: [
6701
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", paragraph: true, children: category.description }),
6702
- /* @__PURE__ */ jsx8(Typography8, { variant: "subtitle2", gutterBottom: true, children: "Storage Locations:" }),
6703
- /* @__PURE__ */ jsx8(List, { dense: true, children: category.stores.map((store) => /* @__PURE__ */ jsxs8(ListItem, { sx: { py: 0.5 }, children: [
6704
- /* @__PURE__ */ jsx8(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx8(StorageIcon, { fontSize: "small" }) }),
6705
- /* @__PURE__ */ jsx8(
8189
+ /* @__PURE__ */ jsx10(AccordionDetails, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { pl: 5 }, children: [
8190
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", paragraph: true, children: category.description }),
8191
+ /* @__PURE__ */ jsx10(Typography9, { variant: "subtitle2", gutterBottom: true, children: "Storage Locations:" }),
8192
+ /* @__PURE__ */ jsx10(List2, { dense: true, children: category.stores.map((store) => /* @__PURE__ */ jsxs10(ListItem, { sx: { py: 0.5 }, children: [
8193
+ /* @__PURE__ */ jsx10(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx10(StorageIcon, { fontSize: "small" }) }),
8194
+ /* @__PURE__ */ jsx10(
6706
8195
  ListItemText,
6707
8196
  {
6708
8197
  primary: store,
@@ -6710,14 +8199,14 @@ var StorageTab = ({ currentTheme }) => {
6710
8199
  }
6711
8200
  )
6712
8201
  ] }, store)) }),
6713
- category.canClear ? /* @__PURE__ */ jsxs8(Box8, { sx: { mt: 2, pt: 2, borderTop: 1, borderColor: "divider" }, children: [
6714
- /* @__PURE__ */ jsxs8(
6715
- Button7,
8202
+ category.canClear ? /* @__PURE__ */ jsxs10(Box10, { sx: { mt: 2, pt: 2, borderTop: 1, borderColor: "divider" }, children: [
8203
+ /* @__PURE__ */ jsxs10(
8204
+ Button8,
6716
8205
  {
6717
8206
  variant: "outlined",
6718
8207
  color: "error",
6719
8208
  size: "small",
6720
- startIcon: /* @__PURE__ */ jsx8(DeleteIcon3, {}),
8209
+ startIcon: /* @__PURE__ */ jsx10(DeleteIcon4, {}),
6721
8210
  onClick: () => setClearCategoryDialog(category),
6722
8211
  disabled: clearing,
6723
8212
  children: [
@@ -6726,19 +8215,19 @@ var StorageTab = ({ currentTheme }) => {
6726
8215
  ]
6727
8216
  }
6728
8217
  ),
6729
- category.clearWarning && /* @__PURE__ */ jsx8(Alert7, { severity: "warning", sx: { mt: 2 }, children: /* @__PURE__ */ jsx8(Typography8, { variant: "caption", children: category.clearWarning }) })
6730
- ] }) : /* @__PURE__ */ jsx8(Alert7, { severity: "info", sx: { mt: 2 }, children: /* @__PURE__ */ jsx8(Typography8, { variant: "caption", children: category.itemCount === 0 ? "This category is empty." : "This category cannot be cleared automatically." }) })
8218
+ category.clearWarning && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: 2 }, children: /* @__PURE__ */ jsx10(Typography9, { variant: "caption", children: category.clearWarning }) })
8219
+ ] }) : /* @__PURE__ */ jsx10(Alert8, { severity: "info", sx: { mt: 2 }, children: /* @__PURE__ */ jsx10(Typography9, { variant: "caption", children: category.itemCount === 0 ? "This category is empty." : "This category cannot be cleared automatically." }) })
6731
8220
  ] }) })
6732
8221
  ] }, category.name);
6733
8222
  }) }) }),
6734
- /* @__PURE__ */ jsx8(Card4, { sx: { mt: 4 }, children: /* @__PURE__ */ jsxs8(CardContent4, { children: [
6735
- /* @__PURE__ */ jsxs8(Typography8, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
6736
- /* @__PURE__ */ jsx8(InfoIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
8223
+ /* @__PURE__ */ jsx10(Card5, { sx: { mt: 4 }, children: /* @__PURE__ */ jsxs10(CardContent5, { children: [
8224
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "h6", gutterBottom: true, sx: { fontWeight: 600, color: "text.primary" }, children: [
8225
+ /* @__PURE__ */ jsx10(InfoIcon, { sx: { mr: 1, verticalAlign: "middle" } }),
6737
8226
  "Storage Tips & Clear Options"
6738
8227
  ] }),
6739
- /* @__PURE__ */ jsxs8(List, { children: [
6740
- /* @__PURE__ */ jsxs8(ListItem, { children: [
6741
- /* @__PURE__ */ jsx8(ListItemIcon, { children: /* @__PURE__ */ jsx8(
8228
+ /* @__PURE__ */ jsxs10(List2, { children: [
8229
+ /* @__PURE__ */ jsxs10(ListItem, { children: [
8230
+ /* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(
6742
8231
  CheckCircleIcon3,
6743
8232
  {
6744
8233
  sx: {
@@ -6746,7 +8235,7 @@ var StorageTab = ({ currentTheme }) => {
6746
8235
  }
6747
8236
  }
6748
8237
  ) }),
6749
- /* @__PURE__ */ jsx8(
8238
+ /* @__PURE__ */ jsx10(
6750
8239
  ListItemText,
6751
8240
  {
6752
8241
  primary: storageStatusPrimary,
@@ -6754,9 +8243,9 @@ var StorageTab = ({ currentTheme }) => {
6754
8243
  }
6755
8244
  )
6756
8245
  ] }),
6757
- /* @__PURE__ */ jsxs8(ListItem, { children: [
6758
- /* @__PURE__ */ jsx8(ListItemIcon, { children: /* @__PURE__ */ jsx8(CleaningServicesIcon, { color: "info" }) }),
6759
- /* @__PURE__ */ jsx8(
8246
+ /* @__PURE__ */ jsxs10(ListItem, { children: [
8247
+ /* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(CleaningServicesIcon, { color: "info" }) }),
8248
+ /* @__PURE__ */ jsx10(
6760
8249
  ListItemText,
6761
8250
  {
6762
8251
  primary: "Clear All Data (Safe)",
@@ -6764,9 +8253,9 @@ var StorageTab = ({ currentTheme }) => {
6764
8253
  }
6765
8254
  )
6766
8255
  ] }),
6767
- /* @__PURE__ */ jsxs8(ListItem, { children: [
6768
- /* @__PURE__ */ jsx8(ListItemIcon, { children: /* @__PURE__ */ jsx8(DeleteIcon3, { color: "error" }) }),
6769
- /* @__PURE__ */ jsx8(
8256
+ /* @__PURE__ */ jsxs10(ListItem, { children: [
8257
+ /* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(DeleteIcon4, { color: "error" }) }),
8258
+ /* @__PURE__ */ jsx10(
6770
8259
  ListItemText,
6771
8260
  {
6772
8261
  primary: "Nuclear Clear (Complete Reset)",
@@ -6774,9 +8263,9 @@ var StorageTab = ({ currentTheme }) => {
6774
8263
  }
6775
8264
  )
6776
8265
  ] }),
6777
- /* @__PURE__ */ jsxs8(ListItem, { children: [
6778
- /* @__PURE__ */ jsx8(ListItemIcon, { children: /* @__PURE__ */ jsx8(WarningIcon, { color: "warning" }) }),
6779
- /* @__PURE__ */ jsx8(
8266
+ /* @__PURE__ */ jsxs10(ListItem, { children: [
8267
+ /* @__PURE__ */ jsx10(ListItemIcon, { children: /* @__PURE__ */ jsx10(WarningIcon, { color: "warning" }) }),
8268
+ /* @__PURE__ */ jsx10(
6780
8269
  ListItemText,
6781
8270
  {
6782
8271
  primary: "Backup important data",
@@ -6786,38 +8275,38 @@ var StorageTab = ({ currentTheme }) => {
6786
8275
  ] })
6787
8276
  ] })
6788
8277
  ] }) }),
6789
- /* @__PURE__ */ jsxs8(
6790
- Dialog6,
8278
+ /* @__PURE__ */ jsxs10(
8279
+ Dialog7,
6791
8280
  {
6792
8281
  open: !!clearCategoryDialog,
6793
8282
  onClose: () => setClearCategoryDialog(null),
6794
8283
  maxWidth: "sm",
6795
8284
  fullWidth: true,
6796
8285
  children: [
6797
- /* @__PURE__ */ jsx8(DialogTitle5, { children: /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
6798
- /* @__PURE__ */ jsx8(WarningIcon, { color: "warning" }),
8286
+ /* @__PURE__ */ jsx10(DialogTitle6, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
8287
+ /* @__PURE__ */ jsx10(WarningIcon, { color: "warning" }),
6799
8288
  "Clear ",
6800
8289
  clearCategoryDialog?.name,
6801
8290
  "?"
6802
8291
  ] }) }),
6803
- /* @__PURE__ */ jsxs8(DialogContent6, { children: [
6804
- /* @__PURE__ */ jsxs8(DialogContentText3, { children: [
8292
+ /* @__PURE__ */ jsxs10(DialogContent7, { children: [
8293
+ /* @__PURE__ */ jsxs10(DialogContentText4, { children: [
6805
8294
  'This will permanently delete all data in the "',
6806
8295
  clearCategoryDialog?.name,
6807
8296
  '" category.'
6808
8297
  ] }),
6809
- clearCategoryDialog?.clearWarning && /* @__PURE__ */ jsx8(Alert7, { severity: "warning", sx: { mt: 2 }, children: clearCategoryDialog.clearWarning }),
6810
- clearCategoryDialog && /* @__PURE__ */ jsxs8(Box8, { sx: { mt: 2, p: 2, bgcolor: "action.hover", borderRadius: 1 }, children: [
6811
- /* @__PURE__ */ jsx8(Typography8, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ jsx8("strong", { children: "Will clear:" }) }),
6812
- /* @__PURE__ */ jsxs8(Typography8, { variant: "body2", sx: { fontFamily: "monospace", mt: 1 }, children: [
8298
+ clearCategoryDialog?.clearWarning && /* @__PURE__ */ jsx10(Alert8, { severity: "warning", sx: { mt: 2 }, children: clearCategoryDialog.clearWarning }),
8299
+ clearCategoryDialog && /* @__PURE__ */ jsxs10(Box10, { sx: { mt: 2, p: 2, bgcolor: "action.hover", borderRadius: 1 }, children: [
8300
+ /* @__PURE__ */ jsx10(Typography9, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ jsx10("strong", { children: "Will clear:" }) }),
8301
+ /* @__PURE__ */ jsxs10(Typography9, { variant: "body2", sx: { fontFamily: "monospace", mt: 1 }, children: [
6813
8302
  "\u2022 ",
6814
8303
  clearCategoryDialog.itemCount,
6815
8304
  " items",
6816
- /* @__PURE__ */ jsx8("br", {}),
8305
+ /* @__PURE__ */ jsx10("br", {}),
6817
8306
  "\u2022 ",
6818
8307
  formatBytes(clearCategoryDialog.size),
6819
8308
  " of data",
6820
- /* @__PURE__ */ jsx8("br", {}),
8309
+ /* @__PURE__ */ jsx10("br", {}),
6821
8310
  "\u2022 ",
6822
8311
  clearCategoryDialog.stores.length,
6823
8312
  " storage location",
@@ -6825,22 +8314,22 @@ var StorageTab = ({ currentTheme }) => {
6825
8314
  ] })
6826
8315
  ] })
6827
8316
  ] }),
6828
- /* @__PURE__ */ jsxs8(DialogActions5, { children: [
6829
- /* @__PURE__ */ jsx8(
6830
- Button7,
8317
+ /* @__PURE__ */ jsxs10(DialogActions6, { children: [
8318
+ /* @__PURE__ */ jsx10(
8319
+ Button8,
6831
8320
  {
6832
8321
  onClick: () => setClearCategoryDialog(null),
6833
8322
  disabled: clearing,
6834
8323
  children: "Cancel"
6835
8324
  }
6836
8325
  ),
6837
- /* @__PURE__ */ jsx8(
6838
- Button7,
8326
+ /* @__PURE__ */ jsx10(
8327
+ Button8,
6839
8328
  {
6840
8329
  onClick: () => clearCategoryDialog && handleClearCategory(clearCategoryDialog),
6841
8330
  color: "error",
6842
8331
  variant: "contained",
6843
- startIcon: clearing ? /* @__PURE__ */ jsx8(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx8(DeleteIcon3, {}),
8332
+ startIcon: clearing ? /* @__PURE__ */ jsx10(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx10(DeleteIcon4, {}),
6844
8333
  disabled: clearing,
6845
8334
  children: clearing ? "Clearing..." : "Clear Data"
6846
8335
  }
@@ -6849,23 +8338,23 @@ var StorageTab = ({ currentTheme }) => {
6849
8338
  ]
6850
8339
  }
6851
8340
  ),
6852
- /* @__PURE__ */ jsxs8(
6853
- Dialog6,
8341
+ /* @__PURE__ */ jsxs10(
8342
+ Dialog7,
6854
8343
  {
6855
8344
  open: clearAllDialogOpen,
6856
8345
  onClose: () => setClearAllDialogOpen(false),
6857
8346
  maxWidth: "sm",
6858
8347
  fullWidth: true,
6859
8348
  children: [
6860
- /* @__PURE__ */ jsx8(DialogTitle5, { children: /* @__PURE__ */ jsxs8(Box8, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
6861
- /* @__PURE__ */ jsx8(ErrorIcon3, { color: "error" }),
8349
+ /* @__PURE__ */ jsx10(DialogTitle6, { children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
8350
+ /* @__PURE__ */ jsx10(ErrorIcon3, { color: "error" }),
6862
8351
  "Clear All Storage Data?"
6863
8352
  ] }) }),
6864
- /* @__PURE__ */ jsxs8(DialogContent6, { children: [
6865
- /* @__PURE__ */ jsx8(DialogContentText3, { children: "This will permanently delete ALL your local data including:" }),
6866
- /* @__PURE__ */ jsx8(List, { dense: true, sx: { mt: 1 }, children: clearableCategories.map((category) => /* @__PURE__ */ jsxs8(ListItem, { children: [
6867
- /* @__PURE__ */ jsx8(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx8(category.icon, { fontSize: "small", sx: { color: category.color } }) }),
6868
- /* @__PURE__ */ jsx8(
8353
+ /* @__PURE__ */ jsxs10(DialogContent7, { children: [
8354
+ /* @__PURE__ */ jsx10(DialogContentText4, { children: "This will permanently delete ALL your local data including:" }),
8355
+ /* @__PURE__ */ jsx10(List2, { dense: true, sx: { mt: 1 }, children: clearableCategories.map((category) => /* @__PURE__ */ jsxs10(ListItem, { children: [
8356
+ /* @__PURE__ */ jsx10(ListItemIcon, { sx: { minWidth: 32 }, children: /* @__PURE__ */ jsx10(category.icon, { fontSize: "small", sx: { color: category.color } }) }),
8357
+ /* @__PURE__ */ jsx10(
6869
8358
  ListItemText,
6870
8359
  {
6871
8360
  primary: category.name,
@@ -6873,27 +8362,27 @@ var StorageTab = ({ currentTheme }) => {
6873
8362
  }
6874
8363
  )
6875
8364
  ] }, category.name)) }),
6876
- /* @__PURE__ */ jsx8(Alert7, { severity: "error", sx: { mt: 2 }, children: /* @__PURE__ */ jsxs8(Typography8, { variant: "body2", children: [
6877
- /* @__PURE__ */ jsx8("strong", { children: "This action cannot be undone!" }),
8365
+ /* @__PURE__ */ jsx10(Alert8, { severity: "error", sx: { mt: 2 }, children: /* @__PURE__ */ jsxs10(Typography9, { variant: "body2", children: [
8366
+ /* @__PURE__ */ jsx10("strong", { children: "This action cannot be undone!" }),
6878
8367
  " Make sure to export any important data before proceeding."
6879
8368
  ] }) })
6880
8369
  ] }),
6881
- /* @__PURE__ */ jsxs8(DialogActions5, { children: [
6882
- /* @__PURE__ */ jsx8(
6883
- Button7,
8370
+ /* @__PURE__ */ jsxs10(DialogActions6, { children: [
8371
+ /* @__PURE__ */ jsx10(
8372
+ Button8,
6884
8373
  {
6885
8374
  onClick: () => setClearAllDialogOpen(false),
6886
8375
  disabled: clearing,
6887
8376
  children: "Cancel"
6888
8377
  }
6889
8378
  ),
6890
- /* @__PURE__ */ jsx8(
6891
- Button7,
8379
+ /* @__PURE__ */ jsx10(
8380
+ Button8,
6892
8381
  {
6893
8382
  onClick: handleClearAll,
6894
8383
  color: "error",
6895
8384
  variant: "contained",
6896
- startIcon: clearing ? /* @__PURE__ */ jsx8(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx8(CleaningServicesIcon, {}),
8385
+ startIcon: clearing ? /* @__PURE__ */ jsx10(CircularProgress, { size: 16 }) : /* @__PURE__ */ jsx10(CleaningServicesIcon, {}),
6897
8386
  disabled: clearing,
6898
8387
  children: clearing ? "Clearing All..." : "Clear All Data"
6899
8388
  }
@@ -6902,15 +8391,15 @@ var StorageTab = ({ currentTheme }) => {
6902
8391
  ]
6903
8392
  }
6904
8393
  ),
6905
- /* @__PURE__ */ jsx8(
6906
- Snackbar3,
8394
+ /* @__PURE__ */ jsx10(
8395
+ Snackbar4,
6907
8396
  {
6908
8397
  open: showSnackbar,
6909
8398
  autoHideDuration: 4e3,
6910
8399
  onClose: () => setShowSnackbar(false),
6911
8400
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
6912
- children: /* @__PURE__ */ jsx8(
6913
- Alert7,
8401
+ children: /* @__PURE__ */ jsx10(
8402
+ Alert8,
6914
8403
  {
6915
8404
  onClose: () => setShowSnackbar(false),
6916
8405
  severity: snackbarSeverity,
@@ -6926,27 +8415,27 @@ var StorageTab = ({ currentTheme }) => {
6926
8415
  var StorageTab_default = StorageTab;
6927
8416
 
6928
8417
  // src/management/components/ProviderTab.tsx
6929
- import { useState as useState10, useEffect as useEffect7, useCallback as useCallback6 } from "react";
8418
+ import { useState as useState12, useEffect as useEffect9, useCallback as useCallback7 } from "react";
6930
8419
  import {
6931
- Box as Box9,
6932
- Typography as Typography9,
8420
+ Box as Box11,
8421
+ Typography as Typography10,
6933
8422
  Paper as Paper5,
6934
- Button as Button8,
6935
- TextField as TextField5,
8423
+ Button as Button9,
8424
+ TextField as TextField6,
6936
8425
  MenuItem as MenuItem3,
6937
- Chip as Chip7,
6938
- Snackbar as Snackbar4,
6939
- Alert as Alert8,
6940
- useTheme as useTheme7,
6941
- useMediaQuery as useMediaQuery5
8426
+ Chip as Chip8,
8427
+ Snackbar as Snackbar5,
8428
+ Alert as Alert9,
8429
+ useTheme as useTheme8,
8430
+ useMediaQuery as useMediaQuery6
6942
8431
  } from "@mui/material";
6943
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
8432
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
6944
8433
  var ProviderTab = () => {
6945
8434
  const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
6946
8435
  const { settings: packageSettings } = usePackageSettingsStore();
6947
- const theme = useTheme7();
6948
- const isMobile = useMediaQuery5(theme.breakpoints.down("sm"));
6949
- const getSuggestedModel = useCallback6((type) => {
8436
+ const theme = useTheme8();
8437
+ const isMobile = useMediaQuery6(theme.breakpoints.down("sm"));
8438
+ const getSuggestedModel = useCallback7((type) => {
6950
8439
  const configuredDefault = packageSettings?.defaultModel?.trim();
6951
8440
  if (configuredDefault) {
6952
8441
  return configuredDefault;
@@ -6962,7 +8451,7 @@ var ProviderTab = () => {
6962
8451
  return "";
6963
8452
  }
6964
8453
  }, [packageSettings?.defaultModel]);
6965
- const applyDefaultModel = useCallback6((config) => {
8454
+ const applyDefaultModel = useCallback7((config) => {
6966
8455
  const normalized = { ...config };
6967
8456
  const trimmed = typeof normalized.defaultModel === "string" ? normalized.defaultModel.trim() : void 0;
6968
8457
  const requiresModel = normalized.type === "openai" /* OPENAI */ || normalized.type === "xai" /* XAI */ || normalized.type === "bandit" /* BANDIT */;
@@ -6982,7 +8471,7 @@ var ProviderTab = () => {
6982
8471
  }
6983
8472
  return normalized;
6984
8473
  }, [getSuggestedModel]);
6985
- const sanitizeConfigForSave = useCallback6((config) => {
8474
+ const sanitizeConfigForSave = useCallback7((config) => {
6986
8475
  const sanitized = { ...config };
6987
8476
  if (typeof sanitized.defaultModel === "string") {
6988
8477
  const trimmed = sanitized.defaultModel.trim();
@@ -6994,15 +8483,15 @@ var ProviderTab = () => {
6994
8483
  }
6995
8484
  return sanitized;
6996
8485
  }, []);
6997
- const [providerConfig, setProviderConfig] = useState10({
8486
+ const [providerConfig, setProviderConfig] = useState12({
6998
8487
  type: "gateway",
6999
8488
  gatewayUrl: packageSettings?.gatewayApiUrl || "",
7000
8489
  provider: "bandit"
7001
8490
  });
7002
- const [isProviderConfigOpen, setIsProviderConfigOpen] = useState10(false);
7003
- const [snackbarMessage, setSnackbarMessage] = useState10("");
7004
- const [showSnackbar, setShowSnackbar] = useState10(false);
7005
- const [snackbarSeverity, setSnackbarSeverity] = useState10("success");
8491
+ const [isProviderConfigOpen, setIsProviderConfigOpen] = useState12(false);
8492
+ const [snackbarMessage, setSnackbarMessage] = useState12("");
8493
+ const [showSnackbar, setShowSnackbar] = useState12(false);
8494
+ const [snackbarSeverity, setSnackbarSeverity] = useState12("success");
7006
8495
  const saveProviderConfigToDB = async (config) => {
7007
8496
  try {
7008
8497
  const { tokenFactory: _tokenFactory, ...persistableConfig } = config;
@@ -7043,7 +8532,7 @@ var ProviderTab = () => {
7043
8532
  }
7044
8533
  return null;
7045
8534
  };
7046
- const convertAnthropicConfig = useCallback6((config) => {
8535
+ const convertAnthropicConfig = useCallback7((config) => {
7047
8536
  if (!config) return null;
7048
8537
  if (config.type !== "anthropic" /* ANTHROPIC */) {
7049
8538
  return config;
@@ -7059,7 +8548,7 @@ var ProviderTab = () => {
7059
8548
  };
7060
8549
  return converted;
7061
8550
  }, [packageSettings?.gatewayApiUrl]);
7062
- useEffect7(() => {
8551
+ useEffect9(() => {
7063
8552
  const initializeProviderConfig = async () => {
7064
8553
  const savedConfig = await loadProviderConfigFromDB();
7065
8554
  if (savedConfig) {
@@ -7194,18 +8683,18 @@ var ProviderTab = () => {
7194
8683
  showMessage("Connection test failed. Please check your configuration.", "error");
7195
8684
  }
7196
8685
  };
7197
- return /* @__PURE__ */ jsxs9(Box9, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
7198
- /* @__PURE__ */ jsxs9(Box9, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
7199
- /* @__PURE__ */ jsx9(
7200
- Typography9,
8686
+ return /* @__PURE__ */ jsxs11(Box11, { sx: { p: { xs: 1.5, sm: 3, md: 4 } }, children: [
8687
+ /* @__PURE__ */ jsxs11(Box11, { sx: { mb: { xs: 2.5, md: 3 } }, children: [
8688
+ /* @__PURE__ */ jsx11(
8689
+ Typography10,
7201
8690
  {
7202
8691
  variant: "h5",
7203
8692
  sx: { fontWeight: 600, mb: 1, color: "primary.main", fontSize: { xs: "1.6rem", md: "1.8rem" } },
7204
8693
  children: "AI Provider Configuration"
7205
8694
  }
7206
8695
  ),
7207
- /* @__PURE__ */ jsx9(
7208
- Typography9,
8696
+ /* @__PURE__ */ jsx11(
8697
+ Typography10,
7209
8698
  {
7210
8699
  variant: "body1",
7211
8700
  color: "text.secondary",
@@ -7214,23 +8703,23 @@ var ProviderTab = () => {
7214
8703
  children: "Configure your AI provider for chat, generation, and model services. This determines which backend service powers your AI interactions."
7215
8704
  }
7216
8705
  ),
7217
- /* @__PURE__ */ jsxs9(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
7218
- /* @__PURE__ */ jsx9(Typography9, { variant: "h6", sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Current Provider" }),
7219
- currentProvider ? /* @__PURE__ */ jsxs9(Box9, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
7220
- /* @__PURE__ */ jsx9(
7221
- Chip7,
8706
+ /* @__PURE__ */ jsxs11(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
8707
+ /* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { mb: 2, fontWeight: 600, color: "text.primary" }, children: "Current Provider" }),
8708
+ currentProvider ? /* @__PURE__ */ jsxs11(Box11, { sx: { display: "flex", alignItems: "center", gap: 2 }, children: [
8709
+ /* @__PURE__ */ jsx11(
8710
+ Chip8,
7222
8711
  {
7223
8712
  label: currentProvider.getProviderType().toUpperCase(),
7224
8713
  color: "primary",
7225
8714
  variant: "filled"
7226
8715
  }
7227
8716
  ),
7228
- /* @__PURE__ */ jsx9(Typography9, { variant: "body2", color: "text.secondary", children: currentProviderConfig?.baseUrl || currentProviderConfig?.gatewayUrl || "No URL configured" })
7229
- ] }) : /* @__PURE__ */ jsx9(Chip7, { label: "No Provider Configured", color: "warning" })
8717
+ /* @__PURE__ */ jsx11(Typography10, { variant: "body2", color: "text.secondary", children: currentProviderConfig?.baseUrl || currentProviderConfig?.gatewayUrl || "No URL configured" })
8718
+ ] }) : /* @__PURE__ */ jsx11(Chip8, { label: "No Provider Configured", color: "warning" })
7230
8719
  ] }),
7231
- /* @__PURE__ */ jsxs9(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
7232
- /* @__PURE__ */ jsxs9(
7233
- Box9,
8720
+ /* @__PURE__ */ jsxs11(Paper5, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider" }, children: [
8721
+ /* @__PURE__ */ jsxs11(
8722
+ Box11,
7234
8723
  {
7235
8724
  sx: {
7236
8725
  display: "flex",
@@ -7241,9 +8730,9 @@ var ProviderTab = () => {
7241
8730
  mb: 3
7242
8731
  },
7243
8732
  children: [
7244
- /* @__PURE__ */ jsx9(Typography9, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
7245
- /* @__PURE__ */ jsxs9(
7246
- Button8,
8733
+ /* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
8734
+ /* @__PURE__ */ jsxs11(
8735
+ Button9,
7247
8736
  {
7248
8737
  variant: "outlined",
7249
8738
  onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
@@ -7257,9 +8746,9 @@ var ProviderTab = () => {
7257
8746
  ]
7258
8747
  }
7259
8748
  ),
7260
- isProviderConfigOpen && /* @__PURE__ */ jsxs9(Box9, { sx: { mt: 3 }, children: [
7261
- /* @__PURE__ */ jsxs9(
7262
- TextField5,
8749
+ isProviderConfigOpen && /* @__PURE__ */ jsxs11(Box11, { sx: { mt: 3 }, children: [
8750
+ /* @__PURE__ */ jsxs11(
8751
+ TextField6,
7263
8752
  {
7264
8753
  label: "Provider Type",
7265
8754
  select: true,
@@ -7268,19 +8757,19 @@ var ProviderTab = () => {
7268
8757
  fullWidth: true,
7269
8758
  sx: { mb: 3 },
7270
8759
  children: [
7271
- /* @__PURE__ */ jsx9(MenuItem3, { value: "gateway", children: "Gateway (Recommended)" }),
7272
- /* @__PURE__ */ jsx9(MenuItem3, { value: "ollama", children: "Ollama" }),
7273
- /* @__PURE__ */ jsx9(MenuItem3, { value: "openai", children: "OpenAI" }),
7274
- /* @__PURE__ */ jsx9(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
7275
- /* @__PURE__ */ jsx9(MenuItem3, { value: "bandit", children: "Bandit AI" }),
7276
- /* @__PURE__ */ jsx9(MenuItem3, { value: "xai", children: "xAI" }),
7277
- /* @__PURE__ */ jsx9(MenuItem3, { value: "playground", children: "Playground (Mock Demo)" })
8760
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "gateway", children: "Gateway (Recommended)" }),
8761
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "ollama", children: "Ollama" }),
8762
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "openai", children: "OpenAI" }),
8763
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
8764
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "bandit", children: "Bandit AI" }),
8765
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "xai", children: "xAI" }),
8766
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "playground", children: "Playground (Mock Demo)" })
7278
8767
  ]
7279
8768
  }
7280
8769
  ),
7281
- providerConfig.type === "gateway" && /* @__PURE__ */ jsxs9(Box9, { children: [
7282
- /* @__PURE__ */ jsx9(
7283
- TextField5,
8770
+ providerConfig.type === "gateway" && /* @__PURE__ */ jsxs11(Box11, { children: [
8771
+ /* @__PURE__ */ jsx11(
8772
+ TextField6,
7284
8773
  {
7285
8774
  label: "Gateway URL",
7286
8775
  value: providerConfig.gatewayUrl || "",
@@ -7290,8 +8779,8 @@ var ProviderTab = () => {
7290
8779
  placeholder: "https://your-gateway-api.com"
7291
8780
  }
7292
8781
  ),
7293
- /* @__PURE__ */ jsxs9(
7294
- TextField5,
8782
+ /* @__PURE__ */ jsxs11(
8783
+ TextField6,
7295
8784
  {
7296
8785
  label: "Backend Provider",
7297
8786
  select: true,
@@ -7303,18 +8792,18 @@ var ProviderTab = () => {
7303
8792
  fullWidth: true,
7304
8793
  sx: { mb: 2 },
7305
8794
  children: [
7306
- /* @__PURE__ */ jsx9(MenuItem3, { value: "openai", children: "OpenAI" }),
7307
- /* @__PURE__ */ jsx9(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
7308
- /* @__PURE__ */ jsx9(MenuItem3, { value: "anthropic", children: "Anthropic" }),
7309
- /* @__PURE__ */ jsx9(MenuItem3, { value: "ollama", children: "Ollama" }),
7310
- /* @__PURE__ */ jsx9(MenuItem3, { value: "bandit", children: "Bandit AI" }),
7311
- /* @__PURE__ */ jsx9(MenuItem3, { value: "xai", children: "xAI" })
8795
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "openai", children: "OpenAI" }),
8796
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "azure-openai", children: "Azure OpenAI" }),
8797
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "anthropic", children: "Anthropic" }),
8798
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "ollama", children: "Ollama" }),
8799
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "bandit", children: "Bandit AI" }),
8800
+ /* @__PURE__ */ jsx11(MenuItem3, { value: "xai", children: "xAI" })
7312
8801
  ]
7313
8802
  }
7314
8803
  )
7315
8804
  ] }),
7316
- providerConfig.type === "ollama" && /* @__PURE__ */ jsx9(
7317
- TextField5,
8805
+ providerConfig.type === "ollama" && /* @__PURE__ */ jsx11(
8806
+ TextField6,
7318
8807
  {
7319
8808
  label: "Ollama URL",
7320
8809
  value: providerConfig.baseUrl || "",
@@ -7323,9 +8812,9 @@ var ProviderTab = () => {
7323
8812
  placeholder: "http://localhost:11434"
7324
8813
  }
7325
8814
  ),
7326
- providerConfig.type === "bandit" && /* @__PURE__ */ jsxs9(Box9, { children: [
7327
- /* @__PURE__ */ jsx9(
7328
- TextField5,
8815
+ providerConfig.type === "bandit" && /* @__PURE__ */ jsxs11(Box11, { children: [
8816
+ /* @__PURE__ */ jsx11(
8817
+ TextField6,
7329
8818
  {
7330
8819
  label: "API Base URL",
7331
8820
  value: providerConfig.baseUrl || "",
@@ -7339,8 +8828,8 @@ var ProviderTab = () => {
7339
8828
  helperText: "Defaults to https://api.burtson.ai"
7340
8829
  }
7341
8830
  ),
7342
- /* @__PURE__ */ jsx9(
7343
- TextField5,
8831
+ /* @__PURE__ */ jsx11(
8832
+ TextField6,
7344
8833
  {
7345
8834
  label: "API Key",
7346
8835
  type: "password",
@@ -7354,8 +8843,8 @@ var ProviderTab = () => {
7354
8843
  placeholder: "bai_..."
7355
8844
  }
7356
8845
  ),
7357
- /* @__PURE__ */ jsx9(
7358
- TextField5,
8846
+ /* @__PURE__ */ jsx11(
8847
+ TextField6,
7359
8848
  {
7360
8849
  label: "Default Model ID",
7361
8850
  value: providerConfig.defaultModel || "",
@@ -7369,9 +8858,9 @@ var ProviderTab = () => {
7369
8858
  }
7370
8859
  )
7371
8860
  ] }),
7372
- providerConfig.type === "openai" && /* @__PURE__ */ jsxs9(Box9, { children: [
7373
- /* @__PURE__ */ jsx9(
7374
- TextField5,
8861
+ providerConfig.type === "openai" && /* @__PURE__ */ jsxs11(Box11, { children: [
8862
+ /* @__PURE__ */ jsx11(
8863
+ TextField6,
7375
8864
  {
7376
8865
  label: "API Base URL",
7377
8866
  value: providerConfig.baseUrl || "",
@@ -7384,8 +8873,8 @@ var ProviderTab = () => {
7384
8873
  placeholder: "https://api.openai.com/v1"
7385
8874
  }
7386
8875
  ),
7387
- /* @__PURE__ */ jsx9(
7388
- TextField5,
8876
+ /* @__PURE__ */ jsx11(
8877
+ TextField6,
7389
8878
  {
7390
8879
  label: "API Key",
7391
8880
  type: "password",
@@ -7399,8 +8888,8 @@ var ProviderTab = () => {
7399
8888
  placeholder: "sk-..."
7400
8889
  }
7401
8890
  ),
7402
- /* @__PURE__ */ jsx9(
7403
- TextField5,
8891
+ /* @__PURE__ */ jsx11(
8892
+ TextField6,
7404
8893
  {
7405
8894
  label: "Default Model ID",
7406
8895
  value: providerConfig.defaultModel || "",
@@ -7414,9 +8903,9 @@ var ProviderTab = () => {
7414
8903
  }
7415
8904
  )
7416
8905
  ] }),
7417
- providerConfig.type === "azure-openai" && /* @__PURE__ */ jsxs9(Box9, { children: [
7418
- /* @__PURE__ */ jsx9(
7419
- TextField5,
8906
+ providerConfig.type === "azure-openai" && /* @__PURE__ */ jsxs11(Box11, { children: [
8907
+ /* @__PURE__ */ jsx11(
8908
+ TextField6,
7420
8909
  {
7421
8910
  label: "Azure Endpoint",
7422
8911
  value: providerConfig.baseUrl || "",
@@ -7426,8 +8915,8 @@ var ProviderTab = () => {
7426
8915
  placeholder: "https://your-resource.openai.azure.com"
7427
8916
  }
7428
8917
  ),
7429
- /* @__PURE__ */ jsx9(
7430
- TextField5,
8918
+ /* @__PURE__ */ jsx11(
8919
+ TextField6,
7431
8920
  {
7432
8921
  label: "API Key",
7433
8922
  type: "password",
@@ -7437,8 +8926,8 @@ var ProviderTab = () => {
7437
8926
  sx: { mb: 2 }
7438
8927
  }
7439
8928
  ),
7440
- /* @__PURE__ */ jsx9(
7441
- TextField5,
8929
+ /* @__PURE__ */ jsx11(
8930
+ TextField6,
7442
8931
  {
7443
8932
  label: "API Version",
7444
8933
  value: providerConfig.apiVersion || "",
@@ -7448,8 +8937,8 @@ var ProviderTab = () => {
7448
8937
  placeholder: "2024-02-01"
7449
8938
  }
7450
8939
  ),
7451
- /* @__PURE__ */ jsx9(
7452
- TextField5,
8940
+ /* @__PURE__ */ jsx11(
8941
+ TextField6,
7453
8942
  {
7454
8943
  label: "Deployment Name",
7455
8944
  value: providerConfig.deploymentName || "",
@@ -7459,9 +8948,9 @@ var ProviderTab = () => {
7459
8948
  }
7460
8949
  )
7461
8950
  ] }),
7462
- providerConfig.type === "xai" && /* @__PURE__ */ jsxs9(Box9, { children: [
7463
- /* @__PURE__ */ jsx9(
7464
- TextField5,
8951
+ providerConfig.type === "xai" && /* @__PURE__ */ jsxs11(Box11, { children: [
8952
+ /* @__PURE__ */ jsx11(
8953
+ TextField6,
7465
8954
  {
7466
8955
  label: "API Base URL",
7467
8956
  value: providerConfig.baseUrl || "",
@@ -7474,8 +8963,8 @@ var ProviderTab = () => {
7474
8963
  placeholder: "https://api.x.ai/v1"
7475
8964
  }
7476
8965
  ),
7477
- /* @__PURE__ */ jsx9(
7478
- TextField5,
8966
+ /* @__PURE__ */ jsx11(
8967
+ TextField6,
7479
8968
  {
7480
8969
  label: "API Key",
7481
8970
  type: "password",
@@ -7489,8 +8978,8 @@ var ProviderTab = () => {
7489
8978
  placeholder: "xai-..."
7490
8979
  }
7491
8980
  ),
7492
- /* @__PURE__ */ jsx9(
7493
- TextField5,
8981
+ /* @__PURE__ */ jsx11(
8982
+ TextField6,
7494
8983
  {
7495
8984
  label: "Default Model ID",
7496
8985
  value: providerConfig.defaultModel || "",
@@ -7504,10 +8993,10 @@ var ProviderTab = () => {
7504
8993
  }
7505
8994
  )
7506
8995
  ] }),
7507
- providerConfig.type === "anthropic" && /* @__PURE__ */ jsx9(Alert8, { severity: "warning", sx: { mt: 2 }, children: "Anthropic is only supported through the Bandit Gateway provider. Please switch to Gateway and select Anthropic as the backend service." }),
7508
- /* @__PURE__ */ jsxs9(Box9, { sx: { display: "flex", gap: 2, mt: 3 }, children: [
7509
- /* @__PURE__ */ jsx9(
7510
- Button8,
8996
+ providerConfig.type === "anthropic" && /* @__PURE__ */ jsx11(Alert9, { severity: "warning", sx: { mt: 2 }, children: "Anthropic is only supported through the Bandit Gateway provider. Please switch to Gateway and select Anthropic as the backend service." }),
8997
+ /* @__PURE__ */ jsxs11(Box11, { sx: { display: "flex", gap: 2, mt: 3 }, children: [
8998
+ /* @__PURE__ */ jsx11(
8999
+ Button9,
7511
9000
  {
7512
9001
  variant: "outlined",
7513
9002
  onClick: handleTestProviderConnection,
@@ -7515,8 +9004,8 @@ var ProviderTab = () => {
7515
9004
  children: "Test Connection"
7516
9005
  }
7517
9006
  ),
7518
- /* @__PURE__ */ jsx9(
7519
- Button8,
9007
+ /* @__PURE__ */ jsx11(
9008
+ Button9,
7520
9009
  {
7521
9010
  variant: "contained",
7522
9011
  onClick: handleSaveProviderConfig,
@@ -7527,20 +9016,20 @@ var ProviderTab = () => {
7527
9016
  ] })
7528
9017
  ] })
7529
9018
  ] }),
7530
- /* @__PURE__ */ jsxs9(Paper5, { sx: { p: 3, bgcolor: "info.main", color: "info.contrastText", borderRadius: 2 }, children: [
7531
- /* @__PURE__ */ jsx9(Typography9, { variant: "h6", sx: { mb: 1, fontWeight: 600, color: "text.primary" }, children: "\u{1F680} Gateway Provider Recommended" }),
7532
- /* @__PURE__ */ jsx9(Typography9, { variant: "body2", children: "For production deployments, we recommend using the Gateway provider which routes requests through your secure backend API. This approach keeps API keys secure, enables rate limiting, and provides better monitoring capabilities." })
9019
+ /* @__PURE__ */ jsxs11(Paper5, { sx: { p: 3, bgcolor: "info.main", color: "info.contrastText", borderRadius: 2 }, children: [
9020
+ /* @__PURE__ */ jsx11(Typography10, { variant: "h6", sx: { mb: 1, fontWeight: 600, color: "text.primary" }, children: "\u{1F680} Gateway Provider Recommended" }),
9021
+ /* @__PURE__ */ jsx11(Typography10, { variant: "body2", children: "For production deployments, we recommend using the Gateway provider which routes requests through your secure backend API. This approach keeps API keys secure, enables rate limiting, and provides better monitoring capabilities." })
7533
9022
  ] })
7534
9023
  ] }),
7535
- /* @__PURE__ */ jsx9(
7536
- Snackbar4,
9024
+ /* @__PURE__ */ jsx11(
9025
+ Snackbar5,
7537
9026
  {
7538
9027
  open: showSnackbar,
7539
9028
  autoHideDuration: 6e3,
7540
9029
  onClose: () => setShowSnackbar(false),
7541
9030
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
7542
- children: /* @__PURE__ */ jsx9(
7543
- Alert8,
9031
+ children: /* @__PURE__ */ jsx11(
9032
+ Alert9,
7544
9033
  {
7545
9034
  onClose: () => setShowSnackbar(false),
7546
9035
  severity: snackbarSeverity,
@@ -7555,9 +9044,9 @@ var ProviderTab = () => {
7555
9044
  };
7556
9045
 
7557
9046
  // src/management/components/MCPToolsTabV2.tsx
7558
- import { useEffect as useEffect8, useMemo as useMemo4, useState as useState11 } from "react";
7559
- import { Box as Box10, Typography as Typography10, Paper as Paper6, Chip as Chip8, Stack as Stack4, IconButton as IconButton5, Tooltip as Tooltip2, LinearProgress as LinearProgress4, Switch as Switch3, FormControlLabel as FormControlLabel2 } from "@mui/material";
7560
- import RefreshIcon3 from "@mui/icons-material/Refresh";
9047
+ import { useEffect as useEffect10, useMemo as useMemo5, useState as useState13 } from "react";
9048
+ import { Box as Box12, Typography as Typography11, Paper as Paper6, Chip as Chip9, Stack as Stack5, IconButton as IconButton6, Tooltip as Tooltip3, LinearProgress as LinearProgress5, Switch as Switch3, FormControlLabel as FormControlLabel2 } from "@mui/material";
9049
+ import RefreshIcon4 from "@mui/icons-material/Refresh";
7561
9050
  import HealthAndSafetyIcon from "@mui/icons-material/HealthAndSafety";
7562
9051
  import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
7563
9052
  import SettingsIcon2 from "@mui/icons-material/Settings";
@@ -7571,7 +9060,7 @@ var isPlaygroundMode = () => {
7571
9060
  const gatewayUrl = settings.gatewayApiUrl?.toLowerCase() ?? "";
7572
9061
  return Boolean(settings.playgroundMode || gatewayUrl.startsWith("playground://"));
7573
9062
  };
7574
- function buildUrl(path) {
9063
+ function buildUrl2(path) {
7575
9064
  if (isPlaygroundMode()) {
7576
9065
  debugLogger.info("MCP controller URL build skipped in playground mode", { path });
7577
9066
  return path.startsWith("/") ? path : `/${path}`;
@@ -7594,7 +9083,7 @@ async function fetchAvailableMcpTools() {
7594
9083
  debugLogger.info("Skipping remote MCP tool fetch \u2014 playground mode active");
7595
9084
  return [];
7596
9085
  }
7597
- const url = buildUrl("/mcp/tools");
9086
+ const url = buildUrl2("/mcp/tools");
7598
9087
  try {
7599
9088
  const res = await fetch(url, { headers: authHeaders() });
7600
9089
  const data = await res.json();
@@ -7618,7 +9107,7 @@ async function fetchMcpHealth() {
7618
9107
  availableTools: []
7619
9108
  };
7620
9109
  }
7621
- const url = buildUrl("/mcp/health");
9110
+ const url = buildUrl2("/mcp/health");
7622
9111
  try {
7623
9112
  const res = await fetch(url, { headers: authHeaders() });
7624
9113
  const data = await res.json();
@@ -7633,14 +9122,14 @@ async function fetchMcpHealth() {
7633
9122
  }
7634
9123
 
7635
9124
  // src/management/components/MCPToolsTabV2.tsx
7636
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
9125
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
7637
9126
  var MCPToolsTabV2 = () => {
7638
9127
  const { settings } = usePackageSettingsStore();
7639
9128
  const { tools: localTools, loadTools, toggleTool, addTool, updateTool, isLoaded } = useMCPToolsStore();
7640
- const [loading, setLoading] = useState11(true);
7641
- const [error, setError] = useState11(null);
7642
- const [tools, setTools] = useState11([]);
7643
- const [health, setHealth] = useState11(null);
9129
+ const [loading, setLoading] = useState13(true);
9130
+ const [error, setError] = useState13(null);
9131
+ const [tools, setTools] = useState13([]);
9132
+ const [health, setHealth] = useState13(null);
7644
9133
  const gatewayConfigured = !!settings?.gatewayApiUrl;
7645
9134
  const refresh = async () => {
7646
9135
  setLoading(true);
@@ -7694,7 +9183,7 @@ var MCPToolsTabV2 = () => {
7694
9183
  setLoading(false);
7695
9184
  }
7696
9185
  };
7697
- useEffect8(() => {
9186
+ useEffect10(() => {
7698
9187
  if (isLoaded) {
7699
9188
  refresh();
7700
9189
  } else {
@@ -7703,7 +9192,7 @@ var MCPToolsTabV2 = () => {
7703
9192
  });
7704
9193
  }
7705
9194
  }, [isLoaded]);
7706
- const localEnabledMap = useMemo4(() => {
9195
+ const localEnabledMap = useMemo5(() => {
7707
9196
  const map = /* @__PURE__ */ new Map();
7708
9197
  const sortedTools = [...localTools].sort((a, b) => {
7709
9198
  if (a.isBuiltIn && !b.isBuiltIn) return -1;
@@ -7719,17 +9208,17 @@ var MCPToolsTabV2 = () => {
7719
9208
  });
7720
9209
  return map;
7721
9210
  }, [localTools]);
7722
- return /* @__PURE__ */ jsxs10(Box10, { children: [
7723
- /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
7724
- /* @__PURE__ */ jsx10(Typography10, { variant: "h5", sx: { fontWeight: 600, color: "primary.main" }, children: "Available Tools" }),
7725
- /* @__PURE__ */ jsx10(Box10, { children: /* @__PURE__ */ jsx10(Tooltip2, { title: "Refresh", children: /* @__PURE__ */ jsx10(IconButton5, { onClick: refresh, children: /* @__PURE__ */ jsx10(RefreshIcon3, {}) }) }) })
9211
+ return /* @__PURE__ */ jsxs12(Box12, { children: [
9212
+ /* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
9213
+ /* @__PURE__ */ jsx12(Typography11, { variant: "h5", sx: { fontWeight: 600, color: "primary.main" }, children: "Available Tools" }),
9214
+ /* @__PURE__ */ jsx12(Box12, { children: /* @__PURE__ */ jsx12(Tooltip3, { title: "Refresh", children: /* @__PURE__ */ jsx12(IconButton6, { onClick: refresh, children: /* @__PURE__ */ jsx12(RefreshIcon4, {}) }) }) })
7726
9215
  ] }),
7727
- !gatewayConfigured && /* @__PURE__ */ jsx10(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx10(Typography10, { variant: "body2", color: "text.secondary", children: "Gateway API URL isn\u2019t configured. The controller endpoints will be fetched relative to this origin." }) }),
7728
- /* @__PURE__ */ jsx10(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
7729
- health?.status === "healthy" ? /* @__PURE__ */ jsx10(HealthAndSafetyIcon, { color: "success" }) : health?.status === "unhealthy" ? /* @__PURE__ */ jsx10(ErrorOutlineIcon, { color: "error" }) : /* @__PURE__ */ jsx10(ErrorOutlineIcon, { color: "disabled" }),
7730
- /* @__PURE__ */ jsx10(Typography10, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "Controller Health" }),
7731
- /* @__PURE__ */ jsx10(
7732
- Chip8,
9216
+ !gatewayConfigured && /* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx12(Typography11, { variant: "body2", color: "text.secondary", children: "Gateway API URL isn\u2019t configured. The controller endpoints will be fetched relative to this origin." }) }),
9217
+ /* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
9218
+ health?.status === "healthy" ? /* @__PURE__ */ jsx12(HealthAndSafetyIcon, { color: "success" }) : health?.status === "unhealthy" ? /* @__PURE__ */ jsx12(ErrorOutlineIcon, { color: "error" }) : /* @__PURE__ */ jsx12(ErrorOutlineIcon, { color: "disabled" }),
9219
+ /* @__PURE__ */ jsx12(Typography11, { variant: "subtitle1", sx: { fontWeight: 600 }, children: "Controller Health" }),
9220
+ /* @__PURE__ */ jsx12(
9221
+ Chip9,
7733
9222
  {
7734
9223
  size: "small",
7735
9224
  label: (health?.status || "unknown").toString(),
@@ -7737,11 +9226,11 @@ var MCPToolsTabV2 = () => {
7737
9226
  sx: { ml: 1 }
7738
9227
  }
7739
9228
  ),
7740
- health?.timestamp && /* @__PURE__ */ jsx10(Typography10, { variant: "caption", color: "text.secondary", sx: { ml: 1 }, children: new Date(health.timestamp).toLocaleString() })
9229
+ health?.timestamp && /* @__PURE__ */ jsx12(Typography11, { variant: "caption", color: "text.secondary", sx: { ml: 1 }, children: new Date(health.timestamp).toLocaleString() })
7741
9230
  ] }) }),
7742
- loading && /* @__PURE__ */ jsx10(Box10, { sx: { mb: 2 }, children: /* @__PURE__ */ jsx10(LinearProgress4, {}) }),
7743
- error && /* @__PURE__ */ jsx10(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx10(Typography10, { color: "error", children: error }) }),
7744
- /* @__PURE__ */ jsx10(Stack4, { spacing: 2, children: tools.map((tool) => {
9231
+ loading && /* @__PURE__ */ jsx12(Box12, { sx: { mb: 2 }, children: /* @__PURE__ */ jsx12(LinearProgress5, {}) }),
9232
+ error && /* @__PURE__ */ jsx12(Paper6, { sx: { p: 2, mb: 2 }, children: /* @__PURE__ */ jsx12(Typography11, { color: "error", children: error }) }),
9233
+ /* @__PURE__ */ jsx12(Stack5, { spacing: 2, children: tools.map((tool) => {
7745
9234
  let locallyEnabled = localEnabledMap.get(tool.id);
7746
9235
  if (locallyEnabled === void 0) {
7747
9236
  locallyEnabled = localEnabledMap.get(tool.name);
@@ -7752,17 +9241,17 @@ var MCPToolsTabV2 = () => {
7752
9241
  );
7753
9242
  locallyEnabled = directLookup?.enabled ?? tool.isEnabled;
7754
9243
  }
7755
- return /* @__PURE__ */ jsxs10(Paper6, { sx: { p: 2 }, children: [
7756
- /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
7757
- /* @__PURE__ */ jsxs10(Box10, { children: [
7758
- /* @__PURE__ */ jsx10(Typography10, { variant: "h6", sx: { fontWeight: 700 }, children: tool.name }),
7759
- /* @__PURE__ */ jsx10(Typography10, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: tool.description })
9244
+ return /* @__PURE__ */ jsxs12(Paper6, { sx: { p: 2 }, children: [
9245
+ /* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
9246
+ /* @__PURE__ */ jsxs12(Box12, { children: [
9247
+ /* @__PURE__ */ jsx12(Typography11, { variant: "h6", sx: { fontWeight: 700 }, children: tool.name }),
9248
+ /* @__PURE__ */ jsx12(Typography11, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: tool.description })
7760
9249
  ] }),
7761
- /* @__PURE__ */ jsxs10(Box10, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
7762
- /* @__PURE__ */ jsx10(
9250
+ /* @__PURE__ */ jsxs12(Box12, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
9251
+ /* @__PURE__ */ jsx12(
7763
9252
  FormControlLabel2,
7764
9253
  {
7765
- control: /* @__PURE__ */ jsx10(Switch3, { checked: !!locallyEnabled, onChange: () => {
9254
+ control: /* @__PURE__ */ jsx12(Switch3, { checked: !!locallyEnabled, onChange: () => {
7766
9255
  let local = localTools.find((t) => t.function.name === tool.id);
7767
9256
  if (!local) {
7768
9257
  local = localTools.find((t) => t.function.name === tool.name);
@@ -7782,12 +9271,12 @@ var MCPToolsTabV2 = () => {
7782
9271
  label: locallyEnabled ? "Enabled" : "Disabled"
7783
9272
  }
7784
9273
  ),
7785
- /* @__PURE__ */ jsx10(Tooltip2, { title: "Controller-driven tools (read-only schema)", children: /* @__PURE__ */ jsx10(SettingsIcon2, { color: "disabled" }) })
9274
+ /* @__PURE__ */ jsx12(Tooltip3, { title: "Controller-driven tools (read-only schema)", children: /* @__PURE__ */ jsx12(SettingsIcon2, { color: "disabled" }) })
7786
9275
  ] })
7787
9276
  ] }),
7788
- !!tool.supportedParameters?.length && /* @__PURE__ */ jsxs10(Box10, { sx: { mt: 1.5 }, children: [
7789
- /* @__PURE__ */ jsx10(Typography10, { variant: "caption", color: "text.secondary", children: "Supported parameters" }),
7790
- /* @__PURE__ */ jsx10(Box10, { sx: { mt: 0.5, display: "flex", flexWrap: "wrap", gap: 1 }, children: tool.supportedParameters.map((p) => /* @__PURE__ */ jsx10(Chip8, { size: "small", label: p }, p)) })
9277
+ !!tool.supportedParameters?.length && /* @__PURE__ */ jsxs12(Box12, { sx: { mt: 1.5 }, children: [
9278
+ /* @__PURE__ */ jsx12(Typography11, { variant: "caption", color: "text.secondary", children: "Supported parameters" }),
9279
+ /* @__PURE__ */ jsx12(Box12, { sx: { mt: 0.5, display: "flex", flexWrap: "wrap", gap: 1 }, children: tool.supportedParameters.map((p) => /* @__PURE__ */ jsx12(Chip9, { size: "small", label: p }, p)) })
7791
9280
  ] })
7792
9281
  ] }, tool.id);
7793
9282
  }) })
@@ -7796,13 +9285,20 @@ var MCPToolsTabV2 = () => {
7796
9285
  var MCPToolsTabV2_default = MCPToolsTabV2;
7797
9286
 
7798
9287
  // src/management/management.tsx
7799
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
7800
- var preloadChatPage = () => import("./chat-7U633EWN.mjs");
9288
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
9289
+ var preloadChatPage = () => import("./chat-CQWZOJH4.mjs");
9290
+ var buildCapabilitiesUrl = (gatewayApiUrl) => {
9291
+ const trimmed = gatewayApiUrl.replace(/\/$/, "");
9292
+ if (trimmed.endsWith("/api")) {
9293
+ return `${trimmed}/capabilities`;
9294
+ }
9295
+ return `${trimmed}/api/capabilities`;
9296
+ };
7801
9297
  var Management = () => {
7802
9298
  const navigate = useNavigate();
7803
9299
  const notificationService = useNotificationService();
7804
- const isMobile = useMediaQuery6("(max-width:900px)");
7805
- const [sidebarOpen, setSidebarOpen] = useState12(false);
9300
+ const isMobile = useMediaQuery7("(max-width:900px)");
9301
+ const [sidebarOpen, setSidebarOpen] = useState14(false);
7806
9302
  const getOptimalFabLogo = async () => {
7807
9303
  const banditHead2 = "https://cdn.burtson.ai/images/bandit-head.png";
7808
9304
  try {
@@ -7842,16 +9338,16 @@ var Management = () => {
7842
9338
  hasTransparentLogo,
7843
9339
  setHasTransparentLogo
7844
9340
  } = useModelStore();
7845
- const [modalOpen, setModalOpen] = useState12(false);
9341
+ const [modalOpen, setModalOpen] = useState14(false);
7846
9342
  const banditHead = "https://cdn.burtson.ai/images/bandit-head.png";
7847
- const [fabLogo, setFabLogo] = useState12(banditHead);
7848
- const [tabIndex, setTabIndex] = useState12(0);
7849
- const [logoFile, setLogoFile] = useState12(null);
7850
- const [logoBase64, setLogoBase64] = useState12(null);
7851
- const [brandingText, setBrandingText] = useState12("");
7852
- const [theme, setTheme] = useState12("bandit-dark");
7853
- const [customAvatarBase64, setCustomAvatarBase64] = useState12(null);
7854
- const [presetAvatar, setPresetAvatar] = useState12(null);
9343
+ const [fabLogo, setFabLogo] = useState14(banditHead);
9344
+ const [tabIndex, setTabIndex] = useState14(0);
9345
+ const [logoFile, setLogoFile] = useState14(null);
9346
+ const [logoBase64, setLogoBase64] = useState14(null);
9347
+ const [brandingText, setBrandingText] = useState14("");
9348
+ const [theme, setTheme] = useState14("bandit-dark");
9349
+ const [customAvatarBase64, setCustomAvatarBase64] = useState14(null);
9350
+ const [presetAvatar, setPresetAvatar] = useState14(null);
7855
9351
  const showSnackbarMessage = (message, severity = "success") => {
7856
9352
  if (severity === "success") {
7857
9353
  notificationService?.showSuccess(message);
@@ -7859,16 +9355,18 @@ var Management = () => {
7859
9355
  notificationService?.showError(message);
7860
9356
  }
7861
9357
  };
7862
- const [restoreDialogOpen, setRestoreDialogOpen] = useState12(false);
7863
- const [brandingLoaded, setBrandingLoaded] = useState12(false);
7864
- const [isLoadingBranding, setIsLoadingBranding] = useState12(false);
9358
+ const [restoreDialogOpen, setRestoreDialogOpen] = useState14(false);
9359
+ const [brandingLoaded, setBrandingLoaded] = useState14(false);
9360
+ const [isLoadingBranding, setIsLoadingBranding] = useState14(false);
7865
9361
  const { initModels } = useModelStore();
7866
9362
  const { settings: packageSettings } = usePackageSettingsStore();
9363
+ const authToken = useAuthenticationStore((state) => state.token);
7867
9364
  const { preferences, updatePreference } = usePreferencesStore();
7868
9365
  const { hasAdminDashboard, hasLimitedAdminDashboard, getCurrentTier, hasAdvancedSearch } = useFeatures();
7869
9366
  const { showAdminPanel, showLimitedAdminPanel } = useFeatureVisibility();
7870
9367
  const { provider: currentProvider, config: currentProviderConfig } = useAIProviderStore();
7871
- const [localSelectedModel, setLocalSelectedModel] = useState12({
9368
+ const [seedPacksEnabled, setSeedPacksEnabled] = useState14(false);
9369
+ const [localSelectedModel, setLocalSelectedModel] = useState14({
7872
9370
  name: "",
7873
9371
  tagline: "",
7874
9372
  systemPrompt: "",
@@ -7881,7 +9379,7 @@ var Management = () => {
7881
9379
  loadDocuments,
7882
9380
  clearAllDocuments
7883
9381
  } = useKnowledgeStore();
7884
- useEffect9(() => {
9382
+ useEffect11(() => {
7885
9383
  if (selectedModel) {
7886
9384
  const selected = availableModels.find((m) => m.name === selectedModel);
7887
9385
  if (selected) {
@@ -7905,7 +9403,7 @@ var Management = () => {
7905
9403
  }
7906
9404
  }
7907
9405
  }, [selectedModel, availableModels]);
7908
- const loadBrandingConfig = useCallback7(async () => {
9406
+ const loadBrandingConfig = useCallback8(async () => {
7909
9407
  if (isLoadingBranding || brandingLoaded) {
7910
9408
  debugLogger.warn("Branding loading already in progress or completed, skipping");
7911
9409
  return;
@@ -8020,15 +9518,15 @@ var Management = () => {
8020
9518
  setTagline,
8021
9519
  setTheme
8022
9520
  ]);
8023
- useEffect9(() => {
9521
+ useEffect11(() => {
8024
9522
  void loadBrandingConfig();
8025
9523
  }, [loadBrandingConfig]);
8026
9524
  const handleOpenModal = () => setModalOpen(true);
8027
9525
  const handleCloseModal = () => setModalOpen(false);
8028
- useEffect9(() => {
9526
+ useEffect11(() => {
8029
9527
  getOptimalFabLogo().then(setFabLogo);
8030
9528
  }, []);
8031
- useEffect9(() => {
9529
+ useEffect11(() => {
8032
9530
  if (logoBase64) {
8033
9531
  setFabLogo(logoBase64);
8034
9532
  } else {
@@ -8083,6 +9581,7 @@ var Management = () => {
8083
9581
  name: modelToSave.name,
8084
9582
  tagline: modelToSave.tagline,
8085
9583
  systemPrompt: modelToSave.systemPrompt,
9584
+ avatarBase64: modelToSave.avatarBase64 || void 0,
8086
9585
  selectedModel: modelToSave.name
8087
9586
  }
8088
9587
  };
@@ -8135,6 +9634,19 @@ var Management = () => {
8135
9634
  try {
8136
9635
  const storeConfigs = [{ name: "config", keyPath: "id" }];
8137
9636
  debugLogger.info("Saving branding data to IndexedDB");
9637
+ let finalHasTransparentLogo = hasTransparentLogo;
9638
+ if (logoBase64) {
9639
+ try {
9640
+ const detected = await detectTransparency(logoBase64);
9641
+ const isPng = logoBase64.startsWith("data:image/png");
9642
+ finalHasTransparentLogo = detected || isPng;
9643
+ debugLogger.debug("SaveBranding transparency check", { detected, isPng, finalHasTransparentLogo });
9644
+ } catch (err) {
9645
+ const isPng = logoBase64.startsWith("data:image/png");
9646
+ finalHasTransparentLogo = finalHasTransparentLogo ?? isPng ?? true;
9647
+ debugLogger.warn("SaveBranding transparency check failed, using fallback", { error: err, finalHasTransparentLogo });
9648
+ }
9649
+ }
8138
9650
  const current = await indexedDBService_default.get(
8139
9651
  "banditConfig",
8140
9652
  1,
@@ -8150,7 +9662,7 @@ var Management = () => {
8150
9662
  logoBase64,
8151
9663
  brandingText,
8152
9664
  theme,
8153
- hasTransparentLogo,
9665
+ hasTransparentLogo: finalHasTransparentLogo,
8154
9666
  userSaved: true
8155
9667
  // Mark as user-saved to protect from CDN overrides
8156
9668
  }
@@ -8189,9 +9701,11 @@ var Management = () => {
8189
9701
  setLogoBase64(base64);
8190
9702
  debugLogger.debug("Starting transparency detection for uploaded image");
8191
9703
  try {
9704
+ const isPng = base64.startsWith("data:image/png");
8192
9705
  const isTransparent = await detectTransparency(base64);
8193
- setHasTransparentLogo(isTransparent);
8194
- debugLogger.debug("Transparency detection result saved", { isTransparent });
9706
+ const finalTransparent = isTransparent || isPng;
9707
+ setHasTransparentLogo(finalTransparent);
9708
+ debugLogger.debug("Transparency detection result saved", { isTransparent, finalTransparent });
8195
9709
  } catch (err) {
8196
9710
  debugLogger.error("Failed to detect transparency", { error: err });
8197
9711
  }
@@ -8404,7 +9918,8 @@ var Management = () => {
8404
9918
  name: modelName2,
8405
9919
  tagline: typeof parsedModel.tagline === "string" ? parsedModel.tagline : void 0,
8406
9920
  systemPrompt: typeof parsedModel.systemPrompt === "string" ? parsedModel.systemPrompt : void 0,
8407
- selectedModel: typeof parsedModel.selectedModel === "string" ? parsedModel.selectedModel : void 0
9921
+ selectedModel: typeof parsedModel.selectedModel === "string" ? parsedModel.selectedModel : void 0,
9922
+ avatarBase64: typeof parsedModel.avatarBase64 === "string" ? parsedModel.avatarBase64 : parsedModel.avatarBase64 === null ? void 0 : void 0
8408
9923
  };
8409
9924
  const entry = {
8410
9925
  id: modelName2,
@@ -8412,7 +9927,8 @@ var Management = () => {
8412
9927
  name: modelName2,
8413
9928
  tagline: sanitizedModel.tagline,
8414
9929
  systemPrompt: sanitizedModel.systemPrompt,
8415
- avatarBase64: typeof parsedModel.avatarBase64 === "string" ? parsedModel.avatarBase64 : void 0
9930
+ // Normalize to match StoredBanditConfigRecord (string | undefined)
9931
+ avatarBase64: sanitizedModel.avatarBase64 ?? void 0
8416
9932
  };
8417
9933
  await indexedDBService_default.put("banditConfig", 1, "config", entry, storeConfigs);
8418
9934
  }
@@ -8457,7 +9973,7 @@ var Management = () => {
8457
9973
  reader.readAsText(file);
8458
9974
  }
8459
9975
  };
8460
- useEffect9(() => {
9976
+ useEffect11(() => {
8461
9977
  if (localSelectedModel.selectedModel && !availableModels.some((m) => m.name === localSelectedModel.selectedModel)) {
8462
9978
  setLocalSelectedModel((prev) => ({
8463
9979
  ...prev,
@@ -8465,51 +9981,120 @@ var Management = () => {
8465
9981
  }));
8466
9982
  }
8467
9983
  }, [availableModels, localSelectedModel.selectedModel]);
8468
- useEffect9(() => {
9984
+ useEffect11(() => {
8469
9985
  loadDocuments();
8470
9986
  }, [loadDocuments]);
8471
- const currentTheme = predefinedThemes[theme] || banditDarkTheme;
9987
+ useEffect11(() => {
9988
+ const gatewayApiUrl = packageSettings?.gatewayApiUrl;
9989
+ if (!gatewayApiUrl || gatewayApiUrl.toLowerCase().startsWith("playground://")) {
9990
+ setSeedPacksEnabled(false);
9991
+ return;
9992
+ }
9993
+ let isActive = true;
9994
+ const loadCapabilities = async () => {
9995
+ try {
9996
+ const token = authToken ?? authenticationService.getToken();
9997
+ const headers = {
9998
+ "Content-Type": "application/json"
9999
+ };
10000
+ if (token) {
10001
+ headers.Authorization = `Bearer ${token}`;
10002
+ }
10003
+ const response = await fetch(buildCapabilitiesUrl(gatewayApiUrl), {
10004
+ method: "GET",
10005
+ headers
10006
+ });
10007
+ if (!response.ok) {
10008
+ throw new Error(`Capabilities request failed: ${response.status}`);
10009
+ }
10010
+ const payload = await response.json();
10011
+ if (!isActive) {
10012
+ return;
10013
+ }
10014
+ setSeedPacksEnabled(Boolean(payload?.seedPacksEnabled));
10015
+ } catch (error) {
10016
+ if (!isActive) {
10017
+ return;
10018
+ }
10019
+ setSeedPacksEnabled(false);
10020
+ debugLogger.warn("Management: failed to load capabilities", {
10021
+ error: error instanceof Error ? error.message : String(error)
10022
+ });
10023
+ }
10024
+ };
10025
+ loadCapabilities();
10026
+ return () => {
10027
+ isActive = false;
10028
+ };
10029
+ }, [packageSettings?.gatewayApiUrl, authToken]);
10030
+ const currentTheme = useMemo6(() => {
10031
+ const baseTheme = predefinedThemes[theme] || banditDarkTheme;
10032
+ return createTheme(baseTheme, {
10033
+ components: {
10034
+ MuiInputBase: {
10035
+ styleOverrides: {
10036
+ input: {
10037
+ outline: "none",
10038
+ boxShadow: "none",
10039
+ "&:focus, &:focus-visible": {
10040
+ outline: "none",
10041
+ boxShadow: "none"
10042
+ }
10043
+ },
10044
+ inputMultiline: {
10045
+ outline: "none",
10046
+ boxShadow: "none",
10047
+ "&:focus, &:focus-visible": {
10048
+ outline: "none",
10049
+ boxShadow: "none"
10050
+ }
10051
+ }
10052
+ }
10053
+ }
10054
+ }
10055
+ });
10056
+ }, [theme]);
8472
10057
  if (!brandingLoaded) return null;
8473
10058
  const allNavTabs = [
8474
10059
  {
8475
10060
  label: "Personalities",
8476
- icon: /* @__PURE__ */ jsx11(FaceRetouchingNaturalIcon, {}),
10061
+ icon: /* @__PURE__ */ jsx13(FaceRetouchingNaturalIcon, {}),
8477
10062
  requiresFeature: "limitedAdminDashboard"
8478
10063
  // Available to premium+
8479
10064
  },
8480
10065
  {
8481
10066
  label: "Branding",
8482
- icon: /* @__PURE__ */ jsx11(BrushIcon, {}),
10067
+ icon: /* @__PURE__ */ jsx13(BrushIcon, {}),
8483
10068
  requiresFeature: "limitedAdminDashboard"
8484
10069
  // Available to premium+
8485
10070
  },
8486
10071
  {
8487
10072
  label: "Knowledge",
8488
- icon: /* @__PURE__ */ jsx11(MenuBookIcon, {}),
10073
+ icon: /* @__PURE__ */ jsx13(MenuBookIcon, {}),
8489
10074
  requiresFeature: "limitedAdminDashboard"
8490
10075
  // Available to premium+
8491
10076
  },
8492
10077
  {
8493
10078
  label: "Storage",
8494
- icon: /* @__PURE__ */ jsx11(StorageIcon2, {}),
10079
+ icon: /* @__PURE__ */ jsx13(StorageIcon2, {}),
8495
10080
  requiresFeature: "limitedAdminDashboard"
8496
10081
  // Available to premium+ (changed from adminDashboardEnabled)
8497
10082
  },
8498
10083
  {
8499
10084
  label: "Preferences",
8500
- icon: /* @__PURE__ */ jsx11(TuneIcon, {}),
10085
+ icon: /* @__PURE__ */ jsx13(TuneIcon, {}),
8501
10086
  requiresFeature: "limitedAdminDashboard"
8502
10087
  // Available to premium+
8503
10088
  },
8504
10089
  {
8505
10090
  label: "Provider",
8506
- icon: /* @__PURE__ */ jsx11(CloudIcon, {}),
10091
+ icon: /* @__PURE__ */ jsx13(CloudIcon, {}),
8507
10092
  requiresFeature: "advancedSearch"
8508
10093
  // Pro/Team users with advanced features
8509
10094
  },
8510
10095
  {
8511
10096
  label: "MCP Tools",
8512
- icon: /* @__PURE__ */ jsx11(BuildIcon, {}),
10097
+ icon: /* @__PURE__ */ jsx13(BuildIcon, {}),
8513
10098
  requiresFeature: "advancedSearch"
8514
10099
  // Pro/Team users with advanced features
8515
10100
  }
@@ -8526,8 +10111,8 @@ var Management = () => {
8526
10111
  }
8527
10112
  return true;
8528
10113
  });
8529
- const navigationContent = /* @__PURE__ */ jsxs11(
8530
- Box11,
10114
+ const navigationContent = /* @__PURE__ */ jsxs13(
10115
+ Box13,
8531
10116
  {
8532
10117
  sx: {
8533
10118
  display: "flex",
@@ -8537,8 +10122,8 @@ var Management = () => {
8537
10122
  bgcolor: "inherit"
8538
10123
  },
8539
10124
  children: [
8540
- isMobile && /* @__PURE__ */ jsx11(
8541
- Box11,
10125
+ isMobile && /* @__PURE__ */ jsx13(
10126
+ Box13,
8542
10127
  {
8543
10128
  sx: {
8544
10129
  height: 6,
@@ -8551,15 +10136,15 @@ var Management = () => {
8551
10136
  }
8552
10137
  }
8553
10138
  ),
8554
- /* @__PURE__ */ jsx11(Box11, { sx: { p: isMobile ? 2.5 : 3, pb: isMobile ? 1.5 : 2 }, children: /* @__PURE__ */ jsx11(
8555
- Button9,
10139
+ /* @__PURE__ */ jsx13(Box13, { sx: { p: isMobile ? 2.5 : 3, pb: isMobile ? 1.5 : 2 }, children: /* @__PURE__ */ jsx13(
10140
+ Button10,
8556
10141
  {
8557
10142
  onClick: () => {
8558
10143
  if (isMobile) setSidebarOpen(false);
8559
10144
  navigate("/chat");
8560
10145
  },
8561
10146
  onMouseEnter: preloadChatPage,
8562
- startIcon: /* @__PURE__ */ jsx11(ChevronLeftIcon, { sx: { fontSize: 20 } }),
10147
+ startIcon: /* @__PURE__ */ jsx13(ChevronLeftIcon, { sx: { fontSize: 20 } }),
8563
10148
  fullWidth: true,
8564
10149
  variant: "outlined",
8565
10150
  sx: {
@@ -8586,9 +10171,9 @@ var Management = () => {
8586
10171
  children: "Back to Chat"
8587
10172
  }
8588
10173
  ) }),
8589
- /* @__PURE__ */ jsx11(Divider, { sx: { mx: isMobile ? 2 : 3, mb: 2, opacity: 0.6 } }),
8590
- /* @__PURE__ */ jsx11(Box11, { sx: { flex: 1, px: isMobile ? 1.5 : 2, pb: 3, overflowY: "auto" }, children: /* @__PURE__ */ jsx11(List2, { sx: { px: 0, py: 0 }, children: navTabs.map((tab, idx) => /* @__PURE__ */ jsxs11(
8591
- ListItemButton,
10174
+ /* @__PURE__ */ jsx13(Divider2, { sx: { mx: isMobile ? 2 : 3, mb: 2, opacity: 0.6 } }),
10175
+ /* @__PURE__ */ jsx13(Box13, { sx: { flex: 1, px: isMobile ? 1.5 : 2, pb: 3, overflowY: "auto" }, children: /* @__PURE__ */ jsx13(List3, { sx: { px: 0, py: 0 }, children: navTabs.map((tab, idx) => /* @__PURE__ */ jsxs13(
10176
+ ListItemButton2,
8592
10177
  {
8593
10178
  selected: tabIndex === idx,
8594
10179
  onClick: () => {
@@ -8637,7 +10222,7 @@ var Management = () => {
8637
10222
  }
8638
10223
  },
8639
10224
  children: [
8640
- /* @__PURE__ */ jsx11(
10225
+ /* @__PURE__ */ jsx13(
8641
10226
  ListItemIcon2,
8642
10227
  {
8643
10228
  sx: {
@@ -8648,7 +10233,7 @@ var Management = () => {
8648
10233
  children: tab.icon
8649
10234
  }
8650
10235
  ),
8651
- /* @__PURE__ */ jsx11(
10236
+ /* @__PURE__ */ jsx13(
8652
10237
  ListItemText2,
8653
10238
  {
8654
10239
  primary: tab.label,
@@ -8659,8 +10244,8 @@ var Management = () => {
8659
10244
  }
8660
10245
  }
8661
10246
  ),
8662
- tabIndex === idx && /* @__PURE__ */ jsx11(
8663
- Box11,
10247
+ tabIndex === idx && /* @__PURE__ */ jsx13(
10248
+ Box13,
8664
10249
  {
8665
10250
  sx: {
8666
10251
  position: "absolute",
@@ -8682,10 +10267,10 @@ var Management = () => {
8682
10267
  ]
8683
10268
  }
8684
10269
  );
8685
- return /* @__PURE__ */ jsxs11(ThemeProvider, { theme: currentTheme, children: [
8686
- /* @__PURE__ */ jsx11(CssBaseline, {}),
8687
- /* @__PURE__ */ jsxs11(
8688
- Box11,
10270
+ return /* @__PURE__ */ jsxs13(ThemeProvider, { theme: currentTheme, children: [
10271
+ /* @__PURE__ */ jsx13(CssBaseline, {}),
10272
+ /* @__PURE__ */ jsxs13(
10273
+ Box13,
8689
10274
  {
8690
10275
  display: "flex",
8691
10276
  height: "100vh",
@@ -8697,8 +10282,8 @@ var Management = () => {
8697
10282
  position: "relative"
8698
10283
  },
8699
10284
  children: [
8700
- isMobile && /* @__PURE__ */ jsxs11(
8701
- Box11,
10285
+ isMobile && /* @__PURE__ */ jsxs13(
10286
+ Box13,
8702
10287
  {
8703
10288
  sx: {
8704
10289
  width: "100%",
@@ -8717,8 +10302,8 @@ var Management = () => {
8717
10302
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
8718
10303
  },
8719
10304
  children: [
8720
- /* @__PURE__ */ jsx11(
8721
- Button9,
10305
+ /* @__PURE__ */ jsx13(
10306
+ Button10,
8722
10307
  {
8723
10308
  onClick: () => setSidebarOpen((o) => !o),
8724
10309
  sx: {
@@ -8739,7 +10324,7 @@ var Management = () => {
8739
10324
  transform: sidebarOpen ? "rotate(90deg) scale(0.95)" : "scale(0.95)"
8740
10325
  }
8741
10326
  },
8742
- children: /* @__PURE__ */ jsx11("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx11(
10327
+ children: /* @__PURE__ */ jsx13("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx13(
8743
10328
  "path",
8744
10329
  {
8745
10330
  d: sidebarOpen ? "M18 6L6 18M6 6L18 18" : "M3 12H21M3 6H21M3 18H21",
@@ -8751,8 +10336,8 @@ var Management = () => {
8751
10336
  ) })
8752
10337
  }
8753
10338
  ),
8754
- /* @__PURE__ */ jsx11(
8755
- Typography11,
10339
+ /* @__PURE__ */ jsx13(
10340
+ Typography12,
8756
10341
  {
8757
10342
  variant: "h6",
8758
10343
  sx: {
@@ -8764,14 +10349,14 @@ var Management = () => {
8764
10349
  children: "Management"
8765
10350
  }
8766
10351
  ),
8767
- /* @__PURE__ */ jsx11(Box11, { sx: {
10352
+ /* @__PURE__ */ jsx13(Box13, { sx: {
8768
10353
  px: 2,
8769
10354
  py: 0.5,
8770
10355
  borderRadius: 2,
8771
10356
  bgcolor: (theme2) => theme2.palette.mode === "dark" ? "rgba(25,118,210,0.12)" : "rgba(25,118,210,0.08)",
8772
10357
  border: (theme2) => `1px solid ${theme2.palette.primary.main}20`
8773
- }, children: /* @__PURE__ */ jsx11(
8774
- Typography11,
10358
+ }, children: /* @__PURE__ */ jsx13(
10359
+ Typography12,
8775
10360
  {
8776
10361
  variant: "caption",
8777
10362
  sx: {
@@ -8785,7 +10370,7 @@ var Management = () => {
8785
10370
  ]
8786
10371
  }
8787
10372
  ),
8788
- isMobile ? /* @__PURE__ */ jsx11(
10373
+ isMobile ? /* @__PURE__ */ jsx13(
8789
10374
  SwipeableDrawer,
8790
10375
  {
8791
10376
  anchor: "bottom",
@@ -8806,8 +10391,8 @@ var Management = () => {
8806
10391
  },
8807
10392
  children: navigationContent
8808
10393
  }
8809
- ) : /* @__PURE__ */ jsx11(
8810
- Box11,
10394
+ ) : /* @__PURE__ */ jsx13(
10395
+ Box13,
8811
10396
  {
8812
10397
  sx: {
8813
10398
  width: 280,
@@ -8830,8 +10415,8 @@ var Management = () => {
8830
10415
  children: navigationContent
8831
10416
  }
8832
10417
  ),
8833
- /* @__PURE__ */ jsxs11(
8834
- Box11,
10418
+ /* @__PURE__ */ jsxs13(
10419
+ Box13,
8835
10420
  {
8836
10421
  sx: {
8837
10422
  flex: 1,
@@ -8859,7 +10444,7 @@ var Management = () => {
8859
10444
  // IE and Edge
8860
10445
  },
8861
10446
  children: [
8862
- navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ jsx11(
10447
+ navTabs[tabIndex]?.label === "Personalities" && /* @__PURE__ */ jsx13(
8863
10448
  PersonalitiesTab_default,
8864
10449
  {
8865
10450
  availableModels,
@@ -8878,7 +10463,7 @@ var Management = () => {
8878
10463
  showSnackbar: showSnackbarMessage
8879
10464
  }
8880
10465
  ),
8881
- navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ jsx11(
10466
+ navTabs[tabIndex]?.label === "Branding" && /* @__PURE__ */ jsx13(
8882
10467
  BrandingTab_default,
8883
10468
  {
8884
10469
  logoFile,
@@ -8897,8 +10482,8 @@ var Management = () => {
8897
10482
  setLogoBase64
8898
10483
  }
8899
10484
  ),
8900
- navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ jsx11(
8901
- KnowledgeTab_default,
10485
+ navTabs[tabIndex]?.label === "Knowledge" && /* @__PURE__ */ jsx13(
10486
+ KnowledgeHubTab_default,
8902
10487
  {
8903
10488
  documents,
8904
10489
  addDocuments,
@@ -8906,11 +10491,12 @@ var Management = () => {
8906
10491
  loadDocuments,
8907
10492
  clearAllDocuments,
8908
10493
  currentTheme,
8909
- isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard()
10494
+ isLimitedAdmin: hasLimitedAdminDashboard() && !hasAdminDashboard(),
10495
+ seedPacksEnabled
8910
10496
  }
8911
10497
  ),
8912
- navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ jsx11(StorageTab_default, { currentTheme }),
8913
- navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ jsx11(
10498
+ navTabs[tabIndex]?.label === "Storage" && /* @__PURE__ */ jsx13(StorageTab_default, { currentTheme }),
10499
+ navTabs[tabIndex]?.label === "Preferences" && /* @__PURE__ */ jsx13(
8914
10500
  PreferencesTab_default,
8915
10501
  {
8916
10502
  preferences,
@@ -8920,12 +10506,12 @@ var Management = () => {
8920
10506
  showSnackbar: showSnackbarMessage
8921
10507
  }
8922
10508
  ),
8923
- navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ jsx11(ProviderTab, {}),
8924
- navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ jsx11(MCPToolsTabV2_default, {})
10509
+ navTabs[tabIndex]?.label === "Provider" && /* @__PURE__ */ jsx13(ProviderTab, {}),
10510
+ navTabs[tabIndex]?.label === "MCP Tools" && /* @__PURE__ */ jsx13(MCPToolsTabV2_default, {})
8925
10511
  ]
8926
10512
  }
8927
10513
  ),
8928
- /* @__PURE__ */ jsx11(
10514
+ /* @__PURE__ */ jsx13(
8929
10515
  Fab,
8930
10516
  {
8931
10517
  "aria-label": "AI",
@@ -8947,7 +10533,7 @@ var Management = () => {
8947
10533
  boxShadow: theme2.shadows[6],
8948
10534
  zIndex: 2e3
8949
10535
  }),
8950
- children: /* @__PURE__ */ jsx11(
10536
+ children: /* @__PURE__ */ jsx13(
8951
10537
  "img",
8952
10538
  {
8953
10539
  src: fabLogo,
@@ -8961,7 +10547,7 @@ var Management = () => {
8961
10547
  )
8962
10548
  }
8963
10549
  ),
8964
- /* @__PURE__ */ jsx11(chat_modal_default, { open: modalOpen, onClose: handleCloseModal })
10550
+ /* @__PURE__ */ jsx13(chat_modal_default, { open: modalOpen, onClose: handleCloseModal })
8965
10551
  ]
8966
10552
  }
8967
10553
  )
@@ -8975,4 +10561,4 @@ export {
8975
10561
  useGatewayMemory,
8976
10562
  management_default
8977
10563
  };
8978
- //# sourceMappingURL=chunk-JRGCRBWE.mjs.map
10564
+ //# sourceMappingURL=chunk-ZTTGERUG.mjs.map