@vinaverse/react-native 0.1.0-alpha.10 → 0.1.0-alpha.11

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.
@@ -0,0 +1,673 @@
1
+ 'use strict';
2
+
3
+ var chunkXAG2P447_cjs = require('./chunk-XAG2P447.cjs');
4
+ var chunk6QYDPGRS_cjs = require('./chunk-6QYDPGRS.cjs');
5
+ var agent = require('@vinaverse/react/agent');
6
+ var history = require('@vinaverse/react/history');
7
+ var flashList = require('@shopify/flash-list');
8
+ var react$1 = require('@vinaverse/react');
9
+ var react = require('react');
10
+ var reactNative = require('react-native');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+
13
+ function AgentHistoryList(props) {
14
+ const copy = react.useMemo(
15
+ () => props.agentName ? { ...props.copy, agentFallbackName: props.agentName } : props.copy,
16
+ [props.agentName, props.copy]
17
+ );
18
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.CopyProvider, { locale: props.locale, copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunk6QYDPGRS_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(HistoryList, { ...props }) }) });
19
+ }
20
+ function alertConfirm(t) {
21
+ return () => new Promise((resolve) => {
22
+ reactNative.Alert.alert(
23
+ t("historyDeleteTitle"),
24
+ t("historyDeleteBody"),
25
+ [
26
+ { text: t("cancel"), style: "cancel", onPress: () => resolve(false) },
27
+ {
28
+ text: t("historyDelete"),
29
+ style: "destructive",
30
+ onPress: () => resolve(true)
31
+ }
32
+ ],
33
+ { cancelable: true, onDismiss: () => resolve(false) }
34
+ );
35
+ });
36
+ }
37
+ function HistoryList(props) {
38
+ const { t, locale, direction } = react$1.useCopy();
39
+ const { colors, space } = chunk6QYDPGRS_cjs.useTheme();
40
+ const runtime = agent.useAgentRuntime();
41
+ chunk6QYDPGRS_cjs.useAgentSweep(runtime);
42
+ const { name } = agent.useAgentProfile(t("agentFallbackName"));
43
+ const history$1 = history.useAgentHistory({
44
+ subject: props.subject,
45
+ mode: props.mode,
46
+ scope: props.scope ?? null,
47
+ agent: props.agent ?? null,
48
+ ...props.thread === void 0 ? {} : { thread: props.thread },
49
+ ...props.pageSize === void 0 ? {} : { pageSize: props.pageSize }
50
+ });
51
+ const { state } = history$1;
52
+ const [deleting, setDeleting] = react.useState(/* @__PURE__ */ new Set());
53
+ const [failed, setFailed] = react.useState(/* @__PURE__ */ new Set());
54
+ const { onOpen, onContinue, onWarning, confirmDelete, timeZone } = props;
55
+ const confirm = react.useMemo(
56
+ () => confirmDelete ?? alertConfirm(t),
57
+ [confirmDelete, t]
58
+ );
59
+ const remove = react.useCallback(
60
+ async (conversation) => {
61
+ if (!await confirm(conversation)) return;
62
+ mark(setDeleting, conversation.id, true);
63
+ mark(setFailed, conversation.id, false);
64
+ try {
65
+ await history$1.remove(conversation);
66
+ } catch (error) {
67
+ mark(setFailed, conversation.id, true);
68
+ onWarning?.(`Vinaverse history: delete failed: ${String(error)}`, {
69
+ code: "delete_failed"
70
+ });
71
+ } finally {
72
+ mark(setDeleting, conversation.id, false);
73
+ }
74
+ },
75
+ [confirm, history$1, onWarning]
76
+ );
77
+ const slots = props.components ?? {};
78
+ const { Row: Row2, Empty, Failure, ListComponent } = slots;
79
+ const renderItem = react.useCallback(
80
+ ({ item }) => {
81
+ const own = {
82
+ conversation: item,
83
+ when: react$1.formatDateTime(item.last_activity_at, locale, timeZone),
84
+ messages: t("historyMessages", { count: item.message_count }),
85
+ ended: item.state === "ended",
86
+ onOpen: onOpen ? () => onOpen(item) : void 0,
87
+ onContinue: onContinue && item.state === "open" ? () => onContinue(item, history$1.continue(item)) : void 0,
88
+ onDelete: () => void remove(item),
89
+ deleting: deleting.has(item.id),
90
+ deleteFailed: failed.has(item.id)
91
+ };
92
+ return Row2 ? /* @__PURE__ */ jsxRuntime.jsx(Row2, { ...own, Default: DefaultHistoryRow }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultHistoryRow, { ...own });
93
+ },
94
+ [
95
+ Row2,
96
+ locale,
97
+ timeZone,
98
+ t,
99
+ onOpen,
100
+ onContinue,
101
+ history$1,
102
+ remove,
103
+ deleting,
104
+ failed
105
+ ]
106
+ );
107
+ const empty = state.failure && state.conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Failure ? /* @__PURE__ */ jsxRuntime.jsx(
108
+ Failure,
109
+ {
110
+ reason: state.failure,
111
+ onRetry: history$1.refresh,
112
+ Default: DefaultHistoryFailure
113
+ }
114
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
115
+ DefaultHistoryFailure,
116
+ {
117
+ reason: state.failure,
118
+ onRetry: history$1.refresh
119
+ }
120
+ ) }) : state.started && !state.loading ? /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Empty ? /* @__PURE__ */ jsxRuntime.jsx(Empty, { agentName: name, Default: DefaultHistoryEmpty }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultHistoryEmpty, { agentName: name }) }) : null;
121
+ const footer = state.loading && state.conversations.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { padding: space.md, alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
122
+ reactNative.ActivityIndicator,
123
+ {
124
+ color: colors.textMuted,
125
+ accessibilityLabel: t("loading")
126
+ }
127
+ ) }) : state.failure && state.conversations.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { padding: space.sm, alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(chunkXAG2P447_cjs.Button, { label: t("tryAgain"), variant: "text", onPress: history$1.retry }) }) : null;
128
+ const list = react.useMemo(
129
+ () => ({
130
+ data: state.conversations,
131
+ renderItem,
132
+ keyExtractor: (item) => item.id,
133
+ onEndReached: history$1.loadMore,
134
+ onRefresh: history$1.refresh,
135
+ refreshing: state.loading && state.conversations.length === 0,
136
+ ListFooterComponent: footer,
137
+ ListEmptyComponent: empty,
138
+ contentContainerStyle: { paddingVertical: space.sm }
139
+ }),
140
+ [state, renderItem, history$1, footer, empty, space.sm]
141
+ );
142
+ const List = ListComponent;
143
+ return /* @__PURE__ */ jsxRuntime.jsx(
144
+ reactNative.View,
145
+ {
146
+ testID: props.testID ?? "vinaverse-history",
147
+ style: [
148
+ { flex: 1, backgroundColor: colors.background, direction },
149
+ props.style
150
+ ],
151
+ children: List ? /* @__PURE__ */ jsxRuntime.jsx(List, { ...list }) : /* @__PURE__ */ jsxRuntime.jsx(flashList.FlashList, { ...list })
152
+ }
153
+ );
154
+ }
155
+ var mark = (set, id, on) => set((s) => {
156
+ const next = new Set(s);
157
+ if (on) next.add(id);
158
+ else next.delete(id);
159
+ return next;
160
+ });
161
+ function Centered(props) {
162
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
163
+ return /* @__PURE__ */ jsxRuntime.jsx(
164
+ reactNative.View,
165
+ {
166
+ style: {
167
+ alignItems: "center",
168
+ justifyContent: "center",
169
+ padding: space.xl
170
+ },
171
+ children: props.children
172
+ }
173
+ );
174
+ }
175
+ function DefaultHistoryRow(props) {
176
+ const { t } = react$1.useCopy();
177
+ const { colors, space, font, radius } = chunk6QYDPGRS_cjs.useTheme();
178
+ const { conversation } = props;
179
+ const detail = [
180
+ props.when,
181
+ props.messages,
182
+ props.ended ? t("historyEnded") : null
183
+ ].filter(Boolean).join(" \xB7 ");
184
+ return /* @__PURE__ */ jsxRuntime.jsxs(
185
+ reactNative.View,
186
+ {
187
+ style: {
188
+ marginHorizontal: space.lg,
189
+ marginVertical: space.xs,
190
+ borderRadius: radius.lg,
191
+ backgroundColor: colors.surface,
192
+ opacity: props.deleting ? 0.6 : 1
193
+ },
194
+ testID: `vinaverse-history-${conversation.id}`,
195
+ children: [
196
+ /* @__PURE__ */ jsxRuntime.jsxs(
197
+ reactNative.Pressable,
198
+ {
199
+ accessibilityRole: "button",
200
+ accessibilityLabel: `${conversation.title}. ${detail}`,
201
+ accessibilityState: { disabled: !props.onOpen || props.deleting },
202
+ disabled: !props.onOpen || props.deleting,
203
+ onPress: props.onOpen,
204
+ style: { paddingHorizontal: space.md, paddingTop: space.md },
205
+ children: [
206
+ /* @__PURE__ */ jsxRuntime.jsx(
207
+ reactNative.Text,
208
+ {
209
+ numberOfLines: 2,
210
+ style: {
211
+ color: colors.text,
212
+ fontSize: font.size.md,
213
+ fontWeight: "600",
214
+ ...font.family ? { fontFamily: font.family } : {}
215
+ },
216
+ children: conversation.title
217
+ }
218
+ ),
219
+ /* @__PURE__ */ jsxRuntime.jsx(
220
+ reactNative.Text,
221
+ {
222
+ style: {
223
+ color: colors.textMuted,
224
+ fontSize: font.size.sm,
225
+ marginTop: space.xxs
226
+ },
227
+ children: detail
228
+ }
229
+ )
230
+ ]
231
+ }
232
+ ),
233
+ /* @__PURE__ */ jsxRuntime.jsxs(
234
+ reactNative.View,
235
+ {
236
+ style: {
237
+ flexDirection: "row",
238
+ alignItems: "center",
239
+ gap: space.xs,
240
+ paddingHorizontal: space.xs
241
+ },
242
+ children: [
243
+ props.onContinue ? /* @__PURE__ */ jsxRuntime.jsx(
244
+ chunkXAG2P447_cjs.Button,
245
+ {
246
+ label: t("historyContinue"),
247
+ variant: "text",
248
+ disabled: props.deleting,
249
+ onPress: props.onContinue
250
+ }
251
+ ) : null,
252
+ /* @__PURE__ */ jsxRuntime.jsx(
253
+ chunkXAG2P447_cjs.Button,
254
+ {
255
+ label: t("historyDelete"),
256
+ variant: "text",
257
+ busy: props.deleting,
258
+ onPress: props.onDelete
259
+ }
260
+ ),
261
+ props.deleteFailed ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.danger, fontSize: font.size.xs }, children: t("historyDeleteFailed") }) : null
262
+ ]
263
+ }
264
+ )
265
+ ]
266
+ }
267
+ );
268
+ }
269
+ function DefaultHistoryEmpty(props) {
270
+ const { t } = react$1.useCopy();
271
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
272
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { alignItems: "center", gap: space.sm }, children: [
273
+ /* @__PURE__ */ jsxRuntime.jsx(
274
+ reactNative.Text,
275
+ {
276
+ style: {
277
+ color: colors.text,
278
+ fontSize: font.size.lg,
279
+ fontWeight: "600",
280
+ textAlign: "center"
281
+ },
282
+ children: t("historyEmpty")
283
+ }
284
+ ),
285
+ /* @__PURE__ */ jsxRuntime.jsx(
286
+ reactNative.Text,
287
+ {
288
+ style: {
289
+ color: colors.textMuted,
290
+ fontSize: font.size.md,
291
+ textAlign: "center"
292
+ },
293
+ children: t("historyEmptyBody", { agent: props.agentName })
294
+ }
295
+ )
296
+ ] });
297
+ }
298
+ function DefaultHistoryFailure(props) {
299
+ const { t } = react$1.useCopy();
300
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
301
+ const off = props.reason === "off";
302
+ return /* @__PURE__ */ jsxRuntime.jsxs(
303
+ reactNative.View,
304
+ {
305
+ accessibilityRole: "alert",
306
+ style: { alignItems: "center", gap: space.md },
307
+ children: [
308
+ /* @__PURE__ */ jsxRuntime.jsx(
309
+ reactNative.Text,
310
+ {
311
+ style: {
312
+ color: colors.text,
313
+ fontSize: font.size.md,
314
+ textAlign: "center"
315
+ },
316
+ children: t(off ? "historyOff" : "historyFailed")
317
+ }
318
+ ),
319
+ off ? null : /* @__PURE__ */ jsxRuntime.jsx(
320
+ chunkXAG2P447_cjs.Button,
321
+ {
322
+ label: t("tryAgain"),
323
+ variant: "primary",
324
+ onPress: props.onRetry
325
+ }
326
+ )
327
+ ]
328
+ }
329
+ );
330
+ }
331
+
332
+ // src/components/readOnlyStore.ts
333
+ var none = () => () => void 0;
334
+ function readOnlyStore(view) {
335
+ const snapshot = {
336
+ status: "ready",
337
+ conversationId: view.conversationId,
338
+ banner: null,
339
+ next: null,
340
+ agent: { name: view.agentName, avatarUrl: view.agentAvatar },
341
+ welcome: null,
342
+ disclosure: null,
343
+ takeover: null,
344
+ items: view.items,
345
+ activity: [],
346
+ responding: false,
347
+ openQuestion: null,
348
+ answersNeedWebSocket: false,
349
+ turnsLeft: null,
350
+ history: "restored"
351
+ };
352
+ return {
353
+ getSnapshot: () => snapshot,
354
+ subscribe: none,
355
+ getStreaming: () => null,
356
+ subscribeStreaming: none,
357
+ send: () => "",
358
+ retry: () => null,
359
+ retryTurn: () => null,
360
+ cancel: () => void 0,
361
+ answer: () => "",
362
+ cardAction: () => "",
363
+ decideProposal: () => Promise.resolve(null),
364
+ checkLink: () => false,
365
+ continueHere: () => Promise.resolve(),
366
+ setForeground: () => void 0,
367
+ start: () => void 0
368
+ };
369
+ }
370
+ function AgentTranscript(props) {
371
+ const copy = react.useMemo(
372
+ () => props.agentName ? { ...props.copy, agentFallbackName: props.agentName } : props.copy,
373
+ [props.agentName, props.copy]
374
+ );
375
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.CopyProvider, { locale: props.locale, copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunk6QYDPGRS_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(Transcript, { ...props }) }) });
376
+ }
377
+ var EMPTY_SLOTS = {};
378
+ function Transcript(props) {
379
+ const { t, direction } = react$1.useCopy();
380
+ const { colors, space } = chunk6QYDPGRS_cjs.useTheme();
381
+ const runtime = agent.useAgentRuntime();
382
+ const profile = agent.useAgentProfile(t("agentFallbackName"));
383
+ const name = profile.name;
384
+ const avatar = props.agentAvatar ?? profile.avatarUrl;
385
+ const transcript = history.useAgentTranscript(props.conversationId, {
386
+ ...props.pageSize === void 0 ? {} : { pageSize: props.pageSize }
387
+ });
388
+ const { state } = transcript;
389
+ const slots = props.components ?? EMPTY_SLOTS;
390
+ const { Header, Failure, ListComponent } = slots;
391
+ const chatSlots = react.useMemo(() => {
392
+ const { Header: _h, Failure: _f, ListComponent: _l, ...rest } = slots;
393
+ return rest;
394
+ }, [slots]);
395
+ const store = react.useMemo(
396
+ () => readOnlyStore({
397
+ items: state.items,
398
+ conversationId: props.conversationId,
399
+ agentName: name,
400
+ agentAvatar: avatar
401
+ }),
402
+ [state.items, props.conversationId, name, avatar]
403
+ );
404
+ const handlers = react.useRef({});
405
+ handlers.current = {
406
+ ...props.prefetchImage ? { prefetchImage: props.prefetchImage } : {}
407
+ };
408
+ const value = react.useMemo(
409
+ () => ({
410
+ store,
411
+ handlers,
412
+ slots: chatSlots,
413
+ agentAvatar: props.agentAvatar,
414
+ timeZone: props.timeZone,
415
+ failureAction: null,
416
+ starters: void 0,
417
+ imagePolicy: props.imagePolicy
418
+ }),
419
+ [store, chatSlots, props.agentAvatar, props.timeZone, props.imagePolicy]
420
+ );
421
+ const header = { name, avatarUrl: avatar, takeoverBy: null };
422
+ const gone = state.failure === "not_found" || state.failure === "expired" || state.failure === "ended";
423
+ const onContinue = props.onContinue;
424
+ const agentKey = props.agentKey;
425
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkXAG2P447_cjs.ChatContextProvider, { value, children: /* @__PURE__ */ jsxRuntime.jsxs(
426
+ reactNative.View,
427
+ {
428
+ testID: props.testID ?? "vinaverse-transcript",
429
+ style: [
430
+ { flex: 1, backgroundColor: colors.background, direction },
431
+ props.style
432
+ ],
433
+ children: [
434
+ props.hideHeader ? null : Header ? /* @__PURE__ */ jsxRuntime.jsx(Header, { ...header, Default: chunkXAG2P447_cjs.DefaultHeader }) : /* @__PURE__ */ jsxRuntime.jsx(chunkXAG2P447_cjs.DefaultHeader, { ...header }),
435
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXAG2P447_cjs.DisclosureBar, {}),
436
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { flex: 1 }, children: state.failure && state.items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(Centered2, { children: Failure ? /* @__PURE__ */ jsxRuntime.jsx(
437
+ Failure,
438
+ {
439
+ reason: state.failure,
440
+ gone,
441
+ onRetry: transcript.load,
442
+ Default: DefaultTranscriptFailure
443
+ }
444
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
445
+ DefaultTranscriptFailure,
446
+ {
447
+ reason: state.failure,
448
+ gone,
449
+ onRetry: transcript.load
450
+ }
451
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(
452
+ TranscriptList,
453
+ {
454
+ items: state.items,
455
+ loading: state.loading,
456
+ more: !state.done && state.started && !state.loading,
457
+ failed: state.failure !== null,
458
+ onEarlier: transcript.loadEarlier,
459
+ onRetry: transcript.retry,
460
+ ListComponent,
461
+ grouped: chatSlots.CardGroup !== void 0
462
+ }
463
+ ) }),
464
+ onContinue && agentKey && !gone && props.ended !== true ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { padding: space.lg }, children: /* @__PURE__ */ jsxRuntime.jsx(
465
+ chunkXAG2P447_cjs.Button,
466
+ {
467
+ label: t("historyContinue"),
468
+ variant: "primary",
469
+ onPress: () => onContinue(runtime.continue(agentKey, props.conversationId))
470
+ }
471
+ ) }) : null
472
+ ]
473
+ }
474
+ ) });
475
+ }
476
+ function authorOf(item) {
477
+ return item?.type === "message" ? item.role : null;
478
+ }
479
+ function TranscriptList(props) {
480
+ const { t } = react$1.useCopy();
481
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
482
+ const reducedMotion = chunk6QYDPGRS_cjs.useReducedMotion();
483
+ const { items, grouped } = props;
484
+ const runsRef = react.useRef(/* @__PURE__ */ new Map());
485
+ const grouping = react.useMemo(
486
+ () => grouped ? chunkXAG2P447_cjs.carousels(items, runsRef.current) : null,
487
+ [items, grouped]
488
+ );
489
+ runsRef.current = grouping?.runs ?? /* @__PURE__ */ new Map();
490
+ const itemsRef = react.useRef(items);
491
+ itemsRef.current = items;
492
+ const groupingRef = react.useRef(grouping);
493
+ groupingRef.current = grouping;
494
+ const renderItem = react.useCallback(
495
+ ({ item, index }) => /* @__PURE__ */ jsxRuntime.jsx(
496
+ chunkXAG2P447_cjs.Row,
497
+ {
498
+ item,
499
+ showAuthor: authorOf(item) !== authorOf(itemsRef.current[index - 1]),
500
+ run: groupingRef.current?.runs.get(item.key),
501
+ inside: groupingRef.current?.inside.has(item.key) === true
502
+ }
503
+ ),
504
+ []
505
+ );
506
+ const header = props.loading ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { padding: space.md, alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
507
+ reactNative.ActivityIndicator,
508
+ {
509
+ color: colors.textMuted,
510
+ accessibilityLabel: t("loading")
511
+ }
512
+ ) }) : props.failed ? (
513
+ // Said where the earlier messages would be, with a way to ask again (the same cursor, or the newest page).
514
+ /* @__PURE__ */ jsxRuntime.jsxs(
515
+ reactNative.View,
516
+ {
517
+ accessibilityRole: "alert",
518
+ style: {
519
+ padding: space.sm,
520
+ flexDirection: "row",
521
+ justifyContent: "center",
522
+ alignItems: "center",
523
+ gap: space.sm
524
+ },
525
+ children: [
526
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: colors.textMuted, fontSize: font.size.sm }, children: t("transcriptEarlier") }),
527
+ /* @__PURE__ */ jsxRuntime.jsx(
528
+ chunkXAG2P447_cjs.Button,
529
+ {
530
+ label: t("tryAgain"),
531
+ hint: t("transcriptEarlier"),
532
+ variant: "text",
533
+ onPress: props.onRetry
534
+ }
535
+ )
536
+ ]
537
+ }
538
+ )
539
+ ) : props.more ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { padding: space.sm, alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
540
+ chunkXAG2P447_cjs.Button,
541
+ {
542
+ label: t("transcriptEarlier"),
543
+ variant: "text",
544
+ onPress: props.onEarlier
545
+ }
546
+ ) }) : null;
547
+ const list = react.useMemo(
548
+ () => ({
549
+ data: items,
550
+ renderItem,
551
+ keyExtractor: (item) => item.key,
552
+ getItemType: chunkXAG2P447_cjs.itemType,
553
+ maintainVisibleContentPosition: {
554
+ startRenderingFromBottom: true,
555
+ animateAutoScrollToBottom: !reducedMotion
556
+ },
557
+ onStartReached: props.onEarlier,
558
+ ListHeaderComponent: header,
559
+ contentContainerStyle: { paddingVertical: space.sm }
560
+ }),
561
+ [items, renderItem, reducedMotion, props.onEarlier, header, space.sm]
562
+ );
563
+ const List = props.ListComponent;
564
+ return List ? /* @__PURE__ */ jsxRuntime.jsx(List, { ...list }) : /* @__PURE__ */ jsxRuntime.jsx(flashList.FlashList, { ...list });
565
+ }
566
+ function Centered2(props) {
567
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
568
+ return /* @__PURE__ */ jsxRuntime.jsx(
569
+ reactNative.View,
570
+ {
571
+ style: {
572
+ flex: 1,
573
+ alignItems: "center",
574
+ justifyContent: "center",
575
+ padding: space.xl
576
+ },
577
+ children: props.children
578
+ }
579
+ );
580
+ }
581
+ function DefaultTranscriptFailure(props) {
582
+ const { t } = react$1.useCopy();
583
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
584
+ return /* @__PURE__ */ jsxRuntime.jsxs(
585
+ reactNative.View,
586
+ {
587
+ accessibilityRole: "alert",
588
+ style: { alignItems: "center", gap: space.md },
589
+ children: [
590
+ /* @__PURE__ */ jsxRuntime.jsx(
591
+ reactNative.Text,
592
+ {
593
+ style: {
594
+ color: colors.text,
595
+ fontSize: font.size.md,
596
+ textAlign: "center"
597
+ },
598
+ children: t(props.gone ? "transcriptGone" : "transcriptFailed")
599
+ }
600
+ ),
601
+ props.gone ? null : /* @__PURE__ */ jsxRuntime.jsx(
602
+ chunkXAG2P447_cjs.Button,
603
+ {
604
+ label: t("tryAgain"),
605
+ variant: "primary",
606
+ onPress: props.onRetry
607
+ }
608
+ )
609
+ ]
610
+ }
611
+ );
612
+ }
613
+
614
+ Object.defineProperty(exports, "CardCarousel", {
615
+ enumerable: true,
616
+ get: function () { return chunkXAG2P447_cjs.CardCarousel; }
617
+ });
618
+ Object.defineProperty(exports, "ThemeProvider", {
619
+ enumerable: true,
620
+ get: function () { return chunk6QYDPGRS_cjs.ThemeProvider; }
621
+ });
622
+ Object.defineProperty(exports, "useTheme", {
623
+ enumerable: true,
624
+ get: function () { return chunk6QYDPGRS_cjs.useTheme; }
625
+ });
626
+ Object.defineProperty(exports, "AgentRuntimeProvider", {
627
+ enumerable: true,
628
+ get: function () { return agent.AgentRuntimeProvider; }
629
+ });
630
+ Object.defineProperty(exports, "useAgentConversation", {
631
+ enumerable: true,
632
+ get: function () { return agent.useAgentConversation; }
633
+ });
634
+ Object.defineProperty(exports, "useAgentFeatures", {
635
+ enumerable: true,
636
+ get: function () { return agent.useAgentFeatures; }
637
+ });
638
+ Object.defineProperty(exports, "useAgentName", {
639
+ enumerable: true,
640
+ get: function () { return agent.useAgentName; }
641
+ });
642
+ Object.defineProperty(exports, "useAgentProfile", {
643
+ enumerable: true,
644
+ get: function () { return agent.useAgentProfile; }
645
+ });
646
+ Object.defineProperty(exports, "useAgentRuntime", {
647
+ enumerable: true,
648
+ get: function () { return agent.useAgentRuntime; }
649
+ });
650
+ Object.defineProperty(exports, "useAgentStatus", {
651
+ enumerable: true,
652
+ get: function () { return agent.useAgentStatus; }
653
+ });
654
+ Object.defineProperty(exports, "useAgentStatusState", {
655
+ enumerable: true,
656
+ get: function () { return agent.useAgentStatusState; }
657
+ });
658
+ Object.defineProperty(exports, "useAgentHistory", {
659
+ enumerable: true,
660
+ get: function () { return history.useAgentHistory; }
661
+ });
662
+ Object.defineProperty(exports, "useAgentTranscript", {
663
+ enumerable: true,
664
+ get: function () { return history.useAgentTranscript; }
665
+ });
666
+ exports.AgentHistoryList = AgentHistoryList;
667
+ exports.AgentTranscript = AgentTranscript;
668
+ exports.DefaultHistoryEmpty = DefaultHistoryEmpty;
669
+ exports.DefaultHistoryFailure = DefaultHistoryFailure;
670
+ exports.DefaultHistoryRow = DefaultHistoryRow;
671
+ exports.DefaultTranscriptFailure = DefaultTranscriptFailure;
672
+ //# sourceMappingURL=history.cjs.map
673
+ //# sourceMappingURL=history.cjs.map