@cuekit-ai/react 1.6.8 → 1.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  getRoom,
24
24
  getRoomName,
25
25
  onStateChange,
26
+ registerWebRTCCallbacks,
26
27
  resolveRoutePath,
27
28
  sendData,
28
29
  sendRuntimeData,
@@ -34,10 +35,10 @@ import {
34
35
  setAudioContainer,
35
36
  setNavigationHandler,
36
37
  setServerUrl,
37
- setWebRTCCallbacks,
38
38
  setWebRTCConfig,
39
+ unregisterWebRTCCallbacks,
39
40
  validateDynamicElements
40
- } from "./chunk-ZP7AXODE.mjs";
41
+ } from "./chunk-XVA5MZMJ.mjs";
41
42
 
42
43
  // node_modules/inline-style-parser/index.js
43
44
  var require_inline_style_parser = __commonJS({
@@ -1183,45 +1184,6 @@ function InitCuekit(config) {
1183
1184
  setWebRTCConfig(webRTCConfig);
1184
1185
  }
1185
1186
 
1186
- // src/utils/webrtc-config.ts
1187
- var configureWebRTCServer = (config) => {
1188
- if (!config.apiKey) {
1189
- throw new Error("API key is required for WebRTC configuration");
1190
- }
1191
- const finalConfig = {
1192
- serverUrl: WEBRTC_BACKEND_SERVER_URL,
1193
- apiKey: config.apiKey,
1194
- roomName: config.roomName,
1195
- participantName: config.participantName,
1196
- tokenTtlSeconds: config.tokenTtlSeconds
1197
- };
1198
- setServerUrl(finalConfig.serverUrl);
1199
- if (typeof window !== "undefined") {
1200
- ;
1201
- window.CuekitWebRTCConfig = finalConfig;
1202
- }
1203
- };
1204
- var getWebRTCServerConfig = () => {
1205
- if (typeof window !== "undefined") {
1206
- return window.CuekitWebRTCConfig || null;
1207
- }
1208
- return null;
1209
- };
1210
- var initWebRTCWithDeployedBackend = (apiKey, customConfig) => {
1211
- const config = {
1212
- serverUrl: WEBRTC_BACKEND_SERVER_URL,
1213
- apiKey,
1214
- roomName: customConfig?.roomName || "default-room",
1215
- participantName: customConfig?.participantName || "user",
1216
- tokenTtlSeconds: customConfig?.tokenTtlSeconds || 7200
1217
- };
1218
- configureWebRTCServer(config);
1219
- return config;
1220
- };
1221
- var initWebRTC = (apiKey) => {
1222
- return initWebRTCWithDeployedBackend(apiKey);
1223
- };
1224
-
1225
1187
  // src/utils/colors.ts
1226
1188
  function hexToHSL(hex) {
1227
1189
  hex = hex.replace(/^#/, "");
@@ -1261,6 +1223,94 @@ function hexToHSL(hex) {
1261
1223
  };
1262
1224
  }
1263
1225
 
1226
+ // src/utils/theme.ts
1227
+ var generateThemeStyles = (theme, currentTheme = "dark") => {
1228
+ if (!theme) return {};
1229
+ const colors = currentTheme === "light" ? theme.light : theme.dark;
1230
+ if (!colors) return {};
1231
+ const mapping = {
1232
+ primary: "--voice-accent",
1233
+ statusBg: "--voice-status-bg",
1234
+ statusText: "--voice-status-text",
1235
+ background: "--voice-bg",
1236
+ surface: "--voice-surface",
1237
+ border: "--voice-border",
1238
+ text: "--voice-text",
1239
+ textMuted: "--voice-text-muted",
1240
+ userBubble: "--voice-user-bubble",
1241
+ userText: "--voice-user-text",
1242
+ aiBubble: "--voice-ai-bubble",
1243
+ aiText: "--voice-ai-text"
1244
+ };
1245
+ const styles = {};
1246
+ Object.entries(colors).forEach(([key, value]) => {
1247
+ const varName = mapping[key];
1248
+ if (varName && value) {
1249
+ const hsl = hexToHSL(value);
1250
+ if (hsl) {
1251
+ styles[varName] = hsl.toString();
1252
+ if (key === "primary") {
1253
+ const indicatorHsl = colors.indicator ? hexToHSL(colors.indicator) : hsl;
1254
+ styles["--indicator-bg"] = indicatorHsl ? indicatorHsl.toString() : hsl.toString();
1255
+ const vibrantHsl = colors.primaryVibrant ? hexToHSL(colors.primaryVibrant) : null;
1256
+ const lVibrant = vibrantHsl ? vibrantHsl.l : Math.min(hsl.l + 7, 100);
1257
+ styles["--voice-accent-vibrant"] = vibrantHsl ? vibrantHsl.toString() : `${hsl.h} ${hsl.s}% ${lVibrant}%`;
1258
+ const darkHsl = colors.primaryDark ? hexToHSL(colors.primaryDark) : null;
1259
+ const lDark = darkHsl ? darkHsl.l : Math.max(hsl.l - 10, 0);
1260
+ styles["--voice-accent-dark"] = darkHsl ? darkHsl.toString() : `${hsl.h} ${hsl.s}% ${lDark}%`;
1261
+ styles["--voice-accent-light"] = currentTheme === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
1262
+ const finalVibrant = vibrantHsl ? `hsl(${vibrantHsl.toString()})` : `hsl(${hsl.h} ${hsl.s}% ${lVibrant}%)`;
1263
+ const finalDark = darkHsl ? `hsl(${darkHsl.toString()})` : `hsl(${hsl.h} ${hsl.s}% ${lDark}%)`;
1264
+ styles["--gradient-primary"] = `linear-gradient(135deg, hsl(${hsl.toString()}), ${finalVibrant})`;
1265
+ styles["--gradient-mic-button"] = `radial-gradient(circle at 50% 0%, ${finalVibrant}, ${finalDark})`;
1266
+ const shadowColor = currentTheme === "light" ? `hsl(${hsl.toString()} / 0.1)` : `hsl(${hsl.toString()} / 0.2)`;
1267
+ styles["--shadow-soft"] = `0 4px 20px -2px ${shadowColor}`;
1268
+ }
1269
+ }
1270
+ }
1271
+ });
1272
+ return styles;
1273
+ };
1274
+
1275
+ // src/utils/webrtc-config.ts
1276
+ var configureWebRTCServer = (config) => {
1277
+ if (!config.apiKey) {
1278
+ throw new Error("API key is required for WebRTC configuration");
1279
+ }
1280
+ const finalConfig = {
1281
+ serverUrl: WEBRTC_BACKEND_SERVER_URL,
1282
+ apiKey: config.apiKey,
1283
+ roomName: config.roomName,
1284
+ participantName: config.participantName,
1285
+ tokenTtlSeconds: config.tokenTtlSeconds
1286
+ };
1287
+ setServerUrl(finalConfig.serverUrl);
1288
+ if (typeof window !== "undefined") {
1289
+ ;
1290
+ window.CuekitWebRTCConfig = finalConfig;
1291
+ }
1292
+ };
1293
+ var getWebRTCServerConfig = () => {
1294
+ if (typeof window !== "undefined") {
1295
+ return window.CuekitWebRTCConfig || null;
1296
+ }
1297
+ return null;
1298
+ };
1299
+ var initWebRTCWithDeployedBackend = (apiKey, customConfig) => {
1300
+ const config = {
1301
+ serverUrl: WEBRTC_BACKEND_SERVER_URL,
1302
+ apiKey,
1303
+ roomName: customConfig?.roomName || "default-room",
1304
+ participantName: customConfig?.participantName || "user",
1305
+ tokenTtlSeconds: customConfig?.tokenTtlSeconds || 7200
1306
+ };
1307
+ configureWebRTCServer(config);
1308
+ return config;
1309
+ };
1310
+ var initWebRTC = (apiKey) => {
1311
+ return initWebRTCWithDeployedBackend(apiKey);
1312
+ };
1313
+
1264
1314
  // src/providers/ansyr-provider.tsx
1265
1315
  if (typeof window !== "undefined" && !globalThis.AnsyrStore) {
1266
1316
  globalThis.AnsyrStore = {
@@ -1315,47 +1365,7 @@ var AnsyrProvider = ({
1315
1365
  emptyStateMessage
1316
1366
  }) => {
1317
1367
  const [internalDeviceId, setInternalDeviceId] = useState(deviceId);
1318
- const generateThemeStyles2 = (theme2) => {
1319
- if (!theme2) return {};
1320
- const mapColorsToVars = (colors) => {
1321
- const mapping = {
1322
- primary: "--voice-accent",
1323
- background: "--voice-bg",
1324
- surface: "--voice-surface",
1325
- border: "--voice-border",
1326
- text: "--voice-text",
1327
- textMuted: "--voice-text-muted",
1328
- userBubble: "--voice-user-bubble",
1329
- userText: "--voice-user-text",
1330
- aiBubble: "--voice-ai-bubble",
1331
- aiText: "--voice-ai-text"
1332
- };
1333
- const styles2 = {};
1334
- Object.entries(colors).forEach(([key, value]) => {
1335
- const varName = mapping[key];
1336
- if (varName && value) {
1337
- const hsl = hexToHSL(value);
1338
- if (hsl) {
1339
- styles2[varName] = hsl.toString();
1340
- if (key === "primary") {
1341
- styles2["--indicator-bg"] = hsl.toString();
1342
- styles2["--voice-accent-light"] = `${hsl.h} ${hsl.s}% 96%`;
1343
- }
1344
- }
1345
- }
1346
- });
1347
- return styles2;
1348
- };
1349
- const styles = {};
1350
- if (theme2.light) {
1351
- const lightStyles = mapColorsToVars(theme2.light);
1352
- Object.entries(lightStyles).forEach(([key, value]) => {
1353
- styles[key] = value;
1354
- });
1355
- }
1356
- return styles;
1357
- };
1358
- const themeStyles = generateThemeStyles2(theme);
1368
+ const themeStyles = generateThemeStyles(theme, "dark");
1359
1369
  useEffect(() => {
1360
1370
  InitCuekit({ apiKey, appId });
1361
1371
  }, [apiKey, appId]);
@@ -1375,31 +1385,43 @@ var AnsyrProvider = ({
1375
1385
  };
1376
1386
  }, [navigationHandler]);
1377
1387
  useEffect(() => {
1378
- import("./webrtc-service-IMARTHNM.mjs").then(({ setWebRTCCallbacks: setWebRTCCallbacks2 }) => {
1379
- setWebRTCCallbacks2({
1380
- onNavigationCommand: (command) => {
1381
- const data = command.data ?? command;
1382
- if (!data?.actionType) return;
1383
- if (data.actionType === "navigate" && data.routeName) {
1384
- if (navigationHandler) {
1385
- navigationHandler(data.routeName);
1388
+ let cleanup = null;
1389
+ import("./webrtc-service-XS2JQUBW.mjs").then(
1390
+ ({ registerWebRTCCallbacks: registerWebRTCCallbacks2, unregisterWebRTCCallbacks: unregisterWebRTCCallbacks2 }) => {
1391
+ const listeners = {
1392
+ onNavigationCommand: (command) => {
1393
+ const data = command.data ?? command;
1394
+ if (!data?.actionType) return;
1395
+ if (data.actionType === "navigate" && data.routeName) {
1396
+ if (navigationHandler) {
1397
+ navigationHandler(data.routeName);
1398
+ }
1399
+ } else if (data.actionType === "click" && data.elementId) {
1400
+ console.log("AI intent: Click element", data.elementId);
1401
+ }
1402
+ },
1403
+ onConnectionStateChange: (state) => {
1404
+ if (onConnectionStateChange) {
1405
+ onConnectionStateChange(state);
1406
+ }
1407
+ },
1408
+ onParticipantUpdate: (participants) => {
1409
+ if (onParticipantUpdate) {
1410
+ onParticipantUpdate(participants);
1386
1411
  }
1387
- } else if (data.actionType === "click" && data.elementId) {
1388
- console.log("AI intent: Click element", data.elementId);
1389
- }
1390
- },
1391
- onConnectionStateChange: (state) => {
1392
- if (onConnectionStateChange) {
1393
- onConnectionStateChange(state);
1394
- }
1395
- },
1396
- onParticipantUpdate: (participants) => {
1397
- if (onParticipantUpdate) {
1398
- onParticipantUpdate(participants);
1399
1412
  }
1400
- }
1401
- });
1402
- });
1413
+ };
1414
+ registerWebRTCCallbacks2(listeners);
1415
+ cleanup = () => {
1416
+ unregisterWebRTCCallbacks2(listeners);
1417
+ };
1418
+ }
1419
+ );
1420
+ return () => {
1421
+ if (cleanup) {
1422
+ cleanup();
1423
+ }
1424
+ };
1403
1425
  }, [onConnectionStateChange, onParticipantUpdate, navigationHandler]);
1404
1426
  useEffect(() => {
1405
1427
  const updateGlobalStore = (id) => {
@@ -1486,6 +1508,7 @@ var useWebRTC = (options) => {
1486
1508
  const [participants, setParticipants] = useState2([]);
1487
1509
  const [room, setRoom] = useState2(null);
1488
1510
  const [error, setError] = useState2(null);
1511
+ const listenersRef = useRef(null);
1489
1512
  const audioContainerRef = useRef(null);
1490
1513
  useEffect2(() => {
1491
1514
  setAudioContainer(audioContainerRef);
@@ -1501,15 +1524,20 @@ var useWebRTC = (options) => {
1501
1524
  setParticipants(participants2);
1502
1525
  options?.onParticipantUpdate?.(participants2);
1503
1526
  };
1504
- setWebRTCCallbacks({
1527
+ const listeners = {
1505
1528
  onConnectionStateChange: handleConnectionStateChange,
1506
1529
  onParticipantUpdate: handleParticipantUpdate,
1507
1530
  onNavigationCommand: options?.onNavigationCommand,
1508
1531
  onAISpeechStart: options?.onAISpeechStart,
1509
1532
  onAISpeechEnd: options?.onAISpeechEnd
1510
- });
1533
+ };
1534
+ listenersRef.current = listeners;
1535
+ registerWebRTCCallbacks(listeners);
1511
1536
  return () => {
1512
- setWebRTCCallbacks({});
1537
+ if (listenersRef.current) {
1538
+ unregisterWebRTCCallbacks(listenersRef.current);
1539
+ listenersRef.current = null;
1540
+ }
1513
1541
  };
1514
1542
  }, [
1515
1543
  options?.onConnectionStateChange,
@@ -1569,30 +1597,85 @@ var useCuekit = (options) => {
1569
1597
  const currentUserMessageRef = useRef2(null);
1570
1598
  const currentAIMessageRef = useRef2(null);
1571
1599
  const handleMessageChunk = useCallback2((text7, role, isFinal) => {
1572
- const currentMessageRef = role === "user" ? currentUserMessageRef : currentAIMessageRef;
1573
- const messageToUpdate = currentMessageRef.current;
1574
- if (!messageToUpdate && !text7 && isFinal) {
1575
- return;
1576
- }
1577
- if (messageToUpdate) {
1578
- const updatedMessage = { ...messageToUpdate, text: messageToUpdate.text + text7, isFinal };
1579
- currentMessageRef.current = updatedMessage;
1580
- setMessages(
1581
- (prev) => prev.map((msg) => msg.id === messageToUpdate.id ? updatedMessage : msg)
1582
- );
1583
- } else {
1584
- const newMessage = {
1585
- id: `${role}-${Date.now()}`,
1600
+ const activeRef = role === "user" ? currentUserMessageRef : currentAIMessageRef;
1601
+ console.log(`\u{1F50D} handleMessageChunk called:`, {
1602
+ role,
1603
+ text: text7.substring(0, 50) + (text7.length > 50 ? "..." : ""),
1604
+ textLength: text7.length,
1605
+ isFinal,
1606
+ hasExistingMessage: !!activeRef.current,
1607
+ existingMessageId: activeRef.current?.id
1608
+ });
1609
+ const messageToUpdate = activeRef.current;
1610
+ let updatedMessage = null;
1611
+ setMessages((prev) => {
1612
+ console.log(`\u{1F50D} setMessages callback:`, {
1586
1613
  role,
1587
- text: text7,
1588
- isFinal,
1589
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1590
- };
1591
- currentMessageRef.current = newMessage;
1592
- setMessages((prev) => [...prev, newMessage]);
1614
+ messageToUpdate: messageToUpdate ? { id: messageToUpdate.id, textLength: messageToUpdate.text.length } : null,
1615
+ prevMessagesCount: prev.length,
1616
+ prevMessages: prev.map((m) => ({
1617
+ id: m.id,
1618
+ role: m.role,
1619
+ textLength: m.text.length,
1620
+ isFinal: m.isFinal
1621
+ }))
1622
+ });
1623
+ if (!messageToUpdate && !text7 && isFinal) {
1624
+ console.log(`\u{1F50D} Skipping empty final chunk (no existing message)`);
1625
+ return prev;
1626
+ }
1627
+ if (messageToUpdate) {
1628
+ const existsInState = prev.some((msg) => msg.id === messageToUpdate.id);
1629
+ const newUpdatedMessage = { ...messageToUpdate, text: messageToUpdate.text + text7, isFinal };
1630
+ updatedMessage = newUpdatedMessage;
1631
+ if (!existsInState) {
1632
+ console.log(`\u{1F50D} \u26A0\uFE0F Message ${messageToUpdate.id} not in state yet, adding it:`, {
1633
+ id: newUpdatedMessage.id,
1634
+ textLength: newUpdatedMessage.text.length,
1635
+ isFinal: newUpdatedMessage.isFinal
1636
+ });
1637
+ return [...prev, newUpdatedMessage];
1638
+ } else {
1639
+ console.log(`\u{1F50D} Updating existing ${role} message:`, {
1640
+ id: newUpdatedMessage.id,
1641
+ newTextLength: newUpdatedMessage.text.length,
1642
+ isFinal: newUpdatedMessage.isFinal
1643
+ });
1644
+ return prev.map((msg) => msg.id === messageToUpdate.id ? newUpdatedMessage : msg);
1645
+ }
1646
+ } else {
1647
+ const newMessage = {
1648
+ id: `${role}-${Date.now()}`,
1649
+ role,
1650
+ text: text7,
1651
+ isFinal,
1652
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
1653
+ };
1654
+ updatedMessage = newMessage;
1655
+ console.log(`\u{1F50D} Creating NEW ${role} message:`, {
1656
+ id: newMessage.id,
1657
+ textLength: newMessage.text.length,
1658
+ isFinal: newMessage.isFinal
1659
+ });
1660
+ const newArray = [...prev, newMessage];
1661
+ console.log(
1662
+ `\u{1F50D} New messages array:`,
1663
+ newArray.map((m) => ({
1664
+ id: m.id,
1665
+ role: m.role,
1666
+ textLength: m.text.length,
1667
+ isFinal: m.isFinal
1668
+ }))
1669
+ );
1670
+ return newArray;
1671
+ }
1672
+ });
1673
+ if (updatedMessage && !isFinal) {
1674
+ activeRef.current = updatedMessage;
1593
1675
  }
1594
1676
  if (isFinal) {
1595
- currentMessageRef.current = null;
1677
+ console.log(`\u{1F50D} Clearing ${role} ref (message finalized)`);
1678
+ activeRef.current = null;
1596
1679
  }
1597
1680
  }, []);
1598
1681
  const handleAIInterruption = useCallback2(() => {
@@ -1618,12 +1701,9 @@ var useCuekit = (options) => {
1618
1701
  const handleNavigationCommand = (event) => {
1619
1702
  console.log(`\u2B07\uFE0F Received event from backend: ${event.type}`, event);
1620
1703
  switch (event.type) {
1621
- case "speech_text": {
1622
- console.log("\u{1F5E3}\uFE0F AI Speech text:", event.data);
1623
- break;
1624
- }
1704
+ // raw_text is a redundant "reliability packet" - we already process ai_speech_chunk
1625
1705
  case "raw_text": {
1626
- console.log("\u{1F4DD} Raw text message:", event.data);
1706
+ console.log("\u{1F4DD} Raw text message (ignored, using ai_speech_chunk instead):", event.data);
1627
1707
  break;
1628
1708
  }
1629
1709
  case "user_speech_chunk":
@@ -15272,38 +15352,6 @@ var useDraggableResizableContainer = (storageKey) => {
15272
15352
  };
15273
15353
 
15274
15354
  // src/components/chat-popup.tsx
15275
- var generateThemeStyles = (theme, currentTheme = "dark") => {
15276
- if (!theme) return {};
15277
- const colors = currentTheme === "light" ? theme.light : theme.dark;
15278
- if (!colors) return {};
15279
- const mapping = {
15280
- primary: "--voice-accent",
15281
- background: "--voice-bg",
15282
- surface: "--voice-surface",
15283
- border: "--voice-border",
15284
- text: "--voice-text",
15285
- textMuted: "--voice-text-muted",
15286
- userBubble: "--voice-user-bubble",
15287
- userText: "--voice-user-text",
15288
- aiBubble: "--voice-ai-bubble",
15289
- aiText: "--voice-ai-text"
15290
- };
15291
- const styles = {};
15292
- Object.entries(colors).forEach(([key, value]) => {
15293
- const varName = mapping[key];
15294
- if (varName && value) {
15295
- const hsl = hexToHSL(value);
15296
- if (hsl) {
15297
- styles[varName] = hsl.toString();
15298
- if (key === "primary") {
15299
- styles["--indicator-bg"] = hsl.toString();
15300
- styles["--voice-accent-light"] = currentTheme === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
15301
- }
15302
- }
15303
- }
15304
- });
15305
- return styles;
15306
- };
15307
15355
  var ChatPopup = ({
15308
15356
  isOpen,
15309
15357
  isMinimized,
@@ -15494,8 +15542,8 @@ var ChatPopup = ({
15494
15542
  "div",
15495
15543
  {
15496
15544
  style: {
15497
- background: "hsl(var(--voice-accent-light))",
15498
- color: "hsl(var(--voice-accent))",
15545
+ background: "hsl(var(--voice-status-bg))",
15546
+ color: "hsl(var(--voice-status-text))",
15499
15547
  minHeight: "16px",
15500
15548
  display: "flex",
15501
15549
  alignItems: "center",
@@ -15939,8 +15987,8 @@ var ChatPopup = ({
15939
15987
  style: {
15940
15988
  padding: "10px 12px",
15941
15989
  borderRadius: 8,
15942
- border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`,
15943
- background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
15990
+ border: "1px solid hsl(var(--voice-accent))",
15991
+ background: "hsl(var(--voice-accent))",
15944
15992
  color: "#fff",
15945
15993
  fontSize: 12,
15946
15994
  fontWeight: 700,
@@ -15963,8 +16011,8 @@ var ChatPopup = ({
15963
16011
  style: {
15964
16012
  padding: "10px 12px",
15965
16013
  borderRadius: 8,
15966
- border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`,
15967
- background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
16014
+ border: "1px solid hsl(var(--voice-accent))",
16015
+ background: "hsl(var(--voice-accent))",
15968
16016
  color: "#fff",
15969
16017
  fontSize: 12,
15970
16018
  fontWeight: 700,
@@ -16002,17 +16050,14 @@ var BorderGlow = ({ isActive }) => {
16002
16050
  right: 0,
16003
16051
  bottom: 0,
16004
16052
  width: "4px",
16005
- background: "linear-gradient(to bottom, #A39EEC, #8177ed, #6257d9)",
16053
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
16006
16054
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16007
16055
  opacity: 0.8
16008
16056
  },
16009
16057
  rightBorder2: {
16010
16058
  position: "absolute",
16011
16059
  top: 0,
16012
- right: 0,
16013
- bottom: 0,
16014
- width: "8px",
16015
- background: "linear-gradient(to bottom, #c0bbfb, #8177ed, #8177ed)",
16060
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent)))",
16016
16061
  filter: "blur(4px)",
16017
16062
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16018
16063
  opacity: 0.6
@@ -16021,9 +16066,7 @@ var BorderGlow = ({ isActive }) => {
16021
16066
  position: "absolute",
16022
16067
  top: 0,
16023
16068
  right: 0,
16024
- bottom: 0,
16025
- width: "16px",
16026
- background: "linear-gradient(to bottom, #dad7fe, #8177ed, #9a92f6)",
16069
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
16027
16070
  filter: "blur(12px)",
16028
16071
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16029
16072
  opacity: 0.4
@@ -16034,7 +16077,7 @@ var BorderGlow = ({ isActive }) => {
16034
16077
  left: 0,
16035
16078
  bottom: 0,
16036
16079
  width: "4px",
16037
- background: "linear-gradient(to bottom, #A39EEC, #8177ed, #6257d9)",
16080
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
16038
16081
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16039
16082
  opacity: 0.8
16040
16083
  },
@@ -16043,8 +16086,7 @@ var BorderGlow = ({ isActive }) => {
16043
16086
  top: 0,
16044
16087
  left: 0,
16045
16088
  bottom: 0,
16046
- width: "8px",
16047
- background: "linear-gradient(to bottom, #c0bbfb, #8177ed, #8177ed)",
16089
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent)))",
16048
16090
  filter: "blur(4px)",
16049
16091
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16050
16092
  opacity: 0.6
@@ -16054,8 +16096,7 @@ var BorderGlow = ({ isActive }) => {
16054
16096
  top: 0,
16055
16097
  left: 0,
16056
16098
  bottom: 0,
16057
- width: "16px",
16058
- background: "linear-gradient(to bottom, #dad7fe, #8177ed, #9a92f6)",
16099
+ background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
16059
16100
  filter: "blur(12px)",
16060
16101
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
16061
16102
  opacity: 0.4
@@ -16066,7 +16107,7 @@ var BorderGlow = ({ isActive }) => {
16066
16107
  left: 0,
16067
16108
  width: "32px",
16068
16109
  height: "32px",
16069
- background: "#9a92f6",
16110
+ background: "hsl(var(--voice-accent))",
16070
16111
  borderBottomRightRadius: "50%",
16071
16112
  filter: "blur(16px)",
16072
16113
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
@@ -16078,7 +16119,7 @@ var BorderGlow = ({ isActive }) => {
16078
16119
  right: 0,
16079
16120
  width: "32px",
16080
16121
  height: "32px",
16081
- background: "#A39EEC",
16122
+ background: "hsl(var(--voice-accent))",
16082
16123
  borderBottomLeftRadius: "50%",
16083
16124
  filter: "blur(16px)",
16084
16125
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
@@ -16090,7 +16131,7 @@ var BorderGlow = ({ isActive }) => {
16090
16131
  right: 0,
16091
16132
  width: "32px",
16092
16133
  height: "32px",
16093
- background: "#8177ed",
16134
+ background: "hsl(var(--voice-accent))",
16094
16135
  borderTopLeftRadius: "50%",
16095
16136
  filter: "blur(16px)",
16096
16137
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
@@ -16102,7 +16143,7 @@ var BorderGlow = ({ isActive }) => {
16102
16143
  left: 0,
16103
16144
  width: "32px",
16104
16145
  height: "32px",
16105
- background: "#6257d9",
16146
+ background: "hsl(var(--voice-accent))",
16106
16147
  borderTopRightRadius: "50%",
16107
16148
  filter: "blur(16px)",
16108
16149
  animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
@@ -18492,47 +18533,7 @@ var MicButton = ({
18492
18533
  }
18493
18534
  };
18494
18535
  const generateMicButtonGradient = () => {
18495
- const colors = currentTheme === "light" ? theme?.light : theme?.dark;
18496
- if (colors?.primary) {
18497
- const hsl = hexToHSL(colors.primary);
18498
- if (hsl) {
18499
- const lightHsl = `${hsl.h} ${hsl.s}% ${Math.min(hsl.l + 10, 100)}%`;
18500
- return `radial-gradient(circle at 50% 0%, hsl(${lightHsl}), hsl(${hsl.toString()}))`;
18501
- }
18502
- }
18503
- return currentTheme === "dark" ? "radial-gradient(circle at 50% 0%, #9a92f6, #5447cd)" : "radial-gradient(circle at 50% 0%, #9a92f6, #6257d9)";
18504
- };
18505
- const generateThemeStyles2 = (theme2, currentTheme2 = "dark") => {
18506
- if (!theme2) return {};
18507
- const colors = currentTheme2 === "light" ? theme2.light : theme2.dark;
18508
- if (!colors) return {};
18509
- const mapping = {
18510
- primary: "--voice-accent",
18511
- background: "--voice-bg",
18512
- surface: "--voice-surface",
18513
- border: "--voice-border",
18514
- text: "--voice-text",
18515
- textMuted: "--voice-text-muted",
18516
- userBubble: "--voice-user-bubble",
18517
- userText: "--voice-user-text",
18518
- aiBubble: "--voice-ai-bubble",
18519
- aiText: "--voice-ai-text"
18520
- };
18521
- const styles = {};
18522
- Object.entries(colors).forEach(([key, value]) => {
18523
- const varName = mapping[key];
18524
- if (varName && value) {
18525
- const hsl = hexToHSL(value);
18526
- if (hsl) {
18527
- styles[varName] = hsl.toString();
18528
- if (key === "primary") {
18529
- styles["--indicator-bg"] = hsl.toString();
18530
- styles["--voice-accent-light"] = currentTheme2 === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
18531
- }
18532
- }
18533
- }
18534
- });
18535
- return styles;
18536
+ return "radial-gradient(circle at 50% 0%, hsl(var(--voice-accent-vibrant)), hsl(var(--voice-accent-dark)))";
18536
18537
  };
18537
18538
  const micButtonGradient = generateMicButtonGradient();
18538
18539
  const buttonStyles = {
@@ -18569,18 +18570,18 @@ var MicButton = ({
18569
18570
  switch (micState) {
18570
18571
  case "listening":
18571
18572
  baseStyle.transform = "scale(1.05)";
18572
- baseStyle.boxShadow = "0 25px 50px -12px rgba(129, 119, 237, 0.6)";
18573
+ baseStyle.boxShadow = "0 25px 50px -12px hsla(var(--voice-accent) / 0.6)";
18573
18574
  break;
18574
18575
  case "thinking":
18575
18576
  baseStyle.transform = "scale(1.02)";
18576
- baseStyle.boxShadow = "0 20px 25px -5px rgba(154, 146, 246, 0.4)";
18577
+ baseStyle.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
18577
18578
  break;
18578
18579
  case "replying":
18579
18580
  baseStyle.transform = "scale(1.02)";
18580
- baseStyle.boxShadow = "0 20px 25px -5px rgba(129, 119, 237, 0.4)";
18581
+ baseStyle.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
18581
18582
  break;
18582
18583
  default:
18583
- baseStyle.boxShadow = "0 10px 15px -3px rgba(129, 119, 237, 0.3)";
18584
+ baseStyle.boxShadow = "0 10px 15px -3px hsla(var(--voice-accent) / 0.3)";
18584
18585
  break;
18585
18586
  }
18586
18587
  return baseStyle;
@@ -18593,7 +18594,7 @@ var MicButton = ({
18593
18594
  style: {
18594
18595
  ...buttonStyles.container,
18595
18596
  ...getPositionStyle(),
18596
- ...generateThemeStyles2(theme, currentTheme)
18597
+ ...generateThemeStyles(theme, currentTheme)
18597
18598
  }
18598
18599
  },
18599
18600
  showLanguageSelector && showLanguageDropdown ? /* @__PURE__ */ React15.createElement("div", { className: "voice-chat-language-selection" }, /* @__PURE__ */ React15.createElement("div", { className: "voice-chat-language-header" }, /* @__PURE__ */ React15.createElement("div", { className: "voice-chat-language-icon" }, /* @__PURE__ */ React15.createElement(mic_default, { width: 20, height: 20 })), /* @__PURE__ */ React15.createElement("span", { className: "voice-chat-language-title" }, "Select Language")), /* @__PURE__ */ React15.createElement(
@@ -18611,9 +18612,9 @@ var MicButton = ({
18611
18612
  className: "voice-chat-cancel-button",
18612
18613
  onClick: () => setShowLanguageSelector(false),
18613
18614
  style: {
18614
- background: currentTheme === "dark" ? "hsl(248 32% 17.5%)" : "#f6f5ff",
18615
- color: currentTheme === "dark" ? "hsl(252 20% 65%)" : "#6257d9",
18616
- border: `1px solid ${currentTheme === "dark" ? "hsl(248 32% 22%)" : "#c0bbfb"}`
18615
+ background: currentTheme === "dark" ? "hsl(var(--voice-surface))" : "hsl(var(--voice-accent-light))",
18616
+ color: currentTheme === "dark" ? "hsl(var(--voice-text-muted))" : "hsl(var(--voice-accent))",
18617
+ border: "1px solid hsl(var(--voice-border))"
18617
18618
  }
18618
18619
  },
18619
18620
  "Cancel"
@@ -18623,9 +18624,9 @@ var MicButton = ({
18623
18624
  className: "voice-chat-confirm-button",
18624
18625
  onClick: handleLanguageConfirm,
18625
18626
  style: {
18626
- background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
18627
+ background: "hsl(var(--voice-accent))",
18627
18628
  color: "#fff",
18628
- border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`
18629
+ border: "1px solid hsl(var(--voice-accent))"
18629
18630
  }
18630
18631
  },
18631
18632
  "Start Voice Chat"
@@ -18650,13 +18651,13 @@ var MicButton = ({
18650
18651
  onMouseEnter: (e2) => {
18651
18652
  if (micState === "idle") {
18652
18653
  e2.currentTarget.style.transform = "scale(1.05)";
18653
- e2.currentTarget.style.boxShadow = "0 20px 25px -5px rgba(129, 119, 237, 0.4)";
18654
+ e2.currentTarget.style.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
18654
18655
  }
18655
18656
  },
18656
18657
  onMouseLeave: (e2) => {
18657
18658
  if (micState === "idle") {
18658
18659
  e2.currentTarget.style.transform = "scale(1)";
18659
- e2.currentTarget.style.boxShadow = "0 10px 15px -3px rgba(129, 119, 237, 0.3)";
18660
+ e2.currentTarget.style.boxShadow = "0 10px 15px -3px hsla(var(--voice-accent) / 0.3)";
18660
18661
  }
18661
18662
  },
18662
18663
  "aria-label": micState === "thinking" ? "Processing..." : micState === "replying" ? "AI is responding..." : isListening ? "Stop listening" : "Start listening"