@poolse/react-native 3.2.0-dev.2 → 3.2.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/default.ts","../src/theme/PoolseTheme.tsx","../src/primitives/userColor.ts","../src/primitives/Avatar.tsx","../src/primitives/icons-data.ts","../src/primitives/PoolseIcon.tsx","../src/MemberList.tsx","../src/internal/edgeToEdge.ts","../src/internal/safeArea.ts","../src/internal/useDismissableSheet.ts","../src/GroupDetailsSheet.tsx","../src/ChatHeader.tsx","../src/ConversationList.tsx","../src/internal/uploadContext.tsx","../src/AttachmentPicker.tsx","../src/DaySeparator.tsx","../src/LiveCallBanner.tsx","../src/UploadQueueStrip.tsx","../src/internal/useKeyboardOpen.ts","../src/MessageComposer.tsx","../src/MentionInput.tsx","../src/MessageList.tsx","../src/CallLogRow.tsx","../src/MessageActions.tsx","../src/AttachmentPreview.tsx","../src/ImageMosaic.tsx","../src/internal/bubbleText.ts","../src/internal/markdown.ts","../src/MessageBubble.tsx","../src/Reactions.tsx","../src/MessageRow.tsx","../src/ThreadView.tsx","../src/UserName.tsx","../src/TypingIndicator.tsx","../src/ConversationView.tsx","../src/internal/UserPickerSheet.tsx","../src/PoolseInbox.tsx","../src/primitives/PoolseLogo.tsx","../src/primitives/index.ts","../src/lifecycle/useAppStateLifecycle.tsx","../src/voice/callTheme.ts","../src/voice/CallControlButton.tsx","../src/voice/CallAvatar.tsx","../src/voice/AudioRouteSheet.tsx","../src/voice/useCallDuration.ts"],"names":["createContext","useMemo","useContext","jsxs","View","jsx","Image","Text","StyleSheet","SvgXml","useMembers","usePresence","styles","ActivityIndicator","FlatList","Fragment","useUser","Pressable","useSafeAreaInsets","useRef","Animated","PanResponder","useConversation","useWindowDimensions","Modal","useMe","useState","useConversations","formatCallLogPreview","useAttachmentUpload","useCallback","RNImage","manipulateAsync","SaveFormat","ImagePicker","res","DocumentPicker","ScrollView","useEffect","Keyboard","Platform","forwardRef","MessageComposer","useImperativeHandle","TextInput","KeyboardAvoidingView","callLogDisplayFor","useAttachmentUrl","formatBytes","MarkdownIt","createElement","Markdown","radii","formatTime","Linking","sameDay","useReactions","Clipboard","useThread","Easing","receiptsOf","useMessages","useTyping","useMessageStreams","useRealtimeStatus","AppState","isMessageVisibleTo","computeGroupPosition","canEditOwnMessage","formatDayLabel","useLiveCall","PoolseInbox","Svg","Path","Circle","G","usePoolse","ICONS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,WAAA,GAAc;AAAA,EAClB,KAAA,EAAO,SAAA;AAAA,EACP,WAAA,EAAa,SAAA;AAAA,EACb,SAAA,EAAW,SAAA;AAAA,EACX,OAAA,EAAS,SAAA;AAAA,EACT,KAAA,EAAO,SAAA;AAAA,EACP,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,SAAA;AAAA,EACV,GAAA,EAAK,SAAA;AAAA,EACL,IAAA,EAAM,SAAA;AAAA,EACN,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ,SAAA;AAAA,EACR,QAAA,EAAU,SAAA;AAAA,EACV,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,KAAA,EAAO,SAAA;AAAA,EACP,IAAA,EAAM,SAAA;AAAA,EACN,UAAA,EAAY,SAAA;AAAA,EACZ,cAAA,EAAgB,SAAA;AAAA,EAChB,WAAA,EAAa,SAAA;AAAA,EACb,eAAA,EAAiB,SAAA;AAAA,EACjB,UAAA,EAAY,SAAA;AAAA,EACZ,cAAA,EAAgB;AAClB,CAAA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} from './types.js';\n\n// Values mirror the --poolse-* CSS variables in @poolse/react-ui's\n// styles.css :root block. If the brand changes there, change here.\n\nconst lightColors = {\n brand: '#ff5436',\n brandStrong: '#d63415',\n brandSoft: '#ffe9e2',\n onBrand: '#fbf7f4',\n paper: '#fbf7f4',\n surface: '#ffffff',\n surface2: '#f4eee9',\n ink: '#1c1a19',\n ink2: '#6b6560',\n ink3: '#9a938c',\n border: '#eae3dc',\n presence: '#16c172',\n success: '#16a34a',\n warning: '#e08c16',\n error: '#e5484d',\n info: '#3b82f6',\n selfBubble: '#ff5436',\n selfBubbleText: '#fbf7f4',\n otherBubble: '#ffffff',\n otherBubbleText: '#1c1a19',\n unreadPill: '#ff5436',\n unreadPillText: '#fbf7f4',\n};\n\nconst darkColors = {\n brand: '#ff6a4d',\n brandStrong: '#ff8366',\n brandSoft: '#2c1712',\n onBrand: '#fbf7f4',\n paper: '#0e0d10',\n surface: '#16141a',\n surface2: '#201d25',\n ink: '#f6f2ee',\n ink2: '#a8a29b',\n ink3: '#766f68',\n border: '#2a2630',\n presence: '#22d37a',\n success: '#34d399',\n warning: '#fbbf24',\n error: '#f87171',\n info: '#60a5fa',\n selfBubble: '#ff6a4d',\n selfBubbleText: '#fbf7f4',\n otherBubble: '#16141a',\n otherBubbleText: '#f6f2ee',\n unreadPill: '#ff6a4d',\n unreadPillText: '#fbf7f4',\n};\n\nconst type = {\n // RN can't use Bricolage/Hanken/JetBrains without expo-font setup,\n // so we default to the platform sans-serif. Devs override via the\n // theme prop if they ship custom fonts.\n fontDisplay: 'System',\n fontBody: 'System',\n fontMono: 'Menlo',\n bodySize: 15,\n lineHeight: 22,\n weightRegular: '400' as const,\n weightMedium: '500' as const,\n weightSemibold: '600' as const,\n weightBold: '700' as const,\n};\n\nconst radii = {\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n pill: 999,\n bubble: 18,\n};\n\nconst spacing = {\n xs: 4,\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n};\n\nconst lightShadows: ThemeShadows = {\n sm: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 1 },\n shadowRadius: 2,\n elevation: 1,\n },\n md: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.18,\n shadowOffset: { width: 0, height: 10 },\n shadowRadius: 30,\n elevation: 6,\n },\n lg: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.28,\n shadowOffset: { width: 0, height: 24 },\n shadowRadius: 60,\n elevation: 12,\n },\n};\n\nconst darkShadows: ThemeShadows = {\n sm: {\n shadowColor: '#000000',\n shadowOpacity: 0.4,\n shadowOffset: { width: 0, height: 1 },\n shadowRadius: 2,\n elevation: 1,\n },\n md: {\n shadowColor: '#000000',\n shadowOpacity: 0.55,\n shadowOffset: { width: 0, height: 10 },\n shadowRadius: 30,\n elevation: 6,\n },\n lg: {\n shadowColor: '#000000',\n shadowOpacity: 0.7,\n shadowOffset: { width: 0, height: 24 },\n shadowRadius: 60,\n elevation: 12,\n },\n};\n\nexport const defaultLightTheme: PoolseRNTheme = {\n mode: 'light',\n colors: lightColors,\n type,\n radii,\n spacing,\n shadows: lightShadows,\n};\n\nexport const defaultDarkTheme: PoolseRNTheme = {\n mode: 'dark',\n colors: darkColors,\n type,\n radii,\n spacing,\n shadows: darkShadows,\n};\n","import { createContext, useContext, useMemo, type ReactNode } from 'react';\n\nimport { defaultDarkTheme, defaultLightTheme } from './default.js';\nimport type { PoolseRNTheme, PoolseRNThemeOverrides, ThemeMode } from './types.js';\n\nconst ThemeContext = createContext<PoolseRNTheme | null>(null);\n\nexport interface PoolseThemeProps {\n /**\n * Light or dark base palette. Overrides are merged on top of the\n * chosen base. Defaults to `light` if omitted.\n */\n mode?: ThemeMode;\n /**\n * Partial overrides — only the fields you set replace the defaults.\n * Nested groups (`colors`, `type`, `radii`, `spacing`, `shadows`)\n * deep-merge, so `{ colors: { brand: '#000' } }` keeps every other\n * color from the base theme.\n */\n theme?: PoolseRNThemeOverrides;\n children: ReactNode;\n}\n\nexport function PoolseTheme({ mode, theme, children }: PoolseThemeProps) {\n const resolved = useMemo(() => {\n const base = (mode ?? theme?.mode) === 'dark' ? defaultDarkTheme : defaultLightTheme;\n if (!theme) return base;\n return {\n mode: theme.mode ?? base.mode,\n colors: { ...base.colors, ...theme.colors },\n type: { ...base.type, ...theme.type },\n radii: { ...base.radii, ...theme.radii },\n spacing: { ...base.spacing, ...theme.spacing },\n shadows: {\n sm: { ...base.shadows.sm, ...theme.shadows?.sm },\n md: { ...base.shadows.md, ...theme.shadows?.md },\n lg: { ...base.shadows.lg, ...theme.shadows?.lg },\n },\n } satisfies PoolseRNTheme;\n }, [mode, theme]);\n\n return <ThemeContext.Provider value={resolved}>{children}</ThemeContext.Provider>;\n}\n\n/**\n * Read the active poolse theme. Falls back to `defaultLightTheme`\n * if no `<PoolseTheme>` ancestor is mounted, so components render\n * sensibly even without explicit wiring.\n */\nexport function usePoolseTheme(): PoolseRNTheme {\n return useContext(ThemeContext) ?? defaultLightTheme;\n}\n","// Mirror of @poolse/react-ui's userColor — deterministic per-user\n// color from the same 8-hue palette.\n\nconst PALETTE = [\n '#6366f1', // indigo\n '#10b981', // emerald\n '#f59e0b', // amber\n '#ec4899', // rose\n '#0ea5e9', // sky\n '#8b5cf6', // violet\n '#14b8a6', // teal\n '#d946ef', // fuchsia\n];\n\nexport function userColor(id: string): string {\n let h = 0;\n for (let i = 0; i < id.length; i++) {\n h = (h * 31 + id.charCodeAt(i)) | 0;\n }\n return PALETTE[Math.abs(h) % PALETTE.length]!;\n}\n","import { Image, StyleSheet, Text, View } from 'react-native';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\nimport { userColor } from './userColor.js';\n\nexport interface AvatarProps {\n /** URL to a profile image. Falls back to initials when omitted. */\n src?: string | null;\n /** Used for initials. */\n name?: string | null;\n /** Stable color seed (typically the user's external_id). */\n seed?: string | null;\n /** Show a green presence dot in the bottom-right corner. */\n online?: boolean;\n /** Size variant. `md` → 40px, `sm` → 28px, `lg` → 56px. */\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst SIZES = { sm: 28, md: 40, lg: 56 } as const;\n\nexport function Avatar({ src, name, seed, online, size = 'md' }: AvatarProps) {\n const theme = usePoolseTheme();\n const dim = SIZES[size];\n const initials = computeInitials(name);\n const tint = seed ? userColor(seed) : theme.colors.brand;\n const fontSize = size === 'sm' ? 11 : size === 'lg' ? 22 : 15;\n\n return (\n <View\n style={[\n styles.root,\n {\n width: dim,\n height: dim,\n borderRadius: dim / 2,\n backgroundColor: tint,\n },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={name ?? 'avatar'}\n >\n {src ? (\n <Image\n source={{ uri: src }}\n style={{ width: dim, height: dim, borderRadius: dim / 2 }}\n accessible={false}\n />\n ) : (\n <Text\n style={{\n color: theme.colors.onBrand,\n fontSize,\n fontWeight: '600',\n fontFamily: theme.type.fontBody,\n }}\n >\n {initials}\n </Text>\n )}\n {online ? (\n <View\n style={[\n styles.presence,\n {\n backgroundColor: theme.colors.presence,\n borderColor: theme.colors.surface,\n width: dim * 0.32,\n height: dim * 0.32,\n borderRadius: dim * 0.16,\n },\n ]}\n />\n ) : null}\n </View>\n );\n}\n\nfunction computeInitials(name: string | null | undefined): string {\n if (!name) return '?';\n const parts = name.trim().split(/\\s+/).slice(0, 2);\n return (\n parts\n .map((p) => p.charAt(0).toUpperCase())\n .join('')\n .slice(0, 2) || '?'\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'visible',\n },\n presence: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n borderWidth: 2,\n },\n});\n","// AUTO-GENERATED from poolse-brand-kit/icons/. Do not edit by hand.\n// Run scripts/build-icons.py from the brand kit if the source SVGs change.\n\nexport interface IconDef {\n vb: string;\n d: string;\n}\n\nexport const ICONS = {\n attachment: {\n vb: '0 0 24 24',\n d: '<path d=\"M20 11.6 11.4 20.2a5 5 0 0 1-7.1-7.1l8.7-8.7a3.3 3.3 0 0 1 4.7 4.7l-8.6 8.6a1.65 1.65 0 0 1-2.36-2.32l7.86-7.86\"/>',\n },\n bell: {\n vb: '0 0 24 24',\n d: '<path d=\"M6 9.2a6 6 0 0 1 12 0c0 4.8 1.4 6.3 1.9 6.8H4.1C4.6 15.5 6 14 6 9.2Z\"/><path d=\"M9.6 19.8a2.5 2.5 0 0 0 4.8 0\"/>',\n },\n bluetooth: {\n vb: '0 0 24 24',\n d: '<path d=\"M7.5 7.5 16.5 16.5 12 21V3l4.5 4.5L7.5 16.5\"/>',\n },\n camera: {\n vb: '0 0 24 24',\n d: '<path d=\"M3 8.5a2 2 0 0 1 2-2h2.4l1.4-2h6.4l1.4 2H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9Z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>',\n },\n 'camera-flip': {\n vb: '0 0 24 24',\n d: '<path d=\"M3 8.5a2 2 0 0 1 2-2h2.4l1.4-2h6.4l1.4 2H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9Z\"/><path d=\"M14.6 13a2.6 2.6 0 0 1-4.5 1.8\"/><path d=\"M9.4 13a2.6 2.6 0 0 1 4.5-1.8\"/><path d=\"M13.9 9.6v1.7h-1.7\"/><path d=\"M10.1 16.4v-1.7h1.7\"/>',\n },\n 'check-double': {\n vb: '0 0 24 24',\n d: '<path d=\"M2.5 12.8 6.9 17 15.4 7.6\"/><path d=\"M11.4 16.4 12.3 17.2 21 7.6\"/>',\n },\n check: {\n vb: '0 0 24 24',\n d: '<path d=\"M4.5 12.6 9.4 17.4 19.5 6.6\"/>',\n },\n 'chevron-down': {\n vb: '0 0 24 24',\n d: '<path d=\"M5 9 12 16 19 9\"/>',\n },\n 'chevron-right': {\n vb: '0 0 24 24',\n d: '<path d=\"M9 5 16 12 9 19\"/>',\n },\n 'chevron-up': {\n vb: '0 0 24 24',\n d: '<path d=\"M6 14.5 12 8.5 18 14.5\"/>',\n },\n close: {\n vb: '0 0 24 24',\n d: '<path d=\"M6 6 18 18M18 6 6 18\"/>',\n },\n code: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 7.5 4.5 12 9 16.5\"/><path d=\"M15 7.5 19.5 12 15 16.5\"/><path d=\"M13.2 5 10.8 19\"/>',\n },\n compose: {\n vb: '0 0 24 24',\n d: '<path d=\"M11.5 4H6a2.5 2.5 0 0 0-2.5 2.5V18A2.5 2.5 0 0 0 6 20.5h11.5A2.5 2.5 0 0 0 20 18v-5.5\"/><path d=\"M18.4 2.7a2.05 2.05 0 0 1 2.9 2.9L12 15l-4 1 1-4 9.4-9.3Z\"/>',\n },\n copy: {\n vb: '0 0 24 24',\n d: '<rect x=\"8.4\" y=\"8.4\" width=\"11.2\" height=\"11.2\" rx=\"2.3\"/><path d=\"M5.6 15.6H5A1.6 1.6 0 0 1 3.4 14V5A1.6 1.6 0 0 1 5 3.4h9A1.6 1.6 0 0 1 15.6 5v.6\"/>',\n },\n download: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 3.2v11.6\"/><path d=\"M7.4 10.2 12 14.8 16.6 10.2\"/><path d=\"M4 19.6h16\"/>',\n },\n edit: {\n vb: '0 0 24 24',\n d: '<path d=\"M16.7 3.3a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.7-12.7Z\"/>',\n },\n emoji: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><circle cx=\"9\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M8.4 14.2a4.6 4.6 0 0 0 7.2 0\"/>',\n },\n headphones: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 14v-2a8 8 0 0 1 16 0v2\"/><path d=\"M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z\"/><path d=\"M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z\"/>',\n },\n heart: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 20.3 4.4 12.9a4.6 4.6 0 1 1 6.5-6.5l1.1 1.1 1.1-1.1a4.6 4.6 0 1 1 6.5 6.5L12 20.3Z\"/>',\n },\n image: {\n vb: '0 0 24 24',\n d: '<rect x=\"3.2\" y=\"4.2\" width=\"17.6\" height=\"15.6\" rx=\"2.6\"/><circle cx=\"8.6\" cy=\"9.4\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M20.8 15.8 16 11 6 19.8\"/>',\n },\n info: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><path d=\"M12 11v5.2\"/><circle cx=\"12\" cy=\"7.7\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n key: {\n vb: '0 0 24 24',\n d: '<circle cx=\"8\" cy=\"8\" r=\"4.4\"/><path d=\"M11.1 11.1 20 20\"/><path d=\"M16.6 16.6 18.6 14.6M14 14l2-2\"/>',\n },\n link: {\n vb: '0 0 24 24',\n d: '<path d=\"M10.2 13.8a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1.2 1.2\"/><path d=\"M13.8 10.2a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1.2-1.2\"/>',\n },\n lock: {\n vb: '0 0 24 24',\n d: '<rect x=\"4.6\" y=\"10.4\" width=\"14.8\" height=\"9.8\" rx=\"2.2\"/><path d=\"M8 10.4V7a4 4 0 0 1 8 0v3.4\"/>',\n },\n message: {\n vb: '0 0 24 24',\n d: '<path d=\"M20.5 11.4c0 4.5-3.9 8.1-8.5 8.1a9 9 0 0 1-3.7-.78L3.5 20.5l1.8-4.6A7.9 7.9 0 0 1 3.5 11.4C3.5 6.9 7.4 3.3 12 3.3s8.5 3.6 8.5 8.1Z\"/>',\n },\n messages: {\n vb: '0 0 24 24',\n d: '<path d=\"M14 9.2a4.7 4.7 0 0 1-4.7 4.7H6.8L3.5 16.4v-2.9A4.7 4.7 0 0 1 6.8 4.5h2.5A4.7 4.7 0 0 1 14 9.2Z\"/><path d=\"M9.4 13.6A4.7 4.7 0 0 0 13.6 16h3.6l3.3 2.5v-2.9a4.7 4.7 0 0 0-2.4-4.1\"/>',\n },\n mic: {\n vb: '0 0 24 24',\n d: '<rect x=\"9\" y=\"2.6\" width=\"6\" height=\"11.2\" rx=\"3\"/><path d=\"M5.6 11.2a6.4 6.4 0 0 0 12.8 0\"/><path d=\"M12 17.6v3.4\"/><path d=\"M8.6 21h6.8\"/>',\n },\n 'mic-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"9\" y=\"2.6\" width=\"6\" height=\"11.2\" rx=\"3\"/><path d=\"M5.6 11.2a6.4 6.4 0 0 0 12.8 0\"/><path d=\"M12 17.6v3.4\"/><path d=\"M8.6 21h6.8\"/><path d=\"M3.6 3.2 20.4 20.8\"/>',\n },\n 'more-h': {\n vb: '0 0 24 24',\n d: '<circle cx=\"5.4\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"18.6\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n 'more-v': {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"5.4\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"18.6\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n phone: {\n vb: '0 0 24 24',\n d: '<path d=\"M6.6 3.5h3l1.5 3.7-1.9 1.4a12.5 12.5 0 0 0 6.2 6.2l1.4-1.9 3.7 1.5v3a2 2 0 0 1-2.2 2A16.8 16.8 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2Z\"/>',\n },\n 'phone-off': {\n vb: '0 0 24 24',\n d: '<g transform=\"rotate(135 12 12)\"><path d=\"M6.6 3.5h3l1.5 3.7-1.9 1.4a12.5 12.5 0 0 0 6.2 6.2l1.4-1.9 3.7 1.5v3a2 2 0 0 1-2.2 2A16.8 16.8 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2Z\"/></g>',\n },\n pin: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 3.4h6v1.8l-1 5.6 3 3.2H7l3-3.2-1-5.6V3.4Z\"/><path d=\"M12 17v3.6\"/>',\n },\n plus: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 5v14M5 12h14\"/>',\n },\n presence: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"currentColor\" opacity=\"0.18\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"5\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n pulse: {\n vb: '0 0 24 24',\n d: '<path d=\"M3 13h4.6l2.2-4.6 3.4 9 2.2-4.4H21\"/>',\n },\n reply: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 7 4 12l5 5\"/><path d=\"M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20\"/>',\n },\n 'screen-share': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M12 13V7.4\"/><path d=\"M9.4 9.8 12 7.2l2.6 2.6\"/>',\n },\n 'screen-share-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M9.6 8 14.4 12.6\"/><path d=\"M14.4 8 9.6 12.6\"/>',\n },\n search: {\n vb: '0 0 24 24',\n d: '<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>',\n },\n 'send-fill': {\n vb: '0 0 24 24',\n d: '<path fill=\"currentColor\" stroke=\"none\" d=\"M21.7 2.3a1 1 0 0 1 .25 1L15.3 21.8a1 1 0 0 1-1.86.06L10.6 14.2 3 11.4a1 1 0 0 1 .06-1.9L20.7 2.05a1 1 0 0 1 1 .25Z\"/>',\n },\n send: {\n vb: '0 0 24 24',\n d: '<path d=\"M21.4 2.6 11 13\"/><path d=\"M21.4 2.6 14.8 21.5a.6.6 0 0 1-1.1.05L11 14l-7.5-2.7a.6.6 0 0 1 .05-1.1L21.4 2.6Z\"/>',\n },\n settings: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"3.1\"/><path d=\"M12 2.6V5M12 19v2.4M4.2 4.2 5.9 5.9M18.1 18.1l1.7 1.7M2.6 12H5M19 12h2.4M4.2 19.8 5.9 18.1M18.1 5.9l1.7-1.7\"/>',\n },\n sliders: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 7h9M17 7h3\"/><circle cx=\"15\" cy=\"7\" r=\"2.1\"/><path d=\"M4 17h3M11 17h9\"/><circle cx=\"9\" cy=\"17\" r=\"2.1\"/>',\n },\n speaker: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 9.5h3.2L12 5.4v13.2L7.2 14.5H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1Z\"/><path d=\"M15.6 9.2a4 4 0 0 1 0 5.6\"/><path d=\"M18.2 6.6a7.7 7.7 0 0 1 0 10.8\"/>',\n },\n 'speaker-off': {\n vb: '0 0 24 24',\n d: '<path d=\"M4 9.5h3.2L12 5.4v13.2L7.2 14.5H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1Z\"/><path d=\"M16.4 9.6 21.4 14.4\"/><path d=\"M21.4 9.6 16.4 14.4\"/>',\n },\n 'thumbs-up': {\n vb: '0 0 24 24',\n d: '<path d=\"M7 10.4V20H4.2V10.4Z\"/><path d=\"M7 10.4 11 3.2a2 2 0 0 1 1.9 2.2L12.4 9H18a2 2 0 0 1 2 2.4l-1.1 6A2 2 0 0 1 16.9 20H7\"/>',\n },\n trash: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 7h16\"/><path d=\"M9.2 7V5.2A1.8 1.8 0 0 1 11 3.4h2a1.8 1.8 0 0 1 1.8 1.8V7\"/><path d=\"M6.2 7 7.2 19A1.9 1.9 0 0 0 9.1 20.7h5.8A1.9 1.9 0 0 0 16.8 19L17.8 7\"/><path d=\"M10.3 11v5M13.7 11v5\"/>',\n },\n typing: {\n vb: '0 0 24 24',\n d: '<circle cx=\"6\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"18\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n 'user-plus': {\n vb: '0 0 24 24',\n d: '<circle cx=\"9\" cy=\"8\" r=\"3.8\"/><path d=\"M3 20a6 6 0 0 1 12 0\"/><path d=\"M18 8v6M15 11h6\"/>',\n },\n user: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4.6 20a7.4 7.4 0 0 1 14.8 0\"/>',\n },\n users: {\n vb: '0 0 24 24',\n d: '<circle cx=\"9\" cy=\"8\" r=\"3.6\"/><path d=\"M2.6 20a6.4 6.4 0 0 1 12.8 0\"/><path d=\"M15.8 4.7a3.6 3.6 0 0 1 0 6.6\"/><path d=\"M17.6 20a6.4 6.4 0 0 0-3.1-5.5\"/>',\n },\n video: {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"6\" width=\"13\" height=\"12\" rx=\"2.4\"/><path d=\"M15.6 11.2 21.4 8v8l-5.8-3.2Z\"/>',\n },\n 'video-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"6\" width=\"13\" height=\"12\" rx=\"2.4\"/><path d=\"M15.6 11.2 21.4 8v8l-5.8-3.2Z\"/><path d=\"M3.6 3.2 20.4 20.8\"/>',\n },\n webhook: {\n vb: '0 0 24 24',\n d: '<circle cx=\"6\" cy=\"6\" r=\"2.6\"/><circle cx=\"18\" cy=\"9\" r=\"2.6\"/><circle cx=\"9.5\" cy=\"18\" r=\"2.6\"/><path d=\"M7.9 7.9 12 12l3.7-1.5\"/><path d=\"M11.6 12.7 9.8 16\"/>',\n },\n} as const satisfies Record<string, IconDef>;\n\nexport type IconName = keyof typeof ICONS;\n","import { SvgXml } from 'react-native-svg';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\nimport { ICONS, type IconName } from './icons-data.js';\n\nexport type { IconName };\n\nexport interface PoolseIconProps {\n /** Icon name — see {@link IconName} for the full list. */\n name: IconName;\n /** Width + height in pixels. Defaults to `20` (matches a body-line). */\n size?: number;\n /** Stroke color. Defaults to the theme's `ink` color. */\n color?: string;\n /** Accessibility label. Defaults to the icon name. */\n label?: string | null;\n}\n\nexport function PoolseIcon({ name, size = 20, color, label }: PoolseIconProps) {\n const theme = usePoolseTheme();\n const def = ICONS[name];\n if (!def) return null;\n const stroke = color ?? theme.colors.ink;\n const xml = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"${def.vb}\" fill=\"none\" stroke=\"${stroke}\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${def.d}</svg>`;\n const a11y =\n label === null\n ? { accessibilityRole: 'none' as const }\n : { accessibilityRole: 'image' as const, accessibilityLabel: label ?? name };\n return <SvgXml xml={xml} width={size} height={size} {...a11y} />;\n}\n","import type { MemberRole, Membership, Uuid } from '@poolse/sdk';\nimport { useMembers, usePresence, useUser } from '@poolse/react';\nimport { type ReactNode } from 'react';\nimport { ActivityIndicator, FlatList, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MemberListProps {\n conversationId: Uuid;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onlineExternalIds?: Set<string>;\n canRemove?: (m: Membership) => boolean;\n renderItem?: (m: Membership) => ReactNode;\n emptyState?: ReactNode | string;\n}\n\nexport function MemberList({\n conversationId,\n labelFor,\n avatarFor,\n onlineExternalIds,\n canRemove,\n renderItem,\n emptyState,\n}: MemberListProps) {\n const theme = usePoolseTheme();\n const { members, loading, error, removeMember } = useMembers(conversationId);\n const { online: presenceOnline } = usePresence(\n onlineExternalIds === undefined ? conversationId : '',\n );\n const effectiveOnline = onlineExternalIds ?? presenceOnline;\n\n if (loading && members.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (error) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <Text style={{ color: theme.colors.error, fontFamily: theme.type.fontBody }}>\n Failed to load members.\n </Text>\n {error.message ? (\n <Text style={[styles.errorDetail, { color: theme.colors.ink3 }]}>{error.message}</Text>\n ) : null}\n </View>\n );\n }\n\n if (members.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' || emptyState == null ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {(emptyState as string) ?? 'No members.'}\n </Text>\n ) : (\n emptyState\n )}\n </View>\n );\n }\n\n return (\n <FlatList\n data={members}\n keyExtractor={(m) => m.user_id}\n style={{ backgroundColor: theme.colors.paper }}\n renderItem={({ item }) => {\n if (renderItem) return <>{renderItem(item)}</>;\n const isOnline = effectiveOnline.has(item.external_id);\n const showRemove = canRemove?.(item) ?? false;\n return (\n <MemberRow\n externalId={item.external_id}\n role={item.role}\n online={isOnline}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(showRemove ? { onRemove: () => removeMember(item.external_id) } : {})}\n />\n );\n }}\n />\n );\n}\n\nfunction MemberRow({\n externalId,\n role,\n online,\n labelFor,\n avatarFor,\n onRemove,\n}: {\n externalId: string;\n role: MemberRole;\n online: boolean;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onRemove?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n // The previous version used `labelFor?.(id) ?? id` and skipped the\n // resolver entirely when labelFor wasn't passed, defeating the\n // PoolseConfig.userResolver contract for consumers who configured\n // one and expected names + avatars to flow through automatically.\n const resolved = useUser(externalId);\n const name = labelFor?.(externalId) ?? resolved.profile?.displayName ?? externalId;\n const avatarUrl = avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null;\n return (\n <View style={styles.row}>\n <Avatar src={avatarUrl} name={name} seed={externalId} online={online} size=\"md\" />\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {name}\n </Text>\n <Text style={[styles.role, { color: theme.colors.ink3 }]}>{role}</Text>\n </View>\n {onRemove ? (\n <Pressable onPress={onRemove} hitSlop={8} style={styles.removeBtn}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n errorDetail: {\n marginTop: 6,\n fontSize: 11,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 8,\n gap: 10,\n },\n body: {\n flex: 1,\n gap: 1,\n },\n name: {\n fontSize: 14,\n fontWeight: '500',\n },\n role: {\n fontSize: 11,\n textTransform: 'capitalize',\n },\n removeBtn: {\n padding: 6,\n },\n});\n","/**\n * Spread onto every SDK `<Modal>` so its Android window is edge-to-edge\n * like the host app (Expo SDK 54 / RN 0.81 enables edge-to-edge): the\n * modal then draws under both system bars on every device, and each\n * surface pads for `useSafeInsets()` itself. Without these the modal\n * window's bar handling differs by RN version and nav mode, so the\n * same padding would clear the nav bar on one phone and not another.\n *\n * `navigationBarTranslucent` arrived in RN 0.77 and the SDK still\n * type-checks against 0.76, hence a spread (no excess-prop check)\n * rather than JSX props. Older RN ignores the unknown prop.\n */\nexport const EDGE_TO_EDGE_MODAL = {\n statusBarTranslucent: true,\n navigationBarTranslucent: true,\n} as const;\n","// The real safe-area hook, re-exported under the SDK's historical\n// name.\n//\n// This used to lazy-require react-native-safe-area-context inside a\n// try/catch \"in case the host app lacks it\" — but in the ESM bundle\n// `require` doesn't exist at runtime, so the catch silently served\n// hardcoded fallbacks instead: 34pt on iOS (coincidentally right for\n// iPhones, which masked the bug) and 0 on Android, which put the\n// composer underneath the navigation bar on every Android device.\n// The library is a hard peer in practice, so this indirection\n// protected nothing.\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nexport interface EdgeInsets {\n top: number;\n bottom: number;\n left: number;\n right: number;\n}\n\nexport const useSafeInsets: () => EdgeInsets = useSafeAreaInsets;\n","import { useMemo, useRef } from 'react';\nimport { Animated, PanResponder } from 'react-native';\n\ninterface Options {\n /** Called once the dismiss animation completes. */\n onClose: () => void;\n /**\n * Sheet height in pixels — used as the off-screen target when\n * animating dismissal. Pass `Dimensions.get('window').height * 0.85`\n * for a standard 85% bottom sheet.\n */\n sheetHeight: number;\n /**\n * Fraction of sheetHeight the user must drag past to commit\n * dismissal on release. Defaults to 0.22. Quick flicks (high\n * vertical velocity) also commit regardless of distance.\n */\n dismissThreshold?: number;\n}\n\n/**\n * Adds a pull-down-to-dismiss gesture to a bottom sheet. Returns an\n * Animated `translateY` to apply to the sheet's outer wrapper +\n * `panHandlers` to spread on whichever sub-view captures the drag\n * (typically the drag-pill area at the top, OR the whole sheet if\n * you want anywhere-drag to work).\n *\n * Only claims the gesture on clear downward motion; horizontal /\n * upward drags pass through to children (so a FlatList inside the\n * sheet can still scroll normally).\n */\nexport function useDismissableSheet({ onClose, sheetHeight, dismissThreshold = 0.22 }: Options) {\n const translateY = useRef(new Animated.Value(0)).current;\n\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n onMoveShouldSetPanResponder: (_, g) => {\n // Only claim on clear downward intent. Lets the FlatList\n // inside the sheet handle vertical scrolls upward.\n return g.dy > 6 && g.dy > Math.abs(g.dx);\n },\n onPanResponderMove: (_, g) => {\n // Only follow downward drag (positive dy). Upward goes\n // back to 0 — sheet can't be pulled UP past its anchor.\n translateY.setValue(Math.max(0, g.dy));\n },\n onPanResponderRelease: (_, g) => {\n const committed = g.dy > sheetHeight * dismissThreshold || g.vy > 0.6;\n if (committed) {\n // Animate the sheet off-screen, THEN fire onClose. Without\n // this the modal's own slide-out + our reset would fight.\n Animated.timing(translateY, {\n toValue: sheetHeight,\n duration: 180,\n useNativeDriver: true,\n }).start(() => {\n translateY.setValue(0);\n onClose();\n });\n } else {\n Animated.spring(translateY, {\n toValue: 0,\n useNativeDriver: true,\n speed: 22,\n bounciness: 4,\n }).start();\n }\n },\n onPanResponderTerminate: () => {\n Animated.spring(translateY, {\n toValue: 0,\n useNativeDriver: true,\n speed: 22,\n bounciness: 4,\n }).start();\n },\n }),\n [onClose, sheetHeight, dismissThreshold, translateY],\n );\n\n return { translateY, panHandlers: panResponder.panHandlers };\n}\n","import type { Uuid } from '@poolse/sdk';\nimport { useConversation, useMembers } from '@poolse/react';\nimport {\n Animated,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { MemberList } from './MemberList.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useDismissableSheet } from './internal/useDismissableSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface GroupDetailsSheetProps {\n visible: boolean;\n onClose: () => void;\n conversationId: Uuid;\n /** Resolve external_id → display name. Same shape as MemberList. */\n labelFor?: (externalId: string) => string;\n /** Resolve external_id → avatar URL. Same shape as MemberList. */\n avatarFor?: (externalId: string) => string | null;\n /**\n * Predicate for the per-row remove button. Defaults to \"never show\"\n * — wire it on the parent for owners/admins. Receives the\n * Membership row so you can scope to roles or exclude self.\n */\n canRemoveMember?: (m: { user_id: string; external_id: string; role: string }) => boolean;\n}\n\n/**\n * Bottom-sheet (85% of screen) that opens when the user taps the\n * group chat header. Shows group name + member count at the top,\n * then a scrollable roster with avatars, display names (resolved\n * through `labelFor` / `userResolver`), role badges, and live\n * presence dots (driven by `MemberList` internally).\n */\nexport function GroupDetailsSheet({\n visible,\n onClose,\n conversationId,\n labelFor,\n avatarFor,\n canRemoveMember,\n}: GroupDetailsSheetProps) {\n const theme = usePoolseTheme();\n const { conversation } = useConversation(conversationId);\n const { members } = useMembers(conversationId);\n const insets = useSafeInsets();\n const { height: screenHeight } = useWindowDimensions();\n const { translateY, panHandlers } = useDismissableSheet({\n onClose,\n sheetHeight: screenHeight * 0.85,\n });\n\n const title = conversation?.name ?? 'Conversation';\n const subtitle = `${members.length} ${members.length === 1 ? 'member' : 'members'}`;\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app; the sheet pads its\n // bottom by the nav-bar inset so the last member row clears it.\n {...EDGE_TO_EDGE_MODAL}\n >\n <View style={styles.modalRoot}>\n <Pressable\n style={styles.backdrop}\n onPress={onClose}\n accessibilityLabel=\"Close group details\"\n />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n // Header stays below the status bar even on short screens.\n maxHeight: screenHeight - insets.top - 8,\n paddingBottom: insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* Pan handlers spread on the drag-pill region so list\n scrolling underneath isn't affected. */}\n <View {...panHandlers} style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={styles.headerRow}>\n <Pressable\n onPress={onClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.headerTitle,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n Group details\n </Text>\n </View>\n\n <View style={styles.summary}>\n <Avatar src={null} name={title} seed={conversationId} size=\"lg\" />\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n numberOfLines={1}\n >\n {title}\n </Text>\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]}>{subtitle}</Text>\n </View>\n\n <View style={[styles.divider, { backgroundColor: theme.colors.border }]} />\n\n <View style={styles.sectionLabelRow}>\n <Text\n style={[\n styles.sectionLabel,\n { color: theme.colors.ink2, fontFamily: theme.type.fontBody },\n ]}\n >\n Members\n </Text>\n </View>\n\n <View style={{ flex: 1 }}>\n <MemberList\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(canRemoveMember ? { canRemove: canRemoveMember } : {})}\n emptyState=\"No members yet.\"\n />\n </View>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n height: '85%',\n overflow: 'hidden',\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 4,\n paddingBottom: 12,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n headerTitle: {\n fontSize: 16,\n fontWeight: '600',\n },\n summary: {\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 8,\n },\n title: {\n fontSize: 20,\n fontWeight: '700',\n },\n subtitle: {\n fontSize: 13,\n },\n divider: {\n height: StyleSheet.hairlineWidth,\n },\n sectionLabelRow: {\n paddingHorizontal: 16,\n paddingTop: 14,\n paddingBottom: 6,\n },\n sectionLabel: {\n fontSize: 11,\n fontWeight: '700',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n },\n});\n","import type { Uuid } from '@poolse/sdk';\nimport { useConversation, useMe, useMembers, usePresence, useUser } from '@poolse/react';\nimport { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { GroupDetailsSheet } from './GroupDetailsSheet.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ChatHeaderProps {\n conversationId: Uuid;\n /**\n * Override the title resolver — useful when you want to derive the\n * direct-chat name from your own user directory instead of going\n * through the SDK's `userResolver`. When omitted, falls back to:\n * * direct → the other member's display name (via `useUser`)\n * * group → `conversation.name`\n */\n labelFor?: (externalId: string) => string;\n /** Optional avatar URL resolver for the other party (direct only). */\n avatarFor?: (externalId: string) => string | null;\n /** Right-side icon button — typically opens a member-list sheet. */\n onMembersPress?: () => void;\n /**\n * Tap handler for the whole header. Behavior:\n * * Direct chat → calls this if provided, otherwise no-op.\n * * Group chat → calls this if provided. If omitted, the header\n * opens a built-in group-details sheet showing the member\n * roster with live presence.\n */\n onPress?: () => void;\n /**\n * When provided, renders a back arrow on the LEFT of the header\n * that calls this handler on tap. Used by `<PoolseInbox>` to\n * navigate back to the conversation list; safe to wire from your\n * own navigator too.\n */\n onBack?: () => void;\n}\n\n/**\n * Top-of-chat header bar.\n * * 1:1 direct → other user's display name + avatar + presence dot.\n * * Group → conversation name + \"N members\" + group-tile avatar.\n *\n * Sits above `<MessageList>` inside `<ConversationView>` by default;\n * pass `header={false}` to `<ConversationView>` if you mount your own.\n */\nexport function ChatHeader({\n conversationId,\n labelFor,\n avatarFor,\n onMembersPress,\n onPress,\n onBack,\n}: ChatHeaderProps) {\n const theme = usePoolseTheme();\n const { conversation } = useConversation(conversationId);\n const { members } = useMembers(conversationId);\n const { me } = useMe();\n const { online } = usePresence(conversationId);\n const [detailsOpen, setDetailsOpen] = useState(false);\n\n const isDirect = conversation?.type === 'direct';\n const otherMember = isDirect ? members.find((m) => m.user_id !== me?.id) : null;\n const otherExtId = otherMember?.external_id ?? null;\n // useUser is safe with null — short-circuits to no-op state. Keeps the\n // hook unconditional regardless of conversation type.\n const otherUser = useUser(otherExtId);\n\n if (!conversation) {\n return (\n <View\n style={[\n styles.root,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n />\n );\n }\n\n const fallbackName = otherExtId ?? '';\n const directName =\n otherUser.profile?.displayName ??\n (otherExtId ? (labelFor?.(otherExtId) ?? fallbackName) : 'Direct');\n const title = isDirect ? directName : (conversation.name ?? 'Conversation');\n\n const isOnline = isDirect && otherExtId ? online.has(otherExtId) : false;\n const subtitle = isDirect\n ? isOnline\n ? 'Online'\n : null\n : `${members.length} ${members.length === 1 ? 'member' : 'members'}`;\n\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? otherUser.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conversationId) : conversationId;\n\n // For groups, default tap = open the built-in details sheet.\n // For directs (or when caller supplied onPress), call onPress.\n // A View wrapper is used only when there's no tap target at all\n // (direct chat with no onPress) so we don't render a no-op\n // Pressable that swallows touches.\n const isGroup = !isDirect;\n const headerOnPress = onPress ?? (isGroup ? () => setDetailsOpen(true) : undefined);\n const Wrapper: typeof View | typeof Pressable = headerOnPress ? Pressable : View;\n\n return (\n <>\n <Wrapper\n {...(headerOnPress ? { onPress: headerOnPress } : {})}\n style={[\n styles.root,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n {onBack ? (\n <Pressable onPress={onBack} hitSlop={12} style={styles.backBtn} accessibilityLabel=\"Back\">\n <PoolseIcon name=\"reply\" size={20} color={theme.colors.ink} />\n </Pressable>\n ) : null}\n <Avatar src={avatarUrl} name={title} seed={avatarSeed} online={isOnline} size=\"md\" />\n <View style={styles.titleCol}>\n <Text\n style={[styles.title, { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n {subtitle ? (\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {onMembersPress ? (\n <Pressable\n onPress={onMembersPress}\n hitSlop={12}\n style={styles.actionBtn}\n accessibilityLabel=\"Show members\"\n >\n <PoolseIcon name=\"users\" size={20} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </Wrapper>\n\n {isGroup ? (\n <GroupDetailsSheet\n visible={detailsOpen}\n onClose={() => setDetailsOpen(false)}\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n ) : null}\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n titleCol: {\n flex: 1,\n gap: 2,\n },\n title: {\n fontSize: 16,\n fontWeight: '600',\n },\n subtitle: {\n fontSize: 12,\n fontWeight: '500',\n },\n actionBtn: {\n width: 36,\n height: 36,\n borderRadius: 18,\n alignItems: 'center',\n justifyContent: 'center',\n },\n backBtn: {\n width: 36,\n height: 36,\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: -6,\n },\n});\n","import type { Conversation, Uuid } from '@poolse/sdk';\nimport { formatCallLogPreview, useConversations, useMe, useUser } from '@poolse/react';\nimport { type ReactNode } from 'react';\nimport {\n ActivityIndicator,\n FlatList,\n Image,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ConversationListProps {\n selectedId?: string | null;\n onSelect?: (conv: Conversation) => void;\n /** Optional override for each row's rendering. */\n renderItem?: (conv: Conversation, selected: boolean) => ReactNode;\n /** Custom empty state when there are no conversations. */\n emptyState?: ReactNode | string;\n /** Controlled-mode: skip `useConversations()` and render from these. */\n conversations?: Conversation[];\n loading?: boolean;\n error?: Error | null;\n /** Per-conversation unread counts rendered as a Pulse Coral pill. */\n unreadCounts?: Record<Uuid, number>;\n /**\n * Explicit overrides for direct-chat names + avatars, keyed by the\n * OTHER member's external_id. When omitted, the row falls back to\n * `PoolseConfig.userResolver` and finally to the external_id.\n */\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}\n\nexport function ConversationList({\n selectedId,\n onSelect,\n renderItem,\n emptyState,\n conversations: controlled,\n loading: controlledLoading,\n error: controlledError,\n unreadCounts,\n labelFor,\n avatarFor,\n}: ConversationListProps) {\n const theme = usePoolseTheme();\n const auto = useConversations();\n const { me } = useMe();\n const meExternalId = me?.external_id ?? null;\n const meId = me?.id ?? null;\n const isControlled = controlled !== undefined;\n const conversations = isControlled ? controlled : auto.conversations;\n const loading = isControlled ? (controlledLoading ?? false) : auto.loading;\n const error = isControlled ? (controlledError ?? null) : auto.error;\n const counts = unreadCounts ?? (isControlled ? undefined : auto.unreadCounts);\n\n if (loading && conversations.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (error) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <Text style={{ color: theme.colors.error, fontFamily: theme.type.fontBody }}>\n Failed to load conversations.\n </Text>\n </View>\n );\n }\n\n if (conversations.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' || emptyState == null ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {(emptyState as string) ?? 'No conversations yet.'}\n </Text>\n ) : (\n emptyState\n )}\n </View>\n );\n }\n\n return (\n <FlatList\n data={conversations}\n keyExtractor={(c) => c.id}\n style={{ backgroundColor: theme.colors.paper }}\n renderItem={({ item }) => {\n const selected = selectedId === item.id;\n if (renderItem) {\n return <>{renderItem(item, selected)}</>;\n }\n return (\n <ConversationRow\n conv={item}\n selected={selected}\n meExternalId={meExternalId}\n meId={meId}\n unread={counts?.[item.id] ?? 0}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(onSelect ? { onSelect } : {})}\n />\n );\n }}\n />\n );\n}\n\nfunction ConversationRow({\n conv,\n selected,\n meExternalId,\n meId = null,\n unread,\n labelFor,\n avatarFor,\n onSelect,\n}: {\n conv: Conversation;\n selected: boolean;\n meExternalId: string | null;\n meId?: string | null;\n unread: number;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onSelect?: (conv: Conversation) => void;\n}) {\n const theme = usePoolseTheme();\n\n // For direct conversations the row title + avatar come from the OTHER\n // member, NOT the conversation itself (which has `name: null` for\n // directs). Find the counterparty's external_id and resolve via the\n // standard priority: explicit prop > userResolver > external_id.\n const isDirect = conv.type === 'direct';\n const otherExtId =\n isDirect && meExternalId\n ? ((conv.member_external_ids ?? []).find((x) => x !== meExternalId) ?? null)\n : null;\n const resolvedOther = useUser(isDirect ? otherExtId : null);\n\n const title = isDirect\n ? otherExtId\n ? (labelFor?.(otherExtId) ?? resolvedOther.profile?.displayName ?? otherExtId)\n : 'Direct chat'\n : (conv.name ?? 'Untitled conversation');\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? resolvedOther.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conv.id) : conv.id;\n\n return (\n <Pressable\n onPress={() => onSelect?.(conv)}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.surface2 : 'transparent',\n },\n ]}\n >\n {avatarUrl ? (\n <Image source={{ uri: avatarUrl }} style={styles.rowAvatar} />\n ) : (\n <Avatar src={null} name={title} seed={avatarSeed} size=\"md\" />\n )}\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n {conv.last_message_preview ? (\n <Text style={[styles.preview, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview}\n </Text>\n ) : conv.last_message_at ? (\n <Text style={[styles.preview, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatRelative(conv.last_message_at)}\n </Text>\n ) : null}\n </View>\n {unread > 0 ? (\n <View style={[styles.unreadPill, { backgroundColor: theme.colors.unreadPill }]}>\n <Text style={[styles.unreadText, { color: theme.colors.unreadPillText }]}>\n {unread > 99 ? '99+' : String(unread)}\n </Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nfunction formatRelative(iso: string): string {\n try {\n const d = new Date(iso);\n const now = Date.now();\n const diff = now - d.getTime();\n if (diff < 60_000) return 'just now';\n if (diff < 3600_000) return `${Math.floor(diff / 60_000)}m`;\n if (diff < 86_400_000) return `${Math.floor(diff / 3600_000)}h`;\n return `${Math.floor(diff / 86_400_000)}d`;\n } catch {\n return '';\n }\n}\n\nconst styles = StyleSheet.create({\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n gap: 10,\n },\n rowAvatar: {\n width: 40,\n height: 40,\n borderRadius: 20,\n },\n body: {\n flex: 1,\n gap: 2,\n },\n name: {\n fontSize: 15,\n fontWeight: '600',\n },\n preview: {\n fontSize: 12,\n },\n unreadPill: {\n minWidth: 22,\n height: 22,\n borderRadius: 11,\n paddingHorizontal: 6,\n alignItems: 'center',\n justifyContent: 'center',\n },\n unreadText: {\n fontSize: 11,\n fontWeight: '700',\n },\n});\n","import { createContext, useCallback, useContext, useRef, type ReactNode } from 'react';\nimport { useAttachmentUpload } from '@poolse/react';\n\ntype UploadState = ReturnType<typeof useAttachmentUpload>;\n\n/**\n * Shared upload-queue value. The SDK's `useAttachmentUpload` creates\n * a private queue per call site — without a provider, each component\n * (picker / composer / strip) ends up with its own queue and uploads\n * never reach the send-with-attachment_ids path.\n *\n * `setPreview` / `getPreview` are an RN-only side channel: the SDK\n * strips the original local file URI when it converts to a Blob, but\n * the queue strip needs the URI to render an Image thumbnail. The\n * picker stashes it here keyed by filename so the strip can read it\n * back during render.\n */\ninterface UploadContextValue {\n upload: UploadState;\n setPreview: (filename: string, uri: string) => void;\n getPreview: (filename: string) => string | null;\n}\n\nconst UploadCtx = createContext<UploadContextValue | null>(null);\n\nexport function UploadProvider({ children }: { children: ReactNode }) {\n const upload = useAttachmentUpload();\n const previews = useRef<Map<string, string>>(new Map());\n\n const setPreview = useCallback((filename: string, uri: string) => {\n previews.current.set(filename, uri);\n }, []);\n\n const getPreview = useCallback((filename: string) => {\n return previews.current.get(filename) ?? null;\n }, []);\n\n return (\n <UploadCtx.Provider value={{ upload, setPreview, getPreview }}>{children}</UploadCtx.Provider>\n );\n}\n\n/**\n * Read the shared upload state. Falls back to a component-local\n * `useAttachmentUpload` when no provider is mounted so the component\n * still functions standalone (but loses preview thumbnails since\n * setPreview won't propagate).\n */\nexport function useSharedUpload(): UploadState {\n const fromCtx = useContext(UploadCtx);\n const fallback = useAttachmentUpload();\n return fromCtx?.upload ?? fallback;\n}\n\n/**\n * Preview-URI side channel for the queue strip's thumbnails. No-op\n * when no provider is mounted (strip falls back to icon placeholder).\n */\nexport function useUploadPreview() {\n const ctx = useContext(UploadCtx);\n return {\n setPreview: ctx?.setPreview ?? (() => undefined),\n getPreview: ctx?.getPreview ?? (() => null),\n };\n}\n","import { Image as RNImage, Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n// Static imports — Metro's bundle graph can only trace literal\n// `import` / `require` calls. The earlier `new Function('m', 'return\n// import(m)')(name)` trick bypassed Metro entirely, so the picker\n// modules were never bundled even when the consumer installed them.\n//\n// Trade-off: if a consumer mounts <AttachmentPicker> without these\n// modules installed, the bundle fails at build time with a clear\n// \"module not found\" rather than the silent runtime warning we had\n// before. Consumers who don't want attachments at all should pass\n// `attachments={false}` to <ConversationView> so this file is never\n// rendered (and tree-shaking can drop the imports in production\n// builds with a real bundler — Metro doesn't tree-shake but the\n// imports add ~12kb total which is acceptable).\nimport * as ImagePicker from 'expo-image-picker';\nimport * as DocumentPicker from 'expo-document-picker';\nimport { manipulateAsync, SaveFormat } from 'expo-image-manipulator';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useSharedUpload, useUploadPreview } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface AttachmentPickerProps {\n visible: boolean;\n onClose: () => void;\n /**\n * Optional adapter that produces upload inputs from a picked file.\n * Override to plug in custom storage / transcoding. Default reads\n * from `expo-image-picker` / `expo-document-picker`.\n */\n onPickInputs?: (kind: 'image' | 'document' | 'camera') => Promise<\n {\n body: { uri: string; name: string; type: string } | Blob | unknown;\n contentType: string;\n byteSize: number;\n filename?: string;\n }[]\n >;\n /**\n * Show the Camera item alongside Photo and File. Defaults true.\n * Disable if your app explicitly doesn't want camera access (some\n * App Store reviewers require an explicit usage description even\n * for the picker entry). Add `NSCameraUsageDescription` to your\n * iOS Info.plist when leaving this on.\n */\n camera?: boolean;\n}\n\n/**\n * Picker sheet wrapping `expo-image-picker` and `expo-document-picker`.\n * Both must be installed (`npx expo install expo-image-picker\n * expo-document-picker`) when this component is mounted — they're\n * declared as optional peers because consumers who pass\n * `attachments={false}` to ConversationView never render this file.\n */\nexport function AttachmentPicker({\n visible,\n onClose,\n onPickInputs,\n camera = true,\n}: AttachmentPickerProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n // Shared queue (via UploadProvider) so the composer sees these\n // uploads and can include them in the next send. Falls back to a\n // local queue when the picker is mounted outside ConversationView.\n const upload = useSharedUpload();\n const { setPreview } = useUploadPreview();\n\n const pickFromKind = async (kind: 'image' | 'document' | 'camera') => {\n try {\n const adapter = onPickInputs ?? defaultAdapter;\n const inputs = await adapter(kind);\n for (const input of inputs) {\n // Stash the original local URI on the shared context so the\n // UploadQueueStrip can render a real thumbnail. The SDK only\n // sees the Blob from here on out.\n const previewUri = (input as { _previewUri?: string })._previewUri ?? null;\n if (previewUri && input.filename) {\n setPreview(input.filename, previewUri);\n }\n void upload.upload(input as never);\n }\n } catch (err) {\n console.warn('[poolse/picker]', err);\n } finally {\n onClose();\n }\n };\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the sheet's\n // bottom padding below is what actually clears the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable style={styles.backdrop} onPress={onClose}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Cancel must sit above the nav bar / home indicator.\n paddingBottom: 24 + insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n theme.shadows.lg,\n ]}\n >\n {camera ? (\n <Pressable style={styles.item} onPress={() => pickFromKind('camera')}>\n <PoolseIcon name=\"camera\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>Camera</Text>\n </Pressable>\n ) : null}\n <Pressable style={styles.item} onPress={() => pickFromKind('image')}>\n <PoolseIcon name=\"image\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>Photo or video</Text>\n </Pressable>\n <Pressable style={styles.item} onPress={() => pickFromKind('document')}>\n <PoolseIcon name=\"attachment\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>File</Text>\n </Pressable>\n <Pressable style={styles.cancel} onPress={onClose}>\n <Text style={[styles.itemText, { color: theme.colors.brand }]}>Cancel</Text>\n </Pressable>\n </View>\n </Pressable>\n </Modal>\n );\n}\n\n// RN gives us a local file URI. The SDK's upload PUTs the `body` raw\n// to a presigned S3/R2 URL — those only accept raw bytes, NOT\n// multipart. If we passed the `{ uri, name, type }` object directly,\n// fetch would serialize it as multipart and the bucket would reject\n// the upload silently. So we read the URI as a Blob first (same shape\n// that `<input type=\"file\">` would give on web) and pass that.\nasync function uriToBlob(uri: string): Promise<Blob> {\n const res = await fetch(uri);\n if (!res.ok && res.status !== 0) {\n throw new Error(`failed to read picked file (HTTP ${res.status})`);\n }\n return res.blob();\n}\n\n// Phone-sized output — the fullscreen viewer on a 3x retina display\n// only needs ~1300px on the long edge, and chat bubbles top out at\n// ~960px. 1600 leaves headroom for pinch-zoom without sending the\n// 4000+ px monsters that some screenshots ship with.\nconst COMPRESSION_LONG_SIDE_PX = 1600;\nconst COMPRESSION_QUALITY = 0.75;\n\nfunction getImageSize(uri: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n RNImage.getSize(uri, (width, height) => resolve({ width, height }), reject);\n });\n}\n\n/**\n * Resize → WebP @ 0.75 every image before upload. iOS screenshots\n * can be 8–12 MB PNGs and the fullscreen `<Image>` decode of those\n * blocks the JS thread / silently fails on older devices — clipping\n * the long edge to 1600 keeps the per-message payload under ~250kb\n * for typical photos and is still crisp on every phone display.\n *\n * Never upscales. Falls back to the original blob on any failure so\n * a flaky manipulator pass never blocks a send.\n */\nasync function compressImage({\n uri,\n width,\n height,\n filename,\n}: {\n uri: string;\n width?: number;\n height?: number;\n filename?: string;\n}): Promise<{ blob: Blob; contentType: string; filename: string }> {\n let w = width;\n let h = height;\n if (!w || !h) {\n try {\n const size = await getImageSize(uri);\n w = size.width;\n h = size.height;\n } catch {\n w = 0;\n h = 0;\n }\n }\n const longSide = Math.max(w ?? 0, h ?? 0);\n const scale = longSide > COMPRESSION_LONG_SIDE_PX ? COMPRESSION_LONG_SIDE_PX / longSide : 1;\n const actions =\n scale < 1 && w && h\n ? [{ resize: { width: Math.round(w * scale), height: Math.round(h * scale) } }]\n : [];\n\n const result = await manipulateAsync(uri, actions, {\n compress: COMPRESSION_QUALITY,\n format: SaveFormat.WEBP,\n });\n const blob = await uriToBlob(result.uri);\n const base = (filename ?? `image-${Date.now()}`).replace(/\\.[^.]+$/, '');\n return {\n blob,\n contentType: 'image/webp',\n filename: `${base}.webp`,\n };\n}\n\nasync function assetsToInputs(assets: ReadonlyArray<ImagePicker.ImagePickerAsset>) {\n return Promise.all(\n assets.map(async (asset) => {\n try {\n const compressed = await compressImage({\n uri: asset.uri,\n width: asset.width,\n height: asset.height,\n filename: asset.fileName ?? `image-${Date.now()}`,\n });\n return {\n body: compressed.blob,\n contentType: compressed.contentType,\n byteSize: compressed.blob.size,\n filename: compressed.filename,\n _previewUri: asset.uri,\n };\n } catch (err) {\n console.warn('[poolse/picker] image compression failed, sending original:', err);\n const blob = await uriToBlob(asset.uri);\n const contentType = asset.mimeType ?? blob.type ?? 'image/jpeg';\n return {\n body: blob,\n contentType,\n // The uploaded bytes: the server refuses a file bigger than declared.\n byteSize: blob.size || asset.fileSize || 0,\n filename: asset.fileName ?? `image-${Date.now()}.jpg`,\n _previewUri: asset.uri,\n };\n }\n }),\n );\n}\n\nasync function defaultAdapter(kind: 'image' | 'document' | 'camera') {\n if (kind === 'camera') {\n // Camera permissions are required on both iOS (Info.plist\n // NSCameraUsageDescription) and Android. requestCameraPermissionsAsync\n // shows the system prompt the first time; subsequent calls\n // resolve immediately with the cached answer.\n const perm = await ImagePicker.requestCameraPermissionsAsync();\n if (!perm.granted) {\n console.warn('[poolse/picker] camera permission denied');\n return [];\n }\n const res = await ImagePicker.launchCameraAsync({\n mediaTypes: 'images',\n quality: 1,\n });\n if (res.canceled) return [];\n return assetsToInputs(res.assets);\n }\n if (kind === 'image') {\n const res = await ImagePicker.launchImageLibraryAsync({\n mediaTypes: 'images',\n // Quality 1 — picker hands back the source as-is and we do the\n // compression ourselves below. Letting the picker re-encode\n // first just chains two lossy passes.\n quality: 1,\n });\n if (res.canceled) return [];\n return assetsToInputs(res.assets);\n }\n const res = await DocumentPicker.getDocumentAsync({\n copyToCacheDirectory: true,\n multiple: true,\n });\n if (res.canceled) return [];\n return Promise.all(\n res.assets.map(async (asset) => {\n const isImage = (asset.mimeType ?? '').startsWith('image/');\n if (isImage) {\n try {\n const compressed = await compressImage({\n uri: asset.uri,\n filename: asset.name,\n });\n return {\n body: compressed.blob,\n contentType: compressed.contentType,\n byteSize: compressed.blob.size,\n filename: compressed.filename,\n _previewUri: asset.uri,\n };\n } catch (err) {\n console.warn('[poolse/picker] image compression failed, sending original:', err);\n }\n }\n const blob = await uriToBlob(asset.uri);\n const contentType = asset.mimeType ?? blob.type ?? 'application/octet-stream';\n return {\n body: blob,\n contentType,\n // The uploaded bytes: the server refuses a file bigger than declared.\n byteSize: blob.size || asset.size || 0,\n filename: asset.name,\n _previewUri: asset.uri,\n };\n }),\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n paddingVertical: 8,\n paddingBottom: 24,\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 20,\n paddingVertical: 14,\n gap: 14,\n },\n cancel: {\n paddingHorizontal: 20,\n paddingVertical: 14,\n alignItems: 'center',\n marginTop: 4,\n },\n itemText: {\n fontSize: 15,\n fontWeight: '500',\n },\n});\n","import { StyleSheet, Text, View } from 'react-native';\n\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface DaySeparatorProps {\n label: string;\n}\n\n/**\n * Centered date pill rendered between messages whose `inserted_at`\n * falls on a different calendar day from the previous message. Pair\n * with `formatDayLabel` from `@poolse/react` to compute the label\n * (\"Today\" / \"Yesterday\" / weekday / \"26 May 2024\").\n */\nexport function DaySeparator({ label }: DaySeparatorProps) {\n const theme = usePoolseTheme();\n return (\n <View style={styles.wrap}>\n <View\n style={[\n styles.chip,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: theme.colors.border,\n },\n ]}\n >\n <Text\n style={[\n styles.label,\n {\n color: theme.colors.ink2,\n fontFamily: theme.type.fontBody,\n },\n ]}\n >\n {label}\n </Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignItems: 'center',\n marginVertical: 8,\n },\n chip: {\n paddingHorizontal: 12,\n paddingVertical: 4,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n },\n label: {\n fontSize: 11,\n fontWeight: '600',\n letterSpacing: 0.3,\n },\n});\n","import type { LiveCall } from '@poolse/sdk';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface LiveCallBannerProps {\n call: LiveCall;\n /** How many people are in the room right now. */\n inCall: number;\n onJoin: (call: LiveCall) => void;\n}\n\n/**\n * \"Voice call in progress · 2 on the call [Join]\" — a strip across the\n * top of a conversation while a call runs that the viewer is not on.\n * `<ConversationView onJoinCall>` renders it for you; use it directly\n * to place it elsewhere (with `useLiveCall`).\n */\nexport function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps) {\n const theme = usePoolseTheme();\n const what =\n call.kind === 'room'\n ? call.media === 'video'\n ? 'Video room'\n : 'Voice room'\n : call.media === 'video'\n ? 'Video call in progress'\n : 'Voice call in progress';\n const who =\n inCall > 0\n ? `${inCall} ${call.kind === 'room' ? 'in the room' : 'on the call'}`\n : call.kind === 'room'\n ? 'Starting'\n : 'Ringing';\n return (\n <View\n style={[styles.bar, { backgroundColor: theme.colors.success }]}\n accessibilityRole=\"summary\"\n accessibilityLabel={`${what}, ${who}`}\n >\n <PoolseIcon\n name={call.media === 'video' ? 'video' : 'phone'}\n size={16}\n color=\"#FFFFFF\"\n label={null}\n />\n <View style={styles.text}>\n <Text style={[styles.title, { fontFamily: theme.type.fontBody }]} numberOfLines={1}>\n {what}\n </Text>\n <Text style={[styles.meta, { fontFamily: theme.type.fontBody }]} numberOfLines={1}>\n {who}\n </Text>\n </View>\n <Pressable\n onPress={() => onJoin(call)}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Join call\"\n hitSlop={8}\n style={({ pressed }) => [styles.join, pressed && styles.joinPressed]}\n >\n <Text\n style={[\n styles.joinText,\n { color: theme.colors.success, fontFamily: theme.type.fontBody },\n ]}\n >\n Join\n </Text>\n </Pressable>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n bar: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n paddingHorizontal: 16,\n paddingVertical: 8,\n },\n text: { flex: 1, minWidth: 0 },\n title: { color: '#FFFFFF', fontSize: 14, fontWeight: '600' },\n meta: { color: 'rgba(255,255,255,0.85)', fontSize: 12 },\n join: {\n backgroundColor: '#FFFFFF',\n borderRadius: 999,\n paddingHorizontal: 16,\n paddingVertical: 6,\n },\n joinPressed: { opacity: 0.8 },\n joinText: { fontSize: 14, fontWeight: '700' },\n});\n","import { Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { useSharedUpload, useUploadPreview } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n/**\n * Horizontal scrolling preview row of pending / in-flight / ready\n * uploads. Image attachments render as 64×64 thumbnails sourced from\n * the original local file URI; file attachments render as a row card\n * with icon + name + size. A small × overlay on each tile lets the\n * user drop the upload before send.\n *\n * Reads queue state from the shared `<UploadProvider>` (mounted by\n * `<ConversationView>`), so the composer's \"ready attachment ids\"\n * pickup and the strip's display always agree.\n */\nexport function UploadQueueStrip() {\n const theme = usePoolseTheme();\n const upload = useSharedUpload();\n const { getPreview } = useUploadPreview();\n\n if (upload.queue.length === 0) return null;\n\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.scroll}\n // overflow:visible (+ explicit paddingTop on the contentContainer)\n // so the X close button can sit at -6/-6 outside the tile without\n // being clipped by the scroll bounds.\n style={[styles.scrollStyle, { marginBottom: 8 }]}\n >\n {upload.queue.map((item) => {\n const isError = item.status === 'error';\n const isUploading = item.status === 'uploading' || item.status === 'pending';\n const isImage = (item.contentType ?? '').startsWith('image/');\n const previewUri = getPreview(item.filename);\n const canTerminate = isUploading || item.status === 'ready' || isError;\n\n const handleClose = () => {\n if (item.status === 'ready' || isError) upload.remove(item.localId);\n else upload.cancel(item.localId);\n };\n\n return (\n <View key={item.localId} style={styles.tileWrap}>\n {isImage && previewUri ? (\n <ImageTile uri={previewUri} uploading={isUploading} error={isError} />\n ) : (\n <FileTile\n filename={item.filename}\n size={item.byteSize}\n uploading={isUploading}\n error={isError}\n />\n )}\n\n {canTerminate ? (\n <Pressable\n onPress={handleClose}\n hitSlop={8}\n // Hardcoded dark dot + white X. Pulling from the\n // theme made the close affordance invisible against\n // light-on-light or dark-on-dark custom palettes\n // (e.g. a white-on-white surface/onBrand pair).\n // This is a thumbnail badge — not chrome — so it\n // should look the same in every theme.\n style={styles.closeBtn}\n accessibilityLabel={isError ? 'Remove failed upload' : 'Cancel upload'}\n >\n <PoolseIcon name=\"close\" size={11} color=\"#fff\" />\n </Pressable>\n ) : null}\n\n {isUploading ? (\n <View style={styles.progressOverlay}>\n <View style={[styles.spinner, { borderColor: theme.colors.onBrand }]} />\n </View>\n ) : null}\n\n {isError ? (\n <View style={[styles.errorOverlay, { backgroundColor: 'rgba(229,72,77,0.85)' }]}>\n <Text style={[styles.errorText, { color: '#fff' }]}>Failed</Text>\n </View>\n ) : null}\n </View>\n );\n })}\n </ScrollView>\n );\n}\n\nfunction ImageTile({ uri, uploading, error }: { uri: string; uploading: boolean; error: boolean }) {\n const theme = usePoolseTheme();\n return (\n <Image\n source={{ uri }}\n style={[\n styles.imageTile,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: error ? theme.colors.error : 'transparent',\n opacity: uploading ? 0.65 : 1,\n },\n ]}\n resizeMode=\"cover\"\n />\n );\n}\n\nfunction FileTile({\n filename,\n size,\n uploading,\n error,\n}: {\n filename: string;\n size: number;\n uploading: boolean;\n error: boolean;\n}) {\n const theme = usePoolseTheme();\n return (\n <View\n style={[\n styles.fileTile,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: error\n ? theme.colors.error\n : uploading\n ? theme.colors.brand\n : theme.colors.border,\n },\n ]}\n >\n <View style={[styles.fileIconBox, { backgroundColor: theme.colors.brandSoft }]}>\n <PoolseIcon name=\"attachment\" size={18} color={theme.colors.brand} />\n </View>\n <View style={styles.fileInfo}>\n <Text\n style={[styles.fileName, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {filename}\n </Text>\n <Text style={[styles.fileSize, { color: theme.colors.ink3 }]}>{formatBytes(size)}</Text>\n </View>\n </View>\n );\n}\n\nfunction formatBytes(n: number): string {\n if (!n || n < 0) return '';\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;\n if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;\n return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;\n}\n\nconst TILE = 64;\n\nconst styles = StyleSheet.create({\n scrollStyle: {\n overflow: 'visible',\n },\n scroll: {\n paddingHorizontal: 8,\n // paddingTop creates room for the X to overflow the tile without\n // being clipped on Android (where overflow:visible isn't enough).\n paddingTop: 8,\n gap: 10,\n flexDirection: 'row',\n },\n tileWrap: {\n position: 'relative',\n overflow: 'visible',\n },\n imageTile: {\n width: TILE,\n height: TILE,\n borderRadius: 10,\n borderWidth: 1.5,\n },\n fileTile: {\n height: TILE,\n minWidth: 200,\n maxWidth: 260,\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 10,\n paddingRight: 28,\n borderRadius: 10,\n borderWidth: 1,\n gap: 10,\n },\n fileIconBox: {\n width: 36,\n height: 36,\n borderRadius: 8,\n alignItems: 'center',\n justifyContent: 'center',\n },\n fileInfo: {\n flex: 1,\n gap: 2,\n },\n fileName: {\n fontSize: 13,\n fontWeight: '600',\n },\n fileSize: {\n fontSize: 11,\n },\n closeBtn: {\n // Outside the tile (top-right corner overflowing). Parent\n // scroll container + tileWrap set overflow:visible and the\n // scroll contentContainer has paddingTop:8 so the overflow\n // isn't clipped on Android.\n position: 'absolute',\n top: -6,\n right: -6,\n width: 22,\n height: 22,\n borderRadius: 11,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'rgba(40,40,40,0.85)',\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.3,\n shadowRadius: 2,\n elevation: 3,\n },\n progressOverlay: {\n ...StyleSheet.absoluteFillObject,\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'none',\n },\n spinner: {\n width: 24,\n height: 24,\n borderRadius: 12,\n borderWidth: 2.5,\n borderTopColor: 'transparent',\n // RN can't loop a rotation purely in StyleSheet, but the static\n // 3/4-circle still reads as \"in progress.\" A real Animated.View\n // rotation lands in a follow-up.\n },\n errorOverlay: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n paddingVertical: 3,\n alignItems: 'center',\n },\n errorText: {\n fontSize: 10,\n fontWeight: '700',\n },\n});\n","import { useEffect, useState } from 'react';\nimport { Keyboard, Platform } from 'react-native';\n\n/**\n * True while the software keyboard is up.\n *\n * Surfaces use this to drop their bottom safe-area padding while the\n * keyboard covers the navigation bar / home indicator — otherwise the\n * inset shows up as a dead gap between the content and the keyboard.\n * iOS fires `Will*` events (lets the padding change ride the keyboard\n * animation); Android only reliably fires `Did*`.\n */\nexport function useKeyboardOpen(): boolean {\n const [open, setOpen] = useState(false);\n useEffect(() => {\n const show = Keyboard.addListener(\n Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow',\n () => setOpen(true),\n );\n const hide = Keyboard.addListener(\n Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide',\n () => setOpen(false),\n );\n return () => {\n show.remove();\n hide.remove();\n };\n }, []);\n return open;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';\nimport type { AttachmentUploadInput, Message, Uuid } from '@poolse/sdk';\nimport { useUser } from '@poolse/react';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { UploadQueueStrip } from './UploadQueueStrip.js';\nimport { useSharedUpload } from './internal/uploadContext.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useKeyboardOpen } from './internal/useKeyboardOpen.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MessageComposerProps {\n /**\n * Called when the user taps Send. Second arg carries\n * `quoted_message_id` (when replying) and `attachment_ids`\n * (resolved from the composer's upload queue). Awaited so the\n * composer disables until the send round-trips.\n */\n onSend: (\n body: string,\n opts?: { quoted_message_id?: Uuid; attachment_ids?: Uuid[] },\n ) => Promise<unknown> | void;\n /** Called on every keystroke. Hook to `useTyping().signalTyping`. */\n onTyping?: () => void;\n placeholder?: string;\n disabled?: boolean;\n /** Renders a quote chip above the input; cleared by the caller in `onSend`. */\n replyingTo?: Message | null;\n /** User tapped (x) on the quote chip. */\n onCancelReply?: () => void;\n /** Display label for the quoted sender, keyed by `external_id`. */\n labelFor?: (externalId: string) => string;\n /** Show the paperclip + queue strip. Defaults true. */\n attachments?: boolean;\n /** Tap on the paperclip — wire to `<AttachmentPicker>` from the same package. */\n onAttachPress?: () => void;\n /**\n * Distance from the top of the screen to the top of the\n * KeyboardAvoidingView — typically the height of any navigation\n * header sitting above the chat. Pass this when the iOS keyboard\n * suggestions strip ends up covering the composer (a sign the\n * computed offset is wrong). Defaults to 0; on Android it's\n * ignored.\n */\n keyboardOffset?: number;\n /**\n * When set, the composer enters edit mode: prefills the input with\n * the message body and renders an \"Editing message\" chip above\n * (mirrors `replyingTo`). Tapping Send calls `onSaveEdit(body)`\n * instead of `onSend`; `onCancelEdit` clears the chip and restores\n * the previous draft. Pass `null` (or omit) when not editing.\n */\n editingMessage?: Message | null;\n onCancelEdit?: () => void;\n onSaveEdit?: (body: string) => Promise<unknown> | void;\n}\n\n/**\n * Imperative handle for parents that want to add files to the\n * composer's upload queue externally (drag/drop on a wrapper,\n * deep-link, attachment shortcut).\n */\nexport interface MessageComposerHandle {\n /** Enqueue ready-to-upload inputs. The picker component is the usual caller; this is the escape hatch. */\n addFiles: (inputs: AttachmentUploadInput[]) => void;\n focus: () => void;\n clear: () => void;\n}\n\nexport const MessageComposer = forwardRef<MessageComposerHandle, MessageComposerProps>(\n function MessageComposer(\n {\n onSend,\n onTyping,\n placeholder = 'Type a message…',\n disabled = false,\n replyingTo,\n onCancelReply,\n labelFor,\n attachments = true,\n onAttachPress,\n keyboardOffset: _keyboardOffset = 0,\n editingMessage = null,\n onCancelEdit,\n onSaveEdit,\n },\n ref,\n ) {\n const theme = usePoolseTheme();\n const inputRef = useRef<TextInput>(null);\n const [value, setValue] = useState('');\n const [sending, setSending] = useState(false);\n const keyboardOpen = useKeyboardOpen();\n const upload = useSharedUpload();\n const insets = useSafeInsets();\n\n useImperativeHandle(\n ref,\n () => ({\n addFiles: (inputs) => {\n if (!attachments) return;\n for (const input of inputs) {\n void upload.upload(input);\n }\n },\n focus: () => inputRef.current?.focus(),\n clear: () => setValue(''),\n }),\n [attachments, upload],\n );\n\n const readyAttachmentIds = upload.queue\n .filter((item) => item.status === 'ready' && item.attachment)\n .map((item) => item.attachment!.id);\n const isUploading = upload.queue.some(\n (item) => item.status === 'uploading' || item.status === 'pending',\n );\n\n // Stash the user's in-progress draft when edit mode opens so we\n // can put it back when they cancel. Without this, cancelling\n // would either wipe what they were typing or leave the edited\n // body in the input.\n const previousDraftRef = useRef<string | null>(null);\n const editingIdRef = useRef<string | null>(null);\n useEffect(() => {\n const id = editingMessage?.id ?? null;\n if (id === editingIdRef.current) return;\n if (id) {\n // Entering edit mode for a new message: snapshot whatever\n // the user was drafting, then prefill with the body.\n previousDraftRef.current = value;\n setValue(editingMessage?.body ?? '');\n // Focus so the keyboard pops up and the cursor lands at the\n // end of the prefilled body.\n inputRef.current?.focus();\n } else {\n // Leaving edit mode — restore the prior draft.\n setValue(previousDraftRef.current ?? '');\n previousDraftRef.current = null;\n }\n editingIdRef.current = id;\n // value intentionally omitted: we only want this to fire when\n // the editingMessage identity changes, not on every keystroke.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editingMessage?.id, editingMessage?.body]);\n\n const isEditing = !!editingMessage;\n const editChanged = isEditing && value.trim() !== (editingMessage?.body?.trim() ?? '');\n\n const submitDisabled =\n disabled ||\n sending ||\n isUploading ||\n (isEditing\n ? !editChanged || value.trim().length === 0\n : value.trim().length === 0 && readyAttachmentIds.length === 0);\n\n const handleSend = async () => {\n if (submitDisabled) return;\n // Snapshot + clear synchronously so the input is empty on the\n // next keystroke even if the send round-trip is slow. Otherwise\n // the user types into the still-present old text and the new\n // characters append to the stale message.\n const body = value.trim();\n setSending(true);\n try {\n if (isEditing && onSaveEdit) {\n // Edit mode: don't clear attachments or the reply chip;\n // we're just updating the body. The parent will clear\n // editingMessage on success, which triggers the effect\n // above to restore the prior draft.\n await onSaveEdit(body);\n } else {\n const replyId = replyingTo?.id;\n const attachmentIds = readyAttachmentIds;\n setValue('');\n upload.reset();\n await onSend(body, {\n ...(replyId ? { quoted_message_id: replyId } : {}),\n ...(attachmentIds.length > 0 ? { attachment_ids: attachmentIds } : {}),\n });\n }\n } finally {\n setSending(false);\n }\n };\n\n // No KeyboardAvoidingView here — ConversationView wraps the whole\n // chat surface in a single KAV so the list + composer shift up\n // together. Wrapping only the composer inside a flex:1 parent\n // with no headroom pushed it below the visible area on iPhone\n // home-indicator devices.\n //\n // When the keyboard is closed we add the bottom safe-area inset\n // to keep the send/attach buttons off the home indicator. When\n // it's open the OS bottom inset is irrelevant (keyboard occupies\n // that space) and we collapse back to the base 10px padding to\n // avoid floating the composer above the keyboard.\n const paddingBottom = keyboardOpen ? 10 : Math.max(10, insets.bottom);\n return (\n <View\n style={[\n styles.wrap,\n {\n backgroundColor: theme.colors.surface,\n borderTopColor: theme.colors.border,\n paddingBottom,\n },\n ]}\n >\n {isEditing ? (\n <EditChip\n message={editingMessage!}\n {...(onCancelEdit ? { onCancel: onCancelEdit } : {})}\n />\n ) : replyingTo ? (\n <ReplyChip\n message={replyingTo}\n {...(labelFor ? { labelFor } : {})}\n {...(onCancelReply ? { onCancel: onCancelReply } : {})}\n />\n ) : null}\n\n {attachments && !isEditing ? <UploadQueueStrip /> : null}\n\n <View style={styles.row}>\n {attachments && onAttachPress ? (\n <Pressable\n onPress={onAttachPress}\n hitSlop={8}\n style={styles.iconBtn}\n accessibilityLabel=\"Attach file\"\n >\n <PoolseIcon name=\"attachment\" size={22} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n\n <TextInput\n ref={inputRef}\n value={value}\n onChangeText={(text) => {\n setValue(text);\n onTyping?.();\n }}\n placeholder={placeholder}\n placeholderTextColor={theme.colors.ink3}\n multiline\n editable={!disabled}\n style={[\n styles.input,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.lg,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n },\n ]}\n />\n\n <Pressable\n onPress={handleSend}\n disabled={submitDisabled}\n style={[\n styles.sendBtn,\n {\n backgroundColor: submitDisabled ? theme.colors.ink3 : theme.colors.brand,\n opacity: submitDisabled ? 0.6 : 1,\n },\n ]}\n accessibilityLabel=\"Send message\"\n >\n <PoolseIcon name=\"send\" size={18} color={theme.colors.onBrand} />\n </Pressable>\n </View>\n </View>\n );\n },\n);\n\nfunction EditChip({ message, onCancel }: { message: Message; onCancel?: () => void }) {\n const theme = usePoolseTheme();\n return (\n <View\n style={[\n styles.replyChip,\n {\n backgroundColor: theme.colors.surface2,\n borderLeftColor: theme.colors.brand,\n },\n ]}\n >\n <View style={{ flex: 1 }}>\n <Text style={[styles.replyName, { color: theme.colors.brand }]}>Editing message</Text>\n <Text style={[styles.replyBody, { color: theme.colors.ink2 }]} numberOfLines={1}>\n {message.body ?? '…'}\n </Text>\n </View>\n {onCancel ? (\n <Pressable onPress={onCancel} hitSlop={8} style={styles.replyCancel}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction ReplyChip({\n message,\n labelFor,\n onCancel,\n}: {\n message: Message;\n labelFor?: (externalId: string) => string;\n onCancel?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n const resolved = useUser(message.sender_external_id);\n const senderName = message.sender_external_id\n ? (labelFor?.(message.sender_external_id) ??\n resolved.profile?.displayName ??\n message.sender_external_id)\n : 'Unknown';\n return (\n <View\n style={[\n styles.replyChip,\n {\n backgroundColor: theme.colors.surface2,\n borderLeftColor: theme.colors.brand,\n },\n ]}\n >\n <View style={{ flex: 1 }}>\n <Text style={[styles.replyName, { color: theme.colors.brand }]}>\n Replying to {senderName}\n </Text>\n <Text style={[styles.replyBody, { color: theme.colors.ink2 }]} numberOfLines={1}>\n {message.body ?? '…'}\n </Text>\n </View>\n {onCancel ? (\n <Pressable onPress={onCancel} hitSlop={8} style={styles.replyCancel}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n borderTopWidth: StyleSheet.hairlineWidth,\n paddingTop: 8,\n paddingHorizontal: 12,\n // paddingBottom is applied inline — it follows the keyboard state\n // (10 px while open, max(10, safeBottomInset) while closed) so the\n // send/attach buttons stay clear of the home indicator without\n // double-padding above the keyboard.\n },\n row: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 8,\n },\n iconBtn: {\n padding: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n minHeight: 40,\n maxHeight: 120,\n paddingHorizontal: 12,\n paddingTop: 10,\n paddingBottom: 10,\n },\n sendBtn: {\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n },\n replyChip: {\n flexDirection: 'row',\n alignItems: 'center',\n borderLeftWidth: 3,\n paddingLeft: 10,\n paddingRight: 6,\n paddingVertical: 6,\n marginBottom: 8,\n borderRadius: 6,\n },\n replyName: {\n fontSize: 11,\n fontWeight: '600',\n marginBottom: 2,\n },\n replyBody: {\n fontSize: 12,\n },\n replyCancel: {\n padding: 6,\n },\n});\n","import type { Membership, Uuid } from '@poolse/sdk';\nimport { useMembers } from '@poolse/react';\nimport { useMemo, useState } from 'react';\nimport {\n FlatList,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { MessageComposer, type MessageComposerProps } from './MessageComposer.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useKeyboardOpen } from './internal/useKeyboardOpen.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MentionInputProps extends Omit<MessageComposerProps, 'onSend'> {\n conversationId: Uuid;\n /** Same callback as MessageComposer.onSend, plus optional mention user_ids. */\n onSend: (\n body: string,\n opts?: {\n quoted_message_id?: Uuid;\n attachment_ids?: Uuid[];\n mentions?: Uuid[];\n },\n ) => Promise<unknown> | void;\n}\n\n/**\n * Composer with an inline `@`-trigger that opens a modal sheet of\n * conversation members. Selecting a member inserts their\n * `external_id` into the text, and the wire `mentions` array (sent\n * to the backend) carries the corresponding internal `user_id`s.\n */\nexport function MentionInput({ conversationId, onSend, ...composerProps }: MentionInputProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n const keyboardOpen = useKeyboardOpen();\n const { members } = useMembers(conversationId);\n const [pickerOpen, setPickerOpen] = useState(false);\n const [pickerQuery, _setPickerQuery] = useState('');\n const [pendingMentionUuids, setPendingMentionUuids] = useState<Uuid[]>([]);\n const [text, setText] = useState('');\n\n const filteredMembers = useMemo(() => {\n if (!pickerQuery) return members;\n const q = pickerQuery.toLowerCase();\n return members.filter((m) => m.external_id.toLowerCase().includes(q));\n }, [members, pickerQuery]);\n\n const handleSend: MessageComposerProps['onSend'] = async (body, opts) => {\n await onSend(body, {\n ...opts,\n ...(pendingMentionUuids.length > 0 ? { mentions: pendingMentionUuids } : {}),\n });\n setPendingMentionUuids([]);\n setText('');\n };\n\n return (\n <>\n <MessageComposer\n {...composerProps}\n onSend={handleSend}\n onTyping={() => {\n composerProps.onTyping?.();\n // Watch for an `@` token to open the picker.\n const lastChar = text.slice(-1);\n if (lastChar === '@') setPickerOpen(true);\n }}\n />\n\n <Modal\n visible={pickerOpen}\n transparent\n animationType=\"slide\"\n onRequestClose={() => setPickerOpen(false)}\n // Edge-to-edge on Android like the host app, so the inset and\n // keyboard maths below hold on every device.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* The picker opens while the composer's keyboard is usually\n still up. The modal is full-screen and never resized, so a\n `padding` KAV (on both platforms) lifts the sheet exactly\n above the keyboard. */}\n <KeyboardAvoidingView style={styles.kav} behavior=\"padding\">\n <Pressable style={styles.backdrop} onPress={() => setPickerOpen(false)}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Clear the nav bar — unless the keyboard is covering\n // it, where the inset would just be a gap.\n paddingBottom: 12 + (keyboardOpen ? 0 : insets.bottom),\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n ]}\n >\n <Text\n style={[styles.title, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n >\n Mention a member\n </Text>\n <FlatList\n data={filteredMembers}\n keyExtractor={(m) => m.user_id}\n // First tap picks a member even with the keyboard up.\n keyboardShouldPersistTaps=\"handled\"\n renderItem={({ item }) => (\n <MentionRow\n member={item}\n onPress={() => {\n setPendingMentionUuids((prev) => [...prev, item.user_id]);\n setText((prev) => `${prev}${item.external_id} `);\n setPickerOpen(false);\n }}\n />\n )}\n />\n </View>\n </Pressable>\n </KeyboardAvoidingView>\n </Modal>\n </>\n );\n}\n\nfunction MentionRow({ member, onPress }: { member: Membership; onPress: () => void }) {\n const theme = usePoolseTheme();\n return (\n <Pressable onPress={onPress} style={styles.row}>\n <Avatar src={null} name={member.external_id} seed={member.external_id} size=\"sm\" />\n <Text style={[styles.rowText, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}>\n {member.external_id}\n </Text>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n kav: {\n flex: 1,\n },\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n maxHeight: '60%',\n paddingVertical: 12,\n },\n title: {\n fontSize: 14,\n fontWeight: '600',\n paddingHorizontal: 16,\n paddingBottom: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 10,\n gap: 10,\n },\n rowText: {\n fontSize: 14,\n },\n});\n","import type { Message } from '@poolse/sdk';\nimport {\n ActivityIndicator,\n FlatList,\n type ListRenderItem,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\nimport { useCallback, useEffect, useRef, useState, type ReactElement } from 'react';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n/**\n * Either a real message or a day-separator row. ConversationView\n * builds the list of items (interleaving separators where the day\n * changes) and hands it to MessageList; MessageList just renders.\n */\nexport type MessageListItem =\n | { kind: 'msg'; msg: Message }\n | { kind: 'separator'; id: string; node: ReactElement };\n\nexport interface MessageListProps {\n messages: Message[];\n /**\n * Optional pre-built item list (with day separators interleaved).\n * When omitted, a list with `{ kind: 'msg' }` items is derived\n * from `messages` and rendered without separators.\n */\n items?: MessageListItem[];\n loading?: boolean;\n hasMore?: boolean;\n onLoadMore?: () => void;\n renderItem: (msg: Message, index: number) => ReactElement;\n /** Slot rendered above the latest message (typically the typing indicator). */\n ListHeader?: ReactElement | null;\n /** Slot rendered below the oldest message (rare — typically nothing). */\n ListFooter?: ReactElement | null;\n /** Custom empty state when there are no messages. */\n emptyState?: ReactElement | string;\n /**\n * The current user's id. When provided, MessageList will show a\n * \"↓ N new messages\" jump button at the bottom of the chat\n * whenever new messages from OTHER users arrive while the user is\n * scrolled away from the bottom. Tapping scrolls to the latest.\n */\n meId?: string | null;\n}\n\n// How far above the bottom (in pixels — the list is inverted, so\n// this is contentOffset.y) before we consider the user \"scrolled\n// up\" and start counting new messages.\nconst AT_BOTTOM_THRESHOLD = 32;\n\n/**\n * Inverted FlatList wrapper for chat history. Newest message at the\n * bottom (visually), oldest at the top. Calls `onLoadMore` when the\n * user scrolls near the top edge and `hasMore` is true.\n *\n * Pagination is owned by `useMessages` (hand it `messages` +\n * `hasMore` + `loadMore`); this component just renders + scrolls.\n */\nexport function MessageList({\n messages,\n items,\n loading = false,\n hasMore = false,\n onLoadMore,\n renderItem,\n ListHeader = null,\n ListFooter = null,\n emptyState,\n meId = null,\n}: MessageListProps) {\n const theme = usePoolseTheme();\n const flatListRef = useRef<FlatList<MessageListItem>>(null);\n const [atBottom, setAtBottom] = useState(true);\n const [newCount, setNewCount] = useState(0);\n const lastTailIdRef = useRef<string | null>(null);\n\n // Build the FlatList data — either the caller's prebuilt items\n // (with separators) or a plain msg-only list. FlatList is\n // inverted, so we reverse to put the newest item at the top of\n // `data` (which renders at the visual bottom).\n const sourceItems: MessageListItem[] =\n items ?? messages.map((msg) => ({ kind: 'msg' as const, msg }));\n const data = [...sourceItems].reverse();\n\n // Track tail-message changes to maintain the \"new messages\" badge\n // when the user is scrolled up.\n useEffect(() => {\n const tail = messages[messages.length - 1];\n if (!tail) return;\n const tailId = tail.id;\n if (tailId === lastTailIdRef.current) return;\n const isFirstSet = lastTailIdRef.current === null;\n lastTailIdRef.current = tailId;\n if (atBottom || isFirstSet) {\n setNewCount(0);\n return;\n }\n // Only count incoming messages from other users — self messages\n // would have already triggered a scroll-to-bottom in normal flow.\n if (meId !== null && tail.sender_id === meId) return;\n setNewCount((n) => n + 1);\n }, [messages, atBottom, meId]);\n\n const handleScroll = useCallback((e: NativeSyntheticEvent<NativeScrollEvent>) => {\n const y = e.nativeEvent.contentOffset.y;\n const next = y <= AT_BOTTOM_THRESHOLD;\n setAtBottom((prev) => (prev === next ? prev : next));\n if (next) setNewCount(0);\n }, []);\n\n const scrollToBottom = useCallback(() => {\n flatListRef.current?.scrollToOffset({ offset: 0, animated: true });\n setNewCount(0);\n }, []);\n\n const handleRender: ListRenderItem<MessageListItem> = useCallback(\n ({ item, index }) => {\n if (item.kind === 'separator') return item.node;\n // Index in the original (newest-last) source order. Used by\n // ConversationView's renderItem to pick neighbours for\n // grouping when it doesn't pre-compute groupPosition itself.\n const sourceIndex = data.length - 1 - index;\n return renderItem(item.msg, sourceIndex);\n },\n [renderItem, data.length],\n );\n\n if (loading && messages.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (messages.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {emptyState}\n </Text>\n ) : (\n (emptyState ?? null)\n )}\n </View>\n );\n }\n\n return (\n <View style={styles.root}>\n <FlatList\n ref={flatListRef}\n inverted\n data={data}\n keyExtractor={(item) => (item.kind === 'msg' ? item.msg.id : item.id)}\n renderItem={handleRender}\n onEndReached={hasMore ? onLoadMore : undefined}\n onEndReachedThreshold={0.3}\n onScroll={handleScroll}\n scrollEventThrottle={32}\n // `inverted` flips the list, so FlatList's ListHeaderComponent\n // renders at the bottom of the screen (above the latest message,\n // next to the composer) and ListFooterComponent renders at the\n // top (above the oldest message). That matches our prop names.\n ListHeaderComponent={ListHeader}\n ListFooterComponent={\n <View>\n {hasMore && loading ? (\n <ActivityIndicator color={theme.colors.ink3} style={{ marginVertical: 8 }} />\n ) : null}\n {ListFooter}\n </View>\n }\n style={{ backgroundColor: theme.colors.paper }}\n contentContainerStyle={{ paddingVertical: 8 }}\n />\n\n {!atBottom && newCount > 0 ? (\n <Pressable\n onPress={scrollToBottom}\n style={[\n styles.jumpButton,\n {\n backgroundColor: theme.colors.brand,\n },\n theme.shadows.sm,\n ]}\n accessibilityLabel={`${newCount} new ${newCount === 1 ? 'message' : 'messages'}, jump to latest`}\n >\n <PoolseIcon name=\"chevron-down\" size={14} color={theme.colors.onBrand} />\n <Text style={[styles.jumpText, { color: theme.colors.onBrand }]}>\n {newCount} new {newCount === 1 ? 'message' : 'messages'}\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n jumpButton: {\n position: 'absolute',\n alignSelf: 'center',\n bottom: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n paddingHorizontal: 14,\n paddingVertical: 8,\n borderRadius: 999,\n },\n jumpText: {\n fontSize: 13,\n fontWeight: '600',\n },\n});\n","import type { Message } from '@poolse/sdk';\nimport { callLogDisplayFor } from '@poolse/react';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface CallLogRowProps {\n /** The call-log message. Rows that aren't call logs render nothing. */\n msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & { deleted_at?: string | null };\n /** Current user's id — decides how the call is worded for them. */\n meId: string | null;\n /**\n * Offer \"Call back\" on calls the viewer missed or declined, or placed\n * with no answer. Receives the call's media. Omit to show no action.\n */\n onCallBack?: (media: 'audio' | 'video') => void;\n}\n\n/**\n * Centered, compact timeline line for call-log system messages\n * (\"Voice call · 3:12\", \"Missed call\"). Same visual family as\n * `<DaySeparator>` — surface chip, hairline border, small semibold\n * label — so it reads as a separator between bubble clusters rather\n * than a message. No reactions, thread pill, swipe or long-press.\n *\n * `<MessageRow>` renders this automatically for call-log messages.\n */\nexport function CallLogRow({ msg, meId, onCallBack }: CallLogRowProps) {\n const theme = usePoolseTheme();\n const display = callLogDisplayFor(msg, meId);\n if (!display) return null;\n\n const accent = display.missed ? theme.colors.error : theme.colors.ink3;\n const time = formatTime(msg.inserted_at);\n const label = [display.title, display.detail, time].filter(Boolean).join(', ');\n const metaStyle = [styles.meta, { color: theme.colors.ink3, fontFamily: theme.type.fontBody }];\n\n return (\n <View style={styles.wrap} accessible accessibilityLabel={label}>\n <View\n style={[\n styles.chip,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: theme.colors.border,\n },\n ]}\n >\n <PoolseIcon name={display.media === 'video' ? 'video' : 'phone'} size={13} color={accent} />\n <Text\n style={[\n styles.title,\n {\n color: display.missed ? theme.colors.error : theme.colors.ink2,\n fontFamily: theme.type.fontBody,\n },\n ]}\n numberOfLines={1}\n >\n {display.title}\n </Text>\n {display.detail ? <Text style={metaStyle}>· {display.detail}</Text> : null}\n {time ? <Text style={metaStyle}>· {time}</Text> : null}\n </View>\n {display.callBack && onCallBack ? (\n <Pressable\n onPress={() => onCallBack(display.media)}\n accessibilityRole=\"button\"\n accessibilityLabel={display.media === 'video' ? 'Video call back' : 'Call back'}\n hitSlop={8}\n style={({ pressed }) => [styles.callBack, pressed && styles.callBackPressed]}\n >\n <Text\n style={[\n styles.callBackText,\n { color: theme.colors.brand, fontFamily: theme.type.fontBody },\n ]}\n >\n Call back\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction formatTime(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '';\n return d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignItems: 'center',\n alignSelf: 'stretch',\n marginVertical: 6,\n paddingHorizontal: 16,\n gap: 4,\n },\n callBack: { paddingHorizontal: 10, paddingVertical: 2 },\n callBackPressed: { opacity: 0.6 },\n callBackText: { fontSize: 12, fontWeight: '600' },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n maxWidth: '100%',\n paddingHorizontal: 12,\n paddingVertical: 4,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n },\n title: {\n fontSize: 11,\n fontWeight: '600',\n letterSpacing: 0.3,\n flexShrink: 1,\n },\n meta: {\n fontSize: 11,\n fontWeight: '500',\n letterSpacing: 0.3,\n fontVariant: ['tabular-nums'],\n },\n});\n","import { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nconst DEFAULT_REACTION_EMOJIS = ['👍', '❤️', '😂', '🎉', '🙏', '🔥'];\n\nexport interface MessageActionsProps {\n visible: boolean;\n onClose: () => void;\n isSelf: boolean;\n /**\n * Quick-reaction emoji row rendered at the top of the sheet. Tap\n * one to fire `onPickReaction(emoji)` and immediately close. When\n * omitted (or `onPickReaction` is omitted) the row is hidden.\n */\n emojis?: string[];\n onPickReaction?: (emoji: string) => void;\n onReply?: () => void;\n onReplyInThread?: () => void;\n onQuote?: () => void;\n onEdit?: () => void;\n onDelete?: () => void;\n onCopy?: () => void;\n}\n\n/**\n * Long-press action menu — modal bottom sheet. Renders a row of\n * quick-react emojis at the top (one tap reacts + closes) plus the\n * action items below. Matches WhatsApp / iMessage's \"long-press\n * shows everything inline\" pattern.\n */\nexport function MessageActions({\n visible,\n onClose,\n isSelf,\n emojis = DEFAULT_REACTION_EMOJIS,\n onPickReaction,\n onReply,\n onReplyInThread,\n onQuote,\n onEdit,\n onDelete,\n onCopy,\n}: MessageActionsProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n const items: Array<{ label: string; icon: IconName; onPress: () => void; danger?: boolean }> = [];\n if (onReply) items.push({ label: 'Reply', icon: 'reply', onPress: onReply });\n if (onQuote) items.push({ label: 'Quote reply', icon: 'reply', onPress: onQuote });\n if (onReplyInThread)\n items.push({ label: 'Reply in thread', icon: 'messages', onPress: onReplyInThread });\n if (onCopy) items.push({ label: 'Copy text', icon: 'copy', onPress: onCopy });\n if (isSelf && onEdit) items.push({ label: 'Edit', icon: 'edit', onPress: onEdit });\n if (isSelf && onDelete)\n items.push({ label: 'Delete', icon: 'trash', onPress: onDelete, danger: true });\n\n const showEmojiRow = !!onPickReaction && emojis.length > 0;\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the sheet's\n // bottom padding below is what actually clears the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable style={styles.backdrop} onPress={onClose}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Last action row must sit above the nav bar / home indicator.\n paddingBottom: 24 + insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n theme.shadows.lg,\n ]}\n >\n {showEmojiRow ? (\n <View style={[styles.emojiRow, { borderBottomColor: theme.colors.border }]}>\n {emojis.map((emoji) => (\n <Pressable\n key={emoji}\n onPress={() => {\n onPickReaction(emoji);\n onClose();\n }}\n style={styles.emojiBtn}\n hitSlop={6}\n accessibilityLabel={`React with ${emoji}`}\n >\n <Text style={styles.emoji}>{emoji}</Text>\n </Pressable>\n ))}\n </View>\n ) : null}\n\n {items.map((item) => (\n <Pressable key={item.label} onPress={item.onPress} style={styles.item}>\n <PoolseIcon\n name={item.icon}\n size={18}\n color={item.danger ? theme.colors.error : theme.colors.ink2}\n />\n <Text\n style={[\n styles.itemText,\n {\n color: item.danger ? theme.colors.error : theme.colors.ink,\n fontFamily: theme.type.fontBody,\n },\n ]}\n >\n {item.label}\n </Text>\n </Pressable>\n ))}\n </View>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n paddingTop: 8,\n paddingBottom: 24,\n },\n emojiRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-around',\n paddingHorizontal: 12,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n marginBottom: 6,\n },\n emojiBtn: {\n paddingHorizontal: 6,\n paddingVertical: 6,\n borderRadius: 999,\n alignItems: 'center',\n justifyContent: 'center',\n },\n emoji: {\n fontSize: 30,\n lineHeight: 36,\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 20,\n paddingVertical: 14,\n gap: 14,\n },\n itemText: {\n fontSize: 15,\n fontWeight: '500',\n },\n});\n","import type { Attachment } from '@poolse/sdk';\nimport { useAttachmentUrl } from '@poolse/react';\nimport { Image, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface AttachmentPreviewProps {\n attachment: Attachment;\n /** Optional tap handler. For images defaults to opening the source URL. */\n onPress?: () => void;\n /** Render at this max width. Defaults to 280. */\n maxWidth?: number;\n /**\n * `'onBrand'` restyles the file card for a brand-colored self\n * bubble — translucent white instead of surface grey, so the card\n * reads as part of the bubble rather than a patch cut out of it.\n */\n tone?: 'default' | 'onBrand';\n}\n\nexport function AttachmentPreview({\n attachment,\n onPress,\n maxWidth = 280,\n tone = 'default',\n}: AttachmentPreviewProps) {\n const theme = usePoolseTheme();\n const isImage = (attachment.content_type ?? '').startsWith('image/');\n const { url } = useAttachmentUrl(attachment.id);\n\n if (isImage) {\n return (\n <Pressable onPress={onPress} disabled={!onPress}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={{\n width: maxWidth,\n height: 200,\n borderRadius: theme.radii.md,\n backgroundColor: theme.colors.surface2,\n }}\n resizeMode=\"cover\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'attachment image'}\n />\n ) : (\n <View\n style={[\n styles.imagePlaceholder,\n {\n width: maxWidth,\n height: 200,\n borderRadius: theme.radii.md,\n backgroundColor: theme.colors.surface2,\n },\n ]}\n />\n )}\n </Pressable>\n );\n }\n\n const onBrand = tone === 'onBrand';\n const ink = onBrand ? theme.colors.onBrand : theme.colors.ink;\n const inkSoft = onBrand ? theme.colors.onBrand : theme.colors.ink3;\n\n return (\n <Pressable\n onPress={onPress}\n disabled={!onPress}\n style={[\n styles.fileCard,\n {\n backgroundColor: onBrand ? 'rgba(255,255,255,0.18)' : theme.colors.surface2,\n borderColor: onBrand ? 'transparent' : theme.colors.border,\n borderRadius: theme.radii.md,\n },\n ]}\n >\n <PoolseIcon name=\"attachment\" size={18} color={onBrand ? ink : theme.colors.ink2} />\n <View style={{ flex: 1, marginLeft: 8 }}>\n <Text\n style={[styles.fileName, { color: ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {attachment.original_filename ?? 'file'}\n </Text>\n <Text style={[styles.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }]}>\n {formatBytes(attachment.byte_size)}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nfunction formatBytes(n: number): string {\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;\n if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;\n return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;\n}\n\nconst styles = StyleSheet.create({\n imagePlaceholder: {},\n fileCard: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 8,\n borderWidth: StyleSheet.hairlineWidth,\n },\n fileName: {\n fontSize: 13,\n fontWeight: '500',\n },\n fileSize: {\n fontSize: 11,\n },\n});\n","import type { Attachment } from '@poolse/sdk';\nimport { useAttachmentUrl } from '@poolse/react';\nimport { useState } from 'react';\nimport { Image, Modal, Pressable, StyleSheet, Text, useWindowDimensions, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ImageMosaicProps {\n images: Attachment[];\n /**\n * Pixel ceiling on the mosaic's width. The mosaic itself fills its\n * parent (`width: '100%'`) and caps at this value, so it always\n * fits inside whatever the bubble's actual content area is at\n * render time — no more hardcoded 280px overflowing on small\n * screens or inside narrow bubbles.\n */\n maxWidth?: number;\n radius?: number;\n /**\n * Square off the bottom corners (a small 5px instead of `radius`).\n * Pass when a caption or file cards follow the mosaic, so the media\n * flows into the text block instead of leaving \"ears\" of bubble\n * color between the image and the caption.\n */\n squareBottom?: boolean;\n /**\n * Long-press on any tile. The tiles are Pressables (tap opens the\n * viewer), and a nested Pressable wins the gesture — so without\n * this, holding an image-only message never reached the row's\n * actions sheet. MessageRow threads its long-press down through\n * here.\n */\n onLongPress?: () => void;\n}\n\n/**\n * WhatsApp-style multi-image grid for inside the message bubble.\n * Uses flex-based widths (with `%` and `aspectRatio`) so the layout\n * scales to whatever the bubble's content area is — no fixed pixel\n * positioning that can overflow when the bubble is narrower than\n * the configured max.\n *\n * * n = 1 → single tile, 16:10 aspect.\n * * n = 2 → row of 2 squares.\n * * n = 3 → 16:9 hero on top + row of 2 squares below.\n * * n ≥ 4 → 2×2 grid with \"+N more\" overlay on the 4th tile.\n */\nexport function ImageMosaic({\n images,\n maxWidth,\n radius,\n squareBottom = false,\n onLongPress,\n}: ImageMosaicProps) {\n const theme = usePoolseTheme();\n const r = radius ?? theme.radii.md;\n const rBottom = squareBottom ? 5 : r;\n const [viewerIndex, setViewerIndex] = useState<number | null>(null);\n\n if (images.length === 0) return null;\n\n const visible = images.slice(0, 4);\n const overflow = images.length > 4 ? images.length - 4 : 0;\n const n = visible.length as 1 | 2 | 3 | 4;\n\n return (\n <>\n <View\n style={[\n styles.root,\n {\n borderTopLeftRadius: r,\n borderTopRightRadius: r,\n borderBottomLeftRadius: rBottom,\n borderBottomRightRadius: rBottom,\n // Explicit pixel width, not just a cap: the mosaic sits\n // inside an auto-sized bubble, and a percentage width\n // against an indefinite parent collapses (or, worse,\n // resolves against the image's intrinsic size and blows\n // the row open). Media bubbles are fixed-width — the\n // WhatsApp convention anyway.\n ...(maxWidth ? { width: maxWidth } : {}),\n },\n ]}\n >\n {n === 1 ? (\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileFull}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n ) : null}\n\n {n === 2 ? (\n <View style={styles.rowEven}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n </View>\n ) : null}\n\n {n === 3 ? (\n <>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHero}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <View style={[styles.rowEven, { marginTop: 2 }]}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[2]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(2)}\n overlay={null}\n />\n </View>\n </>\n ) : null}\n\n {n === 4 ? (\n <>\n <View style={styles.rowEven}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n </View>\n <View style={[styles.rowEven, { marginTop: 2 }]}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[2]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(2)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[3]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(3)}\n overlay={overflow > 0 ? `+${overflow}` : null}\n />\n </View>\n </>\n ) : null}\n </View>\n\n <Modal\n visible={viewerIndex !== null}\n transparent\n animationType=\"fade\"\n onRequestClose={() => setViewerIndex(null)}\n // Full-bleed black viewer on Android too (no app chrome peeking\n // through above/below); the close button pads for the insets.\n {...EDGE_TO_EDGE_MODAL}\n >\n {viewerIndex !== null ? (\n <FullScreenViewer\n attachment={images[viewerIndex]!}\n onClose={() => setViewerIndex(null)}\n />\n ) : null}\n </Modal>\n </>\n );\n}\n\nfunction Tile({\n attachment,\n style,\n overlay,\n onPress,\n onLongPress,\n}: {\n attachment: Attachment;\n style: object;\n overlay: string | null;\n onPress: () => void;\n onLongPress?: (() => void) | undefined;\n}) {\n const theme = usePoolseTheme();\n const { url } = useAttachmentUrl(attachment.id);\n return (\n <Pressable onPress={onPress} onLongPress={onLongPress} style={[styles.tileBase, style]}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={[styles.tileImage, { backgroundColor: theme.colors.surface2 }]}\n resizeMode=\"cover\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'image'}\n />\n ) : (\n <View style={[styles.tileImage, { backgroundColor: theme.colors.surface2 }]} />\n )}\n {overlay ? (\n <View style={styles.overflow}>\n <Text style={styles.overflowText}>{overlay}</Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nfunction FullScreenViewer({\n attachment,\n onClose,\n}: {\n attachment: Attachment;\n onClose: () => void;\n}) {\n const { url } = useAttachmentUrl(attachment.id);\n const { width, height } = useWindowDimensions();\n const insets = useSafeInsets();\n return (\n <Pressable style={styles.viewer} onPress={onClose}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={{ width, height }}\n resizeMode=\"contain\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'image'}\n />\n ) : null}\n <Pressable\n onPress={onClose}\n hitSlop={12}\n // Keep the close button out from under the status bar / notch.\n style={[styles.closeBtn, { top: insets.top + 12, right: insets.right + 16 }]}\n accessibilityLabel=\"Close viewer\"\n >\n <PoolseIcon name=\"close\" size={20} color=\"#ffffff\" />\n </Pressable>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n width: '100%',\n overflow: 'hidden',\n marginBottom: 4,\n },\n rowEven: {\n flexDirection: 'row',\n gap: 2,\n },\n tileBase: {\n overflow: 'hidden',\n },\n // n=1: full bleed at the bubble's available width, 16:10 aspect.\n tileFull: {\n width: '100%',\n aspectRatio: 16 / 10,\n },\n // n=2 / n=4 (per row): two equal squares side-by-side.\n tileHalfSquare: {\n flex: 1,\n aspectRatio: 1,\n },\n // n=3 hero: full-bleed top tile, 16:9.\n tileHero: {\n width: '100%',\n aspectRatio: 16 / 9,\n },\n tileImage: {\n width: '100%',\n height: '100%',\n },\n overflow: {\n position: 'absolute',\n inset: 0,\n backgroundColor: 'rgba(0,0,0,0.55)',\n alignItems: 'center',\n justifyContent: 'center',\n },\n overflowText: {\n color: '#ffffff',\n fontWeight: '700',\n fontSize: 22,\n },\n viewer: {\n flex: 1,\n backgroundColor: '#000000',\n alignItems: 'center',\n justifyContent: 'center',\n },\n closeBtn: {\n position: 'absolute',\n padding: 8,\n backgroundColor: 'rgba(0,0,0,0.5)',\n borderRadius: 20,\n },\n});\n","/**\n * Text-shape helpers shared by the bubble renderer.\n *\n * The bubble picks between three body treatments — inline-meta plain\n * text, full markdown, jumbo emoji — and these predicates are the\n * entire decision. Kept dependency-free so the native package can\n * mirror them line for line (see react-ui/src/bubbleText.ts).\n */\n\n/**\n * Whether the body contains anything Markdown would render\n * differently from plain text. When it doesn't, the bubble skips the\n * Markdown pipeline entirely and uses the plain-text fast path, which\n * is the only path that can float the timestamp into the last line —\n * block elements (paragraphs, lists, fences) own their line boxes and\n * push the meta below instead.\n *\n * Deliberately eager: a false positive only costs the inline\n * timestamp, a false negative would print literal `**` in a bubble.\n */\nexport function hasMarkdown(body: string): boolean {\n return /[*_~`#>|\\\\]|\\[.*\\]|^\\s*(?:[-+]|\\d+[.)])\\s|https?:\\/\\/|www\\./ms.test(body);\n}\n\n/**\n * 1–3 emoji and nothing else → the bubble drops its chrome and the\n * emoji render large (the iMessage convention — a lone 👍 deserves\n * better than a padded rectangle). Returns the emoji count, or 0 when\n * the body is not emoji-only.\n *\n * The regex builds each emoji as: one pictographic base (or keycap /\n * flag pair), optional skin tone, optional VS16, then any number of\n * ZWJ-joined continuations — so 👩👩👧👧 counts as one. Guarded by try\n * in case the engine lacks Unicode property escapes; the fallback is\n * simply \"not emoji-only\", which renders a normal bubble.\n */\nexport function emojiOnlyCount(body: string): number {\n const text = body.trim();\n if (!text || text.length > 32) return 0;\n try {\n const unit =\n '(?:\\\\p{Regional_Indicator}{2}|\\\\p{Extended_Pictographic})' +\n '[\\\\u{1F3FB}-\\\\u{1F3FF}]?\\\\uFE0F?' +\n '(?:\\\\u200D\\\\p{Extended_Pictographic}[\\\\u{1F3FB}-\\\\u{1F3FF}]?\\\\uFE0F?)*';\n const whole = new RegExp(`^(?:${unit}){1,3}$`, 'u');\n if (!whole.test(text)) return 0;\n const each = new RegExp(unit, 'gu');\n return (text.match(each) ?? []).length;\n } catch {\n return 0;\n }\n}\n\n/** Jumbo emoji font size by how many there are — fewer reads bigger. */\nexport function emojiFontSize(count: number): number {\n return count === 1 ? 44 : count === 2 ? 38 : 32;\n}\n","import { createElement, type ReactElement } from 'react';\nimport type { StyleSheet } from 'react-native';\n// Static import — Metro's bundle graph can only trace literal\n// `import` / `require` calls. The earlier try/require trick generated\n// a `require('react-native-markdown-display')` that Metro couldn't\n// resolve from inside our pre-bundled CJS dist, throwing a runtime\n// \"Requiring unknown module\" even when the consumer had the package\n// installed. Hard-importing puts the resolution into the consumer\n// app's normal graph where it works the same way react-native-svg or\n// expo-image-picker do.\n//\n// Trade-off: the package is now a required peer of @poolse/react-native\n// (was optional). Consumers who don't want markdown can pass\n// `markdown={false}` to <ConversationView> — the import stays in the\n// bundle but the component isn't rendered.\nimport Markdown, { MarkdownIt } from 'react-native-markdown-display';\n\n// `react-native-markdown-display` defaults to a stock CommonMark\n// parser, which only treats `[text](url)` and `<url>` as links. Bare\n// URLs in body text (e.g. \"check https://example.com\") stay plain\n// text. Turn on `linkify` so markdown-it autolinks them — matches\n// what react-ui gets via remark-gfm. Built once at module load: the\n// instance is stateless and re-using it avoids re-allocating the\n// parser for every rendered message.\nconst markdownit = MarkdownIt({ typographer: false, linkify: true });\n\nexport interface MarkdownStyleArgs {\n textColor: string;\n linkColor: string;\n fontFamily?: string;\n fontSize: number;\n lineHeight: number;\n onLinkPress: (url: string) => boolean;\n}\n\n/**\n * Render `body` as Markdown into a React element. The style mapping\n * uses the bubble's resolved theme tokens so text color tracks self /\n * other bubble background.\n */\nexport function renderMarkdown(body: string, args: MarkdownStyleArgs): ReactElement {\n const baseText = {\n color: args.textColor,\n fontFamily: args.fontFamily,\n fontSize: args.fontSize,\n lineHeight: args.lineHeight,\n };\n // Match react-ui's GFM defaults — body+inline elements use bubble\n // text color; links pick up the brand-on-bubble color so they\n // remain visible whether the bubble is a self-brand or\n // other-surface variant.\n const style: StyleSheet.NamedStyles<unknown> = {\n body: baseText,\n paragraph: { ...baseText, marginTop: 0, marginBottom: 0 },\n text: baseText,\n strong: { ...baseText, fontWeight: '700' },\n em: { ...baseText, fontStyle: 'italic' },\n s: { ...baseText, textDecorationLine: 'line-through' },\n link: { color: args.linkColor, textDecorationLine: 'underline' },\n code_inline: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n borderRadius: 4,\n paddingHorizontal: 4,\n },\n code_block: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n padding: 8,\n borderRadius: 6,\n },\n fence: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n padding: 8,\n borderRadius: 6,\n },\n bullet_list: { marginTop: 2, marginBottom: 2 },\n ordered_list: { marginTop: 2, marginBottom: 2 },\n list_item: baseText,\n blockquote: {\n ...baseText,\n borderLeftWidth: 3,\n borderLeftColor: args.linkColor,\n paddingLeft: 8,\n marginVertical: 4,\n opacity: 0.85,\n },\n };\n return createElement(Markdown, { style, markdownit, onLinkPress: args.onLinkPress }, body);\n}\n","import type { Message, QuotedMessagePreview, Uuid } from '@poolse/sdk';\nimport { useUser } from '@poolse/react';\nimport { useState, type ReactNode } from 'react';\nimport { Linking, Pressable, StyleSheet, Text, useWindowDimensions, View } from 'react-native';\n\nimport { AttachmentPreview } from './AttachmentPreview.js';\nimport { ImageMosaic } from './ImageMosaic.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { emojiFontSize, emojiOnlyCount, hasMarkdown } from './internal/bubbleText.js';\nimport { renderMarkdown } from './internal/markdown.js';\nimport { userColor } from './primitives/userColor.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';\n\nexport interface MessageBubbleProps {\n message: Message;\n /** Used to decide left/right alignment, color, and read-receipt visibility. */\n currentUserId: string | null;\n /** `'sent'` → single tick, `'read'` → double tick (theme.colors.brand). */\n readState?: 'sent' | 'read';\n /** Label resolver keyed by `external_id` — falls back to the externalId itself. */\n labelFor?: (externalId: string) => string;\n /** Quoted-card tap handler. Typically used to scroll the list to the original message. */\n onQuotedClick?: (quotedMessageId: Uuid) => void;\n /** Position in a same-sender cluster — drives tail-corner rendering. */\n groupPosition?: BubbleGroupPosition;\n /** Truncate at this many chars and show a \"Read more\" toggle. Defaults to 0 (off). */\n maxBodyLength?: number;\n /** Show a colored sender label above other-side bubbles. Only meaningful in group chats. */\n showSenderName?: boolean;\n /** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */\n actionsTrigger?: ReactNode;\n /**\n * Long-press, forwarded into the image tiles. The tiles are\n * Pressables of their own and win the gesture, so a wrapper's\n * onLongPress never fires over an image-only message without this.\n */\n onLongPress?: () => void;\n /** Render in-bubble attachments (images, file cards). Defaults to true. */\n showAttachments?: boolean;\n /**\n * Render the body as Markdown (bold, italic, code, lists, links).\n * Links open via `Linking.openURL`. Requires\n * `react-native-markdown-display` to be installed in the host app;\n * without it we fall back to plain text. Defaults to true.\n */\n markdown?: boolean;\n}\n\n/**\n * One message bubble, structured as stacked sections rather than one\n * padded box: media bleeds to a 3px frame, text carries its own\n * padding, and the timestamp shares the last text line when measured\n * room allows — which is what makes \"ok\" a one-line bubble instead of\n * a squat rectangle.\n */\nexport function MessageBubble({\n message,\n currentUserId,\n readState,\n labelFor,\n onQuotedClick,\n groupPosition = 'standalone',\n maxBodyLength = 0,\n showSenderName = false,\n actionsTrigger,\n showAttachments = true,\n markdown = true,\n onLongPress,\n}: MessageBubbleProps) {\n const theme = usePoolseTheme();\n const { width: screenWidth } = useWindowDimensions();\n const isSelf = currentUserId !== null && message.sender_id === currentUserId;\n const [expanded, setExpanded] = useState(false);\n // Measured, not reserved: the old trick put an invisible twin of the\n // meta inline after the text — but `color: transparent` on a nested\n // Text does not reliably apply on Android, so the \"invisible\" twin\n // rendered visibly at the end of every message. Now the text's last\n // line and the meta are measured, and the meta either shares the\n // last line (when it provably fits) or takes its own row.\n const [lastLineWidth, setLastLineWidth] = useState<number | null>(null);\n const [textBoxWidth, setTextBoxWidth] = useState<number | null>(null);\n const [metaWidth, setMetaWidth] = useState<number | null>(null);\n\n // Pixel cap pinned to screen width so single-line and multi-line\n // bubbles hit the same edge regardless of row padding.\n const bubbleMaxWidth = Math.floor(screenWidth * 0.78);\n // Media caps tighter than text — a photo at 78% of an iPad is a\n // poster, not a message. 420 matches the web stylesheet's cap.\n const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);\n\n const sender = useUser(!isSelf ? message.sender_external_id : null);\n const senderFallbackName = message.sender_external_id ?? 'Unknown';\n const senderLabel =\n sender.profile?.displayName ??\n (message.sender_external_id\n ? (labelFor?.(message.sender_external_id) ?? senderFallbackName)\n : senderFallbackName);\n const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);\n\n const tailCorner = groupPosition === 'last' || groupPosition === 'standalone';\n const bubbleRadius = theme.radii.bubble;\n const textColor = isSelf ? theme.colors.selfBubbleText : theme.colors.otherBubbleText;\n const mutedOnBubble = isSelf ? theme.colors.onBrand : theme.colors.ink3;\n\n const radii = {\n topLeft: bubbleRadius,\n topRight: bubbleRadius,\n bottomLeft: bubbleRadius,\n bottomRight: bubbleRadius,\n };\n if (tailCorner) {\n if (isSelf) radii.bottomRight = 5;\n else radii.bottomLeft = 5;\n }\n\n const body = message.body ?? '';\n const isDeleted = !!message.deleted_at;\n const isEdited = !!message.edited_at && !isDeleted;\n const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;\n const truncated = trimmable && !expanded ? body.slice(0, maxBodyLength) + '…' : body;\n const time = formatTime(message.inserted_at);\n\n const images =\n showAttachments && !isDeleted\n ? (message.attachments ?? []).filter((a) => isImageContentType(a.content_type))\n : [];\n const files =\n showAttachments && !isDeleted\n ? (message.attachments ?? []).filter((a) => !isImageContentType(a.content_type))\n : [];\n const hasMedia = images.length > 0;\n const hasFiles = files.length > 0;\n const hasBody = !isDeleted && body.length > 0;\n\n // Image-only bubble → the meta floats over the picture on a scrim\n // pill, WhatsApp-style, and the bubble is nothing but the frame.\n const metaOverlay = hasMedia && !hasBody && !hasFiles;\n\n // 1–3 emoji and nothing else → no bubble chrome, big glyphs.\n const jumboCount =\n hasBody && !hasMedia && !hasFiles && !message.quoted_message_id ? emojiOnlyCount(body) : 0;\n\n // Timestamp may share the last text line — but only on the\n // plain-text path; markdown blocks and the Read-more toggle own\n // their last line, so those keep the meta row.\n const inlineMeta =\n hasBody && jumboCount === 0 && !trimmable && (!markdown || !hasMarkdown(truncated));\n\n const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;\n\n // The meta shares the last text line only when measurement proves\n // there is room for it; until the three measurements land, it takes\n // its own row, which is always safe.\n const metaFits =\n lastLineWidth !== null &&\n textBoxWidth !== null &&\n metaWidth !== null &&\n lastLineWidth + metaWidth + 14 <= textBoxWidth;\n\n const metaRow = (variant: 'inline' | 'wrapped' | 'block' | 'overlay' | 'jumbo') => {\n const color =\n variant === 'overlay' ? '#FFFFFF' : variant === 'jumbo' ? theme.colors.ink3 : mutedOnBubble;\n return (\n <View\n style={[\n styles.metaRow,\n variant === 'inline' && styles.metaInline,\n variant === 'wrapped' && styles.metaWrapped,\n variant === 'overlay' && styles.metaOverlay,\n variant === 'block' && styles.metaBlock,\n // File-only bubble: the meta row follows the cards directly —\n // give it air so the time doesn't sit glued to the card.\n variant === 'block' && hasFiles && !hasBody && styles.metaBlockAfterFiles,\n variant === 'jumbo' && styles.metaJumbo,\n ]}\n onLayout={\n variant === 'inline' || variant === 'wrapped'\n ? (e) => setMetaWidth(e.nativeEvent.layout.width)\n : undefined\n }\n pointerEvents=\"none\"\n >\n {isEdited ? (\n <Text style={[styles.editedTag, { color, opacity: 0.8 }]}>edited</Text>\n ) : null}\n <Text style={[styles.meta, { color, opacity: variant === 'overlay' ? 1 : 0.75 }]}>\n {time}\n </Text>\n {isSelf && readState ? (\n <View style={styles.readTick}>\n <PoolseIcon\n name={readState === 'read' ? 'check-double' : 'check'}\n size={13}\n color={color}\n />\n </View>\n ) : null}\n </View>\n );\n };\n\n return (\n <View style={[styles.wrap, { alignSelf: isSelf ? 'flex-end' : 'flex-start', maxWidth: bubbleMaxWidth }]}>\n <View\n style={[\n jumboCount === 0 && {\n backgroundColor: isSelf ? theme.colors.selfBubble : theme.colors.otherBubble,\n borderColor: isSelf ? 'transparent' : theme.colors.border,\n borderWidth: isSelf ? 0 : StyleSheet.hairlineWidth,\n borderTopLeftRadius: radii.topLeft,\n borderTopRightRadius: radii.topRight,\n borderBottomLeftRadius: radii.bottomLeft,\n borderBottomRightRadius: radii.bottomRight,\n },\n jumboCount === 0 && theme.shadows.sm,\n ]}\n >\n {showSenderName &&\n !isSelf &&\n jumboCount === 0 &&\n (groupPosition === 'first' || groupPosition === 'standalone') ? (\n <Text\n style={[styles.senderName, { color: senderTint, fontFamily: theme.type.fontBody }]}\n >\n {senderLabel}\n </Text>\n ) : null}\n\n {message.quoted_message ? (\n <QuotedCard\n quoted={message.quoted_message}\n isSelf={isSelf}\n {...(labelFor ? { labelFor } : {})}\n {...(onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message!.id) } : {})}\n />\n ) : null}\n\n {hasMedia ? (\n // 3px of bubble color framing the picture; the mosaic clips\n // itself 3px tighter than the bubble so the curves stay\n // concentric.\n <View style={styles.mediaFrame}>\n <ImageMosaic\n images={images}\n maxWidth={mediaWidth}\n radius={Math.max(bubbleRadius - 3, 8)}\n squareBottom={!metaOverlay}\n {...(onLongPress ? { onLongPress } : {})}\n />\n {metaOverlay ? metaRow('overlay') : null}\n </View>\n ) : null}\n\n {hasFiles ? (\n <View style={styles.filesBlock}>\n {files.map((att) => (\n <AttachmentPreview\n key={att.id}\n attachment={att}\n maxWidth={bubbleMaxWidth - 12}\n tone={isSelf ? 'onBrand' : 'default'}\n />\n ))}\n </View>\n ) : null}\n\n {isDeleted ? (\n <View style={[styles.textBlock, sectionAbove && styles.textBlockAfter]}>\n <Text\n style={{\n color: mutedOnBubble,\n opacity: 0.7,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n fontStyle: 'italic',\n }}\n >\n Message deleted\n </Text>\n </View>\n ) : null}\n\n {hasBody && jumboCount > 0 ? (\n <View style={styles.jumboBlock}>\n <Text\n style={{ fontSize: emojiFontSize(jumboCount), lineHeight: emojiFontSize(jumboCount) + 8 }}\n >\n {body}\n </Text>\n </View>\n ) : null}\n\n {hasBody && jumboCount === 0 ? (\n <View\n style={[styles.textBlock, sectionAbove && styles.textBlockAfter]}\n onLayout={\n inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : undefined\n }\n >\n {markdown && !inlineMeta ? (\n renderMarkdown(truncated, {\n textColor,\n linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n onLinkPress: (url: string) => {\n void Linking.openURL(url).catch(() => undefined);\n return false;\n },\n })\n ) : (\n <Text\n style={{\n color: textColor,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n }}\n onTextLayout={\n inlineMeta\n ? (e) => {\n const lines = e.nativeEvent.lines;\n const last = lines[lines.length - 1];\n setLastLineWidth(last ? Math.ceil(last.width) : 0);\n }\n : undefined\n }\n >\n {truncated}\n </Text>\n )}\n\n {trimmable ? (\n <Pressable onPress={() => setExpanded((e) => !e)}>\n <Text\n style={[\n styles.readMore,\n { color: isSelf ? theme.colors.onBrand : theme.colors.brand },\n ]}\n >\n {expanded ? 'Show less' : 'Read more'}\n </Text>\n </Pressable>\n ) : null}\n\n {inlineMeta ? metaRow(metaFits ? 'inline' : 'wrapped') : null}\n </View>\n ) : null}\n\n {/* Fallback meta row for everything that couldn't inline or\n overlay it: markdown bodies, file bubbles, deleted rows. */}\n {!inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow('block') : null}\n\n {actionsTrigger ? <View style={styles.actionsSlot}>{actionsTrigger}</View> : null}\n </View>\n\n {jumboCount > 0 ? (\n <View style={{ alignSelf: isSelf ? 'flex-end' : 'flex-start' }}>{metaRow('jumbo')}</View>\n ) : null}\n </View>\n );\n}\n\nfunction QuotedCard({\n quoted,\n isSelf,\n labelFor,\n onPress,\n}: {\n quoted: QuotedMessagePreview;\n isSelf: boolean;\n labelFor?: (externalId: string) => string;\n onPress?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n const resolved = useUser(quoted.sender_external_id);\n const senderName = quoted.sender_external_id\n ? (labelFor?.(quoted.sender_external_id) ??\n resolved.profile?.displayName ??\n quoted.sender_external_id)\n : 'Unknown';\n // Darker than the bubble on both sides, so the quote reads as\n // something the message sits on top of.\n const bg = isSelf ? 'rgba(0,0,0,0.16)' : theme.colors.surface2;\n const accent = isSelf ? theme.colors.onBrand : theme.colors.brand;\n const txt = isSelf ? theme.colors.onBrand : theme.colors.ink;\n return (\n <Pressable\n onPress={onPress}\n disabled={!onPress}\n style={[\n styles.quoted,\n {\n backgroundColor: bg,\n borderLeftColor: accent,\n },\n ]}\n >\n <Text style={[styles.quotedSender, { color: accent }]} numberOfLines={1}>\n {senderName}\n </Text>\n <Text style={[styles.quotedBody, { color: txt }]} numberOfLines={2}>\n {quoted.deleted_at ? 'Original message deleted' : (quoted.body ?? '…')}\n </Text>\n </Pressable>\n );\n}\n\nfunction isImageContentType(ct: string | null | undefined): boolean {\n if (!ct) return false;\n return ct.startsWith('image/');\n}\n\n// HH:MM if same calendar day, \"Yesterday HH:MM\" if yesterday, \"Mon DD\"\n// if older than a week, otherwise weekday abbreviation. Matches the\n// WhatsApp / iMessage convention — short enough to fit in the meta\n// row, long enough to be useful at a glance.\nfunction formatTime(iso: string): string {\n try {\n const d = new Date(iso);\n const now = new Date();\n const sameDay = isSameDay(d, now);\n const time = d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });\n if (sameDay) return time;\n\n const yesterday = new Date(now);\n yesterday.setDate(now.getDate() - 1);\n if (isSameDay(d, yesterday)) return `Yesterday ${time}`;\n\n const diffMs = now.getTime() - d.getTime();\n const diffDays = Math.floor(diffMs / 86_400_000);\n if (diffDays < 7) {\n return `${d.toLocaleDateString([], { weekday: 'short' })} ${time}`;\n }\n return d.toLocaleDateString([], { month: 'short', day: 'numeric' });\n } catch {\n return '';\n }\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n marginBottom: 2,\n },\n senderName: {\n fontSize: 12,\n fontWeight: '700',\n paddingTop: 7,\n paddingHorizontal: 12,\n },\n mediaFrame: {\n margin: 3,\n },\n filesBlock: {\n paddingHorizontal: 6,\n paddingTop: 6,\n gap: 4,\n },\n textBlock: {\n paddingHorizontal: 12,\n paddingVertical: 7,\n },\n // A hair less air when media / files / a quote already sit above.\n textBlockAfter: {\n paddingTop: 6,\n },\n jumboBlock: {\n paddingVertical: 2,\n },\n // The meta on its own line inside the text block, flush right —\n // the fallback whenever the last text line has no room for it.\n metaWrapped: {\n alignSelf: 'flex-end',\n marginTop: 3,\n },\n readMore: {\n fontSize: 12,\n fontWeight: '600',\n marginTop: 4,\n },\n metaRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n metaInline: {\n position: 'absolute',\n right: 12,\n // Optically centers the meta against the body's last line (22px\n // line over the 7px bottom padding): 7 + (22 - 14) / 2. At 8 it\n // sat visibly low beside a one-line message.\n bottom: 11,\n },\n metaOverlay: {\n position: 'absolute',\n right: 6,\n bottom: 6,\n paddingHorizontal: 8,\n paddingVertical: 3,\n borderRadius: 999,\n backgroundColor: 'rgba(0,0,0,0.42)',\n },\n metaBlock: {\n justifyContent: 'flex-end',\n paddingHorizontal: 12,\n paddingBottom: 6,\n marginTop: -2,\n },\n metaBlockAfterFiles: {\n marginTop: 6,\n },\n metaJumbo: {\n paddingTop: 2,\n },\n meta: {\n fontSize: 11,\n fontVariant: ['tabular-nums'],\n includeFontPadding: false,\n },\n editedTag: {\n fontSize: 10,\n fontStyle: 'italic',\n letterSpacing: 0.1,\n },\n readTick: {\n marginLeft: 1,\n marginTop: 1,\n },\n actionsSlot: {\n position: 'absolute',\n top: 4,\n right: 4,\n },\n quoted: {\n borderLeftWidth: 3,\n paddingLeft: 9,\n paddingVertical: 5,\n paddingRight: 8,\n margin: 4,\n marginBottom: 0,\n borderRadius: 10,\n },\n quotedSender: {\n fontSize: 12,\n fontWeight: '700',\n marginBottom: 1,\n },\n quotedBody: {\n fontSize: 12.5,\n opacity: 0.8,\n },\n});\n","import type { Uuid } from '@poolse/sdk';\nimport { useReactions } from '@poolse/react';\nimport { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nconst DEFAULT_EMOJIS = ['👍', '❤️', '😂', '🎉', '🙏', '🔥'];\n\nexport interface ReactionStripProps {\n messageId: Uuid;\n conversationId: Uuid;\n meId: string | null;\n /** Seed map from a known message (e.g. `useMessages`). */\n initialReactions?: Record<string, Uuid[]>;\n}\n\nexport function ReactionStrip({\n messageId,\n conversationId,\n meId,\n initialReactions,\n}: ReactionStripProps) {\n const theme = usePoolseTheme();\n const { reactions, addReaction, removeReaction } = useReactions(messageId, {\n conversationId,\n currentUserId: meId,\n ...(initialReactions ? { initialReactions } : {}),\n });\n const entries = Object.entries(reactions);\n if (entries.length === 0) return null;\n\n return (\n <View style={styles.strip}>\n {entries.map(([emoji, userIds]) => {\n const userArr = Array.isArray(userIds) ? userIds : [];\n const meReacted = meId !== null && userArr.includes(meId);\n return (\n <Pressable\n key={emoji}\n onPress={() => (meReacted ? removeReaction(emoji) : addReaction(emoji))}\n style={[\n styles.chip,\n {\n backgroundColor: meReacted ? theme.colors.brandSoft : theme.colors.surface2,\n borderColor: meReacted ? theme.colors.brand : theme.colors.border,\n borderWidth: meReacted ? 1.5 : 1,\n transform: meReacted ? [{ scale: 1.04 }] : undefined,\n },\n ]}\n >\n <Text style={styles.emoji}>{emoji}</Text>\n <Text\n style={[\n styles.count,\n {\n color: meReacted ? theme.colors.brand : theme.colors.ink2,\n fontWeight: meReacted ? '700' : '600',\n },\n ]}\n >\n {userArr.length}\n </Text>\n </Pressable>\n );\n })}\n </View>\n );\n}\n\nexport interface ReactionPickerProps {\n visible: boolean;\n onClose: () => void;\n onPick: (emoji: string) => void;\n /** Override the default 6-emoji set. */\n emojis?: string[];\n}\n\nexport function ReactionPicker({\n visible,\n onClose,\n onPick,\n emojis = DEFAULT_EMOJIS,\n}: ReactionPickerProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app; the backdrop pads\n // by the insets so the picker centres in the visible area.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable\n style={[styles.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }]}\n onPress={onClose}\n >\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderRadius: theme.radii.lg,\n },\n theme.shadows.lg,\n ]}\n >\n {emojis.map((emoji) => (\n <Pressable\n key={emoji}\n style={styles.emojiBtn}\n onPress={() => {\n onPick(emoji);\n onClose();\n }}\n >\n <Text style={styles.bigEmoji}>{emoji}</Text>\n </Pressable>\n ))}\n </View>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n strip: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: 4,\n marginTop: 2,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 9,\n paddingVertical: 4,\n borderRadius: 14,\n gap: 5,\n minHeight: 26,\n // Subtle elevation so chips lift off the surface\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.06,\n shadowRadius: 2,\n elevation: 1,\n },\n emoji: {\n fontSize: 15,\n lineHeight: 18,\n },\n count: {\n fontSize: 12,\n fontVariant: ['tabular-nums'],\n },\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.4)',\n justifyContent: 'center',\n alignItems: 'center',\n paddingHorizontal: 24,\n },\n sheet: {\n flexDirection: 'row',\n paddingHorizontal: 12,\n paddingVertical: 12,\n gap: 4,\n alignItems: 'center',\n },\n emojiBtn: {\n paddingHorizontal: 8,\n paddingVertical: 6,\n borderRadius: 999,\n alignItems: 'center',\n justifyContent: 'center',\n },\n bigEmoji: {\n fontSize: 32,\n lineHeight: 38,\n },\n});\n","import { Animated, PanResponder, Pressable, StyleSheet, Text, View } from 'react-native';\nimport type { Message, Uuid } from '@poolse/sdk';\nimport { useMemo, useRef, useState } from 'react';\n// Static import — Metro's bundle graph can only trace literal\n// `import` / `require` calls. See ./internal/markdown.ts for the\n// full reasoning. `expo-clipboard` is a required peer dep; consumers\n// who don't want copy can omit the Copy action by not enabling\n// `actions` on <ConversationView>.\nimport * as Clipboard from 'expo-clipboard';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { CallLogRow } from './CallLogRow.js';\nimport { MessageActions } from './MessageActions.js';\nimport { MessageBubble, type BubbleGroupPosition } from './MessageBubble.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { ReactionStrip } from './Reactions.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\nimport { callLogDisplayFor, useReactions, useUser } from '@poolse/react';\n\n// Swipe-to-reply triggers at this much horizontal pull. iOS / WhatsApp\n// use 50–60px; the lower bound feels lighter for one-handed thumb use.\nconst SWIPE_REPLY_THRESHOLD = 50;\n\nexport interface MessageRowProps {\n msg: Message;\n meId: string | null;\n\n // Feature toggles — same set as ConversationView's, but per-row.\n reactions?: boolean;\n attachments?: boolean;\n actions?: boolean;\n /** Pass false in ThreadView since nested threads aren't a thing in v1. */\n threads?: boolean;\n /** WhatsApp-style quote-reply. Defaults true on ConversationView. */\n quotations?: boolean;\n /** Forwarded to `<MessageBubble markdown>`. Defaults true. */\n markdown?: boolean;\n\n readState?: 'sent' | 'read';\n\n /**\n * Whether this row's message is the one currently being edited.\n * Editing happens in the composer (see MessageComposer's\n * `editingMessage` prop); this flag is only used to elevate the\n * row above the dim backdrop ConversationView renders during\n * edit mode.\n */\n isEditing?: boolean;\n /**\n * Long-press → \"Edit\". Omitted entirely (no Edit option in the\n * menu) when the parent has decided this message isn't editable\n * (someone read it, it's deleted, it isn't yours).\n */\n onStartEdit?: () => void;\n onDelete?: () => void;\n onOpenThread?: () => void;\n onQuote?: () => void;\n labelFor?: (externalId: string) => string;\n onQuotedClick?: (quotedMessageId: Uuid) => void;\n groupPosition?: BubbleGroupPosition;\n maxBodyLength?: number;\n /** Show a colored sender label above other-side bubbles. */\n showSenderName?: boolean;\n /** Render an avatar to the LEFT of other-side bubbles. */\n showAvatar?: boolean;\n /** Avatar resolver — same signature as `<MemberList avatarFor>`. */\n avatarFor?: (externalId: string) => string | null;\n /** Call-log rows: offer \"Call back\" (see `<CallLogRow onCallBack>`). */\n onCallBack?: (media: 'audio' | 'video') => void;\n}\n\nexport function MessageRow(props: MessageRowProps) {\n // Call-log system messages render as a centered compact line with\n // no bubble / swipe / long-press / reactions. `undefined` = not a\n // call log; `null` = a call log hidden for this viewer (someone\n // else's missed-call marker). Split into its own component so the\n // bubble row's hooks never run conditionally.\n const callLog = callLogDisplayFor(props.msg, props.meId);\n if (callLog !== undefined) {\n return callLog ? (\n <CallLogRow\n msg={props.msg}\n meId={props.meId}\n {...(props.onCallBack ? { onCallBack: props.onCallBack } : {})}\n />\n ) : null;\n }\n return <BubbleMessageRow {...props} />;\n}\n\nfunction BubbleMessageRow({\n msg,\n meId,\n reactions = true,\n attachments = true,\n actions = true,\n threads = true,\n quotations = true,\n markdown = true,\n readState,\n isEditing = false,\n onStartEdit,\n onDelete,\n onOpenThread,\n onQuote,\n labelFor,\n onQuotedClick,\n groupPosition = 'standalone',\n maxBodyLength = 0,\n showSenderName = false,\n showAvatar = false,\n avatarFor,\n}: MessageRowProps) {\n const theme = usePoolseTheme();\n const isSelf = meId !== null && msg.sender_id === meId;\n const [actionsOpen, setActionsOpen] = useState(false);\n\n // Per-row useReactions subscription so the long-press → React picker\n // and the inline ReactionStrip share the same realtime state. Adds\n // one realtime listener per visible row, which is fine — they're\n // server-filtered by messageId and the FlatList only mounts rows in\n // view. Initial seed comes from msg.reactions so the strip renders\n // immediately without waiting for the first echo.\n const reactionsApi = useReactions(msg.id, {\n conversationId: msg.conversation_id,\n currentUserId: meId,\n ...(msg.reactions ? { initialReactions: msg.reactions } : {}),\n });\n\n // Swipe-to-reply state. The bubble's translateX is driven by a pan\n // gesture; when the user releases past SWIPE_REPLY_THRESHOLD we fire\n // onQuote (which the parent wires to setReplyingTo on the composer).\n // Animation runs on the JS thread because we need to read the value\n // synchronously on release — native driver would prevent that.\n const translateX = useRef(new Animated.Value(0)).current;\n const swipeEnabled = quotations && !!onQuote && !isEditing;\n\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n // Tap / long-press still go to the inner Pressable.\n onStartShouldSetPanResponder: () => false,\n onStartShouldSetPanResponderCapture: () => false,\n // Capture-phase claim: we intercept the gesture BEFORE the\n // child Pressable as soon as the move shows clear horizontal\n // intent. Without capture-phase, the Pressable's touch handling\n // wins first and the pan never starts (this is why self-bubble\n // left swipes felt totally dead — the Pressable was attached\n // to a touch that started with the user's finger over the\n // bubble center, and we never got a turn).\n onMoveShouldSetPanResponder: () => false,\n onMoveShouldSetPanResponderCapture: (_, g) => {\n if (!swipeEnabled) return false;\n // 4px is plenty to disambiguate from an accidental jitter\n // during a tap. `dx > dy` (not `dx > dy * 2`) so a slightly\n // diagonal pull still counts as horizontal — the user isn't\n // going to hold their finger to a perfect axis.\n return Math.abs(g.dx) > 4 && Math.abs(g.dx) > Math.abs(g.dy);\n },\n // Don't surrender the gesture mid-swipe (e.g. parent FlatList\n // asking for it back) — once we're translating the bubble we\n // hold on until release.\n onPanResponderTerminationRequest: () => false,\n // 1:1 finger-follow up to the threshold, then square-root\n // damping past it so the bubble never slides off-screen.\n // Matches iMessage / WhatsApp — feels weightless during the\n // committed range and stiffens once you've already triggered.\n onPanResponderMove: (_, g) => {\n const dx = isSelf ? Math.min(0, g.dx) : Math.max(0, g.dx);\n const abs = Math.abs(dx);\n let translated: number;\n if (abs <= SWIPE_REPLY_THRESHOLD) {\n translated = dx;\n } else {\n const excess = abs - SWIPE_REPLY_THRESHOLD;\n const dampened = SWIPE_REPLY_THRESHOLD + Math.sqrt(excess * 6);\n translated = dx < 0 ? -dampened : dampened;\n }\n translateX.setValue(translated);\n },\n onPanResponderRelease: (_, g) => {\n const past = Math.abs(g.dx) >= SWIPE_REPLY_THRESHOLD;\n if (past && onQuote) onQuote();\n Animated.spring(translateX, {\n toValue: 0,\n useNativeDriver: false,\n speed: 28,\n bounciness: 4,\n }).start();\n },\n onPanResponderTerminate: () => {\n Animated.spring(translateX, {\n toValue: 0,\n useNativeDriver: false,\n speed: 28,\n bounciness: 4,\n }).start();\n },\n }),\n [swipeEnabled, isSelf, onQuote, translateX],\n );\n\n // Reply icon fades + scales in as the bubble drags past ~half the\n // threshold. Sits on the SAME side the swipe is coming FROM (so\n // it's revealed behind the bubble as the bubble slides away).\n const replyIconOpacity = translateX.interpolate({\n inputRange: isSelf\n ? [-SWIPE_REPLY_THRESHOLD, -SWIPE_REPLY_THRESHOLD / 2, 0]\n : [0, SWIPE_REPLY_THRESHOLD / 2, SWIPE_REPLY_THRESHOLD],\n outputRange: isSelf ? [1, 0.3, 0] : [0, 0.3, 1],\n extrapolate: 'clamp',\n });\n const replyIconScale = translateX.interpolate({\n inputRange: isSelf ? [-SWIPE_REPLY_THRESHOLD, 0] : [0, SWIPE_REPLY_THRESHOLD],\n outputRange: isSelf ? [1, 0.5] : [0.5, 1],\n extrapolate: 'clamp',\n });\n\n const showAvatarSlot = showAvatar && !isSelf;\n const showAvatarRender =\n showAvatarSlot && (groupPosition === 'last' || groupPosition === 'standalone');\n // Resolve avatar / label with the same priority as MessageBubble /\n // ChatHeader: explicit prop > SDK userResolver > externalId fallback.\n // Without the useUser fallback, omitting `avatarFor` / `labelFor` on\n // <ConversationView> bypassed the resolver at the row level even\n // when `PoolseConfig.userResolver` was configured.\n const rowSender = useUser(showAvatarSlot ? msg.sender_external_id : null);\n const avatarUrl = msg.sender_external_id\n ? (avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null)\n : null;\n const senderLabel = msg.sender_external_id\n ? (labelFor?.(msg.sender_external_id) ??\n rowSender.profile?.displayName ??\n msg.sender_external_id)\n : null;\n\n return (\n <View\n style={[\n styles.row,\n { alignSelf: isSelf ? 'flex-end' : 'flex-start' },\n // Lift this row above the dim backdrop the parent renders\n // during edit mode. zIndex covers iOS / web; elevation does\n // the equivalent on Android.\n isEditing ? styles.rowEditing : null,\n ]}\n >\n {showAvatarSlot ? (\n <View style={styles.avatarSlot}>\n {showAvatarRender ? (\n <Avatar\n src={avatarUrl ?? null}\n name={senderLabel}\n seed={msg.sender_external_id ?? null}\n size=\"sm\"\n />\n ) : null}\n </View>\n ) : null}\n\n <View style={styles.bubbleCol}>\n {swipeEnabled ? (\n <Animated.View\n pointerEvents=\"none\"\n style={[\n styles.replyHint,\n isSelf ? styles.replyHintRight : styles.replyHintLeft,\n {\n opacity: replyIconOpacity,\n transform: [{ scale: replyIconScale }],\n backgroundColor: theme.colors.surface2,\n },\n ]}\n >\n <PoolseIcon name=\"reply\" size={16} color={theme.colors.brand} />\n </Animated.View>\n ) : null}\n\n <Animated.View\n {...(swipeEnabled ? panResponder.panHandlers : {})}\n style={{ transform: [{ translateX }] }}\n >\n <Pressable\n onLongPress={() => {\n if (!actions) return;\n setActionsOpen(true);\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Message actions\"\n >\n <MessageBubble\n message={msg}\n currentUserId={meId}\n {...(readState ? { readState } : {})}\n {...(labelFor ? { labelFor } : {})}\n {...(onQuotedClick ? { onQuotedClick } : {})}\n groupPosition={groupPosition}\n maxBodyLength={maxBodyLength}\n showSenderName={showSenderName}\n showAttachments={attachments}\n markdown={markdown}\n // No actionsTrigger: the always-visible chevron stamped\n // into the bubble corner fought the bubble shape and\n // duplicated affordances a phone already has — long-press\n // opens the same sheet, swipe quotes. Touch conventions,\n // not desktop ones.\n //\n // The long-press is ALSO threaded into the bubble so the\n // image tiles — Pressables of their own, which win the\n // gesture — still open the sheet on an image-only message.\n onLongPress={() => {\n if (actions) setActionsOpen(true);\n }}\n />\n </Pressable>\n </Animated.View>\n\n {threads && (msg.reply_count ?? 0) > 0 && onOpenThread ? (\n <Pressable onPress={onOpenThread} style={styles.threadPill}>\n <Text style={[styles.threadPillText, { color: theme.colors.brand }]}>\n 💬 {msg.reply_count} {msg.reply_count === 1 ? 'reply' : 'replies'}\n </Text>\n </Pressable>\n ) : null}\n\n {reactions ? (\n <View style={[styles.reactionsRow, { alignSelf: isSelf ? 'flex-end' : 'flex-start' }]}>\n <ReactionStrip\n messageId={msg.id}\n conversationId={msg.conversation_id}\n meId={meId}\n {...(msg.reactions ? { initialReactions: msg.reactions } : {})}\n />\n </View>\n ) : null}\n </View>\n\n {actions && actionsOpen ? (\n <MessageActions\n visible={actionsOpen}\n onClose={() => setActionsOpen(false)}\n isSelf={isSelf}\n {...(reactions\n ? {\n // Inline quick-react row at the top of the sheet —\n // one tap = react + close, no second modal needed.\n onPickReaction: (emoji: string) => {\n void reactionsApi.addReaction(emoji);\n },\n }\n : {})}\n {...(msg.body && !msg.deleted_at\n ? {\n onCopy: () => {\n setActionsOpen(false);\n void Clipboard.setStringAsync(msg.body ?? '');\n },\n }\n : {})}\n {...(onStartEdit\n ? {\n onEdit: () => {\n setActionsOpen(false);\n onStartEdit();\n },\n }\n : {})}\n {...(onDelete\n ? {\n onDelete: () => {\n setActionsOpen(false);\n onDelete();\n },\n }\n : {})}\n {...(onOpenThread\n ? {\n onReplyInThread: () => {\n setActionsOpen(false);\n onOpenThread();\n },\n }\n : {})}\n {...(quotations && onQuote\n ? {\n onQuote: () => {\n setActionsOpen(false);\n onQuote();\n },\n }\n : {})}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n // Tighter vertical rhythm — was 2px each side (4px between rows)\n // plus the bubble's 4px marginBottom = 8px. Now 1+1+2 = 4px,\n // closer to iMessage / WhatsApp density.\n marginVertical: 1,\n // 10px on each side — tight enough to use the available width\n // for content, loose enough to keep bubbles off the screen edge\n // on every device.\n paddingHorizontal: 10,\n maxWidth: '95%',\n },\n rowEditing: {\n // Above ConversationView's editBackdrop (zIndex 5). Elevation\n // does the equivalent stacking on Android.\n zIndex: 10,\n elevation: 10,\n },\n avatarSlot: {\n width: 36,\n marginRight: 6,\n },\n bubbleCol: {\n flexShrink: 1,\n position: 'relative',\n },\n replyHint: {\n position: 'absolute',\n top: '50%',\n marginTop: -16,\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: -1,\n },\n replyHintLeft: {\n left: -44,\n },\n replyHintRight: {\n right: -44,\n },\n threadPill: {\n alignSelf: 'flex-start',\n marginTop: 2,\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n threadPillText: {\n fontSize: 11,\n fontWeight: '600',\n },\n reactionsRow: {\n marginTop: 2,\n },\n});\n","import type { Message, Uuid } from '@poolse/sdk';\nimport { useMe, useThread } from '@poolse/react';\nimport { useCallback, useMemo, useState, type ReactElement } from 'react';\nimport {\n Animated,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { AttachmentPicker } from './AttachmentPicker.js';\nimport { MessageComposer } from './MessageComposer.js';\nimport { MessageList } from './MessageList.js';\nimport { MessageRow } from './MessageRow.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { UploadProvider } from './internal/uploadContext.js';\nimport { useDismissableSheet } from './internal/useDismissableSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ThreadViewProps {\n visible: boolean;\n onClose: () => void;\n conversationId: Uuid;\n rootMessage: Message;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}\n\n// Sheet covers the bottom 88% of the screen. The remaining 12% is the\n// pull-down gutter (also the KeyboardAvoidingView's vertical offset).\nconst SHEET_HEIGHT_FRACTION = 0.88;\n\n/**\n * Bottom-sheet modal for thread replies. Pull the drag handle / header\n * down to dismiss; tap the backdrop or close button too. The composer\n * inside the sheet supports attachments (paperclip → picker, shared\n * upload queue) and the reply rows support reactions, swipe-to-reply,\n * long-press actions, edit, delete — same surface as ConversationView.\n *\n * Keyboard handling: the modal is translucent (edge-to-edge) on both\n * platforms, so nothing resizes it for the keyboard — Android's\n * `adjustResize` doesn't reach an edge-to-edge window. The composer\n * needs its own `padding` KeyboardAvoidingView with\n * `keyboardVerticalOffset` = the distance from the screen top to the\n * sheet top (the gutter), since KAV measures its frame relative to\n * its parent (the sheet), not the screen.\n */\nexport function ThreadView({\n visible,\n onClose,\n conversationId,\n rootMessage,\n labelFor,\n avatarFor,\n}: ThreadViewProps) {\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the modal covers\n // the whole screen and the keyboard overlap is the same maths as\n // on iOS. The composer pads itself for the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* Each open of the thread gets its own UploadProvider so the\n composer's queue is isolated from the parent ConversationView's\n composer queue. */}\n <UploadProvider>\n <ThreadSheet\n onClose={onClose}\n conversationId={conversationId}\n rootMessage={rootMessage}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n </UploadProvider>\n </Modal>\n );\n}\n\nfunction ThreadSheet({\n onClose,\n conversationId,\n rootMessage,\n labelFor,\n avatarFor,\n}: {\n onClose: () => void;\n conversationId: Uuid;\n rootMessage: Message;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}) {\n const theme = usePoolseTheme();\n const { me } = useMe();\n const meId = me?.id ?? null;\n const {\n replies,\n sendReply,\n edit,\n delete: deleteReply,\n loadMore,\n hasMore,\n } = useThread(conversationId, rootMessage.id);\n const insets = useSafeInsets();\n const { height: windowHeight } = useWindowDimensions();\n // Measured modal height — on some Android builds the window\n // dimensions exclude the nav bar while the translucent modal draws\n // under it, which would skew the keyboard offset by that much.\n const [rootHeight, setRootHeight] = useState(0);\n const screenHeight = rootHeight || windowHeight;\n // Never let the sheet's header slide under the status bar.\n const sheetHeight = Math.min(\n Math.round(screenHeight * SHEET_HEIGHT_FRACTION),\n screenHeight - insets.top - 8,\n );\n const gutter = screenHeight - sheetHeight;\n const { translateY, panHandlers } = useDismissableSheet({ onClose, sheetHeight });\n\n const [pickerOpen, setPickerOpen] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n\n const renderReply = useCallback(\n (msg: Message): ReactElement => {\n const isSelf = meId !== null && msg.sender_id === meId;\n const canEdit = isSelf && !msg.deleted_at;\n return (\n <MessageRow\n msg={msg}\n meId={meId}\n // Reactions + actions on by default; nested threads off (you\n // can't thread inside a thread in v1).\n reactions\n attachments\n actions\n threads={false}\n // Quote-to-reply doesn't make sense inside a single-root thread.\n quotations={false}\n isEditing={editingId === msg.id}\n {...(canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {})}\n onDelete={() => {\n void deleteReply(msg.id);\n }}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n );\n },\n [meId, editingId, deleteReply, labelFor, avatarFor],\n );\n\n const editingMessage = useMemo(\n () => (editingId ? (replies.find((m) => m.id === editingId) ?? null) : null),\n [editingId, replies],\n );\n\n const rootRow = useMemo(\n () => (\n <MessageRow\n msg={rootMessage}\n meId={meId}\n reactions\n attachments\n actions={false}\n threads={false}\n quotations={false}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n ),\n [rootMessage, meId, labelFor, avatarFor],\n );\n\n return (\n <View\n style={styles.modalRoot}\n onLayout={(e) => setRootHeight(Math.round(e.nativeEvent.layout.height))}\n >\n <Pressable style={styles.backdrop} onPress={onClose} accessibilityLabel=\"Close thread\" />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n height: sheetHeight,\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* Wrap the header + drag pill in the pan handler so users can\n pull from a comfortable 60-pt-tall strip — the bare 16-pt\n pill on its own was nearly invisible to fingers. */}\n <View {...panHandlers}>\n <View style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={[styles.header, { borderBottomColor: theme.colors.border }]}>\n <Pressable\n onPress={onClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close thread\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n Thread\n </Text>\n </View>\n </View>\n\n {/* KAV scope: just the scrolling area + composer. `padding` on\n both platforms: the modal is full-screen and never resized,\n so the overlap is exactly the keyboard's height over the\n sheet bottom. The composer drops its nav-bar inset while the\n keyboard is up, so there's no gap above the keyboard. */}\n <KeyboardAvoidingView\n style={styles.kavBody}\n behavior=\"padding\"\n keyboardVerticalOffset={gutter}\n >\n <View style={[styles.rootPreview, { backgroundColor: theme.colors.surface2 }]}>\n {rootRow}\n </View>\n\n <View style={styles.listWrap}>\n <MessageList\n messages={replies}\n hasMore={hasMore}\n onLoadMore={loadMore}\n renderItem={renderReply}\n />\n </View>\n\n <MessageComposer\n onSend={async (body, opts) => {\n await sendReply({ body, ...opts });\n }}\n placeholder=\"Reply to thread…\"\n attachments\n onAttachPress={() => setPickerOpen(true)}\n editingMessage={editingMessage}\n onCancelEdit={() => setEditingId(null)}\n onSaveEdit={async (body) => {\n if (!editingId) return;\n await edit(editingId, body);\n setEditingId(null);\n }}\n />\n </KeyboardAvoidingView>\n\n <AttachmentPicker visible={pickerOpen} onClose={() => setPickerOpen(false)} />\n </Animated.View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n overflow: 'hidden',\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 6,\n paddingBottom: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n fontSize: 16,\n fontWeight: '600',\n },\n rootPreview: {\n paddingVertical: 8,\n paddingHorizontal: 8,\n },\n kavBody: {\n flex: 1,\n },\n listWrap: {\n flex: 1,\n },\n});\n","import { Text } from 'react-native';\nimport { useUser } from '@poolse/react';\n\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface UserNameProps {\n /** The user's external_id. Pass null to render the fallback. */\n externalId: string | null | undefined;\n /** Optional fallback when the resolver returns nothing. Defaults to the externalId itself. */\n fallback?: string;\n /** Caller-supplied label override; if it returns a string, it wins. */\n labelFor?: (externalId: string) => string;\n}\n\n/**\n * Display name for a user, looked up via the SDK's `userResolver`\n * with caller-overridable + fallback fallbacks. Renders a `<Text>`.\n */\nexport function UserName({ externalId, fallback, labelFor }: UserNameProps) {\n const theme = usePoolseTheme();\n const name = useDisplayName(externalId, labelFor) ?? fallback ?? externalId ?? '';\n return <Text style={{ color: theme.colors.ink, fontFamily: theme.type.fontBody }}>{name}</Text>;\n}\n\n/**\n * Resolves a user's display name via the 3-tier chain:\n * 1. `labelFor(externalId)` — caller-supplied override\n * 2. SDK `userResolver` (memoized via `useUser`)\n * 3. The externalId itself (so something always renders)\n */\nexport function useDisplayName(\n externalId: string | null | undefined,\n labelFor?: (externalId: string) => string,\n): string {\n const resolved = useUser(externalId ?? null);\n if (!externalId) return '';\n if (labelFor) {\n const override = labelFor(externalId);\n if (override) return override;\n }\n return resolved.profile?.displayName ?? externalId;\n}\n","import { useEffect, useRef } from 'react';\nimport { Animated, StyleSheet, Text, View, Easing } from 'react-native';\n\nimport { useDisplayName } from './UserName.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface TypingIndicatorProps {\n /** Set of `external_id`s currently typing — what `useTyping` returns. */\n typing: Set<string>;\n /**\n * Resolves an `external_id` to a display label. Defaults to the\n * SDK's `userResolver` (and falls back to the external_id itself\n * when the resolver isn't configured).\n */\n labelFor?: (externalId: string) => string;\n}\n\n/**\n * Three animated dots + an inline \"X is typing\" label. Renders a\n * zero-height row when nobody is typing so the list doesn't jump.\n */\nexport function TypingIndicator({ typing, labelFor }: TypingIndicatorProps) {\n const ids = Array.from(typing);\n const isTyping = ids.length > 0;\n\n if (!isTyping) return <View style={{ height: 0 }} />;\n\n return (\n <View style={styles.row}>\n <TypingDots />\n <TypingLabel ids={ids} {...(labelFor ? { labelFor } : {})} />\n </View>\n );\n}\n\nfunction TypingDots() {\n const theme = usePoolseTheme();\n const a = useRef(new Animated.Value(0)).current;\n const b = useRef(new Animated.Value(0)).current;\n const c = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n const loop = (val: Animated.Value, delay: number) =>\n Animated.loop(\n Animated.sequence([\n Animated.delay(delay),\n Animated.timing(val, {\n toValue: 1,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(val, {\n toValue: 0,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ]),\n );\n const animations = [loop(a, 0), loop(b, 150), loop(c, 300)];\n animations.forEach((anim) => anim.start());\n return () => animations.forEach((anim) => anim.stop());\n }, [a, b, c]);\n\n const dot = (val: Animated.Value) => ({\n width: 6,\n height: 6,\n borderRadius: 3,\n backgroundColor: theme.colors.ink3,\n marginHorizontal: 2,\n transform: [\n {\n translateY: val.interpolate({ inputRange: [0, 1], outputRange: [0, -3] }),\n },\n ],\n opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] }),\n });\n\n return (\n <View style={styles.dotsWrap}>\n <Animated.View style={dot(a)} />\n <Animated.View style={dot(b)} />\n <Animated.View style={dot(c)} />\n </View>\n );\n}\n\nfunction TypingLabel({\n ids,\n labelFor,\n}: {\n ids: string[];\n labelFor?: (externalId: string) => string;\n}) {\n const theme = usePoolseTheme();\n const id1 = ids[0] ?? null;\n const id2 = ids[1] ?? null;\n const name1 = useDisplayName(id1, labelFor);\n const name2 = useDisplayName(id2, labelFor);\n\n const text =\n ids.length === 1\n ? `${name1} is typing`\n : ids.length === 2\n ? `${name1} and ${name2} are typing`\n : `${ids.length} people are typing`;\n\n return (\n <Text style={[styles.label, { color: theme.colors.ink2, fontFamily: theme.type.fontBody }]}>\n {text}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n dotsWrap: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n marginRight: 8,\n height: 12,\n },\n label: {\n fontSize: 12,\n },\n});\n","import type { LiveCall, Message, Uuid } from '@poolse/sdk';\nimport {\n canEditOwnMessage,\n computeGroupPosition,\n formatDayLabel,\n isMessageVisibleTo,\n receiptsOf,\n sameDay,\n useMe,\n useMembers,\n useMessageStreams,\n useMessages,\n useRealtimeStatus,\n useLiveCall,\n useTyping,\n type MessageStream,\n} from '@poolse/react';\nimport { useCallback, useEffect, useMemo, useRef, useState, type ReactElement } from 'react';\nimport {\n AppState,\n KeyboardAvoidingView,\n Platform,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { AttachmentPicker } from './AttachmentPicker.js';\nimport { ChatHeader } from './ChatHeader.js';\nimport { DaySeparator } from './DaySeparator.js';\nimport { LiveCallBanner } from './LiveCallBanner.js';\nimport { MentionInput } from './MentionInput.js';\nimport { MessageComposer } from './MessageComposer.js';\nimport { MessageList, type MessageListItem } from './MessageList.js';\nimport { MessageRow } from './MessageRow.js';\nimport { ThreadView } from './ThreadView.js';\nimport { TypingIndicator } from './TypingIndicator.js';\nimport { UploadProvider } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n// Two messages from the same sender within this window collapse\n// into a visual cluster (tight margin, grouped bubble corners).\n// Matches the react-ui default.\nconst GROUPING_WINDOW_MS = 5 * 60 * 1000;\n\nexport interface ConversationViewProps {\n conversationId: Uuid;\n emptyState?: ReactElement | string;\n /**\n * Custom row renderer. Return `null` / `undefined` to fall back to\n * the default row for that message (so you can override just the\n * message kinds you care about).\n */\n renderMessage?: (msg: Message, currentUserId: string | null) => ReactElement | null | undefined;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n\n /**\n * Renders the default `<ChatHeader>` at the top of the chat surface.\n * * `true` (default) — auto chat header (other user / group name).\n * * `false` — no header (you supply your own above).\n * * `ReactElement` — custom header node, rendered as-is.\n */\n header?: boolean | ReactElement;\n /** Tap on the header's members icon — typically opens a sheet. */\n onHeaderMembersPress?: () => void;\n /** Tap on the header itself — typically opens a conversation profile. */\n onHeaderPress?: () => void;\n\n // Feature toggles — all default ON, identical names + defaults to web.\n reactions?: boolean;\n mentions?: boolean;\n attachments?: boolean;\n actions?: boolean;\n threads?: boolean;\n quotations?: boolean;\n readReceipts?: boolean;\n /** Render message bodies as Markdown (links, bold, code). Defaults true. */\n markdown?: boolean;\n maxBodyLength?: number;\n\n /** Show sender labels in group chats. `auto` (default), `always`, `never`. */\n senderLabels?: 'auto' | 'always' | 'never';\n /** Show avatars to the left of other-side bubbles in group chats. Same semantics. */\n avatars?: 'auto' | 'always' | 'never';\n\n /**\n * Fires when auto-mark-read commits a new server-side read cursor.\n * Receives the conversation id + the message id that was marked\n * as the last-read. Wire this to `useConversations().markConversationRead(convId, msgId)`\n * so the sidebar / list view's unread badge clears immediately\n * instead of waiting for the next conversations refetch.\n */\n onMarkedRead?: (conversationId: string, messageId: string) => void;\n /**\n * Fires after every successful message send. Wire to the parent's\n * `useConversations().refetch()` so the conversation list shows\n * the fresh `last_message_preview` / `last_message_at` for the\n * conversation you just sent into. `useConversations` creates\n * isolated state per call site, so ConversationView can't refresh\n * a parent hook's state on its own.\n */\n onSent?: (conversationId: string) => void;\n /**\n * keyboardVerticalOffset passed to the internal KeyboardAvoidingView.\n * On iOS this MUST equal the distance from the screen top to the\n * KAV's top (status bar + safe-area-top + any nav header above\n * the chat). `<PoolseInbox>` computes this for you. Standalone\n * consumers pass it manually.\n */\n keyboardOffset?: number;\n /**\n * Offer \"Call back\" on call-log rows the viewer missed or declined,\n * or placed with no answer. Receives the call's media; place the call\n * on this conversation.\n */\n onCallBack?: (media: 'audio' | 'video') => void;\n /**\n * Show a \"Call in progress · Join\" banner while a call runs on this\n * conversation that the viewer is not on. Called with the live call\n * when they tap Join.\n */\n onJoinCall?: (call: LiveCall) => void;\n /**\n * The call this device is already on, if any — its banner is hidden\n * (the viewer is in the room, or ringing out as its caller).\n */\n currentCallId?: string | null;\n}\n\nexport function ConversationView({\n conversationId,\n emptyState,\n renderMessage,\n labelFor,\n avatarFor,\n header = true,\n onHeaderMembersPress,\n onHeaderPress,\n reactions = true,\n mentions = true,\n attachments = true,\n actions = true,\n threads = true,\n quotations = true,\n readReceipts = true,\n markdown = true,\n maxBodyLength = 200,\n senderLabels = 'auto',\n avatars = 'auto',\n onMarkedRead,\n onSent,\n keyboardOffset = 0,\n onCallBack,\n onJoinCall,\n currentCallId = null,\n}: ConversationViewProps) {\n const theme = usePoolseTheme();\n const { me } = useMe();\n const meId = me?.id ?? null;\n // The workspace's read-receipt setting, for this user: hidden means no\n // check marks anywhere (the server withholds others' read state too).\n // Marking messages read is unaffected — it drives the user's own\n // unread counts.\n const receiptsVisible = receiptsOf(me).visible;\n const showReadState = readReceipts && receiptsVisible;\n\n const {\n messages,\n loading,\n hasMore,\n loadMore,\n send,\n edit,\n delete: deleteMsg,\n markReadUpTo,\n refetch,\n } = useMessages(conversationId);\n const { typing: typingPeople, signalTyping } = useTyping(conversationId);\n // AI agent replies being written. Before the first words arrive the\n // agent shows as typing; then its reply streams into a bubble.\n const streams = useMessageStreams(conversationId);\n const typing = useMemo(() => {\n const thinking = streams.filter((s) => s.status === 'streaming' && !s.text);\n if (thinking.length === 0) return typingPeople;\n const next = new Set(typingPeople);\n for (const s of thinking) if (s.sender_external_id) next.add(s.sender_external_id);\n return next;\n }, [typingPeople, streams]);\n const visibleStreams = streams.filter((s) => s.text || s.status === 'failed');\n const realtimeStatus = useRealtimeStatus();\n\n // Pull the latest page when the app foregrounds or the socket\n // reconnects. While the socket is down (background, network drop)\n // we miss `message:new` pushes; without this the chat shows stale\n // data until the user navigates away and back.\n useEffect(() => {\n const sub = AppState.addEventListener('change', (next) => {\n if (next === 'active') void refetch();\n });\n return () => sub.remove();\n }, [refetch]);\n\n const prevStatusRef = useRef(realtimeStatus);\n useEffect(() => {\n const prev = prevStatusRef.current;\n prevStatusRef.current = realtimeStatus;\n if (\n realtimeStatus === 'connected' &&\n (prev === 'reconnecting' || prev === 'closed' || prev === 'connecting')\n ) {\n void refetch();\n }\n }, [realtimeStatus, refetch]);\n\n const wantsMembers = mentions || senderLabels === 'auto' || avatars === 'auto';\n const { members } = useMembers(wantsMembers ? conversationId : '');\n const isGroupChat = members.length > 2;\n const showSenderLabels = senderLabels === 'always' || (senderLabels === 'auto' && isGroupChat);\n const showAvatars = avatars === 'always' || (avatars === 'auto' && isGroupChat);\n\n const [replyingTo, setReplyingTo] = useState<Message | null>(null);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [threadRoot, setThreadRoot] = useState<Message | null>(null);\n const [pickerOpen, setPickerOpen] = useState(false);\n\n // messageId → sequence map for read-receipt comparison. Membership\n // only carries `last_read_message_id` (UUID); to know whether\n // member X read message Y we have to translate the read message's\n // id into its sequence and compare against Y's sequence. UUIDs\n // aren't chronological so we have to do this lookup explicitly.\n const sequenceByMessageId = useMemo(() => {\n const m = new Map<string, number>();\n for (const msg of messages) {\n if (typeof msg.sequence === 'number') m.set(msg.id, msg.sequence);\n }\n return m;\n }, [messages]);\n\n // Auto-mark-read: advance the read cursor whenever a confirmed\n // message lands at the tail. Skip optimistic temp messages\n // (no `sequence` yet — server hasn't seen the id) to avoid\n // 404s when send-then-immediately-mark races the round-trip.\n // Wrapping in try/catch lets us survive any other transient\n // membership-write failures without breaking the chat.\n const lastMarkedRef = useRef<string | null>(null);\n useEffect(() => {\n if (!readReceipts) return;\n if (messages.length === 0) return;\n const latest = messages[messages.length - 1];\n if (!latest || !latest.id) return;\n if (latest.id === lastMarkedRef.current) return;\n // Optimistic temp messages don't have a server-assigned sequence.\n // Marking them would 404 (server hasn't processed the send yet);\n // wait for the realtime confirmation to land, which replaces the\n // temp with a real message carrying a real sequence.\n if (typeof latest.sequence !== 'number' || latest.sequence <= 0) return;\n lastMarkedRef.current = latest.id;\n void markReadUpTo(latest.id).catch(() => {\n // Reset so we retry on the next message arrival.\n lastMarkedRef.current = null;\n });\n onMarkedRead?.(conversationId, latest.id);\n }, [messages, meId, readReceipts, markReadUpTo, onMarkedRead, conversationId]);\n\n // Precompute per-message group position (drives the bubble's\n // corner treatment + inter-cluster spacing). Same logic as\n // react-ui's ConversationView; the helpers live in @poolse/react.\n //\n // Runs over the *rendered* feed: call-log markers addressed to\n // someone else (a `call_missed` for another callee) are dropped\n // first so a hidden row never splits a bubble cluster or spawns an\n // orphan day separator. Call-log rows themselves never group\n // (`sameGroup` treats them as separators).\n const visibleMessages = useMemo(\n () => messages.filter((m) => isMessageVisibleTo(m, meId)),\n [messages, meId],\n );\n const groupPositionById = useMemo(() => {\n const map = new Map<string, ReturnType<typeof computeGroupPosition>>();\n for (let i = 0; i < visibleMessages.length; i++) {\n const msg = visibleMessages[i];\n if (!msg) continue;\n const prev = i > 0 ? (visibleMessages[i - 1] ?? null) : null;\n const next = i < visibleMessages.length - 1 ? (visibleMessages[i + 1] ?? null) : null;\n map.set(msg.id, computeGroupPosition(msg, prev, next, GROUPING_WINDOW_MS));\n }\n return map;\n }, [visibleMessages]);\n\n const renderItem = useCallback(\n (msg: Message): ReactElement => {\n if (renderMessage) {\n // null / undefined → fall through to the default row.\n const custom = renderMessage(msg, meId);\n if (custom !== null && custom !== undefined) return custom;\n }\n const readState: 'sent' | 'read' | undefined =\n showReadState && meId !== null && msg.sender_id === meId\n ? readStateForMessage(msg, members, meId, sequenceByMessageId)\n : undefined;\n // Edit is only offered for own messages no one else has read\n // yet — once someone has \"seen\" it (their last_read_message_id\n // sequence >= this one) WhatsApp-style apps disable editing to\n // prevent conversation rewriting. `readStateForMessage`\n // returns 'sent' in 1:1 chats with no other member, so own\n // messages in fresh threads stay editable. With read receipts\n // hidden by the workspace it is a 15-minute window instead\n // (canEditOwnMessage).\n const isSelf = meId !== null && msg.sender_id === meId;\n const canEdit = canEditOwnMessage({\n isSelf,\n deleted: !!msg.deleted_at,\n receiptsVisible,\n readState,\n insertedAt: msg.inserted_at,\n });\n const groupPosition = groupPositionById.get(msg.id) ?? 'standalone';\n return (\n <MessageRow\n msg={msg}\n meId={meId}\n reactions={reactions}\n attachments={attachments}\n actions={actions}\n threads={threads}\n quotations={quotations}\n {...(readState ? { readState } : {})}\n isEditing={editingId === msg.id}\n {...(canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {})}\n onDelete={() => deleteMsg(msg.id)}\n {...(threads ? { onOpenThread: () => setThreadRoot(msg) } : {})}\n {...(quotations ? { onQuote: () => setReplyingTo(msg) } : {})}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n showSenderName={showSenderLabels}\n showAvatar={showAvatars}\n maxBodyLength={maxBodyLength}\n groupPosition={groupPosition}\n markdown={markdown}\n {...(onCallBack ? { onCallBack } : {})}\n />\n );\n },\n [\n onCallBack,\n renderMessage,\n meId,\n readReceipts,\n showReadState,\n receiptsVisible,\n members,\n reactions,\n attachments,\n actions,\n threads,\n quotations,\n editingId,\n deleteMsg,\n labelFor,\n avatarFor,\n showSenderLabels,\n showAvatars,\n maxBodyLength,\n sequenceByMessageId,\n groupPositionById,\n markdown,\n ],\n );\n\n const editingMessage = useMemo(\n () => (editingId ? (messages.find((m) => m.id === editingId) ?? null) : null),\n [editingId, messages],\n );\n\n // Build the interleaved item list (messages + day separators).\n // Inject a separator BEFORE a message whenever its day differs\n // from the previous message's day.\n const listItems = useMemo<MessageListItem[]>(() => {\n const out: MessageListItem[] = [];\n let prev: Message | null = null;\n for (const msg of visibleMessages) {\n if (prev === null || !sameDay(msg.inserted_at, prev.inserted_at)) {\n const label = formatDayLabel(msg.inserted_at);\n out.push({\n kind: 'separator',\n id: `sep-${msg.id}`,\n node: <DaySeparator label={label} />,\n });\n }\n out.push({ kind: 'msg', msg });\n prev = msg;\n }\n return out;\n }, [visibleMessages]);\n\n const composerProps = useMemo(\n () => ({\n onSend: async (\n body: string,\n opts?: { quoted_message_id?: Uuid; attachment_ids?: Uuid[]; mentions?: Uuid[] },\n ) => {\n await send({ body, ...opts });\n setReplyingTo(null);\n // Tell the parent so it can refresh ITS useConversations\n // state. useConversations creates isolated state per call\n // site, so a refetch from here wouldn't update PoolseInbox's\n // list — only the parent's own hook instance can.\n onSent?.(conversationId);\n },\n onTyping: signalTyping,\n ...(attachments ? { onAttachPress: () => setPickerOpen(true) } : {}),\n ...(replyingTo ? { replyingTo } : {}),\n onCancelReply: () => setReplyingTo(null),\n ...(labelFor ? { labelFor } : {}),\n attachments,\n keyboardOffset,\n editingMessage,\n onCancelEdit: () => setEditingId(null),\n onSaveEdit: async (body: string) => {\n if (!editingId) return;\n await edit(editingId, body);\n setEditingId(null);\n },\n }),\n [\n send,\n signalTyping,\n attachments,\n replyingTo,\n labelFor,\n keyboardOffset,\n onSent,\n conversationId,\n editingMessage,\n editingId,\n edit,\n ],\n );\n\n const headerNode =\n header === false ? null : header === true ? (\n <ChatHeader\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(onHeaderMembersPress ? { onMembersPress: onHeaderMembersPress } : {})}\n {...(onHeaderPress ? { onPress: onHeaderPress } : {})}\n />\n ) : (\n header\n );\n\n return (\n <UploadProvider>\n <KeyboardAvoidingView\n // iOS uses `padding` (the height behavior is documented as\n // only working on absolute-positioned children and is\n // basically a no-op inside flex:1 chains like ours).\n // Padding mode REQUIRES the right keyboardVerticalOffset —\n // the distance from the screen top to the KAV's top.\n // PoolseInbox computes this from the safe-area top + its own\n // ChatHeader height and passes it through; standalone\n // consumers must pass it themselves.\n //\n // Android uses `height` — works there because the layout\n // recomputes from the Android window resize.\n style={[styles.root, { backgroundColor: theme.colors.paper }]}\n behavior={Platform.OS === 'ios' ? 'padding' : 'height'}\n keyboardVerticalOffset={keyboardOffset}\n >\n {headerNode}\n {onJoinCall ? (\n <JoinBanner\n conversationId={conversationId}\n meId={meId}\n currentCallId={currentCallId}\n onJoin={onJoinCall}\n />\n ) : null}\n <View style={styles.listWrap}>\n <MessageList\n messages={visibleMessages}\n items={listItems}\n meId={meId}\n loading={loading}\n hasMore={hasMore}\n onLoadMore={loadMore}\n renderItem={renderItem}\n ListHeader={\n <View>\n {visibleStreams.map((stream) =>\n stream.status === 'failed' ? (\n <Text\n key={stream.id}\n style={[styles.streamFailed, { color: theme.colors.ink3 }]}\n accessibilityRole=\"alert\"\n >\n {stream.error\n ? `The agent couldn't reply: ${stream.error}`\n : \"The agent couldn't reply.\"}\n </Text>\n ) : (\n <MessageRow\n key={stream.id}\n msg={streamingMessage(stream)}\n meId={meId}\n reactions={false}\n attachments={false}\n actions={false}\n threads={false}\n quotations={false}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n showSenderName={showSenderLabels}\n showAvatar={showAvatars}\n markdown={markdown}\n />\n ),\n )}\n <TypingIndicator typing={typing} {...(labelFor ? { labelFor } : {})} />\n </View>\n }\n {...(emptyState !== undefined ? { emptyState } : {})}\n />\n {/* WhatsApp-style dim while editing: the overlay covers\n the scroll surface but the row being edited renders\n above it (MessageRow elevates itself when isEditing).\n Tap-outside cancels. */}\n {editingId ? (\n <Pressable\n style={styles.editBackdrop}\n onPress={() => setEditingId(null)}\n accessibilityLabel=\"Cancel editing\"\n />\n ) : null}\n </View>\n\n {mentions ? (\n <MentionInput conversationId={conversationId} {...composerProps} />\n ) : (\n <MessageComposer {...composerProps} />\n )}\n\n {attachments ? (\n <AttachmentPicker visible={pickerOpen} onClose={() => setPickerOpen(false)} />\n ) : null}\n\n {threads && threadRoot ? (\n <ThreadView\n visible\n onClose={() => setThreadRoot(null)}\n conversationId={conversationId}\n rootMessage={threadRoot}\n {...(labelFor ? { labelFor } : {})}\n />\n ) : null}\n </KeyboardAvoidingView>\n </UploadProvider>\n );\n}\n\n// Its own component so the live-call subscription exists only for hosts\n// that asked for the banner.\nfunction JoinBanner({\n conversationId,\n meId,\n currentCallId,\n onJoin,\n}: {\n conversationId: string;\n meId: string | null;\n currentCallId: string | null;\n onJoin: (call: LiveCall) => void;\n}) {\n const { call, participantIds } = useLiveCall(conversationId);\n if (!call || call.id === currentCallId) return null;\n // Already in the room on another device: nothing to join.\n if (meId !== null && participantIds.includes(meId)) return null;\n return <LiveCallBanner call={call} inCall={participantIds.length} onJoin={onJoin} />;\n}\n\nfunction readStateForMessage(\n msg: Message,\n members: ReadonlyArray<{ user_id: string; last_read_message_id: string | null }>,\n meId: string,\n sequenceByMessageId: Map<string, number>,\n): 'sent' | 'read' {\n const otherMembers = members.filter((m) => m.user_id !== meId);\n if (otherMembers.length === 0) return 'sent';\n if (typeof msg.sequence !== 'number') return 'sent';\n const mySeq = msg.sequence;\n const anyRead = otherMembers.some((m) => {\n if (!m.last_read_message_id) return false;\n const readSeq = sequenceByMessageId.get(m.last_read_message_id);\n if (readSeq === undefined) return false;\n return readSeq >= mySeq;\n });\n return anyRead ? 'read' : 'sent';\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n streamFailed: {\n fontSize: 12,\n marginHorizontal: 16,\n marginVertical: 4,\n },\n listWrap: {\n flex: 1,\n },\n editBackdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.45)',\n // Sit above message rows by default but below any row that\n // explicitly elevates itself (MessageRow bumps zIndex/elevation\n // when isEditing is true).\n zIndex: 5,\n },\n});\n\n// A streaming agent reply shaped as a Message, so it renders with the\n// same row and bubble as the finished one that replaces it. A caret\n// marks it as still being written.\nfunction streamingMessage(stream: MessageStream): Message {\n const now = new Date().toISOString();\n return {\n id: stream.id,\n tenant_id: '',\n conversation_id: stream.conversation_id,\n sender_id: stream.sender_id,\n sender_external_id: stream.sender_external_id,\n type: 'text',\n body: `${stream.text} ▍`,\n reply_to_id: null,\n thread_root_id: null,\n mentions: [],\n reactions: {},\n edited_at: null,\n deleted_at: null,\n sequence: Number.MAX_SAFE_INTEGER,\n inserted_at: now,\n updated_at: now,\n };\n}\n","import { useMemo, useState } from 'react';\nimport {\n Animated,\n FlatList,\n Image,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n TextInput,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { Avatar } from '../primitives/Avatar.js';\nimport { PoolseIcon } from '../primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './edgeToEdge.js';\nimport { useSafeInsets } from './safeArea.js';\nimport { useDismissableSheet } from './useDismissableSheet.js';\nimport { useKeyboardOpen } from './useKeyboardOpen.js';\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\n\nexport interface InboxUser {\n /** The user's external_id (the same id you mint JWTs with). */\n externalId: string;\n /** Display name shown in the picker row. */\n name: string;\n /** Optional avatar URL — falls back to initials if missing. */\n avatarUrl?: string | null;\n /** Optional secondary line (email, role, handle…). */\n subtitle?: string;\n}\n\nexport interface UserPickerSheetProps {\n visible: boolean;\n onClose: () => void;\n users: InboxUser[];\n /** External_ids to hide (usually the caller's own id). */\n excludeIds?: string[];\n /**\n * `single` → direct-chat mode; tap a row, fires onPickDirect, closes.\n * `group` → multi-select with a group-name input + Create button.\n */\n mode: 'single' | 'group';\n onPickDirect?: (externalId: string) => void;\n onCreateGroup?: (name: string, memberExternalIds: string[]) => void;\n /** Optional header slot — title defaults to \"New chat\" / \"New group\". */\n title?: string;\n /** Search input shown when user count ≥ 8. Override to force on/off. */\n searchable?: boolean;\n}\n\n/**\n * Bottom-sheet picker for selecting one or many users from the\n * tenant's user directory. Used by `<PoolseInbox>` for the\n * built-in \"New chat\" / \"New group\" flows. Exported standalone so\n * devs can drive it from their own UI (e.g. a \"Forward to…\" sheet).\n */\nexport function UserPickerSheet({\n visible,\n onClose,\n users,\n excludeIds,\n mode,\n onPickDirect,\n onCreateGroup,\n title,\n searchable,\n}: UserPickerSheetProps) {\n const theme = usePoolseTheme();\n const [query, setQuery] = useState('');\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n const [groupName, setGroupName] = useState('');\n const insets = useSafeInsets();\n const keyboardOpen = useKeyboardOpen();\n const { height: windowHeight } = useWindowDimensions();\n // Measured modal height — on some Android builds the window\n // dimensions exclude the nav bar while the translucent modal draws\n // under it, which would skew the keyboard offset by that much.\n const [rootHeight, setRootHeight] = useState(0);\n const screenHeight = rootHeight || windowHeight;\n // 85%, but never so tall the header slides under the status bar.\n const sheetHeight = Math.min(Math.round(screenHeight * 0.85), screenHeight - insets.top - 8);\n const { translateY, panHandlers } = useDismissableSheet({\n onClose: () => {\n // Reset selection state on dismiss so it doesn't survive\n // across opens.\n setQuery('');\n setSelectedIds([]);\n setGroupName('');\n onClose();\n },\n sheetHeight,\n });\n\n const excludeSet = useMemo(() => new Set(excludeIds ?? []), [excludeIds]);\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n return users.filter((u) => {\n if (excludeSet.has(u.externalId)) return false;\n if (!q) return true;\n return (\n u.name.toLowerCase().includes(q) ||\n (u.subtitle ?? '').toLowerCase().includes(q) ||\n u.externalId.toLowerCase().includes(q)\n );\n });\n }, [users, query, excludeSet]);\n\n const showSearch = searchable ?? users.length >= 8;\n const isGroup = mode === 'group';\n const heading = title ?? (isGroup ? 'New group' : 'New chat');\n\n const reset = () => {\n setQuery('');\n setSelectedIds([]);\n setGroupName('');\n };\n\n const handleClose = () => {\n reset();\n onClose();\n };\n\n const toggle = (externalId: string) => {\n setSelectedIds((prev) =>\n prev.includes(externalId) ? prev.filter((id) => id !== externalId) : [...prev, externalId],\n );\n };\n\n const canCreate = isGroup && selectedIds.length > 0 && groupName.trim().length > 0;\n\n const handleCreate = () => {\n if (!canCreate) return;\n onCreateGroup?.(groupName.trim(), selectedIds);\n reset();\n onClose();\n };\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={handleClose}\n // Edge-to-edge on Android like the host app, so the inset and\n // keyboard maths below hold on every device.\n {...EDGE_TO_EDGE_MODAL}\n >\n <View\n style={styles.modalRoot}\n onLayout={(e) => setRootHeight(Math.round(e.nativeEvent.layout.height))}\n >\n <Pressable style={styles.backdrop} onPress={handleClose} />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n height: sheetHeight,\n // Last row clears the nav bar — unless the keyboard is\n // covering it, where the inset would just be a gap.\n paddingBottom: keyboardOpen ? 0 : insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* The group-name / search inputs open the keyboard over a\n translucent, never-resized modal. A `padding` KAV (both\n platforms) shrinks the list to end above the keyboard;\n the offset is the gutter above the sheet because KAV\n measures its frame relative to the sheet, not the screen. */}\n <KeyboardAvoidingView\n style={styles.kav}\n behavior=\"padding\"\n keyboardVerticalOffset={screenHeight - sheetHeight}\n >\n <View {...panHandlers} style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={styles.header}>\n <Pressable\n onPress={handleClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close picker\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n numberOfLines={1}\n >\n {heading}\n </Text>\n {isGroup ? (\n <Pressable\n onPress={handleCreate}\n disabled={!canCreate}\n hitSlop={6}\n style={[\n styles.createBtn,\n {\n backgroundColor: canCreate ? theme.colors.brand : theme.colors.surface2,\n opacity: canCreate ? 1 : 0.6,\n },\n ]}\n >\n <Text\n style={{\n color: canCreate ? theme.colors.onBrand : theme.colors.ink3,\n fontWeight: '700',\n fontSize: 13,\n }}\n >\n Create{selectedIds.length > 0 ? ` (${selectedIds.length})` : ''}\n </Text>\n </Pressable>\n ) : null}\n </View>\n\n {isGroup ? (\n <TextInput\n placeholder=\"Group name\"\n placeholderTextColor={theme.colors.ink3}\n value={groupName}\n onChangeText={setGroupName}\n style={[\n styles.groupNameInput,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.md,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n },\n ]}\n />\n ) : null}\n\n {showSearch ? (\n <TextInput\n placeholder=\"Search…\"\n placeholderTextColor={theme.colors.ink3}\n value={query}\n onChangeText={setQuery}\n style={[\n styles.searchInput,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.md,\n fontFamily: theme.type.fontBody,\n fontSize: 14,\n },\n ]}\n />\n ) : null}\n\n <FlatList\n data={filtered}\n keyExtractor={(u) => u.externalId}\n // First tap selects a row even with the keyboard up.\n keyboardShouldPersistTaps=\"handled\"\n ListEmptyComponent={\n <View style={styles.empty}>\n <Text style={[styles.emptyText, { color: theme.colors.ink3 }]}>\n {query ? 'No matches.' : 'No users to show.'}\n </Text>\n </View>\n }\n renderItem={({ item }) => (\n <UserRow\n user={item}\n selected={selectedIds.includes(item.externalId)}\n isGroup={isGroup}\n onPress={() => {\n if (isGroup) toggle(item.externalId);\n else {\n onPickDirect?.(item.externalId);\n reset();\n onClose();\n }\n }}\n />\n )}\n />\n </KeyboardAvoidingView>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nfunction UserRow({\n user,\n selected,\n isGroup,\n onPress,\n}: {\n user: InboxUser;\n selected: boolean;\n isGroup: boolean;\n onPress: () => void;\n}) {\n const theme = usePoolseTheme();\n return (\n <Pressable\n onPress={onPress}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.brandSoft : 'transparent',\n },\n ]}\n >\n {user.avatarUrl ? (\n <Image source={{ uri: user.avatarUrl }} style={styles.avatarImg} />\n ) : (\n <Avatar src={null} name={user.name} seed={user.externalId} size=\"md\" />\n )}\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {user.name}\n </Text>\n {user.subtitle ? (\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {user.subtitle}\n </Text>\n ) : null}\n </View>\n {isGroup ? (\n <View\n style={[\n styles.checkbox,\n {\n borderColor: selected ? theme.colors.brand : theme.colors.border,\n backgroundColor: selected ? theme.colors.brand : 'transparent',\n },\n ]}\n >\n {selected ? <PoolseIcon name=\"check\" size={14} color={theme.colors.onBrand} /> : null}\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n overflow: 'hidden',\n },\n kav: {\n flex: 1,\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 4,\n paddingBottom: 12,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n fontSize: 17,\n fontWeight: '700',\n flex: 1,\n },\n createBtn: {\n paddingHorizontal: 14,\n paddingVertical: 7,\n borderRadius: 999,\n },\n groupNameInput: {\n marginHorizontal: 16,\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 10,\n fontWeight: '600',\n },\n searchInput: {\n marginHorizontal: 16,\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 10,\n gap: 12,\n },\n avatarImg: {\n width: 40,\n height: 40,\n borderRadius: 20,\n },\n body: {\n flex: 1,\n gap: 2,\n },\n name: {\n fontSize: 15,\n fontWeight: '600',\n },\n subtitle: {\n fontSize: 12,\n },\n checkbox: {\n width: 22,\n height: 22,\n borderRadius: 11,\n borderWidth: 1.5,\n alignItems: 'center',\n justifyContent: 'center',\n },\n empty: {\n paddingVertical: 40,\n alignItems: 'center',\n },\n emptyText: {\n fontSize: 13,\n },\n});\n","import type { Conversation, Uuid } from '@poolse/sdk';\nimport { formatCallLogPreview, useConversations, useMe, useUser } from '@poolse/react';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport {\n Animated,\n Easing,\n Image,\n PanResponder,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { ChatHeader } from './ChatHeader.js';\nimport { ConversationList } from './ConversationList.js';\nimport { ConversationView } from './ConversationView.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { Avatar } from './primitives/Avatar.js';\nimport { UserPickerSheet, type InboxUser } from './internal/UserPickerSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport type { InboxUser } from './internal/UserPickerSheet.js';\n\n// Height of the ChatHeader we render above ConversationView in the\n// detail pane. Hardcoded because ChatHeader has fixed vertical\n// padding (10 + 36 content + 10 ≈ 56). If you change ChatHeader's\n// padding, bump this constant.\nconst CHAT_HEADER_HEIGHT = 56;\n\nexport interface PoolseInboxProps {\n /** Header title above the conversation list. Defaults to \"Chats\". */\n title?: string;\n\n /**\n * The tenant's user directory. When provided, the inbox shows\n * \"New chat\" + \"New group\" buttons in the header. Omit if you\n * don't want the built-in picker UI (e.g. you start chats from\n * elsewhere via the imperative `openDirect()` API).\n */\n users?: InboxUser[];\n\n /** Display-name resolver for sender labels / chat header titles. */\n labelFor?: (externalId: string) => string;\n /** Avatar URL resolver. */\n avatarFor?: (externalId: string) => string | null;\n\n /**\n * Right-side slot in the header — typical use is a logout / settings\n * button. Rendered after the New-chat / New-group buttons.\n */\n renderRightAction?: () => ReactNode;\n\n /**\n * Custom row renderer for the conversation list. Receives the\n * conversation + the caller's external_id (resolved via `useMe`)\n * so you can branch on direct-vs-group display.\n */\n renderConversationRow?: (\n conv: Conversation,\n callerExternalId: string | null,\n selected: boolean,\n ) => ReactNode;\n\n /** Custom empty state when the list is empty. */\n emptyState?: ReactNode | string;\n\n /** Forwarded to `<ConversationView>` — set if you have a nav header above. */\n keyboardOffset?: number;\n}\n\nexport interface PoolseInboxHandle {\n /** Open a known conversation (e.g. from a deep link / push tap). */\n open: (conversationId: Uuid) => void;\n /**\n * Open (or create) a direct conversation with the given external_id.\n * The backend dedupes per pair — returns the existing conversation\n * if one already exists. Use this from a \"Message\" button on your\n * user profile screens.\n */\n openDirect: (externalId: string) => Promise<void>;\n /** Open (or create) a group conversation. */\n openGroup: (name: string, memberExternalIds: string[]) => Promise<void>;\n /** Open the built-in \"new chat\" picker programmatically. */\n promptNewChat: () => void;\n /** Open the built-in \"new group\" picker programmatically. */\n promptNewGroup: () => void;\n /** Pop back to the conversation list. */\n close: () => void;\n}\n\n/**\n * Drop-in inbox screen: scrollable list of conversations + chat\n * detail, with an iOS-style slide animation between them. Manages\n * its own navigation stack (no react-navigation needed). Picker\n * sheets for \"New chat\" / \"New group\" appear when `users` is\n * provided; otherwise the dev wires those flows themselves and\n * uses the imperative ref to open conversations.\n *\n * For the \"Message\" button on a user profile screen, hold a ref to\n * the inbox and call `inboxRef.current?.openDirect(externalId)`.\n */\nexport const PoolseInbox = forwardRef<PoolseInboxHandle, PoolseInboxProps>(\n function PoolseInbox(props, ref) {\n const {\n title = 'Chats',\n users,\n labelFor,\n avatarFor,\n renderRightAction,\n renderConversationRow,\n emptyState,\n keyboardOffset = 0,\n } = props;\n\n const theme = usePoolseTheme();\n const { width: screenWidth } = useWindowDimensions();\n const { me } = useMe();\n const {\n conversations,\n create,\n unreadCounts,\n markConversationRead,\n refetch: refetchConversations,\n } = useConversations();\n const meExternalId = me?.external_id ?? null;\n const meId = me?.id ?? null;\n // KAV.frame.y is measured relative to the SafeAreaView's\n // coordinate space (the SafeAreaView already absorbs the\n // safe-area-top inset). So the only chrome we need to compensate\n // for in keyboardVerticalOffset is our own ChatHeader above the\n // KAV. Adding insets.top on top double-counts and pushes the\n // composer way too far above the keyboard.\n const detailKeyboardOffset = CHAT_HEADER_HEIGHT;\n\n const [activeId, setActiveId] = useState<Uuid | null>(null);\n const [userPickerOpen, setUserPickerOpen] = useState(false);\n const [groupPickerOpen, setGroupPickerOpen] = useState(false);\n\n const slide = useRef(new Animated.Value(0)).current;\n // Flipped to true while the user is dragging the detail pane via\n // the edge-swipe gesture so the activeId-driven timing animation\n // doesn't fight the finger.\n const draggingRef = useRef(false);\n useEffect(() => {\n if (draggingRef.current) return;\n Animated.timing(slide, {\n toValue: activeId ? 1 : 0,\n duration: 280,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }, [activeId, slide]);\n\n const listTransform = slide.interpolate({\n inputRange: [0, 1],\n outputRange: [0, -Math.round(screenWidth * 0.25)],\n });\n const detailTransform = slide.interpolate({\n inputRange: [0, 1],\n outputRange: [screenWidth, 0],\n });\n\n // ── Edge-swipe-to-dismiss ────────────────────────────────────────\n // A thin invisible strip pinned to the screen's left edge owns a\n // PanResponder that drags the detail pane back to the right. Only\n // arms when:\n // - the detail pane is currently shown (activeId != null), AND\n // - the gesture starts within EDGE_WIDTH of the left screen edge,\n // AND\n // - the first movement is horizontal-dominant + rightward.\n // Those gates keep the strip from eating bubble swipes, vertical\n // scrolls, or back-button taps in the ChatHeader.\n const EDGE_WIDTH = 24;\n const DISMISS_VX_THRESHOLD = 0.4;\n const activeIdRef = useRef(activeId);\n useEffect(() => {\n activeIdRef.current = activeId;\n }, [activeId]);\n const panResponder = useMemo(() => {\n // Commit-vs-snap threshold scales with the screen so the gesture\n // feels right on phone widths AND tablets.\n const dismissDxThreshold = screenWidth * 0.35;\n return PanResponder.create({\n // Never claim the touch on start — that would swallow taps on\n // the back button in the ChatHeader strip.\n onStartShouldSetPanResponder: () => false,\n onStartShouldSetPanResponderCapture: () => false,\n onMoveShouldSetPanResponder: (_e, gs) => {\n if (!activeIdRef.current) return false;\n if (gs.x0 > EDGE_WIDTH) return false;\n return gs.dx > 6 && Math.abs(gs.dx) > Math.abs(gs.dy);\n },\n onMoveShouldSetPanResponderCapture: (_e, gs) => {\n if (!activeIdRef.current) return false;\n if (gs.x0 > EDGE_WIDTH) return false;\n return gs.dx > 6 && Math.abs(gs.dx) > Math.abs(gs.dy);\n },\n onPanResponderGrant: () => {\n draggingRef.current = true;\n slide.stopAnimation();\n },\n onPanResponderMove: (_e, gs) => {\n // Map finger displacement to slide: dx=0 → slide=1\n // (detail fully on); dx=screenWidth → slide=0 (off).\n const dx = Math.max(0, gs.dx);\n const progress = Math.min(1, dx / screenWidth);\n slide.setValue(1 - progress);\n },\n onPanResponderRelease: (_e, gs) => {\n draggingRef.current = false;\n const past = gs.dx > dismissDxThreshold || gs.vx > DISMISS_VX_THRESHOLD;\n if (past) {\n // Let the activeId-effect drive the close animation from\n // wherever the finger left the pane — Animated.timing\n // starts from the current value, so the motion is\n // continuous.\n setActiveId(null);\n } else {\n Animated.timing(slide, {\n toValue: 1,\n duration: 220,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }\n },\n onPanResponderTerminate: () => {\n // Another responder took over (rare — scroll, dialog).\n // Snap back to \"open\" so the pane doesn't get stuck.\n draggingRef.current = false;\n Animated.timing(slide, {\n toValue: 1,\n duration: 220,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n },\n onPanResponderTerminationRequest: () => false,\n });\n }, [slide, screenWidth]);\n\n const openDirect = useCallback(\n async (externalId: string) => {\n const conv = await create({\n type: 'direct',\n member_external_ids: [externalId],\n });\n setActiveId(conv.id);\n },\n [create],\n );\n\n const openGroup = useCallback(\n async (name: string, memberExternalIds: string[]) => {\n const conv = await create({\n type: 'group',\n name,\n member_external_ids: memberExternalIds,\n });\n setActiveId(conv.id);\n },\n [create],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n open: setActiveId,\n openDirect,\n openGroup,\n promptNewChat: () => setUserPickerOpen(true),\n promptNewGroup: () => setGroupPickerOpen(true),\n close: () => setActiveId(null),\n }),\n [openDirect, openGroup],\n );\n\n const renderRow = useCallback(\n (conv: Conversation, selected: boolean) => {\n if (renderConversationRow) {\n return <>{renderConversationRow(conv, meExternalId, selected)}</>;\n }\n // Live unread count from useConversations — updates immediately\n // when markConversationRead fires, instead of waiting for the\n // next list refetch. Falls back to the server snapshot on the\n // conversation row when the live map doesn't have an entry yet.\n const unread = unreadCounts?.[conv.id] ?? conv.unread_count ?? 0;\n return (\n <DefaultConversationRow\n conv={conv}\n selected={selected}\n meExternalId={meExternalId}\n meId={meId}\n unread={unread}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n onPress={() => setActiveId(conv.id)}\n />\n );\n },\n [renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts],\n );\n\n return (\n <View style={[styles.root, { backgroundColor: theme.colors.paper }]}>\n {/* LIST PANE */}\n <Animated.View\n style={[StyleSheet.absoluteFillObject, { transform: [{ translateX: listTransform }] }]}\n pointerEvents={activeId ? 'none' : 'auto'}\n >\n <View\n style={[\n styles.listHeader,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n <Text\n style={[\n styles.listTitle,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n {title}\n </Text>\n <View style={styles.headerActions}>\n {users ? (\n <>\n <HeaderIconButton\n icon=\"compose\"\n onPress={() => setUserPickerOpen(true)}\n label=\"New chat\"\n />\n <HeaderIconButton\n icon=\"users\"\n onPress={() => setGroupPickerOpen(true)}\n label=\"New group\"\n />\n </>\n ) : null}\n {renderRightAction?.()}\n </View>\n </View>\n\n <ConversationList\n conversations={conversations}\n renderItem={renderRow}\n {...(emptyState !== undefined ? { emptyState } : {})}\n />\n </Animated.View>\n\n {/* DETAIL PANE — our own ChatHeader (with onBack wired) above\n a ConversationView with header={false} so they don't stack.\n PanResponder lives on this wrapper (not a separate overlay\n strip) so taps fall straight through to the back button /\n attachment / send buttons — the strip approach would have\n stolen the leftmost slice of those tap targets. The gate in\n onMoveShouldSetPanResponderCapture restricts gestures to\n the left edge + horizontal-dominant + rightward, so vertical\n scrolling, swipe-to-reply on bubbles (which lives further\n inside), and button taps stay unaffected. */}\n <Animated.View\n style={[StyleSheet.absoluteFillObject, { transform: [{ translateX: detailTransform }] }]}\n pointerEvents={activeId ? 'auto' : 'none'}\n {...panResponder.panHandlers}\n >\n {activeId ? (\n <View style={{ flex: 1 }}>\n <ChatHeader\n conversationId={activeId}\n onBack={() => setActiveId(null)}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n <ConversationView\n key={activeId}\n conversationId={activeId}\n header={false}\n // Caller override wins; else use safe-area-top + our\n // ChatHeader height as the iOS keyboardVerticalOffset.\n keyboardOffset={keyboardOffset || detailKeyboardOffset}\n onMarkedRead={(convId) => {\n // Optimistic local clear so the badge disappears\n // immediately — server-side cursor was advanced\n // by ConversationView's markReadUpTo.\n markConversationRead(convId);\n }}\n onSent={() => {\n // useConversations is per-call-site state — only\n // OUR refetch updates the list's preview / timestamps.\n void refetchConversations();\n }}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n </View>\n ) : null}\n </Animated.View>\n\n {/* Pickers */}\n {users ? (\n <UserPickerSheet\n visible={userPickerOpen}\n onClose={() => setUserPickerOpen(false)}\n users={users}\n excludeIds={meExternalId ? [meExternalId] : []}\n mode=\"single\"\n onPickDirect={(externalId) => {\n void openDirect(externalId);\n }}\n />\n ) : null}\n\n {users ? (\n <UserPickerSheet\n visible={groupPickerOpen}\n onClose={() => setGroupPickerOpen(false)}\n users={users}\n excludeIds={meExternalId ? [meExternalId] : []}\n mode=\"group\"\n onCreateGroup={(name, ids) => {\n void openGroup(name, ids);\n }}\n />\n ) : null}\n </View>\n );\n },\n);\n\nfunction HeaderIconButton({\n icon,\n onPress,\n label,\n}: {\n icon: 'compose' | 'users';\n onPress: () => void;\n label: string;\n}) {\n const theme = usePoolseTheme();\n return (\n <Pressable\n onPress={onPress}\n hitSlop={10}\n accessibilityLabel={label}\n style={({ pressed }) => [\n styles.iconBtn,\n {\n backgroundColor: pressed ? theme.colors.surface2 : 'transparent',\n },\n ]}\n >\n <PoolseIcon name={icon} size={20} color={theme.colors.ink} />\n </Pressable>\n );\n}\n\nfunction DefaultConversationRow({\n conv,\n selected,\n meExternalId,\n meId = null,\n unread,\n labelFor,\n avatarFor,\n onPress,\n}: {\n conv: Conversation;\n selected: boolean;\n meExternalId: string | null;\n meId?: string | null;\n unread: number;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onPress: () => void;\n}) {\n const theme = usePoolseTheme();\n\n // For directs, derive display from the OTHER member's external_id\n // (added to Conversation.member_external_ids by the backend). For\n // groups, use the conversation's own name + a group avatar tile.\n const isDirect = conv.type === 'direct';\n const otherExtId =\n isDirect && meExternalId\n ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId)\n : null;\n\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n // Inbox rows are typically the first place an avatar / name shows up\n // for a conversation, so the resolver must run here too — not only\n // inside ConversationView's bubbles.\n const resolvedOther = useUser(isDirect ? (otherExtId ?? null) : null);\n const title = isDirect\n ? otherExtId\n ? (labelFor?.(otherExtId) ?? resolvedOther.profile?.displayName ?? otherExtId)\n : 'Direct chat'\n : (conv.name ?? 'Untitled group');\n\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? resolvedOther.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conv.id) : conv.id;\n\n return (\n <Pressable\n onPress={onPress}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.surface2 : 'transparent',\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n {avatarUrl ? (\n <Image source={{ uri: avatarUrl }} style={styles.rowAvatar} />\n ) : (\n <Avatar src={null} name={title} seed={avatarSeed} size=\"md\" />\n )}\n <View style={styles.rowBody}>\n <Text\n style={[styles.rowTitle, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n <Text style={[styles.rowSubtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatCallLogPreview(conv.last_message_preview, meId) ??\n conv.last_message_preview ??\n (isDirect ? (otherExtId ?? '') : `${(conv.member_external_ids ?? []).length} members`)}\n </Text>\n </View>\n {unread > 0 ? (\n <View style={[styles.unreadPill, { backgroundColor: theme.colors.unreadPill }]}>\n <Text style={[styles.unreadText, { color: theme.colors.unreadPillText }]}>\n {unread > 99 ? '99+' : String(unread)}\n </Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n overflow: 'hidden',\n },\n listHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n listTitle: {\n flex: 1,\n fontSize: 20,\n fontWeight: '700',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n iconBtn: {\n width: 36,\n height: 36,\n borderRadius: 18,\n alignItems: 'center',\n justifyContent: 'center',\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 12,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n rowAvatar: {\n width: 44,\n height: 44,\n borderRadius: 22,\n },\n rowBody: {\n flex: 1,\n gap: 2,\n },\n rowTitle: {\n fontSize: 15,\n fontWeight: '600',\n },\n rowSubtitle: {\n fontSize: 12,\n },\n unreadPill: {\n minWidth: 22,\n height: 22,\n borderRadius: 11,\n paddingHorizontal: 7,\n alignItems: 'center',\n justifyContent: 'center',\n },\n unreadText: {\n fontSize: 11,\n fontWeight: '700',\n },\n});\n","import { Svg, Path, Circle, G } from 'react-native-svg';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\n\nexport type PoolseLogoVariant = 'lockup' | 'mark' | 'wordmark' | 'mono';\n\nexport interface PoolseLogoProps {\n variant?: PoolseLogoVariant;\n /** Height in pixels — width is computed from the variant's aspect ratio. */\n size?: number;\n /** Mono variant accepts a color override; otherwise the theme drives fills. */\n color?: string;\n label?: string | null;\n}\n\nconst 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';\nconst PULSE_PATH = 'M16 55 H34 L40 55 L47 30 L54 73 L60 55 H72';\nconst WORDMARK_P_PATH =\n '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';\nconst WORDMARK_O_PATH =\n 'M305 -14Q225 -14 163.5 17.0Q102 48 67.0 110.0Q32 172 32 265Q32 358 67.0 419.5Q102 481 164.0 511.5Q226 542 306 542Q386 542 448.0 511.0Q510 480 545.0 418.5Q580 357 580 264Q580 169 544.0 107.0Q508 45 445.5 15.5Q383 -14 305 -14ZM310 103Q346 103 370.0 119.5Q394 136 406.0 170.0Q418 204 418 254Q418 307 405.0 343.5Q392 380 366.5 399.5Q341 419 301 419Q267 419 242.5 402.5Q218 386 206.0 352.0Q194 318 194 267Q194 185 224.5 144.0Q255 103 310 103Z';\nconst WORDMARK_L_PATH = 'M62 0V720H220V0Z';\nconst WORDMARK_S_PATH =\n 'M278 -14Q225 -14 182.0 -4.5Q139 5 107.0 23.0Q75 41 54.5 66.5Q34 92 26 123L146 176Q153 159 170.5 141.5Q188 124 217.5 113.0Q247 102 289 102Q329 102 351.5 113.5Q374 125 374 147Q374 163 361.5 172.5Q349 182 324.0 189.5Q299 197 262 204Q224 212 185.0 222.5Q146 233 112.0 251.5Q78 270 57.5 300.5Q37 331 37 378Q37 427 63.0 463.5Q89 500 140.5 521.0Q192 542 266 542Q332 542 382.0 525.0Q432 508 465.5 476.5Q499 445 512 401L383 355Q378 377 362.5 393.0Q347 409 323.5 417.5Q300 426 268 426Q229 426 207.5 414.0Q186 402 186 382Q186 366 200.5 355.5Q215 345 242.0 338.0Q269 331 306 323Q345 315 383.5 304.5Q422 294 453.5 276.5Q485 259 503.5 230.5Q522 202 522 157Q522 104 494.0 65.5Q466 27 411.5 6.5Q357 -14 278 -14Z';\nconst WORDMARK_E_PATH =\n 'M313 -14Q247 -14 195.0 3.5Q143 21 106.5 55.0Q70 89 51.0 139.0Q32 189 32 254Q32 317 50.5 370.0Q69 423 103.5 461.5Q138 500 188.5 521.0Q239 542 302 542Q366 542 414.5 521.5Q463 501 494.5 461.0Q526 421 541.0 363.5Q556 306 551 232L138 229V313L459 316L402 277Q409 327 396.0 358.5Q383 390 358.0 404.5Q333 419 304 419Q269 419 242.5 400.0Q216 381 201.0 345.0Q186 309 186 257Q186 175 221.5 138.0Q257 101 312 101Q339 101 357.0 108.5Q375 116 386.5 127.5Q398 139 404.5 153.0Q411 167 415 180L555 150Q547 113 529.5 83.0Q512 53 482.5 31.0Q453 9 411.5 -2.5Q370 -14 313 -14Z';\n\nconst VARIANT_VB: Record<\n PoolseLogoVariant,\n { vb: [number, number, number, number]; aspect: number }\n> = {\n lockup: { vb: [0, 0, 454, 100], aspect: 4.54 },\n mark: { vb: [0, 0, 100, 100], aspect: 1 },\n wordmark: { vb: [0, 0, 350, 100], aspect: 3.5 },\n mono: { vb: [0, 0, 454, 100], aspect: 4.54 },\n};\n\nexport function PoolseLogo({ variant = 'lockup', size = 28, color, label }: PoolseLogoProps) {\n const theme = usePoolseTheme();\n const mono = variant === 'mono';\n const monoColor = color ?? theme.colors.ink;\n\n const tileFill = mono ? 'none' : theme.colors.brand;\n const tileStroke = mono ? monoColor : 'transparent';\n const tileStrokeWidth = mono ? 5 : 0;\n const pulseStroke = mono ? monoColor : theme.colors.onBrand;\n const pulseDotFill = mono ? monoColor : theme.colors.onBrand;\n const inkFill = mono ? monoColor : theme.colors.ink;\n const oFill = mono ? monoColor : theme.colors.brand;\n\n const { vb, aspect } = VARIANT_VB[variant];\n const width = size * aspect;\n const showMark = variant === 'lockup' || variant === 'mark' || variant === 'mono';\n const showWordmark = variant === 'lockup' || variant === 'wordmark' || variant === 'mono';\n const wordmarkOffsetX = variant === 'wordmark' ? 0 : 126;\n\n const a11y = label === null ? {} : { accessibilityLabel: label ?? 'poolse' };\n return (\n <Svg viewBox={vb.join(' ')} width={width} height={size} {...a11y}>\n {showMark ? (\n <>\n <Path d={TILE_PATH} fill={tileFill} stroke={tileStroke} strokeWidth={tileStrokeWidth} />\n <Path\n d={PULSE_PATH}\n fill=\"none\"\n stroke={pulseStroke}\n strokeWidth={9}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <Circle cx={72} cy={55} r={6.2} fill={pulseDotFill} />\n </>\n ) : null}\n {showWordmark ? (\n <G transform={`translate(${wordmarkOffsetX},85.0) scale(0.097222 -0.097222)`}>\n <Path d={WORDMARK_P_PATH} fill={inkFill} transform=\"translate(0,0)\" />\n <Path d={WORDMARK_O_PATH} fill={oFill} transform=\"translate(658,0)\" />\n <Path d={WORDMARK_O_PATH} fill={oFill} transform=\"translate(1280,0)\" />\n <Path d={WORDMARK_L_PATH} fill={inkFill} transform=\"translate(1902,0)\" />\n <Path d={WORDMARK_S_PATH} fill={inkFill} transform=\"translate(2195,0)\" />\n <Path d={WORDMARK_E_PATH} fill={inkFill} transform=\"translate(2754,0)\" />\n </G>\n ) : null}\n </Svg>\n );\n}\n","export { PoolseIcon, type PoolseIconProps, type IconName } from './PoolseIcon.js';\nexport { PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant } from './PoolseLogo.js';\nexport { Avatar, type AvatarProps } from './Avatar.js';\nexport { userColor } from './userColor.js';\n\n// Re-exported as a namespace for the public API surface.\nimport { PoolseIcon } from './PoolseIcon.js';\nimport { PoolseLogo } from './PoolseLogo.js';\nimport { Avatar } from './Avatar.js';\n\nexport const primitives = { PoolseIcon, PoolseLogo, Avatar };\n","import { useEffect } from 'react';\nimport { AppState, type AppStateStatus } from 'react-native';\nimport { usePoolse } from '@poolse/react';\n\n/**\n * Closes the SDK WebSocket when the app goes to the background and\n * reopens it when the app comes back. iOS and Android suspend sockets\n * in the background anyway; closing cleanly avoids a half-dead\n * connection on resume. poolse sends push notifications for messages\n * and calls itself, so nothing is lost while the socket is closed.\n *\n * Channel handles and their listeners survive the pause, so mounted\n * hooks keep working after resume, and `useMessages` /\n * `useConversations` reload from REST to catch up on what was sent\n * while the app was away.\n *\n * Mount once, inside the provider:\n *\n * <PoolseProvider config={config}>\n * <AppShell />\n * </PoolseProvider>\n *\n * function AppShell() {\n * useAppStateLifecycle();\n * return ...;\n * }\n */\nexport function useAppStateLifecycle() {\n const poolse = usePoolse();\n\n useEffect(() => {\n // Only 'background' pauses: iOS reports 'inactive' for the\n // notification centre or the app switcher, which is no reason to drop\n // the connection.\n const sub = AppState.addEventListener('change', (next: AppStateStatus) => {\n if (next === 'background') poolse.realtime.pause();\n else if (next === 'active') poolse.realtime.resume();\n });\n\n return () => sub.remove();\n }, [poolse]);\n}\n","/**\n * The call surface's own palette.\n *\n * Deliberately NOT the app theme. Every serious calling app — phone,\n * FaceTime, WhatsApp, Meet — renders calls dark regardless of the rest\n * of the UI, for three reasons that all apply here:\n *\n * * video is the content, and a light chrome around it washes the\n * picture out,\n * * a call screen is the one surface that routinely opens at 3am,\n * * it takes over the whole screen, so it reads as a mode change\n * rather than as a screen that has lost the app's styling.\n *\n * The brand still shows up — in the accept button and the speaking\n * ring — it just doesn't set the background.\n */\nexport const callColors = {\n /** Behind everything. Near-black, cooled toward the brand. */\n bg: '#0B0B14',\n /** The brand glow rising behind the identity block. */\n glow: '#5B54E8',\n /** The faint counter-glow low in the frame, for depth. */\n glowWarm: '#B16CEA',\n /** The floating control dock and the status pill. */\n glass: 'rgba(255,255,255,0.08)',\n glassBorder: 'rgba(255,255,255,0.12)',\n /** Behind a participant tile with no video. */\n tile: '#1c1c20',\n /** Scrim under the top/bottom chrome so text stays legible over video. */\n scrim: 'rgba(0,0,0,0.45)',\n\n text: '#ffffff',\n textDim: 'rgba(255,255,255,0.72)',\n textFaint: 'rgba(255,255,255,0.5)',\n\n /** A control that is off / inactive — translucent over whatever is behind. */\n control: 'rgba(255,255,255,0.16)',\n /**\n * A control that is ENGAGED (muted, speaker on, camera off).\n *\n * Inverted rather than tinted: at a glance the user needs to see\n * *which* controls are doing something, and a solid white circle is\n * unmistakable against five translucent ones in a dim room.\n */\n controlActive: '#ffffff',\n controlActiveIcon: '#101012',\n\n danger: '#ef4444',\n accept: '#22c55e',\n onAction: '#ffffff',\n} as const;\n\n/** Control button diameters. Hang-up is bigger; it is the one you reach for. */\nexport const CONTROL_SIZE = 58;\nexport const CONTROL_SIZE_LARGE = 68;\n","import { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from '../primitives/PoolseIcon.js';\nimport { CONTROL_SIZE, CONTROL_SIZE_LARGE, callColors } from './callTheme.js';\n\nexport interface CallControlButtonProps {\n icon: IconName;\n /** Shown under the button. Omit for the hang-up / answer buttons. */\n label?: string | undefined;\n /**\n * The control is doing something — muted, speaker forced on, camera\n * off. Inverts the button so engaged controls are readable at a\n * glance.\n */\n active?: boolean;\n /** Paints the button a solid colour: the hang-up and answer actions. */\n tone?: 'neutral' | 'danger' | 'accept';\n large?: boolean;\n disabled?: boolean;\n onPress: () => void;\n /**\n * Spoken description. Defaults to `label`, but a toggle needs to say\n * what pressing it will DO, which is rarely what the label says —\n * \"Mute\" under a button that unmutes is exactly backwards for anyone\n * using a screen reader.\n */\n accessibilityLabel?: string | undefined;\n}\n\n/**\n * One round call control.\n *\n * Fixed diameter and a caption underneath, so a row of them lines up on\n * a grid regardless of label length — the thing that makes a control\n * bar look built rather than assembled.\n */\nexport function CallControlButton({\n icon,\n label,\n active = false,\n tone = 'neutral',\n large = false,\n disabled = false,\n onPress,\n accessibilityLabel,\n}: CallControlButtonProps) {\n const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;\n\n const background =\n tone === 'danger'\n ? callColors.danger\n : tone === 'accept'\n ? callColors.accept\n : active\n ? callColors.controlActive\n : callColors.control;\n\n const iconColor =\n tone === 'neutral' && active ? callColors.controlActiveIcon : callColors.onAction;\n\n return (\n <View style={styles.slot}>\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected: active }}\n accessibilityLabel={accessibilityLabel ?? label ?? icon}\n hitSlop={8}\n style={({ pressed }) => [\n styles.button,\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor: background,\n // Feedback without a layout shift — scaling a round button\n // inside a fixed slot keeps the row from twitching.\n opacity: disabled ? 0.4 : pressed ? 0.75 : 1,\n },\n ]}\n >\n <PoolseIcon name={icon} size={large ? 30 : 25} color={iconColor} label={null} />\n </Pressable>\n {label ? (\n <Text numberOfLines={1} style={styles.label}>\n {label}\n </Text>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n // Fixed width so captions of different lengths cannot shift the row.\n slot: { width: 76, alignItems: 'center', gap: 7 },\n button: { alignItems: 'center', justifyContent: 'center' },\n label: { color: callColors.textDim, fontSize: 11.5, fontWeight: '500' },\n});\n","import { StyleSheet, Text, View } from 'react-native';\n\nimport { userColor } from '../primitives/userColor.js';\nimport { callColors } from './callTheme.js';\n\nexport interface CallAvatarProps {\n /** Display name; the first letters become the initials. */\n name: string;\n /** Stable colour seed — the poolse user id. */\n seed: string;\n size: number;\n /** Draw the active-speaker ring. */\n speaking?: boolean;\n}\n\n/**\n * The stand-in for a face when a camera is off.\n *\n * Separate from `<Avatar>` rather than a size variant of it: this one\n * scales to a third of the screen, carries the speaking ring, and lives\n * on a dark surface, none of which the list avatar wants.\n *\n * The ring sits OUTSIDE the circle, drawn as a border on a larger box.\n * Growing the avatar itself to show speaking would make everything jump\n * every time somebody starts talking.\n */\nexport function CallAvatar({ name, seed, size, speaking = false }: CallAvatarProps) {\n const ring = Math.max(2, Math.round(size * 0.045));\n const outer = size + ring * 4;\n\n return (\n <View\n style={[\n styles.ring,\n {\n width: outer,\n height: outer,\n borderRadius: outer / 2,\n borderWidth: ring,\n borderColor: speaking ? callColors.accept : 'transparent',\n },\n ]}\n >\n <View\n style={[\n styles.circle,\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor: userColor(seed),\n },\n ]}\n >\n <Text\n style={[styles.initials, { fontSize: Math.round(size * 0.38) }]}\n numberOfLines={1}\n allowFontScaling={false}\n >\n {initialsOf(name)}\n </Text>\n </View>\n </View>\n );\n}\n\n/** Up to two initials, matching how the rest of the SDK derives them. */\nfunction initialsOf(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) return '?';\n if (parts.length === 1) return parts[0]!.slice(0, 2).toUpperCase();\n return (parts[0]![0]! + parts[parts.length - 1]![0]!).toUpperCase();\n}\n\nconst styles = StyleSheet.create({\n ring: { alignItems: 'center', justifyContent: 'center' },\n circle: { alignItems: 'center', justifyContent: 'center' },\n initials: { color: '#ffffff', fontWeight: '600' },\n});\n","import { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from '../primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from '../internal/edgeToEdge.js';\nimport { useSafeInsets } from '../internal/safeArea.js';\nimport { callColors } from './callTheme.js';\n\nexport type AudioRouteKind = 'speaker' | 'earpiece' | 'headset' | 'bluetooth' | 'auto';\n\n/** One place call audio can play — a row in the sheet. */\nexport interface AudioRoute {\n /** Platform id, passed back through `onSelect`. */\n id: string;\n kind: AudioRouteKind;\n /** Human label for the row. */\n label: string;\n}\n\nexport interface AudioRouteSheetProps {\n visible: boolean;\n routes: AudioRoute[];\n /** Platform id of the chosen route, or null while routing is automatic. */\n selectedRouteId: string | null;\n onSelect: (id: string) => void;\n onClose: () => void;\n}\n\nconst ICONS: Record<AudioRouteKind, IconName> = {\n speaker: 'speaker',\n earpiece: 'phone',\n headset: 'headphones',\n bluetooth: 'bluetooth',\n auto: 'phone',\n};\n\n/**\n * Pick where call audio comes out.\n *\n * Only worth showing when there is a real choice — more than the phone\n * and its speaker (AirPods, a car, a headset beside the speaker). With\n * just those two, a single speaker toggle is the better control.\n */\nexport function AudioRouteSheet({\n visible,\n routes,\n selectedRouteId,\n onSelect,\n onClose,\n}: AudioRouteSheetProps) {\n // The device's real insets — the sheet is a modal over the call.\n const insets = useSafeInsets();\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android so the padding below is what clears\n // the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* Tapping away closes it, which is what a sheet like this owes\n anyone who opened it by accident mid-call. */}\n <Pressable style={styles.backdrop} onPress={onClose} accessibilityRole=\"button\">\n <Pressable\n // The old fixed 34 was an iPhone home-indicator guess; a\n // 3-button Android nav bar is taller, so use the real inset.\n style={[styles.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }]}\n onPress={() => {}}\n >\n <View style={styles.grabber} />\n <Text style={styles.title}>Audio output</Text>\n\n {routes.map((route) => {\n const selected = route.id === selectedRouteId;\n return (\n <Pressable\n key={route.id}\n onPress={() => {\n onSelect(route.id);\n onClose();\n }}\n accessibilityRole=\"button\"\n accessibilityState={{ selected }}\n style={({ pressed }) => [styles.row, pressed && styles.rowPressed]}\n >\n <PoolseIcon\n name={ICONS[route.kind]}\n size={21}\n color={selected ? callColors.accept : callColors.text}\n label={null}\n />\n <Text style={[styles.label, selected && styles.labelSelected]}>{route.label}</Text>\n {selected && (\n <PoolseIcon name=\"check\" size={19} color={callColors.accept} label=\"selected\" />\n )}\n </Pressable>\n );\n })}\n </Pressable>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: { flex: 1, backgroundColor: 'rgba(0,0,0,0.55)', justifyContent: 'flex-end' },\n sheet: {\n backgroundColor: callColors.tile,\n borderTopLeftRadius: 22,\n borderTopRightRadius: 22,\n paddingHorizontal: 12,\n paddingTop: 10,\n gap: 2,\n },\n grabber: {\n alignSelf: 'center',\n width: 38,\n height: 4,\n borderRadius: 2,\n backgroundColor: callColors.textFaint,\n marginBottom: 12,\n },\n title: {\n color: callColors.textDim,\n fontSize: 12.5,\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: 0.6,\n paddingHorizontal: 12,\n paddingBottom: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 14,\n paddingHorizontal: 12,\n paddingVertical: 15,\n borderRadius: 14,\n },\n rowPressed: { backgroundColor: 'rgba(255,255,255,0.08)' },\n label: { flex: 1, color: callColors.text, fontSize: 16, fontWeight: '500' },\n labelSelected: { color: callColors.accept },\n});\n","import { useEffect, useRef, useState } from 'react';\n\n/**\n * How long the call has been connected, as `m:ss` (or `h:mm:ss`).\n *\n * Anchored to a timestamp rather than counting ticks: a phone that\n * sleeps or throttles timers would otherwise drift, and a call timer\n * that reads 4:12 after eleven minutes is worse than none. Returns null\n * until the call is actually up, so a ringing call shows its status\n * line instead of `0:00`.\n */\nexport function useCallDuration(connected: boolean): string | null {\n const startedAt = useRef<number | null>(null);\n const [, tick] = useState(0);\n\n if (connected && startedAt.current === null) startedAt.current = Date.now();\n if (!connected && startedAt.current !== null) startedAt.current = null;\n\n useEffect(() => {\n if (!connected) return;\n const id = setInterval(() => tick((n) => n + 1), 1000);\n return () => clearInterval(id);\n }, [connected]);\n\n if (!connected || startedAt.current === null) return null;\n return format(Math.max(0, Math.floor((Date.now() - startedAt.current) / 1000)));\n}\n\nfunction format(total: number): string {\n const hours = Math.floor(total / 3600);\n const minutes = Math.floor((total % 3600) / 60);\n const seconds = total % 60;\n const mm = hours > 0 ? String(minutes).padStart(2, '0') : String(minutes);\n return `${hours > 0 ? `${hours}:` : ''}${mm}:${String(seconds).padStart(2, '0')}`;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/theme/default.ts","../src/theme/PoolseTheme.tsx","../src/primitives/userColor.ts","../src/primitives/Avatar.tsx","../src/primitives/icons-data.ts","../src/primitives/PoolseIcon.tsx","../src/MemberList.tsx","../src/internal/edgeToEdge.ts","../src/internal/safeArea.ts","../src/internal/useDismissableSheet.ts","../src/GroupDetailsSheet.tsx","../src/ChatHeader.tsx","../src/ConversationList.tsx","../src/internal/uploadContext.tsx","../src/AttachmentPicker.tsx","../src/DaySeparator.tsx","../src/LiveCallBanner.tsx","../src/UploadQueueStrip.tsx","../src/internal/useKeyboardOpen.ts","../src/MessageComposer.tsx","../src/MentionInput.tsx","../src/MessageList.tsx","../src/CallLogRow.tsx","../src/MessageActions.tsx","../src/AttachmentPreview.tsx","../src/ImageMosaic.tsx","../src/internal/bubbleText.ts","../src/internal/markdown.ts","../src/MessageBubble.tsx","../src/Reactions.tsx","../src/MessageRow.tsx","../src/ThreadView.tsx","../src/UserName.tsx","../src/TypingIndicator.tsx","../src/ConversationView.tsx","../src/internal/UserPickerSheet.tsx","../src/PoolseInbox.tsx","../src/primitives/PoolseLogo.tsx","../src/primitives/index.ts","../src/lifecycle/useAppStateLifecycle.tsx","../src/voice/callTheme.ts","../src/voice/CallControlButton.tsx","../src/voice/CallAvatar.tsx","../src/voice/AudioRouteSheet.tsx","../src/voice/useCallDuration.ts"],"names":["createContext","useMemo","useContext","jsxs","View","jsx","Image","Text","StyleSheet","SvgXml","useMembers","usePresence","styles","ActivityIndicator","FlatList","Fragment","useUser","Pressable","useSafeAreaInsets","useRef","Animated","PanResponder","useConversation","useWindowDimensions","Modal","useMe","useState","useConversations","formatCallLogPreview","useAttachmentUpload","useCallback","RNImage","manipulateAsync","SaveFormat","ImagePicker","res","DocumentPicker","ScrollView","useEffect","Keyboard","Platform","forwardRef","MessageComposer","useImperativeHandle","TextInput","KeyboardAvoidingView","callLogDisplayFor","useAttachmentUrl","formatBytes","MarkdownIt","createElement","Markdown","radii","formatTime","Linking","sameDay","useReactions","Clipboard","useThread","Easing","receiptsOf","useMessages","useTyping","useMessageStreams","useRealtimeStatus","AppState","isMessageVisibleTo","computeGroupPosition","canEditOwnMessage","formatDayLabel","useLiveCall","PoolseInbox","Svg","Path","Circle","G","usePoolse","ICONS"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,WAAA,GAAc;AAAA,EAClB,KAAA,EAAO,SAAA;AAAA,EACP,WAAA,EAAa,SAAA;AAAA,EACb,SAAA,EAAW,SAAA;AAAA,EACX,OAAA,EAAS,SAAA;AAAA,EACT,KAAA,EAAO,SAA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AA,CAAU,OAAA,IAAW,GAAI,CAAC,CAAC,CAAA;AAChF;AAEA,SAAS,OAAO,KAAA,EAAuB;AACrC,EAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,IAAI,CAAA;AACrC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAO,KAAA,GAAQ,OAAQ,EAAE,CAAA;AAC9C,EAAA,MAAM,UAAU,KAAA,GAAQ,EAAA;AACxB,EAAA,MAAM,EAAA,GAAK,KAAA,GAAQ,CAAA,GAAI,MAAA,CAAO,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAA,GAAI,MAAA,CAAO,OAAO,CAAA;AACxE,EAAA,OAAO,GAAG,KAAA,GAAQ,CAAA,GAAI,CAAA,EAAG,KAAK,MAAM,EAAE,CAAA,EAAG,EAAE,CAAA,CAAA,EAAI,OAAO,OAAO,CAAA,CAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAAA;AACjF","file":"index.cjs","sourcesContent":["import type { PoolseRNTheme, ThemeShadows } from './types.js';\n\n// Values mirror the --poolse-* CSS variables in @poolse/react-ui's\n// styles.css :root block. If the brand changes there, change here.\n\nconst lightColors = {\n brand: '#ff5436',\n brandStrong: '#d63415',\n brandSoft: '#ffe9e2',\n onBrand: '#fbf7f4',\n paper: '#fbf7f4',\n surface: '#ffffff',\n surface2: '#f4eee9',\n ink: '#1c1a19',\n ink2: '#6b6560',\n ink3: '#9a938c',\n border: '#eae3dc',\n presence: '#16c172',\n success: '#16a34a',\n warning: '#e08c16',\n error: '#e5484d',\n info: '#3b82f6',\n selfBubble: '#ff5436',\n selfBubbleText: '#fbf7f4',\n otherBubble: '#ffffff',\n otherBubbleText: '#1c1a19',\n unreadPill: '#ff5436',\n unreadPillText: '#fbf7f4',\n};\n\nconst darkColors = {\n brand: '#ff6a4d',\n brandStrong: '#ff8366',\n brandSoft: '#2c1712',\n onBrand: '#fbf7f4',\n paper: '#0e0d10',\n surface: '#16141a',\n surface2: '#201d25',\n ink: '#f6f2ee',\n ink2: '#a8a29b',\n ink3: '#766f68',\n border: '#2a2630',\n presence: '#22d37a',\n success: '#34d399',\n warning: '#fbbf24',\n error: '#f87171',\n info: '#60a5fa',\n selfBubble: '#ff6a4d',\n selfBubbleText: '#fbf7f4',\n otherBubble: '#16141a',\n otherBubbleText: '#f6f2ee',\n unreadPill: '#ff6a4d',\n unreadPillText: '#fbf7f4',\n};\n\nconst type = {\n // RN can't use Bricolage/Hanken/JetBrains without expo-font setup,\n // so we default to the platform sans-serif. Devs override via the\n // theme prop if they ship custom fonts.\n fontDisplay: 'System',\n fontBody: 'System',\n fontMono: 'Menlo',\n bodySize: 15,\n lineHeight: 22,\n weightRegular: '400' as const,\n weightMedium: '500' as const,\n weightSemibold: '600' as const,\n weightBold: '700' as const,\n};\n\nconst radii = {\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n pill: 999,\n bubble: 18,\n};\n\nconst spacing = {\n xs: 4,\n sm: 8,\n md: 12,\n lg: 16,\n xl: 24,\n};\n\nconst lightShadows: ThemeShadows = {\n sm: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.08,\n shadowOffset: { width: 0, height: 1 },\n shadowRadius: 2,\n elevation: 1,\n },\n md: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.18,\n shadowOffset: { width: 0, height: 10 },\n shadowRadius: 30,\n elevation: 6,\n },\n lg: {\n shadowColor: '#1c1a19',\n shadowOpacity: 0.28,\n shadowOffset: { width: 0, height: 24 },\n shadowRadius: 60,\n elevation: 12,\n },\n};\n\nconst darkShadows: ThemeShadows = {\n sm: {\n shadowColor: '#000000',\n shadowOpacity: 0.4,\n shadowOffset: { width: 0, height: 1 },\n shadowRadius: 2,\n elevation: 1,\n },\n md: {\n shadowColor: '#000000',\n shadowOpacity: 0.55,\n shadowOffset: { width: 0, height: 10 },\n shadowRadius: 30,\n elevation: 6,\n },\n lg: {\n shadowColor: '#000000',\n shadowOpacity: 0.7,\n shadowOffset: { width: 0, height: 24 },\n shadowRadius: 60,\n elevation: 12,\n },\n};\n\nexport const defaultLightTheme: PoolseRNTheme = {\n mode: 'light',\n colors: lightColors,\n type,\n radii,\n spacing,\n shadows: lightShadows,\n};\n\nexport const defaultDarkTheme: PoolseRNTheme = {\n mode: 'dark',\n colors: darkColors,\n type,\n radii,\n spacing,\n shadows: darkShadows,\n};\n","import { createContext, useContext, useMemo, type ReactNode } from 'react';\n\nimport { defaultDarkTheme, defaultLightTheme } from './default.js';\nimport type { PoolseRNTheme, PoolseRNThemeOverrides, ThemeMode } from './types.js';\n\nconst ThemeContext = createContext<PoolseRNTheme | null>(null);\n\nexport interface PoolseThemeProps {\n /**\n * Light or dark base palette. Overrides are merged on top of the\n * chosen base. Defaults to `light` if omitted.\n */\n mode?: ThemeMode;\n /**\n * Partial overrides — only the fields you set replace the defaults.\n * Nested groups (`colors`, `type`, `radii`, `spacing`, `shadows`)\n * deep-merge, so `{ colors: { brand: '#000' } }` keeps every other\n * color from the base theme.\n */\n theme?: PoolseRNThemeOverrides;\n children: ReactNode;\n}\n\nexport function PoolseTheme({ mode, theme, children }: PoolseThemeProps) {\n const resolved = useMemo(() => {\n const base = (mode ?? theme?.mode) === 'dark' ? defaultDarkTheme : defaultLightTheme;\n if (!theme) return base;\n return {\n mode: theme.mode ?? base.mode,\n colors: { ...base.colors, ...theme.colors },\n type: { ...base.type, ...theme.type },\n radii: { ...base.radii, ...theme.radii },\n spacing: { ...base.spacing, ...theme.spacing },\n shadows: {\n sm: { ...base.shadows.sm, ...theme.shadows?.sm },\n md: { ...base.shadows.md, ...theme.shadows?.md },\n lg: { ...base.shadows.lg, ...theme.shadows?.lg },\n },\n } satisfies PoolseRNTheme;\n }, [mode, theme]);\n\n return <ThemeContext.Provider value={resolved}>{children}</ThemeContext.Provider>;\n}\n\n/**\n * Read the active poolse theme. Falls back to `defaultLightTheme`\n * if no `<PoolseTheme>` ancestor is mounted, so components render\n * sensibly even without explicit wiring.\n */\nexport function usePoolseTheme(): PoolseRNTheme {\n return useContext(ThemeContext) ?? defaultLightTheme;\n}\n","// Mirror of @poolse/react-ui's userColor — deterministic per-user\n// color from the same 8-hue palette.\n\nconst PALETTE = [\n '#6366f1', // indigo\n '#10b981', // emerald\n '#f59e0b', // amber\n '#ec4899', // rose\n '#0ea5e9', // sky\n '#8b5cf6', // violet\n '#14b8a6', // teal\n '#d946ef', // fuchsia\n];\n\nexport function userColor(id: string): string {\n let h = 0;\n for (let i = 0; i < id.length; i++) {\n h = (h * 31 + id.charCodeAt(i)) | 0;\n }\n return PALETTE[Math.abs(h) % PALETTE.length]!;\n}\n","import { Image, StyleSheet, Text, View } from 'react-native';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\nimport { userColor } from './userColor.js';\n\nexport interface AvatarProps {\n /** URL to a profile image. Falls back to initials when omitted. */\n src?: string | null;\n /** Used for initials. */\n name?: string | null;\n /** Stable color seed (typically the user's external_id). */\n seed?: string | null;\n /** Show a green presence dot in the bottom-right corner. */\n online?: boolean;\n /** Size variant. `md` → 40px, `sm` → 28px, `lg` → 56px. */\n size?: 'sm' | 'md' | 'lg';\n}\n\nconst SIZES = { sm: 28, md: 40, lg: 56 } as const;\n\nexport function Avatar({ src, name, seed, online, size = 'md' }: AvatarProps) {\n const theme = usePoolseTheme();\n const dim = SIZES[size];\n const initials = computeInitials(name);\n const tint = seed ? userColor(seed) : theme.colors.brand;\n const fontSize = size === 'sm' ? 11 : size === 'lg' ? 22 : 15;\n\n return (\n <View\n style={[\n styles.root,\n {\n width: dim,\n height: dim,\n borderRadius: dim / 2,\n backgroundColor: tint,\n },\n ]}\n accessibilityRole=\"image\"\n accessibilityLabel={name ?? 'avatar'}\n >\n {src ? (\n <Image\n source={{ uri: src }}\n style={{ width: dim, height: dim, borderRadius: dim / 2 }}\n accessible={false}\n />\n ) : (\n <Text\n style={{\n color: theme.colors.onBrand,\n fontSize,\n fontWeight: '600',\n fontFamily: theme.type.fontBody,\n }}\n >\n {initials}\n </Text>\n )}\n {online ? (\n <View\n style={[\n styles.presence,\n {\n backgroundColor: theme.colors.presence,\n borderColor: theme.colors.surface,\n width: dim * 0.32,\n height: dim * 0.32,\n borderRadius: dim * 0.16,\n },\n ]}\n />\n ) : null}\n </View>\n );\n}\n\nfunction computeInitials(name: string | null | undefined): string {\n if (!name) return '?';\n const parts = name.trim().split(/\\s+/).slice(0, 2);\n return (\n parts\n .map((p) => p.charAt(0).toUpperCase())\n .join('')\n .slice(0, 2) || '?'\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n overflow: 'visible',\n },\n presence: {\n position: 'absolute',\n bottom: 0,\n right: 0,\n borderWidth: 2,\n },\n});\n","// AUTO-GENERATED from poolse-brand-kit/icons/. Do not edit by hand.\n// Run scripts/build-icons.py from the brand kit if the source SVGs change.\n\nexport interface IconDef {\n vb: string;\n d: string;\n}\n\nexport const ICONS = {\n attachment: {\n vb: '0 0 24 24',\n d: '<path d=\"M20 11.6 11.4 20.2a5 5 0 0 1-7.1-7.1l8.7-8.7a3.3 3.3 0 0 1 4.7 4.7l-8.6 8.6a1.65 1.65 0 0 1-2.36-2.32l7.86-7.86\"/>',\n },\n bell: {\n vb: '0 0 24 24',\n d: '<path d=\"M6 9.2a6 6 0 0 1 12 0c0 4.8 1.4 6.3 1.9 6.8H4.1C4.6 15.5 6 14 6 9.2Z\"/><path d=\"M9.6 19.8a2.5 2.5 0 0 0 4.8 0\"/>',\n },\n bluetooth: {\n vb: '0 0 24 24',\n d: '<path d=\"M7.5 7.5 16.5 16.5 12 21V3l4.5 4.5L7.5 16.5\"/>',\n },\n camera: {\n vb: '0 0 24 24',\n d: '<path d=\"M3 8.5a2 2 0 0 1 2-2h2.4l1.4-2h6.4l1.4 2H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9Z\"/><circle cx=\"12\" cy=\"13\" r=\"3.5\"/>',\n },\n 'camera-flip': {\n vb: '0 0 24 24',\n d: '<path d=\"M3 8.5a2 2 0 0 1 2-2h2.4l1.4-2h6.4l1.4 2H19a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-9Z\"/><path d=\"M14.6 13a2.6 2.6 0 0 1-4.5 1.8\"/><path d=\"M9.4 13a2.6 2.6 0 0 1 4.5-1.8\"/><path d=\"M13.9 9.6v1.7h-1.7\"/><path d=\"M10.1 16.4v-1.7h1.7\"/>',\n },\n 'check-double': {\n vb: '0 0 24 24',\n d: '<path d=\"M2.5 12.8 6.9 17 15.4 7.6\"/><path d=\"M11.4 16.4 12.3 17.2 21 7.6\"/>',\n },\n check: {\n vb: '0 0 24 24',\n d: '<path d=\"M4.5 12.6 9.4 17.4 19.5 6.6\"/>',\n },\n 'chevron-down': {\n vb: '0 0 24 24',\n d: '<path d=\"M5 9 12 16 19 9\"/>',\n },\n 'chevron-right': {\n vb: '0 0 24 24',\n d: '<path d=\"M9 5 16 12 9 19\"/>',\n },\n 'chevron-up': {\n vb: '0 0 24 24',\n d: '<path d=\"M6 14.5 12 8.5 18 14.5\"/>',\n },\n close: {\n vb: '0 0 24 24',\n d: '<path d=\"M6 6 18 18M18 6 6 18\"/>',\n },\n code: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 7.5 4.5 12 9 16.5\"/><path d=\"M15 7.5 19.5 12 15 16.5\"/><path d=\"M13.2 5 10.8 19\"/>',\n },\n compose: {\n vb: '0 0 24 24',\n d: '<path d=\"M11.5 4H6a2.5 2.5 0 0 0-2.5 2.5V18A2.5 2.5 0 0 0 6 20.5h11.5A2.5 2.5 0 0 0 20 18v-5.5\"/><path d=\"M18.4 2.7a2.05 2.05 0 0 1 2.9 2.9L12 15l-4 1 1-4 9.4-9.3Z\"/>',\n },\n copy: {\n vb: '0 0 24 24',\n d: '<rect x=\"8.4\" y=\"8.4\" width=\"11.2\" height=\"11.2\" rx=\"2.3\"/><path d=\"M5.6 15.6H5A1.6 1.6 0 0 1 3.4 14V5A1.6 1.6 0 0 1 5 3.4h9A1.6 1.6 0 0 1 15.6 5v.6\"/>',\n },\n download: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 3.2v11.6\"/><path d=\"M7.4 10.2 12 14.8 16.6 10.2\"/><path d=\"M4 19.6h16\"/>',\n },\n edit: {\n vb: '0 0 24 24',\n d: '<path d=\"M16.7 3.3a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.7-12.7Z\"/>',\n },\n emoji: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><circle cx=\"9\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"15\" cy=\"10\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M8.4 14.2a4.6 4.6 0 0 0 7.2 0\"/>',\n },\n fullscreen: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 9V5.5A1.5 1.5 0 0 1 5.5 4H9\"/><path d=\"M15 4h3.5A1.5 1.5 0 0 1 20 5.5V9\"/><path d=\"M20 15v3.5a1.5 1.5 0 0 1-1.5 1.5H15\"/><path d=\"M9 20H5.5A1.5 1.5 0 0 1 4 18.5V15\"/>',\n },\n 'fullscreen-exit': {\n vb: '0 0 24 24',\n d: '<path d=\"M9 4v3.5A1.5 1.5 0 0 1 7.5 9H4\"/><path d=\"M20 9h-3.5A1.5 1.5 0 0 1 15 7.5V4\"/><path d=\"M15 20v-3.5a1.5 1.5 0 0 1 1.5-1.5H20\"/><path d=\"M4 15h3.5A1.5 1.5 0 0 1 9 16.5V20\"/>',\n },\n headphones: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 14v-2a8 8 0 0 1 16 0v2\"/><path d=\"M4 14h2.6a1.4 1.4 0 0 1 1.4 1.4v3.2A1.4 1.4 0 0 1 6.6 20H5.4A1.4 1.4 0 0 1 4 18.6Z\"/><path d=\"M20 14h-2.6a1.4 1.4 0 0 0-1.4 1.4v3.2A1.4 1.4 0 0 0 17.4 20h1.2A1.4 1.4 0 0 0 20 18.6Z\"/>',\n },\n heart: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 20.3 4.4 12.9a4.6 4.6 0 1 1 6.5-6.5l1.1 1.1 1.1-1.1a4.6 4.6 0 1 1 6.5 6.5L12 20.3Z\"/>',\n },\n image: {\n vb: '0 0 24 24',\n d: '<rect x=\"3.2\" y=\"4.2\" width=\"17.6\" height=\"15.6\" rx=\"2.6\"/><circle cx=\"8.6\" cy=\"9.4\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M20.8 15.8 16 11 6 19.8\"/>',\n },\n info: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"8.6\"/><path d=\"M12 11v5.2\"/><circle cx=\"12\" cy=\"7.7\" r=\"1\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n key: {\n vb: '0 0 24 24',\n d: '<circle cx=\"8\" cy=\"8\" r=\"4.4\"/><path d=\"M11.1 11.1 20 20\"/><path d=\"M16.6 16.6 18.6 14.6M14 14l2-2\"/>',\n },\n link: {\n vb: '0 0 24 24',\n d: '<path d=\"M10.2 13.8a3.5 3.5 0 0 0 5 0l3-3a3.5 3.5 0 0 0-5-5l-1.2 1.2\"/><path d=\"M13.8 10.2a3.5 3.5 0 0 0-5 0l-3 3a3.5 3.5 0 0 0 5 5l1.2-1.2\"/>',\n },\n lock: {\n vb: '0 0 24 24',\n d: '<rect x=\"4.6\" y=\"10.4\" width=\"14.8\" height=\"9.8\" rx=\"2.2\"/><path d=\"M8 10.4V7a4 4 0 0 1 8 0v3.4\"/>',\n },\n message: {\n vb: '0 0 24 24',\n d: '<path d=\"M20.5 11.4c0 4.5-3.9 8.1-8.5 8.1a9 9 0 0 1-3.7-.78L3.5 20.5l1.8-4.6A7.9 7.9 0 0 1 3.5 11.4C3.5 6.9 7.4 3.3 12 3.3s8.5 3.6 8.5 8.1Z\"/>',\n },\n messages: {\n vb: '0 0 24 24',\n d: '<path d=\"M14 9.2a4.7 4.7 0 0 1-4.7 4.7H6.8L3.5 16.4v-2.9A4.7 4.7 0 0 1 6.8 4.5h2.5A4.7 4.7 0 0 1 14 9.2Z\"/><path d=\"M9.4 13.6A4.7 4.7 0 0 0 13.6 16h3.6l3.3 2.5v-2.9a4.7 4.7 0 0 0-2.4-4.1\"/>',\n },\n mic: {\n vb: '0 0 24 24',\n d: '<rect x=\"9\" y=\"2.6\" width=\"6\" height=\"11.2\" rx=\"3\"/><path d=\"M5.6 11.2a6.4 6.4 0 0 0 12.8 0\"/><path d=\"M12 17.6v3.4\"/><path d=\"M8.6 21h6.8\"/>',\n },\n 'mic-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"9\" y=\"2.6\" width=\"6\" height=\"11.2\" rx=\"3\"/><path d=\"M5.6 11.2a6.4 6.4 0 0 0 12.8 0\"/><path d=\"M12 17.6v3.4\"/><path d=\"M8.6 21h6.8\"/><path d=\"M3.6 3.2 20.4 20.8\"/>',\n },\n 'more-h': {\n vb: '0 0 24 24',\n d: '<circle cx=\"5.4\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"18.6\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n 'more-v': {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"5.4\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"18.6\" r=\"1.6\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n phone: {\n vb: '0 0 24 24',\n d: '<path d=\"M6.6 3.5h3l1.5 3.7-1.9 1.4a12.5 12.5 0 0 0 6.2 6.2l1.4-1.9 3.7 1.5v3a2 2 0 0 1-2.2 2A16.8 16.8 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2Z\"/>',\n },\n 'phone-off': {\n vb: '0 0 24 24',\n d: '<g transform=\"rotate(135 12 12)\"><path d=\"M6.6 3.5h3l1.5 3.7-1.9 1.4a12.5 12.5 0 0 0 6.2 6.2l1.4-1.9 3.7 1.5v3a2 2 0 0 1-2.2 2A16.8 16.8 0 0 1 4.6 5.7a2 2 0 0 1 2-2.2Z\"/></g>',\n },\n pin: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 3.4h6v1.8l-1 5.6 3 3.2H7l3-3.2-1-5.6V3.4Z\"/><path d=\"M12 17v3.6\"/>',\n },\n plus: {\n vb: '0 0 24 24',\n d: '<path d=\"M12 5v14M5 12h14\"/>',\n },\n presence: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"currentColor\" opacity=\"0.18\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"5\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n pulse: {\n vb: '0 0 24 24',\n d: '<path d=\"M3 13h4.6l2.2-4.6 3.4 9 2.2-4.4H21\"/>',\n },\n reply: {\n vb: '0 0 24 24',\n d: '<path d=\"M9 7 4 12l5 5\"/><path d=\"M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20\"/>',\n },\n 'screen-share': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M12 13V7.4\"/><path d=\"M9.4 9.8 12 7.2l2.6 2.6\"/>',\n },\n 'screen-share-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"4\" width=\"18.8\" height=\"12.6\" rx=\"2\"/><path d=\"M8.4 20.4h7.2\"/><path d=\"M12 16.6v3.8\"/><path d=\"M9.6 8 14.4 12.6\"/><path d=\"M14.4 8 9.6 12.6\"/>',\n },\n search: {\n vb: '0 0 24 24',\n d: '<circle cx=\"11\" cy=\"11\" r=\"6.8\"/><path d=\"M20.8 20.8 16 16\"/>',\n },\n 'send-fill': {\n vb: '0 0 24 24',\n d: '<path fill=\"currentColor\" stroke=\"none\" d=\"M21.7 2.3a1 1 0 0 1 .25 1L15.3 21.8a1 1 0 0 1-1.86.06L10.6 14.2 3 11.4a1 1 0 0 1 .06-1.9L20.7 2.05a1 1 0 0 1 1 .25Z\"/>',\n },\n send: {\n vb: '0 0 24 24',\n d: '<path d=\"M21.4 2.6 11 13\"/><path d=\"M21.4 2.6 14.8 21.5a.6.6 0 0 1-1.1.05L11 14l-7.5-2.7a.6.6 0 0 1 .05-1.1L21.4 2.6Z\"/>',\n },\n settings: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"12\" r=\"3.1\"/><path d=\"M12 2.6V5M12 19v2.4M4.2 4.2 5.9 5.9M18.1 18.1l1.7 1.7M2.6 12H5M19 12h2.4M4.2 19.8 5.9 18.1M18.1 5.9l1.7-1.7\"/>',\n },\n sliders: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 7h9M17 7h3\"/><circle cx=\"15\" cy=\"7\" r=\"2.1\"/><path d=\"M4 17h3M11 17h9\"/><circle cx=\"9\" cy=\"17\" r=\"2.1\"/>',\n },\n speaker: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 9.5h3.2L12 5.4v13.2L7.2 14.5H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1Z\"/><path d=\"M15.6 9.2a4 4 0 0 1 0 5.6\"/><path d=\"M18.2 6.6a7.7 7.7 0 0 1 0 10.8\"/>',\n },\n 'speaker-off': {\n vb: '0 0 24 24',\n d: '<path d=\"M4 9.5h3.2L12 5.4v13.2L7.2 14.5H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1Z\"/><path d=\"M16.4 9.6 21.4 14.4\"/><path d=\"M21.4 9.6 16.4 14.4\"/>',\n },\n 'thumbs-up': {\n vb: '0 0 24 24',\n d: '<path d=\"M7 10.4V20H4.2V10.4Z\"/><path d=\"M7 10.4 11 3.2a2 2 0 0 1 1.9 2.2L12.4 9H18a2 2 0 0 1 2 2.4l-1.1 6A2 2 0 0 1 16.9 20H7\"/>',\n },\n trash: {\n vb: '0 0 24 24',\n d: '<path d=\"M4 7h16\"/><path d=\"M9.2 7V5.2A1.8 1.8 0 0 1 11 3.4h2a1.8 1.8 0 0 1 1.8 1.8V7\"/><path d=\"M6.2 7 7.2 19A1.9 1.9 0 0 0 9.1 20.7h5.8A1.9 1.9 0 0 0 16.8 19L17.8 7\"/><path d=\"M10.3 11v5M13.7 11v5\"/>',\n },\n typing: {\n vb: '0 0 24 24',\n d: '<circle cx=\"6\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"12\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"18\" cy=\"12\" r=\"1.7\" fill=\"currentColor\" stroke=\"none\"/>',\n },\n 'user-plus': {\n vb: '0 0 24 24',\n d: '<circle cx=\"9\" cy=\"8\" r=\"3.8\"/><path d=\"M3 20a6 6 0 0 1 12 0\"/><path d=\"M18 8v6M15 11h6\"/>',\n },\n user: {\n vb: '0 0 24 24',\n d: '<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4.6 20a7.4 7.4 0 0 1 14.8 0\"/>',\n },\n users: {\n vb: '0 0 24 24',\n d: '<circle cx=\"9\" cy=\"8\" r=\"3.6\"/><path d=\"M2.6 20a6.4 6.4 0 0 1 12.8 0\"/><path d=\"M15.8 4.7a3.6 3.6 0 0 1 0 6.6\"/><path d=\"M17.6 20a6.4 6.4 0 0 0-3.1-5.5\"/>',\n },\n video: {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"6\" width=\"13\" height=\"12\" rx=\"2.4\"/><path d=\"M15.6 11.2 21.4 8v8l-5.8-3.2Z\"/>',\n },\n 'video-off': {\n vb: '0 0 24 24',\n d: '<rect x=\"2.6\" y=\"6\" width=\"13\" height=\"12\" rx=\"2.4\"/><path d=\"M15.6 11.2 21.4 8v8l-5.8-3.2Z\"/><path d=\"M3.6 3.2 20.4 20.8\"/>',\n },\n webhook: {\n vb: '0 0 24 24',\n d: '<circle cx=\"6\" cy=\"6\" r=\"2.6\"/><circle cx=\"18\" cy=\"9\" r=\"2.6\"/><circle cx=\"9.5\" cy=\"18\" r=\"2.6\"/><path d=\"M7.9 7.9 12 12l3.7-1.5\"/><path d=\"M11.6 12.7 9.8 16\"/>',\n },\n} as const satisfies Record<string, IconDef>;\n\nexport type IconName = keyof typeof ICONS;\n","import { SvgXml } from 'react-native-svg';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\nimport { ICONS, type IconName } from './icons-data.js';\n\nexport type { IconName };\n\nexport interface PoolseIconProps {\n /** Icon name — see {@link IconName} for the full list. */\n name: IconName;\n /** Width + height in pixels. Defaults to `20` (matches a body-line). */\n size?: number;\n /** Stroke color. Defaults to the theme's `ink` color. */\n color?: string;\n /** Accessibility label. Defaults to the icon name. */\n label?: string | null;\n}\n\nexport function PoolseIcon({ name, size = 20, color, label }: PoolseIconProps) {\n const theme = usePoolseTheme();\n const def = ICONS[name];\n if (!def) return null;\n const stroke = color ?? theme.colors.ink;\n const xml = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"${def.vb}\" fill=\"none\" stroke=\"${stroke}\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\">${def.d}</svg>`;\n const a11y =\n label === null\n ? { accessibilityRole: 'none' as const }\n : { accessibilityRole: 'image' as const, accessibilityLabel: label ?? name };\n return <SvgXml xml={xml} width={size} height={size} {...a11y} />;\n}\n","import type { MemberRole, Membership, Uuid } from '@poolse/sdk';\nimport { useMembers, usePresence, useUser } from '@poolse/react';\nimport { type ReactNode } from 'react';\nimport { ActivityIndicator, FlatList, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MemberListProps {\n conversationId: Uuid;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onlineExternalIds?: Set<string>;\n canRemove?: (m: Membership) => boolean;\n renderItem?: (m: Membership) => ReactNode;\n emptyState?: ReactNode | string;\n}\n\nexport function MemberList({\n conversationId,\n labelFor,\n avatarFor,\n onlineExternalIds,\n canRemove,\n renderItem,\n emptyState,\n}: MemberListProps) {\n const theme = usePoolseTheme();\n const { members, loading, error, removeMember } = useMembers(conversationId);\n const { online: presenceOnline } = usePresence(\n onlineExternalIds === undefined ? conversationId : '',\n );\n const effectiveOnline = onlineExternalIds ?? presenceOnline;\n\n if (loading && members.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (error) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <Text style={{ color: theme.colors.error, fontFamily: theme.type.fontBody }}>\n Failed to load members.\n </Text>\n {error.message ? (\n <Text style={[styles.errorDetail, { color: theme.colors.ink3 }]}>{error.message}</Text>\n ) : null}\n </View>\n );\n }\n\n if (members.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' || emptyState == null ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {(emptyState as string) ?? 'No members.'}\n </Text>\n ) : (\n emptyState\n )}\n </View>\n );\n }\n\n return (\n <FlatList\n data={members}\n keyExtractor={(m) => m.user_id}\n style={{ backgroundColor: theme.colors.paper }}\n renderItem={({ item }) => {\n if (renderItem) return <>{renderItem(item)}</>;\n const isOnline = effectiveOnline.has(item.external_id);\n const showRemove = canRemove?.(item) ?? false;\n return (\n <MemberRow\n externalId={item.external_id}\n role={item.role}\n online={isOnline}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(showRemove ? { onRemove: () => removeMember(item.external_id) } : {})}\n />\n );\n }}\n />\n );\n}\n\nfunction MemberRow({\n externalId,\n role,\n online,\n labelFor,\n avatarFor,\n onRemove,\n}: {\n externalId: string;\n role: MemberRole;\n online: boolean;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onRemove?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n // The previous version used `labelFor?.(id) ?? id` and skipped the\n // resolver entirely when labelFor wasn't passed, defeating the\n // PoolseConfig.userResolver contract for consumers who configured\n // one and expected names + avatars to flow through automatically.\n const resolved = useUser(externalId);\n const name = labelFor?.(externalId) ?? resolved.profile?.displayName ?? externalId;\n const avatarUrl = avatarFor?.(externalId) ?? resolved.profile?.avatarUrl ?? null;\n return (\n <View style={styles.row}>\n <Avatar src={avatarUrl} name={name} seed={externalId} online={online} size=\"md\" />\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {name}\n </Text>\n <Text style={[styles.role, { color: theme.colors.ink3 }]}>{role}</Text>\n </View>\n {onRemove ? (\n <Pressable onPress={onRemove} hitSlop={8} style={styles.removeBtn}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n errorDetail: {\n marginTop: 6,\n fontSize: 11,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 8,\n gap: 10,\n },\n body: {\n flex: 1,\n gap: 1,\n },\n name: {\n fontSize: 14,\n fontWeight: '500',\n },\n role: {\n fontSize: 11,\n textTransform: 'capitalize',\n },\n removeBtn: {\n padding: 6,\n },\n});\n","/**\n * Spread onto every SDK `<Modal>` so its Android window is edge-to-edge\n * like the host app (Expo SDK 54 / RN 0.81 enables edge-to-edge): the\n * modal then draws under both system bars on every device, and each\n * surface pads for `useSafeInsets()` itself. Without these the modal\n * window's bar handling differs by RN version and nav mode, so the\n * same padding would clear the nav bar on one phone and not another.\n *\n * `navigationBarTranslucent` arrived in RN 0.77 and the SDK still\n * type-checks against 0.76, hence a spread (no excess-prop check)\n * rather than JSX props. Older RN ignores the unknown prop.\n */\nexport const EDGE_TO_EDGE_MODAL = {\n statusBarTranslucent: true,\n navigationBarTranslucent: true,\n} as const;\n","// The real safe-area hook, re-exported under the SDK's historical\n// name.\n//\n// This used to lazy-require react-native-safe-area-context inside a\n// try/catch \"in case the host app lacks it\" — but in the ESM bundle\n// `require` doesn't exist at runtime, so the catch silently served\n// hardcoded fallbacks instead: 34pt on iOS (coincidentally right for\n// iPhones, which masked the bug) and 0 on Android, which put the\n// composer underneath the navigation bar on every Android device.\n// The library is a hard peer in practice, so this indirection\n// protected nothing.\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nexport interface EdgeInsets {\n top: number;\n bottom: number;\n left: number;\n right: number;\n}\n\nexport const useSafeInsets: () => EdgeInsets = useSafeAreaInsets;\n","import { useMemo, useRef } from 'react';\nimport { Animated, PanResponder } from 'react-native';\n\ninterface Options {\n /** Called once the dismiss animation completes. */\n onClose: () => void;\n /**\n * Sheet height in pixels — used as the off-screen target when\n * animating dismissal. Pass `Dimensions.get('window').height * 0.85`\n * for a standard 85% bottom sheet.\n */\n sheetHeight: number;\n /**\n * Fraction of sheetHeight the user must drag past to commit\n * dismissal on release. Defaults to 0.22. Quick flicks (high\n * vertical velocity) also commit regardless of distance.\n */\n dismissThreshold?: number;\n}\n\n/**\n * Adds a pull-down-to-dismiss gesture to a bottom sheet. Returns an\n * Animated `translateY` to apply to the sheet's outer wrapper +\n * `panHandlers` to spread on whichever sub-view captures the drag\n * (typically the drag-pill area at the top, OR the whole sheet if\n * you want anywhere-drag to work).\n *\n * Only claims the gesture on clear downward motion; horizontal /\n * upward drags pass through to children (so a FlatList inside the\n * sheet can still scroll normally).\n */\nexport function useDismissableSheet({ onClose, sheetHeight, dismissThreshold = 0.22 }: Options) {\n const translateY = useRef(new Animated.Value(0)).current;\n\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n onMoveShouldSetPanResponder: (_, g) => {\n // Only claim on clear downward intent. Lets the FlatList\n // inside the sheet handle vertical scrolls upward.\n return g.dy > 6 && g.dy > Math.abs(g.dx);\n },\n onPanResponderMove: (_, g) => {\n // Only follow downward drag (positive dy). Upward goes\n // back to 0 — sheet can't be pulled UP past its anchor.\n translateY.setValue(Math.max(0, g.dy));\n },\n onPanResponderRelease: (_, g) => {\n const committed = g.dy > sheetHeight * dismissThreshold || g.vy > 0.6;\n if (committed) {\n // Animate the sheet off-screen, THEN fire onClose. Without\n // this the modal's own slide-out + our reset would fight.\n Animated.timing(translateY, {\n toValue: sheetHeight,\n duration: 180,\n useNativeDriver: true,\n }).start(() => {\n translateY.setValue(0);\n onClose();\n });\n } else {\n Animated.spring(translateY, {\n toValue: 0,\n useNativeDriver: true,\n speed: 22,\n bounciness: 4,\n }).start();\n }\n },\n onPanResponderTerminate: () => {\n Animated.spring(translateY, {\n toValue: 0,\n useNativeDriver: true,\n speed: 22,\n bounciness: 4,\n }).start();\n },\n }),\n [onClose, sheetHeight, dismissThreshold, translateY],\n );\n\n return { translateY, panHandlers: panResponder.panHandlers };\n}\n","import type { Uuid } from '@poolse/sdk';\nimport { useConversation, useMembers } from '@poolse/react';\nimport {\n Animated,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { MemberList } from './MemberList.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useDismissableSheet } from './internal/useDismissableSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface GroupDetailsSheetProps {\n visible: boolean;\n onClose: () => void;\n conversationId: Uuid;\n /** Resolve external_id → display name. Same shape as MemberList. */\n labelFor?: (externalId: string) => string;\n /** Resolve external_id → avatar URL. Same shape as MemberList. */\n avatarFor?: (externalId: string) => string | null;\n /**\n * Predicate for the per-row remove button. Defaults to \"never show\"\n * — wire it on the parent for owners/admins. Receives the\n * Membership row so you can scope to roles or exclude self.\n */\n canRemoveMember?: (m: { user_id: string; external_id: string; role: string }) => boolean;\n}\n\n/**\n * Bottom-sheet (85% of screen) that opens when the user taps the\n * group chat header. Shows group name + member count at the top,\n * then a scrollable roster with avatars, display names (resolved\n * through `labelFor` / `userResolver`), role badges, and live\n * presence dots (driven by `MemberList` internally).\n */\nexport function GroupDetailsSheet({\n visible,\n onClose,\n conversationId,\n labelFor,\n avatarFor,\n canRemoveMember,\n}: GroupDetailsSheetProps) {\n const theme = usePoolseTheme();\n const { conversation } = useConversation(conversationId);\n const { members } = useMembers(conversationId);\n const insets = useSafeInsets();\n const { height: screenHeight } = useWindowDimensions();\n const { translateY, panHandlers } = useDismissableSheet({\n onClose,\n sheetHeight: screenHeight * 0.85,\n });\n\n const title = conversation?.name ?? 'Conversation';\n const subtitle = `${members.length} ${members.length === 1 ? 'member' : 'members'}`;\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app; the sheet pads its\n // bottom by the nav-bar inset so the last member row clears it.\n {...EDGE_TO_EDGE_MODAL}\n >\n <View style={styles.modalRoot}>\n <Pressable\n style={styles.backdrop}\n onPress={onClose}\n accessibilityLabel=\"Close group details\"\n />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n // Header stays below the status bar even on short screens.\n maxHeight: screenHeight - insets.top - 8,\n paddingBottom: insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* Pan handlers spread on the drag-pill region so list\n scrolling underneath isn't affected. */}\n <View {...panHandlers} style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={styles.headerRow}>\n <Pressable\n onPress={onClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.headerTitle,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n Group details\n </Text>\n </View>\n\n <View style={styles.summary}>\n <Avatar src={null} name={title} seed={conversationId} size=\"lg\" />\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n numberOfLines={1}\n >\n {title}\n </Text>\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]}>{subtitle}</Text>\n </View>\n\n <View style={[styles.divider, { backgroundColor: theme.colors.border }]} />\n\n <View style={styles.sectionLabelRow}>\n <Text\n style={[\n styles.sectionLabel,\n { color: theme.colors.ink2, fontFamily: theme.type.fontBody },\n ]}\n >\n Members\n </Text>\n </View>\n\n <View style={{ flex: 1 }}>\n <MemberList\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(canRemoveMember ? { canRemove: canRemoveMember } : {})}\n emptyState=\"No members yet.\"\n />\n </View>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n height: '85%',\n overflow: 'hidden',\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 4,\n paddingBottom: 12,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n headerTitle: {\n fontSize: 16,\n fontWeight: '600',\n },\n summary: {\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingBottom: 16,\n gap: 8,\n },\n title: {\n fontSize: 20,\n fontWeight: '700',\n },\n subtitle: {\n fontSize: 13,\n },\n divider: {\n height: StyleSheet.hairlineWidth,\n },\n sectionLabelRow: {\n paddingHorizontal: 16,\n paddingTop: 14,\n paddingBottom: 6,\n },\n sectionLabel: {\n fontSize: 11,\n fontWeight: '700',\n letterSpacing: 0.5,\n textTransform: 'uppercase',\n },\n});\n","import type { Uuid } from '@poolse/sdk';\nimport { useConversation, useMe, useMembers, usePresence, useUser } from '@poolse/react';\nimport { useState } from 'react';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { GroupDetailsSheet } from './GroupDetailsSheet.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ChatHeaderProps {\n conversationId: Uuid;\n /**\n * Override the title resolver — useful when you want to derive the\n * direct-chat name from your own user directory instead of going\n * through the SDK's `userResolver`. When omitted, falls back to:\n * * direct → the other member's display name (via `useUser`)\n * * group → `conversation.name`\n */\n labelFor?: (externalId: string) => string;\n /** Optional avatar URL resolver for the other party (direct only). */\n avatarFor?: (externalId: string) => string | null;\n /** Right-side icon button — typically opens a member-list sheet. */\n onMembersPress?: () => void;\n /**\n * Tap handler for the whole header. Behavior:\n * * Direct chat → calls this if provided, otherwise no-op.\n * * Group chat → calls this if provided. If omitted, the header\n * opens a built-in group-details sheet showing the member\n * roster with live presence.\n */\n onPress?: () => void;\n /**\n * When provided, renders a back arrow on the LEFT of the header\n * that calls this handler on tap. Used by `<PoolseInbox>` to\n * navigate back to the conversation list; safe to wire from your\n * own navigator too.\n */\n onBack?: () => void;\n}\n\n/**\n * Top-of-chat header bar.\n * * 1:1 direct → other user's display name + avatar + presence dot.\n * * Group → conversation name + \"N members\" + group-tile avatar.\n *\n * Sits above `<MessageList>` inside `<ConversationView>` by default;\n * pass `header={false}` to `<ConversationView>` if you mount your own.\n */\nexport function ChatHeader({\n conversationId,\n labelFor,\n avatarFor,\n onMembersPress,\n onPress,\n onBack,\n}: ChatHeaderProps) {\n const theme = usePoolseTheme();\n const { conversation } = useConversation(conversationId);\n const { members } = useMembers(conversationId);\n const { me } = useMe();\n const { online } = usePresence(conversationId);\n const [detailsOpen, setDetailsOpen] = useState(false);\n\n const isDirect = conversation?.type === 'direct';\n const otherMember = isDirect ? members.find((m) => m.user_id !== me?.id) : null;\n const otherExtId = otherMember?.external_id ?? null;\n // useUser is safe with null — short-circuits to no-op state. Keeps the\n // hook unconditional regardless of conversation type.\n const otherUser = useUser(otherExtId);\n\n if (!conversation) {\n return (\n <View\n style={[\n styles.root,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n />\n );\n }\n\n const fallbackName = otherExtId ?? '';\n const directName =\n otherUser.profile?.displayName ??\n (otherExtId ? (labelFor?.(otherExtId) ?? fallbackName) : 'Direct');\n const title = isDirect ? directName : (conversation.name ?? 'Conversation');\n\n const isOnline = isDirect && otherExtId ? online.has(otherExtId) : false;\n const subtitle = isDirect\n ? isOnline\n ? 'Online'\n : null\n : `${members.length} ${members.length === 1 ? 'member' : 'members'}`;\n\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? otherUser.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conversationId) : conversationId;\n\n // For groups, default tap = open the built-in details sheet.\n // For directs (or when caller supplied onPress), call onPress.\n // A View wrapper is used only when there's no tap target at all\n // (direct chat with no onPress) so we don't render a no-op\n // Pressable that swallows touches.\n const isGroup = !isDirect;\n const headerOnPress = onPress ?? (isGroup ? () => setDetailsOpen(true) : undefined);\n const Wrapper: typeof View | typeof Pressable = headerOnPress ? Pressable : View;\n\n return (\n <>\n <Wrapper\n {...(headerOnPress ? { onPress: headerOnPress } : {})}\n style={[\n styles.root,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n {onBack ? (\n <Pressable onPress={onBack} hitSlop={12} style={styles.backBtn} accessibilityLabel=\"Back\">\n <PoolseIcon name=\"reply\" size={20} color={theme.colors.ink} />\n </Pressable>\n ) : null}\n <Avatar src={avatarUrl} name={title} seed={avatarSeed} online={isOnline} size=\"md\" />\n <View style={styles.titleCol}>\n <Text\n style={[styles.title, { color: theme.colors.ink, fontFamily: theme.type.fontDisplay }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n {subtitle ? (\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {subtitle}\n </Text>\n ) : null}\n </View>\n {onMembersPress ? (\n <Pressable\n onPress={onMembersPress}\n hitSlop={12}\n style={styles.actionBtn}\n accessibilityLabel=\"Show members\"\n >\n <PoolseIcon name=\"users\" size={20} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </Wrapper>\n\n {isGroup ? (\n <GroupDetailsSheet\n visible={detailsOpen}\n onClose={() => setDetailsOpen(false)}\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n ) : null}\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n titleCol: {\n flex: 1,\n gap: 2,\n },\n title: {\n fontSize: 16,\n fontWeight: '600',\n },\n subtitle: {\n fontSize: 12,\n fontWeight: '500',\n },\n actionBtn: {\n width: 36,\n height: 36,\n borderRadius: 18,\n alignItems: 'center',\n justifyContent: 'center',\n },\n backBtn: {\n width: 36,\n height: 36,\n alignItems: 'center',\n justifyContent: 'center',\n marginLeft: -6,\n },\n});\n","import type { Conversation, Uuid } from '@poolse/sdk';\nimport { formatCallLogPreview, useConversations, useMe, useUser } from '@poolse/react';\nimport { type ReactNode } from 'react';\nimport {\n ActivityIndicator,\n FlatList,\n Image,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ConversationListProps {\n selectedId?: string | null;\n onSelect?: (conv: Conversation) => void;\n /** Optional override for each row's rendering. */\n renderItem?: (conv: Conversation, selected: boolean) => ReactNode;\n /** Custom empty state when there are no conversations. */\n emptyState?: ReactNode | string;\n /** Controlled-mode: skip `useConversations()` and render from these. */\n conversations?: Conversation[];\n loading?: boolean;\n error?: Error | null;\n /** Per-conversation unread counts rendered as a Pulse Coral pill. */\n unreadCounts?: Record<Uuid, number>;\n /**\n * Explicit overrides for direct-chat names + avatars, keyed by the\n * OTHER member's external_id. When omitted, the row falls back to\n * `PoolseConfig.userResolver` and finally to the external_id.\n */\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}\n\nexport function ConversationList({\n selectedId,\n onSelect,\n renderItem,\n emptyState,\n conversations: controlled,\n loading: controlledLoading,\n error: controlledError,\n unreadCounts,\n labelFor,\n avatarFor,\n}: ConversationListProps) {\n const theme = usePoolseTheme();\n const auto = useConversations();\n const { me } = useMe();\n const meExternalId = me?.external_id ?? null;\n const meId = me?.id ?? null;\n const isControlled = controlled !== undefined;\n const conversations = isControlled ? controlled : auto.conversations;\n const loading = isControlled ? (controlledLoading ?? false) : auto.loading;\n const error = isControlled ? (controlledError ?? null) : auto.error;\n const counts = unreadCounts ?? (isControlled ? undefined : auto.unreadCounts);\n\n if (loading && conversations.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (error) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <Text style={{ color: theme.colors.error, fontFamily: theme.type.fontBody }}>\n Failed to load conversations.\n </Text>\n </View>\n );\n }\n\n if (conversations.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' || emptyState == null ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {(emptyState as string) ?? 'No conversations yet.'}\n </Text>\n ) : (\n emptyState\n )}\n </View>\n );\n }\n\n return (\n <FlatList\n data={conversations}\n keyExtractor={(c) => c.id}\n style={{ backgroundColor: theme.colors.paper }}\n renderItem={({ item }) => {\n const selected = selectedId === item.id;\n if (renderItem) {\n return <>{renderItem(item, selected)}</>;\n }\n return (\n <ConversationRow\n conv={item}\n selected={selected}\n meExternalId={meExternalId}\n meId={meId}\n unread={counts?.[item.id] ?? 0}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(onSelect ? { onSelect } : {})}\n />\n );\n }}\n />\n );\n}\n\nfunction ConversationRow({\n conv,\n selected,\n meExternalId,\n meId = null,\n unread,\n labelFor,\n avatarFor,\n onSelect,\n}: {\n conv: Conversation;\n selected: boolean;\n meExternalId: string | null;\n meId?: string | null;\n unread: number;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onSelect?: (conv: Conversation) => void;\n}) {\n const theme = usePoolseTheme();\n\n // For direct conversations the row title + avatar come from the OTHER\n // member, NOT the conversation itself (which has `name: null` for\n // directs). Find the counterparty's external_id and resolve via the\n // standard priority: explicit prop > userResolver > external_id.\n const isDirect = conv.type === 'direct';\n const otherExtId =\n isDirect && meExternalId\n ? ((conv.member_external_ids ?? []).find((x) => x !== meExternalId) ?? null)\n : null;\n const resolvedOther = useUser(isDirect ? otherExtId : null);\n\n const title = isDirect\n ? otherExtId\n ? (labelFor?.(otherExtId) ?? resolvedOther.profile?.displayName ?? otherExtId)\n : 'Direct chat'\n : (conv.name ?? 'Untitled conversation');\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? resolvedOther.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conv.id) : conv.id;\n\n return (\n <Pressable\n onPress={() => onSelect?.(conv)}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.surface2 : 'transparent',\n },\n ]}\n >\n {avatarUrl ? (\n <Image source={{ uri: avatarUrl }} style={styles.rowAvatar} />\n ) : (\n <Avatar src={null} name={title} seed={avatarSeed} size=\"md\" />\n )}\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n {conv.last_message_preview ? (\n <Text style={[styles.preview, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatCallLogPreview(conv.last_message_preview, meId) ?? conv.last_message_preview}\n </Text>\n ) : conv.last_message_at ? (\n <Text style={[styles.preview, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatRelative(conv.last_message_at)}\n </Text>\n ) : null}\n </View>\n {unread > 0 ? (\n <View style={[styles.unreadPill, { backgroundColor: theme.colors.unreadPill }]}>\n <Text style={[styles.unreadText, { color: theme.colors.unreadPillText }]}>\n {unread > 99 ? '99+' : String(unread)}\n </Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nfunction formatRelative(iso: string): string {\n try {\n const d = new Date(iso);\n const now = Date.now();\n const diff = now - d.getTime();\n if (diff < 60_000) return 'just now';\n if (diff < 3600_000) return `${Math.floor(diff / 60_000)}m`;\n if (diff < 86_400_000) return `${Math.floor(diff / 3600_000)}h`;\n return `${Math.floor(diff / 86_400_000)}d`;\n } catch {\n return '';\n }\n}\n\nconst styles = StyleSheet.create({\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 10,\n gap: 10,\n },\n rowAvatar: {\n width: 40,\n height: 40,\n borderRadius: 20,\n },\n body: {\n flex: 1,\n gap: 2,\n },\n name: {\n fontSize: 15,\n fontWeight: '600',\n },\n preview: {\n fontSize: 12,\n },\n unreadPill: {\n minWidth: 22,\n height: 22,\n borderRadius: 11,\n paddingHorizontal: 6,\n alignItems: 'center',\n justifyContent: 'center',\n },\n unreadText: {\n fontSize: 11,\n fontWeight: '700',\n },\n});\n","import { createContext, useCallback, useContext, useRef, type ReactNode } from 'react';\nimport { useAttachmentUpload } from '@poolse/react';\n\ntype UploadState = ReturnType<typeof useAttachmentUpload>;\n\n/**\n * Shared upload-queue value. The SDK's `useAttachmentUpload` creates\n * a private queue per call site — without a provider, each component\n * (picker / composer / strip) ends up with its own queue and uploads\n * never reach the send-with-attachment_ids path.\n *\n * `setPreview` / `getPreview` are an RN-only side channel: the SDK\n * strips the original local file URI when it converts to a Blob, but\n * the queue strip needs the URI to render an Image thumbnail. The\n * picker stashes it here keyed by filename so the strip can read it\n * back during render.\n */\ninterface UploadContextValue {\n upload: UploadState;\n setPreview: (filename: string, uri: string) => void;\n getPreview: (filename: string) => string | null;\n}\n\nconst UploadCtx = createContext<UploadContextValue | null>(null);\n\nexport function UploadProvider({ children }: { children: ReactNode }) {\n const upload = useAttachmentUpload();\n const previews = useRef<Map<string, string>>(new Map());\n\n const setPreview = useCallback((filename: string, uri: string) => {\n previews.current.set(filename, uri);\n }, []);\n\n const getPreview = useCallback((filename: string) => {\n return previews.current.get(filename) ?? null;\n }, []);\n\n return (\n <UploadCtx.Provider value={{ upload, setPreview, getPreview }}>{children}</UploadCtx.Provider>\n );\n}\n\n/**\n * Read the shared upload state. Falls back to a component-local\n * `useAttachmentUpload` when no provider is mounted so the component\n * still functions standalone (but loses preview thumbnails since\n * setPreview won't propagate).\n */\nexport function useSharedUpload(): UploadState {\n const fromCtx = useContext(UploadCtx);\n const fallback = useAttachmentUpload();\n return fromCtx?.upload ?? fallback;\n}\n\n/**\n * Preview-URI side channel for the queue strip's thumbnails. No-op\n * when no provider is mounted (strip falls back to icon placeholder).\n */\nexport function useUploadPreview() {\n const ctx = useContext(UploadCtx);\n return {\n setPreview: ctx?.setPreview ?? (() => undefined),\n getPreview: ctx?.getPreview ?? (() => null),\n };\n}\n","import { Image as RNImage, Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n// Static imports — Metro's bundle graph can only trace literal\n// `import` / `require` calls. The earlier `new Function('m', 'return\n// import(m)')(name)` trick bypassed Metro entirely, so the picker\n// modules were never bundled even when the consumer installed them.\n//\n// Trade-off: if a consumer mounts <AttachmentPicker> without these\n// modules installed, the bundle fails at build time with a clear\n// \"module not found\" rather than the silent runtime warning we had\n// before. Consumers who don't want attachments at all should pass\n// `attachments={false}` to <ConversationView> so this file is never\n// rendered (and tree-shaking can drop the imports in production\n// builds with a real bundler — Metro doesn't tree-shake but the\n// imports add ~12kb total which is acceptable).\nimport * as ImagePicker from 'expo-image-picker';\nimport * as DocumentPicker from 'expo-document-picker';\nimport { manipulateAsync, SaveFormat } from 'expo-image-manipulator';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useSharedUpload, useUploadPreview } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface AttachmentPickerProps {\n visible: boolean;\n onClose: () => void;\n /**\n * Optional adapter that produces upload inputs from a picked file.\n * Override to plug in custom storage / transcoding. Default reads\n * from `expo-image-picker` / `expo-document-picker`.\n */\n onPickInputs?: (kind: 'image' | 'document' | 'camera') => Promise<\n {\n body: { uri: string; name: string; type: string } | Blob | unknown;\n contentType: string;\n byteSize: number;\n filename?: string;\n }[]\n >;\n /**\n * Show the Camera item alongside Photo and File. Defaults true.\n * Disable if your app explicitly doesn't want camera access (some\n * App Store reviewers require an explicit usage description even\n * for the picker entry). Add `NSCameraUsageDescription` to your\n * iOS Info.plist when leaving this on.\n */\n camera?: boolean;\n}\n\n/**\n * Picker sheet wrapping `expo-image-picker` and `expo-document-picker`.\n * Both must be installed (`npx expo install expo-image-picker\n * expo-document-picker`) when this component is mounted — they're\n * declared as optional peers because consumers who pass\n * `attachments={false}` to ConversationView never render this file.\n */\nexport function AttachmentPicker({\n visible,\n onClose,\n onPickInputs,\n camera = true,\n}: AttachmentPickerProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n // Shared queue (via UploadProvider) so the composer sees these\n // uploads and can include them in the next send. Falls back to a\n // local queue when the picker is mounted outside ConversationView.\n const upload = useSharedUpload();\n const { setPreview } = useUploadPreview();\n\n const pickFromKind = async (kind: 'image' | 'document' | 'camera') => {\n try {\n const adapter = onPickInputs ?? defaultAdapter;\n const inputs = await adapter(kind);\n for (const input of inputs) {\n // Stash the original local URI on the shared context so the\n // UploadQueueStrip can render a real thumbnail. The SDK only\n // sees the Blob from here on out.\n const previewUri = (input as { _previewUri?: string })._previewUri ?? null;\n if (previewUri && input.filename) {\n setPreview(input.filename, previewUri);\n }\n void upload.upload(input as never);\n }\n } catch (err) {\n console.warn('[poolse/picker]', err);\n } finally {\n onClose();\n }\n };\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the sheet's\n // bottom padding below is what actually clears the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable style={styles.backdrop} onPress={onClose}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Cancel must sit above the nav bar / home indicator.\n paddingBottom: 24 + insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n theme.shadows.lg,\n ]}\n >\n {camera ? (\n <Pressable style={styles.item} onPress={() => pickFromKind('camera')}>\n <PoolseIcon name=\"camera\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>Camera</Text>\n </Pressable>\n ) : null}\n <Pressable style={styles.item} onPress={() => pickFromKind('image')}>\n <PoolseIcon name=\"image\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>Photo or video</Text>\n </Pressable>\n <Pressable style={styles.item} onPress={() => pickFromKind('document')}>\n <PoolseIcon name=\"attachment\" size={20} color={theme.colors.ink2} />\n <Text style={[styles.itemText, { color: theme.colors.ink }]}>File</Text>\n </Pressable>\n <Pressable style={styles.cancel} onPress={onClose}>\n <Text style={[styles.itemText, { color: theme.colors.brand }]}>Cancel</Text>\n </Pressable>\n </View>\n </Pressable>\n </Modal>\n );\n}\n\n// RN gives us a local file URI. The SDK's upload PUTs the `body` raw\n// to a presigned S3/R2 URL — those only accept raw bytes, NOT\n// multipart. If we passed the `{ uri, name, type }` object directly,\n// fetch would serialize it as multipart and the bucket would reject\n// the upload silently. So we read the URI as a Blob first (same shape\n// that `<input type=\"file\">` would give on web) and pass that.\nasync function uriToBlob(uri: string): Promise<Blob> {\n const res = await fetch(uri);\n if (!res.ok && res.status !== 0) {\n throw new Error(`failed to read picked file (HTTP ${res.status})`);\n }\n return res.blob();\n}\n\n// Phone-sized output — the fullscreen viewer on a 3x retina display\n// only needs ~1300px on the long edge, and chat bubbles top out at\n// ~960px. 1600 leaves headroom for pinch-zoom without sending the\n// 4000+ px monsters that some screenshots ship with.\nconst COMPRESSION_LONG_SIDE_PX = 1600;\nconst COMPRESSION_QUALITY = 0.75;\n\nfunction getImageSize(uri: string): Promise<{ width: number; height: number }> {\n return new Promise((resolve, reject) => {\n RNImage.getSize(uri, (width, height) => resolve({ width, height }), reject);\n });\n}\n\n/**\n * Resize → WebP @ 0.75 every image before upload. iOS screenshots\n * can be 8–12 MB PNGs and the fullscreen `<Image>` decode of those\n * blocks the JS thread / silently fails on older devices — clipping\n * the long edge to 1600 keeps the per-message payload under ~250kb\n * for typical photos and is still crisp on every phone display.\n *\n * Never upscales. Falls back to the original blob on any failure so\n * a flaky manipulator pass never blocks a send.\n */\nasync function compressImage({\n uri,\n width,\n height,\n filename,\n}: {\n uri: string;\n width?: number;\n height?: number;\n filename?: string;\n}): Promise<{ blob: Blob; contentType: string; filename: string }> {\n let w = width;\n let h = height;\n if (!w || !h) {\n try {\n const size = await getImageSize(uri);\n w = size.width;\n h = size.height;\n } catch {\n w = 0;\n h = 0;\n }\n }\n const longSide = Math.max(w ?? 0, h ?? 0);\n const scale = longSide > COMPRESSION_LONG_SIDE_PX ? COMPRESSION_LONG_SIDE_PX / longSide : 1;\n const actions =\n scale < 1 && w && h\n ? [{ resize: { width: Math.round(w * scale), height: Math.round(h * scale) } }]\n : [];\n\n const result = await manipulateAsync(uri, actions, {\n compress: COMPRESSION_QUALITY,\n format: SaveFormat.WEBP,\n });\n const blob = await uriToBlob(result.uri);\n const base = (filename ?? `image-${Date.now()}`).replace(/\\.[^.]+$/, '');\n return {\n blob,\n contentType: 'image/webp',\n filename: `${base}.webp`,\n };\n}\n\nasync function assetsToInputs(assets: ReadonlyArray<ImagePicker.ImagePickerAsset>) {\n return Promise.all(\n assets.map(async (asset) => {\n try {\n const compressed = await compressImage({\n uri: asset.uri,\n width: asset.width,\n height: asset.height,\n filename: asset.fileName ?? `image-${Date.now()}`,\n });\n return {\n body: compressed.blob,\n contentType: compressed.contentType,\n byteSize: compressed.blob.size,\n filename: compressed.filename,\n _previewUri: asset.uri,\n };\n } catch (err) {\n console.warn('[poolse/picker] image compression failed, sending original:', err);\n const blob = await uriToBlob(asset.uri);\n const contentType = asset.mimeType ?? blob.type ?? 'image/jpeg';\n return {\n body: blob,\n contentType,\n // The uploaded bytes: the server refuses a file bigger than declared.\n byteSize: blob.size || asset.fileSize || 0,\n filename: asset.fileName ?? `image-${Date.now()}.jpg`,\n _previewUri: asset.uri,\n };\n }\n }),\n );\n}\n\nasync function defaultAdapter(kind: 'image' | 'document' | 'camera') {\n if (kind === 'camera') {\n // Camera permissions are required on both iOS (Info.plist\n // NSCameraUsageDescription) and Android. requestCameraPermissionsAsync\n // shows the system prompt the first time; subsequent calls\n // resolve immediately with the cached answer.\n const perm = await ImagePicker.requestCameraPermissionsAsync();\n if (!perm.granted) {\n console.warn('[poolse/picker] camera permission denied');\n return [];\n }\n const res = await ImagePicker.launchCameraAsync({\n mediaTypes: 'images',\n quality: 1,\n });\n if (res.canceled) return [];\n return assetsToInputs(res.assets);\n }\n if (kind === 'image') {\n const res = await ImagePicker.launchImageLibraryAsync({\n mediaTypes: 'images',\n // Quality 1 — picker hands back the source as-is and we do the\n // compression ourselves below. Letting the picker re-encode\n // first just chains two lossy passes.\n quality: 1,\n });\n if (res.canceled) return [];\n return assetsToInputs(res.assets);\n }\n const res = await DocumentPicker.getDocumentAsync({\n copyToCacheDirectory: true,\n multiple: true,\n });\n if (res.canceled) return [];\n return Promise.all(\n res.assets.map(async (asset) => {\n const isImage = (asset.mimeType ?? '').startsWith('image/');\n if (isImage) {\n try {\n const compressed = await compressImage({\n uri: asset.uri,\n filename: asset.name,\n });\n return {\n body: compressed.blob,\n contentType: compressed.contentType,\n byteSize: compressed.blob.size,\n filename: compressed.filename,\n _previewUri: asset.uri,\n };\n } catch (err) {\n console.warn('[poolse/picker] image compression failed, sending original:', err);\n }\n }\n const blob = await uriToBlob(asset.uri);\n const contentType = asset.mimeType ?? blob.type ?? 'application/octet-stream';\n return {\n body: blob,\n contentType,\n // The uploaded bytes: the server refuses a file bigger than declared.\n byteSize: blob.size || asset.size || 0,\n filename: asset.name,\n _previewUri: asset.uri,\n };\n }),\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n paddingVertical: 8,\n paddingBottom: 24,\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 20,\n paddingVertical: 14,\n gap: 14,\n },\n cancel: {\n paddingHorizontal: 20,\n paddingVertical: 14,\n alignItems: 'center',\n marginTop: 4,\n },\n itemText: {\n fontSize: 15,\n fontWeight: '500',\n },\n});\n","import { StyleSheet, Text, View } from 'react-native';\n\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface DaySeparatorProps {\n label: string;\n}\n\n/**\n * Centered date pill rendered between messages whose `inserted_at`\n * falls on a different calendar day from the previous message. Pair\n * with `formatDayLabel` from `@poolse/react` to compute the label\n * (\"Today\" / \"Yesterday\" / weekday / \"26 May 2024\").\n */\nexport function DaySeparator({ label }: DaySeparatorProps) {\n const theme = usePoolseTheme();\n return (\n <View style={styles.wrap}>\n <View\n style={[\n styles.chip,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: theme.colors.border,\n },\n ]}\n >\n <Text\n style={[\n styles.label,\n {\n color: theme.colors.ink2,\n fontFamily: theme.type.fontBody,\n },\n ]}\n >\n {label}\n </Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignItems: 'center',\n marginVertical: 8,\n },\n chip: {\n paddingHorizontal: 12,\n paddingVertical: 4,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n },\n label: {\n fontSize: 11,\n fontWeight: '600',\n letterSpacing: 0.3,\n },\n});\n","import type { LiveCall } from '@poolse/sdk';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface LiveCallBannerProps {\n call: LiveCall;\n /** How many people are in the room right now. */\n inCall: number;\n onJoin: (call: LiveCall) => void;\n}\n\n/**\n * \"Voice call in progress · 2 on the call [Join]\" — a strip across the\n * top of a conversation while a call runs that the viewer is not on.\n * `<ConversationView onJoinCall>` renders it for you; use it directly\n * to place it elsewhere (with `useLiveCall`).\n */\nexport function LiveCallBanner({ call, inCall, onJoin }: LiveCallBannerProps) {\n const theme = usePoolseTheme();\n const what =\n call.kind === 'room'\n ? call.media === 'video'\n ? 'Video room'\n : 'Voice room'\n : call.media === 'video'\n ? 'Video call in progress'\n : 'Voice call in progress';\n const who =\n inCall > 0\n ? `${inCall} ${call.kind === 'room' ? 'in the room' : 'on the call'}`\n : call.kind === 'room'\n ? 'Starting'\n : 'Ringing';\n return (\n <View\n style={[styles.bar, { backgroundColor: theme.colors.success }]}\n accessibilityRole=\"summary\"\n accessibilityLabel={`${what}, ${who}`}\n >\n <PoolseIcon\n name={call.media === 'video' ? 'video' : 'phone'}\n size={16}\n color=\"#FFFFFF\"\n label={null}\n />\n <View style={styles.text}>\n <Text style={[styles.title, { fontFamily: theme.type.fontBody }]} numberOfLines={1}>\n {what}\n </Text>\n <Text style={[styles.meta, { fontFamily: theme.type.fontBody }]} numberOfLines={1}>\n {who}\n </Text>\n </View>\n <Pressable\n onPress={() => onJoin(call)}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Join call\"\n hitSlop={8}\n style={({ pressed }) => [styles.join, pressed && styles.joinPressed]}\n >\n <Text\n style={[\n styles.joinText,\n { color: theme.colors.success, fontFamily: theme.type.fontBody },\n ]}\n >\n Join\n </Text>\n </Pressable>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n bar: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 10,\n paddingHorizontal: 16,\n paddingVertical: 8,\n },\n text: { flex: 1, minWidth: 0 },\n title: { color: '#FFFFFF', fontSize: 14, fontWeight: '600' },\n meta: { color: 'rgba(255,255,255,0.85)', fontSize: 12 },\n join: {\n backgroundColor: '#FFFFFF',\n borderRadius: 999,\n paddingHorizontal: 16,\n paddingVertical: 6,\n },\n joinPressed: { opacity: 0.8 },\n joinText: { fontSize: 14, fontWeight: '700' },\n});\n","import { Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { useSharedUpload, useUploadPreview } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n/**\n * Horizontal scrolling preview row of pending / in-flight / ready\n * uploads. Image attachments render as 64×64 thumbnails sourced from\n * the original local file URI; file attachments render as a row card\n * with icon + name + size. A small × overlay on each tile lets the\n * user drop the upload before send.\n *\n * Reads queue state from the shared `<UploadProvider>` (mounted by\n * `<ConversationView>`), so the composer's \"ready attachment ids\"\n * pickup and the strip's display always agree.\n */\nexport function UploadQueueStrip() {\n const theme = usePoolseTheme();\n const upload = useSharedUpload();\n const { getPreview } = useUploadPreview();\n\n if (upload.queue.length === 0) return null;\n\n return (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.scroll}\n // overflow:visible (+ explicit paddingTop on the contentContainer)\n // so the X close button can sit at -6/-6 outside the tile without\n // being clipped by the scroll bounds.\n style={[styles.scrollStyle, { marginBottom: 8 }]}\n >\n {upload.queue.map((item) => {\n const isError = item.status === 'error';\n const isUploading = item.status === 'uploading' || item.status === 'pending';\n const isImage = (item.contentType ?? '').startsWith('image/');\n const previewUri = getPreview(item.filename);\n const canTerminate = isUploading || item.status === 'ready' || isError;\n\n const handleClose = () => {\n if (item.status === 'ready' || isError) upload.remove(item.localId);\n else upload.cancel(item.localId);\n };\n\n return (\n <View key={item.localId} style={styles.tileWrap}>\n {isImage && previewUri ? (\n <ImageTile uri={previewUri} uploading={isUploading} error={isError} />\n ) : (\n <FileTile\n filename={item.filename}\n size={item.byteSize}\n uploading={isUploading}\n error={isError}\n />\n )}\n\n {canTerminate ? (\n <Pressable\n onPress={handleClose}\n hitSlop={8}\n // Hardcoded dark dot + white X. Pulling from the\n // theme made the close affordance invisible against\n // light-on-light or dark-on-dark custom palettes\n // (e.g. a white-on-white surface/onBrand pair).\n // This is a thumbnail badge — not chrome — so it\n // should look the same in every theme.\n style={styles.closeBtn}\n accessibilityLabel={isError ? 'Remove failed upload' : 'Cancel upload'}\n >\n <PoolseIcon name=\"close\" size={11} color=\"#fff\" />\n </Pressable>\n ) : null}\n\n {isUploading ? (\n <View style={styles.progressOverlay}>\n <View style={[styles.spinner, { borderColor: theme.colors.onBrand }]} />\n </View>\n ) : null}\n\n {isError ? (\n <View style={[styles.errorOverlay, { backgroundColor: 'rgba(229,72,77,0.85)' }]}>\n <Text style={[styles.errorText, { color: '#fff' }]}>Failed</Text>\n </View>\n ) : null}\n </View>\n );\n })}\n </ScrollView>\n );\n}\n\nfunction ImageTile({ uri, uploading, error }: { uri: string; uploading: boolean; error: boolean }) {\n const theme = usePoolseTheme();\n return (\n <Image\n source={{ uri }}\n style={[\n styles.imageTile,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: error ? theme.colors.error : 'transparent',\n opacity: uploading ? 0.65 : 1,\n },\n ]}\n resizeMode=\"cover\"\n />\n );\n}\n\nfunction FileTile({\n filename,\n size,\n uploading,\n error,\n}: {\n filename: string;\n size: number;\n uploading: boolean;\n error: boolean;\n}) {\n const theme = usePoolseTheme();\n return (\n <View\n style={[\n styles.fileTile,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: error\n ? theme.colors.error\n : uploading\n ? theme.colors.brand\n : theme.colors.border,\n },\n ]}\n >\n <View style={[styles.fileIconBox, { backgroundColor: theme.colors.brandSoft }]}>\n <PoolseIcon name=\"attachment\" size={18} color={theme.colors.brand} />\n </View>\n <View style={styles.fileInfo}>\n <Text\n style={[styles.fileName, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {filename}\n </Text>\n <Text style={[styles.fileSize, { color: theme.colors.ink3 }]}>{formatBytes(size)}</Text>\n </View>\n </View>\n );\n}\n\nfunction formatBytes(n: number): string {\n if (!n || n < 0) return '';\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;\n if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;\n return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;\n}\n\nconst TILE = 64;\n\nconst styles = StyleSheet.create({\n scrollStyle: {\n overflow: 'visible',\n },\n scroll: {\n paddingHorizontal: 8,\n // paddingTop creates room for the X to overflow the tile without\n // being clipped on Android (where overflow:visible isn't enough).\n paddingTop: 8,\n gap: 10,\n flexDirection: 'row',\n },\n tileWrap: {\n position: 'relative',\n overflow: 'visible',\n },\n imageTile: {\n width: TILE,\n height: TILE,\n borderRadius: 10,\n borderWidth: 1.5,\n },\n fileTile: {\n height: TILE,\n minWidth: 200,\n maxWidth: 260,\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 10,\n paddingRight: 28,\n borderRadius: 10,\n borderWidth: 1,\n gap: 10,\n },\n fileIconBox: {\n width: 36,\n height: 36,\n borderRadius: 8,\n alignItems: 'center',\n justifyContent: 'center',\n },\n fileInfo: {\n flex: 1,\n gap: 2,\n },\n fileName: {\n fontSize: 13,\n fontWeight: '600',\n },\n fileSize: {\n fontSize: 11,\n },\n closeBtn: {\n // Outside the tile (top-right corner overflowing). Parent\n // scroll container + tileWrap set overflow:visible and the\n // scroll contentContainer has paddingTop:8 so the overflow\n // isn't clipped on Android.\n position: 'absolute',\n top: -6,\n right: -6,\n width: 22,\n height: 22,\n borderRadius: 11,\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: 'rgba(40,40,40,0.85)',\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.3,\n shadowRadius: 2,\n elevation: 3,\n },\n progressOverlay: {\n ...StyleSheet.absoluteFillObject,\n alignItems: 'center',\n justifyContent: 'center',\n pointerEvents: 'none',\n },\n spinner: {\n width: 24,\n height: 24,\n borderRadius: 12,\n borderWidth: 2.5,\n borderTopColor: 'transparent',\n // RN can't loop a rotation purely in StyleSheet, but the static\n // 3/4-circle still reads as \"in progress.\" A real Animated.View\n // rotation lands in a follow-up.\n },\n errorOverlay: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n paddingVertical: 3,\n alignItems: 'center',\n },\n errorText: {\n fontSize: 10,\n fontWeight: '700',\n },\n});\n","import { useEffect, useState } from 'react';\nimport { Keyboard, Platform } from 'react-native';\n\n/**\n * True while the software keyboard is up.\n *\n * Surfaces use this to drop their bottom safe-area padding while the\n * keyboard covers the navigation bar / home indicator — otherwise the\n * inset shows up as a dead gap between the content and the keyboard.\n * iOS fires `Will*` events (lets the padding change ride the keyboard\n * animation); Android only reliably fires `Did*`.\n */\nexport function useKeyboardOpen(): boolean {\n const [open, setOpen] = useState(false);\n useEffect(() => {\n const show = Keyboard.addListener(\n Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow',\n () => setOpen(true),\n );\n const hide = Keyboard.addListener(\n Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide',\n () => setOpen(false),\n );\n return () => {\n show.remove();\n hide.remove();\n };\n }, []);\n return open;\n}\n","import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport { Pressable, StyleSheet, Text, TextInput, View } from 'react-native';\nimport type { AttachmentUploadInput, Message, Uuid } from '@poolse/sdk';\nimport { useUser } from '@poolse/react';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { UploadQueueStrip } from './UploadQueueStrip.js';\nimport { useSharedUpload } from './internal/uploadContext.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useKeyboardOpen } from './internal/useKeyboardOpen.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MessageComposerProps {\n /**\n * Called when the user taps Send. Second arg carries\n * `quoted_message_id` (when replying) and `attachment_ids`\n * (resolved from the composer's upload queue). Awaited so the\n * composer disables until the send round-trips.\n */\n onSend: (\n body: string,\n opts?: { quoted_message_id?: Uuid; attachment_ids?: Uuid[] },\n ) => Promise<unknown> | void;\n /** Called on every keystroke. Hook to `useTyping().signalTyping`. */\n onTyping?: () => void;\n placeholder?: string;\n disabled?: boolean;\n /** Renders a quote chip above the input; cleared by the caller in `onSend`. */\n replyingTo?: Message | null;\n /** User tapped (x) on the quote chip. */\n onCancelReply?: () => void;\n /** Display label for the quoted sender, keyed by `external_id`. */\n labelFor?: (externalId: string) => string;\n /** Show the paperclip + queue strip. Defaults true. */\n attachments?: boolean;\n /** Tap on the paperclip — wire to `<AttachmentPicker>` from the same package. */\n onAttachPress?: () => void;\n /**\n * Distance from the top of the screen to the top of the\n * KeyboardAvoidingView — typically the height of any navigation\n * header sitting above the chat. Pass this when the iOS keyboard\n * suggestions strip ends up covering the composer (a sign the\n * computed offset is wrong). Defaults to 0; on Android it's\n * ignored.\n */\n keyboardOffset?: number;\n /**\n * When set, the composer enters edit mode: prefills the input with\n * the message body and renders an \"Editing message\" chip above\n * (mirrors `replyingTo`). Tapping Send calls `onSaveEdit(body)`\n * instead of `onSend`; `onCancelEdit` clears the chip and restores\n * the previous draft. Pass `null` (or omit) when not editing.\n */\n editingMessage?: Message | null;\n onCancelEdit?: () => void;\n onSaveEdit?: (body: string) => Promise<unknown> | void;\n}\n\n/**\n * Imperative handle for parents that want to add files to the\n * composer's upload queue externally (drag/drop on a wrapper,\n * deep-link, attachment shortcut).\n */\nexport interface MessageComposerHandle {\n /** Enqueue ready-to-upload inputs. The picker component is the usual caller; this is the escape hatch. */\n addFiles: (inputs: AttachmentUploadInput[]) => void;\n focus: () => void;\n clear: () => void;\n}\n\nexport const MessageComposer = forwardRef<MessageComposerHandle, MessageComposerProps>(\n function MessageComposer(\n {\n onSend,\n onTyping,\n placeholder = 'Type a message…',\n disabled = false,\n replyingTo,\n onCancelReply,\n labelFor,\n attachments = true,\n onAttachPress,\n keyboardOffset: _keyboardOffset = 0,\n editingMessage = null,\n onCancelEdit,\n onSaveEdit,\n },\n ref,\n ) {\n const theme = usePoolseTheme();\n const inputRef = useRef<TextInput>(null);\n const [value, setValue] = useState('');\n const [sending, setSending] = useState(false);\n const keyboardOpen = useKeyboardOpen();\n const upload = useSharedUpload();\n const insets = useSafeInsets();\n\n useImperativeHandle(\n ref,\n () => ({\n addFiles: (inputs) => {\n if (!attachments) return;\n for (const input of inputs) {\n void upload.upload(input);\n }\n },\n focus: () => inputRef.current?.focus(),\n clear: () => setValue(''),\n }),\n [attachments, upload],\n );\n\n const readyAttachmentIds = upload.queue\n .filter((item) => item.status === 'ready' && item.attachment)\n .map((item) => item.attachment!.id);\n const isUploading = upload.queue.some(\n (item) => item.status === 'uploading' || item.status === 'pending',\n );\n\n // Stash the user's in-progress draft when edit mode opens so we\n // can put it back when they cancel. Without this, cancelling\n // would either wipe what they were typing or leave the edited\n // body in the input.\n const previousDraftRef = useRef<string | null>(null);\n const editingIdRef = useRef<string | null>(null);\n useEffect(() => {\n const id = editingMessage?.id ?? null;\n if (id === editingIdRef.current) return;\n if (id) {\n // Entering edit mode for a new message: snapshot whatever\n // the user was drafting, then prefill with the body.\n previousDraftRef.current = value;\n setValue(editingMessage?.body ?? '');\n // Focus so the keyboard pops up and the cursor lands at the\n // end of the prefilled body.\n inputRef.current?.focus();\n } else {\n // Leaving edit mode — restore the prior draft.\n setValue(previousDraftRef.current ?? '');\n previousDraftRef.current = null;\n }\n editingIdRef.current = id;\n // value intentionally omitted: we only want this to fire when\n // the editingMessage identity changes, not on every keystroke.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editingMessage?.id, editingMessage?.body]);\n\n const isEditing = !!editingMessage;\n const editChanged = isEditing && value.trim() !== (editingMessage?.body?.trim() ?? '');\n\n const submitDisabled =\n disabled ||\n sending ||\n isUploading ||\n (isEditing\n ? !editChanged || value.trim().length === 0\n : value.trim().length === 0 && readyAttachmentIds.length === 0);\n\n const handleSend = async () => {\n if (submitDisabled) return;\n // Snapshot + clear synchronously so the input is empty on the\n // next keystroke even if the send round-trip is slow. Otherwise\n // the user types into the still-present old text and the new\n // characters append to the stale message.\n const body = value.trim();\n setSending(true);\n try {\n if (isEditing && onSaveEdit) {\n // Edit mode: don't clear attachments or the reply chip;\n // we're just updating the body. The parent will clear\n // editingMessage on success, which triggers the effect\n // above to restore the prior draft.\n await onSaveEdit(body);\n } else {\n const replyId = replyingTo?.id;\n const attachmentIds = readyAttachmentIds;\n setValue('');\n upload.reset();\n await onSend(body, {\n ...(replyId ? { quoted_message_id: replyId } : {}),\n ...(attachmentIds.length > 0 ? { attachment_ids: attachmentIds } : {}),\n });\n }\n } finally {\n setSending(false);\n }\n };\n\n // No KeyboardAvoidingView here — ConversationView wraps the whole\n // chat surface in a single KAV so the list + composer shift up\n // together. Wrapping only the composer inside a flex:1 parent\n // with no headroom pushed it below the visible area on iPhone\n // home-indicator devices.\n //\n // When the keyboard is closed we add the bottom safe-area inset\n // to keep the send/attach buttons off the home indicator. When\n // it's open the OS bottom inset is irrelevant (keyboard occupies\n // that space) and we collapse back to the base 10px padding to\n // avoid floating the composer above the keyboard.\n const paddingBottom = keyboardOpen ? 10 : Math.max(10, insets.bottom);\n return (\n <View\n style={[\n styles.wrap,\n {\n backgroundColor: theme.colors.surface,\n borderTopColor: theme.colors.border,\n paddingBottom,\n },\n ]}\n >\n {isEditing ? (\n <EditChip\n message={editingMessage!}\n {...(onCancelEdit ? { onCancel: onCancelEdit } : {})}\n />\n ) : replyingTo ? (\n <ReplyChip\n message={replyingTo}\n {...(labelFor ? { labelFor } : {})}\n {...(onCancelReply ? { onCancel: onCancelReply } : {})}\n />\n ) : null}\n\n {attachments && !isEditing ? <UploadQueueStrip /> : null}\n\n <View style={styles.row}>\n {attachments && onAttachPress ? (\n <Pressable\n onPress={onAttachPress}\n hitSlop={8}\n style={styles.iconBtn}\n accessibilityLabel=\"Attach file\"\n >\n <PoolseIcon name=\"attachment\" size={22} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n\n <TextInput\n ref={inputRef}\n value={value}\n onChangeText={(text) => {\n setValue(text);\n onTyping?.();\n }}\n placeholder={placeholder}\n placeholderTextColor={theme.colors.ink3}\n multiline\n editable={!disabled}\n style={[\n styles.input,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.lg,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n },\n ]}\n />\n\n <Pressable\n onPress={handleSend}\n disabled={submitDisabled}\n style={[\n styles.sendBtn,\n {\n backgroundColor: submitDisabled ? theme.colors.ink3 : theme.colors.brand,\n opacity: submitDisabled ? 0.6 : 1,\n },\n ]}\n accessibilityLabel=\"Send message\"\n >\n <PoolseIcon name=\"send\" size={18} color={theme.colors.onBrand} />\n </Pressable>\n </View>\n </View>\n );\n },\n);\n\nfunction EditChip({ message, onCancel }: { message: Message; onCancel?: () => void }) {\n const theme = usePoolseTheme();\n return (\n <View\n style={[\n styles.replyChip,\n {\n backgroundColor: theme.colors.surface2,\n borderLeftColor: theme.colors.brand,\n },\n ]}\n >\n <View style={{ flex: 1 }}>\n <Text style={[styles.replyName, { color: theme.colors.brand }]}>Editing message</Text>\n <Text style={[styles.replyBody, { color: theme.colors.ink2 }]} numberOfLines={1}>\n {message.body ?? '…'}\n </Text>\n </View>\n {onCancel ? (\n <Pressable onPress={onCancel} hitSlop={8} style={styles.replyCancel}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction ReplyChip({\n message,\n labelFor,\n onCancel,\n}: {\n message: Message;\n labelFor?: (externalId: string) => string;\n onCancel?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n const resolved = useUser(message.sender_external_id);\n const senderName = message.sender_external_id\n ? (labelFor?.(message.sender_external_id) ??\n resolved.profile?.displayName ??\n message.sender_external_id)\n : 'Unknown';\n return (\n <View\n style={[\n styles.replyChip,\n {\n backgroundColor: theme.colors.surface2,\n borderLeftColor: theme.colors.brand,\n },\n ]}\n >\n <View style={{ flex: 1 }}>\n <Text style={[styles.replyName, { color: theme.colors.brand }]}>\n Replying to {senderName}\n </Text>\n <Text style={[styles.replyBody, { color: theme.colors.ink2 }]} numberOfLines={1}>\n {message.body ?? '…'}\n </Text>\n </View>\n {onCancel ? (\n <Pressable onPress={onCancel} hitSlop={8} style={styles.replyCancel}>\n <PoolseIcon name=\"close\" size={16} color={theme.colors.ink2} />\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n borderTopWidth: StyleSheet.hairlineWidth,\n paddingTop: 8,\n paddingHorizontal: 12,\n // paddingBottom is applied inline — it follows the keyboard state\n // (10 px while open, max(10, safeBottomInset) while closed) so the\n // send/attach buttons stay clear of the home indicator without\n // double-padding above the keyboard.\n },\n row: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n gap: 8,\n },\n iconBtn: {\n padding: 8,\n justifyContent: 'center',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n minHeight: 40,\n maxHeight: 120,\n paddingHorizontal: 12,\n paddingTop: 10,\n paddingBottom: 10,\n },\n sendBtn: {\n width: 40,\n height: 40,\n borderRadius: 20,\n justifyContent: 'center',\n alignItems: 'center',\n },\n replyChip: {\n flexDirection: 'row',\n alignItems: 'center',\n borderLeftWidth: 3,\n paddingLeft: 10,\n paddingRight: 6,\n paddingVertical: 6,\n marginBottom: 8,\n borderRadius: 6,\n },\n replyName: {\n fontSize: 11,\n fontWeight: '600',\n marginBottom: 2,\n },\n replyBody: {\n fontSize: 12,\n },\n replyCancel: {\n padding: 6,\n },\n});\n","import type { Membership, Uuid } from '@poolse/sdk';\nimport { useMembers } from '@poolse/react';\nimport { useMemo, useState } from 'react';\nimport {\n FlatList,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { MessageComposer, type MessageComposerProps } from './MessageComposer.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { useKeyboardOpen } from './internal/useKeyboardOpen.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface MentionInputProps extends Omit<MessageComposerProps, 'onSend'> {\n conversationId: Uuid;\n /** Same callback as MessageComposer.onSend, plus optional mention user_ids. */\n onSend: (\n body: string,\n opts?: {\n quoted_message_id?: Uuid;\n attachment_ids?: Uuid[];\n mentions?: Uuid[];\n },\n ) => Promise<unknown> | void;\n}\n\n/**\n * Composer with an inline `@`-trigger that opens a modal sheet of\n * conversation members. Selecting a member inserts their\n * `external_id` into the text, and the wire `mentions` array (sent\n * to the backend) carries the corresponding internal `user_id`s.\n */\nexport function MentionInput({ conversationId, onSend, ...composerProps }: MentionInputProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n const keyboardOpen = useKeyboardOpen();\n const { members } = useMembers(conversationId);\n const [pickerOpen, setPickerOpen] = useState(false);\n const [pickerQuery, _setPickerQuery] = useState('');\n const [pendingMentionUuids, setPendingMentionUuids] = useState<Uuid[]>([]);\n const [text, setText] = useState('');\n\n const filteredMembers = useMemo(() => {\n if (!pickerQuery) return members;\n const q = pickerQuery.toLowerCase();\n return members.filter((m) => m.external_id.toLowerCase().includes(q));\n }, [members, pickerQuery]);\n\n const handleSend: MessageComposerProps['onSend'] = async (body, opts) => {\n await onSend(body, {\n ...opts,\n ...(pendingMentionUuids.length > 0 ? { mentions: pendingMentionUuids } : {}),\n });\n setPendingMentionUuids([]);\n setText('');\n };\n\n return (\n <>\n <MessageComposer\n {...composerProps}\n onSend={handleSend}\n onTyping={() => {\n composerProps.onTyping?.();\n // Watch for an `@` token to open the picker.\n const lastChar = text.slice(-1);\n if (lastChar === '@') setPickerOpen(true);\n }}\n />\n\n <Modal\n visible={pickerOpen}\n transparent\n animationType=\"slide\"\n onRequestClose={() => setPickerOpen(false)}\n // Edge-to-edge on Android like the host app, so the inset and\n // keyboard maths below hold on every device.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* The picker opens while the composer's keyboard is usually\n still up. The modal is full-screen and never resized, so a\n `padding` KAV (on both platforms) lifts the sheet exactly\n above the keyboard. */}\n <KeyboardAvoidingView style={styles.kav} behavior=\"padding\">\n <Pressable style={styles.backdrop} onPress={() => setPickerOpen(false)}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Clear the nav bar — unless the keyboard is covering\n // it, where the inset would just be a gap.\n paddingBottom: 12 + (keyboardOpen ? 0 : insets.bottom),\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n ]}\n >\n <Text\n style={[styles.title, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n >\n Mention a member\n </Text>\n <FlatList\n data={filteredMembers}\n keyExtractor={(m) => m.user_id}\n // First tap picks a member even with the keyboard up.\n keyboardShouldPersistTaps=\"handled\"\n renderItem={({ item }) => (\n <MentionRow\n member={item}\n onPress={() => {\n setPendingMentionUuids((prev) => [...prev, item.user_id]);\n setText((prev) => `${prev}${item.external_id} `);\n setPickerOpen(false);\n }}\n />\n )}\n />\n </View>\n </Pressable>\n </KeyboardAvoidingView>\n </Modal>\n </>\n );\n}\n\nfunction MentionRow({ member, onPress }: { member: Membership; onPress: () => void }) {\n const theme = usePoolseTheme();\n return (\n <Pressable onPress={onPress} style={styles.row}>\n <Avatar src={null} name={member.external_id} seed={member.external_id} size=\"sm\" />\n <Text style={[styles.rowText, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}>\n {member.external_id}\n </Text>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n kav: {\n flex: 1,\n },\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n maxHeight: '60%',\n paddingVertical: 12,\n },\n title: {\n fontSize: 14,\n fontWeight: '600',\n paddingHorizontal: 16,\n paddingBottom: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 10,\n gap: 10,\n },\n rowText: {\n fontSize: 14,\n },\n});\n","import type { Message } from '@poolse/sdk';\nimport {\n ActivityIndicator,\n FlatList,\n type ListRenderItem,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\nimport { useCallback, useEffect, useRef, useState, type ReactElement } from 'react';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n/**\n * Either a real message or a day-separator row. ConversationView\n * builds the list of items (interleaving separators where the day\n * changes) and hands it to MessageList; MessageList just renders.\n */\nexport type MessageListItem =\n | { kind: 'msg'; msg: Message }\n | { kind: 'separator'; id: string; node: ReactElement };\n\nexport interface MessageListProps {\n messages: Message[];\n /**\n * Optional pre-built item list (with day separators interleaved).\n * When omitted, a list with `{ kind: 'msg' }` items is derived\n * from `messages` and rendered without separators.\n */\n items?: MessageListItem[];\n loading?: boolean;\n hasMore?: boolean;\n onLoadMore?: () => void;\n renderItem: (msg: Message, index: number) => ReactElement;\n /** Slot rendered above the latest message (typically the typing indicator). */\n ListHeader?: ReactElement | null;\n /** Slot rendered below the oldest message (rare — typically nothing). */\n ListFooter?: ReactElement | null;\n /** Custom empty state when there are no messages. */\n emptyState?: ReactElement | string;\n /**\n * The current user's id. When provided, MessageList will show a\n * \"↓ N new messages\" jump button at the bottom of the chat\n * whenever new messages from OTHER users arrive while the user is\n * scrolled away from the bottom. Tapping scrolls to the latest.\n */\n meId?: string | null;\n}\n\n// How far above the bottom (in pixels — the list is inverted, so\n// this is contentOffset.y) before we consider the user \"scrolled\n// up\" and start counting new messages.\nconst AT_BOTTOM_THRESHOLD = 32;\n\n/**\n * Inverted FlatList wrapper for chat history. Newest message at the\n * bottom (visually), oldest at the top. Calls `onLoadMore` when the\n * user scrolls near the top edge and `hasMore` is true.\n *\n * Pagination is owned by `useMessages` (hand it `messages` +\n * `hasMore` + `loadMore`); this component just renders + scrolls.\n */\nexport function MessageList({\n messages,\n items,\n loading = false,\n hasMore = false,\n onLoadMore,\n renderItem,\n ListHeader = null,\n ListFooter = null,\n emptyState,\n meId = null,\n}: MessageListProps) {\n const theme = usePoolseTheme();\n const flatListRef = useRef<FlatList<MessageListItem>>(null);\n const [atBottom, setAtBottom] = useState(true);\n const [newCount, setNewCount] = useState(0);\n const lastTailIdRef = useRef<string | null>(null);\n\n // Build the FlatList data — either the caller's prebuilt items\n // (with separators) or a plain msg-only list. FlatList is\n // inverted, so we reverse to put the newest item at the top of\n // `data` (which renders at the visual bottom).\n const sourceItems: MessageListItem[] =\n items ?? messages.map((msg) => ({ kind: 'msg' as const, msg }));\n const data = [...sourceItems].reverse();\n\n // Track tail-message changes to maintain the \"new messages\" badge\n // when the user is scrolled up.\n useEffect(() => {\n const tail = messages[messages.length - 1];\n if (!tail) return;\n const tailId = tail.id;\n if (tailId === lastTailIdRef.current) return;\n const isFirstSet = lastTailIdRef.current === null;\n lastTailIdRef.current = tailId;\n if (atBottom || isFirstSet) {\n setNewCount(0);\n return;\n }\n // Only count incoming messages from other users — self messages\n // would have already triggered a scroll-to-bottom in normal flow.\n if (meId !== null && tail.sender_id === meId) return;\n setNewCount((n) => n + 1);\n }, [messages, atBottom, meId]);\n\n const handleScroll = useCallback((e: NativeSyntheticEvent<NativeScrollEvent>) => {\n const y = e.nativeEvent.contentOffset.y;\n const next = y <= AT_BOTTOM_THRESHOLD;\n setAtBottom((prev) => (prev === next ? prev : next));\n if (next) setNewCount(0);\n }, []);\n\n const scrollToBottom = useCallback(() => {\n flatListRef.current?.scrollToOffset({ offset: 0, animated: true });\n setNewCount(0);\n }, []);\n\n const handleRender: ListRenderItem<MessageListItem> = useCallback(\n ({ item, index }) => {\n if (item.kind === 'separator') return item.node;\n // Index in the original (newest-last) source order. Used by\n // ConversationView's renderItem to pick neighbours for\n // grouping when it doesn't pre-compute groupPosition itself.\n const sourceIndex = data.length - 1 - index;\n return renderItem(item.msg, sourceIndex);\n },\n [renderItem, data.length],\n );\n\n if (loading && messages.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n <ActivityIndicator color={theme.colors.brand} />\n </View>\n );\n }\n\n if (messages.length === 0) {\n return (\n <View style={[styles.placeholder, { backgroundColor: theme.colors.paper }]}>\n {typeof emptyState === 'string' ? (\n <Text style={{ color: theme.colors.ink3, fontFamily: theme.type.fontBody }}>\n {emptyState}\n </Text>\n ) : (\n (emptyState ?? null)\n )}\n </View>\n );\n }\n\n return (\n <View style={styles.root}>\n <FlatList\n ref={flatListRef}\n inverted\n data={data}\n keyExtractor={(item) => (item.kind === 'msg' ? item.msg.id : item.id)}\n renderItem={handleRender}\n onEndReached={hasMore ? onLoadMore : undefined}\n onEndReachedThreshold={0.3}\n onScroll={handleScroll}\n scrollEventThrottle={32}\n // `inverted` flips the list, so FlatList's ListHeaderComponent\n // renders at the bottom of the screen (above the latest message,\n // next to the composer) and ListFooterComponent renders at the\n // top (above the oldest message). That matches our prop names.\n ListHeaderComponent={ListHeader}\n ListFooterComponent={\n <View>\n {hasMore && loading ? (\n <ActivityIndicator color={theme.colors.ink3} style={{ marginVertical: 8 }} />\n ) : null}\n {ListFooter}\n </View>\n }\n style={{ backgroundColor: theme.colors.paper }}\n contentContainerStyle={{ paddingVertical: 8 }}\n />\n\n {!atBottom && newCount > 0 ? (\n <Pressable\n onPress={scrollToBottom}\n style={[\n styles.jumpButton,\n {\n backgroundColor: theme.colors.brand,\n },\n theme.shadows.sm,\n ]}\n accessibilityLabel={`${newCount} new ${newCount === 1 ? 'message' : 'messages'}, jump to latest`}\n >\n <PoolseIcon name=\"chevron-down\" size={14} color={theme.colors.onBrand} />\n <Text style={[styles.jumpText, { color: theme.colors.onBrand }]}>\n {newCount} new {newCount === 1 ? 'message' : 'messages'}\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n placeholder: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n padding: 24,\n },\n jumpButton: {\n position: 'absolute',\n alignSelf: 'center',\n bottom: 12,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n paddingHorizontal: 14,\n paddingVertical: 8,\n borderRadius: 999,\n },\n jumpText: {\n fontSize: 13,\n fontWeight: '600',\n },\n});\n","import type { Message } from '@poolse/sdk';\nimport { callLogDisplayFor } from '@poolse/react';\nimport { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface CallLogRowProps {\n /** The call-log message. Rows that aren't call logs render nothing. */\n msg: Pick<Message, 'type' | 'body' | 'inserted_at'> & { deleted_at?: string | null };\n /** Current user's id — decides how the call is worded for them. */\n meId: string | null;\n /**\n * Offer \"Call back\" on calls the viewer missed or declined, or placed\n * with no answer. Receives the call's media. Omit to show no action.\n */\n onCallBack?: (media: 'audio' | 'video') => void;\n}\n\n/**\n * Centered, compact timeline line for call-log system messages\n * (\"Voice call · 3:12\", \"Missed call\"). Same visual family as\n * `<DaySeparator>` — surface chip, hairline border, small semibold\n * label — so it reads as a separator between bubble clusters rather\n * than a message. No reactions, thread pill, swipe or long-press.\n *\n * `<MessageRow>` renders this automatically for call-log messages.\n */\nexport function CallLogRow({ msg, meId, onCallBack }: CallLogRowProps) {\n const theme = usePoolseTheme();\n const display = callLogDisplayFor(msg, meId);\n if (!display) return null;\n\n const accent = display.missed ? theme.colors.error : theme.colors.ink3;\n const time = formatTime(msg.inserted_at);\n const label = [display.title, display.detail, time].filter(Boolean).join(', ');\n const metaStyle = [styles.meta, { color: theme.colors.ink3, fontFamily: theme.type.fontBody }];\n\n return (\n <View style={styles.wrap} accessible accessibilityLabel={label}>\n <View\n style={[\n styles.chip,\n {\n backgroundColor: theme.colors.surface2,\n borderColor: theme.colors.border,\n },\n ]}\n >\n <PoolseIcon name={display.media === 'video' ? 'video' : 'phone'} size={13} color={accent} />\n <Text\n style={[\n styles.title,\n {\n color: display.missed ? theme.colors.error : theme.colors.ink2,\n fontFamily: theme.type.fontBody,\n },\n ]}\n numberOfLines={1}\n >\n {display.title}\n </Text>\n {display.detail ? <Text style={metaStyle}>· {display.detail}</Text> : null}\n {time ? <Text style={metaStyle}>· {time}</Text> : null}\n </View>\n {display.callBack && onCallBack ? (\n <Pressable\n onPress={() => onCallBack(display.media)}\n accessibilityRole=\"button\"\n accessibilityLabel={display.media === 'video' ? 'Video call back' : 'Call back'}\n hitSlop={8}\n style={({ pressed }) => [styles.callBack, pressed && styles.callBackPressed]}\n >\n <Text\n style={[\n styles.callBackText,\n { color: theme.colors.brand, fontFamily: theme.type.fontBody },\n ]}\n >\n Call back\n </Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n\nfunction formatTime(iso: string): string {\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return '';\n return d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n alignItems: 'center',\n alignSelf: 'stretch',\n marginVertical: 6,\n paddingHorizontal: 16,\n gap: 4,\n },\n callBack: { paddingHorizontal: 10, paddingVertical: 2 },\n callBackPressed: { opacity: 0.6 },\n callBackText: { fontSize: 12, fontWeight: '600' },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 6,\n maxWidth: '100%',\n paddingHorizontal: 12,\n paddingVertical: 4,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n },\n title: {\n fontSize: 11,\n fontWeight: '600',\n letterSpacing: 0.3,\n flexShrink: 1,\n },\n meta: {\n fontSize: 11,\n fontWeight: '500',\n letterSpacing: 0.3,\n fontVariant: ['tabular-nums'],\n },\n});\n","import { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nconst DEFAULT_REACTION_EMOJIS = ['👍', '❤️', '😂', '🎉', '🙏', '🔥'];\n\nexport interface MessageActionsProps {\n visible: boolean;\n onClose: () => void;\n isSelf: boolean;\n /**\n * Quick-reaction emoji row rendered at the top of the sheet. Tap\n * one to fire `onPickReaction(emoji)` and immediately close. When\n * omitted (or `onPickReaction` is omitted) the row is hidden.\n */\n emojis?: string[];\n onPickReaction?: (emoji: string) => void;\n onReply?: () => void;\n onReplyInThread?: () => void;\n onQuote?: () => void;\n onEdit?: () => void;\n onDelete?: () => void;\n onCopy?: () => void;\n}\n\n/**\n * Long-press action menu — modal bottom sheet. Renders a row of\n * quick-react emojis at the top (one tap reacts + closes) plus the\n * action items below. Matches WhatsApp / iMessage's \"long-press\n * shows everything inline\" pattern.\n */\nexport function MessageActions({\n visible,\n onClose,\n isSelf,\n emojis = DEFAULT_REACTION_EMOJIS,\n onPickReaction,\n onReply,\n onReplyInThread,\n onQuote,\n onEdit,\n onDelete,\n onCopy,\n}: MessageActionsProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n const items: Array<{ label: string; icon: IconName; onPress: () => void; danger?: boolean }> = [];\n if (onReply) items.push({ label: 'Reply', icon: 'reply', onPress: onReply });\n if (onQuote) items.push({ label: 'Quote reply', icon: 'reply', onPress: onQuote });\n if (onReplyInThread)\n items.push({ label: 'Reply in thread', icon: 'messages', onPress: onReplyInThread });\n if (onCopy) items.push({ label: 'Copy text', icon: 'copy', onPress: onCopy });\n if (isSelf && onEdit) items.push({ label: 'Edit', icon: 'edit', onPress: onEdit });\n if (isSelf && onDelete)\n items.push({ label: 'Delete', icon: 'trash', onPress: onDelete, danger: true });\n\n const showEmojiRow = !!onPickReaction && emojis.length > 0;\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the sheet's\n // bottom padding below is what actually clears the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable style={styles.backdrop} onPress={onClose}>\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderTopLeftRadius: theme.radii.lg,\n borderTopRightRadius: theme.radii.lg,\n // Last action row must sit above the nav bar / home indicator.\n paddingBottom: 24 + insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n theme.shadows.lg,\n ]}\n >\n {showEmojiRow ? (\n <View style={[styles.emojiRow, { borderBottomColor: theme.colors.border }]}>\n {emojis.map((emoji) => (\n <Pressable\n key={emoji}\n onPress={() => {\n onPickReaction(emoji);\n onClose();\n }}\n style={styles.emojiBtn}\n hitSlop={6}\n accessibilityLabel={`React with ${emoji}`}\n >\n <Text style={styles.emoji}>{emoji}</Text>\n </Pressable>\n ))}\n </View>\n ) : null}\n\n {items.map((item) => (\n <Pressable key={item.label} onPress={item.onPress} style={styles.item}>\n <PoolseIcon\n name={item.icon}\n size={18}\n color={item.danger ? theme.colors.error : theme.colors.ink2}\n />\n <Text\n style={[\n styles.itemText,\n {\n color: item.danger ? theme.colors.error : theme.colors.ink,\n fontFamily: theme.type.fontBody,\n },\n ]}\n >\n {item.label}\n </Text>\n </Pressable>\n ))}\n </View>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.35)',\n justifyContent: 'flex-end',\n },\n sheet: {\n paddingTop: 8,\n paddingBottom: 24,\n },\n emojiRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-around',\n paddingHorizontal: 12,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n marginBottom: 6,\n },\n emojiBtn: {\n paddingHorizontal: 6,\n paddingVertical: 6,\n borderRadius: 999,\n alignItems: 'center',\n justifyContent: 'center',\n },\n emoji: {\n fontSize: 30,\n lineHeight: 36,\n },\n item: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 20,\n paddingVertical: 14,\n gap: 14,\n },\n itemText: {\n fontSize: 15,\n fontWeight: '500',\n },\n});\n","import type { Attachment } from '@poolse/sdk';\nimport { useAttachmentUrl } from '@poolse/react';\nimport { Image, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface AttachmentPreviewProps {\n attachment: Attachment;\n /** Optional tap handler. For images defaults to opening the source URL. */\n onPress?: () => void;\n /** Render at this max width. Defaults to 280. */\n maxWidth?: number;\n /**\n * `'onBrand'` restyles the file card for a brand-colored self\n * bubble — translucent white instead of surface grey, so the card\n * reads as part of the bubble rather than a patch cut out of it.\n */\n tone?: 'default' | 'onBrand';\n}\n\nexport function AttachmentPreview({\n attachment,\n onPress,\n maxWidth = 280,\n tone = 'default',\n}: AttachmentPreviewProps) {\n const theme = usePoolseTheme();\n const isImage = (attachment.content_type ?? '').startsWith('image/');\n const { url } = useAttachmentUrl(attachment.id);\n\n if (isImage) {\n return (\n <Pressable onPress={onPress} disabled={!onPress}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={{\n width: maxWidth,\n height: 200,\n borderRadius: theme.radii.md,\n backgroundColor: theme.colors.surface2,\n }}\n resizeMode=\"cover\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'attachment image'}\n />\n ) : (\n <View\n style={[\n styles.imagePlaceholder,\n {\n width: maxWidth,\n height: 200,\n borderRadius: theme.radii.md,\n backgroundColor: theme.colors.surface2,\n },\n ]}\n />\n )}\n </Pressable>\n );\n }\n\n const onBrand = tone === 'onBrand';\n const ink = onBrand ? theme.colors.onBrand : theme.colors.ink;\n const inkSoft = onBrand ? theme.colors.onBrand : theme.colors.ink3;\n\n return (\n <Pressable\n onPress={onPress}\n disabled={!onPress}\n style={[\n styles.fileCard,\n {\n backgroundColor: onBrand ? 'rgba(255,255,255,0.18)' : theme.colors.surface2,\n borderColor: onBrand ? 'transparent' : theme.colors.border,\n borderRadius: theme.radii.md,\n },\n ]}\n >\n <PoolseIcon name=\"attachment\" size={18} color={onBrand ? ink : theme.colors.ink2} />\n <View style={{ flex: 1, marginLeft: 8 }}>\n <Text\n style={[styles.fileName, { color: ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {attachment.original_filename ?? 'file'}\n </Text>\n <Text style={[styles.fileSize, { color: inkSoft, opacity: onBrand ? 0.8 : 1 }]}>\n {formatBytes(attachment.byte_size)}\n </Text>\n </View>\n </Pressable>\n );\n}\n\nfunction formatBytes(n: number): string {\n if (n < 1024) return `${n} B`;\n if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;\n if (n < 1024 * 1024 * 1024) return `${(n / 1024 / 1024).toFixed(1)} MB`;\n return `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;\n}\n\nconst styles = StyleSheet.create({\n imagePlaceholder: {},\n fileCard: {\n flexDirection: 'row',\n alignItems: 'center',\n padding: 8,\n borderWidth: StyleSheet.hairlineWidth,\n },\n fileName: {\n fontSize: 13,\n fontWeight: '500',\n },\n fileSize: {\n fontSize: 11,\n },\n});\n","import type { Attachment } from '@poolse/sdk';\nimport { useAttachmentUrl } from '@poolse/react';\nimport { useState } from 'react';\nimport { Image, Modal, Pressable, StyleSheet, Text, useWindowDimensions, View } from 'react-native';\n\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ImageMosaicProps {\n images: Attachment[];\n /**\n * Pixel ceiling on the mosaic's width. The mosaic itself fills its\n * parent (`width: '100%'`) and caps at this value, so it always\n * fits inside whatever the bubble's actual content area is at\n * render time — no more hardcoded 280px overflowing on small\n * screens or inside narrow bubbles.\n */\n maxWidth?: number;\n radius?: number;\n /**\n * Square off the bottom corners (a small 5px instead of `radius`).\n * Pass when a caption or file cards follow the mosaic, so the media\n * flows into the text block instead of leaving \"ears\" of bubble\n * color between the image and the caption.\n */\n squareBottom?: boolean;\n /**\n * Long-press on any tile. The tiles are Pressables (tap opens the\n * viewer), and a nested Pressable wins the gesture — so without\n * this, holding an image-only message never reached the row's\n * actions sheet. MessageRow threads its long-press down through\n * here.\n */\n onLongPress?: () => void;\n}\n\n/**\n * WhatsApp-style multi-image grid for inside the message bubble.\n * Uses flex-based widths (with `%` and `aspectRatio`) so the layout\n * scales to whatever the bubble's content area is — no fixed pixel\n * positioning that can overflow when the bubble is narrower than\n * the configured max.\n *\n * * n = 1 → single tile, 16:10 aspect.\n * * n = 2 → row of 2 squares.\n * * n = 3 → 16:9 hero on top + row of 2 squares below.\n * * n ≥ 4 → 2×2 grid with \"+N more\" overlay on the 4th tile.\n */\nexport function ImageMosaic({\n images,\n maxWidth,\n radius,\n squareBottom = false,\n onLongPress,\n}: ImageMosaicProps) {\n const theme = usePoolseTheme();\n const r = radius ?? theme.radii.md;\n const rBottom = squareBottom ? 5 : r;\n const [viewerIndex, setViewerIndex] = useState<number | null>(null);\n\n if (images.length === 0) return null;\n\n const visible = images.slice(0, 4);\n const overflow = images.length > 4 ? images.length - 4 : 0;\n const n = visible.length as 1 | 2 | 3 | 4;\n\n return (\n <>\n <View\n style={[\n styles.root,\n {\n borderTopLeftRadius: r,\n borderTopRightRadius: r,\n borderBottomLeftRadius: rBottom,\n borderBottomRightRadius: rBottom,\n // Explicit pixel width, not just a cap: the mosaic sits\n // inside an auto-sized bubble, and a percentage width\n // against an indefinite parent collapses (or, worse,\n // resolves against the image's intrinsic size and blows\n // the row open). Media bubbles are fixed-width — the\n // WhatsApp convention anyway.\n ...(maxWidth ? { width: maxWidth } : {}),\n },\n ]}\n >\n {n === 1 ? (\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileFull}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n ) : null}\n\n {n === 2 ? (\n <View style={styles.rowEven}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n </View>\n ) : null}\n\n {n === 3 ? (\n <>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHero}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <View style={[styles.rowEven, { marginTop: 2 }]}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[2]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(2)}\n overlay={null}\n />\n </View>\n </>\n ) : null}\n\n {n === 4 ? (\n <>\n <View style={styles.rowEven}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[0]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(0)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[1]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(1)}\n overlay={null}\n />\n </View>\n <View style={[styles.rowEven, { marginTop: 2 }]}>\n <Tile\n onLongPress={onLongPress}\n attachment={visible[2]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(2)}\n overlay={null}\n />\n <Tile\n onLongPress={onLongPress}\n attachment={visible[3]!}\n style={styles.tileHalfSquare}\n onPress={() => setViewerIndex(3)}\n overlay={overflow > 0 ? `+${overflow}` : null}\n />\n </View>\n </>\n ) : null}\n </View>\n\n <Modal\n visible={viewerIndex !== null}\n transparent\n animationType=\"fade\"\n onRequestClose={() => setViewerIndex(null)}\n // Full-bleed black viewer on Android too (no app chrome peeking\n // through above/below); the close button pads for the insets.\n {...EDGE_TO_EDGE_MODAL}\n >\n {viewerIndex !== null ? (\n <FullScreenViewer\n attachment={images[viewerIndex]!}\n onClose={() => setViewerIndex(null)}\n />\n ) : null}\n </Modal>\n </>\n );\n}\n\nfunction Tile({\n attachment,\n style,\n overlay,\n onPress,\n onLongPress,\n}: {\n attachment: Attachment;\n style: object;\n overlay: string | null;\n onPress: () => void;\n onLongPress?: (() => void) | undefined;\n}) {\n const theme = usePoolseTheme();\n const { url } = useAttachmentUrl(attachment.id);\n return (\n <Pressable onPress={onPress} onLongPress={onLongPress} style={[styles.tileBase, style]}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={[styles.tileImage, { backgroundColor: theme.colors.surface2 }]}\n resizeMode=\"cover\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'image'}\n />\n ) : (\n <View style={[styles.tileImage, { backgroundColor: theme.colors.surface2 }]} />\n )}\n {overlay ? (\n <View style={styles.overflow}>\n <Text style={styles.overflowText}>{overlay}</Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nfunction FullScreenViewer({\n attachment,\n onClose,\n}: {\n attachment: Attachment;\n onClose: () => void;\n}) {\n const { url } = useAttachmentUrl(attachment.id);\n const { width, height } = useWindowDimensions();\n const insets = useSafeInsets();\n return (\n <Pressable style={styles.viewer} onPress={onClose}>\n {url ? (\n <Image\n source={{ uri: url }}\n style={{ width, height }}\n resizeMode=\"contain\"\n accessible\n accessibilityLabel={attachment.original_filename ?? 'image'}\n />\n ) : null}\n <Pressable\n onPress={onClose}\n hitSlop={12}\n // Keep the close button out from under the status bar / notch.\n style={[styles.closeBtn, { top: insets.top + 12, right: insets.right + 16 }]}\n accessibilityLabel=\"Close viewer\"\n >\n <PoolseIcon name=\"close\" size={20} color=\"#ffffff\" />\n </Pressable>\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n width: '100%',\n overflow: 'hidden',\n marginBottom: 4,\n },\n rowEven: {\n flexDirection: 'row',\n gap: 2,\n },\n tileBase: {\n overflow: 'hidden',\n },\n // n=1: full bleed at the bubble's available width, 16:10 aspect.\n tileFull: {\n width: '100%',\n aspectRatio: 16 / 10,\n },\n // n=2 / n=4 (per row): two equal squares side-by-side.\n tileHalfSquare: {\n flex: 1,\n aspectRatio: 1,\n },\n // n=3 hero: full-bleed top tile, 16:9.\n tileHero: {\n width: '100%',\n aspectRatio: 16 / 9,\n },\n tileImage: {\n width: '100%',\n height: '100%',\n },\n overflow: {\n position: 'absolute',\n inset: 0,\n backgroundColor: 'rgba(0,0,0,0.55)',\n alignItems: 'center',\n justifyContent: 'center',\n },\n overflowText: {\n color: '#ffffff',\n fontWeight: '700',\n fontSize: 22,\n },\n viewer: {\n flex: 1,\n backgroundColor: '#000000',\n alignItems: 'center',\n justifyContent: 'center',\n },\n closeBtn: {\n position: 'absolute',\n padding: 8,\n backgroundColor: 'rgba(0,0,0,0.5)',\n borderRadius: 20,\n },\n});\n","/**\n * Text-shape helpers shared by the bubble renderer.\n *\n * The bubble picks between three body treatments — inline-meta plain\n * text, full markdown, jumbo emoji — and these predicates are the\n * entire decision. Kept dependency-free so the native package can\n * mirror them line for line (see react-ui/src/bubbleText.ts).\n */\n\n/**\n * Whether the body contains anything Markdown would render\n * differently from plain text. When it doesn't, the bubble skips the\n * Markdown pipeline entirely and uses the plain-text fast path, which\n * is the only path that can float the timestamp into the last line —\n * block elements (paragraphs, lists, fences) own their line boxes and\n * push the meta below instead.\n *\n * Deliberately eager: a false positive only costs the inline\n * timestamp, a false negative would print literal `**` in a bubble.\n */\nexport function hasMarkdown(body: string): boolean {\n return /[*_~`#>|\\\\]|\\[.*\\]|^\\s*(?:[-+]|\\d+[.)])\\s|https?:\\/\\/|www\\./ms.test(body);\n}\n\n/**\n * 1–3 emoji and nothing else → the bubble drops its chrome and the\n * emoji render large (the iMessage convention — a lone 👍 deserves\n * better than a padded rectangle). Returns the emoji count, or 0 when\n * the body is not emoji-only.\n *\n * The regex builds each emoji as: one pictographic base (or keycap /\n * flag pair), optional skin tone, optional VS16, then any number of\n * ZWJ-joined continuations — so 👩👩👧👧 counts as one. Guarded by try\n * in case the engine lacks Unicode property escapes; the fallback is\n * simply \"not emoji-only\", which renders a normal bubble.\n */\nexport function emojiOnlyCount(body: string): number {\n const text = body.trim();\n if (!text || text.length > 32) return 0;\n try {\n const unit =\n '(?:\\\\p{Regional_Indicator}{2}|\\\\p{Extended_Pictographic})' +\n '[\\\\u{1F3FB}-\\\\u{1F3FF}]?\\\\uFE0F?' +\n '(?:\\\\u200D\\\\p{Extended_Pictographic}[\\\\u{1F3FB}-\\\\u{1F3FF}]?\\\\uFE0F?)*';\n const whole = new RegExp(`^(?:${unit}){1,3}$`, 'u');\n if (!whole.test(text)) return 0;\n const each = new RegExp(unit, 'gu');\n return (text.match(each) ?? []).length;\n } catch {\n return 0;\n }\n}\n\n/** Jumbo emoji font size by how many there are — fewer reads bigger. */\nexport function emojiFontSize(count: number): number {\n return count === 1 ? 44 : count === 2 ? 38 : 32;\n}\n","import { createElement, type ReactElement } from 'react';\nimport type { StyleSheet } from 'react-native';\n// Static import — Metro's bundle graph can only trace literal\n// `import` / `require` calls. The earlier try/require trick generated\n// a `require('react-native-markdown-display')` that Metro couldn't\n// resolve from inside our pre-bundled CJS dist, throwing a runtime\n// \"Requiring unknown module\" even when the consumer had the package\n// installed. Hard-importing puts the resolution into the consumer\n// app's normal graph where it works the same way react-native-svg or\n// expo-image-picker do.\n//\n// Trade-off: the package is now a required peer of @poolse/react-native\n// (was optional). Consumers who don't want markdown can pass\n// `markdown={false}` to <ConversationView> — the import stays in the\n// bundle but the component isn't rendered.\nimport Markdown, { MarkdownIt } from 'react-native-markdown-display';\n\n// `react-native-markdown-display` defaults to a stock CommonMark\n// parser, which only treats `[text](url)` and `<url>` as links. Bare\n// URLs in body text (e.g. \"check https://example.com\") stay plain\n// text. Turn on `linkify` so markdown-it autolinks them — matches\n// what react-ui gets via remark-gfm. Built once at module load: the\n// instance is stateless and re-using it avoids re-allocating the\n// parser for every rendered message.\nconst markdownit = MarkdownIt({ typographer: false, linkify: true });\n\nexport interface MarkdownStyleArgs {\n textColor: string;\n linkColor: string;\n fontFamily?: string;\n fontSize: number;\n lineHeight: number;\n onLinkPress: (url: string) => boolean;\n}\n\n/**\n * Render `body` as Markdown into a React element. The style mapping\n * uses the bubble's resolved theme tokens so text color tracks self /\n * other bubble background.\n */\nexport function renderMarkdown(body: string, args: MarkdownStyleArgs): ReactElement {\n const baseText = {\n color: args.textColor,\n fontFamily: args.fontFamily,\n fontSize: args.fontSize,\n lineHeight: args.lineHeight,\n };\n // Match react-ui's GFM defaults — body+inline elements use bubble\n // text color; links pick up the brand-on-bubble color so they\n // remain visible whether the bubble is a self-brand or\n // other-surface variant.\n const style: StyleSheet.NamedStyles<unknown> = {\n body: baseText,\n paragraph: { ...baseText, marginTop: 0, marginBottom: 0 },\n text: baseText,\n strong: { ...baseText, fontWeight: '700' },\n em: { ...baseText, fontStyle: 'italic' },\n s: { ...baseText, textDecorationLine: 'line-through' },\n link: { color: args.linkColor, textDecorationLine: 'underline' },\n code_inline: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n borderRadius: 4,\n paddingHorizontal: 4,\n },\n code_block: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n padding: 8,\n borderRadius: 6,\n },\n fence: {\n ...baseText,\n backgroundColor: 'rgba(127,127,127,0.18)',\n padding: 8,\n borderRadius: 6,\n },\n bullet_list: { marginTop: 2, marginBottom: 2 },\n ordered_list: { marginTop: 2, marginBottom: 2 },\n list_item: baseText,\n blockquote: {\n ...baseText,\n borderLeftWidth: 3,\n borderLeftColor: args.linkColor,\n paddingLeft: 8,\n marginVertical: 4,\n opacity: 0.85,\n },\n };\n return createElement(Markdown, { style, markdownit, onLinkPress: args.onLinkPress }, body);\n}\n","import type { Message, QuotedMessagePreview, Uuid } from '@poolse/sdk';\nimport { useUser } from '@poolse/react';\nimport { useState, type ReactNode } from 'react';\nimport { Linking, Pressable, StyleSheet, Text, useWindowDimensions, View } from 'react-native';\n\nimport { AttachmentPreview } from './AttachmentPreview.js';\nimport { ImageMosaic } from './ImageMosaic.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { emojiFontSize, emojiOnlyCount, hasMarkdown } from './internal/bubbleText.js';\nimport { renderMarkdown } from './internal/markdown.js';\nimport { userColor } from './primitives/userColor.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport type BubbleGroupPosition = 'first' | 'middle' | 'last' | 'standalone';\n\nexport interface MessageBubbleProps {\n message: Message;\n /** Used to decide left/right alignment, color, and read-receipt visibility. */\n currentUserId: string | null;\n /** `'sent'` → single tick, `'read'` → double tick (theme.colors.brand). */\n readState?: 'sent' | 'read';\n /** Label resolver keyed by `external_id` — falls back to the externalId itself. */\n labelFor?: (externalId: string) => string;\n /** Quoted-card tap handler. Typically used to scroll the list to the original message. */\n onQuotedClick?: (quotedMessageId: Uuid) => void;\n /** Position in a same-sender cluster — drives tail-corner rendering. */\n groupPosition?: BubbleGroupPosition;\n /** Truncate at this many chars and show a \"Read more\" toggle. Defaults to 0 (off). */\n maxBodyLength?: number;\n /** Show a colored sender label above other-side bubbles. Only meaningful in group chats. */\n showSenderName?: boolean;\n /** Slot for an actions trigger — typically a chevron rendered by `<MessageRow>`. */\n actionsTrigger?: ReactNode;\n /**\n * Long-press, forwarded into the image tiles. The tiles are\n * Pressables of their own and win the gesture, so a wrapper's\n * onLongPress never fires over an image-only message without this.\n */\n onLongPress?: () => void;\n /** Render in-bubble attachments (images, file cards). Defaults to true. */\n showAttachments?: boolean;\n /**\n * Render the body as Markdown (bold, italic, code, lists, links).\n * Links open via `Linking.openURL`. Requires\n * `react-native-markdown-display` to be installed in the host app;\n * without it we fall back to plain text. Defaults to true.\n */\n markdown?: boolean;\n}\n\n/**\n * One message bubble, structured as stacked sections rather than one\n * padded box: media bleeds to a 3px frame, text carries its own\n * padding, and the timestamp shares the last text line when measured\n * room allows — which is what makes \"ok\" a one-line bubble instead of\n * a squat rectangle.\n */\nexport function MessageBubble({\n message,\n currentUserId,\n readState,\n labelFor,\n onQuotedClick,\n groupPosition = 'standalone',\n maxBodyLength = 0,\n showSenderName = false,\n actionsTrigger,\n showAttachments = true,\n markdown = true,\n onLongPress,\n}: MessageBubbleProps) {\n const theme = usePoolseTheme();\n const { width: screenWidth } = useWindowDimensions();\n const isSelf = currentUserId !== null && message.sender_id === currentUserId;\n const [expanded, setExpanded] = useState(false);\n // Measured, not reserved: the old trick put an invisible twin of the\n // meta inline after the text — but `color: transparent` on a nested\n // Text does not reliably apply on Android, so the \"invisible\" twin\n // rendered visibly at the end of every message. Now the text's last\n // line and the meta are measured, and the meta either shares the\n // last line (when it provably fits) or takes its own row.\n const [lastLineWidth, setLastLineWidth] = useState<number | null>(null);\n const [textBoxWidth, setTextBoxWidth] = useState<number | null>(null);\n const [metaWidth, setMetaWidth] = useState<number | null>(null);\n\n // Pixel cap pinned to screen width so single-line and multi-line\n // bubbles hit the same edge regardless of row padding.\n const bubbleMaxWidth = Math.floor(screenWidth * 0.78);\n // Media caps tighter than text — a photo at 78% of an iPad is a\n // poster, not a message. 420 matches the web stylesheet's cap.\n const mediaWidth = Math.min(bubbleMaxWidth - 6, 420);\n\n const sender = useUser(!isSelf ? message.sender_external_id : null);\n const senderFallbackName = message.sender_external_id ?? 'Unknown';\n const senderLabel =\n sender.profile?.displayName ??\n (message.sender_external_id\n ? (labelFor?.(message.sender_external_id) ?? senderFallbackName)\n : senderFallbackName);\n const senderTint = userColor(message.sender_external_id ?? message.sender_id ?? message.id);\n\n const tailCorner = groupPosition === 'last' || groupPosition === 'standalone';\n const bubbleRadius = theme.radii.bubble;\n const textColor = isSelf ? theme.colors.selfBubbleText : theme.colors.otherBubbleText;\n const mutedOnBubble = isSelf ? theme.colors.onBrand : theme.colors.ink3;\n\n const radii = {\n topLeft: bubbleRadius,\n topRight: bubbleRadius,\n bottomLeft: bubbleRadius,\n bottomRight: bubbleRadius,\n };\n if (tailCorner) {\n if (isSelf) radii.bottomRight = 5;\n else radii.bottomLeft = 5;\n }\n\n const body = message.body ?? '';\n const isDeleted = !!message.deleted_at;\n const isEdited = !!message.edited_at && !isDeleted;\n const trimmable = maxBodyLength > 0 && body.length > maxBodyLength;\n const truncated = trimmable && !expanded ? body.slice(0, maxBodyLength) + '…' : body;\n const time = formatTime(message.inserted_at);\n\n const images =\n showAttachments && !isDeleted\n ? (message.attachments ?? []).filter((a) => isImageContentType(a.content_type))\n : [];\n const files =\n showAttachments && !isDeleted\n ? (message.attachments ?? []).filter((a) => !isImageContentType(a.content_type))\n : [];\n const hasMedia = images.length > 0;\n const hasFiles = files.length > 0;\n const hasBody = !isDeleted && body.length > 0;\n\n // Image-only bubble → the meta floats over the picture on a scrim\n // pill, WhatsApp-style, and the bubble is nothing but the frame.\n const metaOverlay = hasMedia && !hasBody && !hasFiles;\n\n // 1–3 emoji and nothing else → no bubble chrome, big glyphs.\n const jumboCount =\n hasBody && !hasMedia && !hasFiles && !message.quoted_message_id ? emojiOnlyCount(body) : 0;\n\n // Timestamp may share the last text line — but only on the\n // plain-text path; markdown blocks and the Read-more toggle own\n // their last line, so those keep the meta row.\n const inlineMeta =\n hasBody && jumboCount === 0 && !trimmable && (!markdown || !hasMarkdown(truncated));\n\n const sectionAbove = hasMedia || hasFiles || !!message.quoted_message || isDeleted;\n\n // The meta shares the last text line only when measurement proves\n // there is room for it; until the three measurements land, it takes\n // its own row, which is always safe.\n const metaFits =\n lastLineWidth !== null &&\n textBoxWidth !== null &&\n metaWidth !== null &&\n lastLineWidth + metaWidth + 14 <= textBoxWidth;\n\n const metaRow = (variant: 'inline' | 'wrapped' | 'block' | 'overlay' | 'jumbo') => {\n const color =\n variant === 'overlay' ? '#FFFFFF' : variant === 'jumbo' ? theme.colors.ink3 : mutedOnBubble;\n return (\n <View\n style={[\n styles.metaRow,\n variant === 'inline' && styles.metaInline,\n variant === 'wrapped' && styles.metaWrapped,\n variant === 'overlay' && styles.metaOverlay,\n variant === 'block' && styles.metaBlock,\n // File-only bubble: the meta row follows the cards directly —\n // give it air so the time doesn't sit glued to the card.\n variant === 'block' && hasFiles && !hasBody && styles.metaBlockAfterFiles,\n variant === 'jumbo' && styles.metaJumbo,\n ]}\n onLayout={\n variant === 'inline' || variant === 'wrapped'\n ? (e) => setMetaWidth(e.nativeEvent.layout.width)\n : undefined\n }\n pointerEvents=\"none\"\n >\n {isEdited ? (\n <Text style={[styles.editedTag, { color, opacity: 0.8 }]}>edited</Text>\n ) : null}\n <Text style={[styles.meta, { color, opacity: variant === 'overlay' ? 1 : 0.75 }]}>\n {time}\n </Text>\n {isSelf && readState ? (\n <View style={styles.readTick}>\n <PoolseIcon\n name={readState === 'read' ? 'check-double' : 'check'}\n size={13}\n color={color}\n />\n </View>\n ) : null}\n </View>\n );\n };\n\n return (\n <View style={[styles.wrap, { alignSelf: isSelf ? 'flex-end' : 'flex-start', maxWidth: bubbleMaxWidth }]}>\n <View\n style={[\n jumboCount === 0 && {\n backgroundColor: isSelf ? theme.colors.selfBubble : theme.colors.otherBubble,\n borderColor: isSelf ? 'transparent' : theme.colors.border,\n borderWidth: isSelf ? 0 : StyleSheet.hairlineWidth,\n borderTopLeftRadius: radii.topLeft,\n borderTopRightRadius: radii.topRight,\n borderBottomLeftRadius: radii.bottomLeft,\n borderBottomRightRadius: radii.bottomRight,\n },\n jumboCount === 0 && theme.shadows.sm,\n ]}\n >\n {showSenderName &&\n !isSelf &&\n jumboCount === 0 &&\n (groupPosition === 'first' || groupPosition === 'standalone') ? (\n <Text\n style={[styles.senderName, { color: senderTint, fontFamily: theme.type.fontBody }]}\n >\n {senderLabel}\n </Text>\n ) : null}\n\n {message.quoted_message ? (\n <QuotedCard\n quoted={message.quoted_message}\n isSelf={isSelf}\n {...(labelFor ? { labelFor } : {})}\n {...(onQuotedClick ? { onPress: () => onQuotedClick(message.quoted_message!.id) } : {})}\n />\n ) : null}\n\n {hasMedia ? (\n // 3px of bubble color framing the picture; the mosaic clips\n // itself 3px tighter than the bubble so the curves stay\n // concentric.\n <View style={styles.mediaFrame}>\n <ImageMosaic\n images={images}\n maxWidth={mediaWidth}\n radius={Math.max(bubbleRadius - 3, 8)}\n squareBottom={!metaOverlay}\n {...(onLongPress ? { onLongPress } : {})}\n />\n {metaOverlay ? metaRow('overlay') : null}\n </View>\n ) : null}\n\n {hasFiles ? (\n <View style={styles.filesBlock}>\n {files.map((att) => (\n <AttachmentPreview\n key={att.id}\n attachment={att}\n maxWidth={bubbleMaxWidth - 12}\n tone={isSelf ? 'onBrand' : 'default'}\n />\n ))}\n </View>\n ) : null}\n\n {isDeleted ? (\n <View style={[styles.textBlock, sectionAbove && styles.textBlockAfter]}>\n <Text\n style={{\n color: mutedOnBubble,\n opacity: 0.7,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n fontStyle: 'italic',\n }}\n >\n Message deleted\n </Text>\n </View>\n ) : null}\n\n {hasBody && jumboCount > 0 ? (\n <View style={styles.jumboBlock}>\n <Text\n style={{ fontSize: emojiFontSize(jumboCount), lineHeight: emojiFontSize(jumboCount) + 8 }}\n >\n {body}\n </Text>\n </View>\n ) : null}\n\n {hasBody && jumboCount === 0 ? (\n <View\n style={[styles.textBlock, sectionAbove && styles.textBlockAfter]}\n onLayout={\n inlineMeta ? (e) => setTextBoxWidth(e.nativeEvent.layout.width - 24) : undefined\n }\n >\n {markdown && !inlineMeta ? (\n renderMarkdown(truncated, {\n textColor,\n linkColor: isSelf ? theme.colors.onBrand : theme.colors.brand,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n onLinkPress: (url: string) => {\n void Linking.openURL(url).catch(() => undefined);\n return false;\n },\n })\n ) : (\n <Text\n style={{\n color: textColor,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n lineHeight: theme.type.lineHeight,\n }}\n onTextLayout={\n inlineMeta\n ? (e) => {\n const lines = e.nativeEvent.lines;\n const last = lines[lines.length - 1];\n setLastLineWidth(last ? Math.ceil(last.width) : 0);\n }\n : undefined\n }\n >\n {truncated}\n </Text>\n )}\n\n {trimmable ? (\n <Pressable onPress={() => setExpanded((e) => !e)}>\n <Text\n style={[\n styles.readMore,\n { color: isSelf ? theme.colors.onBrand : theme.colors.brand },\n ]}\n >\n {expanded ? 'Show less' : 'Read more'}\n </Text>\n </Pressable>\n ) : null}\n\n {inlineMeta ? metaRow(metaFits ? 'inline' : 'wrapped') : null}\n </View>\n ) : null}\n\n {/* Fallback meta row for everything that couldn't inline or\n overlay it: markdown bodies, file bubbles, deleted rows. */}\n {!inlineMeta && !metaOverlay && jumboCount === 0 ? metaRow('block') : null}\n\n {actionsTrigger ? <View style={styles.actionsSlot}>{actionsTrigger}</View> : null}\n </View>\n\n {jumboCount > 0 ? (\n <View style={{ alignSelf: isSelf ? 'flex-end' : 'flex-start' }}>{metaRow('jumbo')}</View>\n ) : null}\n </View>\n );\n}\n\nfunction QuotedCard({\n quoted,\n isSelf,\n labelFor,\n onPress,\n}: {\n quoted: QuotedMessagePreview;\n isSelf: boolean;\n labelFor?: (externalId: string) => string;\n onPress?: () => void;\n}) {\n const theme = usePoolseTheme();\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n const resolved = useUser(quoted.sender_external_id);\n const senderName = quoted.sender_external_id\n ? (labelFor?.(quoted.sender_external_id) ??\n resolved.profile?.displayName ??\n quoted.sender_external_id)\n : 'Unknown';\n // Darker than the bubble on both sides, so the quote reads as\n // something the message sits on top of.\n const bg = isSelf ? 'rgba(0,0,0,0.16)' : theme.colors.surface2;\n const accent = isSelf ? theme.colors.onBrand : theme.colors.brand;\n const txt = isSelf ? theme.colors.onBrand : theme.colors.ink;\n return (\n <Pressable\n onPress={onPress}\n disabled={!onPress}\n style={[\n styles.quoted,\n {\n backgroundColor: bg,\n borderLeftColor: accent,\n },\n ]}\n >\n <Text style={[styles.quotedSender, { color: accent }]} numberOfLines={1}>\n {senderName}\n </Text>\n <Text style={[styles.quotedBody, { color: txt }]} numberOfLines={2}>\n {quoted.deleted_at ? 'Original message deleted' : (quoted.body ?? '…')}\n </Text>\n </Pressable>\n );\n}\n\nfunction isImageContentType(ct: string | null | undefined): boolean {\n if (!ct) return false;\n return ct.startsWith('image/');\n}\n\n// HH:MM if same calendar day, \"Yesterday HH:MM\" if yesterday, \"Mon DD\"\n// if older than a week, otherwise weekday abbreviation. Matches the\n// WhatsApp / iMessage convention — short enough to fit in the meta\n// row, long enough to be useful at a glance.\nfunction formatTime(iso: string): string {\n try {\n const d = new Date(iso);\n const now = new Date();\n const sameDay = isSameDay(d, now);\n const time = d.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' });\n if (sameDay) return time;\n\n const yesterday = new Date(now);\n yesterday.setDate(now.getDate() - 1);\n if (isSameDay(d, yesterday)) return `Yesterday ${time}`;\n\n const diffMs = now.getTime() - d.getTime();\n const diffDays = Math.floor(diffMs / 86_400_000);\n if (diffDays < 7) {\n return `${d.toLocaleDateString([], { weekday: 'short' })} ${time}`;\n }\n return d.toLocaleDateString([], { month: 'short', day: 'numeric' });\n } catch {\n return '';\n }\n}\n\nfunction isSameDay(a: Date, b: Date): boolean {\n return (\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\nconst styles = StyleSheet.create({\n wrap: {\n marginBottom: 2,\n },\n senderName: {\n fontSize: 12,\n fontWeight: '700',\n paddingTop: 7,\n paddingHorizontal: 12,\n },\n mediaFrame: {\n margin: 3,\n },\n filesBlock: {\n paddingHorizontal: 6,\n paddingTop: 6,\n gap: 4,\n },\n textBlock: {\n paddingHorizontal: 12,\n paddingVertical: 7,\n },\n // A hair less air when media / files / a quote already sit above.\n textBlockAfter: {\n paddingTop: 6,\n },\n jumboBlock: {\n paddingVertical: 2,\n },\n // The meta on its own line inside the text block, flush right —\n // the fallback whenever the last text line has no room for it.\n metaWrapped: {\n alignSelf: 'flex-end',\n marginTop: 3,\n },\n readMore: {\n fontSize: 12,\n fontWeight: '600',\n marginTop: 4,\n },\n metaRow: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n metaInline: {\n position: 'absolute',\n right: 12,\n // Optically centers the meta against the body's last line (22px\n // line over the 7px bottom padding): 7 + (22 - 14) / 2. At 8 it\n // sat visibly low beside a one-line message.\n bottom: 11,\n },\n metaOverlay: {\n position: 'absolute',\n right: 6,\n bottom: 6,\n paddingHorizontal: 8,\n paddingVertical: 3,\n borderRadius: 999,\n backgroundColor: 'rgba(0,0,0,0.42)',\n },\n metaBlock: {\n justifyContent: 'flex-end',\n paddingHorizontal: 12,\n paddingBottom: 6,\n marginTop: -2,\n },\n metaBlockAfterFiles: {\n marginTop: 6,\n },\n metaJumbo: {\n paddingTop: 2,\n },\n meta: {\n fontSize: 11,\n fontVariant: ['tabular-nums'],\n includeFontPadding: false,\n },\n editedTag: {\n fontSize: 10,\n fontStyle: 'italic',\n letterSpacing: 0.1,\n },\n readTick: {\n marginLeft: 1,\n marginTop: 1,\n },\n actionsSlot: {\n position: 'absolute',\n top: 4,\n right: 4,\n },\n quoted: {\n borderLeftWidth: 3,\n paddingLeft: 9,\n paddingVertical: 5,\n paddingRight: 8,\n margin: 4,\n marginBottom: 0,\n borderRadius: 10,\n },\n quotedSender: {\n fontSize: 12,\n fontWeight: '700',\n marginBottom: 1,\n },\n quotedBody: {\n fontSize: 12.5,\n opacity: 0.8,\n },\n});\n","import type { Uuid } from '@poolse/sdk';\nimport { useReactions } from '@poolse/react';\nimport { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nconst DEFAULT_EMOJIS = ['👍', '❤️', '😂', '🎉', '🙏', '🔥'];\n\nexport interface ReactionStripProps {\n messageId: Uuid;\n conversationId: Uuid;\n meId: string | null;\n /** Seed map from a known message (e.g. `useMessages`). */\n initialReactions?: Record<string, Uuid[]>;\n}\n\nexport function ReactionStrip({\n messageId,\n conversationId,\n meId,\n initialReactions,\n}: ReactionStripProps) {\n const theme = usePoolseTheme();\n const { reactions, addReaction, removeReaction } = useReactions(messageId, {\n conversationId,\n currentUserId: meId,\n ...(initialReactions ? { initialReactions } : {}),\n });\n const entries = Object.entries(reactions);\n if (entries.length === 0) return null;\n\n return (\n <View style={styles.strip}>\n {entries.map(([emoji, userIds]) => {\n const userArr = Array.isArray(userIds) ? userIds : [];\n const meReacted = meId !== null && userArr.includes(meId);\n return (\n <Pressable\n key={emoji}\n onPress={() => (meReacted ? removeReaction(emoji) : addReaction(emoji))}\n style={[\n styles.chip,\n {\n backgroundColor: meReacted ? theme.colors.brandSoft : theme.colors.surface2,\n borderColor: meReacted ? theme.colors.brand : theme.colors.border,\n borderWidth: meReacted ? 1.5 : 1,\n transform: meReacted ? [{ scale: 1.04 }] : undefined,\n },\n ]}\n >\n <Text style={styles.emoji}>{emoji}</Text>\n <Text\n style={[\n styles.count,\n {\n color: meReacted ? theme.colors.brand : theme.colors.ink2,\n fontWeight: meReacted ? '700' : '600',\n },\n ]}\n >\n {userArr.length}\n </Text>\n </Pressable>\n );\n })}\n </View>\n );\n}\n\nexport interface ReactionPickerProps {\n visible: boolean;\n onClose: () => void;\n onPick: (emoji: string) => void;\n /** Override the default 6-emoji set. */\n emojis?: string[];\n}\n\nexport function ReactionPicker({\n visible,\n onClose,\n onPick,\n emojis = DEFAULT_EMOJIS,\n}: ReactionPickerProps) {\n const theme = usePoolseTheme();\n const insets = useSafeInsets();\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app; the backdrop pads\n // by the insets so the picker centres in the visible area.\n {...EDGE_TO_EDGE_MODAL}\n >\n <Pressable\n style={[styles.backdrop, { paddingTop: insets.top, paddingBottom: insets.bottom }]}\n onPress={onClose}\n >\n <View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.surface,\n borderRadius: theme.radii.lg,\n },\n theme.shadows.lg,\n ]}\n >\n {emojis.map((emoji) => (\n <Pressable\n key={emoji}\n style={styles.emojiBtn}\n onPress={() => {\n onPick(emoji);\n onClose();\n }}\n >\n <Text style={styles.bigEmoji}>{emoji}</Text>\n </Pressable>\n ))}\n </View>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n strip: {\n flexDirection: 'row',\n flexWrap: 'wrap',\n gap: 4,\n marginTop: 2,\n },\n chip: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 9,\n paddingVertical: 4,\n borderRadius: 14,\n gap: 5,\n minHeight: 26,\n // Subtle elevation so chips lift off the surface\n shadowColor: '#000',\n shadowOffset: { width: 0, height: 1 },\n shadowOpacity: 0.06,\n shadowRadius: 2,\n elevation: 1,\n },\n emoji: {\n fontSize: 15,\n lineHeight: 18,\n },\n count: {\n fontSize: 12,\n fontVariant: ['tabular-nums'],\n },\n backdrop: {\n flex: 1,\n backgroundColor: 'rgba(0,0,0,0.4)',\n justifyContent: 'center',\n alignItems: 'center',\n paddingHorizontal: 24,\n },\n sheet: {\n flexDirection: 'row',\n paddingHorizontal: 12,\n paddingVertical: 12,\n gap: 4,\n alignItems: 'center',\n },\n emojiBtn: {\n paddingHorizontal: 8,\n paddingVertical: 6,\n borderRadius: 999,\n alignItems: 'center',\n justifyContent: 'center',\n },\n bigEmoji: {\n fontSize: 32,\n lineHeight: 38,\n },\n});\n","import { Animated, PanResponder, Pressable, StyleSheet, Text, View } from 'react-native';\nimport type { Message, Uuid } from '@poolse/sdk';\nimport { useMemo, useRef, useState } from 'react';\n// Static import — Metro's bundle graph can only trace literal\n// `import` / `require` calls. See ./internal/markdown.ts for the\n// full reasoning. `expo-clipboard` is a required peer dep; consumers\n// who don't want copy can omit the Copy action by not enabling\n// `actions` on <ConversationView>.\nimport * as Clipboard from 'expo-clipboard';\n\nimport { Avatar } from './primitives/Avatar.js';\nimport { CallLogRow } from './CallLogRow.js';\nimport { MessageActions } from './MessageActions.js';\nimport { MessageBubble, type BubbleGroupPosition } from './MessageBubble.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { ReactionStrip } from './Reactions.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\nimport { callLogDisplayFor, useReactions, useUser } from '@poolse/react';\n\n// Swipe-to-reply triggers at this much horizontal pull. iOS / WhatsApp\n// use 50–60px; the lower bound feels lighter for one-handed thumb use.\nconst SWIPE_REPLY_THRESHOLD = 50;\n\nexport interface MessageRowProps {\n msg: Message;\n meId: string | null;\n\n // Feature toggles — same set as ConversationView's, but per-row.\n reactions?: boolean;\n attachments?: boolean;\n actions?: boolean;\n /** Pass false in ThreadView since nested threads aren't a thing in v1. */\n threads?: boolean;\n /** WhatsApp-style quote-reply. Defaults true on ConversationView. */\n quotations?: boolean;\n /** Forwarded to `<MessageBubble markdown>`. Defaults true. */\n markdown?: boolean;\n\n readState?: 'sent' | 'read';\n\n /**\n * Whether this row's message is the one currently being edited.\n * Editing happens in the composer (see MessageComposer's\n * `editingMessage` prop); this flag is only used to elevate the\n * row above the dim backdrop ConversationView renders during\n * edit mode.\n */\n isEditing?: boolean;\n /**\n * Long-press → \"Edit\". Omitted entirely (no Edit option in the\n * menu) when the parent has decided this message isn't editable\n * (someone read it, it's deleted, it isn't yours).\n */\n onStartEdit?: () => void;\n onDelete?: () => void;\n onOpenThread?: () => void;\n onQuote?: () => void;\n labelFor?: (externalId: string) => string;\n onQuotedClick?: (quotedMessageId: Uuid) => void;\n groupPosition?: BubbleGroupPosition;\n maxBodyLength?: number;\n /** Show a colored sender label above other-side bubbles. */\n showSenderName?: boolean;\n /** Render an avatar to the LEFT of other-side bubbles. */\n showAvatar?: boolean;\n /** Avatar resolver — same signature as `<MemberList avatarFor>`. */\n avatarFor?: (externalId: string) => string | null;\n /** Call-log rows: offer \"Call back\" (see `<CallLogRow onCallBack>`). */\n onCallBack?: (media: 'audio' | 'video') => void;\n}\n\nexport function MessageRow(props: MessageRowProps) {\n // Call-log system messages render as a centered compact line with\n // no bubble / swipe / long-press / reactions. `undefined` = not a\n // call log; `null` = a call log hidden for this viewer (someone\n // else's missed-call marker). Split into its own component so the\n // bubble row's hooks never run conditionally.\n const callLog = callLogDisplayFor(props.msg, props.meId);\n if (callLog !== undefined) {\n return callLog ? (\n <CallLogRow\n msg={props.msg}\n meId={props.meId}\n {...(props.onCallBack ? { onCallBack: props.onCallBack } : {})}\n />\n ) : null;\n }\n return <BubbleMessageRow {...props} />;\n}\n\nfunction BubbleMessageRow({\n msg,\n meId,\n reactions = true,\n attachments = true,\n actions = true,\n threads = true,\n quotations = true,\n markdown = true,\n readState,\n isEditing = false,\n onStartEdit,\n onDelete,\n onOpenThread,\n onQuote,\n labelFor,\n onQuotedClick,\n groupPosition = 'standalone',\n maxBodyLength = 0,\n showSenderName = false,\n showAvatar = false,\n avatarFor,\n}: MessageRowProps) {\n const theme = usePoolseTheme();\n const isSelf = meId !== null && msg.sender_id === meId;\n const [actionsOpen, setActionsOpen] = useState(false);\n\n // Per-row useReactions subscription so the long-press → React picker\n // and the inline ReactionStrip share the same realtime state. Adds\n // one realtime listener per visible row, which is fine — they're\n // server-filtered by messageId and the FlatList only mounts rows in\n // view. Initial seed comes from msg.reactions so the strip renders\n // immediately without waiting for the first echo.\n const reactionsApi = useReactions(msg.id, {\n conversationId: msg.conversation_id,\n currentUserId: meId,\n ...(msg.reactions ? { initialReactions: msg.reactions } : {}),\n });\n\n // Swipe-to-reply state. The bubble's translateX is driven by a pan\n // gesture; when the user releases past SWIPE_REPLY_THRESHOLD we fire\n // onQuote (which the parent wires to setReplyingTo on the composer).\n // Animation runs on the JS thread because we need to read the value\n // synchronously on release — native driver would prevent that.\n const translateX = useRef(new Animated.Value(0)).current;\n const swipeEnabled = quotations && !!onQuote && !isEditing;\n\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n // Tap / long-press still go to the inner Pressable.\n onStartShouldSetPanResponder: () => false,\n onStartShouldSetPanResponderCapture: () => false,\n // Capture-phase claim: we intercept the gesture BEFORE the\n // child Pressable as soon as the move shows clear horizontal\n // intent. Without capture-phase, the Pressable's touch handling\n // wins first and the pan never starts (this is why self-bubble\n // left swipes felt totally dead — the Pressable was attached\n // to a touch that started with the user's finger over the\n // bubble center, and we never got a turn).\n onMoveShouldSetPanResponder: () => false,\n onMoveShouldSetPanResponderCapture: (_, g) => {\n if (!swipeEnabled) return false;\n // 4px is plenty to disambiguate from an accidental jitter\n // during a tap. `dx > dy` (not `dx > dy * 2`) so a slightly\n // diagonal pull still counts as horizontal — the user isn't\n // going to hold their finger to a perfect axis.\n return Math.abs(g.dx) > 4 && Math.abs(g.dx) > Math.abs(g.dy);\n },\n // Don't surrender the gesture mid-swipe (e.g. parent FlatList\n // asking for it back) — once we're translating the bubble we\n // hold on until release.\n onPanResponderTerminationRequest: () => false,\n // 1:1 finger-follow up to the threshold, then square-root\n // damping past it so the bubble never slides off-screen.\n // Matches iMessage / WhatsApp — feels weightless during the\n // committed range and stiffens once you've already triggered.\n onPanResponderMove: (_, g) => {\n const dx = isSelf ? Math.min(0, g.dx) : Math.max(0, g.dx);\n const abs = Math.abs(dx);\n let translated: number;\n if (abs <= SWIPE_REPLY_THRESHOLD) {\n translated = dx;\n } else {\n const excess = abs - SWIPE_REPLY_THRESHOLD;\n const dampened = SWIPE_REPLY_THRESHOLD + Math.sqrt(excess * 6);\n translated = dx < 0 ? -dampened : dampened;\n }\n translateX.setValue(translated);\n },\n onPanResponderRelease: (_, g) => {\n const past = Math.abs(g.dx) >= SWIPE_REPLY_THRESHOLD;\n if (past && onQuote) onQuote();\n Animated.spring(translateX, {\n toValue: 0,\n useNativeDriver: false,\n speed: 28,\n bounciness: 4,\n }).start();\n },\n onPanResponderTerminate: () => {\n Animated.spring(translateX, {\n toValue: 0,\n useNativeDriver: false,\n speed: 28,\n bounciness: 4,\n }).start();\n },\n }),\n [swipeEnabled, isSelf, onQuote, translateX],\n );\n\n // Reply icon fades + scales in as the bubble drags past ~half the\n // threshold. Sits on the SAME side the swipe is coming FROM (so\n // it's revealed behind the bubble as the bubble slides away).\n const replyIconOpacity = translateX.interpolate({\n inputRange: isSelf\n ? [-SWIPE_REPLY_THRESHOLD, -SWIPE_REPLY_THRESHOLD / 2, 0]\n : [0, SWIPE_REPLY_THRESHOLD / 2, SWIPE_REPLY_THRESHOLD],\n outputRange: isSelf ? [1, 0.3, 0] : [0, 0.3, 1],\n extrapolate: 'clamp',\n });\n const replyIconScale = translateX.interpolate({\n inputRange: isSelf ? [-SWIPE_REPLY_THRESHOLD, 0] : [0, SWIPE_REPLY_THRESHOLD],\n outputRange: isSelf ? [1, 0.5] : [0.5, 1],\n extrapolate: 'clamp',\n });\n\n const showAvatarSlot = showAvatar && !isSelf;\n const showAvatarRender =\n showAvatarSlot && (groupPosition === 'last' || groupPosition === 'standalone');\n // Resolve avatar / label with the same priority as MessageBubble /\n // ChatHeader: explicit prop > SDK userResolver > externalId fallback.\n // Without the useUser fallback, omitting `avatarFor` / `labelFor` on\n // <ConversationView> bypassed the resolver at the row level even\n // when `PoolseConfig.userResolver` was configured.\n const rowSender = useUser(showAvatarSlot ? msg.sender_external_id : null);\n const avatarUrl = msg.sender_external_id\n ? (avatarFor?.(msg.sender_external_id) ?? rowSender.profile?.avatarUrl ?? null)\n : null;\n const senderLabel = msg.sender_external_id\n ? (labelFor?.(msg.sender_external_id) ??\n rowSender.profile?.displayName ??\n msg.sender_external_id)\n : null;\n\n return (\n <View\n style={[\n styles.row,\n { alignSelf: isSelf ? 'flex-end' : 'flex-start' },\n // Lift this row above the dim backdrop the parent renders\n // during edit mode. zIndex covers iOS / web; elevation does\n // the equivalent on Android.\n isEditing ? styles.rowEditing : null,\n ]}\n >\n {showAvatarSlot ? (\n <View style={styles.avatarSlot}>\n {showAvatarRender ? (\n <Avatar\n src={avatarUrl ?? null}\n name={senderLabel}\n seed={msg.sender_external_id ?? null}\n size=\"sm\"\n />\n ) : null}\n </View>\n ) : null}\n\n <View style={styles.bubbleCol}>\n {swipeEnabled ? (\n <Animated.View\n pointerEvents=\"none\"\n style={[\n styles.replyHint,\n isSelf ? styles.replyHintRight : styles.replyHintLeft,\n {\n opacity: replyIconOpacity,\n transform: [{ scale: replyIconScale }],\n backgroundColor: theme.colors.surface2,\n },\n ]}\n >\n <PoolseIcon name=\"reply\" size={16} color={theme.colors.brand} />\n </Animated.View>\n ) : null}\n\n <Animated.View\n {...(swipeEnabled ? panResponder.panHandlers : {})}\n style={{ transform: [{ translateX }] }}\n >\n <Pressable\n onLongPress={() => {\n if (!actions) return;\n setActionsOpen(true);\n }}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Message actions\"\n >\n <MessageBubble\n message={msg}\n currentUserId={meId}\n {...(readState ? { readState } : {})}\n {...(labelFor ? { labelFor } : {})}\n {...(onQuotedClick ? { onQuotedClick } : {})}\n groupPosition={groupPosition}\n maxBodyLength={maxBodyLength}\n showSenderName={showSenderName}\n showAttachments={attachments}\n markdown={markdown}\n // No actionsTrigger: the always-visible chevron stamped\n // into the bubble corner fought the bubble shape and\n // duplicated affordances a phone already has — long-press\n // opens the same sheet, swipe quotes. Touch conventions,\n // not desktop ones.\n //\n // The long-press is ALSO threaded into the bubble so the\n // image tiles — Pressables of their own, which win the\n // gesture — still open the sheet on an image-only message.\n onLongPress={() => {\n if (actions) setActionsOpen(true);\n }}\n />\n </Pressable>\n </Animated.View>\n\n {threads && (msg.reply_count ?? 0) > 0 && onOpenThread ? (\n <Pressable onPress={onOpenThread} style={styles.threadPill}>\n <Text style={[styles.threadPillText, { color: theme.colors.brand }]}>\n 💬 {msg.reply_count} {msg.reply_count === 1 ? 'reply' : 'replies'}\n </Text>\n </Pressable>\n ) : null}\n\n {reactions ? (\n <View style={[styles.reactionsRow, { alignSelf: isSelf ? 'flex-end' : 'flex-start' }]}>\n <ReactionStrip\n messageId={msg.id}\n conversationId={msg.conversation_id}\n meId={meId}\n {...(msg.reactions ? { initialReactions: msg.reactions } : {})}\n />\n </View>\n ) : null}\n </View>\n\n {actions && actionsOpen ? (\n <MessageActions\n visible={actionsOpen}\n onClose={() => setActionsOpen(false)}\n isSelf={isSelf}\n {...(reactions\n ? {\n // Inline quick-react row at the top of the sheet —\n // one tap = react + close, no second modal needed.\n onPickReaction: (emoji: string) => {\n void reactionsApi.addReaction(emoji);\n },\n }\n : {})}\n {...(msg.body && !msg.deleted_at\n ? {\n onCopy: () => {\n setActionsOpen(false);\n void Clipboard.setStringAsync(msg.body ?? '');\n },\n }\n : {})}\n {...(onStartEdit\n ? {\n onEdit: () => {\n setActionsOpen(false);\n onStartEdit();\n },\n }\n : {})}\n {...(onDelete\n ? {\n onDelete: () => {\n setActionsOpen(false);\n onDelete();\n },\n }\n : {})}\n {...(onOpenThread\n ? {\n onReplyInThread: () => {\n setActionsOpen(false);\n onOpenThread();\n },\n }\n : {})}\n {...(quotations && onQuote\n ? {\n onQuote: () => {\n setActionsOpen(false);\n onQuote();\n },\n }\n : {})}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n // Tighter vertical rhythm — was 2px each side (4px between rows)\n // plus the bubble's 4px marginBottom = 8px. Now 1+1+2 = 4px,\n // closer to iMessage / WhatsApp density.\n marginVertical: 1,\n // 10px on each side — tight enough to use the available width\n // for content, loose enough to keep bubbles off the screen edge\n // on every device.\n paddingHorizontal: 10,\n maxWidth: '95%',\n },\n rowEditing: {\n // Above ConversationView's editBackdrop (zIndex 5). Elevation\n // does the equivalent stacking on Android.\n zIndex: 10,\n elevation: 10,\n },\n avatarSlot: {\n width: 36,\n marginRight: 6,\n },\n bubbleCol: {\n flexShrink: 1,\n position: 'relative',\n },\n replyHint: {\n position: 'absolute',\n top: '50%',\n marginTop: -16,\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: -1,\n },\n replyHintLeft: {\n left: -44,\n },\n replyHintRight: {\n right: -44,\n },\n threadPill: {\n alignSelf: 'flex-start',\n marginTop: 2,\n paddingHorizontal: 8,\n paddingVertical: 3,\n },\n threadPillText: {\n fontSize: 11,\n fontWeight: '600',\n },\n reactionsRow: {\n marginTop: 2,\n },\n});\n","import type { Message, Uuid } from '@poolse/sdk';\nimport { useMe, useThread } from '@poolse/react';\nimport { useCallback, useMemo, useState, type ReactElement } from 'react';\nimport {\n Animated,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { AttachmentPicker } from './AttachmentPicker.js';\nimport { MessageComposer } from './MessageComposer.js';\nimport { MessageList } from './MessageList.js';\nimport { MessageRow } from './MessageRow.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './internal/edgeToEdge.js';\nimport { useSafeInsets } from './internal/safeArea.js';\nimport { UploadProvider } from './internal/uploadContext.js';\nimport { useDismissableSheet } from './internal/useDismissableSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface ThreadViewProps {\n visible: boolean;\n onClose: () => void;\n conversationId: Uuid;\n rootMessage: Message;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}\n\n// Sheet covers the bottom 88% of the screen. The remaining 12% is the\n// pull-down gutter (also the KeyboardAvoidingView's vertical offset).\nconst SHEET_HEIGHT_FRACTION = 0.88;\n\n/**\n * Bottom-sheet modal for thread replies. Pull the drag handle / header\n * down to dismiss; tap the backdrop or close button too. The composer\n * inside the sheet supports attachments (paperclip → picker, shared\n * upload queue) and the reply rows support reactions, swipe-to-reply,\n * long-press actions, edit, delete — same surface as ConversationView.\n *\n * Keyboard handling: the modal is translucent (edge-to-edge) on both\n * platforms, so nothing resizes it for the keyboard — Android's\n * `adjustResize` doesn't reach an edge-to-edge window. The composer\n * needs its own `padding` KeyboardAvoidingView with\n * `keyboardVerticalOffset` = the distance from the screen top to the\n * sheet top (the gutter), since KAV measures its frame relative to\n * its parent (the sheet), not the screen.\n */\nexport function ThreadView({\n visible,\n onClose,\n conversationId,\n rootMessage,\n labelFor,\n avatarFor,\n}: ThreadViewProps) {\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={onClose}\n // Edge-to-edge on Android like the host app, so the modal covers\n // the whole screen and the keyboard overlap is the same maths as\n // on iOS. The composer pads itself for the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* Each open of the thread gets its own UploadProvider so the\n composer's queue is isolated from the parent ConversationView's\n composer queue. */}\n <UploadProvider>\n <ThreadSheet\n onClose={onClose}\n conversationId={conversationId}\n rootMessage={rootMessage}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n </UploadProvider>\n </Modal>\n );\n}\n\nfunction ThreadSheet({\n onClose,\n conversationId,\n rootMessage,\n labelFor,\n avatarFor,\n}: {\n onClose: () => void;\n conversationId: Uuid;\n rootMessage: Message;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n}) {\n const theme = usePoolseTheme();\n const { me } = useMe();\n const meId = me?.id ?? null;\n const {\n replies,\n sendReply,\n edit,\n delete: deleteReply,\n loadMore,\n hasMore,\n } = useThread(conversationId, rootMessage.id);\n const insets = useSafeInsets();\n const { height: windowHeight } = useWindowDimensions();\n // Measured modal height — on some Android builds the window\n // dimensions exclude the nav bar while the translucent modal draws\n // under it, which would skew the keyboard offset by that much.\n const [rootHeight, setRootHeight] = useState(0);\n const screenHeight = rootHeight || windowHeight;\n // Never let the sheet's header slide under the status bar.\n const sheetHeight = Math.min(\n Math.round(screenHeight * SHEET_HEIGHT_FRACTION),\n screenHeight - insets.top - 8,\n );\n const gutter = screenHeight - sheetHeight;\n const { translateY, panHandlers } = useDismissableSheet({ onClose, sheetHeight });\n\n const [pickerOpen, setPickerOpen] = useState(false);\n const [editingId, setEditingId] = useState<string | null>(null);\n\n const renderReply = useCallback(\n (msg: Message): ReactElement => {\n const isSelf = meId !== null && msg.sender_id === meId;\n const canEdit = isSelf && !msg.deleted_at;\n return (\n <MessageRow\n msg={msg}\n meId={meId}\n // Reactions + actions on by default; nested threads off (you\n // can't thread inside a thread in v1).\n reactions\n attachments\n actions\n threads={false}\n // Quote-to-reply doesn't make sense inside a single-root thread.\n quotations={false}\n isEditing={editingId === msg.id}\n {...(canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {})}\n onDelete={() => {\n void deleteReply(msg.id);\n }}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n );\n },\n [meId, editingId, deleteReply, labelFor, avatarFor],\n );\n\n const editingMessage = useMemo(\n () => (editingId ? (replies.find((m) => m.id === editingId) ?? null) : null),\n [editingId, replies],\n );\n\n const rootRow = useMemo(\n () => (\n <MessageRow\n msg={rootMessage}\n meId={meId}\n reactions\n attachments\n actions={false}\n threads={false}\n quotations={false}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n ),\n [rootMessage, meId, labelFor, avatarFor],\n );\n\n return (\n <View\n style={styles.modalRoot}\n onLayout={(e) => setRootHeight(Math.round(e.nativeEvent.layout.height))}\n >\n <Pressable style={styles.backdrop} onPress={onClose} accessibilityLabel=\"Close thread\" />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n height: sheetHeight,\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* Wrap the header + drag pill in the pan handler so users can\n pull from a comfortable 60-pt-tall strip — the bare 16-pt\n pill on its own was nearly invisible to fingers. */}\n <View {...panHandlers}>\n <View style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={[styles.header, { borderBottomColor: theme.colors.border }]}>\n <Pressable\n onPress={onClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close thread\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n Thread\n </Text>\n </View>\n </View>\n\n {/* KAV scope: just the scrolling area + composer. `padding` on\n both platforms: the modal is full-screen and never resized,\n so the overlap is exactly the keyboard's height over the\n sheet bottom. The composer drops its nav-bar inset while the\n keyboard is up, so there's no gap above the keyboard. */}\n <KeyboardAvoidingView\n style={styles.kavBody}\n behavior=\"padding\"\n keyboardVerticalOffset={gutter}\n >\n <View style={[styles.rootPreview, { backgroundColor: theme.colors.surface2 }]}>\n {rootRow}\n </View>\n\n <View style={styles.listWrap}>\n <MessageList\n messages={replies}\n hasMore={hasMore}\n onLoadMore={loadMore}\n renderItem={renderReply}\n />\n </View>\n\n <MessageComposer\n onSend={async (body, opts) => {\n await sendReply({ body, ...opts });\n }}\n placeholder=\"Reply to thread…\"\n attachments\n onAttachPress={() => setPickerOpen(true)}\n editingMessage={editingMessage}\n onCancelEdit={() => setEditingId(null)}\n onSaveEdit={async (body) => {\n if (!editingId) return;\n await edit(editingId, body);\n setEditingId(null);\n }}\n />\n </KeyboardAvoidingView>\n\n <AttachmentPicker visible={pickerOpen} onClose={() => setPickerOpen(false)} />\n </Animated.View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n overflow: 'hidden',\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 6,\n paddingBottom: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n fontSize: 16,\n fontWeight: '600',\n },\n rootPreview: {\n paddingVertical: 8,\n paddingHorizontal: 8,\n },\n kavBody: {\n flex: 1,\n },\n listWrap: {\n flex: 1,\n },\n});\n","import { Text } from 'react-native';\nimport { useUser } from '@poolse/react';\n\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface UserNameProps {\n /** The user's external_id. Pass null to render the fallback. */\n externalId: string | null | undefined;\n /** Optional fallback when the resolver returns nothing. Defaults to the externalId itself. */\n fallback?: string;\n /** Caller-supplied label override; if it returns a string, it wins. */\n labelFor?: (externalId: string) => string;\n}\n\n/**\n * Display name for a user, looked up via the SDK's `userResolver`\n * with caller-overridable + fallback fallbacks. Renders a `<Text>`.\n */\nexport function UserName({ externalId, fallback, labelFor }: UserNameProps) {\n const theme = usePoolseTheme();\n const name = useDisplayName(externalId, labelFor) ?? fallback ?? externalId ?? '';\n return <Text style={{ color: theme.colors.ink, fontFamily: theme.type.fontBody }}>{name}</Text>;\n}\n\n/**\n * Resolves a user's display name via the 3-tier chain:\n * 1. `labelFor(externalId)` — caller-supplied override\n * 2. SDK `userResolver` (memoized via `useUser`)\n * 3. The externalId itself (so something always renders)\n */\nexport function useDisplayName(\n externalId: string | null | undefined,\n labelFor?: (externalId: string) => string,\n): string {\n const resolved = useUser(externalId ?? null);\n if (!externalId) return '';\n if (labelFor) {\n const override = labelFor(externalId);\n if (override) return override;\n }\n return resolved.profile?.displayName ?? externalId;\n}\n","import { useEffect, useRef } from 'react';\nimport { Animated, StyleSheet, Text, View, Easing } from 'react-native';\n\nimport { useDisplayName } from './UserName.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport interface TypingIndicatorProps {\n /** Set of `external_id`s currently typing — what `useTyping` returns. */\n typing: Set<string>;\n /**\n * Resolves an `external_id` to a display label. Defaults to the\n * SDK's `userResolver` (and falls back to the external_id itself\n * when the resolver isn't configured).\n */\n labelFor?: (externalId: string) => string;\n}\n\n/**\n * Three animated dots + an inline \"X is typing\" label. Renders a\n * zero-height row when nobody is typing so the list doesn't jump.\n */\nexport function TypingIndicator({ typing, labelFor }: TypingIndicatorProps) {\n const ids = Array.from(typing);\n const isTyping = ids.length > 0;\n\n if (!isTyping) return <View style={{ height: 0 }} />;\n\n return (\n <View style={styles.row}>\n <TypingDots />\n <TypingLabel ids={ids} {...(labelFor ? { labelFor } : {})} />\n </View>\n );\n}\n\nfunction TypingDots() {\n const theme = usePoolseTheme();\n const a = useRef(new Animated.Value(0)).current;\n const b = useRef(new Animated.Value(0)).current;\n const c = useRef(new Animated.Value(0)).current;\n\n useEffect(() => {\n const loop = (val: Animated.Value, delay: number) =>\n Animated.loop(\n Animated.sequence([\n Animated.delay(delay),\n Animated.timing(val, {\n toValue: 1,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n Animated.timing(val, {\n toValue: 0,\n duration: 400,\n easing: Easing.inOut(Easing.ease),\n useNativeDriver: true,\n }),\n ]),\n );\n const animations = [loop(a, 0), loop(b, 150), loop(c, 300)];\n animations.forEach((anim) => anim.start());\n return () => animations.forEach((anim) => anim.stop());\n }, [a, b, c]);\n\n const dot = (val: Animated.Value) => ({\n width: 6,\n height: 6,\n borderRadius: 3,\n backgroundColor: theme.colors.ink3,\n marginHorizontal: 2,\n transform: [\n {\n translateY: val.interpolate({ inputRange: [0, 1], outputRange: [0, -3] }),\n },\n ],\n opacity: val.interpolate({ inputRange: [0, 1], outputRange: [0.5, 1] }),\n });\n\n return (\n <View style={styles.dotsWrap}>\n <Animated.View style={dot(a)} />\n <Animated.View style={dot(b)} />\n <Animated.View style={dot(c)} />\n </View>\n );\n}\n\nfunction TypingLabel({\n ids,\n labelFor,\n}: {\n ids: string[];\n labelFor?: (externalId: string) => string;\n}) {\n const theme = usePoolseTheme();\n const id1 = ids[0] ?? null;\n const id2 = ids[1] ?? null;\n const name1 = useDisplayName(id1, labelFor);\n const name2 = useDisplayName(id2, labelFor);\n\n const text =\n ids.length === 1\n ? `${name1} is typing`\n : ids.length === 2\n ? `${name1} and ${name2} are typing`\n : `${ids.length} people are typing`;\n\n return (\n <Text style={[styles.label, { color: theme.colors.ink2, fontFamily: theme.type.fontBody }]}>\n {text}\n </Text>\n );\n}\n\nconst styles = StyleSheet.create({\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingVertical: 6,\n },\n dotsWrap: {\n flexDirection: 'row',\n alignItems: 'flex-end',\n marginRight: 8,\n height: 12,\n },\n label: {\n fontSize: 12,\n },\n});\n","import type { LiveCall, Message, Uuid } from '@poolse/sdk';\nimport {\n canEditOwnMessage,\n computeGroupPosition,\n formatDayLabel,\n isMessageVisibleTo,\n receiptsOf,\n sameDay,\n useMe,\n useMembers,\n useMessageStreams,\n useMessages,\n useRealtimeStatus,\n useLiveCall,\n useTyping,\n type MessageStream,\n} from '@poolse/react';\nimport { useCallback, useEffect, useMemo, useRef, useState, type ReactElement } from 'react';\nimport {\n AppState,\n KeyboardAvoidingView,\n Platform,\n Pressable,\n StyleSheet,\n Text,\n View,\n} from 'react-native';\n\nimport { AttachmentPicker } from './AttachmentPicker.js';\nimport { ChatHeader } from './ChatHeader.js';\nimport { DaySeparator } from './DaySeparator.js';\nimport { LiveCallBanner } from './LiveCallBanner.js';\nimport { MentionInput } from './MentionInput.js';\nimport { MessageComposer } from './MessageComposer.js';\nimport { MessageList, type MessageListItem } from './MessageList.js';\nimport { MessageRow } from './MessageRow.js';\nimport { ThreadView } from './ThreadView.js';\nimport { TypingIndicator } from './TypingIndicator.js';\nimport { UploadProvider } from './internal/uploadContext.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\n// Two messages from the same sender within this window collapse\n// into a visual cluster (tight margin, grouped bubble corners).\n// Matches the react-ui default.\nconst GROUPING_WINDOW_MS = 5 * 60 * 1000;\n\nexport interface ConversationViewProps {\n conversationId: Uuid;\n emptyState?: ReactElement | string;\n /**\n * Custom row renderer. Return `null` / `undefined` to fall back to\n * the default row for that message (so you can override just the\n * message kinds you care about).\n */\n renderMessage?: (msg: Message, currentUserId: string | null) => ReactElement | null | undefined;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n\n /**\n * Renders the default `<ChatHeader>` at the top of the chat surface.\n * * `true` (default) — auto chat header (other user / group name).\n * * `false` — no header (you supply your own above).\n * * `ReactElement` — custom header node, rendered as-is.\n */\n header?: boolean | ReactElement;\n /** Tap on the header's members icon — typically opens a sheet. */\n onHeaderMembersPress?: () => void;\n /** Tap on the header itself — typically opens a conversation profile. */\n onHeaderPress?: () => void;\n\n // Feature toggles — all default ON, identical names + defaults to web.\n reactions?: boolean;\n mentions?: boolean;\n attachments?: boolean;\n actions?: boolean;\n threads?: boolean;\n quotations?: boolean;\n readReceipts?: boolean;\n /** Render message bodies as Markdown (links, bold, code). Defaults true. */\n markdown?: boolean;\n maxBodyLength?: number;\n\n /** Show sender labels in group chats. `auto` (default), `always`, `never`. */\n senderLabels?: 'auto' | 'always' | 'never';\n /** Show avatars to the left of other-side bubbles in group chats. Same semantics. */\n avatars?: 'auto' | 'always' | 'never';\n\n /**\n * Fires when auto-mark-read commits a new server-side read cursor.\n * Receives the conversation id + the message id that was marked\n * as the last-read. Wire this to `useConversations().markConversationRead(convId, msgId)`\n * so the sidebar / list view's unread badge clears immediately\n * instead of waiting for the next conversations refetch.\n */\n onMarkedRead?: (conversationId: string, messageId: string) => void;\n /**\n * Fires after every successful message send. Wire to the parent's\n * `useConversations().refetch()` so the conversation list shows\n * the fresh `last_message_preview` / `last_message_at` for the\n * conversation you just sent into. `useConversations` creates\n * isolated state per call site, so ConversationView can't refresh\n * a parent hook's state on its own.\n */\n onSent?: (conversationId: string) => void;\n /**\n * keyboardVerticalOffset passed to the internal KeyboardAvoidingView.\n * On iOS this MUST equal the distance from the screen top to the\n * KAV's top (status bar + safe-area-top + any nav header above\n * the chat). `<PoolseInbox>` computes this for you. Standalone\n * consumers pass it manually.\n */\n keyboardOffset?: number;\n /**\n * Offer \"Call back\" on call-log rows the viewer missed or declined,\n * or placed with no answer. Receives the call's media; place the call\n * on this conversation.\n */\n onCallBack?: (media: 'audio' | 'video') => void;\n /**\n * Show a \"Call in progress · Join\" banner while a call runs on this\n * conversation that the viewer is not on. Called with the live call\n * when they tap Join.\n */\n onJoinCall?: (call: LiveCall) => void;\n /**\n * The call this device is already on, if any — its banner is hidden\n * (the viewer is in the room, or ringing out as its caller).\n */\n currentCallId?: string | null;\n}\n\nexport function ConversationView({\n conversationId,\n emptyState,\n renderMessage,\n labelFor,\n avatarFor,\n header = true,\n onHeaderMembersPress,\n onHeaderPress,\n reactions = true,\n mentions = true,\n attachments = true,\n actions = true,\n threads = true,\n quotations = true,\n readReceipts = true,\n markdown = true,\n maxBodyLength = 200,\n senderLabels = 'auto',\n avatars = 'auto',\n onMarkedRead,\n onSent,\n keyboardOffset = 0,\n onCallBack,\n onJoinCall,\n currentCallId = null,\n}: ConversationViewProps) {\n const theme = usePoolseTheme();\n const { me } = useMe();\n const meId = me?.id ?? null;\n // The workspace's read-receipt setting, for this user: hidden means no\n // check marks anywhere (the server withholds others' read state too).\n // Marking messages read is unaffected — it drives the user's own\n // unread counts.\n const receiptsVisible = receiptsOf(me).visible;\n const showReadState = readReceipts && receiptsVisible;\n\n const {\n messages,\n loading,\n hasMore,\n loadMore,\n send,\n edit,\n delete: deleteMsg,\n markReadUpTo,\n refetch,\n } = useMessages(conversationId);\n const { typing: typingPeople, signalTyping } = useTyping(conversationId);\n // AI agent replies being written. Before the first words arrive the\n // agent shows as typing; then its reply streams into a bubble.\n const streams = useMessageStreams(conversationId);\n const typing = useMemo(() => {\n const thinking = streams.filter((s) => s.status === 'streaming' && !s.text);\n if (thinking.length === 0) return typingPeople;\n const next = new Set(typingPeople);\n for (const s of thinking) if (s.sender_external_id) next.add(s.sender_external_id);\n return next;\n }, [typingPeople, streams]);\n const visibleStreams = streams.filter((s) => s.text || s.status === 'failed');\n const realtimeStatus = useRealtimeStatus();\n\n // Pull the latest page when the app foregrounds or the socket\n // reconnects. While the socket is down (background, network drop)\n // we miss `message:new` pushes; without this the chat shows stale\n // data until the user navigates away and back.\n useEffect(() => {\n const sub = AppState.addEventListener('change', (next) => {\n if (next === 'active') void refetch();\n });\n return () => sub.remove();\n }, [refetch]);\n\n const prevStatusRef = useRef(realtimeStatus);\n useEffect(() => {\n const prev = prevStatusRef.current;\n prevStatusRef.current = realtimeStatus;\n if (\n realtimeStatus === 'connected' &&\n (prev === 'reconnecting' || prev === 'closed' || prev === 'connecting')\n ) {\n void refetch();\n }\n }, [realtimeStatus, refetch]);\n\n const wantsMembers = mentions || senderLabels === 'auto' || avatars === 'auto';\n const { members } = useMembers(wantsMembers ? conversationId : '');\n const isGroupChat = members.length > 2;\n const showSenderLabels = senderLabels === 'always' || (senderLabels === 'auto' && isGroupChat);\n const showAvatars = avatars === 'always' || (avatars === 'auto' && isGroupChat);\n\n const [replyingTo, setReplyingTo] = useState<Message | null>(null);\n const [editingId, setEditingId] = useState<string | null>(null);\n const [threadRoot, setThreadRoot] = useState<Message | null>(null);\n const [pickerOpen, setPickerOpen] = useState(false);\n\n // messageId → sequence map for read-receipt comparison. Membership\n // only carries `last_read_message_id` (UUID); to know whether\n // member X read message Y we have to translate the read message's\n // id into its sequence and compare against Y's sequence. UUIDs\n // aren't chronological so we have to do this lookup explicitly.\n const sequenceByMessageId = useMemo(() => {\n const m = new Map<string, number>();\n for (const msg of messages) {\n if (typeof msg.sequence === 'number') m.set(msg.id, msg.sequence);\n }\n return m;\n }, [messages]);\n\n // Auto-mark-read: advance the read cursor whenever a confirmed\n // message lands at the tail. Skip optimistic temp messages\n // (no `sequence` yet — server hasn't seen the id) to avoid\n // 404s when send-then-immediately-mark races the round-trip.\n // Wrapping in try/catch lets us survive any other transient\n // membership-write failures without breaking the chat.\n const lastMarkedRef = useRef<string | null>(null);\n useEffect(() => {\n if (!readReceipts) return;\n if (messages.length === 0) return;\n const latest = messages[messages.length - 1];\n if (!latest || !latest.id) return;\n if (latest.id === lastMarkedRef.current) return;\n // Optimistic temp messages don't have a server-assigned sequence.\n // Marking them would 404 (server hasn't processed the send yet);\n // wait for the realtime confirmation to land, which replaces the\n // temp with a real message carrying a real sequence.\n if (typeof latest.sequence !== 'number' || latest.sequence <= 0) return;\n lastMarkedRef.current = latest.id;\n void markReadUpTo(latest.id).catch(() => {\n // Reset so we retry on the next message arrival.\n lastMarkedRef.current = null;\n });\n onMarkedRead?.(conversationId, latest.id);\n }, [messages, meId, readReceipts, markReadUpTo, onMarkedRead, conversationId]);\n\n // Precompute per-message group position (drives the bubble's\n // corner treatment + inter-cluster spacing). Same logic as\n // react-ui's ConversationView; the helpers live in @poolse/react.\n //\n // Runs over the *rendered* feed: call-log markers addressed to\n // someone else (a `call_missed` for another callee) are dropped\n // first so a hidden row never splits a bubble cluster or spawns an\n // orphan day separator. Call-log rows themselves never group\n // (`sameGroup` treats them as separators).\n const visibleMessages = useMemo(\n () => messages.filter((m) => isMessageVisibleTo(m, meId)),\n [messages, meId],\n );\n const groupPositionById = useMemo(() => {\n const map = new Map<string, ReturnType<typeof computeGroupPosition>>();\n for (let i = 0; i < visibleMessages.length; i++) {\n const msg = visibleMessages[i];\n if (!msg) continue;\n const prev = i > 0 ? (visibleMessages[i - 1] ?? null) : null;\n const next = i < visibleMessages.length - 1 ? (visibleMessages[i + 1] ?? null) : null;\n map.set(msg.id, computeGroupPosition(msg, prev, next, GROUPING_WINDOW_MS));\n }\n return map;\n }, [visibleMessages]);\n\n const renderItem = useCallback(\n (msg: Message): ReactElement => {\n if (renderMessage) {\n // null / undefined → fall through to the default row.\n const custom = renderMessage(msg, meId);\n if (custom !== null && custom !== undefined) return custom;\n }\n const readState: 'sent' | 'read' | undefined =\n showReadState && meId !== null && msg.sender_id === meId\n ? readStateForMessage(msg, members, meId, sequenceByMessageId)\n : undefined;\n // Edit is only offered for own messages no one else has read\n // yet — once someone has \"seen\" it (their last_read_message_id\n // sequence >= this one) WhatsApp-style apps disable editing to\n // prevent conversation rewriting. `readStateForMessage`\n // returns 'sent' in 1:1 chats with no other member, so own\n // messages in fresh threads stay editable. With read receipts\n // hidden by the workspace it is a 15-minute window instead\n // (canEditOwnMessage).\n const isSelf = meId !== null && msg.sender_id === meId;\n const canEdit = canEditOwnMessage({\n isSelf,\n deleted: !!msg.deleted_at,\n receiptsVisible,\n readState,\n insertedAt: msg.inserted_at,\n });\n const groupPosition = groupPositionById.get(msg.id) ?? 'standalone';\n return (\n <MessageRow\n msg={msg}\n meId={meId}\n reactions={reactions}\n attachments={attachments}\n actions={actions}\n threads={threads}\n quotations={quotations}\n {...(readState ? { readState } : {})}\n isEditing={editingId === msg.id}\n {...(canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {})}\n onDelete={() => deleteMsg(msg.id)}\n {...(threads ? { onOpenThread: () => setThreadRoot(msg) } : {})}\n {...(quotations ? { onQuote: () => setReplyingTo(msg) } : {})}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n showSenderName={showSenderLabels}\n showAvatar={showAvatars}\n maxBodyLength={maxBodyLength}\n groupPosition={groupPosition}\n markdown={markdown}\n {...(onCallBack ? { onCallBack } : {})}\n />\n );\n },\n [\n onCallBack,\n renderMessage,\n meId,\n readReceipts,\n showReadState,\n receiptsVisible,\n members,\n reactions,\n attachments,\n actions,\n threads,\n quotations,\n editingId,\n deleteMsg,\n labelFor,\n avatarFor,\n showSenderLabels,\n showAvatars,\n maxBodyLength,\n sequenceByMessageId,\n groupPositionById,\n markdown,\n ],\n );\n\n const editingMessage = useMemo(\n () => (editingId ? (messages.find((m) => m.id === editingId) ?? null) : null),\n [editingId, messages],\n );\n\n // Build the interleaved item list (messages + day separators).\n // Inject a separator BEFORE a message whenever its day differs\n // from the previous message's day.\n const listItems = useMemo<MessageListItem[]>(() => {\n const out: MessageListItem[] = [];\n let prev: Message | null = null;\n for (const msg of visibleMessages) {\n if (prev === null || !sameDay(msg.inserted_at, prev.inserted_at)) {\n const label = formatDayLabel(msg.inserted_at);\n out.push({\n kind: 'separator',\n id: `sep-${msg.id}`,\n node: <DaySeparator label={label} />,\n });\n }\n out.push({ kind: 'msg', msg });\n prev = msg;\n }\n return out;\n }, [visibleMessages]);\n\n const composerProps = useMemo(\n () => ({\n onSend: async (\n body: string,\n opts?: { quoted_message_id?: Uuid; attachment_ids?: Uuid[]; mentions?: Uuid[] },\n ) => {\n await send({ body, ...opts });\n setReplyingTo(null);\n // Tell the parent so it can refresh ITS useConversations\n // state. useConversations creates isolated state per call\n // site, so a refetch from here wouldn't update PoolseInbox's\n // list — only the parent's own hook instance can.\n onSent?.(conversationId);\n },\n onTyping: signalTyping,\n ...(attachments ? { onAttachPress: () => setPickerOpen(true) } : {}),\n ...(replyingTo ? { replyingTo } : {}),\n onCancelReply: () => setReplyingTo(null),\n ...(labelFor ? { labelFor } : {}),\n attachments,\n keyboardOffset,\n editingMessage,\n onCancelEdit: () => setEditingId(null),\n onSaveEdit: async (body: string) => {\n if (!editingId) return;\n await edit(editingId, body);\n setEditingId(null);\n },\n }),\n [\n send,\n signalTyping,\n attachments,\n replyingTo,\n labelFor,\n keyboardOffset,\n onSent,\n conversationId,\n editingMessage,\n editingId,\n edit,\n ],\n );\n\n const headerNode =\n header === false ? null : header === true ? (\n <ChatHeader\n conversationId={conversationId}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n {...(onHeaderMembersPress ? { onMembersPress: onHeaderMembersPress } : {})}\n {...(onHeaderPress ? { onPress: onHeaderPress } : {})}\n />\n ) : (\n header\n );\n\n return (\n <UploadProvider>\n <KeyboardAvoidingView\n // iOS uses `padding` (the height behavior is documented as\n // only working on absolute-positioned children and is\n // basically a no-op inside flex:1 chains like ours).\n // Padding mode REQUIRES the right keyboardVerticalOffset —\n // the distance from the screen top to the KAV's top.\n // PoolseInbox computes this from the safe-area top + its own\n // ChatHeader height and passes it through; standalone\n // consumers must pass it themselves.\n //\n // Android uses `height` — works there because the layout\n // recomputes from the Android window resize.\n style={[styles.root, { backgroundColor: theme.colors.paper }]}\n behavior={Platform.OS === 'ios' ? 'padding' : 'height'}\n keyboardVerticalOffset={keyboardOffset}\n >\n {headerNode}\n {onJoinCall ? (\n <JoinBanner\n conversationId={conversationId}\n meId={meId}\n currentCallId={currentCallId}\n onJoin={onJoinCall}\n />\n ) : null}\n <View style={styles.listWrap}>\n <MessageList\n messages={visibleMessages}\n items={listItems}\n meId={meId}\n loading={loading}\n hasMore={hasMore}\n onLoadMore={loadMore}\n renderItem={renderItem}\n ListHeader={\n <View>\n {visibleStreams.map((stream) =>\n stream.status === 'failed' ? (\n <Text\n key={stream.id}\n style={[styles.streamFailed, { color: theme.colors.ink3 }]}\n accessibilityRole=\"alert\"\n >\n {stream.error\n ? `The agent couldn't reply: ${stream.error}`\n : \"The agent couldn't reply.\"}\n </Text>\n ) : (\n <MessageRow\n key={stream.id}\n msg={streamingMessage(stream)}\n meId={meId}\n reactions={false}\n attachments={false}\n actions={false}\n threads={false}\n quotations={false}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n showSenderName={showSenderLabels}\n showAvatar={showAvatars}\n markdown={markdown}\n />\n ),\n )}\n <TypingIndicator typing={typing} {...(labelFor ? { labelFor } : {})} />\n </View>\n }\n {...(emptyState !== undefined ? { emptyState } : {})}\n />\n {/* WhatsApp-style dim while editing: the overlay covers\n the scroll surface but the row being edited renders\n above it (MessageRow elevates itself when isEditing).\n Tap-outside cancels. */}\n {editingId ? (\n <Pressable\n style={styles.editBackdrop}\n onPress={() => setEditingId(null)}\n accessibilityLabel=\"Cancel editing\"\n />\n ) : null}\n </View>\n\n {mentions ? (\n <MentionInput conversationId={conversationId} {...composerProps} />\n ) : (\n <MessageComposer {...composerProps} />\n )}\n\n {attachments ? (\n <AttachmentPicker visible={pickerOpen} onClose={() => setPickerOpen(false)} />\n ) : null}\n\n {threads && threadRoot ? (\n <ThreadView\n visible\n onClose={() => setThreadRoot(null)}\n conversationId={conversationId}\n rootMessage={threadRoot}\n {...(labelFor ? { labelFor } : {})}\n />\n ) : null}\n </KeyboardAvoidingView>\n </UploadProvider>\n );\n}\n\n// Its own component so the live-call subscription exists only for hosts\n// that asked for the banner.\nfunction JoinBanner({\n conversationId,\n meId,\n currentCallId,\n onJoin,\n}: {\n conversationId: string;\n meId: string | null;\n currentCallId: string | null;\n onJoin: (call: LiveCall) => void;\n}) {\n const { call, participantIds } = useLiveCall(conversationId);\n if (!call || call.id === currentCallId) return null;\n // Already in the room on another device: nothing to join.\n if (meId !== null && participantIds.includes(meId)) return null;\n return <LiveCallBanner call={call} inCall={participantIds.length} onJoin={onJoin} />;\n}\n\nfunction readStateForMessage(\n msg: Message,\n members: ReadonlyArray<{ user_id: string; last_read_message_id: string | null }>,\n meId: string,\n sequenceByMessageId: Map<string, number>,\n): 'sent' | 'read' {\n const otherMembers = members.filter((m) => m.user_id !== meId);\n if (otherMembers.length === 0) return 'sent';\n if (typeof msg.sequence !== 'number') return 'sent';\n const mySeq = msg.sequence;\n const anyRead = otherMembers.some((m) => {\n if (!m.last_read_message_id) return false;\n const readSeq = sequenceByMessageId.get(m.last_read_message_id);\n if (readSeq === undefined) return false;\n return readSeq >= mySeq;\n });\n return anyRead ? 'read' : 'sent';\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n },\n streamFailed: {\n fontSize: 12,\n marginHorizontal: 16,\n marginVertical: 4,\n },\n listWrap: {\n flex: 1,\n },\n editBackdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.45)',\n // Sit above message rows by default but below any row that\n // explicitly elevates itself (MessageRow bumps zIndex/elevation\n // when isEditing is true).\n zIndex: 5,\n },\n});\n\n// A streaming agent reply shaped as a Message, so it renders with the\n// same row and bubble as the finished one that replaces it. A caret\n// marks it as still being written.\nfunction streamingMessage(stream: MessageStream): Message {\n const now = new Date().toISOString();\n return {\n id: stream.id,\n tenant_id: '',\n conversation_id: stream.conversation_id,\n sender_id: stream.sender_id,\n sender_external_id: stream.sender_external_id,\n type: 'text',\n body: `${stream.text} ▍`,\n reply_to_id: null,\n thread_root_id: null,\n mentions: [],\n reactions: {},\n edited_at: null,\n deleted_at: null,\n sequence: Number.MAX_SAFE_INTEGER,\n inserted_at: now,\n updated_at: now,\n };\n}\n","import { useMemo, useState } from 'react';\nimport {\n Animated,\n FlatList,\n Image,\n KeyboardAvoidingView,\n Modal,\n Pressable,\n StyleSheet,\n Text,\n TextInput,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { Avatar } from '../primitives/Avatar.js';\nimport { PoolseIcon } from '../primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from './edgeToEdge.js';\nimport { useSafeInsets } from './safeArea.js';\nimport { useDismissableSheet } from './useDismissableSheet.js';\nimport { useKeyboardOpen } from './useKeyboardOpen.js';\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\n\nexport interface InboxUser {\n /** The user's external_id (the same id you mint JWTs with). */\n externalId: string;\n /** Display name shown in the picker row. */\n name: string;\n /** Optional avatar URL — falls back to initials if missing. */\n avatarUrl?: string | null;\n /** Optional secondary line (email, role, handle…). */\n subtitle?: string;\n}\n\nexport interface UserPickerSheetProps {\n visible: boolean;\n onClose: () => void;\n users: InboxUser[];\n /** External_ids to hide (usually the caller's own id). */\n excludeIds?: string[];\n /**\n * `single` → direct-chat mode; tap a row, fires onPickDirect, closes.\n * `group` → multi-select with a group-name input + Create button.\n */\n mode: 'single' | 'group';\n onPickDirect?: (externalId: string) => void;\n onCreateGroup?: (name: string, memberExternalIds: string[]) => void;\n /** Optional header slot — title defaults to \"New chat\" / \"New group\". */\n title?: string;\n /** Search input shown when user count ≥ 8. Override to force on/off. */\n searchable?: boolean;\n}\n\n/**\n * Bottom-sheet picker for selecting one or many users from the\n * tenant's user directory. Used by `<PoolseInbox>` for the\n * built-in \"New chat\" / \"New group\" flows. Exported standalone so\n * devs can drive it from their own UI (e.g. a \"Forward to…\" sheet).\n */\nexport function UserPickerSheet({\n visible,\n onClose,\n users,\n excludeIds,\n mode,\n onPickDirect,\n onCreateGroup,\n title,\n searchable,\n}: UserPickerSheetProps) {\n const theme = usePoolseTheme();\n const [query, setQuery] = useState('');\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n const [groupName, setGroupName] = useState('');\n const insets = useSafeInsets();\n const keyboardOpen = useKeyboardOpen();\n const { height: windowHeight } = useWindowDimensions();\n // Measured modal height — on some Android builds the window\n // dimensions exclude the nav bar while the translucent modal draws\n // under it, which would skew the keyboard offset by that much.\n const [rootHeight, setRootHeight] = useState(0);\n const screenHeight = rootHeight || windowHeight;\n // 85%, but never so tall the header slides under the status bar.\n const sheetHeight = Math.min(Math.round(screenHeight * 0.85), screenHeight - insets.top - 8);\n const { translateY, panHandlers } = useDismissableSheet({\n onClose: () => {\n // Reset selection state on dismiss so it doesn't survive\n // across opens.\n setQuery('');\n setSelectedIds([]);\n setGroupName('');\n onClose();\n },\n sheetHeight,\n });\n\n const excludeSet = useMemo(() => new Set(excludeIds ?? []), [excludeIds]);\n const filtered = useMemo(() => {\n const q = query.trim().toLowerCase();\n return users.filter((u) => {\n if (excludeSet.has(u.externalId)) return false;\n if (!q) return true;\n return (\n u.name.toLowerCase().includes(q) ||\n (u.subtitle ?? '').toLowerCase().includes(q) ||\n u.externalId.toLowerCase().includes(q)\n );\n });\n }, [users, query, excludeSet]);\n\n const showSearch = searchable ?? users.length >= 8;\n const isGroup = mode === 'group';\n const heading = title ?? (isGroup ? 'New group' : 'New chat');\n\n const reset = () => {\n setQuery('');\n setSelectedIds([]);\n setGroupName('');\n };\n\n const handleClose = () => {\n reset();\n onClose();\n };\n\n const toggle = (externalId: string) => {\n setSelectedIds((prev) =>\n prev.includes(externalId) ? prev.filter((id) => id !== externalId) : [...prev, externalId],\n );\n };\n\n const canCreate = isGroup && selectedIds.length > 0 && groupName.trim().length > 0;\n\n const handleCreate = () => {\n if (!canCreate) return;\n onCreateGroup?.(groupName.trim(), selectedIds);\n reset();\n onClose();\n };\n\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"slide\"\n onRequestClose={handleClose}\n // Edge-to-edge on Android like the host app, so the inset and\n // keyboard maths below hold on every device.\n {...EDGE_TO_EDGE_MODAL}\n >\n <View\n style={styles.modalRoot}\n onLayout={(e) => setRootHeight(Math.round(e.nativeEvent.layout.height))}\n >\n <Pressable style={styles.backdrop} onPress={handleClose} />\n\n <Animated.View\n style={[\n styles.sheet,\n {\n backgroundColor: theme.colors.paper,\n borderTopLeftRadius: theme.radii.xl,\n borderTopRightRadius: theme.radii.xl,\n height: sheetHeight,\n // Last row clears the nav bar — unless the keyboard is\n // covering it, where the inset would just be a gap.\n paddingBottom: keyboardOpen ? 0 : insets.bottom,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n transform: [{ translateY }],\n },\n theme.shadows.lg,\n ]}\n >\n {/* The group-name / search inputs open the keyboard over a\n translucent, never-resized modal. A `padding` KAV (both\n platforms) shrinks the list to end above the keyboard;\n the offset is the gutter above the sheet because KAV\n measures its frame relative to the sheet, not the screen. */}\n <KeyboardAvoidingView\n style={styles.kav}\n behavior=\"padding\"\n keyboardVerticalOffset={screenHeight - sheetHeight}\n >\n <View {...panHandlers} style={styles.dragHandle}>\n <View style={[styles.dragPill, { backgroundColor: theme.colors.ink3 }]} />\n </View>\n\n <View style={styles.header}>\n <Pressable\n onPress={handleClose}\n hitSlop={16}\n style={[styles.closeBtn, { backgroundColor: theme.colors.surface2 }]}\n accessibilityLabel=\"Close picker\"\n >\n <PoolseIcon name=\"close\" size={18} color={theme.colors.ink} />\n </Pressable>\n <Text\n style={[\n styles.title,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n numberOfLines={1}\n >\n {heading}\n </Text>\n {isGroup ? (\n <Pressable\n onPress={handleCreate}\n disabled={!canCreate}\n hitSlop={6}\n style={[\n styles.createBtn,\n {\n backgroundColor: canCreate ? theme.colors.brand : theme.colors.surface2,\n opacity: canCreate ? 1 : 0.6,\n },\n ]}\n >\n <Text\n style={{\n color: canCreate ? theme.colors.onBrand : theme.colors.ink3,\n fontWeight: '700',\n fontSize: 13,\n }}\n >\n Create{selectedIds.length > 0 ? ` (${selectedIds.length})` : ''}\n </Text>\n </Pressable>\n ) : null}\n </View>\n\n {isGroup ? (\n <TextInput\n placeholder=\"Group name\"\n placeholderTextColor={theme.colors.ink3}\n value={groupName}\n onChangeText={setGroupName}\n style={[\n styles.groupNameInput,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.md,\n fontFamily: theme.type.fontBody,\n fontSize: theme.type.bodySize,\n },\n ]}\n />\n ) : null}\n\n {showSearch ? (\n <TextInput\n placeholder=\"Search…\"\n placeholderTextColor={theme.colors.ink3}\n value={query}\n onChangeText={setQuery}\n style={[\n styles.searchInput,\n {\n color: theme.colors.ink,\n backgroundColor: theme.colors.surface2,\n borderRadius: theme.radii.md,\n fontFamily: theme.type.fontBody,\n fontSize: 14,\n },\n ]}\n />\n ) : null}\n\n <FlatList\n data={filtered}\n keyExtractor={(u) => u.externalId}\n // First tap selects a row even with the keyboard up.\n keyboardShouldPersistTaps=\"handled\"\n ListEmptyComponent={\n <View style={styles.empty}>\n <Text style={[styles.emptyText, { color: theme.colors.ink3 }]}>\n {query ? 'No matches.' : 'No users to show.'}\n </Text>\n </View>\n }\n renderItem={({ item }) => (\n <UserRow\n user={item}\n selected={selectedIds.includes(item.externalId)}\n isGroup={isGroup}\n onPress={() => {\n if (isGroup) toggle(item.externalId);\n else {\n onPickDirect?.(item.externalId);\n reset();\n onClose();\n }\n }}\n />\n )}\n />\n </KeyboardAvoidingView>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nfunction UserRow({\n user,\n selected,\n isGroup,\n onPress,\n}: {\n user: InboxUser;\n selected: boolean;\n isGroup: boolean;\n onPress: () => void;\n}) {\n const theme = usePoolseTheme();\n return (\n <Pressable\n onPress={onPress}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.brandSoft : 'transparent',\n },\n ]}\n >\n {user.avatarUrl ? (\n <Image source={{ uri: user.avatarUrl }} style={styles.avatarImg} />\n ) : (\n <Avatar src={null} name={user.name} seed={user.externalId} size=\"md\" />\n )}\n <View style={styles.body}>\n <Text\n style={[styles.name, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {user.name}\n </Text>\n {user.subtitle ? (\n <Text style={[styles.subtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {user.subtitle}\n </Text>\n ) : null}\n </View>\n {isGroup ? (\n <View\n style={[\n styles.checkbox,\n {\n borderColor: selected ? theme.colors.brand : theme.colors.border,\n backgroundColor: selected ? theme.colors.brand : 'transparent',\n },\n ]}\n >\n {selected ? <PoolseIcon name=\"check\" size={14} color={theme.colors.onBrand} /> : null}\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n modalRoot: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0,0,0,0.4)',\n },\n sheet: {\n overflow: 'hidden',\n },\n kav: {\n flex: 1,\n },\n dragHandle: {\n alignItems: 'center',\n paddingTop: 8,\n paddingBottom: 4,\n },\n dragPill: {\n width: 36,\n height: 4,\n borderRadius: 2,\n opacity: 0.4,\n },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 12,\n paddingTop: 4,\n paddingBottom: 12,\n gap: 10,\n },\n closeBtn: {\n width: 32,\n height: 32,\n borderRadius: 16,\n alignItems: 'center',\n justifyContent: 'center',\n },\n title: {\n fontSize: 17,\n fontWeight: '700',\n flex: 1,\n },\n createBtn: {\n paddingHorizontal: 14,\n paddingVertical: 7,\n borderRadius: 999,\n },\n groupNameInput: {\n marginHorizontal: 16,\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 10,\n fontWeight: '600',\n },\n searchInput: {\n marginHorizontal: 16,\n marginBottom: 8,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 16,\n paddingVertical: 10,\n gap: 12,\n },\n avatarImg: {\n width: 40,\n height: 40,\n borderRadius: 20,\n },\n body: {\n flex: 1,\n gap: 2,\n },\n name: {\n fontSize: 15,\n fontWeight: '600',\n },\n subtitle: {\n fontSize: 12,\n },\n checkbox: {\n width: 22,\n height: 22,\n borderRadius: 11,\n borderWidth: 1.5,\n alignItems: 'center',\n justifyContent: 'center',\n },\n empty: {\n paddingVertical: 40,\n alignItems: 'center',\n },\n emptyText: {\n fontSize: 13,\n },\n});\n","import type { Conversation, Uuid } from '@poolse/sdk';\nimport { formatCallLogPreview, useConversations, useMe, useUser } from '@poolse/react';\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport {\n Animated,\n Easing,\n Image,\n PanResponder,\n Pressable,\n StyleSheet,\n Text,\n useWindowDimensions,\n View,\n} from 'react-native';\n\nimport { ChatHeader } from './ChatHeader.js';\nimport { ConversationList } from './ConversationList.js';\nimport { ConversationView } from './ConversationView.js';\nimport { PoolseIcon } from './primitives/PoolseIcon.js';\nimport { Avatar } from './primitives/Avatar.js';\nimport { UserPickerSheet, type InboxUser } from './internal/UserPickerSheet.js';\nimport { usePoolseTheme } from './theme/PoolseTheme.js';\n\nexport type { InboxUser } from './internal/UserPickerSheet.js';\n\n// Height of the ChatHeader we render above ConversationView in the\n// detail pane. Hardcoded because ChatHeader has fixed vertical\n// padding (10 + 36 content + 10 ≈ 56). If you change ChatHeader's\n// padding, bump this constant.\nconst CHAT_HEADER_HEIGHT = 56;\n\nexport interface PoolseInboxProps {\n /** Header title above the conversation list. Defaults to \"Chats\". */\n title?: string;\n\n /**\n * The tenant's user directory. When provided, the inbox shows\n * \"New chat\" + \"New group\" buttons in the header. Omit if you\n * don't want the built-in picker UI (e.g. you start chats from\n * elsewhere via the imperative `openDirect()` API).\n */\n users?: InboxUser[];\n\n /** Display-name resolver for sender labels / chat header titles. */\n labelFor?: (externalId: string) => string;\n /** Avatar URL resolver. */\n avatarFor?: (externalId: string) => string | null;\n\n /**\n * Right-side slot in the header — typical use is a logout / settings\n * button. Rendered after the New-chat / New-group buttons.\n */\n renderRightAction?: () => ReactNode;\n\n /**\n * Custom row renderer for the conversation list. Receives the\n * conversation + the caller's external_id (resolved via `useMe`)\n * so you can branch on direct-vs-group display.\n */\n renderConversationRow?: (\n conv: Conversation,\n callerExternalId: string | null,\n selected: boolean,\n ) => ReactNode;\n\n /** Custom empty state when the list is empty. */\n emptyState?: ReactNode | string;\n\n /** Forwarded to `<ConversationView>` — set if you have a nav header above. */\n keyboardOffset?: number;\n}\n\nexport interface PoolseInboxHandle {\n /** Open a known conversation (e.g. from a deep link / push tap). */\n open: (conversationId: Uuid) => void;\n /**\n * Open (or create) a direct conversation with the given external_id.\n * The backend dedupes per pair — returns the existing conversation\n * if one already exists. Use this from a \"Message\" button on your\n * user profile screens.\n */\n openDirect: (externalId: string) => Promise<void>;\n /** Open (or create) a group conversation. */\n openGroup: (name: string, memberExternalIds: string[]) => Promise<void>;\n /** Open the built-in \"new chat\" picker programmatically. */\n promptNewChat: () => void;\n /** Open the built-in \"new group\" picker programmatically. */\n promptNewGroup: () => void;\n /** Pop back to the conversation list. */\n close: () => void;\n}\n\n/**\n * Drop-in inbox screen: scrollable list of conversations + chat\n * detail, with an iOS-style slide animation between them. Manages\n * its own navigation stack (no react-navigation needed). Picker\n * sheets for \"New chat\" / \"New group\" appear when `users` is\n * provided; otherwise the dev wires those flows themselves and\n * uses the imperative ref to open conversations.\n *\n * For the \"Message\" button on a user profile screen, hold a ref to\n * the inbox and call `inboxRef.current?.openDirect(externalId)`.\n */\nexport const PoolseInbox = forwardRef<PoolseInboxHandle, PoolseInboxProps>(\n function PoolseInbox(props, ref) {\n const {\n title = 'Chats',\n users,\n labelFor,\n avatarFor,\n renderRightAction,\n renderConversationRow,\n emptyState,\n keyboardOffset = 0,\n } = props;\n\n const theme = usePoolseTheme();\n const { width: screenWidth } = useWindowDimensions();\n const { me } = useMe();\n const {\n conversations,\n create,\n unreadCounts,\n markConversationRead,\n refetch: refetchConversations,\n } = useConversations();\n const meExternalId = me?.external_id ?? null;\n const meId = me?.id ?? null;\n // KAV.frame.y is measured relative to the SafeAreaView's\n // coordinate space (the SafeAreaView already absorbs the\n // safe-area-top inset). So the only chrome we need to compensate\n // for in keyboardVerticalOffset is our own ChatHeader above the\n // KAV. Adding insets.top on top double-counts and pushes the\n // composer way too far above the keyboard.\n const detailKeyboardOffset = CHAT_HEADER_HEIGHT;\n\n const [activeId, setActiveId] = useState<Uuid | null>(null);\n const [userPickerOpen, setUserPickerOpen] = useState(false);\n const [groupPickerOpen, setGroupPickerOpen] = useState(false);\n\n const slide = useRef(new Animated.Value(0)).current;\n // Flipped to true while the user is dragging the detail pane via\n // the edge-swipe gesture so the activeId-driven timing animation\n // doesn't fight the finger.\n const draggingRef = useRef(false);\n useEffect(() => {\n if (draggingRef.current) return;\n Animated.timing(slide, {\n toValue: activeId ? 1 : 0,\n duration: 280,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }, [activeId, slide]);\n\n const listTransform = slide.interpolate({\n inputRange: [0, 1],\n outputRange: [0, -Math.round(screenWidth * 0.25)],\n });\n const detailTransform = slide.interpolate({\n inputRange: [0, 1],\n outputRange: [screenWidth, 0],\n });\n\n // ── Edge-swipe-to-dismiss ────────────────────────────────────────\n // A thin invisible strip pinned to the screen's left edge owns a\n // PanResponder that drags the detail pane back to the right. Only\n // arms when:\n // - the detail pane is currently shown (activeId != null), AND\n // - the gesture starts within EDGE_WIDTH of the left screen edge,\n // AND\n // - the first movement is horizontal-dominant + rightward.\n // Those gates keep the strip from eating bubble swipes, vertical\n // scrolls, or back-button taps in the ChatHeader.\n const EDGE_WIDTH = 24;\n const DISMISS_VX_THRESHOLD = 0.4;\n const activeIdRef = useRef(activeId);\n useEffect(() => {\n activeIdRef.current = activeId;\n }, [activeId]);\n const panResponder = useMemo(() => {\n // Commit-vs-snap threshold scales with the screen so the gesture\n // feels right on phone widths AND tablets.\n const dismissDxThreshold = screenWidth * 0.35;\n return PanResponder.create({\n // Never claim the touch on start — that would swallow taps on\n // the back button in the ChatHeader strip.\n onStartShouldSetPanResponder: () => false,\n onStartShouldSetPanResponderCapture: () => false,\n onMoveShouldSetPanResponder: (_e, gs) => {\n if (!activeIdRef.current) return false;\n if (gs.x0 > EDGE_WIDTH) return false;\n return gs.dx > 6 && Math.abs(gs.dx) > Math.abs(gs.dy);\n },\n onMoveShouldSetPanResponderCapture: (_e, gs) => {\n if (!activeIdRef.current) return false;\n if (gs.x0 > EDGE_WIDTH) return false;\n return gs.dx > 6 && Math.abs(gs.dx) > Math.abs(gs.dy);\n },\n onPanResponderGrant: () => {\n draggingRef.current = true;\n slide.stopAnimation();\n },\n onPanResponderMove: (_e, gs) => {\n // Map finger displacement to slide: dx=0 → slide=1\n // (detail fully on); dx=screenWidth → slide=0 (off).\n const dx = Math.max(0, gs.dx);\n const progress = Math.min(1, dx / screenWidth);\n slide.setValue(1 - progress);\n },\n onPanResponderRelease: (_e, gs) => {\n draggingRef.current = false;\n const past = gs.dx > dismissDxThreshold || gs.vx > DISMISS_VX_THRESHOLD;\n if (past) {\n // Let the activeId-effect drive the close animation from\n // wherever the finger left the pane — Animated.timing\n // starts from the current value, so the motion is\n // continuous.\n setActiveId(null);\n } else {\n Animated.timing(slide, {\n toValue: 1,\n duration: 220,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n }\n },\n onPanResponderTerminate: () => {\n // Another responder took over (rare — scroll, dialog).\n // Snap back to \"open\" so the pane doesn't get stuck.\n draggingRef.current = false;\n Animated.timing(slide, {\n toValue: 1,\n duration: 220,\n easing: Easing.out(Easing.cubic),\n useNativeDriver: true,\n }).start();\n },\n onPanResponderTerminationRequest: () => false,\n });\n }, [slide, screenWidth]);\n\n const openDirect = useCallback(\n async (externalId: string) => {\n const conv = await create({\n type: 'direct',\n member_external_ids: [externalId],\n });\n setActiveId(conv.id);\n },\n [create],\n );\n\n const openGroup = useCallback(\n async (name: string, memberExternalIds: string[]) => {\n const conv = await create({\n type: 'group',\n name,\n member_external_ids: memberExternalIds,\n });\n setActiveId(conv.id);\n },\n [create],\n );\n\n useImperativeHandle(\n ref,\n () => ({\n open: setActiveId,\n openDirect,\n openGroup,\n promptNewChat: () => setUserPickerOpen(true),\n promptNewGroup: () => setGroupPickerOpen(true),\n close: () => setActiveId(null),\n }),\n [openDirect, openGroup],\n );\n\n const renderRow = useCallback(\n (conv: Conversation, selected: boolean) => {\n if (renderConversationRow) {\n return <>{renderConversationRow(conv, meExternalId, selected)}</>;\n }\n // Live unread count from useConversations — updates immediately\n // when markConversationRead fires, instead of waiting for the\n // next list refetch. Falls back to the server snapshot on the\n // conversation row when the live map doesn't have an entry yet.\n const unread = unreadCounts?.[conv.id] ?? conv.unread_count ?? 0;\n return (\n <DefaultConversationRow\n conv={conv}\n selected={selected}\n meExternalId={meExternalId}\n meId={meId}\n unread={unread}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n onPress={() => setActiveId(conv.id)}\n />\n );\n },\n [renderConversationRow, meExternalId, meId, labelFor, avatarFor, unreadCounts],\n );\n\n return (\n <View style={[styles.root, { backgroundColor: theme.colors.paper }]}>\n {/* LIST PANE */}\n <Animated.View\n style={[StyleSheet.absoluteFillObject, { transform: [{ translateX: listTransform }] }]}\n pointerEvents={activeId ? 'none' : 'auto'}\n >\n <View\n style={[\n styles.listHeader,\n {\n backgroundColor: theme.colors.surface,\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n <Text\n style={[\n styles.listTitle,\n { color: theme.colors.ink, fontFamily: theme.type.fontDisplay },\n ]}\n >\n {title}\n </Text>\n <View style={styles.headerActions}>\n {users ? (\n <>\n <HeaderIconButton\n icon=\"compose\"\n onPress={() => setUserPickerOpen(true)}\n label=\"New chat\"\n />\n <HeaderIconButton\n icon=\"users\"\n onPress={() => setGroupPickerOpen(true)}\n label=\"New group\"\n />\n </>\n ) : null}\n {renderRightAction?.()}\n </View>\n </View>\n\n <ConversationList\n conversations={conversations}\n renderItem={renderRow}\n {...(emptyState !== undefined ? { emptyState } : {})}\n />\n </Animated.View>\n\n {/* DETAIL PANE — our own ChatHeader (with onBack wired) above\n a ConversationView with header={false} so they don't stack.\n PanResponder lives on this wrapper (not a separate overlay\n strip) so taps fall straight through to the back button /\n attachment / send buttons — the strip approach would have\n stolen the leftmost slice of those tap targets. The gate in\n onMoveShouldSetPanResponderCapture restricts gestures to\n the left edge + horizontal-dominant + rightward, so vertical\n scrolling, swipe-to-reply on bubbles (which lives further\n inside), and button taps stay unaffected. */}\n <Animated.View\n style={[StyleSheet.absoluteFillObject, { transform: [{ translateX: detailTransform }] }]}\n pointerEvents={activeId ? 'auto' : 'none'}\n {...panResponder.panHandlers}\n >\n {activeId ? (\n <View style={{ flex: 1 }}>\n <ChatHeader\n conversationId={activeId}\n onBack={() => setActiveId(null)}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n <ConversationView\n key={activeId}\n conversationId={activeId}\n header={false}\n // Caller override wins; else use safe-area-top + our\n // ChatHeader height as the iOS keyboardVerticalOffset.\n keyboardOffset={keyboardOffset || detailKeyboardOffset}\n onMarkedRead={(convId) => {\n // Optimistic local clear so the badge disappears\n // immediately — server-side cursor was advanced\n // by ConversationView's markReadUpTo.\n markConversationRead(convId);\n }}\n onSent={() => {\n // useConversations is per-call-site state — only\n // OUR refetch updates the list's preview / timestamps.\n void refetchConversations();\n }}\n {...(labelFor ? { labelFor } : {})}\n {...(avatarFor ? { avatarFor } : {})}\n />\n </View>\n ) : null}\n </Animated.View>\n\n {/* Pickers */}\n {users ? (\n <UserPickerSheet\n visible={userPickerOpen}\n onClose={() => setUserPickerOpen(false)}\n users={users}\n excludeIds={meExternalId ? [meExternalId] : []}\n mode=\"single\"\n onPickDirect={(externalId) => {\n void openDirect(externalId);\n }}\n />\n ) : null}\n\n {users ? (\n <UserPickerSheet\n visible={groupPickerOpen}\n onClose={() => setGroupPickerOpen(false)}\n users={users}\n excludeIds={meExternalId ? [meExternalId] : []}\n mode=\"group\"\n onCreateGroup={(name, ids) => {\n void openGroup(name, ids);\n }}\n />\n ) : null}\n </View>\n );\n },\n);\n\nfunction HeaderIconButton({\n icon,\n onPress,\n label,\n}: {\n icon: 'compose' | 'users';\n onPress: () => void;\n label: string;\n}) {\n const theme = usePoolseTheme();\n return (\n <Pressable\n onPress={onPress}\n hitSlop={10}\n accessibilityLabel={label}\n style={({ pressed }) => [\n styles.iconBtn,\n {\n backgroundColor: pressed ? theme.colors.surface2 : 'transparent',\n },\n ]}\n >\n <PoolseIcon name={icon} size={20} color={theme.colors.ink} />\n </Pressable>\n );\n}\n\nfunction DefaultConversationRow({\n conv,\n selected,\n meExternalId,\n meId = null,\n unread,\n labelFor,\n avatarFor,\n onPress,\n}: {\n conv: Conversation;\n selected: boolean;\n meExternalId: string | null;\n meId?: string | null;\n unread: number;\n labelFor?: (externalId: string) => string;\n avatarFor?: (externalId: string) => string | null;\n onPress: () => void;\n}) {\n const theme = usePoolseTheme();\n\n // For directs, derive display from the OTHER member's external_id\n // (added to Conversation.member_external_ids by the backend). For\n // groups, use the conversation's own name + a group avatar tile.\n const isDirect = conv.type === 'direct';\n const otherExtId =\n isDirect && meExternalId\n ? (conv.member_external_ids ?? []).find((x) => x !== meExternalId)\n : null;\n\n // Priority: explicit prop > SDK userResolver > externalId fallback.\n // Inbox rows are typically the first place an avatar / name shows up\n // for a conversation, so the resolver must run here too — not only\n // inside ConversationView's bubbles.\n const resolvedOther = useUser(isDirect ? (otherExtId ?? null) : null);\n const title = isDirect\n ? otherExtId\n ? (labelFor?.(otherExtId) ?? resolvedOther.profile?.displayName ?? otherExtId)\n : 'Direct chat'\n : (conv.name ?? 'Untitled group');\n\n const avatarUrl =\n isDirect && otherExtId\n ? (avatarFor?.(otherExtId) ?? resolvedOther.profile?.avatarUrl ?? null)\n : null;\n const avatarSeed = isDirect ? (otherExtId ?? conv.id) : conv.id;\n\n return (\n <Pressable\n onPress={onPress}\n style={[\n styles.row,\n {\n backgroundColor: selected ? theme.colors.surface2 : 'transparent',\n borderBottomColor: theme.colors.border,\n },\n ]}\n >\n {avatarUrl ? (\n <Image source={{ uri: avatarUrl }} style={styles.rowAvatar} />\n ) : (\n <Avatar src={null} name={title} seed={avatarSeed} size=\"md\" />\n )}\n <View style={styles.rowBody}>\n <Text\n style={[styles.rowTitle, { color: theme.colors.ink, fontFamily: theme.type.fontBody }]}\n numberOfLines={1}\n >\n {title}\n </Text>\n <Text style={[styles.rowSubtitle, { color: theme.colors.ink3 }]} numberOfLines={1}>\n {formatCallLogPreview(conv.last_message_preview, meId) ??\n conv.last_message_preview ??\n (isDirect ? (otherExtId ?? '') : `${(conv.member_external_ids ?? []).length} members`)}\n </Text>\n </View>\n {unread > 0 ? (\n <View style={[styles.unreadPill, { backgroundColor: theme.colors.unreadPill }]}>\n <Text style={[styles.unreadText, { color: theme.colors.unreadPillText }]}>\n {unread > 99 ? '99+' : String(unread)}\n </Text>\n </View>\n ) : null}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n overflow: 'hidden',\n },\n listHeader: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 10,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n listTitle: {\n flex: 1,\n fontSize: 20,\n fontWeight: '700',\n },\n headerActions: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n iconBtn: {\n width: 36,\n height: 36,\n borderRadius: 18,\n alignItems: 'center',\n justifyContent: 'center',\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n paddingHorizontal: 14,\n paddingVertical: 12,\n borderBottomWidth: StyleSheet.hairlineWidth,\n gap: 12,\n },\n rowAvatar: {\n width: 44,\n height: 44,\n borderRadius: 22,\n },\n rowBody: {\n flex: 1,\n gap: 2,\n },\n rowTitle: {\n fontSize: 15,\n fontWeight: '600',\n },\n rowSubtitle: {\n fontSize: 12,\n },\n unreadPill: {\n minWidth: 22,\n height: 22,\n borderRadius: 11,\n paddingHorizontal: 7,\n alignItems: 'center',\n justifyContent: 'center',\n },\n unreadText: {\n fontSize: 11,\n fontWeight: '700',\n },\n});\n","import { Svg, Path, Circle, G } from 'react-native-svg';\n\nimport { usePoolseTheme } from '../theme/PoolseTheme.js';\n\nexport type PoolseLogoVariant = 'lockup' | 'mark' | 'wordmark' | 'mono';\n\nexport interface PoolseLogoProps {\n variant?: PoolseLogoVariant;\n /** Height in pixels — width is computed from the variant's aspect ratio. */\n size?: number;\n /** Mono variant accepts a color override; otherwise the theme drives fills. */\n color?: string;\n label?: string | null;\n}\n\nconst 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';\nconst PULSE_PATH = 'M16 55 H34 L40 55 L47 30 L54 73 L60 55 H72';\nconst WORDMARK_P_PATH =\n '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';\nconst WORDMARK_O_PATH =\n 'M305 -14Q225 -14 163.5 17.0Q102 48 67.0 110.0Q32 172 32 265Q32 358 67.0 419.5Q102 481 164.0 511.5Q226 542 306 542Q386 542 448.0 511.0Q510 480 545.0 418.5Q580 357 580 264Q580 169 544.0 107.0Q508 45 445.5 15.5Q383 -14 305 -14ZM310 103Q346 103 370.0 119.5Q394 136 406.0 170.0Q418 204 418 254Q418 307 405.0 343.5Q392 380 366.5 399.5Q341 419 301 419Q267 419 242.5 402.5Q218 386 206.0 352.0Q194 318 194 267Q194 185 224.5 144.0Q255 103 310 103Z';\nconst WORDMARK_L_PATH = 'M62 0V720H220V0Z';\nconst WORDMARK_S_PATH =\n 'M278 -14Q225 -14 182.0 -4.5Q139 5 107.0 23.0Q75 41 54.5 66.5Q34 92 26 123L146 176Q153 159 170.5 141.5Q188 124 217.5 113.0Q247 102 289 102Q329 102 351.5 113.5Q374 125 374 147Q374 163 361.5 172.5Q349 182 324.0 189.5Q299 197 262 204Q224 212 185.0 222.5Q146 233 112.0 251.5Q78 270 57.5 300.5Q37 331 37 378Q37 427 63.0 463.5Q89 500 140.5 521.0Q192 542 266 542Q332 542 382.0 525.0Q432 508 465.5 476.5Q499 445 512 401L383 355Q378 377 362.5 393.0Q347 409 323.5 417.5Q300 426 268 426Q229 426 207.5 414.0Q186 402 186 382Q186 366 200.5 355.5Q215 345 242.0 338.0Q269 331 306 323Q345 315 383.5 304.5Q422 294 453.5 276.5Q485 259 503.5 230.5Q522 202 522 157Q522 104 494.0 65.5Q466 27 411.5 6.5Q357 -14 278 -14Z';\nconst WORDMARK_E_PATH =\n 'M313 -14Q247 -14 195.0 3.5Q143 21 106.5 55.0Q70 89 51.0 139.0Q32 189 32 254Q32 317 50.5 370.0Q69 423 103.5 461.5Q138 500 188.5 521.0Q239 542 302 542Q366 542 414.5 521.5Q463 501 494.5 461.0Q526 421 541.0 363.5Q556 306 551 232L138 229V313L459 316L402 277Q409 327 396.0 358.5Q383 390 358.0 404.5Q333 419 304 419Q269 419 242.5 400.0Q216 381 201.0 345.0Q186 309 186 257Q186 175 221.5 138.0Q257 101 312 101Q339 101 357.0 108.5Q375 116 386.5 127.5Q398 139 404.5 153.0Q411 167 415 180L555 150Q547 113 529.5 83.0Q512 53 482.5 31.0Q453 9 411.5 -2.5Q370 -14 313 -14Z';\n\nconst VARIANT_VB: Record<\n PoolseLogoVariant,\n { vb: [number, number, number, number]; aspect: number }\n> = {\n lockup: { vb: [0, 0, 454, 100], aspect: 4.54 },\n mark: { vb: [0, 0, 100, 100], aspect: 1 },\n wordmark: { vb: [0, 0, 350, 100], aspect: 3.5 },\n mono: { vb: [0, 0, 454, 100], aspect: 4.54 },\n};\n\nexport function PoolseLogo({ variant = 'lockup', size = 28, color, label }: PoolseLogoProps) {\n const theme = usePoolseTheme();\n const mono = variant === 'mono';\n const monoColor = color ?? theme.colors.ink;\n\n const tileFill = mono ? 'none' : theme.colors.brand;\n const tileStroke = mono ? monoColor : 'transparent';\n const tileStrokeWidth = mono ? 5 : 0;\n const pulseStroke = mono ? monoColor : theme.colors.onBrand;\n const pulseDotFill = mono ? monoColor : theme.colors.onBrand;\n const inkFill = mono ? monoColor : theme.colors.ink;\n const oFill = mono ? monoColor : theme.colors.brand;\n\n const { vb, aspect } = VARIANT_VB[variant];\n const width = size * aspect;\n const showMark = variant === 'lockup' || variant === 'mark' || variant === 'mono';\n const showWordmark = variant === 'lockup' || variant === 'wordmark' || variant === 'mono';\n const wordmarkOffsetX = variant === 'wordmark' ? 0 : 126;\n\n const a11y = label === null ? {} : { accessibilityLabel: label ?? 'poolse' };\n return (\n <Svg viewBox={vb.join(' ')} width={width} height={size} {...a11y}>\n {showMark ? (\n <>\n <Path d={TILE_PATH} fill={tileFill} stroke={tileStroke} strokeWidth={tileStrokeWidth} />\n <Path\n d={PULSE_PATH}\n fill=\"none\"\n stroke={pulseStroke}\n strokeWidth={9}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n <Circle cx={72} cy={55} r={6.2} fill={pulseDotFill} />\n </>\n ) : null}\n {showWordmark ? (\n <G transform={`translate(${wordmarkOffsetX},85.0) scale(0.097222 -0.097222)`}>\n <Path d={WORDMARK_P_PATH} fill={inkFill} transform=\"translate(0,0)\" />\n <Path d={WORDMARK_O_PATH} fill={oFill} transform=\"translate(658,0)\" />\n <Path d={WORDMARK_O_PATH} fill={oFill} transform=\"translate(1280,0)\" />\n <Path d={WORDMARK_L_PATH} fill={inkFill} transform=\"translate(1902,0)\" />\n <Path d={WORDMARK_S_PATH} fill={inkFill} transform=\"translate(2195,0)\" />\n <Path d={WORDMARK_E_PATH} fill={inkFill} transform=\"translate(2754,0)\" />\n </G>\n ) : null}\n </Svg>\n );\n}\n","export { PoolseIcon, type PoolseIconProps, type IconName } from './PoolseIcon.js';\nexport { PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant } from './PoolseLogo.js';\nexport { Avatar, type AvatarProps } from './Avatar.js';\nexport { userColor } from './userColor.js';\n\n// Re-exported as a namespace for the public API surface.\nimport { PoolseIcon } from './PoolseIcon.js';\nimport { PoolseLogo } from './PoolseLogo.js';\nimport { Avatar } from './Avatar.js';\n\nexport const primitives = { PoolseIcon, PoolseLogo, Avatar };\n","import { useEffect } from 'react';\nimport { AppState, type AppStateStatus } from 'react-native';\nimport { usePoolse } from '@poolse/react';\n\n/**\n * Closes the SDK WebSocket when the app goes to the background and\n * reopens it when the app comes back. iOS and Android suspend sockets\n * in the background anyway; closing cleanly avoids a half-dead\n * connection on resume. poolse sends push notifications for messages\n * and calls itself, so nothing is lost while the socket is closed.\n *\n * Channel handles and their listeners survive the pause, so mounted\n * hooks keep working after resume, and `useMessages` /\n * `useConversations` reload from REST to catch up on what was sent\n * while the app was away.\n *\n * Mount once, inside the provider:\n *\n * <PoolseProvider config={config}>\n * <AppShell />\n * </PoolseProvider>\n *\n * function AppShell() {\n * useAppStateLifecycle();\n * return ...;\n * }\n */\nexport function useAppStateLifecycle() {\n const poolse = usePoolse();\n\n useEffect(() => {\n // Only 'background' pauses: iOS reports 'inactive' for the\n // notification centre or the app switcher, which is no reason to drop\n // the connection.\n const sub = AppState.addEventListener('change', (next: AppStateStatus) => {\n if (next === 'background') poolse.realtime.pause();\n else if (next === 'active') poolse.realtime.resume();\n });\n\n return () => sub.remove();\n }, [poolse]);\n}\n","/**\n * The call surface's own palette.\n *\n * Deliberately NOT the app theme. Every serious calling app — phone,\n * FaceTime, WhatsApp, Meet — renders calls dark regardless of the rest\n * of the UI, for three reasons that all apply here:\n *\n * * video is the content, and a light chrome around it washes the\n * picture out,\n * * a call screen is the one surface that routinely opens at 3am,\n * * it takes over the whole screen, so it reads as a mode change\n * rather than as a screen that has lost the app's styling.\n *\n * The brand still shows up — in the accept button and the speaking\n * ring — it just doesn't set the background.\n */\nexport const callColors = {\n /** Behind everything. Near-black, cooled toward the brand. */\n bg: '#0B0B14',\n /** The brand glow rising behind the identity block. */\n glow: '#5B54E8',\n /** The faint counter-glow low in the frame, for depth. */\n glowWarm: '#B16CEA',\n /** The floating control dock and the status pill. */\n glass: 'rgba(255,255,255,0.08)',\n glassBorder: 'rgba(255,255,255,0.12)',\n /** Behind a participant tile with no video. */\n tile: '#1c1c20',\n /** Scrim under the top/bottom chrome so text stays legible over video. */\n scrim: 'rgba(0,0,0,0.45)',\n\n text: '#ffffff',\n textDim: 'rgba(255,255,255,0.72)',\n textFaint: 'rgba(255,255,255,0.5)',\n\n /** A control that is off / inactive — translucent over whatever is behind. */\n control: 'rgba(255,255,255,0.16)',\n /**\n * A control that is ENGAGED (muted, speaker on, camera off).\n *\n * Inverted rather than tinted: at a glance the user needs to see\n * *which* controls are doing something, and a solid white circle is\n * unmistakable against five translucent ones in a dim room.\n */\n controlActive: '#ffffff',\n controlActiveIcon: '#101012',\n\n danger: '#ef4444',\n accept: '#22c55e',\n onAction: '#ffffff',\n} as const;\n\n/** Control button diameters. Hang-up is bigger; it is the one you reach for. */\nexport const CONTROL_SIZE = 58;\nexport const CONTROL_SIZE_LARGE = 68;\n","import { Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from '../primitives/PoolseIcon.js';\nimport { CONTROL_SIZE, CONTROL_SIZE_LARGE, callColors } from './callTheme.js';\n\nexport interface CallControlButtonProps {\n icon: IconName;\n /** Shown under the button. Omit for the hang-up / answer buttons. */\n label?: string | undefined;\n /**\n * The control is doing something — muted, speaker forced on, camera\n * off. Inverts the button so engaged controls are readable at a\n * glance.\n */\n active?: boolean;\n /** Paints the button a solid colour: the hang-up and answer actions. */\n tone?: 'neutral' | 'danger' | 'accept';\n large?: boolean;\n disabled?: boolean;\n onPress: () => void;\n /**\n * Spoken description. Defaults to `label`, but a toggle needs to say\n * what pressing it will DO, which is rarely what the label says —\n * \"Mute\" under a button that unmutes is exactly backwards for anyone\n * using a screen reader.\n */\n accessibilityLabel?: string | undefined;\n}\n\n/**\n * One round call control.\n *\n * Fixed diameter and a caption underneath, so a row of them lines up on\n * a grid regardless of label length — the thing that makes a control\n * bar look built rather than assembled.\n */\nexport function CallControlButton({\n icon,\n label,\n active = false,\n tone = 'neutral',\n large = false,\n disabled = false,\n onPress,\n accessibilityLabel,\n}: CallControlButtonProps) {\n const size = large ? CONTROL_SIZE_LARGE : CONTROL_SIZE;\n\n const background =\n tone === 'danger'\n ? callColors.danger\n : tone === 'accept'\n ? callColors.accept\n : active\n ? callColors.controlActive\n : callColors.control;\n\n const iconColor =\n tone === 'neutral' && active ? callColors.controlActiveIcon : callColors.onAction;\n\n return (\n <View style={styles.slot}>\n <Pressable\n onPress={onPress}\n disabled={disabled}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected: active }}\n accessibilityLabel={accessibilityLabel ?? label ?? icon}\n hitSlop={8}\n style={({ pressed }) => [\n styles.button,\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor: background,\n // Feedback without a layout shift — scaling a round button\n // inside a fixed slot keeps the row from twitching.\n opacity: disabled ? 0.4 : pressed ? 0.75 : 1,\n },\n ]}\n >\n <PoolseIcon name={icon} size={large ? 30 : 25} color={iconColor} label={null} />\n </Pressable>\n {label ? (\n <Text numberOfLines={1} style={styles.label}>\n {label}\n </Text>\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n // Fixed width so captions of different lengths cannot shift the row.\n slot: { width: 76, alignItems: 'center', gap: 7 },\n button: { alignItems: 'center', justifyContent: 'center' },\n label: { color: callColors.textDim, fontSize: 11.5, fontWeight: '500' },\n});\n","import { StyleSheet, Text, View } from 'react-native';\n\nimport { userColor } from '../primitives/userColor.js';\nimport { callColors } from './callTheme.js';\n\nexport interface CallAvatarProps {\n /** Display name; the first letters become the initials. */\n name: string;\n /** Stable colour seed — the poolse user id. */\n seed: string;\n size: number;\n /** Draw the active-speaker ring. */\n speaking?: boolean;\n}\n\n/**\n * The stand-in for a face when a camera is off.\n *\n * Separate from `<Avatar>` rather than a size variant of it: this one\n * scales to a third of the screen, carries the speaking ring, and lives\n * on a dark surface, none of which the list avatar wants.\n *\n * The ring sits OUTSIDE the circle, drawn as a border on a larger box.\n * Growing the avatar itself to show speaking would make everything jump\n * every time somebody starts talking.\n */\nexport function CallAvatar({ name, seed, size, speaking = false }: CallAvatarProps) {\n const ring = Math.max(2, Math.round(size * 0.045));\n const outer = size + ring * 4;\n\n return (\n <View\n style={[\n styles.ring,\n {\n width: outer,\n height: outer,\n borderRadius: outer / 2,\n borderWidth: ring,\n borderColor: speaking ? callColors.accept : 'transparent',\n },\n ]}\n >\n <View\n style={[\n styles.circle,\n {\n width: size,\n height: size,\n borderRadius: size / 2,\n backgroundColor: userColor(seed),\n },\n ]}\n >\n <Text\n style={[styles.initials, { fontSize: Math.round(size * 0.38) }]}\n numberOfLines={1}\n allowFontScaling={false}\n >\n {initialsOf(name)}\n </Text>\n </View>\n </View>\n );\n}\n\n/** Up to two initials, matching how the rest of the SDK derives them. */\nfunction initialsOf(name: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) return '?';\n if (parts.length === 1) return parts[0]!.slice(0, 2).toUpperCase();\n return (parts[0]![0]! + parts[parts.length - 1]![0]!).toUpperCase();\n}\n\nconst styles = StyleSheet.create({\n ring: { alignItems: 'center', justifyContent: 'center' },\n circle: { alignItems: 'center', justifyContent: 'center' },\n initials: { color: '#ffffff', fontWeight: '600' },\n});\n","import { Modal, Pressable, StyleSheet, Text, View } from 'react-native';\n\nimport { PoolseIcon, type IconName } from '../primitives/PoolseIcon.js';\nimport { EDGE_TO_EDGE_MODAL } from '../internal/edgeToEdge.js';\nimport { useSafeInsets } from '../internal/safeArea.js';\nimport { callColors } from './callTheme.js';\n\nexport type AudioRouteKind = 'speaker' | 'earpiece' | 'headset' | 'bluetooth' | 'auto';\n\n/** One place call audio can play — a row in the sheet. */\nexport interface AudioRoute {\n /** Platform id, passed back through `onSelect`. */\n id: string;\n kind: AudioRouteKind;\n /** Human label for the row. */\n label: string;\n}\n\nexport interface AudioRouteSheetProps {\n visible: boolean;\n routes: AudioRoute[];\n /** Platform id of the chosen route, or null while routing is automatic. */\n selectedRouteId: string | null;\n onSelect: (id: string) => void;\n onClose: () => void;\n}\n\nconst ICONS: Record<AudioRouteKind, IconName> = {\n speaker: 'speaker',\n earpiece: 'phone',\n headset: 'headphones',\n bluetooth: 'bluetooth',\n auto: 'phone',\n};\n\n/**\n * Pick where call audio comes out.\n *\n * Only worth showing when there is a real choice — more than the phone\n * and its speaker (AirPods, a car, a headset beside the speaker). With\n * just those two, a single speaker toggle is the better control.\n */\nexport function AudioRouteSheet({\n visible,\n routes,\n selectedRouteId,\n onSelect,\n onClose,\n}: AudioRouteSheetProps) {\n // The device's real insets — the sheet is a modal over the call.\n const insets = useSafeInsets();\n return (\n <Modal\n visible={visible}\n transparent\n animationType=\"fade\"\n onRequestClose={onClose}\n // Edge-to-edge on Android so the padding below is what clears\n // the nav bar.\n {...EDGE_TO_EDGE_MODAL}\n >\n {/* Tapping away closes it, which is what a sheet like this owes\n anyone who opened it by accident mid-call. */}\n <Pressable style={styles.backdrop} onPress={onClose} accessibilityRole=\"button\">\n <Pressable\n // The old fixed 34 was an iPhone home-indicator guess; a\n // 3-button Android nav bar is taller, so use the real inset.\n style={[styles.sheet, { paddingBottom: Math.max(34, insets.bottom + 16) }]}\n onPress={() => {}}\n >\n <View style={styles.grabber} />\n <Text style={styles.title}>Audio output</Text>\n\n {routes.map((route) => {\n const selected = route.id === selectedRouteId;\n return (\n <Pressable\n key={route.id}\n onPress={() => {\n onSelect(route.id);\n onClose();\n }}\n accessibilityRole=\"button\"\n accessibilityState={{ selected }}\n style={({ pressed }) => [styles.row, pressed && styles.rowPressed]}\n >\n <PoolseIcon\n name={ICONS[route.kind]}\n size={21}\n color={selected ? callColors.accept : callColors.text}\n label={null}\n />\n <Text style={[styles.label, selected && styles.labelSelected]}>{route.label}</Text>\n {selected && (\n <PoolseIcon name=\"check\" size={19} color={callColors.accept} label=\"selected\" />\n )}\n </Pressable>\n );\n })}\n </Pressable>\n </Pressable>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n backdrop: { flex: 1, backgroundColor: 'rgba(0,0,0,0.55)', justifyContent: 'flex-end' },\n sheet: {\n backgroundColor: callColors.tile,\n borderTopLeftRadius: 22,\n borderTopRightRadius: 22,\n paddingHorizontal: 12,\n paddingTop: 10,\n gap: 2,\n },\n grabber: {\n alignSelf: 'center',\n width: 38,\n height: 4,\n borderRadius: 2,\n backgroundColor: callColors.textFaint,\n marginBottom: 12,\n },\n title: {\n color: callColors.textDim,\n fontSize: 12.5,\n fontWeight: '600',\n textTransform: 'uppercase',\n letterSpacing: 0.6,\n paddingHorizontal: 12,\n paddingBottom: 8,\n },\n row: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 14,\n paddingHorizontal: 12,\n paddingVertical: 15,\n borderRadius: 14,\n },\n rowPressed: { backgroundColor: 'rgba(255,255,255,0.08)' },\n label: { flex: 1, color: callColors.text, fontSize: 16, fontWeight: '500' },\n labelSelected: { color: callColors.accept },\n});\n","import { useEffect, useRef, useState } from 'react';\n\n/**\n * How long the call has been connected, as `m:ss` (or `h:mm:ss`).\n *\n * Anchored to a timestamp rather than counting ticks: a phone that\n * sleeps or throttles timers would otherwise drift, and a call timer\n * that reads 4:12 after eleven minutes is worse than none. Returns null\n * until the call is actually up, so a ringing call shows its status\n * line instead of `0:00`.\n */\nexport function useCallDuration(connected: boolean): string | null {\n const startedAt = useRef<number | null>(null);\n const [, tick] = useState(0);\n\n if (connected && startedAt.current === null) startedAt.current = Date.now();\n if (!connected && startedAt.current !== null) startedAt.current = null;\n\n useEffect(() => {\n if (!connected) return;\n const id = setInterval(() => tick((n) => n + 1), 1000);\n return () => clearInterval(id);\n }, [connected]);\n\n if (!connected || startedAt.current === null) return null;\n return format(Math.max(0, Math.floor((Date.now() - startedAt.current) / 1000)));\n}\n\nfunction format(total: number): string {\n const hours = Math.floor(total / 3600);\n const minutes = Math.floor((total % 3600) / 60);\n const seconds = total % 60;\n const mm = hours > 0 ? String(minutes).padStart(2, '0') : String(minutes);\n return `${hours > 0 ? `${hours}:` : ''}${mm}:${String(seconds).padStart(2, '0')}`;\n}\n"]}
|