@poolse/react-native 3.7.1 → 3.9.0

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.js CHANGED
@@ -1,11 +1,12 @@
1
- import { useUser, useMe, useConversations, useUserPresence, formatCallLogPreview, useAttachmentUpload, usePoolse, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl } from '@poolse/react';
1
+ import { useUser, useMe, useConversations, useUserPresence, formatCallLogPreview, formatRecordingNoticePreview, useAttachmentUpload, usePoolse, filterConversations, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, recordingNoticeDisplayFor, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, captureLabel, useLiveTranscript, groupTranscript, formatCallDuration, useTranscript, findInText, ApiError, captureErrorMessage } from '@poolse/react';
2
2
  import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
3
- import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Keyboard, Platform, ScrollView, Modal, AppState, ActivityIndicator, SectionList, FlatList, KeyboardAvoidingView, Image, Linking, useColorScheme } from 'react-native';
3
+ import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Keyboard, Platform, ScrollView, Modal, AppState, ActivityIndicator, SectionList, FlatList, KeyboardAvoidingView, Image, AccessibilityInfo, Linking, useColorScheme } from 'react-native';
4
4
  import { SvgXml, Svg, Path, Circle, G } from 'react-native-svg';
5
5
  import { toNativeTheme, isBuiltInThemeId } from '@poolse/theme';
6
6
  export { BUILT_IN_THEME_IDS, DEFAULT_THEME_ID, createTheme, decodeTheme, encodeTheme, tokensFromFlat } from '@poolse/theme';
7
7
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
8
8
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
9
+ import { safeUuid, MessageQueuedError } from '@poolse/sdk';
9
10
  import * as ImagePicker from 'expo-image-picker';
10
11
  import * as DocumentPicker from 'expo-document-picker';
11
12
  import { manipulateAsync, SaveFormat } from 'expo-image-manipulator';
@@ -1295,7 +1296,17 @@ function ChatHeader({
1295
1296
  }
1296
1297
  ],
1297
1298
  children: [
1298
- onBack ? /* @__PURE__ */ jsx(Pressable, { onPress: onBack, hitSlop: 12, style: styles5.backBtn, accessibilityLabel: "Back", children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text }) }) : null,
1299
+ onBack ? /* @__PURE__ */ jsx(
1300
+ Pressable,
1301
+ {
1302
+ onPress: onBack,
1303
+ hitSlop: 12,
1304
+ style: styles5.backBtn,
1305
+ accessibilityRole: "button",
1306
+ accessibilityLabel: "Back",
1307
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "reply", size: 20, color: theme.colors.text })
1308
+ }
1309
+ ) : null,
1299
1310
  /* @__PURE__ */ jsx(
1300
1311
  Avatar,
1301
1312
  {
@@ -1326,6 +1337,7 @@ function ChatHeader({
1326
1337
  onPress: onMembersPress,
1327
1338
  hitSlop: 12,
1328
1339
  style: styles5.actionBtn,
1340
+ accessibilityRole: "button",
1329
1341
  accessibilityLabel: "Show members",
1330
1342
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "users", size: 20, color: theme.colors.textMuted })
1331
1343
  }
@@ -1381,6 +1393,34 @@ var styles5 = StyleSheet.create({
1381
1393
  marginLeft: -6
1382
1394
  }
1383
1395
  });
1396
+ function EmptyState({ title, hint, action }) {
1397
+ const theme = useTheme();
1398
+ return /* @__PURE__ */ jsxs(View, { style: styles6.root, accessible: true, accessibilityRole: "text", children: [
1399
+ /* @__PURE__ */ jsx(
1400
+ Text,
1401
+ {
1402
+ style: [styles6.title, { color: theme.colors.text, fontFamily: theme.fonts.body }],
1403
+ maxFontSizeMultiplier: 2,
1404
+ children: title
1405
+ }
1406
+ ),
1407
+ hint ? /* @__PURE__ */ jsx(
1408
+ Text,
1409
+ {
1410
+ style: [styles6.hint, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }],
1411
+ maxFontSizeMultiplier: 2,
1412
+ children: hint
1413
+ }
1414
+ ) : null,
1415
+ action ? /* @__PURE__ */ jsx(View, { style: styles6.action, children: action }) : null
1416
+ ] });
1417
+ }
1418
+ var styles6 = StyleSheet.create({
1419
+ root: { alignItems: "center", paddingHorizontal: 24, paddingVertical: 24, maxWidth: 360 },
1420
+ title: { fontSize: 16, fontWeight: "600", textAlign: "center" },
1421
+ hint: { fontSize: 14, lineHeight: 20, marginTop: 6, textAlign: "center" },
1422
+ action: { marginTop: 14 }
1423
+ });
1384
1424
 
1385
1425
  // src/internal/conversationSections.ts
1386
1426
  var TYPE_SECTIONS = [
@@ -1402,6 +1442,8 @@ function ConversationList({
1402
1442
  onSelect,
1403
1443
  renderItem,
1404
1444
  emptyState,
1445
+ query = "",
1446
+ noResultsState,
1405
1447
  conversations: controlled,
1406
1448
  loading: controlledLoading,
1407
1449
  error: controlledError,
@@ -1423,7 +1465,15 @@ function ConversationList({
1423
1465
  const meExternalId = me?.external_id ?? null;
1424
1466
  const meId = me?.id ?? null;
1425
1467
  const isControlled = controlled !== void 0;
1426
- const conversations = isControlled ? controlled : auto.conversations;
1468
+ const allConversations = isControlled ? controlled : auto.conversations;
1469
+ const needle = query.trim();
1470
+ const conversations = useMemo(
1471
+ () => needle ? filterConversations(allConversations, needle, {
1472
+ meExternalId,
1473
+ ...labelFor ? { labelFor } : {}
1474
+ }) : allConversations,
1475
+ [allConversations, needle, meExternalId, labelFor]
1476
+ );
1427
1477
  const loading = isControlled ? controlledLoading ?? false : auto.loading;
1428
1478
  const error = isControlled ? controlledError ?? null : auto.error;
1429
1479
  const counts = unreadCounts ?? (isControlled ? void 0 : auto.unreadCounts);
@@ -1472,9 +1522,9 @@ function ConversationList({
1472
1522
  onSelect
1473
1523
  ]
1474
1524
  );
1475
- const placeholder = (node) => /* @__PURE__ */ jsxs(View, { style: [styles6.flex, { backgroundColor: theme.colors.background }], children: [
1525
+ const placeholder = (node) => /* @__PURE__ */ jsxs(View, { style: [styles7.flex, { backgroundColor: theme.colors.background }], children: [
1476
1526
  header,
1477
- /* @__PURE__ */ jsx(View, { style: styles6.placeholder, children: node })
1527
+ /* @__PURE__ */ jsx(View, { style: styles7.placeholder, children: node })
1478
1528
  ] });
1479
1529
  if (loading && conversations.length === 0) {
1480
1530
  return placeholder(/* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }));
@@ -1484,12 +1534,29 @@ function ConversationList({
1484
1534
  /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.danger, fontFamily: theme.fonts.body }, children: "Failed to load conversations." })
1485
1535
  );
1486
1536
  }
1537
+ if (conversations.length === 0 && needle && allConversations.length > 0) {
1538
+ return placeholder(
1539
+ typeof noResultsState === "function" ? noResultsState(needle) : noResultsState !== void 0 ? noResultsState : /* @__PURE__ */ jsx(
1540
+ EmptyState,
1541
+ {
1542
+ title: `Nothing matches \u201C${needle}\u201D`,
1543
+ hint: "Check the spelling, or search by a person's or channel's name."
1544
+ }
1545
+ )
1546
+ );
1547
+ }
1487
1548
  if (conversations.length === 0) {
1488
1549
  return placeholder(
1489
- typeof emptyState === "string" || emptyState == null ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState ?? "No conversations yet." }) : emptyState
1550
+ emptyState == null ? /* @__PURE__ */ jsx(
1551
+ EmptyState,
1552
+ {
1553
+ title: "No conversations yet",
1554
+ hint: "Start a chat with someone, or join a channel \u2014 it shows up here."
1555
+ }
1556
+ ) : typeof emptyState === "string" ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState
1490
1557
  );
1491
1558
  }
1492
- const footer = loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.textSubtle, style: styles6.footerSpinner }) : null;
1559
+ const footer = loadingMore ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.textSubtle, style: styles7.footerSpinner }) : null;
1493
1560
  const common = {
1494
1561
  style: { backgroundColor: theme.colors.background },
1495
1562
  onEndReached: hasMore ? loadMore : void 0,
@@ -1510,8 +1577,8 @@ function ConversationList({
1510
1577
  Text,
1511
1578
  {
1512
1579
  style: [
1513
- styles6.sectionTitle,
1514
- density === "compact" ? styles6.sectionTitleDense : null,
1580
+ styles7.sectionTitle,
1581
+ density === "compact" ? styles7.sectionTitleDense : null,
1515
1582
  { color: theme.colors.textMuted, fontFamily: theme.fonts.body }
1516
1583
  ],
1517
1584
  accessibilityRole: "header",
@@ -1552,7 +1619,7 @@ function ConversationRow({
1552
1619
  const title = isDirect ? otherExtId ? labelFor?.(otherExtId) ?? resolvedOther.profile?.displayName ?? otherExtId : "Direct chat" : conv.name ?? "Untitled conversation";
1553
1620
  const avatarUrl = isDirect && otherExtId ? avatarFor?.(otherExtId) ?? resolvedOther.profile?.avatarUrl ?? null : conv.avatar_url ?? null;
1554
1621
  const avatarSeed = isDirect ? otherExtId ?? conv.id : conv.id;
1555
- const preview = conv.last_message_preview ? formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview : null;
1622
+ const preview = conv.last_message_preview ? formatCallLogPreview(conv.last_message_preview, meId) ?? formatRecordingNoticePreview(conv.last_message_preview, meId) ?? conv.last_message_preview : null;
1556
1623
  const when = relativeTime(conv.last_message_at, Date.now(), "short");
1557
1624
  const bold = unread > 0;
1558
1625
  return /* @__PURE__ */ jsxs(
@@ -1563,7 +1630,7 @@ function ConversationRow({
1563
1630
  accessibilityState: { selected },
1564
1631
  accessibilityLabel: unread > 0 ? `${title}, ${unread} unread` : title,
1565
1632
  style: ({ pressed }) => [
1566
- styles6.row,
1633
+ styles7.row,
1567
1634
  {
1568
1635
  paddingHorizontal: theme.spacing.md,
1569
1636
  paddingVertical: dense ? theme.spacing.xs + 2 : theme.spacing.sm + 2,
@@ -1582,14 +1649,14 @@ function ConversationRow({
1582
1649
  ...presence ? { presence: presence.state, doNotDisturb: !!presence.do_not_disturb } : {}
1583
1650
  }
1584
1651
  ),
1585
- /* @__PURE__ */ jsxs(View, { style: styles6.body, children: [
1586
- /* @__PURE__ */ jsxs(View, { style: styles6.titleLine, children: [
1652
+ /* @__PURE__ */ jsxs(View, { style: styles7.body, children: [
1653
+ /* @__PURE__ */ jsxs(View, { style: styles7.titleLine, children: [
1587
1654
  /* @__PURE__ */ jsx(
1588
1655
  Text,
1589
1656
  {
1590
1657
  style: [
1591
- styles6.name,
1592
- dense ? styles6.nameDense : null,
1658
+ styles7.name,
1659
+ dense ? styles7.nameDense : null,
1593
1660
  {
1594
1661
  color: theme.colors.text,
1595
1662
  fontFamily: theme.fonts.body,
@@ -1604,7 +1671,7 @@ function ConversationRow({
1604
1671
  Text,
1605
1672
  {
1606
1673
  style: [
1607
- styles6.time,
1674
+ styles7.time,
1608
1675
  { color: bold ? theme.colors.accentStrong : theme.colors.textSubtle }
1609
1676
  ],
1610
1677
  children: when
@@ -1615,7 +1682,7 @@ function ConversationRow({
1615
1682
  Text,
1616
1683
  {
1617
1684
  style: [
1618
- styles6.preview,
1685
+ styles7.preview,
1619
1686
  { color: bold ? theme.colors.textMuted : theme.colors.textSubtle }
1620
1687
  ],
1621
1688
  numberOfLines: 1,
@@ -1623,12 +1690,12 @@ function ConversationRow({
1623
1690
  }
1624
1691
  ) : null
1625
1692
  ] }),
1626
- unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles6.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles6.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1693
+ unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles7.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles7.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
1627
1694
  ]
1628
1695
  }
1629
1696
  );
1630
1697
  }
1631
- var styles6 = StyleSheet.create({
1698
+ var styles7 = StyleSheet.create({
1632
1699
  flex: {
1633
1700
  flex: 1
1634
1701
  },
@@ -1833,11 +1900,11 @@ function AttachmentPicker({
1833
1900
  animationType: "slide",
1834
1901
  onRequestClose: onClose,
1835
1902
  ...EDGE_TO_EDGE_MODAL,
1836
- children: /* @__PURE__ */ jsx(Pressable, { style: styles7.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
1903
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles8.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
1837
1904
  View,
1838
1905
  {
1839
1906
  style: [
1840
- styles7.sheet,
1907
+ styles8.sheet,
1841
1908
  {
1842
1909
  backgroundColor: theme.colors.surface,
1843
1910
  borderTopLeftRadius: theme.radii.lg,
@@ -1850,19 +1917,19 @@ function AttachmentPicker({
1850
1917
  theme.shadows.lg
1851
1918
  ],
1852
1919
  children: [
1853
- camera ? /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("camera"), children: [
1920
+ camera ? /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("camera"), children: [
1854
1921
  /* @__PURE__ */ jsx(PoolseIcon, { name: "camera", size: 20, color: theme.colors.textMuted }),
1855
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "Camera" })
1922
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "Camera" })
1856
1923
  ] }) : null,
1857
- /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("image"), children: [
1924
+ /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("image"), children: [
1858
1925
  /* @__PURE__ */ jsx(PoolseIcon, { name: "image", size: 20, color: theme.colors.textMuted }),
1859
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "Photo library" })
1926
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "Photo library" })
1860
1927
  ] }),
1861
- /* @__PURE__ */ jsxs(Pressable, { style: styles7.item, onPress: () => pickFromKind("document"), children: [
1928
+ /* @__PURE__ */ jsxs(Pressable, { style: styles8.item, onPress: () => pickFromKind("document"), children: [
1862
1929
  /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 20, color: theme.colors.textMuted }),
1863
- /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.text }], children: "File" })
1930
+ /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.text }], children: "File" })
1864
1931
  ] }),
1865
- /* @__PURE__ */ jsx(Pressable, { style: styles7.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles7.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
1932
+ /* @__PURE__ */ jsx(Pressable, { style: styles8.cancel, onPress: onClose, children: /* @__PURE__ */ jsx(Text, { style: [styles8.itemText, { color: theme.colors.accent }], children: "Cancel" }) })
1866
1933
  ]
1867
1934
  }
1868
1935
  ) })
@@ -2017,7 +2084,7 @@ async function defaultAdapter(kind, { multiple }) {
2017
2084
  })
2018
2085
  );
2019
2086
  }
2020
- var styles7 = StyleSheet.create({
2087
+ var styles8 = StyleSheet.create({
2021
2088
  backdrop: {
2022
2089
  flex: 1,
2023
2090
  backgroundColor: "rgba(0,0,0,0.35)",
@@ -2047,14 +2114,14 @@ var styles7 = StyleSheet.create({
2047
2114
  });
2048
2115
  function DaySeparator({ label, variant = "pill" }) {
2049
2116
  const theme = useTheme();
2050
- const rule = variant === "rule" ? /* @__PURE__ */ jsx(View, { style: [styles8.rule, { backgroundColor: theme.colors.border }] }) : null;
2051
- return /* @__PURE__ */ jsxs(View, { style: [styles8.wrap, rule ? styles8.wrapRule : null], children: [
2117
+ const rule = variant === "rule" ? /* @__PURE__ */ jsx(View, { style: [styles9.rule, { backgroundColor: theme.colors.border }] }) : null;
2118
+ return /* @__PURE__ */ jsxs(View, { style: [styles9.wrap, rule ? styles9.wrapRule : null], children: [
2052
2119
  rule,
2053
2120
  /* @__PURE__ */ jsx(
2054
2121
  View,
2055
2122
  {
2056
2123
  style: [
2057
- styles8.chip,
2124
+ styles9.chip,
2058
2125
  {
2059
2126
  backgroundColor: theme.colors.surfaceAlt,
2060
2127
  borderColor: theme.colors.border
@@ -2064,7 +2131,7 @@ function DaySeparator({ label, variant = "pill" }) {
2064
2131
  Text,
2065
2132
  {
2066
2133
  style: [
2067
- styles8.label,
2134
+ styles9.label,
2068
2135
  {
2069
2136
  color: theme.colors.textMuted,
2070
2137
  fontFamily: theme.fonts.body
@@ -2078,7 +2145,7 @@ function DaySeparator({ label, variant = "pill" }) {
2078
2145
  rule
2079
2146
  ] });
2080
2147
  }
2081
- var styles8 = StyleSheet.create({
2148
+ var styles9 = StyleSheet.create({
2082
2149
  wrap: {
2083
2150
  alignItems: "center",
2084
2151
  marginVertical: 8
@@ -2111,7 +2178,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2111
2178
  return /* @__PURE__ */ jsxs(
2112
2179
  View,
2113
2180
  {
2114
- style: [styles9.bar, { backgroundColor: theme.colors.success }],
2181
+ style: [styles10.bar, { backgroundColor: theme.colors.success }],
2115
2182
  accessibilityRole: "summary",
2116
2183
  accessibilityLabel: `${what}, ${who}`,
2117
2184
  children: [
@@ -2124,9 +2191,9 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2124
2191
  label: null
2125
2192
  }
2126
2193
  ),
2127
- /* @__PURE__ */ jsxs(View, { style: styles9.text, children: [
2128
- /* @__PURE__ */ jsx(Text, { style: [styles9.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
2129
- /* @__PURE__ */ jsx(Text, { style: [styles9.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
2194
+ /* @__PURE__ */ jsxs(View, { style: styles10.text, children: [
2195
+ /* @__PURE__ */ jsx(Text, { style: [styles10.title, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: what }),
2196
+ /* @__PURE__ */ jsx(Text, { style: [styles10.meta, { fontFamily: theme.fonts.body }], numberOfLines: 1, children: who })
2130
2197
  ] }),
2131
2198
  /* @__PURE__ */ jsx(
2132
2199
  Pressable,
@@ -2135,11 +2202,11 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2135
2202
  accessibilityRole: "button",
2136
2203
  accessibilityLabel: "Join call",
2137
2204
  hitSlop: 8,
2138
- style: ({ pressed }) => [styles9.join, pressed && styles9.joinPressed],
2205
+ style: ({ pressed }) => [styles10.join, pressed && styles10.joinPressed],
2139
2206
  children: /* @__PURE__ */ jsx(
2140
2207
  Text,
2141
2208
  {
2142
- style: [styles9.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
2209
+ style: [styles10.joinText, { color: theme.colors.success, fontFamily: theme.fonts.body }],
2143
2210
  children: "Join"
2144
2211
  }
2145
2212
  )
@@ -2149,7 +2216,7 @@ function LiveCallBanner({ call, inCall, onJoin }) {
2149
2216
  }
2150
2217
  );
2151
2218
  }
2152
- var styles9 = StyleSheet.create({
2219
+ var styles10 = StyleSheet.create({
2153
2220
  bar: {
2154
2221
  flexDirection: "row",
2155
2222
  alignItems: "center",
@@ -2355,7 +2422,7 @@ function PickerSheet({
2355
2422
  {
2356
2423
  onPress: () => pick(emoji),
2357
2424
  style: ({ pressed }) => [
2358
- styles10.cell,
2425
+ styles11.cell,
2359
2426
  {
2360
2427
  borderRadius: theme.radii.sm,
2361
2428
  backgroundColor: pressed ? theme.colors.surfaceAlt : void 0
@@ -2363,15 +2430,15 @@ function PickerSheet({
2363
2430
  ],
2364
2431
  accessibilityRole: "button",
2365
2432
  accessibilityLabel: emoji,
2366
- children: /* @__PURE__ */ jsx(Text, { style: styles10.emoji, children: emoji })
2433
+ children: /* @__PURE__ */ jsx(Text, { style: styles11.emoji, children: emoji })
2367
2434
  },
2368
2435
  emoji
2369
2436
  );
2370
- return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: styles10.kav, behavior: "padding", children: [
2437
+ return /* @__PURE__ */ jsxs(KeyboardAvoidingView, { style: styles11.kav, behavior: "padding", children: [
2371
2438
  /* @__PURE__ */ jsx(
2372
2439
  Pressable,
2373
2440
  {
2374
- style: [styles10.backdrop, { backgroundColor: theme.colors.overlay }],
2441
+ style: [styles11.backdrop, { backgroundColor: theme.colors.overlay }],
2375
2442
  onPress: onClose,
2376
2443
  accessibilityLabel: "Close emoji picker"
2377
2444
  }
@@ -2380,7 +2447,7 @@ function PickerSheet({
2380
2447
  View,
2381
2448
  {
2382
2449
  style: [
2383
- styles10.sheet,
2450
+ styles11.sheet,
2384
2451
  {
2385
2452
  height: Math.round(height * 0.55),
2386
2453
  backgroundColor: theme.colors.surface,
@@ -2393,11 +2460,11 @@ function PickerSheet({
2393
2460
  theme.shadows.lg
2394
2461
  ],
2395
2462
  children: [
2396
- /* @__PURE__ */ jsxs(View, { style: styles10.headRow, children: [
2463
+ /* @__PURE__ */ jsxs(View, { style: styles11.headRow, children: [
2397
2464
  /* @__PURE__ */ jsx(
2398
2465
  Text,
2399
2466
  {
2400
- style: [styles10.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
2467
+ style: [styles11.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
2401
2468
  accessibilityRole: "header",
2402
2469
  children: title
2403
2470
  }
@@ -2408,7 +2475,7 @@ function PickerSheet({
2408
2475
  View,
2409
2476
  {
2410
2477
  style: [
2411
- styles10.search,
2478
+ styles11.search,
2412
2479
  { backgroundColor: theme.colors.surfaceAlt, borderRadius: theme.radii.md }
2413
2480
  ],
2414
2481
  children: [
@@ -2422,19 +2489,19 @@ function PickerSheet({
2422
2489
  placeholderTextColor: theme.colors.textSubtle,
2423
2490
  autoCorrect: false,
2424
2491
  autoCapitalize: "none",
2425
- style: [styles10.searchInput, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2492
+ style: [styles11.searchInput, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2426
2493
  accessibilityLabel: "Search emoji"
2427
2494
  }
2428
2495
  )
2429
2496
  ]
2430
2497
  }
2431
2498
  ),
2432
- query.trim() ? results.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles10.results, children: results.map((r) => cell(r.emoji)) }) : /* @__PURE__ */ jsx(Text, { style: [styles10.empty, { color: theme.colors.textMuted }], children: "No emoji found." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2433
- /* @__PURE__ */ jsx(View, { style: [styles10.tabs, { borderBottomColor: theme.colors.border }], children: sections.map((s, i) => /* @__PURE__ */ jsx(
2499
+ query.trim() ? results.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles11.results, children: results.map((r) => cell(r.emoji)) }) : /* @__PURE__ */ jsx(Text, { style: [styles11.empty, { color: theme.colors.textMuted }], children: "No emoji found." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2500
+ /* @__PURE__ */ jsx(View, { style: [styles11.tabs, { borderBottomColor: theme.colors.border }], children: sections.map((s, i) => /* @__PURE__ */ jsx(
2434
2501
  Pressable,
2435
2502
  {
2436
2503
  hitSlop: 4,
2437
- style: styles10.tab,
2504
+ style: styles11.tab,
2438
2505
  onPress: () => listRef.current?.scrollToLocation({
2439
2506
  sectionIndex: i,
2440
2507
  itemIndex: 0,
@@ -2443,7 +2510,7 @@ function PickerSheet({
2443
2510
  }),
2444
2511
  accessibilityRole: "button",
2445
2512
  accessibilityLabel: s.title,
2446
- children: /* @__PURE__ */ jsx(Text, { style: styles10.tabEmoji, children: s.id === "recent" ? "\u{1F558}" : s.data[0]?.[0] })
2513
+ children: /* @__PURE__ */ jsx(Text, { style: styles11.tabEmoji, children: s.id === "recent" ? "\u{1F558}" : s.data[0]?.[0] })
2447
2514
  },
2448
2515
  s.id
2449
2516
  )) }),
@@ -2457,8 +2524,8 @@ function PickerSheet({
2457
2524
  stickySectionHeadersEnabled: false,
2458
2525
  initialNumToRender: 8,
2459
2526
  onScrollToIndexFailed: () => void 0,
2460
- renderSectionHeader: ({ section }) => /* @__PURE__ */ jsx(Text, { style: [styles10.sectionTitle, { color: theme.colors.textMuted }], children: section.title }),
2461
- renderItem: ({ item }) => /* @__PURE__ */ jsx(View, { style: styles10.gridRow, children: item.map(cell) })
2527
+ renderSectionHeader: ({ section }) => /* @__PURE__ */ jsx(Text, { style: [styles11.sectionTitle, { color: theme.colors.textMuted }], children: section.title }),
2528
+ renderItem: ({ item }) => /* @__PURE__ */ jsx(View, { style: styles11.gridRow, children: item.map(cell) })
2462
2529
  }
2463
2530
  )
2464
2531
  ] })
@@ -2472,7 +2539,7 @@ function chunk(list, size) {
2472
2539
  for (let i = 0; i < list.length; i += size) out.push(list.slice(i, i + size));
2473
2540
  return out;
2474
2541
  }
2475
- var styles10 = StyleSheet.create({
2542
+ var styles11 = StyleSheet.create({
2476
2543
  kav: {
2477
2544
  flex: 1,
2478
2545
  justifyContent: "flex-end"
@@ -2563,8 +2630,8 @@ function UploadQueueStrip() {
2563
2630
  {
2564
2631
  horizontal: true,
2565
2632
  showsHorizontalScrollIndicator: false,
2566
- contentContainerStyle: styles11.scroll,
2567
- style: [styles11.scrollStyle, { marginBottom: 8 }],
2633
+ contentContainerStyle: styles12.scroll,
2634
+ style: [styles12.scrollStyle, { marginBottom: 8 }],
2568
2635
  children: upload.queue.map((item) => {
2569
2636
  const isError = item.status === "error";
2570
2637
  const isUploading = item.status === "uploading" || item.status === "pending";
@@ -2575,7 +2642,7 @@ function UploadQueueStrip() {
2575
2642
  if (item.status === "ready" || isError) upload.remove(item.localId);
2576
2643
  else upload.cancel(item.localId);
2577
2644
  };
2578
- return /* @__PURE__ */ jsxs(View, { style: styles11.tileWrap, children: [
2645
+ return /* @__PURE__ */ jsxs(View, { style: styles12.tileWrap, children: [
2579
2646
  isImage && previewUri ? /* @__PURE__ */ jsx(ImageTile, { uri: previewUri, uploading: isUploading, error: isError }) : /* @__PURE__ */ jsx(
2580
2647
  FileTile,
2581
2648
  {
@@ -2590,13 +2657,13 @@ function UploadQueueStrip() {
2590
2657
  {
2591
2658
  onPress: handleClose,
2592
2659
  hitSlop: 8,
2593
- style: styles11.closeBtn,
2660
+ style: styles12.closeBtn,
2594
2661
  accessibilityLabel: isError ? "Remove failed upload" : "Cancel upload",
2595
2662
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 11, color: "#fff" })
2596
2663
  }
2597
2664
  ) : null,
2598
- isUploading ? /* @__PURE__ */ jsx(View, { style: styles11.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles11.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
2599
- isError ? /* @__PURE__ */ jsx(View, { style: [styles11.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsx(Text, { style: [styles11.errorText, { color: "#fff" }], children: "Failed" }) }) : null
2665
+ isUploading ? /* @__PURE__ */ jsx(View, { style: styles12.progressOverlay, children: /* @__PURE__ */ jsx(View, { style: [styles12.spinner, { borderColor: theme.colors.accentText }] }) }) : null,
2666
+ isError ? /* @__PURE__ */ jsx(View, { style: [styles12.errorOverlay, { backgroundColor: "rgba(229,72,77,0.85)" }], children: /* @__PURE__ */ jsx(Text, { style: [styles12.errorText, { color: "#fff" }], children: "Failed" }) }) : null
2600
2667
  ] }, item.localId);
2601
2668
  })
2602
2669
  }
@@ -2609,7 +2676,7 @@ function ImageTile({ uri, uploading, error }) {
2609
2676
  {
2610
2677
  source: { uri },
2611
2678
  style: [
2612
- styles11.imageTile,
2679
+ styles12.imageTile,
2613
2680
  {
2614
2681
  backgroundColor: theme.colors.surfaceAlt,
2615
2682
  borderColor: error ? theme.colors.danger : "transparent",
@@ -2631,24 +2698,24 @@ function FileTile({
2631
2698
  View,
2632
2699
  {
2633
2700
  style: [
2634
- styles11.fileTile,
2701
+ styles12.fileTile,
2635
2702
  {
2636
2703
  backgroundColor: theme.colors.surfaceAlt,
2637
2704
  borderColor: error ? theme.colors.danger : uploading ? theme.colors.accent : theme.colors.border
2638
2705
  }
2639
2706
  ],
2640
2707
  children: [
2641
- /* @__PURE__ */ jsx(View, { style: [styles11.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
2642
- /* @__PURE__ */ jsxs(View, { style: styles11.fileInfo, children: [
2708
+ /* @__PURE__ */ jsx(View, { style: [styles12.fileIconBox, { backgroundColor: theme.colors.accentSoft }], children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 18, color: theme.colors.accent }) }),
2709
+ /* @__PURE__ */ jsxs(View, { style: styles12.fileInfo, children: [
2643
2710
  /* @__PURE__ */ jsx(
2644
2711
  Text,
2645
2712
  {
2646
- style: [styles11.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2713
+ style: [styles12.fileName, { color: theme.colors.text, fontFamily: theme.fonts.body }],
2647
2714
  numberOfLines: 1,
2648
2715
  children: filename
2649
2716
  }
2650
2717
  ),
2651
- /* @__PURE__ */ jsx(Text, { style: [styles11.fileSize, { color: theme.colors.textSubtle }], children: formatBytes2(size) })
2718
+ /* @__PURE__ */ jsx(Text, { style: [styles12.fileSize, { color: theme.colors.textSubtle }], children: formatBytes2(size) })
2652
2719
  ] })
2653
2720
  ]
2654
2721
  }
@@ -2662,7 +2729,7 @@ function formatBytes2(n) {
2662
2729
  return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
2663
2730
  }
2664
2731
  var TILE = 64;
2665
- var styles11 = StyleSheet.create({
2732
+ var styles12 = StyleSheet.create({
2666
2733
  scrollStyle: {
2667
2734
  overflow: "visible"
2668
2735
  },
@@ -2896,7 +2963,7 @@ var MessageComposer = forwardRef(
2896
2963
  View,
2897
2964
  {
2898
2965
  style: [
2899
- styles12.wrap,
2966
+ styles13.wrap,
2900
2967
  {
2901
2968
  backgroundColor: theme.colors.surface,
2902
2969
  borderTopColor: theme.colors.border,
@@ -2920,13 +2987,14 @@ var MessageComposer = forwardRef(
2920
2987
  ) : null,
2921
2988
  attachments && !isEditing ? /* @__PURE__ */ jsx(UploadQueueStrip, {}) : null,
2922
2989
  isEditing ? null : accessory,
2923
- /* @__PURE__ */ jsxs(View, { style: styles12.row, children: [
2990
+ /* @__PURE__ */ jsxs(View, { style: styles13.row, children: [
2924
2991
  attachments && onAttachPress ? /* @__PURE__ */ jsx(
2925
2992
  Pressable,
2926
2993
  {
2927
2994
  onPress: onAttachPress,
2928
2995
  hitSlop: 8,
2929
- style: styles12.iconBtn,
2996
+ style: styles13.iconBtn,
2997
+ accessibilityRole: "button",
2930
2998
  accessibilityLabel: "Attach file",
2931
2999
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 22, color: theme.colors.textMuted })
2932
3000
  }
@@ -2936,7 +3004,7 @@ var MessageComposer = forwardRef(
2936
3004
  {
2937
3005
  onPress: () => setEmojiOpen(true),
2938
3006
  hitSlop: 8,
2939
- style: styles12.iconBtn,
3007
+ style: styles13.iconBtn,
2940
3008
  accessibilityRole: "button",
2941
3009
  accessibilityLabel: "Insert emoji",
2942
3010
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "emoji", size: 22, color: theme.colors.textMuted, label: null })
@@ -2956,11 +3024,12 @@ var MessageComposer = forwardRef(
2956
3024
  if (!isEditing) onSelectionChange?.(e.nativeEvent.selection);
2957
3025
  },
2958
3026
  placeholder,
3027
+ accessibilityLabel: placeholder,
2959
3028
  placeholderTextColor: theme.colors.textSubtle,
2960
3029
  multiline: true,
2961
3030
  editable: !disabled,
2962
3031
  style: [
2963
- styles12.input,
3032
+ styles13.input,
2964
3033
  {
2965
3034
  color: theme.colors.text,
2966
3035
  backgroundColor: theme.colors.surfaceAlt,
@@ -2977,12 +3046,13 @@ var MessageComposer = forwardRef(
2977
3046
  onPress: handleSend,
2978
3047
  disabled: submitDisabled,
2979
3048
  style: [
2980
- styles12.sendBtn,
3049
+ styles13.sendBtn,
2981
3050
  {
2982
3051
  backgroundColor: submitDisabled ? theme.colors.textSubtle : theme.colors.accent,
2983
3052
  opacity: submitDisabled ? 0.6 : 1
2984
3053
  }
2985
3054
  ],
3055
+ accessibilityRole: "button",
2986
3056
  accessibilityLabel: "Send message",
2987
3057
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "send", size: 18, color: theme.colors.accentText })
2988
3058
  }
@@ -3020,7 +3090,7 @@ function EditChip({ message, onCancel }) {
3020
3090
  View,
3021
3091
  {
3022
3092
  style: [
3023
- styles12.replyChip,
3093
+ styles13.replyChip,
3024
3094
  {
3025
3095
  backgroundColor: theme.colors.surfaceAlt,
3026
3096
  borderLeftColor: theme.colors.accent
@@ -3028,10 +3098,10 @@ function EditChip({ message, onCancel }) {
3028
3098
  ],
3029
3099
  children: [
3030
3100
  /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
3031
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyName, { color: theme.colors.accent }], children: "Editing message" }),
3032
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3101
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyName, { color: theme.colors.accent }], children: "Editing message" }),
3102
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3033
3103
  ] }),
3034
- onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles12.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3104
+ onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles13.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3035
3105
  ]
3036
3106
  }
3037
3107
  );
@@ -3048,7 +3118,7 @@ function ReplyChip({
3048
3118
  View,
3049
3119
  {
3050
3120
  style: [
3051
- styles12.replyChip,
3121
+ styles13.replyChip,
3052
3122
  {
3053
3123
  backgroundColor: theme.colors.surfaceAlt,
3054
3124
  borderLeftColor: theme.colors.accent
@@ -3056,18 +3126,18 @@ function ReplyChip({
3056
3126
  ],
3057
3127
  children: [
3058
3128
  /* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
3059
- /* @__PURE__ */ jsxs(Text, { style: [styles12.replyName, { color: theme.colors.accent }], children: [
3129
+ /* @__PURE__ */ jsxs(Text, { style: [styles13.replyName, { color: theme.colors.accent }], children: [
3060
3130
  "Replying to ",
3061
3131
  senderName
3062
3132
  ] }),
3063
- /* @__PURE__ */ jsx(Text, { style: [styles12.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3133
+ /* @__PURE__ */ jsx(Text, { style: [styles13.replyBody, { color: theme.colors.textMuted }], numberOfLines: 1, children: message.body ?? "\u2026" })
3064
3134
  ] }),
3065
- onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles12.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3135
+ onCancel ? /* @__PURE__ */ jsx(Pressable, { onPress: onCancel, hitSlop: 8, style: styles13.replyCancel, children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 16, color: theme.colors.textMuted }) }) : null
3066
3136
  ]
3067
3137
  }
3068
3138
  );
3069
3139
  }
3070
- var styles12 = StyleSheet.create({
3140
+ var styles13 = StyleSheet.create({
3071
3141
  wrap: {
3072
3142
  borderTopWidth: StyleSheet.hairlineWidth,
3073
3143
  paddingTop: 8,
@@ -3178,7 +3248,7 @@ function MentionInput({
3178
3248
  View,
3179
3249
  {
3180
3250
  style: [
3181
- styles13.suggestions,
3251
+ styles14.suggestions,
3182
3252
  {
3183
3253
  backgroundColor: theme.colors.surface,
3184
3254
  borderColor: theme.colors.border,
@@ -3189,7 +3259,7 @@ function MentionInput({
3189
3259
  accessibilityRole: "menu",
3190
3260
  accessibilityLabel: "Mention suggestions",
3191
3261
  children: [
3192
- /* @__PURE__ */ jsx(ScrollView, { keyboardShouldPersistTaps: "always", style: styles13.suggestionScroll, children: candidates.map((c) => /* @__PURE__ */ jsx(
3262
+ /* @__PURE__ */ jsx(ScrollView, { keyboardShouldPersistTaps: "always", style: styles14.suggestionScroll, children: candidates.map((c) => /* @__PURE__ */ jsx(
3193
3263
  MentionRow,
3194
3264
  {
3195
3265
  externalId: c.externalId,
@@ -3202,7 +3272,7 @@ function MentionInput({
3202
3272
  Pressable,
3203
3273
  {
3204
3274
  onPress: () => setDismissedAt(query.start),
3205
- style: styles13.dismiss,
3275
+ style: styles14.dismiss,
3206
3276
  accessibilityRole: "button",
3207
3277
  accessibilityLabel: "Dismiss suggestions",
3208
3278
  hitSlop: 6,
@@ -3245,7 +3315,7 @@ function MentionRow({
3245
3315
  {
3246
3316
  onPress,
3247
3317
  style: ({ pressed }) => [
3248
- styles13.row,
3318
+ styles14.row,
3249
3319
  { backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent" }
3250
3320
  ],
3251
3321
  accessibilityRole: "menuitem",
@@ -3255,7 +3325,7 @@ function MentionRow({
3255
3325
  /* @__PURE__ */ jsx(
3256
3326
  Text,
3257
3327
  {
3258
- style: [styles13.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3328
+ style: [styles14.rowText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3259
3329
  numberOfLines: 1,
3260
3330
  children: name
3261
3331
  }
@@ -3264,7 +3334,7 @@ function MentionRow({
3264
3334
  }
3265
3335
  );
3266
3336
  }
3267
- var styles13 = StyleSheet.create({
3337
+ var styles14 = StyleSheet.create({
3268
3338
  suggestions: {
3269
3339
  borderWidth: StyleSheet.hairlineWidth,
3270
3340
  marginBottom: 8,
@@ -3396,15 +3466,15 @@ function MessageList({
3396
3466
  [renderItem, data.length]
3397
3467
  );
3398
3468
  if (loading && messages.length === 0) {
3399
- return /* @__PURE__ */ jsx(View, { style: [styles14.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
3469
+ return /* @__PURE__ */ jsx(View, { style: [styles15.placeholder, { backgroundColor: theme.colors.background }], children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent }) });
3400
3470
  }
3401
3471
  if (messages.length === 0) {
3402
- return /* @__PURE__ */ jsxs(View, { style: [styles14.placeholder, { backgroundColor: theme.colors.background }], children: [
3403
- ListHeader ? /* @__PURE__ */ jsx(View, { style: styles14.emptyHeader, children: ListHeader }) : null,
3472
+ return /* @__PURE__ */ jsxs(View, { style: [styles15.placeholder, { backgroundColor: theme.colors.background }], children: [
3473
+ ListHeader ? /* @__PURE__ */ jsx(View, { style: styles15.emptyHeader, children: ListHeader }) : null,
3404
3474
  typeof emptyState === "string" ? /* @__PURE__ */ jsx(Text, { style: { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }, children: emptyState }) : emptyState ?? null
3405
3475
  ] });
3406
3476
  }
3407
- return /* @__PURE__ */ jsxs(View, { style: styles14.root, children: [
3477
+ return /* @__PURE__ */ jsxs(View, { style: styles15.root, children: [
3408
3478
  /* @__PURE__ */ jsx(
3409
3479
  FlatList,
3410
3480
  {
@@ -3434,7 +3504,7 @@ function MessageList({
3434
3504
  {
3435
3505
  onPress: scrollToBottom,
3436
3506
  style: [
3437
- styles14.jumpButton,
3507
+ styles15.jumpButton,
3438
3508
  {
3439
3509
  backgroundColor: theme.colors.accent
3440
3510
  },
@@ -3443,7 +3513,7 @@ function MessageList({
3443
3513
  accessibilityLabel: `${newCount} new ${newCount === 1 ? "message" : "messages"}, jump to latest`,
3444
3514
  children: [
3445
3515
  /* @__PURE__ */ jsx(PoolseIcon, { name: "chevron-down", size: 14, color: theme.colors.accentText }),
3446
- /* @__PURE__ */ jsxs(Text, { style: [styles14.jumpText, { color: theme.colors.accentText }], children: [
3516
+ /* @__PURE__ */ jsxs(Text, { style: [styles15.jumpText, { color: theme.colors.accentText }], children: [
3447
3517
  newCount,
3448
3518
  " new ",
3449
3519
  newCount === 1 ? "message" : "messages"
@@ -3454,7 +3524,7 @@ function MessageList({
3454
3524
  ] });
3455
3525
  }
3456
3526
  var VIEWABILITY = { itemVisiblePercentThreshold: 50 };
3457
- var styles14 = StyleSheet.create({
3527
+ var styles15 = StyleSheet.create({
3458
3528
  root: {
3459
3529
  flex: 1
3460
3530
  },
@@ -3493,13 +3563,13 @@ function CallLogRow({ msg, meId, onCallBack }) {
3493
3563
  const accent = display.missed ? theme.colors.danger : theme.colors.textSubtle;
3494
3564
  const time = formatTime(msg.inserted_at);
3495
3565
  const label = [display.title, display.detail, time].filter(Boolean).join(", ");
3496
- const metaStyle = [styles15.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
3497
- return /* @__PURE__ */ jsxs(View, { style: styles15.wrap, accessible: true, accessibilityLabel: label, children: [
3566
+ const metaStyle = [styles16.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
3567
+ return /* @__PURE__ */ jsxs(View, { style: styles16.wrap, accessible: true, accessibilityLabel: label, children: [
3498
3568
  /* @__PURE__ */ jsxs(
3499
3569
  View,
3500
3570
  {
3501
3571
  style: [
3502
- styles15.chip,
3572
+ styles16.chip,
3503
3573
  {
3504
3574
  backgroundColor: theme.colors.surfaceAlt,
3505
3575
  borderColor: theme.colors.border
@@ -3511,7 +3581,7 @@ function CallLogRow({ msg, meId, onCallBack }) {
3511
3581
  Text,
3512
3582
  {
3513
3583
  style: [
3514
- styles15.title,
3584
+ styles16.title,
3515
3585
  {
3516
3586
  color: display.missed ? theme.colors.danger : theme.colors.textMuted,
3517
3587
  fontFamily: theme.fonts.body
@@ -3539,12 +3609,12 @@ function CallLogRow({ msg, meId, onCallBack }) {
3539
3609
  accessibilityRole: "button",
3540
3610
  accessibilityLabel: display.media === "video" ? "Video call back" : "Call back",
3541
3611
  hitSlop: 8,
3542
- style: ({ pressed }) => [styles15.callBack, pressed && styles15.callBackPressed],
3612
+ style: ({ pressed }) => [styles16.callBack, pressed && styles16.callBackPressed],
3543
3613
  children: /* @__PURE__ */ jsx(
3544
3614
  Text,
3545
3615
  {
3546
3616
  style: [
3547
- styles15.callBackText,
3617
+ styles16.callBackText,
3548
3618
  { color: theme.colors.accent, fontFamily: theme.fonts.body }
3549
3619
  ],
3550
3620
  children: "Call back"
@@ -3559,7 +3629,7 @@ function formatTime(iso) {
3559
3629
  if (Number.isNaN(d.getTime())) return "";
3560
3630
  return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
3561
3631
  }
3562
- var styles15 = StyleSheet.create({
3632
+ var styles16 = StyleSheet.create({
3563
3633
  wrap: {
3564
3634
  alignItems: "center",
3565
3635
  alignSelf: "stretch",
@@ -3593,6 +3663,403 @@ var styles15 = StyleSheet.create({
3593
3663
  fontVariant: ["tabular-nums"]
3594
3664
  }
3595
3665
  });
3666
+ function RecDot({ off = false, color }) {
3667
+ const theme = useTheme();
3668
+ const opacity = useRef(new Animated.Value(1)).current;
3669
+ useEffect(() => {
3670
+ if (off) return;
3671
+ let loop = null;
3672
+ let cancelled = false;
3673
+ void AccessibilityInfo.isReduceMotionEnabled?.().then((reduce) => {
3674
+ if (reduce || cancelled) return;
3675
+ loop = Animated.loop(
3676
+ Animated.sequence([
3677
+ Animated.timing(opacity, { toValue: 0.35, duration: 800, useNativeDriver: true }),
3678
+ Animated.timing(opacity, { toValue: 1, duration: 800, useNativeDriver: true })
3679
+ ])
3680
+ );
3681
+ loop.start();
3682
+ }).catch(() => {
3683
+ });
3684
+ return () => {
3685
+ cancelled = true;
3686
+ loop?.stop();
3687
+ };
3688
+ }, [off, opacity]);
3689
+ return /* @__PURE__ */ jsx(
3690
+ Animated.View,
3691
+ {
3692
+ style: [
3693
+ styles17.dot,
3694
+ {
3695
+ backgroundColor: off ? theme.colors.textSubtle : color ?? theme.colors.danger,
3696
+ opacity: off ? 1 : opacity
3697
+ }
3698
+ ]
3699
+ }
3700
+ );
3701
+ }
3702
+ function RecordingBanner({
3703
+ recording,
3704
+ transcribing = false,
3705
+ mode,
3706
+ consentRequired = false,
3707
+ myConsent,
3708
+ onStop,
3709
+ onChangeConsent,
3710
+ pending = false,
3711
+ style
3712
+ }) {
3713
+ const theme = useTheme();
3714
+ const label = captureLabel(recording, transcribing, mode);
3715
+ if (!label) return null;
3716
+ const listenOnly = consentRequired && myConsent === "declined";
3717
+ const meta = listenOnly ? "You declined \u2014 you are listen-only" : consentRequired ? "Only people who agreed are captured" : "Everyone in the call is told";
3718
+ const button = (text, onPress) => /* @__PURE__ */ jsx(
3719
+ Pressable,
3720
+ {
3721
+ onPress,
3722
+ disabled: pending,
3723
+ accessibilityRole: "button",
3724
+ accessibilityLabel: text === "Stop" ? "Stop recording" : "Change consent",
3725
+ hitSlop: 8,
3726
+ style: ({ pressed }) => [
3727
+ styles17.bannerBtn,
3728
+ { borderColor: theme.colors.border, backgroundColor: theme.colors.surface },
3729
+ (pressed || pending) && styles17.pressed
3730
+ ],
3731
+ children: /* @__PURE__ */ jsx(
3732
+ Text,
3733
+ {
3734
+ style: [styles17.bannerBtnText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3735
+ children: text
3736
+ }
3737
+ )
3738
+ }
3739
+ );
3740
+ return /* @__PURE__ */ jsxs(
3741
+ View,
3742
+ {
3743
+ style: [
3744
+ styles17.banner,
3745
+ { backgroundColor: theme.colors.surfaceAlt, borderColor: theme.colors.danger },
3746
+ style
3747
+ ],
3748
+ accessibilityRole: "summary",
3749
+ accessibilityLabel: `${label}. ${meta}`,
3750
+ children: [
3751
+ /* @__PURE__ */ jsx(RecDot, {}),
3752
+ /* @__PURE__ */ jsxs(View, { style: styles17.bannerText, children: [
3753
+ /* @__PURE__ */ jsx(
3754
+ Text,
3755
+ {
3756
+ style: [styles17.bannerTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3757
+ numberOfLines: 1,
3758
+ children: label
3759
+ }
3760
+ ),
3761
+ /* @__PURE__ */ jsx(
3762
+ Text,
3763
+ {
3764
+ style: [
3765
+ styles17.bannerMeta,
3766
+ { color: theme.colors.textMuted, fontFamily: theme.fonts.body }
3767
+ ],
3768
+ numberOfLines: 2,
3769
+ children: meta
3770
+ }
3771
+ )
3772
+ ] }),
3773
+ listenOnly && onChangeConsent ? button("Change", onChangeConsent) : null,
3774
+ recording && onStop ? button("Stop", onStop) : null
3775
+ ]
3776
+ }
3777
+ );
3778
+ }
3779
+ function RecordingIndicator({
3780
+ recording,
3781
+ transcribing = false,
3782
+ mode,
3783
+ color,
3784
+ style
3785
+ }) {
3786
+ const theme = useTheme();
3787
+ const label = captureLabel(recording, transcribing, mode);
3788
+ if (!label) return null;
3789
+ return /* @__PURE__ */ jsxs(
3790
+ View,
3791
+ {
3792
+ style: [styles17.indicator, style],
3793
+ accessible: true,
3794
+ accessibilityRole: "image",
3795
+ accessibilityLabel: label,
3796
+ children: [
3797
+ /* @__PURE__ */ jsx(RecDot, {}),
3798
+ /* @__PURE__ */ jsx(
3799
+ Text,
3800
+ {
3801
+ style: [
3802
+ styles17.indicatorText,
3803
+ { color: color ?? theme.colors.danger, fontFamily: theme.fonts.body }
3804
+ ],
3805
+ children: recording ? "REC" : "Transcript"
3806
+ }
3807
+ )
3808
+ ]
3809
+ }
3810
+ );
3811
+ }
3812
+ function ConsentPrompt({
3813
+ recording,
3814
+ transcribing = false,
3815
+ mode,
3816
+ startedByName,
3817
+ onAnswer,
3818
+ onAccepted,
3819
+ onDeclined,
3820
+ pending = false,
3821
+ error,
3822
+ overlay = true,
3823
+ style
3824
+ }) {
3825
+ const theme = useTheme();
3826
+ const [busy, setBusy] = useState(false);
3827
+ const [failed, setFailed] = useState(false);
3828
+ const what = recording && transcribing ? "recorded and transcribed" : recording ? mode === "audio" ? "recorded (audio)" : "recorded" : "transcribed";
3829
+ const title = `This call is being ${what}`;
3830
+ useEffect(() => {
3831
+ AccessibilityInfo.announceForAccessibility?.(title);
3832
+ }, [title]);
3833
+ const answer = async (decision) => {
3834
+ setBusy(true);
3835
+ setFailed(false);
3836
+ try {
3837
+ const ok = await onAnswer(decision);
3838
+ if (ok === false) {
3839
+ setFailed(true);
3840
+ return;
3841
+ }
3842
+ if (decision === "accepted") onAccepted?.();
3843
+ else onDeclined?.();
3844
+ } catch {
3845
+ setFailed(true);
3846
+ } finally {
3847
+ setBusy(false);
3848
+ }
3849
+ };
3850
+ const disabled = busy || pending;
3851
+ const shownError = error ?? (failed ? "That didn\u2019t go through. Try again." : null);
3852
+ const card = /* @__PURE__ */ jsxs(
3853
+ View,
3854
+ {
3855
+ style: [
3856
+ styles17.card,
3857
+ { backgroundColor: theme.colors.surface, borderColor: theme.colors.border },
3858
+ !overlay && style
3859
+ ],
3860
+ accessibilityViewIsModal: overlay,
3861
+ children: [
3862
+ /* @__PURE__ */ jsxs(View, { style: styles17.cardHead, children: [
3863
+ /* @__PURE__ */ jsx(RecDot, {}),
3864
+ /* @__PURE__ */ jsx(
3865
+ Text,
3866
+ {
3867
+ style: [styles17.cardTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3868
+ accessibilityRole: "header",
3869
+ children: title
3870
+ }
3871
+ )
3872
+ ] }),
3873
+ /* @__PURE__ */ jsxs(
3874
+ Text,
3875
+ {
3876
+ style: [styles17.cardBody, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }],
3877
+ children: [
3878
+ startedByName ? `${startedByName} started it. ` : "",
3879
+ "Your microphone and camera stay off until you agree. You can still hear and see everyone."
3880
+ ]
3881
+ }
3882
+ ),
3883
+ /* @__PURE__ */ jsxs(View, { style: styles17.cardActions, children: [
3884
+ /* @__PURE__ */ jsx(
3885
+ Pressable,
3886
+ {
3887
+ onPress: () => void answer("declined"),
3888
+ disabled,
3889
+ accessibilityRole: "button",
3890
+ accessibilityLabel: "Stay listen-only",
3891
+ style: ({ pressed }) => [
3892
+ styles17.cardBtn,
3893
+ { backgroundColor: theme.colors.surfaceAlt, borderColor: theme.colors.border },
3894
+ (pressed || disabled) && styles17.pressed
3895
+ ],
3896
+ children: /* @__PURE__ */ jsx(
3897
+ Text,
3898
+ {
3899
+ style: [styles17.cardBtnText, { color: theme.colors.text, fontFamily: theme.fonts.body }],
3900
+ children: "Stay listen-only"
3901
+ }
3902
+ )
3903
+ }
3904
+ ),
3905
+ /* @__PURE__ */ jsx(
3906
+ Pressable,
3907
+ {
3908
+ onPress: () => void answer("accepted"),
3909
+ disabled,
3910
+ accessibilityRole: "button",
3911
+ accessibilityLabel: "Agree to be recorded",
3912
+ style: ({ pressed }) => [
3913
+ styles17.cardBtn,
3914
+ { backgroundColor: theme.colors.accent, borderColor: theme.colors.accent },
3915
+ (pressed || disabled) && styles17.pressed
3916
+ ],
3917
+ children: /* @__PURE__ */ jsx(
3918
+ Text,
3919
+ {
3920
+ style: [
3921
+ styles17.cardBtnText,
3922
+ { color: theme.colors.accentText, fontFamily: theme.fonts.body }
3923
+ ],
3924
+ children: "Agree"
3925
+ }
3926
+ )
3927
+ }
3928
+ )
3929
+ ] }),
3930
+ shownError ? /* @__PURE__ */ jsx(
3931
+ Text,
3932
+ {
3933
+ style: [styles17.cardError, { color: theme.colors.danger, fontFamily: theme.fonts.body }],
3934
+ accessibilityLiveRegion: "assertive",
3935
+ children: shownError
3936
+ }
3937
+ ) : null
3938
+ ]
3939
+ }
3940
+ );
3941
+ if (!overlay) return card;
3942
+ return /* @__PURE__ */ jsx(View, { style: [styles17.scrim, { backgroundColor: theme.colors.overlay }, style], children: card });
3943
+ }
3944
+ function RecordingNoticeRow({ msg, meId, nameFor }) {
3945
+ const theme = useTheme();
3946
+ const display = recordingNoticeDisplayFor(msg, meId, nameFor);
3947
+ if (!display) return null;
3948
+ const time = formatTime2(msg.inserted_at);
3949
+ const label = [display.title, display.detail, time].filter(Boolean).join(", ");
3950
+ const metaStyle = [styles17.meta, { color: theme.colors.textSubtle, fontFamily: theme.fonts.body }];
3951
+ return /* @__PURE__ */ jsx(View, { style: styles17.noticeWrap, accessible: true, accessibilityLabel: label, children: /* @__PURE__ */ jsxs(
3952
+ View,
3953
+ {
3954
+ style: [
3955
+ styles17.chip,
3956
+ { backgroundColor: theme.colors.surfaceAlt, borderColor: theme.colors.border }
3957
+ ],
3958
+ children: [
3959
+ /* @__PURE__ */ jsx(RecDot, { off: display.event === "stopped" }),
3960
+ /* @__PURE__ */ jsx(
3961
+ Text,
3962
+ {
3963
+ style: [
3964
+ styles17.chipTitle,
3965
+ { color: theme.colors.textMuted, fontFamily: theme.fonts.body }
3966
+ ],
3967
+ numberOfLines: 1,
3968
+ children: display.title
3969
+ }
3970
+ ),
3971
+ display.detail ? /* @__PURE__ */ jsxs(Text, { style: metaStyle, numberOfLines: 1, children: [
3972
+ "\xB7 ",
3973
+ display.detail
3974
+ ] }) : null,
3975
+ time ? /* @__PURE__ */ jsxs(Text, { style: metaStyle, children: [
3976
+ "\xB7 ",
3977
+ time
3978
+ ] }) : null
3979
+ ]
3980
+ }
3981
+ ) });
3982
+ }
3983
+ function formatTime2(iso) {
3984
+ const d = new Date(iso);
3985
+ if (Number.isNaN(d.getTime())) return "";
3986
+ return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
3987
+ }
3988
+ var styles17 = StyleSheet.create({
3989
+ dot: { width: 8, height: 8, borderRadius: 4 },
3990
+ pressed: { opacity: 0.6 },
3991
+ banner: {
3992
+ flexDirection: "row",
3993
+ alignItems: "center",
3994
+ gap: 10,
3995
+ paddingHorizontal: 12,
3996
+ paddingVertical: 6,
3997
+ borderBottomWidth: StyleSheet.hairlineWidth
3998
+ },
3999
+ bannerText: { flex: 1, minWidth: 0 },
4000
+ bannerTitle: { fontSize: 13, fontWeight: "600" },
4001
+ bannerMeta: { fontSize: 12, fontWeight: "500" },
4002
+ bannerBtn: {
4003
+ paddingHorizontal: 12,
4004
+ paddingVertical: 4,
4005
+ borderRadius: 999,
4006
+ borderWidth: StyleSheet.hairlineWidth
4007
+ },
4008
+ bannerBtnText: { fontSize: 12, fontWeight: "600" },
4009
+ indicator: {
4010
+ flexDirection: "row",
4011
+ alignItems: "center",
4012
+ gap: 6,
4013
+ paddingHorizontal: 8,
4014
+ paddingVertical: 2,
4015
+ borderRadius: 999
4016
+ },
4017
+ indicatorText: { fontSize: 11, fontWeight: "700", letterSpacing: 0.4 },
4018
+ scrim: {
4019
+ ...StyleSheet.absoluteFillObject,
4020
+ zIndex: 20,
4021
+ alignItems: "center",
4022
+ justifyContent: "center",
4023
+ padding: 16
4024
+ },
4025
+ card: {
4026
+ width: "100%",
4027
+ maxWidth: 380,
4028
+ padding: 18,
4029
+ borderRadius: 16,
4030
+ borderWidth: StyleSheet.hairlineWidth
4031
+ },
4032
+ cardHead: { flexDirection: "row", alignItems: "center", gap: 10 },
4033
+ cardTitle: { flex: 1, fontSize: 16, fontWeight: "700" },
4034
+ cardBody: { marginTop: 8, marginBottom: 16, fontSize: 14, lineHeight: 20 },
4035
+ cardActions: { flexDirection: "row", flexWrap: "wrap", justifyContent: "flex-end", gap: 8 },
4036
+ cardBtn: {
4037
+ paddingHorizontal: 16,
4038
+ paddingVertical: 10,
4039
+ borderRadius: 999,
4040
+ borderWidth: StyleSheet.hairlineWidth
4041
+ },
4042
+ cardBtnText: { fontSize: 14, fontWeight: "600" },
4043
+ cardError: { marginTop: 10, fontSize: 13, fontWeight: "500" },
4044
+ noticeWrap: {
4045
+ alignItems: "center",
4046
+ alignSelf: "stretch",
4047
+ marginVertical: 6,
4048
+ paddingHorizontal: 16
4049
+ },
4050
+ chip: {
4051
+ flexDirection: "row",
4052
+ alignItems: "center",
4053
+ gap: 6,
4054
+ maxWidth: "100%",
4055
+ paddingHorizontal: 12,
4056
+ paddingVertical: 4,
4057
+ borderRadius: 999,
4058
+ borderWidth: StyleSheet.hairlineWidth
4059
+ },
4060
+ chipTitle: { fontSize: 11, fontWeight: "600", letterSpacing: 0.3, flexShrink: 1 },
4061
+ meta: { fontSize: 11, fontWeight: "500", letterSpacing: 0.3, flexShrink: 1 }
4062
+ });
3596
4063
  var forbidden = /* @__PURE__ */ new Set();
3597
4064
  function canShowEditHistory(messageId) {
3598
4065
  return !forbidden.has(messageId);
@@ -3633,12 +4100,12 @@ function EditHistorySheet({
3633
4100
  live = false;
3634
4101
  };
3635
4102
  }, [visible, messageId, chat]);
3636
- const entry = (key, label, body, when) => /* @__PURE__ */ jsxs(View, { style: [styles16.entry, { borderBottomColor: theme.colors.border }], children: [
3637
- /* @__PURE__ */ jsxs(View, { style: styles16.entryHead, children: [
3638
- /* @__PURE__ */ jsx(Text, { style: [styles16.entryLabel, { color: theme.colors.textMuted }], children: label }),
3639
- when ? /* @__PURE__ */ jsx(Text, { style: [styles16.entryTime, { color: theme.colors.textSubtle }], children: when }) : null
4103
+ const entry = (key, label, body, when) => /* @__PURE__ */ jsxs(View, { style: [styles18.entry, { borderBottomColor: theme.colors.border }], children: [
4104
+ /* @__PURE__ */ jsxs(View, { style: styles18.entryHead, children: [
4105
+ /* @__PURE__ */ jsx(Text, { style: [styles18.entryLabel, { color: theme.colors.textMuted }], children: label }),
4106
+ when ? /* @__PURE__ */ jsx(Text, { style: [styles18.entryTime, { color: theme.colors.textSubtle }], children: when }) : null
3640
4107
  ] }),
3641
- /* @__PURE__ */ jsx(Text, { style: [styles16.entryBody, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: body ?? "\u2014" })
4108
+ /* @__PURE__ */ jsx(Text, { style: [styles18.entryBody, { color: theme.colors.text, fontFamily: theme.fonts.body }], children: body ?? "\u2014" })
3642
4109
  ] }, key);
3643
4110
  return /* @__PURE__ */ jsx(
3644
4111
  Modal,
@@ -3651,14 +4118,14 @@ function EditHistorySheet({
3651
4118
  children: /* @__PURE__ */ jsx(
3652
4119
  Pressable,
3653
4120
  {
3654
- style: [styles16.backdrop, { backgroundColor: theme.colors.overlay }],
4121
+ style: [styles18.backdrop, { backgroundColor: theme.colors.overlay }],
3655
4122
  onPress: onClose,
3656
4123
  children: /* @__PURE__ */ jsxs(
3657
4124
  Pressable,
3658
4125
  {
3659
4126
  onPress: () => void 0,
3660
4127
  style: [
3661
- styles16.sheet,
4128
+ styles18.sheet,
3662
4129
  {
3663
4130
  backgroundColor: theme.colors.surface,
3664
4131
  borderTopLeftRadius: theme.radii.lg,
@@ -3673,12 +4140,12 @@ function EditHistorySheet({
3673
4140
  /* @__PURE__ */ jsx(
3674
4141
  Text,
3675
4142
  {
3676
- style: [styles16.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
4143
+ style: [styles18.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
3677
4144
  accessibilityRole: "header",
3678
4145
  children: "Edit history"
3679
4146
  }
3680
4147
  ),
3681
- failed ? /* @__PURE__ */ jsx(Text, { style: [styles16.status, { color: theme.colors.textMuted }], children: "Couldn't load the earlier versions." }) : edits === null ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent, style: styles16.spinner }) : /* @__PURE__ */ jsxs(ScrollView, { style: styles16.scroll, children: [
4148
+ failed ? /* @__PURE__ */ jsx(Text, { style: [styles18.status, { color: theme.colors.textMuted }], children: "Couldn't load the earlier versions." }) : edits === null ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors.accent, style: styles18.spinner }) : /* @__PURE__ */ jsxs(ScrollView, { style: styles18.scroll, children: [
3682
4149
  currentBody !== void 0 ? entry("current", "Current", currentBody, "") : null,
3683
4150
  edits.map(
3684
4151
  (e) => entry(
@@ -3688,7 +4155,7 @@ function EditHistorySheet({
3688
4155
  relativeTime(e.written_at)
3689
4156
  )
3690
4157
  ),
3691
- edits.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles16.status, { color: theme.colors.textMuted }], children: "No earlier versions." }) : null
4158
+ edits.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles18.status, { color: theme.colors.textMuted }], children: "No earlier versions." }) : null
3692
4159
  ] })
3693
4160
  ]
3694
4161
  }
@@ -3698,7 +4165,7 @@ function EditHistorySheet({
3698
4165
  }
3699
4166
  );
3700
4167
  }
3701
- var styles16 = StyleSheet.create({
4168
+ var styles18 = StyleSheet.create({
3702
4169
  backdrop: {
3703
4170
  flex: 1,
3704
4171
  justifyContent: "flex-end"
@@ -3776,7 +4243,7 @@ function AttachmentPreview({
3776
4243
  View,
3777
4244
  {
3778
4245
  style: [
3779
- styles17.imagePlaceholder,
4246
+ styles19.imagePlaceholder,
3780
4247
  {
3781
4248
  width: maxWidth,
3782
4249
  height: 200,
@@ -3796,7 +4263,7 @@ function AttachmentPreview({
3796
4263
  onPress,
3797
4264
  disabled: !onPress,
3798
4265
  style: [
3799
- styles17.fileCard,
4266
+ styles19.fileCard,
3800
4267
  {
3801
4268
  backgroundColor: onBrand ? "rgba(255,255,255,0.18)" : theme.colors.surfaceAlt,
3802
4269
  borderColor: onBrand ? "transparent" : theme.colors.border,
@@ -3809,12 +4276,12 @@ function AttachmentPreview({
3809
4276
  /* @__PURE__ */ jsx(
3810
4277
  Text,
3811
4278
  {
3812
- style: [styles17.fileName, { color: ink, fontFamily: theme.fonts.body }],
4279
+ style: [styles19.fileName, { color: ink, fontFamily: theme.fonts.body }],
3813
4280
  numberOfLines: 1,
3814
4281
  children: attachment.original_filename ?? "file"
3815
4282
  }
3816
4283
  ),
3817
- /* @__PURE__ */ jsx(Text, { style: [styles17.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes3(attachment.byte_size) })
4284
+ /* @__PURE__ */ jsx(Text, { style: [styles19.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }], children: formatBytes3(attachment.byte_size) })
3818
4285
  ] })
3819
4286
  ]
3820
4287
  }
@@ -3826,7 +4293,7 @@ function formatBytes3(n) {
3826
4293
  if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;
3827
4294
  return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
3828
4295
  }
3829
- var styles17 = StyleSheet.create({
4296
+ var styles19 = StyleSheet.create({
3830
4297
  imagePlaceholder: {},
3831
4298
  fileCard: {
3832
4299
  flexDirection: "row",
@@ -3862,7 +4329,7 @@ function ImageMosaic({
3862
4329
  View,
3863
4330
  {
3864
4331
  style: [
3865
- styles18.root,
4332
+ styles20.root,
3866
4333
  {
3867
4334
  borderTopLeftRadius: r,
3868
4335
  borderTopRightRadius: r,
@@ -3883,18 +4350,18 @@ function ImageMosaic({
3883
4350
  {
3884
4351
  onLongPress,
3885
4352
  attachment: visible[0],
3886
- style: styles18.tileFull,
4353
+ style: styles20.tileFull,
3887
4354
  onPress: () => setViewerIndex(0),
3888
4355
  overlay: null
3889
4356
  }
3890
4357
  ) : null,
3891
- n === 2 ? /* @__PURE__ */ jsxs(View, { style: styles18.rowEven, children: [
4358
+ n === 2 ? /* @__PURE__ */ jsxs(View, { style: styles20.rowEven, children: [
3892
4359
  /* @__PURE__ */ jsx(
3893
4360
  Tile,
3894
4361
  {
3895
4362
  onLongPress,
3896
4363
  attachment: visible[0],
3897
- style: styles18.tileHalfSquare,
4364
+ style: styles20.tileHalfSquare,
3898
4365
  onPress: () => setViewerIndex(0),
3899
4366
  overlay: null
3900
4367
  }
@@ -3904,7 +4371,7 @@ function ImageMosaic({
3904
4371
  {
3905
4372
  onLongPress,
3906
4373
  attachment: visible[1],
3907
- style: styles18.tileHalfSquare,
4374
+ style: styles20.tileHalfSquare,
3908
4375
  onPress: () => setViewerIndex(1),
3909
4376
  overlay: null
3910
4377
  }
@@ -3916,18 +4383,18 @@ function ImageMosaic({
3916
4383
  {
3917
4384
  onLongPress,
3918
4385
  attachment: visible[0],
3919
- style: styles18.tileHero,
4386
+ style: styles20.tileHero,
3920
4387
  onPress: () => setViewerIndex(0),
3921
4388
  overlay: null
3922
4389
  }
3923
4390
  ),
3924
- /* @__PURE__ */ jsxs(View, { style: [styles18.rowEven, { marginTop: 2 }], children: [
4391
+ /* @__PURE__ */ jsxs(View, { style: [styles20.rowEven, { marginTop: 2 }], children: [
3925
4392
  /* @__PURE__ */ jsx(
3926
4393
  Tile,
3927
4394
  {
3928
4395
  onLongPress,
3929
4396
  attachment: visible[1],
3930
- style: styles18.tileHalfSquare,
4397
+ style: styles20.tileHalfSquare,
3931
4398
  onPress: () => setViewerIndex(1),
3932
4399
  overlay: null
3933
4400
  }
@@ -3937,7 +4404,7 @@ function ImageMosaic({
3937
4404
  {
3938
4405
  onLongPress,
3939
4406
  attachment: visible[2],
3940
- style: styles18.tileHalfSquare,
4407
+ style: styles20.tileHalfSquare,
3941
4408
  onPress: () => setViewerIndex(2),
3942
4409
  overlay: null
3943
4410
  }
@@ -3945,13 +4412,13 @@ function ImageMosaic({
3945
4412
  ] })
3946
4413
  ] }) : null,
3947
4414
  n === 4 ? /* @__PURE__ */ jsxs(Fragment, { children: [
3948
- /* @__PURE__ */ jsxs(View, { style: styles18.rowEven, children: [
4415
+ /* @__PURE__ */ jsxs(View, { style: styles20.rowEven, children: [
3949
4416
  /* @__PURE__ */ jsx(
3950
4417
  Tile,
3951
4418
  {
3952
4419
  onLongPress,
3953
4420
  attachment: visible[0],
3954
- style: styles18.tileHalfSquare,
4421
+ style: styles20.tileHalfSquare,
3955
4422
  onPress: () => setViewerIndex(0),
3956
4423
  overlay: null
3957
4424
  }
@@ -3961,19 +4428,19 @@ function ImageMosaic({
3961
4428
  {
3962
4429
  onLongPress,
3963
4430
  attachment: visible[1],
3964
- style: styles18.tileHalfSquare,
4431
+ style: styles20.tileHalfSquare,
3965
4432
  onPress: () => setViewerIndex(1),
3966
4433
  overlay: null
3967
4434
  }
3968
4435
  )
3969
4436
  ] }),
3970
- /* @__PURE__ */ jsxs(View, { style: [styles18.rowEven, { marginTop: 2 }], children: [
4437
+ /* @__PURE__ */ jsxs(View, { style: [styles20.rowEven, { marginTop: 2 }], children: [
3971
4438
  /* @__PURE__ */ jsx(
3972
4439
  Tile,
3973
4440
  {
3974
4441
  onLongPress,
3975
4442
  attachment: visible[2],
3976
- style: styles18.tileHalfSquare,
4443
+ style: styles20.tileHalfSquare,
3977
4444
  onPress: () => setViewerIndex(2),
3978
4445
  overlay: null
3979
4446
  }
@@ -3983,7 +4450,7 @@ function ImageMosaic({
3983
4450
  {
3984
4451
  onLongPress,
3985
4452
  attachment: visible[3],
3986
- style: styles18.tileHalfSquare,
4453
+ style: styles20.tileHalfSquare,
3987
4454
  onPress: () => setViewerIndex(3),
3988
4455
  overlay: overflow > 0 ? `+${overflow}` : null
3989
4456
  }
@@ -4021,18 +4488,18 @@ function Tile({
4021
4488
  }) {
4022
4489
  const theme = useTheme();
4023
4490
  const { url } = useAttachmentUrl(attachment.id);
4024
- return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles18.tileBase, style], children: [
4491
+ return /* @__PURE__ */ jsxs(Pressable, { onPress, onLongPress, style: [styles20.tileBase, style], children: [
4025
4492
  url ? /* @__PURE__ */ jsx(
4026
4493
  Image,
4027
4494
  {
4028
4495
  source: { uri: url },
4029
- style: [styles18.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
4496
+ style: [styles20.tileImage, { backgroundColor: theme.colors.surfaceAlt }],
4030
4497
  resizeMode: "cover",
4031
4498
  accessible: true,
4032
4499
  accessibilityLabel: attachment.original_filename ?? "image"
4033
4500
  }
4034
- ) : /* @__PURE__ */ jsx(View, { style: [styles18.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
4035
- overlay ? /* @__PURE__ */ jsx(View, { style: styles18.overflow, children: /* @__PURE__ */ jsx(Text, { style: styles18.overflowText, children: overlay }) }) : null
4501
+ ) : /* @__PURE__ */ jsx(View, { style: [styles20.tileImage, { backgroundColor: theme.colors.surfaceAlt }] }),
4502
+ overlay ? /* @__PURE__ */ jsx(View, { style: styles20.overflow, children: /* @__PURE__ */ jsx(Text, { style: styles20.overflowText, children: overlay }) }) : null
4036
4503
  ] });
4037
4504
  }
4038
4505
  function FullScreenViewer({
@@ -4042,7 +4509,7 @@ function FullScreenViewer({
4042
4509
  const { url } = useAttachmentUrl(attachment.id);
4043
4510
  const { width, height } = useWindowDimensions();
4044
4511
  const insets = useSafeInsets();
4045
- return /* @__PURE__ */ jsxs(Pressable, { style: styles18.viewer, onPress: onClose, children: [
4512
+ return /* @__PURE__ */ jsxs(Pressable, { style: styles20.viewer, onPress: onClose, children: [
4046
4513
  url ? /* @__PURE__ */ jsx(
4047
4514
  Image,
4048
4515
  {
@@ -4058,14 +4525,14 @@ function FullScreenViewer({
4058
4525
  {
4059
4526
  onPress: onClose,
4060
4527
  hitSlop: 12,
4061
- style: [styles18.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
4528
+ style: [styles20.closeBtn, { top: insets.top + 12, right: insets.right + 16 }],
4062
4529
  accessibilityLabel: "Close viewer",
4063
4530
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 20, color: "#ffffff" })
4064
4531
  }
4065
4532
  )
4066
4533
  ] });
4067
4534
  }
4068
- var styles18 = StyleSheet.create({
4535
+ var styles20 = StyleSheet.create({
4069
4536
  root: {
4070
4537
  width: "100%",
4071
4538
  overflow: "hidden",
@@ -4238,7 +4705,7 @@ function LinkPreviewCard({
4238
4705
  {
4239
4706
  onPress: onRemove,
4240
4707
  hitSlop: 8,
4241
- style: [styles19.remove, { backgroundColor: theme.colors.overlay }],
4708
+ style: [styles21.remove, { backgroundColor: theme.colors.overlay }],
4242
4709
  accessibilityRole: "button",
4243
4710
  accessibilityLabel: "Remove preview",
4244
4711
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 12, color: "#FFFFFF", label: null })
@@ -4254,13 +4721,13 @@ function LinkPreviewCard({
4254
4721
  ...onLongPress ? { onLongPress } : {},
4255
4722
  accessibilityRole: "link",
4256
4723
  accessibilityLabel: preview.title || "Image link",
4257
- style: [styles19.imageOnly, { maxWidth, borderRadius: theme.radii.md }],
4724
+ style: [styles21.imageOnly, { maxWidth, borderRadius: theme.radii.md }],
4258
4725
  children: [
4259
4726
  /* @__PURE__ */ jsx(
4260
4727
  Image,
4261
4728
  {
4262
4729
  source: { uri: src },
4263
- style: [styles19.inlineImage, { borderRadius: theme.radii.md }],
4730
+ style: [styles21.inlineImage, { borderRadius: theme.radii.md }],
4264
4731
  resizeMode: "cover",
4265
4732
  onError: () => setImageFailed(true),
4266
4733
  accessible: false
@@ -4280,7 +4747,7 @@ function LinkPreviewCard({
4280
4747
  accessibilityRole: "link",
4281
4748
  accessibilityLabel: [site, preview.title].filter(Boolean).join(": ") || preview.url,
4282
4749
  style: ({ pressed }) => [
4283
- styles19.card,
4750
+ styles21.card,
4284
4751
  {
4285
4752
  maxWidth,
4286
4753
  borderRadius: theme.radii.md,
@@ -4295,7 +4762,7 @@ function LinkPreviewCard({
4295
4762
  {
4296
4763
  source: { uri: preview.image_url },
4297
4764
  style: [
4298
- styles19.cardImage,
4765
+ styles21.cardImage,
4299
4766
  { borderTopLeftRadius: theme.radii.md, borderTopRightRadius: theme.radii.md }
4300
4767
  ],
4301
4768
  resizeMode: "cover",
@@ -4303,13 +4770,13 @@ function LinkPreviewCard({
4303
4770
  accessible: false
4304
4771
  }
4305
4772
  ) : null,
4306
- /* @__PURE__ */ jsxs(View, { style: [styles19.cardBody, { padding: theme.spacing.sm, gap: 2 }], children: [
4307
- /* @__PURE__ */ jsxs(View, { style: styles19.siteLine, children: [
4773
+ /* @__PURE__ */ jsxs(View, { style: [styles21.cardBody, { padding: theme.spacing.sm, gap: 2 }], children: [
4774
+ /* @__PURE__ */ jsxs(View, { style: styles21.siteLine, children: [
4308
4775
  preview.favicon_url && !faviconFailed ? /* @__PURE__ */ jsx(
4309
4776
  Image,
4310
4777
  {
4311
4778
  source: { uri: preview.favicon_url },
4312
- style: styles19.favicon,
4779
+ style: styles21.favicon,
4313
4780
  onError: () => setFaviconFailed(true),
4314
4781
  accessible: false
4315
4782
  }
@@ -4317,7 +4784,7 @@ function LinkPreviewCard({
4317
4784
  /* @__PURE__ */ jsx(
4318
4785
  Text,
4319
4786
  {
4320
- style: [styles19.site, { color: muted, fontFamily: theme.fonts.body }],
4787
+ style: [styles21.site, { color: muted, fontFamily: theme.fonts.body }],
4321
4788
  numberOfLines: 1,
4322
4789
  children: site
4323
4790
  }
@@ -4327,7 +4794,7 @@ function LinkPreviewCard({
4327
4794
  Text,
4328
4795
  {
4329
4796
  style: [
4330
- styles19.title,
4797
+ styles21.title,
4331
4798
  { color: onBrand ? text : theme.colors.link, fontFamily: theme.fonts.body }
4332
4799
  ],
4333
4800
  numberOfLines: 2,
@@ -4337,7 +4804,7 @@ function LinkPreviewCard({
4337
4804
  preview.description ? /* @__PURE__ */ jsx(
4338
4805
  Text,
4339
4806
  {
4340
- style: [styles19.description, { color: muted, fontFamily: theme.fonts.body }],
4807
+ style: [styles21.description, { color: muted, fontFamily: theme.fonts.body }],
4341
4808
  numberOfLines: 2,
4342
4809
  children: preview.description
4343
4810
  }
@@ -4352,7 +4819,7 @@ function hostOf(url) {
4352
4819
  const m = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(url);
4353
4820
  return (m?.[1] ?? url).replace(/^www\./, "");
4354
4821
  }
4355
- var styles19 = StyleSheet.create({
4822
+ var styles21 = StyleSheet.create({
4356
4823
  card: {
4357
4824
  alignSelf: "stretch",
4358
4825
  borderLeftWidth: 3,
@@ -4459,7 +4926,7 @@ function MessageBubble({
4459
4926
  const isEdited = !!message.edited_at && !isDeleted;
4460
4927
  const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;
4461
4928
  const truncated = trimmable && !expanded ? body.slice(0, maxBodyLength) + "\u2026" : body;
4462
- const time = formatTime2(message.inserted_at, timeFormat);
4929
+ const time = formatTime3(message.inserted_at, timeFormat);
4463
4930
  const images = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
4464
4931
  const files = showAttachments && !isDeleted ? (message.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
4465
4932
  const hasMedia = images.length > 0;
@@ -4478,16 +4945,16 @@ function MessageBubble({
4478
4945
  View,
4479
4946
  {
4480
4947
  style: [
4481
- styles20.metaRow,
4482
- variant === "inline" && styles20.metaInline,
4483
- variant === "inline" && dense && styles20.metaInlineDense,
4484
- variant === "wrapped" && styles20.metaWrapped,
4485
- variant === "overlay" && styles20.metaOverlay,
4486
- variant === "block" && styles20.metaBlock,
4948
+ styles22.metaRow,
4949
+ variant === "inline" && styles22.metaInline,
4950
+ variant === "inline" && dense && styles22.metaInlineDense,
4951
+ variant === "wrapped" && styles22.metaWrapped,
4952
+ variant === "overlay" && styles22.metaOverlay,
4953
+ variant === "block" && styles22.metaBlock,
4487
4954
  // File-only bubble: the meta row follows the cards directly —
4488
4955
  // give it air so the time doesn't sit glued to the card.
4489
- variant === "block" && hasFiles && !hasBody && styles20.metaBlockAfterFiles,
4490
- variant === "jumbo" && styles20.metaJumbo
4956
+ variant === "block" && hasFiles && !hasBody && styles22.metaBlockAfterFiles,
4957
+ variant === "jumbo" && styles22.metaJumbo
4491
4958
  ],
4492
4959
  onLayout: variant === "inline" || variant === "wrapped" ? (e) => setMetaWidth(e.nativeEvent.layout.width) : void 0,
4493
4960
  pointerEvents: isEdited && onEditedPress ? "box-none" : "none",
@@ -4495,7 +4962,7 @@ function MessageBubble({
4495
4962
  isEdited ? /* @__PURE__ */ jsx(
4496
4963
  Text,
4497
4964
  {
4498
- style: [styles20.editedTag, { color, opacity: 0.8 }],
4965
+ style: [styles22.editedTag, { color, opacity: 0.8 }],
4499
4966
  ...onEditedPress ? {
4500
4967
  onPress: onEditedPress,
4501
4968
  suppressHighlighting: true,
@@ -4506,8 +4973,8 @@ function MessageBubble({
4506
4973
  children: "edited"
4507
4974
  }
4508
4975
  ) : null,
4509
- /* @__PURE__ */ jsx(Text, { style: [styles20.meta, { color, opacity: variant === "overlay" ? 1 : 0.75 }], children: time }),
4510
- isSelf && readState ? /* @__PURE__ */ jsx(View, { style: styles20.readTick, children: /* @__PURE__ */ jsx(
4976
+ /* @__PURE__ */ jsx(Text, { style: [styles22.meta, { color, opacity: variant === "overlay" ? 1 : 0.75 }], children: time }),
4977
+ isSelf && readState ? /* @__PURE__ */ jsx(View, { style: styles22.readTick, children: /* @__PURE__ */ jsx(
4511
4978
  PoolseIcon,
4512
4979
  {
4513
4980
  name: readState === "read" ? "check-double" : "check",
@@ -4523,7 +4990,7 @@ function MessageBubble({
4523
4990
  View,
4524
4991
  {
4525
4992
  style: [
4526
- styles20.wrap,
4993
+ styles22.wrap,
4527
4994
  { alignSelf: isSelf ? "flex-end" : "flex-start", maxWidth: bubbleMaxWidth }
4528
4995
  ],
4529
4996
  children: [
@@ -4549,7 +5016,7 @@ function MessageBubble({
4549
5016
  showSenderName && !isSelf && jumboCount === 0 && (groupPosition === "first" || groupPosition === "standalone") ? /* @__PURE__ */ jsx(
4550
5017
  Text,
4551
5018
  {
4552
- style: [styles20.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
5019
+ style: [styles22.senderName, { color: senderTint, fontFamily: theme.fonts.body }],
4553
5020
  ...onSenderPress ? {
4554
5021
  onPress: onSenderPress,
4555
5022
  accessibilityRole: "button",
@@ -4576,7 +5043,7 @@ function MessageBubble({
4576
5043
  // 3px of bubble color framing the picture; the mosaic clips
4577
5044
  // itself 3px tighter than the bubble so the curves stay
4578
5045
  // concentric.
4579
- /* @__PURE__ */ jsxs(View, { style: styles20.mediaFrame, children: [
5046
+ /* @__PURE__ */ jsxs(View, { style: styles22.mediaFrame, children: [
4580
5047
  /* @__PURE__ */ jsx(
4581
5048
  ImageMosaic,
4582
5049
  {
@@ -4590,7 +5057,7 @@ function MessageBubble({
4590
5057
  metaOverlay ? metaRow("overlay") : null
4591
5058
  ] })
4592
5059
  ) : null,
4593
- hasFiles ? /* @__PURE__ */ jsx(View, { style: styles20.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
5060
+ hasFiles ? /* @__PURE__ */ jsx(View, { style: styles22.filesBlock, children: files.map((att) => /* @__PURE__ */ jsx(
4594
5061
  AttachmentPreview,
4595
5062
  {
4596
5063
  attachment: att,
@@ -4609,9 +5076,9 @@ function MessageBubble({
4609
5076
  View,
4610
5077
  {
4611
5078
  style: [
4612
- styles20.textBlock,
4613
- dense && styles20.textBlockDense,
4614
- sectionAbove && styles20.textBlockAfter
5079
+ styles22.textBlock,
5080
+ dense && styles22.textBlockDense,
5081
+ sectionAbove && styles22.textBlockAfter
4615
5082
  ],
4616
5083
  children: /* @__PURE__ */ jsx(
4617
5084
  Text,
@@ -4629,7 +5096,7 @@ function MessageBubble({
4629
5096
  )
4630
5097
  }
4631
5098
  ) : null,
4632
- hasBody && jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles20.jumboBlock, children: /* @__PURE__ */ jsx(
5099
+ hasBody && jumboCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles22.jumboBlock, children: /* @__PURE__ */ jsx(
4633
5100
  Text,
4634
5101
  {
4635
5102
  style: {
@@ -4643,9 +5110,9 @@ function MessageBubble({
4643
5110
  View,
4644
5111
  {
4645
5112
  style: [
4646
- styles20.textBlock,
4647
- dense && styles20.textBlockDense,
4648
- sectionAbove && styles20.textBlockAfter
5113
+ styles22.textBlock,
5114
+ dense && styles22.textBlockDense,
5115
+ sectionAbove && styles22.textBlockAfter
4649
5116
  ],
4650
5117
  onLayout: inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : void 0,
4651
5118
  children: [
@@ -4680,7 +5147,7 @@ function MessageBubble({
4680
5147
  Text,
4681
5148
  {
4682
5149
  style: [
4683
- styles20.readMore,
5150
+ styles22.readMore,
4684
5151
  { color: isSelf ? theme.colors.ownBubbleText : theme.colors.link }
4685
5152
  ],
4686
5153
  children: expanded ? "Show less" : "Read more"
@@ -4695,7 +5162,7 @@ function MessageBubble({
4695
5162
  hasPreviews ? (
4696
5163
  // A fixed width, like media: a card squeezed into the width of
4697
5164
  // a one-word message would be unreadable.
4698
- /* @__PURE__ */ jsx(View, { style: [styles20.previews, !hasBody && styles20.previewsAlone, { width: mediaWidth }], children: previews.map((p) => /* @__PURE__ */ jsx(
5165
+ /* @__PURE__ */ jsx(View, { style: [styles22.previews, !hasBody && styles22.previewsAlone, { width: mediaWidth }], children: previews.map((p) => /* @__PURE__ */ jsx(
4699
5166
  LinkPreviewCard,
4700
5167
  {
4701
5168
  preview: p,
@@ -4707,7 +5174,7 @@ function MessageBubble({
4707
5174
  )) })
4708
5175
  ) : null,
4709
5176
  !inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow("block") : null,
4710
- actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles20.actionsSlot, children: actionsTrigger }) : null
5177
+ actionsTrigger ? /* @__PURE__ */ jsx(View, { style: styles22.actionsSlot, children: actionsTrigger }) : null
4711
5178
  ]
4712
5179
  }
4713
5180
  ),
@@ -4734,15 +5201,15 @@ function QuotedCard({
4734
5201
  onPress,
4735
5202
  disabled: !onPress,
4736
5203
  style: [
4737
- styles20.quoted,
5204
+ styles22.quoted,
4738
5205
  {
4739
5206
  backgroundColor: bg,
4740
5207
  borderLeftColor: accent
4741
5208
  }
4742
5209
  ],
4743
5210
  children: [
4744
- /* @__PURE__ */ jsx(Text, { style: [styles20.quotedSender, { color: accent }], numberOfLines: 1, children: senderName }),
4745
- /* @__PURE__ */ jsx(Text, { style: [styles20.quotedBody, { color: txt }], numberOfLines: 2, children: quoted.deleted_at ? "Original message deleted" : quoted.body ?? "\u2026" })
5211
+ /* @__PURE__ */ jsx(Text, { style: [styles22.quotedSender, { color: accent }], numberOfLines: 1, children: senderName }),
5212
+ /* @__PURE__ */ jsx(Text, { style: [styles22.quotedBody, { color: txt }], numberOfLines: 2, children: quoted.deleted_at ? "Original message deleted" : quoted.body ?? "\u2026" })
4746
5213
  ]
4747
5214
  }
4748
5215
  );
@@ -4751,7 +5218,7 @@ function isImageContentType(ct) {
4751
5218
  if (!ct) return false;
4752
5219
  return ct.startsWith("image/");
4753
5220
  }
4754
- function formatTime2(iso, format2) {
5221
+ function formatTime3(iso, format2) {
4755
5222
  try {
4756
5223
  const d = new Date(iso);
4757
5224
  if (typeof format2 === "function") return format2(d);
@@ -4775,7 +5242,7 @@ function formatTime2(iso, format2) {
4775
5242
  function isSameDay(a, b) {
4776
5243
  return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
4777
5244
  }
4778
- var styles20 = StyleSheet.create({
5245
+ var styles22 = StyleSheet.create({
4779
5246
  wrap: {
4780
5247
  marginBottom: 2
4781
5248
  },
@@ -4902,6 +5369,24 @@ var styles20 = StyleSheet.create({
4902
5369
  opacity: 0.8
4903
5370
  }
4904
5371
  });
5372
+
5373
+ // src/internal/a11y.ts
5374
+ function messageA11yLabel(msg, senderName, isSelf) {
5375
+ const who = isSelf ? "You" : senderName;
5376
+ if (msg.deleted_at) return `${who}: message deleted`;
5377
+ const parts = [];
5378
+ const body = (msg.body ?? "").trim();
5379
+ if (body) parts.push(body.length > 300 ? `${body.slice(0, 300)}\u2026` : body);
5380
+ const files = Array.isArray(msg.attachments) ? msg.attachments.length : 0;
5381
+ if (files > 0) parts.push(files === 1 ? "1 attachment" : `${files} attachments`);
5382
+ if (msg.edited_at) parts.push("edited");
5383
+ if (msg.local_status === "queued") parts.push("waiting for network");
5384
+ if (msg.local_status === "failed") parts.push("not sent");
5385
+ return `${who}: ${parts.join(", ") || "message"}`;
5386
+ }
5387
+ function reactionA11yLabel(emoji, count, mine) {
5388
+ return `${emoji} ${count}${mine ? ", you reacted" : ""}`;
5389
+ }
4905
5390
  var DEFAULT_EMOJIS = ["\u{1F44D}", "\u2764\uFE0F", "\u{1F602}", "\u{1F389}", "\u{1F64F}", "\u{1F525}"];
4906
5391
  function ReactionStrip({
4907
5392
  messageId,
@@ -4918,7 +5403,7 @@ function ReactionStrip({
4918
5403
  });
4919
5404
  const entries = Object.entries(reactions);
4920
5405
  if (entries.length === 0) return null;
4921
- return /* @__PURE__ */ jsxs(View, { style: styles21.strip, children: [
5406
+ return /* @__PURE__ */ jsxs(View, { style: styles23.strip, children: [
4922
5407
  entries.map(([emoji, userIds]) => {
4923
5408
  const userArr = Array.isArray(userIds) ? userIds : [];
4924
5409
  const meReacted = meId !== null && userArr.includes(meId);
@@ -4926,8 +5411,12 @@ function ReactionStrip({
4926
5411
  Pressable,
4927
5412
  {
4928
5413
  onPress: () => meReacted ? removeReaction(emoji) : addReaction(emoji),
5414
+ accessibilityRole: "button",
5415
+ accessibilityLabel: reactionA11yLabel(emoji, userArr.length, meReacted),
5416
+ accessibilityState: { selected: meReacted },
5417
+ accessibilityHint: meReacted ? "Removes your reaction" : "Adds this reaction",
4929
5418
  style: [
4930
- styles21.chip,
5419
+ styles23.chip,
4931
5420
  {
4932
5421
  backgroundColor: meReacted ? theme.colors.accentSoft : theme.colors.surfaceAlt,
4933
5422
  borderColor: meReacted ? theme.colors.accent : theme.colors.border,
@@ -4936,12 +5425,12 @@ function ReactionStrip({
4936
5425
  }
4937
5426
  ],
4938
5427
  children: [
4939
- /* @__PURE__ */ jsx(Text, { style: styles21.emoji, children: emoji }),
5428
+ /* @__PURE__ */ jsx(Text, { style: styles23.emoji, children: emoji }),
4940
5429
  /* @__PURE__ */ jsx(
4941
5430
  Text,
4942
5431
  {
4943
5432
  style: [
4944
- styles21.count,
5433
+ styles23.count,
4945
5434
  {
4946
5435
  color: meReacted ? theme.colors.accent : theme.colors.textMuted,
4947
5436
  fontWeight: meReacted ? "700" : "600"
@@ -4961,7 +5450,7 @@ function ReactionStrip({
4961
5450
  onPress: onMorePress,
4962
5451
  hitSlop: 4,
4963
5452
  style: [
4964
- styles21.chip,
5453
+ styles23.chip,
4965
5454
  {
4966
5455
  backgroundColor: theme.colors.surfaceAlt,
4967
5456
  borderColor: theme.colors.border,
@@ -4994,13 +5483,13 @@ function ReactionPicker({
4994
5483
  children: /* @__PURE__ */ jsx(
4995
5484
  Pressable,
4996
5485
  {
4997
- style: [styles21.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }],
5486
+ style: [styles23.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }],
4998
5487
  onPress: onClose,
4999
5488
  children: /* @__PURE__ */ jsx(
5000
5489
  View,
5001
5490
  {
5002
5491
  style: [
5003
- styles21.sheet,
5492
+ styles23.sheet,
5004
5493
  {
5005
5494
  backgroundColor: theme.colors.surface,
5006
5495
  borderRadius: theme.radii.lg
@@ -5010,12 +5499,12 @@ function ReactionPicker({
5010
5499
  children: emojis.map((emoji) => /* @__PURE__ */ jsx(
5011
5500
  Pressable,
5012
5501
  {
5013
- style: styles21.emojiBtn,
5502
+ style: styles23.emojiBtn,
5014
5503
  onPress: () => {
5015
5504
  onPick(emoji);
5016
5505
  onClose();
5017
5506
  },
5018
- children: /* @__PURE__ */ jsx(Text, { style: styles21.bigEmoji, children: emoji })
5507
+ children: /* @__PURE__ */ jsx(Text, { style: styles23.bigEmoji, children: emoji })
5019
5508
  },
5020
5509
  emoji
5021
5510
  ))
@@ -5026,7 +5515,7 @@ function ReactionPicker({
5026
5515
  }
5027
5516
  );
5028
5517
  }
5029
- var styles21 = StyleSheet.create({
5518
+ var styles23 = StyleSheet.create({
5030
5519
  strip: {
5031
5520
  flexDirection: "row",
5032
5521
  flexWrap: "wrap",
@@ -5082,6 +5571,69 @@ var styles21 = StyleSheet.create({
5082
5571
  lineHeight: 38
5083
5572
  }
5084
5573
  });
5574
+ function SendStatus({ message, onRetry, onDiscard, alignEnd = true }) {
5575
+ const theme = useTheme();
5576
+ const status = message.local_status;
5577
+ if (status !== "queued" && status !== "failed") return null;
5578
+ const failed = status === "failed";
5579
+ const text = failed ? message.local_error ? `Not sent: ${message.local_error}` : "Not sent" : "Waiting for network\u2026";
5580
+ const button = (label, onPress, danger = false) => /* @__PURE__ */ jsx(
5581
+ Pressable,
5582
+ {
5583
+ onPress,
5584
+ accessibilityRole: "button",
5585
+ accessibilityLabel: `${label} message`,
5586
+ hitSlop: 8,
5587
+ style: styles24.button,
5588
+ children: /* @__PURE__ */ jsx(
5589
+ Text,
5590
+ {
5591
+ style: [
5592
+ styles24.buttonText,
5593
+ { color: danger ? theme.colors.danger : theme.colors.accentStrong },
5594
+ { fontFamily: theme.fonts.body }
5595
+ ],
5596
+ children: label
5597
+ }
5598
+ )
5599
+ }
5600
+ );
5601
+ return /* @__PURE__ */ jsxs(
5602
+ View,
5603
+ {
5604
+ style: [styles24.root, { justifyContent: alignEnd ? "flex-end" : "flex-start" }],
5605
+ accessibilityLiveRegion: "polite",
5606
+ children: [
5607
+ /* @__PURE__ */ jsx(
5608
+ Text,
5609
+ {
5610
+ style: [
5611
+ styles24.text,
5612
+ { color: failed ? theme.colors.danger : theme.colors.textMuted },
5613
+ { fontFamily: theme.fonts.body }
5614
+ ],
5615
+ children: text
5616
+ }
5617
+ ),
5618
+ onRetry ? button(failed ? "Retry" : "Send now", onRetry) : null,
5619
+ failed && onDiscard ? button("Delete", onDiscard, true) : null
5620
+ ]
5621
+ }
5622
+ );
5623
+ }
5624
+ var styles24 = StyleSheet.create({
5625
+ root: {
5626
+ flexDirection: "row",
5627
+ flexWrap: "wrap",
5628
+ alignItems: "center",
5629
+ gap: 10,
5630
+ marginTop: 2,
5631
+ marginBottom: 4
5632
+ },
5633
+ text: { fontSize: 12, flexShrink: 1 },
5634
+ button: { paddingVertical: 2 },
5635
+ buttonText: { fontSize: 12, fontWeight: "700" }
5636
+ });
5085
5637
 
5086
5638
  // src/internal/thread.ts
5087
5639
  function threadSummaryText(replyCount, lastReplyAt, now = Date.now()) {
@@ -5122,7 +5674,7 @@ function ThreadSummary({
5122
5674
  accessibilityLabel: `${label}. Open thread`,
5123
5675
  hitSlop: 4,
5124
5676
  style: ({ pressed }) => [
5125
- styles22.row,
5677
+ styles25.row,
5126
5678
  {
5127
5679
  alignSelf: alignEnd ? "flex-end" : "flex-start",
5128
5680
  borderRadius: theme.radii.pill,
@@ -5130,11 +5682,11 @@ function ThreadSummary({
5130
5682
  }
5131
5683
  ],
5132
5684
  children: [
5133
- people.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles22.stack, children: people.map((p, i) => /* @__PURE__ */ jsx(
5685
+ people.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles25.stack, children: people.map((p, i) => /* @__PURE__ */ jsx(
5134
5686
  View,
5135
5687
  {
5136
5688
  style: [
5137
- styles22.stacked,
5689
+ styles25.stacked,
5138
5690
  {
5139
5691
  marginLeft: i === 0 ? 0 : -6,
5140
5692
  borderColor: theme.colors.background,
@@ -5156,7 +5708,7 @@ function ThreadSummary({
5156
5708
  /* @__PURE__ */ jsx(
5157
5709
  Text,
5158
5710
  {
5159
- style: [styles22.text, { color: theme.colors.link, fontFamily: theme.fonts.body }],
5711
+ style: [styles25.text, { color: theme.colors.link, fontFamily: theme.fonts.body }],
5160
5712
  numberOfLines: 1,
5161
5713
  children: label
5162
5714
  }
@@ -5176,7 +5728,7 @@ function Participant({
5176
5728
  const src = externalId ? avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null : null;
5177
5729
  return /* @__PURE__ */ jsx(Avatar, { src, name, seed: externalId ?? fallback, size: "xs" });
5178
5730
  }
5179
- var styles22 = StyleSheet.create({
5731
+ var styles25 = StyleSheet.create({
5180
5732
  row: {
5181
5733
  flexDirection: "row",
5182
5734
  alignItems: "center",
@@ -5231,7 +5783,9 @@ function FlatMessageRow({
5231
5783
  linkPreviews = true,
5232
5784
  onRemoveLinkPreview,
5233
5785
  onMarkUnread,
5234
- editHistory = true
5786
+ editHistory = true,
5787
+ onRetrySend,
5788
+ onDiscardSend
5235
5789
  }) {
5236
5790
  const theme = useTheme();
5237
5791
  const { width: screenWidth } = useWindowDimensions();
@@ -5260,9 +5814,10 @@ function FlatMessageRow({
5260
5814
  const isRunStart = compact || groupPosition === "first" || groupPosition === "standalone";
5261
5815
  const ctx = { message: msg, isSelf, sender, layout, isRunStart };
5262
5816
  const deleted = isTombstone(msg);
5817
+ const inert = deleted || !!msg.local_status;
5263
5818
  const time = formatMessageTime(msg.inserted_at, timeFormat);
5264
5819
  const openActions = () => {
5265
- if (actions && !deleted) setActionsOpen(true);
5820
+ if (actions && !inert) setActionsOpen(true);
5266
5821
  };
5267
5822
  const text = { fontFamily: theme.fonts.body, color: theme.colors.text };
5268
5823
  const avatarEl = showAvatar ? /* @__PURE__ */ jsx(
@@ -5289,10 +5844,10 @@ function FlatMessageRow({
5289
5844
  Text,
5290
5845
  {
5291
5846
  style: [
5292
- styles23.name,
5847
+ styles26.name,
5293
5848
  text,
5294
5849
  compact ? { color: userColor(ext ?? msg.sender_id ?? msg.id) } : null,
5295
- compact ? styles23.nameCompact : null
5850
+ compact ? styles26.nameCompact : null
5296
5851
  ],
5297
5852
  numberOfLines: 1,
5298
5853
  ...onSenderPress && !isSelf ? {
@@ -5307,22 +5862,22 @@ function FlatMessageRow({
5307
5862
  Text,
5308
5863
  {
5309
5864
  style: [
5310
- styles23.time,
5865
+ styles26.time,
5311
5866
  { color: theme.colors.textSubtle, fontFamily: theme.fonts.body },
5312
- dim ? styles23.timeDim : null
5867
+ dim ? styles26.timeDim : null
5313
5868
  ],
5314
5869
  ...dim ? { numberOfLines: 1, adjustsFontSizeToFit: true, minimumFontScale: 0.6 } : {},
5315
5870
  children: dim ? gutterTime(time) : time
5316
5871
  }
5317
5872
  );
5318
- const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxs(View, { style: styles23.header, children: [
5873
+ const header = compact ? name : isRunStart ? /* @__PURE__ */ jsxs(View, { style: styles26.header, children: [
5319
5874
  name,
5320
5875
  timeText(false)
5321
5876
  ] }) : null;
5322
5877
  const images = attachments && !deleted ? (msg.attachments ?? []).filter((a) => isImageContentType(a.content_type)) : [];
5323
5878
  const files = attachments && !deleted ? (msg.attachments ?? []).filter((a) => !isImageContentType(a.content_type)) : [];
5324
5879
  const mediaWidth = Math.min(screenWidth - GUTTER - 48, 320);
5325
- const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles23.attachments, children: [
5880
+ const attachmentsEl = images.length > 0 || files.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles26.attachments, children: [
5326
5881
  images.length > 0 ? /* @__PURE__ */ jsx(
5327
5882
  ImageMosaic,
5328
5883
  {
@@ -5345,11 +5900,11 @@ function FlatMessageRow({
5345
5900
  lineHeight: dense ? theme.fonts.lineHeight - 3 : theme.fonts.lineHeight
5346
5901
  };
5347
5902
  const edited = !!msg.edited_at && !deleted;
5348
- const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxs(View, { style: styles23.meta, children: [
5903
+ const meta = edited || isSelf && readState ? /* @__PURE__ */ jsxs(View, { style: styles26.meta, children: [
5349
5904
  edited ? /* @__PURE__ */ jsx(
5350
5905
  Text,
5351
5906
  {
5352
- style: [styles23.edited, { color: theme.colors.textSubtle }],
5907
+ style: [styles26.edited, { color: theme.colors.textSubtle }],
5353
5908
  ...editHistory && canShowEditHistory(msg.id) ? {
5354
5909
  onPress: () => setHistoryOpen(true),
5355
5910
  suppressHighlighting: true,
@@ -5369,7 +5924,7 @@ function FlatMessageRow({
5369
5924
  }
5370
5925
  ) : null
5371
5926
  ] }) : null;
5372
- const body = deleted ? /* @__PURE__ */ jsx(Text, { style: [bodyText, styles23.deleted, { color: theme.colors.textMuted }], children: "This message was deleted" }) : raw ? /* @__PURE__ */ jsxs(View, { children: [
5927
+ const body = deleted ? /* @__PURE__ */ jsx(Text, { style: [bodyText, styles26.deleted, { color: theme.colors.textMuted }], children: "This message was deleted" }) : raw ? /* @__PURE__ */ jsxs(View, { children: [
5373
5928
  jumbo > 0 ? /* @__PURE__ */ jsx(Text, { style: { fontSize: emojiFontSize(jumbo), lineHeight: emojiFontSize(jumbo) + 8 }, children: raw }) : markdown && hasMarkdown(shown) ? renderMarkdown(shown, {
5374
5929
  textColor: bodyText.color,
5375
5930
  linkColor: theme.colors.link,
@@ -5381,8 +5936,8 @@ function FlatMessageRow({
5381
5936
  return false;
5382
5937
  }
5383
5938
  }) : /* @__PURE__ */ jsx(Text, { style: bodyText, children: shown }),
5384
- trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(Text, { style: [styles23.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
5385
- previews.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles23.previews, children: previews.map((p) => /* @__PURE__ */ jsx(
5939
+ trimmable ? /* @__PURE__ */ jsx(Pressable, { onPress: () => setExpanded((e) => !e), children: /* @__PURE__ */ jsx(Text, { style: [styles26.readMore, { color: theme.colors.link }], children: expanded ? "Show less" : "Read more" }) }) : null,
5940
+ previews.length > 0 ? /* @__PURE__ */ jsx(View, { style: styles26.previews, children: previews.map((p) => /* @__PURE__ */ jsx(
5386
5941
  LinkPreviewCard,
5387
5942
  {
5388
5943
  preview: p,
@@ -5406,7 +5961,7 @@ function FlatMessageRow({
5406
5961
  }
5407
5962
  ) : null
5408
5963
  );
5409
- const reactionsEl = reactions && !deleted ? /* @__PURE__ */ jsx(View, { style: styles23.reactions, children: /* @__PURE__ */ jsx(
5964
+ const reactionsEl = reactions && !inert ? /* @__PURE__ */ jsx(View, { style: styles26.reactions, children: /* @__PURE__ */ jsx(
5410
5965
  ReactionStrip,
5411
5966
  {
5412
5967
  messageId: msg.id,
@@ -5425,15 +5980,24 @@ function FlatMessageRow({
5425
5980
  ...onQuotedClick ? { onPress: () => onQuotedClick(msg.quoted_message.id) } : {}
5426
5981
  }
5427
5982
  ) : null;
5428
- const content = /* @__PURE__ */ jsxs(View, { style: styles23.content, children: [
5983
+ const content = /* @__PURE__ */ jsxs(View, { style: styles26.content, children: [
5429
5984
  !compact ? renderSlot(slots?.header, ctx, header) : null,
5430
5985
  quote,
5431
5986
  renderSlot(slots?.attachments, ctx, attachmentsEl),
5432
5987
  renderSlot(slots?.body, ctx, body),
5433
5988
  renderSlot(slots?.reactions, ctx, reactionsEl),
5434
- renderSlot(slots?.thread, ctx, threadEl)
5989
+ renderSlot(slots?.thread, ctx, threadEl),
5990
+ /* @__PURE__ */ jsx(
5991
+ SendStatus,
5992
+ {
5993
+ message: msg,
5994
+ alignEnd: false,
5995
+ ...onRetrySend ? { onRetry: onRetrySend } : {},
5996
+ ...onDiscardSend ? { onDiscard: onDiscardSend } : {}
5997
+ }
5998
+ )
5435
5999
  ] });
5436
- const sheet = actions && actionsOpen && !deleted ? /* @__PURE__ */ jsx(
6000
+ const sheet = actions && actionsOpen && !inert ? /* @__PURE__ */ jsx(
5437
6001
  RowActionsSheet,
5438
6002
  {
5439
6003
  msg,
@@ -5457,28 +6021,32 @@ function FlatMessageRow({
5457
6021
  View,
5458
6022
  {
5459
6023
  style: [
5460
- styles23.row,
5461
- compact ? styles23.rowCompact : null,
5462
- dense ? styles23.rowDense : null,
5463
- !compact && isRunStart ? dense ? styles23.runStartDense : styles23.runStart : null,
6024
+ styles26.row,
6025
+ compact ? styles26.rowCompact : null,
6026
+ dense ? styles26.rowDense : null,
6027
+ !compact && isRunStart ? dense ? styles26.runStartDense : styles26.runStart : null,
5464
6028
  mentionsMe ? { backgroundColor: theme.colors.mention, borderLeftColor: theme.colors.accent } : null,
5465
- isEditing ? styles23.rowEditing : null
6029
+ isEditing ? styles26.rowEditing : null
5466
6030
  ],
5467
6031
  children: [
5468
6032
  /* @__PURE__ */ jsx(
5469
6033
  Pressable,
5470
6034
  {
5471
6035
  onLongPress: openActions,
5472
- style: [styles23.line, compact ? styles23.lineCompact : null],
5473
- accessibilityRole: "button",
5474
- accessibilityLabel: "Message actions",
6036
+ style: [styles26.line, compact ? styles26.lineCompact : null],
6037
+ accessibilityLabel: messageA11yLabel(msg, senderName, isSelf),
6038
+ ...actions && !inert ? {
6039
+ accessibilityHint: "Long press for message actions",
6040
+ accessibilityActions: [{ name: "longpress", label: "Message actions" }],
6041
+ onAccessibilityAction: openActions
6042
+ } : {},
5475
6043
  children: compact ? /* @__PURE__ */ jsxs(Fragment, { children: [
5476
6044
  timeText(false),
5477
- avatar ? /* @__PURE__ */ jsx(View, { style: styles23.avatarCompact, children: avatar }) : null,
6045
+ avatar ? /* @__PURE__ */ jsx(View, { style: styles26.avatarCompact, children: avatar }) : null,
5478
6046
  renderSlot(slots?.header, ctx, header),
5479
6047
  content
5480
6048
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
5481
- /* @__PURE__ */ jsx(View, { style: styles23.gutter, children: isRunStart ? avatar : timeText(true) }),
6049
+ /* @__PURE__ */ jsx(View, { style: styles26.gutter, children: isRunStart ? avatar : timeText(true) }),
5482
6050
  content
5483
6051
  ] })
5484
6052
  }
@@ -5499,7 +6067,7 @@ function FlatMessageRow({
5499
6067
  }
5500
6068
  );
5501
6069
  }
5502
- var styles23 = StyleSheet.create({
6070
+ var styles26 = StyleSheet.create({
5503
6071
  row: {
5504
6072
  // 3px left border reserved for the mention accent bar.
5505
6073
  borderLeftWidth: 3,
@@ -5651,13 +6219,13 @@ function MessageActions({
5651
6219
  animationType: "fade",
5652
6220
  onRequestClose: onClose,
5653
6221
  ...EDGE_TO_EDGE_MODAL,
5654
- children: /* @__PURE__ */ jsx(Pressable, { style: styles24.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
6222
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles27.backdrop, onPress: onClose, children: /* @__PURE__ */ jsxs(
5655
6223
  Pressable,
5656
6224
  {
5657
6225
  onPress: () => void 0,
5658
6226
  accessible: false,
5659
6227
  style: [
5660
- styles24.sheet,
6228
+ styles27.sheet,
5661
6229
  {
5662
6230
  backgroundColor: theme.colors.surface,
5663
6231
  borderTopLeftRadius: theme.radii.lg,
@@ -5670,7 +6238,7 @@ function MessageActions({
5670
6238
  theme.shadows.lg
5671
6239
  ],
5672
6240
  children: [
5673
- showEmojiRow ? /* @__PURE__ */ jsxs(View, { style: [styles24.emojiRow, { borderBottomColor: theme.colors.border }], children: [
6241
+ showEmojiRow ? /* @__PURE__ */ jsxs(View, { style: [styles27.emojiRow, { borderBottomColor: theme.colors.border }], children: [
5674
6242
  emojis.map((emoji) => /* @__PURE__ */ jsx(
5675
6243
  Pressable,
5676
6244
  {
@@ -5678,10 +6246,10 @@ function MessageActions({
5678
6246
  onPickReaction(emoji);
5679
6247
  onClose();
5680
6248
  },
5681
- style: styles24.emojiBtn,
6249
+ style: styles27.emojiBtn,
5682
6250
  hitSlop: 6,
5683
6251
  accessibilityLabel: `React with ${emoji}`,
5684
- children: /* @__PURE__ */ jsx(Text, { style: styles24.emoji, children: emoji })
6252
+ children: /* @__PURE__ */ jsx(Text, { style: styles27.emoji, children: emoji })
5685
6253
  },
5686
6254
  emoji
5687
6255
  )),
@@ -5692,7 +6260,7 @@ function MessageActions({
5692
6260
  onClose();
5693
6261
  onMoreReactions();
5694
6262
  },
5695
- style: [styles24.moreBtn, { backgroundColor: theme.colors.surfaceAlt }],
6263
+ style: [styles27.moreBtn, { backgroundColor: theme.colors.surfaceAlt }],
5696
6264
  hitSlop: 6,
5697
6265
  accessibilityRole: "button",
5698
6266
  accessibilityLabel: "More reactions",
@@ -5700,7 +6268,7 @@ function MessageActions({
5700
6268
  }
5701
6269
  ) : null
5702
6270
  ] }) : null,
5703
- items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles24.item, children: [
6271
+ items.map((item) => /* @__PURE__ */ jsxs(Pressable, { onPress: item.onPress, style: styles27.item, children: [
5704
6272
  /* @__PURE__ */ jsx(
5705
6273
  PoolseIcon,
5706
6274
  {
@@ -5713,7 +6281,7 @@ function MessageActions({
5713
6281
  Text,
5714
6282
  {
5715
6283
  style: [
5716
- styles24.itemText,
6284
+ styles27.itemText,
5717
6285
  {
5718
6286
  color: item.danger ? theme.colors.danger : theme.colors.text,
5719
6287
  fontFamily: theme.fonts.body
@@ -5733,7 +6301,7 @@ function hostOf2(url) {
5733
6301
  const m = /^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i.exec(url);
5734
6302
  return (m?.[1] ?? url).replace(/^www\./, "");
5735
6303
  }
5736
- var styles24 = StyleSheet.create({
6304
+ var styles27 = StyleSheet.create({
5737
6305
  backdrop: {
5738
6306
  flex: 1,
5739
6307
  backgroundColor: "rgba(0,0,0,0.35)",
@@ -5850,6 +6418,16 @@ function RowSheets({
5850
6418
  ] });
5851
6419
  }
5852
6420
  function MessageRow(props) {
6421
+ if (recordingNoticeDisplayFor(props.msg, props.meId)) {
6422
+ return /* @__PURE__ */ jsx(
6423
+ RecordingNoticeRow,
6424
+ {
6425
+ msg: props.msg,
6426
+ meId: props.meId,
6427
+ ...props.nameForUserId ? { nameFor: props.nameForUserId } : {}
6428
+ }
6429
+ );
6430
+ }
5853
6431
  const callLog = callLogDisplayFor(props.msg, props.meId);
5854
6432
  if (callLog !== void 0) {
5855
6433
  return callLog ? /* @__PURE__ */ jsx(
@@ -5897,11 +6475,13 @@ function BubbleMessageRow({
5897
6475
  linkPreviews = true,
5898
6476
  onRemoveLinkPreview,
5899
6477
  onMarkUnread,
5900
- editHistory = true
6478
+ editHistory = true,
6479
+ onRetrySend,
6480
+ onDiscardSend
5901
6481
  }) {
5902
6482
  const theme = useTheme();
5903
6483
  const isSelf = meId !== null && msg.sender_id === meId;
5904
- const tombstone = isTombstone(msg);
6484
+ const tombstone = isTombstone(msg) || !!msg.local_status;
5905
6485
  const [actionsOpen, setActionsOpen] = useState(false);
5906
6486
  const [emojiOpen, setEmojiOpen] = useState(false);
5907
6487
  const [historyOpen, setHistoryOpen] = useState(false);
@@ -5983,8 +6563,7 @@ function BubbleMessageRow({
5983
6563
  });
5984
6564
  const showAvatarSlot = showAvatar && !isSelf;
5985
6565
  const showAvatarRender = showAvatarSlot && (groupPosition === "last" || groupPosition === "standalone");
5986
- const wantsSender = showAvatarSlot || !isSelf && onSenderPress !== void 0;
5987
- const rowSender = useUser(wantsSender ? msg.sender_external_id : null);
6566
+ const rowSender = useUser(msg.sender_external_id);
5988
6567
  const avatarUrl = msg.sender_external_id ? avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null : null;
5989
6568
  const senderLabel = msg.sender_external_id ? labelFor?.(msg.sender_external_id) ?? rowSender.profile?.displayName ?? msg.sender_external_id : null;
5990
6569
  const sender = {
@@ -6014,16 +6593,16 @@ function BubbleMessageRow({
6014
6593
  View,
6015
6594
  {
6016
6595
  style: [
6017
- styles25.row,
6596
+ styles28.row,
6018
6597
  { alignSelf: isSelf ? "flex-end" : "flex-start" },
6019
- density === "compact" ? styles25.rowDense : null,
6598
+ density === "compact" ? styles28.rowDense : null,
6020
6599
  // Lift this row above the dim backdrop the parent renders
6021
6600
  // during edit mode. zIndex covers iOS / web; elevation does
6022
6601
  // the equivalent on Android.
6023
- isEditing ? styles25.rowEditing : null
6602
+ isEditing ? styles28.rowEditing : null
6024
6603
  ],
6025
6604
  children: [
6026
- showAvatarSlot ? /* @__PURE__ */ jsx(View, { style: styles25.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsx(
6605
+ showAvatarSlot ? /* @__PURE__ */ jsx(View, { style: styles28.avatarSlot, children: !showAvatarRender ? null : onAvatarPress ? /* @__PURE__ */ jsx(
6027
6606
  Pressable,
6028
6607
  {
6029
6608
  onPress: () => onAvatarPress(sender),
@@ -6033,14 +6612,14 @@ function BubbleMessageRow({
6033
6612
  children: avatar
6034
6613
  }
6035
6614
  ) : avatar }) : null,
6036
- /* @__PURE__ */ jsxs(View, { style: styles25.bubbleCol, children: [
6615
+ /* @__PURE__ */ jsxs(View, { style: styles28.bubbleCol, children: [
6037
6616
  swipeEnabled ? /* @__PURE__ */ jsx(
6038
6617
  Animated.View,
6039
6618
  {
6040
6619
  pointerEvents: "none",
6041
6620
  style: [
6042
- styles25.replyHint,
6043
- isSelf ? styles25.replyHintRight : styles25.replyHintLeft,
6621
+ styles28.replyHint,
6622
+ isSelf ? styles28.replyHintRight : styles28.replyHintLeft,
6044
6623
  {
6045
6624
  opacity: replyIconOpacity,
6046
6625
  transform: [{ scale: replyIconScale }],
@@ -6062,8 +6641,12 @@ function BubbleMessageRow({
6062
6641
  if (!actions || tombstone) return;
6063
6642
  setActionsOpen(true);
6064
6643
  },
6065
- accessibilityRole: "button",
6066
- accessibilityLabel: "Message actions",
6644
+ accessibilityLabel: messageA11yLabel(msg, senderLabel ?? "Unknown", isSelf),
6645
+ ...actions && !tombstone ? {
6646
+ accessibilityHint: "Long press for message actions",
6647
+ accessibilityActions: [{ name: "longpress", label: "Message actions" }],
6648
+ onAccessibilityAction: () => setActionsOpen(true)
6649
+ } : {},
6067
6650
  children: /* @__PURE__ */ jsx(
6068
6651
  MessageBubble,
6069
6652
  {
@@ -6092,6 +6675,15 @@ function BubbleMessageRow({
6092
6675
  )
6093
6676
  }
6094
6677
  ),
6678
+ /* @__PURE__ */ jsx(
6679
+ SendStatus,
6680
+ {
6681
+ message: msg,
6682
+ alignEnd: isSelf,
6683
+ ...onRetrySend ? { onRetry: onRetrySend } : {},
6684
+ ...onDiscardSend ? { onDiscard: onDiscardSend } : {}
6685
+ }
6686
+ ),
6095
6687
  renderSlot(
6096
6688
  slots?.thread,
6097
6689
  slotContext,
@@ -6109,7 +6701,7 @@ function BubbleMessageRow({
6109
6701
  renderSlot(
6110
6702
  slots?.reactions,
6111
6703
  slotContext,
6112
- reactions && !tombstone ? /* @__PURE__ */ jsx(View, { style: [styles25.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsx(
6704
+ reactions && !tombstone ? /* @__PURE__ */ jsx(View, { style: [styles28.reactionsRow, { alignSelf: isSelf ? "flex-end" : "flex-start" }], children: /* @__PURE__ */ jsx(
6113
6705
  ReactionStrip,
6114
6706
  {
6115
6707
  messageId: msg.id,
@@ -6160,7 +6752,7 @@ function BubbleMessageRow({
6160
6752
  }
6161
6753
  );
6162
6754
  }
6163
- var styles25 = StyleSheet.create({
6755
+ var styles28 = StyleSheet.create({
6164
6756
  row: {
6165
6757
  flexDirection: "row",
6166
6758
  alignItems: "flex-end",
@@ -6217,24 +6809,24 @@ function NewMessagesDivider({ label = "New messages" }) {
6217
6809
  return /* @__PURE__ */ jsxs(
6218
6810
  View,
6219
6811
  {
6220
- style: [styles26.row, { paddingHorizontal: theme.spacing.md }],
6812
+ style: [styles29.row, { paddingHorizontal: theme.spacing.md }],
6221
6813
  accessibilityRole: "text",
6222
6814
  accessibilityLabel: label,
6223
6815
  children: [
6224
- /* @__PURE__ */ jsx(View, { style: [styles26.line, { backgroundColor: theme.colors.accent }] }),
6816
+ /* @__PURE__ */ jsx(View, { style: [styles29.line, { backgroundColor: theme.colors.accent }] }),
6225
6817
  /* @__PURE__ */ jsx(
6226
6818
  Text,
6227
6819
  {
6228
- style: [styles26.label, { color: theme.colors.accentStrong, fontFamily: theme.fonts.body }],
6820
+ style: [styles29.label, { color: theme.colors.accentStrong, fontFamily: theme.fonts.body }],
6229
6821
  children: label
6230
6822
  }
6231
6823
  ),
6232
- /* @__PURE__ */ jsx(View, { style: [styles26.line, { backgroundColor: theme.colors.accent }] })
6824
+ /* @__PURE__ */ jsx(View, { style: [styles29.line, { backgroundColor: theme.colors.accent }] })
6233
6825
  ]
6234
6826
  }
6235
6827
  );
6236
6828
  }
6237
- var styles26 = StyleSheet.create({
6829
+ var styles29 = StyleSheet.create({
6238
6830
  row: {
6239
6831
  flexDirection: "row",
6240
6832
  alignItems: "center",
@@ -6403,15 +6995,15 @@ function ThreadSheet({
6403
6995
  return /* @__PURE__ */ jsxs(
6404
6996
  View,
6405
6997
  {
6406
- style: styles27.modalRoot,
6998
+ style: styles30.modalRoot,
6407
6999
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
6408
7000
  children: [
6409
- /* @__PURE__ */ jsx(Pressable, { style: styles27.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
7001
+ /* @__PURE__ */ jsx(Pressable, { style: styles30.backdrop, onPress: onClose, accessibilityLabel: "Close thread" }),
6410
7002
  /* @__PURE__ */ jsxs(
6411
7003
  Animated.View,
6412
7004
  {
6413
7005
  style: [
6414
- styles27.sheet,
7006
+ styles30.sheet,
6415
7007
  {
6416
7008
  height: sheetHeight,
6417
7009
  backgroundColor: theme.colors.background,
@@ -6425,14 +7017,14 @@ function ThreadSheet({
6425
7017
  ],
6426
7018
  children: [
6427
7019
  /* @__PURE__ */ jsxs(View, { ...panHandlers, children: [
6428
- /* @__PURE__ */ jsx(View, { style: styles27.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles27.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
6429
- /* @__PURE__ */ jsxs(View, { style: [styles27.header, { borderBottomColor: theme.colors.border }], children: [
7020
+ /* @__PURE__ */ jsx(View, { style: styles30.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles30.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
7021
+ /* @__PURE__ */ jsxs(View, { style: [styles30.header, { borderBottomColor: theme.colors.border }], children: [
6430
7022
  /* @__PURE__ */ jsx(
6431
7023
  Pressable,
6432
7024
  {
6433
7025
  onPress: onClose,
6434
7026
  hitSlop: 16,
6435
- style: [styles27.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
7027
+ style: [styles30.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
6436
7028
  accessibilityLabel: "Close thread",
6437
7029
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
6438
7030
  }
@@ -6440,7 +7032,7 @@ function ThreadSheet({
6440
7032
  /* @__PURE__ */ jsx(
6441
7033
  Text,
6442
7034
  {
6443
- style: [styles27.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
7035
+ style: [styles30.title, { color: theme.colors.text, fontFamily: theme.fonts.display }],
6444
7036
  children: "Thread"
6445
7037
  }
6446
7038
  )
@@ -6449,18 +7041,25 @@ function ThreadSheet({
6449
7041
  /* @__PURE__ */ jsxs(
6450
7042
  KeyboardAvoidingView,
6451
7043
  {
6452
- style: styles27.kavBody,
7044
+ style: styles30.kavBody,
6453
7045
  behavior: "padding",
6454
7046
  keyboardVerticalOffset: gutter,
6455
7047
  children: [
6456
- /* @__PURE__ */ jsx(View, { style: [styles27.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
6457
- /* @__PURE__ */ jsx(View, { style: styles27.listWrap, children: /* @__PURE__ */ jsx(
7048
+ /* @__PURE__ */ jsx(View, { style: [styles30.rootPreview, { backgroundColor: theme.colors.surfaceAlt }], children: rootRow }),
7049
+ /* @__PURE__ */ jsx(View, { style: styles30.listWrap, children: /* @__PURE__ */ jsx(
6458
7050
  MessageList,
6459
7051
  {
6460
7052
  messages: replies,
6461
7053
  hasMore,
6462
7054
  onLoadMore: loadMore,
6463
- renderItem: renderReply
7055
+ renderItem: renderReply,
7056
+ emptyState: /* @__PURE__ */ jsx(
7057
+ EmptyState,
7058
+ {
7059
+ title: "No replies yet",
7060
+ hint: "Write a reply below to start the thread."
7061
+ }
7062
+ )
6464
7063
  }
6465
7064
  ) }),
6466
7065
  /* @__PURE__ */ jsx(
@@ -6492,7 +7091,7 @@ function ThreadSheet({
6492
7091
  }
6493
7092
  );
6494
7093
  }
6495
- var styles27 = StyleSheet.create({
7094
+ var styles30 = StyleSheet.create({
6496
7095
  modalRoot: {
6497
7096
  flex: 1,
6498
7097
  justifyContent: "flex-end"
@@ -6564,7 +7163,7 @@ function TypingIndicator({ typing, labelFor }) {
6564
7163
  const ids = Array.from(typing);
6565
7164
  const isTyping = ids.length > 0;
6566
7165
  if (!isTyping) return /* @__PURE__ */ jsx(View, { style: { height: 0 } });
6567
- return /* @__PURE__ */ jsxs(View, { style: styles28.row, children: [
7166
+ return /* @__PURE__ */ jsxs(View, { style: styles31.row, children: [
6568
7167
  /* @__PURE__ */ jsx(TypingDots, {}),
6569
7168
  /* @__PURE__ */ jsx(TypingLabel, { ids, ...labelFor ? { labelFor } : {} })
6570
7169
  ] });
@@ -6609,7 +7208,7 @@ function TypingDots() {
6609
7208
  ],
6610
7209
  opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] })
6611
7210
  });
6612
- return /* @__PURE__ */ jsxs(View, { style: styles28.dotsWrap, children: [
7211
+ return /* @__PURE__ */ jsxs(View, { style: styles31.dotsWrap, children: [
6613
7212
  /* @__PURE__ */ jsx(Animated.View, { style: dot(a) }),
6614
7213
  /* @__PURE__ */ jsx(Animated.View, { style: dot(b) }),
6615
7214
  /* @__PURE__ */ jsx(Animated.View, { style: dot(c) })
@@ -6625,9 +7224,9 @@ function TypingLabel({
6625
7224
  const name1 = useDisplayName(id1, labelFor);
6626
7225
  const name2 = useDisplayName(id2, labelFor);
6627
7226
  const text = ids.length === 1 ? `${name1} is typing` : ids.length === 2 ? `${name1} and ${name2} are typing` : `${ids.length} people are typing`;
6628
- return /* @__PURE__ */ jsx(Text, { style: [styles28.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
7227
+ return /* @__PURE__ */ jsx(Text, { style: [styles31.label, { color: theme.colors.textMuted, fontFamily: theme.fonts.body }], children: text });
6629
7228
  }
6630
- var styles28 = StyleSheet.create({
7229
+ var styles31 = StyleSheet.create({
6631
7230
  row: {
6632
7231
  flexDirection: "row",
6633
7232
  alignItems: "center",
@@ -6665,21 +7264,40 @@ function parseDraft(raw) {
6665
7264
  }
6666
7265
  }
6667
7266
  var DraftStore = class {
7267
+ /**
7268
+ * `namespace` resolves to the client's namespace; without it keys are
7269
+ * the pre-3.8 `poolse:draft:<conversation>` (tests, single client).
7270
+ */
7271
+ constructor(namespace) {
7272
+ this.namespace = namespace;
7273
+ }
7274
+ namespace;
6668
7275
  memory = /* @__PURE__ */ new Map();
7276
+ written = /* @__PURE__ */ new Map();
6669
7277
  /** The in-memory draft, if any. */
6670
7278
  peek(conversationId) {
6671
7279
  return this.memory.get(conversationId) ?? null;
6672
7280
  }
6673
7281
  /**
6674
7282
  * The draft: from memory, else from `storage` (which then seeds the
6675
- * memory). Null when there's none, or storage fails.
7283
+ * memory; a pre-3.8 key is moved over). Null when there's none, or
7284
+ * storage fails.
6676
7285
  */
6677
7286
  async load(conversationId, storage) {
6678
7287
  const inMemory = this.memory.get(conversationId);
6679
7288
  if (inMemory) return inMemory;
6680
7289
  if (!storage) return null;
6681
7290
  try {
6682
- const stored = parseDraft(await storage.get(draftKey(conversationId)));
7291
+ const key = await this.key(conversationId);
7292
+ let stored = parseDraft(await storage.get(key));
7293
+ const legacy = draftKey(conversationId);
7294
+ if (!stored && key !== legacy) {
7295
+ stored = parseDraft(await storage.get(legacy));
7296
+ if (stored && !isEmptyDraft(stored)) {
7297
+ this.write(storage, key, stored);
7298
+ swallow(() => storage.remove(legacy));
7299
+ }
7300
+ }
6683
7301
  if (stored && !isEmptyDraft(stored) && !this.memory.has(conversationId)) {
6684
7302
  this.memory.set(conversationId, stored);
6685
7303
  }
@@ -6695,15 +7313,72 @@ var DraftStore = class {
6695
7313
  return;
6696
7314
  }
6697
7315
  this.memory.set(conversationId, draft);
6698
- if (storage) {
6699
- swallow(() => storage.set(draftKey(conversationId), JSON.stringify(draft)));
7316
+ if (storage && !this.namespace) {
7317
+ this.write(storage, draftKey(conversationId), draft);
7318
+ } else if (storage) {
7319
+ void this.key(conversationId).then(
7320
+ (key) => this.write(storage, key, draft),
7321
+ () => void 0
7322
+ );
6700
7323
  }
6701
7324
  }
6702
7325
  clear(conversationId, storage) {
6703
7326
  this.memory.delete(conversationId);
6704
- if (storage) swallow(() => storage.remove(draftKey(conversationId)));
7327
+ if (storage && !this.namespace) {
7328
+ swallow(() => storage.remove(draftKey(conversationId)));
7329
+ } else if (storage) {
7330
+ void this.key(conversationId).then(
7331
+ (key) => swallow(() => storage.remove(key)),
7332
+ () => void 0
7333
+ );
7334
+ }
7335
+ }
7336
+ /** Called by `chat.destroy()`. @internal */
7337
+ async destroy(opts) {
7338
+ this.memory.clear();
7339
+ if (!opts.clearStorage) return;
7340
+ const ns = this.namespace ? await this.namespace() : null;
7341
+ for (const [storage, keys] of this.written) {
7342
+ const all = new Set(keys);
7343
+ if (ns) {
7344
+ try {
7345
+ const listed = JSON.parse(await storage.get(indexKey(ns)) ?? "[]");
7346
+ if (Array.isArray(listed)) {
7347
+ for (const k of listed) if (typeof k === "string") all.add(k);
7348
+ }
7349
+ } catch {
7350
+ }
7351
+ swallow(() => storage.remove(indexKey(ns)));
7352
+ }
7353
+ for (const k of all) swallow(() => storage.remove(k));
7354
+ }
7355
+ this.written.clear();
7356
+ }
7357
+ async key(conversationId) {
7358
+ if (!this.namespace) return draftKey(conversationId);
7359
+ return `${await this.namespace()}:draft:${conversationId}`;
7360
+ }
7361
+ write(storage, key, draft) {
7362
+ swallow(() => storage.set(key, JSON.stringify(draft)));
7363
+ let keys = this.written.get(storage);
7364
+ if (!keys) {
7365
+ keys = /* @__PURE__ */ new Set();
7366
+ this.written.set(storage, keys);
7367
+ }
7368
+ if (keys.has(key) || !this.namespace) return;
7369
+ keys.add(key);
7370
+ const all = keys;
7371
+ void this.namespace().then(async (ns) => {
7372
+ try {
7373
+ const listed = JSON.parse(await storage.get(indexKey(ns)) ?? "[]");
7374
+ const prev = Array.isArray(listed) ? listed.filter((k) => typeof k === "string") : [];
7375
+ await storage.set(indexKey(ns), JSON.stringify([.../* @__PURE__ */ new Set([...prev, ...all])]));
7376
+ } catch {
7377
+ }
7378
+ });
6705
7379
  }
6706
7380
  };
7381
+ var indexKey = (ns) => `${ns}:draft-index`;
6707
7382
  function swallow(fn) {
6708
7383
  try {
6709
7384
  const r = fn();
@@ -6713,7 +7388,9 @@ function swallow(fn) {
6713
7388
  } catch {
6714
7389
  }
6715
7390
  }
6716
- var sharedDraftStore = new DraftStore();
7391
+ function draftStoreOf(chat) {
7392
+ return chat.scoped("react-native:drafts", (c) => new DraftStore(() => c.whenNamespace()));
7393
+ }
6717
7394
 
6718
7395
  // src/internal/errors.ts
6719
7396
  function sendErrorNotice(err) {
@@ -6828,11 +7505,14 @@ function ConversationView({
6828
7505
  loadMore,
6829
7506
  loadUntil,
6830
7507
  send,
7508
+ retry: retrySend,
7509
+ discard: discardSend,
6831
7510
  edit,
6832
7511
  delete: deleteMsg,
6833
7512
  markReadUpTo,
6834
7513
  refetch
6835
7514
  } = useMessages(conversationId);
7515
+ const drafts = draftStoreOf(chat);
6836
7516
  const { typing: typingPeople, signalTyping } = useTyping(conversationId);
6837
7517
  const streams = useMessageStreams(conversationId);
6838
7518
  const typing = useMemo(() => {
@@ -6860,6 +7540,14 @@ function ConversationView({
6860
7540
  }, [realtimeStatus, refetch]);
6861
7541
  const wantsMembers = mentions || senderLabels === "auto" || avatars === "auto";
6862
7542
  const { members } = useMembers(wantsMembers ? conversationId : "");
7543
+ const nameForUserId = useCallback(
7544
+ (userId) => {
7545
+ const ext = members.find((m) => m.user_id === userId)?.external_id;
7546
+ if (!ext) return null;
7547
+ return chat.users.peek(ext)?.displayName ?? labelFor?.(ext) ?? null;
7548
+ },
7549
+ [members, chat, labelFor]
7550
+ );
6863
7551
  const isGroupChat = members.length > 2;
6864
7552
  const showSenderLabels = senderLabels === "always" || senderLabels === "auto" && isGroupChat;
6865
7553
  const showAvatars = showAvatarsProp ?? (layout === "list" ? true : layout === "compact" ? false : avatars === "always" || avatars === "auto" && isGroupChat);
@@ -6873,24 +7561,22 @@ function ConversationView({
6873
7561
  [layout, density, timeFormat, slots]
6874
7562
  );
6875
7563
  const [draftFor, setDraftFor] = useState(conversationId);
6876
- const [draftText, setDraftText] = useState(
6877
- () => sharedDraftStore.peek(conversationId)?.text ?? ""
6878
- );
7564
+ const [draftText, setDraftText] = useState(() => drafts.peek(conversationId)?.text ?? "");
6879
7565
  const [replyingTo, setReplyingTo] = useState(
6880
- () => sharedDraftStore.peek(conversationId)?.quote ?? null
7566
+ () => drafts.peek(conversationId)?.quote ?? null
6881
7567
  );
6882
7568
  const touchedRef = useRef(false);
6883
7569
  const [storedDraftRead, setStoredDraftRead] = useState(false);
6884
7570
  useEffect(() => {
6885
7571
  let live = true;
6886
7572
  touchedRef.current = false;
6887
- const inMemory = sharedDraftStore.peek(conversationId);
7573
+ const inMemory = drafts.peek(conversationId);
6888
7574
  setDraftFor(conversationId);
6889
7575
  setDraftText(inMemory?.text ?? "");
6890
7576
  setReplyingTo(inMemory?.quote ?? null);
6891
7577
  if (!inMemory && storage) {
6892
7578
  setStoredDraftRead(false);
6893
- void sharedDraftStore.load(conversationId, storage).then((d) => {
7579
+ void drafts.load(conversationId, storage).then((d) => {
6894
7580
  if (!live) return;
6895
7581
  setStoredDraftRead(true);
6896
7582
  if (!d || touchedRef.current) return;
@@ -6908,23 +7594,23 @@ function ConversationView({
6908
7594
  useEffect(() => {
6909
7595
  if (draftFor !== conversationId) return;
6910
7596
  const draft = { text: draftText, quote: replyingTo };
6911
- sharedDraftStore.save(conversationId, draft);
7597
+ drafts.save(conversationId, draft);
6912
7598
  if (!storage || !storedDraftRead) return;
6913
7599
  pendingDraftRef.current = { id: conversationId, draft };
6914
7600
  const t = setTimeout(() => {
6915
7601
  pendingDraftRef.current = null;
6916
- sharedDraftStore.save(conversationId, draft, storage);
7602
+ drafts.save(conversationId, draft, storage);
6917
7603
  }, 400);
6918
7604
  return () => clearTimeout(t);
6919
- }, [draftFor, conversationId, draftText, replyingTo, storage, storedDraftRead]);
7605
+ }, [drafts, draftFor, conversationId, draftText, replyingTo, storage, storedDraftRead]);
6920
7606
  const storageRef = useRef(storage);
6921
7607
  storageRef.current = storage;
6922
7608
  useEffect(
6923
7609
  () => () => {
6924
7610
  const pending = pendingDraftRef.current;
6925
- if (pending) sharedDraftStore.save(pending.id, pending.draft, storageRef.current);
7611
+ if (pending) drafts.save(pending.id, pending.draft, storageRef.current);
6926
7612
  },
6927
- []
7613
+ [drafts]
6928
7614
  );
6929
7615
  const [notice, setNotice] = useState(null);
6930
7616
  useEffect(() => {
@@ -7111,6 +7797,10 @@ function ConversationView({
7111
7797
  showPresence,
7112
7798
  linkPreviews,
7113
7799
  ...markable ? { onMarkUnread: () => markMessageUnread(msg) } : {},
7800
+ ...msg.local_status ? {
7801
+ onRetrySend: () => void retrySend(msg.id).catch(() => void 0),
7802
+ onDiscardSend: () => discardSend(msg.id)
7803
+ } : {},
7114
7804
  ...linkPreviews && isSelf && !tombstone && (msg.link_previews?.length ?? 0) > 0 ? { onRemoveLinkPreview: (url) => removeLinkPreview(msg.id, url) } : {},
7115
7805
  reactions,
7116
7806
  attachments,
@@ -7134,6 +7824,7 @@ function ConversationView({
7134
7824
  groupPosition,
7135
7825
  markdown,
7136
7826
  ...onCallBack ? { onCallBack } : {},
7827
+ nameForUserId,
7137
7828
  ...layoutProps,
7138
7829
  mentionsMe: mentionsViewer(msg, meId)
7139
7830
  }
@@ -7142,6 +7833,8 @@ function ConversationView({
7142
7833
  return /* @__PURE__ */ jsx(View, { style: { backgroundColor: theme.colors.accentSoft }, children: row });
7143
7834
  },
7144
7835
  [
7836
+ retrySend,
7837
+ discardSend,
7145
7838
  onCallBack,
7146
7839
  onQuotedClick,
7147
7840
  onSenderPress,
@@ -7171,7 +7864,8 @@ function ConversationView({
7171
7864
  linkPreviews,
7172
7865
  markUnread,
7173
7866
  markMessageUnread,
7174
- removeLinkPreview
7867
+ removeLinkPreview,
7868
+ nameForUserId
7175
7869
  ]
7176
7870
  );
7177
7871
  const renderItem = useCallback(
@@ -7217,9 +7911,17 @@ function ConversationView({
7217
7911
  const composerProps = useMemo(
7218
7912
  () => ({
7219
7913
  onSend: async (body, opts) => {
7914
+ const id = safeUuid();
7220
7915
  try {
7221
- await send({ body, ...opts });
7916
+ await send({ body, ...opts, id });
7222
7917
  } catch (err) {
7918
+ const kept = err instanceof MessageQueuedError || chat.outboxEnabled && !isQuoteGone(err);
7919
+ if (kept) {
7920
+ setReplyingTo(null);
7921
+ setAutoReadPaused(false);
7922
+ return;
7923
+ }
7924
+ if (isQuoteGone(err)) discardSend(id);
7223
7925
  setDraftText((now) => now ? now : body);
7224
7926
  if (isQuoteGone(err)) setReplyingTo(null);
7225
7927
  setNotice(sendErrorNotice(err));
@@ -7252,6 +7954,8 @@ function ConversationView({
7252
7954
  }),
7253
7955
  [
7254
7956
  send,
7957
+ chat.outboxEnabled,
7958
+ discardSend,
7255
7959
  signalTyping,
7256
7960
  attachments,
7257
7961
  replyingTo,
@@ -7279,7 +7983,7 @@ function ConversationView({
7279
7983
  return /* @__PURE__ */ jsx(UploadProvider, { children: /* @__PURE__ */ jsxs(
7280
7984
  KeyboardAvoidingView,
7281
7985
  {
7282
- style: [styles29.root, { backgroundColor: theme.colors.background }],
7986
+ style: [styles32.root, { backgroundColor: theme.colors.background }],
7283
7987
  behavior: Platform.OS === "ios" ? "padding" : "height",
7284
7988
  keyboardVerticalOffset: keyboardOffset,
7285
7989
  children: [
@@ -7288,7 +7992,7 @@ function ConversationView({
7288
7992
  Text,
7289
7993
  {
7290
7994
  style: [
7291
- styles29.notice,
7995
+ styles32.notice,
7292
7996
  { color: theme.colors.textMuted, backgroundColor: theme.colors.surfaceAlt }
7293
7997
  ],
7294
7998
  accessibilityRole: "alert",
@@ -7304,7 +8008,7 @@ function ConversationView({
7304
8008
  onJoin: onJoinCall
7305
8009
  }
7306
8010
  ) : null,
7307
- /* @__PURE__ */ jsxs(View, { style: styles29.listWrap, children: [
8011
+ /* @__PURE__ */ jsxs(View, { style: styles32.listWrap, children: [
7308
8012
  /* @__PURE__ */ jsx(
7309
8013
  MessageList,
7310
8014
  {
@@ -7323,7 +8027,7 @@ function ConversationView({
7323
8027
  (stream) => stream.status === "failed" ? /* @__PURE__ */ jsx(
7324
8028
  Text,
7325
8029
  {
7326
- style: [styles29.streamFailed, { color: theme.colors.textSubtle }],
8030
+ style: [styles32.streamFailed, { color: theme.colors.textSubtle }],
7327
8031
  accessibilityRole: "alert",
7328
8032
  children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply."
7329
8033
  },
@@ -7350,7 +8054,13 @@ function ConversationView({
7350
8054
  ),
7351
8055
  /* @__PURE__ */ jsx(TypingIndicator, { typing, ...labelFor ? { labelFor } : {} })
7352
8056
  ] }),
7353
- ...emptyState !== void 0 ? { emptyState } : {}
8057
+ emptyState: emptyState !== void 0 ? emptyState : /* @__PURE__ */ jsx(
8058
+ EmptyState,
8059
+ {
8060
+ title: "No messages yet",
8061
+ ...showComposer ? { hint: "Write the first message below \u2014 everyone here will see it." } : {}
8062
+ }
8063
+ )
7354
8064
  }
7355
8065
  ),
7356
8066
  unreadPending ? /* @__PURE__ */ jsxs(
@@ -7358,7 +8068,7 @@ function ConversationView({
7358
8068
  {
7359
8069
  onPress: jumpToUnread,
7360
8070
  style: [
7361
- styles29.unreadPill,
8071
+ styles32.unreadPill,
7362
8072
  { backgroundColor: theme.colors.accent, borderRadius: theme.radii.pill },
7363
8073
  theme.shadows.sm
7364
8074
  ],
@@ -7374,7 +8084,7 @@ function ConversationView({
7374
8084
  label: null
7375
8085
  }
7376
8086
  ),
7377
- /* @__PURE__ */ jsx(Text, { style: [styles29.unreadPillText, { color: theme.colors.accentText }], children: seekingUnread ? "Loading\u2026" : "New messages" }),
8087
+ /* @__PURE__ */ jsx(Text, { style: [styles32.unreadPillText, { color: theme.colors.accentText }], children: seekingUnread ? "Loading\u2026" : "New messages" }),
7378
8088
  /* @__PURE__ */ jsx(
7379
8089
  Pressable,
7380
8090
  {
@@ -7391,7 +8101,7 @@ function ConversationView({
7391
8101
  editingId ? /* @__PURE__ */ jsx(
7392
8102
  Pressable,
7393
8103
  {
7394
- style: [styles29.editBackdrop, { backgroundColor: theme.colors.overlay }],
8104
+ style: [styles32.editBackdrop, { backgroundColor: theme.colors.overlay }],
7395
8105
  onPress: () => setEditingId(null),
7396
8106
  accessibilityLabel: "Cancel editing"
7397
8107
  }
@@ -7453,7 +8163,7 @@ function readStateForMessage(msg, members, meId, sequenceByMessageId) {
7453
8163
  return anyRead ? "read" : "sent";
7454
8164
  }
7455
8165
  var NEW_MESSAGES_KEY = "new-messages";
7456
- var styles29 = StyleSheet.create({
8166
+ var styles32 = StyleSheet.create({
7457
8167
  root: {
7458
8168
  flex: 1
7459
8169
  },
@@ -7589,15 +8299,15 @@ function UserPickerSheet({
7589
8299
  children: /* @__PURE__ */ jsxs(
7590
8300
  View,
7591
8301
  {
7592
- style: styles30.modalRoot,
8302
+ style: styles33.modalRoot,
7593
8303
  onLayout: (e) => setRootHeight(Math.round(e.nativeEvent.layout.height)),
7594
8304
  children: [
7595
- /* @__PURE__ */ jsx(Pressable, { style: styles30.backdrop, onPress: handleClose }),
8305
+ /* @__PURE__ */ jsx(Pressable, { style: styles33.backdrop, onPress: handleClose }),
7596
8306
  /* @__PURE__ */ jsx(
7597
8307
  Animated.View,
7598
8308
  {
7599
8309
  style: [
7600
- styles30.sheet,
8310
+ styles33.sheet,
7601
8311
  {
7602
8312
  backgroundColor: theme.colors.background,
7603
8313
  borderTopLeftRadius: theme.radii.xl,
@@ -7615,18 +8325,18 @@ function UserPickerSheet({
7615
8325
  children: /* @__PURE__ */ jsxs(
7616
8326
  KeyboardAvoidingView,
7617
8327
  {
7618
- style: styles30.kav,
8328
+ style: styles33.kav,
7619
8329
  behavior: "padding",
7620
8330
  keyboardVerticalOffset: screenHeight - sheetHeight,
7621
8331
  children: [
7622
- /* @__PURE__ */ jsx(View, { ...panHandlers, style: styles30.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles30.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
7623
- /* @__PURE__ */ jsxs(View, { style: styles30.header, children: [
8332
+ /* @__PURE__ */ jsx(View, { ...panHandlers, style: styles33.dragHandle, children: /* @__PURE__ */ jsx(View, { style: [styles33.dragPill, { backgroundColor: theme.colors.textSubtle }] }) }),
8333
+ /* @__PURE__ */ jsxs(View, { style: styles33.header, children: [
7624
8334
  /* @__PURE__ */ jsx(
7625
8335
  Pressable,
7626
8336
  {
7627
8337
  onPress: handleClose,
7628
8338
  hitSlop: 16,
7629
- style: [styles30.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
8339
+ style: [styles33.closeBtn, { backgroundColor: theme.colors.surfaceAlt }],
7630
8340
  accessibilityLabel: "Close picker",
7631
8341
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.text })
7632
8342
  }
@@ -7635,7 +8345,7 @@ function UserPickerSheet({
7635
8345
  Text,
7636
8346
  {
7637
8347
  style: [
7638
- styles30.title,
8348
+ styles33.title,
7639
8349
  { color: theme.colors.text, fontFamily: theme.fonts.display }
7640
8350
  ],
7641
8351
  numberOfLines: 1,
@@ -7649,7 +8359,7 @@ function UserPickerSheet({
7649
8359
  disabled: !canCreate,
7650
8360
  hitSlop: 6,
7651
8361
  style: [
7652
- styles30.createBtn,
8362
+ styles33.createBtn,
7653
8363
  {
7654
8364
  backgroundColor: canCreate ? theme.colors.accent : theme.colors.surfaceAlt,
7655
8365
  opacity: canCreate ? 1 : 0.6
@@ -7680,7 +8390,7 @@ function UserPickerSheet({
7680
8390
  value: groupName,
7681
8391
  onChangeText: setGroupName,
7682
8392
  style: [
7683
- styles30.groupNameInput,
8393
+ styles33.groupNameInput,
7684
8394
  {
7685
8395
  color: theme.colors.text,
7686
8396
  backgroundColor: theme.colors.surfaceAlt,
@@ -7699,7 +8409,7 @@ function UserPickerSheet({
7699
8409
  value: query,
7700
8410
  onChangeText: setQuery,
7701
8411
  style: [
7702
- styles30.searchInput,
8412
+ styles33.searchInput,
7703
8413
  {
7704
8414
  color: theme.colors.text,
7705
8415
  backgroundColor: theme.colors.surfaceAlt,
@@ -7716,7 +8426,7 @@ function UserPickerSheet({
7716
8426
  data: filtered,
7717
8427
  keyExtractor: (u) => u.externalId,
7718
8428
  keyboardShouldPersistTaps: "handled",
7719
- ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles30.empty, children: /* @__PURE__ */ jsx(Text, { style: [styles30.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
8429
+ ListEmptyComponent: /* @__PURE__ */ jsx(View, { style: styles33.empty, children: /* @__PURE__ */ jsx(Text, { style: [styles33.emptyText, { color: theme.colors.textSubtle }], children: query ? "No matches." : "No users to show." }) }),
7720
8430
  renderItem: ({ item }) => /* @__PURE__ */ jsx(
7721
8431
  UserRow,
7722
8432
  {
@@ -7758,29 +8468,29 @@ function UserRow({
7758
8468
  {
7759
8469
  onPress,
7760
8470
  style: [
7761
- styles30.row,
8471
+ styles33.row,
7762
8472
  {
7763
8473
  backgroundColor: selected ? theme.colors.accentSoft : "transparent"
7764
8474
  }
7765
8475
  ],
7766
8476
  children: [
7767
- user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style: styles30.avatarImg }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
7768
- /* @__PURE__ */ jsxs(View, { style: styles30.body, children: [
8477
+ user.avatarUrl ? /* @__PURE__ */ jsx(Image, { source: { uri: user.avatarUrl }, style: styles33.avatarImg }) : /* @__PURE__ */ jsx(Avatar, { src: null, name: user.name, seed: user.externalId, size: "md" }),
8478
+ /* @__PURE__ */ jsxs(View, { style: styles33.body, children: [
7769
8479
  /* @__PURE__ */ jsx(
7770
8480
  Text,
7771
8481
  {
7772
- style: [styles30.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8482
+ style: [styles33.name, { color: theme.colors.text, fontFamily: theme.fonts.body }],
7773
8483
  numberOfLines: 1,
7774
8484
  children: user.name
7775
8485
  }
7776
8486
  ),
7777
- user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles30.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
8487
+ user.subtitle ? /* @__PURE__ */ jsx(Text, { style: [styles33.subtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: user.subtitle }) : null
7778
8488
  ] }),
7779
8489
  isGroup ? /* @__PURE__ */ jsx(
7780
8490
  View,
7781
8491
  {
7782
8492
  style: [
7783
- styles30.checkbox,
8493
+ styles33.checkbox,
7784
8494
  {
7785
8495
  borderColor: selected ? theme.colors.accent : theme.colors.border,
7786
8496
  backgroundColor: selected ? theme.colors.accent : "transparent"
@@ -7793,7 +8503,7 @@ function UserRow({
7793
8503
  }
7794
8504
  );
7795
8505
  }
7796
- var styles30 = StyleSheet.create({
8506
+ var styles33 = StyleSheet.create({
7797
8507
  modalRoot: {
7798
8508
  flex: 1,
7799
8509
  justifyContent: "flex-end"
@@ -8064,7 +8774,7 @@ var PoolseInbox = forwardRef(
8064
8774
  },
8065
8775
  [renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts, showPresence]
8066
8776
  );
8067
- return /* @__PURE__ */ jsxs(View, { style: [styles31.root, { backgroundColor: theme.colors.background }], children: [
8777
+ return /* @__PURE__ */ jsxs(View, { style: [styles34.root, { backgroundColor: theme.colors.background }], children: [
8068
8778
  /* @__PURE__ */ jsxs(
8069
8779
  Animated.View,
8070
8780
  {
@@ -8075,7 +8785,7 @@ var PoolseInbox = forwardRef(
8075
8785
  View,
8076
8786
  {
8077
8787
  style: [
8078
- styles31.listHeader,
8788
+ styles34.listHeader,
8079
8789
  {
8080
8790
  backgroundColor: theme.colors.surface,
8081
8791
  borderBottomColor: theme.colors.border
@@ -8086,13 +8796,13 @@ var PoolseInbox = forwardRef(
8086
8796
  Text,
8087
8797
  {
8088
8798
  style: [
8089
- styles31.listTitle,
8799
+ styles34.listTitle,
8090
8800
  { color: theme.colors.text, fontFamily: theme.fonts.display }
8091
8801
  ],
8092
8802
  children: title
8093
8803
  }
8094
8804
  ),
8095
- /* @__PURE__ */ jsxs(View, { style: styles31.headerActions, children: [
8805
+ /* @__PURE__ */ jsxs(View, { style: styles34.headerActions, children: [
8096
8806
  users ? /* @__PURE__ */ jsxs(Fragment, { children: [
8097
8807
  /* @__PURE__ */ jsx(
8098
8808
  HeaderIconButton,
@@ -8208,7 +8918,7 @@ function HeaderIconButton({
8208
8918
  hitSlop: 10,
8209
8919
  accessibilityLabel: label,
8210
8920
  style: ({ pressed }) => [
8211
- styles31.iconBtn,
8921
+ styles34.iconBtn,
8212
8922
  {
8213
8923
  backgroundColor: pressed ? theme.colors.surfaceAlt : "transparent"
8214
8924
  }
@@ -8241,7 +8951,7 @@ function DefaultConversationRow({
8241
8951
  {
8242
8952
  onPress,
8243
8953
  style: [
8244
- styles31.row,
8954
+ styles34.row,
8245
8955
  {
8246
8956
  backgroundColor: selected ? theme.colors.surfaceAlt : "transparent",
8247
8957
  borderBottomColor: theme.colors.border
@@ -8258,23 +8968,23 @@ function DefaultConversationRow({
8258
8968
  ...presence ? { presence: presence.state, doNotDisturb: !!presence.do_not_disturb } : {}
8259
8969
  }
8260
8970
  ),
8261
- /* @__PURE__ */ jsxs(View, { style: styles31.rowBody, children: [
8971
+ /* @__PURE__ */ jsxs(View, { style: styles34.rowBody, children: [
8262
8972
  /* @__PURE__ */ jsx(
8263
8973
  Text,
8264
8974
  {
8265
- style: [styles31.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8975
+ style: [styles34.rowTitle, { color: theme.colors.text, fontFamily: theme.fonts.body }],
8266
8976
  numberOfLines: 1,
8267
8977
  children: title
8268
8978
  }
8269
8979
  ),
8270
- /* @__PURE__ */ jsx(Text, { style: [styles31.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
8980
+ /* @__PURE__ */ jsx(Text, { style: [styles34.rowSubtitle, { color: theme.colors.textSubtle }], numberOfLines: 1, children: formatCallLogPreview(conv.last_message_preview, meId) ?? formatRecordingNoticePreview(conv.last_message_preview, meId) ?? conv.last_message_preview ?? (isDirect ? otherExtId ?? "" : `${(conv.member_external_ids ?? []).length} members`) })
8271
8981
  ] }),
8272
- unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles31.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles31.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
8982
+ unread > 0 ? /* @__PURE__ */ jsx(View, { style: [styles34.unreadPill, { backgroundColor: theme.colors.badge }], children: /* @__PURE__ */ jsx(Text, { style: [styles34.unreadText, { color: theme.colors.badgeText }], children: unread > 99 ? "99+" : String(unread) }) }) : null
8273
8983
  ]
8274
8984
  }
8275
8985
  );
8276
8986
  }
8277
- var styles31 = StyleSheet.create({
8987
+ var styles34 = StyleSheet.create({
8278
8988
  root: {
8279
8989
  flex: 1,
8280
8990
  overflow: "hidden"
@@ -8336,6 +9046,439 @@ var styles31 = StyleSheet.create({
8336
9046
  fontWeight: "700"
8337
9047
  }
8338
9048
  });
9049
+ function LiveTranscriptPanel({
9050
+ callId,
9051
+ enabled = true,
9052
+ showControls = true,
9053
+ onClose,
9054
+ title = "Live transcript",
9055
+ style
9056
+ }) {
9057
+ const theme = useTheme();
9058
+ const live = useLiveTranscript(callId, { enabled });
9059
+ const blocks = useMemo(() => groupTranscript(live.segments), [live.segments]);
9060
+ const scroller = useRef(null);
9061
+ const pinned = useRef(true);
9062
+ const error = live.error ? transcriptError(live.error) : null;
9063
+ const text = { color: theme.colors.text, fontFamily: theme.fonts.body };
9064
+ const subtle = { color: theme.colors.textSubtle, fontFamily: theme.fonts.body };
9065
+ return /* @__PURE__ */ jsxs(View, { style: [styles35.panel, { backgroundColor: theme.colors.surface }, style], children: [
9066
+ /* @__PURE__ */ jsxs(View, { style: [styles35.head, { borderColor: theme.colors.border }], children: [
9067
+ /* @__PURE__ */ jsxs(Text, { style: [styles35.title, text], numberOfLines: 1, accessibilityRole: "header", children: [
9068
+ live.live ? "\u25CF " : "",
9069
+ title
9070
+ ] }),
9071
+ showControls && callId ? /* @__PURE__ */ jsx(
9072
+ Pressable,
9073
+ {
9074
+ onPress: () => void (live.live ? live.stop() : live.start()),
9075
+ disabled: live.pending,
9076
+ accessibilityRole: "button",
9077
+ accessibilityLabel: live.live ? "Stop the transcript" : "Start the transcript",
9078
+ hitSlop: 8,
9079
+ style: ({ pressed }) => [
9080
+ styles35.btn,
9081
+ { backgroundColor: theme.colors.surfaceAlt, borderColor: theme.colors.border },
9082
+ (pressed || live.pending) && styles35.pressed
9083
+ ],
9084
+ children: /* @__PURE__ */ jsx(Text, { style: [styles35.btnText, text], children: live.live ? "Stop" : live.transcript ? "Resume" : "Start" })
9085
+ }
9086
+ ) : null,
9087
+ onClose ? /* @__PURE__ */ jsx(
9088
+ Pressable,
9089
+ {
9090
+ onPress: onClose,
9091
+ accessibilityRole: "button",
9092
+ accessibilityLabel: "Close transcript",
9093
+ hitSlop: 8,
9094
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 18, color: theme.colors.textMuted, label: null })
9095
+ }
9096
+ ) : null
9097
+ ] }),
9098
+ /* @__PURE__ */ jsx(
9099
+ ScrollView,
9100
+ {
9101
+ ref: scroller,
9102
+ style: styles35.body,
9103
+ contentContainerStyle: styles35.bodyContent,
9104
+ onScroll: (e) => {
9105
+ const { contentOffset, contentSize, layoutMeasurement } = e.nativeEvent;
9106
+ pinned.current = contentSize.height - contentOffset.y - layoutMeasurement.height < 24;
9107
+ },
9108
+ scrollEventThrottle: 100,
9109
+ onContentSizeChange: () => {
9110
+ if (pinned.current) scroller.current?.scrollToEnd({ animated: false });
9111
+ },
9112
+ accessibilityLiveRegion: "polite",
9113
+ children: blocks.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles35.empty, subtle], children: error ?? (live.live ? "Listening\u2026" : live.joined ? "Transcription is off. Start it to see what is said." : "Opening the transcript\u2026") }) : blocks.map((b, i) => /* @__PURE__ */ jsxs(View, { style: styles35.block, children: [
9114
+ /* @__PURE__ */ jsxs(View, { style: styles35.who, children: [
9115
+ /* @__PURE__ */ jsx(Text, { style: [styles35.name, text], numberOfLines: 1, children: b.name }),
9116
+ /* @__PURE__ */ jsx(Text, { style: [styles35.time, subtle], children: formatCallDuration(b.startMs) })
9117
+ ] }),
9118
+ /* @__PURE__ */ jsx(Text, { style: [styles35.text, text], children: b.segments.map((s, k) => /* @__PURE__ */ jsxs(Text, { style: s.final ? void 0 : { color: theme.colors.textSubtle }, children: [
9119
+ k > 0 ? " " : "",
9120
+ s.text
9121
+ ] }, k)) })
9122
+ ] }, `${b.speaker}-${b.startMs}-${i}`))
9123
+ }
9124
+ ),
9125
+ error && blocks.length > 0 ? /* @__PURE__ */ jsx(Text, { style: [styles35.error, { color: theme.colors.danger, fontFamily: theme.fonts.body }], children: error }) : null
9126
+ ] });
9127
+ }
9128
+ function TranscriptViewer({
9129
+ callId,
9130
+ canRename = true,
9131
+ onSeek,
9132
+ title = "Transcript",
9133
+ style
9134
+ }) {
9135
+ const theme = useTheme();
9136
+ const { transcript, loading, missing, error, renameSpeakers } = useTranscript(callId);
9137
+ const [query, setQuery] = useState("");
9138
+ const [hit, setHit] = useState(0);
9139
+ const blocks = useMemo(() => groupTranscript(transcript?.segments ?? []), [transcript]);
9140
+ const scroller = useRef(null);
9141
+ const blockY = useRef(/* @__PURE__ */ new Map());
9142
+ const hits = useMemo(() => {
9143
+ const out = [];
9144
+ if (!query.trim()) return out;
9145
+ blocks.forEach(
9146
+ (block, b) => block.segments.forEach((seg, s) => {
9147
+ for (const r of findInText(seg.text, query)) out.push({ b, s, r });
9148
+ })
9149
+ );
9150
+ return out;
9151
+ }, [blocks, query]);
9152
+ const go = (next) => {
9153
+ setHit(next);
9154
+ const target = hits[next];
9155
+ const y = target ? blockY.current.get(target.b) : void 0;
9156
+ if (y !== void 0) scroller.current?.scrollTo({ y: Math.max(0, y - 40), animated: true });
9157
+ };
9158
+ const step = (d) => {
9159
+ if (hits.length) go((hit + d + hits.length) % hits.length);
9160
+ };
9161
+ if (!callId) return null;
9162
+ const text = { color: theme.colors.text, fontFamily: theme.fonts.body };
9163
+ const subtle = { color: theme.colors.textSubtle, fontFamily: theme.fonts.body };
9164
+ const meta = transcript ? [
9165
+ transcript.started_at ? formatDate(transcript.started_at) : null,
9166
+ duration(transcript),
9167
+ transcript.speakers.length === 1 ? "1 speaker" : `${transcript.speakers.length} speakers`
9168
+ ].filter(Boolean).join(" \xB7 ") : null;
9169
+ return /* @__PURE__ */ jsxs(View, { style: [styles35.panel, { backgroundColor: theme.colors.surface }, style], children: [
9170
+ /* @__PURE__ */ jsx(View, { style: [styles35.head, { borderColor: theme.colors.border }], children: /* @__PURE__ */ jsxs(View, { style: styles35.heading, children: [
9171
+ /* @__PURE__ */ jsx(Text, { style: [styles35.title, text], numberOfLines: 1, accessibilityRole: "header", children: title }),
9172
+ meta ? /* @__PURE__ */ jsx(Text, { style: [styles35.meta, subtle], numberOfLines: 1, children: meta }) : null
9173
+ ] }) }),
9174
+ transcript && transcript.segments.length > 0 ? /* @__PURE__ */ jsxs(View, { style: [styles35.search, { backgroundColor: theme.colors.surfaceAlt }], children: [
9175
+ /* @__PURE__ */ jsx(PoolseIcon, { name: "search", size: 15, color: theme.colors.textSubtle, label: null }),
9176
+ /* @__PURE__ */ jsx(
9177
+ TextInput,
9178
+ {
9179
+ value: query,
9180
+ onChangeText: (v) => {
9181
+ setQuery(v);
9182
+ setHit(0);
9183
+ },
9184
+ onSubmitEditing: () => step(1),
9185
+ placeholder: "Search the transcript",
9186
+ placeholderTextColor: theme.colors.textSubtle,
9187
+ accessibilityLabel: "Search the transcript",
9188
+ returnKeyType: "search",
9189
+ style: [styles35.searchInput, text]
9190
+ }
9191
+ ),
9192
+ query.trim() ? /* @__PURE__ */ jsxs(Fragment, { children: [
9193
+ /* @__PURE__ */ jsx(Text, { style: [styles35.count, subtle], accessibilityLiveRegion: "polite", children: hits.length ? `${hit + 1} of ${hits.length}` : "No matches" }),
9194
+ /* @__PURE__ */ jsx(
9195
+ Pressable,
9196
+ {
9197
+ onPress: () => step(-1),
9198
+ disabled: !hits.length,
9199
+ accessibilityRole: "button",
9200
+ accessibilityLabel: "Previous match",
9201
+ hitSlop: 6,
9202
+ children: /* @__PURE__ */ jsx(
9203
+ PoolseIcon,
9204
+ {
9205
+ name: "chevron-up",
9206
+ size: 16,
9207
+ color: theme.colors.textMuted,
9208
+ label: null
9209
+ }
9210
+ )
9211
+ }
9212
+ ),
9213
+ /* @__PURE__ */ jsx(
9214
+ Pressable,
9215
+ {
9216
+ onPress: () => step(1),
9217
+ disabled: !hits.length,
9218
+ accessibilityRole: "button",
9219
+ accessibilityLabel: "Next match",
9220
+ hitSlop: 6,
9221
+ children: /* @__PURE__ */ jsx(
9222
+ PoolseIcon,
9223
+ {
9224
+ name: "chevron-down",
9225
+ size: 16,
9226
+ color: theme.colors.textMuted,
9227
+ label: null
9228
+ }
9229
+ )
9230
+ }
9231
+ )
9232
+ ] }) : null
9233
+ ] }) : null,
9234
+ transcript && transcript.speakers.length > 0 ? /* @__PURE__ */ jsx(
9235
+ SpeakerList,
9236
+ {
9237
+ speakers: transcript.speakers,
9238
+ canRename,
9239
+ onRename: renameSpeakers
9240
+ }
9241
+ ) : null,
9242
+ /* @__PURE__ */ jsx(ScrollView, { ref: scroller, style: styles35.body, contentContainerStyle: styles35.bodyContent, children: loading && !transcript ? /* @__PURE__ */ jsx(Text, { style: [styles35.empty, subtle], children: "Loading the transcript\u2026" }) : missing ? /* @__PURE__ */ jsx(Text, { style: [styles35.empty, subtle], children: "This call has no transcript." }) : error && !transcript ? /* @__PURE__ */ jsx(Text, { style: [styles35.empty, subtle], children: transcriptError(error) }) : transcript && transcript.segments.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles35.empty, subtle], children: "Nothing was said in this call." }) : blocks.map((block, b) => /* @__PURE__ */ jsxs(
9243
+ View,
9244
+ {
9245
+ style: styles35.block,
9246
+ onLayout: (e) => blockY.current.set(b, e.nativeEvent.layout.y),
9247
+ children: [
9248
+ /* @__PURE__ */ jsxs(View, { style: styles35.who, children: [
9249
+ /* @__PURE__ */ jsx(Text, { style: [styles35.name, text], numberOfLines: 1, children: block.name }),
9250
+ onSeek ? /* @__PURE__ */ jsx(
9251
+ Pressable,
9252
+ {
9253
+ onPress: () => onSeek(block.startMs),
9254
+ accessibilityRole: "button",
9255
+ accessibilityLabel: `Play from ${formatCallDuration(block.startMs)}`,
9256
+ hitSlop: 6,
9257
+ children: /* @__PURE__ */ jsx(Text, { style: [styles35.time, subtle, styles35.timeLink], children: formatCallDuration(block.startMs) })
9258
+ }
9259
+ ) : /* @__PURE__ */ jsx(Text, { style: [styles35.time, subtle], children: formatCallDuration(block.startMs) })
9260
+ ] }),
9261
+ /* @__PURE__ */ jsx(Text, { style: [styles35.text, text], children: block.segments.map((seg, s) => /* @__PURE__ */ jsxs(Text, { children: [
9262
+ s > 0 ? " " : "",
9263
+ highlight(seg, hits, b, s, hit, theme.colors.warning)
9264
+ ] }, s)) })
9265
+ ]
9266
+ },
9267
+ `${block.speaker}-${block.startMs}-${b}`
9268
+ )) })
9269
+ ] });
9270
+ }
9271
+ function SpeakerList({
9272
+ speakers,
9273
+ canRename,
9274
+ onRename
9275
+ }) {
9276
+ const theme = useTheme();
9277
+ const [editing, setEditing] = useState(null);
9278
+ const [draft, setDraft] = useState("");
9279
+ const [busy, setBusy] = useState(false);
9280
+ const [error, setError] = useState(null);
9281
+ const text = { color: theme.colors.text, fontFamily: theme.fonts.body };
9282
+ const save = async (key, name) => {
9283
+ setBusy(true);
9284
+ setError(null);
9285
+ try {
9286
+ await onRename({ [key]: name });
9287
+ setEditing(null);
9288
+ } catch (err) {
9289
+ setError(
9290
+ err instanceof ApiError && err.status === 403 ? "Only people who were in the call can rename speakers." : err instanceof ApiError && err.code === "validation_failed" ? "Names can be up to 100 characters." : "The name could not be saved. Try again."
9291
+ );
9292
+ } finally {
9293
+ setBusy(false);
9294
+ }
9295
+ };
9296
+ const action = (label, onPress, primary = false) => /* @__PURE__ */ jsx(
9297
+ Pressable,
9298
+ {
9299
+ onPress,
9300
+ disabled: busy,
9301
+ accessibilityRole: "button",
9302
+ accessibilityLabel: label,
9303
+ hitSlop: 6,
9304
+ style: ({ pressed }) => [styles35.renameBtn, (pressed || busy) && styles35.pressed],
9305
+ children: /* @__PURE__ */ jsx(
9306
+ Text,
9307
+ {
9308
+ style: [
9309
+ styles35.renameBtnText,
9310
+ {
9311
+ color: primary ? theme.colors.accentStrong : theme.colors.text,
9312
+ fontFamily: theme.fonts.body
9313
+ }
9314
+ ],
9315
+ children: label
9316
+ }
9317
+ )
9318
+ }
9319
+ );
9320
+ return /* @__PURE__ */ jsxs(View, { style: styles35.speakers, children: [
9321
+ /* @__PURE__ */ jsx(View, { style: styles35.speakerRow, accessibilityLabel: "Speakers", children: speakers.map(
9322
+ (sp) => editing === sp.key ? /* @__PURE__ */ jsxs(View, { style: styles35.rename, children: [
9323
+ /* @__PURE__ */ jsx(
9324
+ TextInput,
9325
+ {
9326
+ value: draft,
9327
+ onChangeText: setDraft,
9328
+ maxLength: 100,
9329
+ autoFocus: true,
9330
+ accessibilityLabel: "Speaker name",
9331
+ onSubmitEditing: () => draft.trim() && void save(sp.key, draft.trim()),
9332
+ style: [
9333
+ styles35.renameInput,
9334
+ text,
9335
+ { borderColor: theme.colors.border, backgroundColor: theme.colors.background }
9336
+ ]
9337
+ }
9338
+ ),
9339
+ action("Save", () => draft.trim() && void save(sp.key, draft.trim()), true),
9340
+ sp.corrected ? action("Use their own name", () => void save(sp.key, null)) : null,
9341
+ action("Cancel", () => setEditing(null))
9342
+ ] }, sp.key) : /* @__PURE__ */ jsxs(
9343
+ View,
9344
+ {
9345
+ style: [styles35.speaker, { backgroundColor: theme.colors.surfaceAlt }],
9346
+ children: [
9347
+ /* @__PURE__ */ jsx(Text, { style: [styles35.speakerName, text], numberOfLines: 1, children: sp.name?.trim() || "Speaker" }),
9348
+ canRename ? /* @__PURE__ */ jsx(
9349
+ Pressable,
9350
+ {
9351
+ onPress: () => {
9352
+ setDraft(sp.name ?? "");
9353
+ setError(null);
9354
+ setEditing(sp.key);
9355
+ },
9356
+ accessibilityRole: "button",
9357
+ accessibilityLabel: `Rename ${sp.name?.trim() || "speaker"}`,
9358
+ hitSlop: 8,
9359
+ style: styles35.speakerEdit,
9360
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "edit", size: 13, color: theme.colors.textMuted, label: null })
9361
+ }
9362
+ ) : null
9363
+ ]
9364
+ },
9365
+ sp.key
9366
+ )
9367
+ ) }),
9368
+ error ? /* @__PURE__ */ jsx(Text, { style: [styles35.error, { color: theme.colors.danger, fontFamily: theme.fonts.body }], children: error }) : null
9369
+ ] });
9370
+ }
9371
+ function highlight(seg, hits, b, s, current, color) {
9372
+ const mine = hits.map((h, i) => ({ ...h, i })).filter((h) => h.b === b && h.s === s);
9373
+ if (!mine.length) return seg.text;
9374
+ const out = [];
9375
+ let at = 0;
9376
+ for (const h of mine) {
9377
+ if (h.r[0] > at) out.push(seg.text.slice(at, h.r[0]));
9378
+ out.push(
9379
+ /* @__PURE__ */ jsx(Text, { style: { backgroundColor: hexAlpha(color, h.i === current ? 0.65 : 0.3) }, children: seg.text.slice(h.r[0], h.r[1]) }, h.i)
9380
+ );
9381
+ at = h.r[1];
9382
+ }
9383
+ if (at < seg.text.length) out.push(seg.text.slice(at));
9384
+ return out;
9385
+ }
9386
+ function hexAlpha(color, a) {
9387
+ const m = /^#([0-9a-f]{6})$/i.exec(color);
9388
+ if (!m) return color;
9389
+ const n = parseInt(m[1], 16);
9390
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${a})`;
9391
+ }
9392
+ function duration(t) {
9393
+ if (!t.started_at || !t.ended_at) return null;
9394
+ const ms = Date.parse(t.ended_at) - Date.parse(t.started_at);
9395
+ return Number.isFinite(ms) && ms > 0 ? formatCallDuration(ms) : null;
9396
+ }
9397
+ function formatDate(iso) {
9398
+ const d = new Date(iso);
9399
+ if (Number.isNaN(d.getTime())) return null;
9400
+ return d.toLocaleString([], {
9401
+ month: "short",
9402
+ day: "numeric",
9403
+ hour: "numeric",
9404
+ minute: "2-digit"
9405
+ });
9406
+ }
9407
+ function transcriptError(err) {
9408
+ const code = err instanceof ApiError ? err.code : err.message;
9409
+ if (code === "forbidden") return "You can\u2019t open this transcript.";
9410
+ if (code === "not_found") return "There is no transcript for this call.";
9411
+ return captureErrorMessage(err instanceof ApiError ? err : { code });
9412
+ }
9413
+ var styles35 = StyleSheet.create({
9414
+ panel: { flex: 1, minHeight: 0 },
9415
+ pressed: { opacity: 0.6 },
9416
+ head: {
9417
+ flexDirection: "row",
9418
+ alignItems: "center",
9419
+ gap: 8,
9420
+ paddingHorizontal: 12,
9421
+ paddingVertical: 10,
9422
+ borderBottomWidth: StyleSheet.hairlineWidth
9423
+ },
9424
+ heading: { flex: 1, minWidth: 0 },
9425
+ title: { flex: 1, fontSize: 15, fontWeight: "600" },
9426
+ meta: { fontSize: 12, fontWeight: "500" },
9427
+ btn: {
9428
+ paddingHorizontal: 12,
9429
+ paddingVertical: 4,
9430
+ borderRadius: 999,
9431
+ borderWidth: StyleSheet.hairlineWidth
9432
+ },
9433
+ btnText: { fontSize: 12, fontWeight: "600" },
9434
+ search: {
9435
+ flexDirection: "row",
9436
+ alignItems: "center",
9437
+ gap: 6,
9438
+ marginHorizontal: 12,
9439
+ marginTop: 8,
9440
+ paddingLeft: 10,
9441
+ paddingRight: 6,
9442
+ borderRadius: 12
9443
+ },
9444
+ searchInput: { flex: 1, minWidth: 0, paddingVertical: 8, fontSize: 14 },
9445
+ count: { fontSize: 12, fontWeight: "500", fontVariant: ["tabular-nums"] },
9446
+ speakers: { paddingHorizontal: 12, paddingTop: 8 },
9447
+ speakerRow: { flexDirection: "row", flexWrap: "wrap", gap: 6 },
9448
+ speaker: {
9449
+ flexDirection: "row",
9450
+ alignItems: "center",
9451
+ maxWidth: "100%",
9452
+ paddingLeft: 10,
9453
+ paddingRight: 4,
9454
+ paddingVertical: 3,
9455
+ borderRadius: 999
9456
+ },
9457
+ speakerName: { flexShrink: 1, maxWidth: 220, fontSize: 12, fontWeight: "500" },
9458
+ speakerEdit: { padding: 4 },
9459
+ rename: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 4, width: "100%" },
9460
+ renameInput: {
9461
+ flexGrow: 1,
9462
+ minWidth: 140,
9463
+ paddingHorizontal: 8,
9464
+ paddingVertical: 6,
9465
+ fontSize: 13,
9466
+ borderRadius: 8,
9467
+ borderWidth: StyleSheet.hairlineWidth
9468
+ },
9469
+ renameBtn: { paddingHorizontal: 8, paddingVertical: 6 },
9470
+ renameBtnText: { fontSize: 12, fontWeight: "600" },
9471
+ body: { flex: 1 },
9472
+ bodyContent: { paddingHorizontal: 12, paddingTop: 8, paddingBottom: 12 },
9473
+ empty: { marginVertical: 24, textAlign: "center", fontSize: 14 },
9474
+ block: { paddingVertical: 6 },
9475
+ who: { flexDirection: "row", alignItems: "baseline", gap: 8, minWidth: 0 },
9476
+ name: { flexShrink: 1, fontSize: 13, fontWeight: "600" },
9477
+ time: { fontSize: 11, fontWeight: "500", fontVariant: ["tabular-nums"] },
9478
+ timeLink: { textDecorationLine: "underline" },
9479
+ text: { marginTop: 2, fontSize: 14, lineHeight: 21 },
9480
+ error: { marginHorizontal: 12, marginVertical: 6, fontSize: 13, fontWeight: "500" }
9481
+ });
8339
9482
  var TILE_PATH = "M50 4 C20 4 4 20 4 50 C4 80 20 96 50 96 C80 96 96 80 96 50 C96 20 80 4 50 4 Z";
8340
9483
  var PULSE_PATH = "M16 55 H34 L40 55 L47 30 L54 73 L60 55 H72";
8341
9484
  var WORDMARK_P_PATH = "M62 -169V258V528H194L196 378L214 376Q223 432 246.0 469.0Q269 506 305.5 524.0Q342 542 389 542Q459 542 509.5 508.0Q560 474 587.0 411.0Q614 348 614 260Q614 182 590.5 120.0Q567 58 519.5 22.0Q472 -14 399 -14Q350 -14 316.0 3.5Q282 21 258.5 55.0Q235 89 219 140H200Q206 113 211.0 85.0Q216 57 219.5 31.0Q223 5 223 -19V-169ZM340 113Q373 113 396.5 131.0Q420 149 433.0 182.0Q446 215 446 259Q446 306 432.5 339.5Q419 373 394.0 391.5Q369 410 336 410Q305 410 283.5 396.5Q262 383 248.5 361.5Q235 340 229.0 316.0Q223 292 223 271V249Q223 230 228.0 211.0Q233 192 243.0 174.5Q253 157 267.0 143.0Q281 129 299.5 121.0Q318 113 340 113Z";
@@ -8410,9 +9553,9 @@ function useAppStateLifecycle(options = {}) {
8410
9553
  const sub = AppState.addEventListener("change", (next) => {
8411
9554
  if (next === "background") {
8412
9555
  setActivity("idle");
8413
- poolse.realtime.pause();
9556
+ poolse.setBackground(true);
8414
9557
  } else if (next === "active") {
8415
- poolse.realtime.resume();
9558
+ poolse.setBackground(false);
8416
9559
  setActivity("active");
8417
9560
  } else {
8418
9561
  setActivity("idle");
@@ -8422,6 +9565,41 @@ function useAppStateLifecycle(options = {}) {
8422
9565
  }, [poolse, presence]);
8423
9566
  }
8424
9567
 
9568
+ // src/internal/background.ts
9569
+ function applyBackground(clients, active, appActive, keepConnected = []) {
9570
+ for (const c of clients) {
9571
+ if (c.destroyed) continue;
9572
+ const foreground = appActive && (c === active || keepConnected.includes(c));
9573
+ c.setBackground(!foreground);
9574
+ }
9575
+ }
9576
+
9577
+ // src/lifecycle/useBackgroundClients.ts
9578
+ function useBackgroundClients(clients, active, opts = {}) {
9579
+ const [appState, setAppState] = useState(AppState.currentState ?? "active");
9580
+ useEffect(() => {
9581
+ const sub = AppState.addEventListener("change", setAppState);
9582
+ return () => sub.remove();
9583
+ }, []);
9584
+ const appActive = appState !== "background";
9585
+ const keep = opts.keepConnected ?? EMPTY;
9586
+ const presence = opts.presence ?? true;
9587
+ const lastActive = useRef(null);
9588
+ useEffect(() => {
9589
+ applyBackground(clients, active, appActive, keep);
9590
+ }, [clients, active, appActive, keep]);
9591
+ useEffect(() => {
9592
+ if (!presence) return;
9593
+ const prev = lastActive.current;
9594
+ if (prev && prev !== active && !prev.destroyed) prev.presence.setActivity("idle");
9595
+ lastActive.current = active;
9596
+ if (active && !active.destroyed) {
9597
+ active.presence.setActivity(appState === "active" ? "active" : "idle");
9598
+ }
9599
+ }, [active, appState, presence]);
9600
+ }
9601
+ var EMPTY = [];
9602
+
8425
9603
  // src/voice/callTheme.ts
8426
9604
  var callColors = {
8427
9605
  /** Behind everything. Near-black, cooled toward the brand. */
@@ -8470,7 +9648,7 @@ function CallControlButton({
8470
9648
  const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;
8471
9649
  const background = tone === "danger" ? callColors.danger : tone === "accept" ? callColors.accept : active ? callColors.controlActive : callColors.control;
8472
9650
  const iconColor = tone === "neutral" && active ? callColors.controlActiveIcon : callColors.onAction;
8473
- return /* @__PURE__ */ jsxs(View, { style: styles32.slot, children: [
9651
+ return /* @__PURE__ */ jsxs(View, { style: styles36.slot, children: [
8474
9652
  /* @__PURE__ */ jsx(
8475
9653
  Pressable,
8476
9654
  {
@@ -8481,7 +9659,7 @@ function CallControlButton({
8481
9659
  accessibilityLabel: accessibilityLabel ?? label ?? icon,
8482
9660
  hitSlop: 8,
8483
9661
  style: ({ pressed }) => [
8484
- styles32.button,
9662
+ styles36.button,
8485
9663
  {
8486
9664
  width: size,
8487
9665
  height: size,
@@ -8495,10 +9673,10 @@ function CallControlButton({
8495
9673
  children: /* @__PURE__ */ jsx(PoolseIcon, { name: icon, size: large ? 30 : 25, color: iconColor, label: null })
8496
9674
  }
8497
9675
  ),
8498
- label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles32.label, children: label }) : null
9676
+ label ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles36.label, children: label }) : null
8499
9677
  ] });
8500
9678
  }
8501
- var styles32 = StyleSheet.create({
9679
+ var styles36 = StyleSheet.create({
8502
9680
  // Fixed width so captions of different lengths cannot shift the row.
8503
9681
  slot: { width: 76, alignItems: "center", gap: 7 },
8504
9682
  button: { alignItems: "center", justifyContent: "center" },
@@ -8511,7 +9689,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8511
9689
  View,
8512
9690
  {
8513
9691
  style: [
8514
- styles33.ring,
9692
+ styles37.ring,
8515
9693
  {
8516
9694
  width: outer,
8517
9695
  height: outer,
@@ -8524,7 +9702,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8524
9702
  View,
8525
9703
  {
8526
9704
  style: [
8527
- styles33.circle,
9705
+ styles37.circle,
8528
9706
  {
8529
9707
  width: size,
8530
9708
  height: size,
@@ -8535,7 +9713,7 @@ function CallAvatar({ name, seed, size, speaking = false }) {
8535
9713
  children: /* @__PURE__ */ jsx(
8536
9714
  Text,
8537
9715
  {
8538
- style: [styles33.initials, { fontSize: Math.round(size * 0.38) }],
9716
+ style: [styles37.initials, { fontSize: Math.round(size * 0.38) }],
8539
9717
  numberOfLines: 1,
8540
9718
  allowFontScaling: false,
8541
9719
  children: initialsOf(name)
@@ -8552,7 +9730,7 @@ function initialsOf(name) {
8552
9730
  if (parts.length === 1) return parts[0].slice(0, 2).toUpperCase();
8553
9731
  return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
8554
9732
  }
8555
- var styles33 = StyleSheet.create({
9733
+ var styles37 = StyleSheet.create({
8556
9734
  ring: { alignItems: "center", justifyContent: "center" },
8557
9735
  circle: { alignItems: "center", justifyContent: "center" },
8558
9736
  initials: { color: "#ffffff", fontWeight: "600" }
@@ -8580,15 +9758,15 @@ function AudioRouteSheet({
8580
9758
  animationType: "fade",
8581
9759
  onRequestClose: onClose,
8582
9760
  ...EDGE_TO_EDGE_MODAL,
8583
- children: /* @__PURE__ */ jsx(Pressable, { style: styles34.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(
9761
+ children: /* @__PURE__ */ jsx(Pressable, { style: styles38.backdrop, onPress: onClose, accessibilityRole: "button", children: /* @__PURE__ */ jsxs(
8584
9762
  Pressable,
8585
9763
  {
8586
- style: [styles34.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
9764
+ style: [styles38.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }],
8587
9765
  onPress: () => {
8588
9766
  },
8589
9767
  children: [
8590
- /* @__PURE__ */ jsx(View, { style: styles34.grabber }),
8591
- /* @__PURE__ */ jsx(Text, { style: styles34.title, children: "Audio output" }),
9768
+ /* @__PURE__ */ jsx(View, { style: styles38.grabber }),
9769
+ /* @__PURE__ */ jsx(Text, { style: styles38.title, children: "Audio output" }),
8592
9770
  routes.map((route) => {
8593
9771
  const selected = route.id === selectedRouteId;
8594
9772
  return /* @__PURE__ */ jsxs(
@@ -8600,7 +9778,7 @@ function AudioRouteSheet({
8600
9778
  },
8601
9779
  accessibilityRole: "button",
8602
9780
  accessibilityState: { selected },
8603
- style: ({ pressed }) => [styles34.row, pressed && styles34.rowPressed],
9781
+ style: ({ pressed }) => [styles38.row, pressed && styles38.rowPressed],
8604
9782
  children: [
8605
9783
  /* @__PURE__ */ jsx(
8606
9784
  PoolseIcon,
@@ -8611,7 +9789,7 @@ function AudioRouteSheet({
8611
9789
  label: null
8612
9790
  }
8613
9791
  ),
8614
- /* @__PURE__ */ jsx(Text, { style: [styles34.label, selected && styles34.labelSelected], children: route.label }),
9792
+ /* @__PURE__ */ jsx(Text, { style: [styles38.label, selected && styles38.labelSelected], children: route.label }),
8615
9793
  selected && /* @__PURE__ */ jsx(PoolseIcon, { name: "check", size: 19, color: callColors.accept, label: "selected" })
8616
9794
  ]
8617
9795
  },
@@ -8624,7 +9802,7 @@ function AudioRouteSheet({
8624
9802
  }
8625
9803
  );
8626
9804
  }
8627
- var styles34 = StyleSheet.create({
9805
+ var styles38 = StyleSheet.create({
8628
9806
  backdrop: { flex: 1, backgroundColor: "rgba(0,0,0,0.55)", justifyContent: "flex-end" },
8629
9807
  sheet: {
8630
9808
  backgroundColor: callColors.tile,
@@ -8684,6 +9862,6 @@ function format(total) {
8684
9862
  return `${hours > 0 ? `${hours}:` : ""}${mm}:${String(seconds).padStart(2, "0")}`;
8685
9863
  }
8686
9864
 
8687
- export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConversationList, ConversationView, DaySeparator, EditHistorySheet, EmojiPicker, GroupDetailsSheet, ImageMosaic, LinkPreviewCard, LiveCallBanner, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, NewMessagesDivider, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, ReactionPicker, ReactionStrip, ThreadSummary, ThreadView, TypingIndicator, UploadQueueStrip, UserName, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useCallDuration, useDisplayName, usePoolseTheme, useTheme };
9865
+ export { AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, CallAvatar, CallControlButton, CallLogRow, ChatHeader, ConsentPrompt, ConversationList, ConversationView, DaySeparator, EditHistorySheet, EmojiPicker, EmptyState, GroupDetailsSheet, ImageMosaic, LinkPreviewCard, LiveCallBanner, LiveTranscriptPanel, MemberList, MentionInput, MessageActions, MessageBubble, MessageComposer, MessageList, MessageRow, NewMessagesDivider, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, ReactionPicker, ReactionStrip, RecordingBanner, RecordingIndicator, RecordingNoticeRow, SendStatus, ThreadSummary, ThreadView, TranscriptViewer, TypingIndicator, UploadQueueStrip, UserName, applyBackground, callColors, defaultDarkTheme, defaultLightTheme, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, usePoolseTheme, useTheme };
8688
9866
  //# sourceMappingURL=index.js.map
8689
9867
  //# sourceMappingURL=index.js.map