@vinaverse/react-native 0.1.0-alpha.6 → 0.1.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +19 -11
  2. package/dist/ask.cjs +9 -5
  3. package/dist/ask.d.cts +14 -3
  4. package/dist/ask.d.ts +14 -3
  5. package/dist/ask.js +3 -3
  6. package/dist/chat.cjs +76 -73
  7. package/dist/chat.d.cts +16 -4
  8. package/dist/chat.d.ts +16 -4
  9. package/dist/chat.js +2 -3
  10. package/dist/{chunk-OWUKWVEZ.cjs → chunk-6QYDPGRS.cjs} +46 -2
  11. package/dist/chunk-6QYDPGRS.cjs.map +1 -0
  12. package/dist/{chunk-H2Y2YW2Q.cjs → chunk-AGZ7IH7E.cjs} +71 -72
  13. package/dist/chunk-AGZ7IH7E.cjs.map +1 -0
  14. package/dist/chunk-EFEXTVIT.js +88 -0
  15. package/dist/chunk-EFEXTVIT.js.map +1 -0
  16. package/dist/{chunk-SF6LJTVJ.js → chunk-HTUXHZ7X.js} +25 -30
  17. package/dist/chunk-HTUXHZ7X.js.map +1 -0
  18. package/dist/{chunk-OGPMGGYS.cjs → chunk-MG32E4JI.cjs} +20 -13
  19. package/dist/chunk-MG32E4JI.cjs.map +1 -0
  20. package/dist/{chunk-Y7P7DDHD.js → chunk-NJ6ARGZS.js} +12 -11
  21. package/dist/chunk-NJ6ARGZS.js.map +1 -0
  22. package/dist/{chunk-NJWRZ55G.js → chunk-POJP52GE.js} +16 -9
  23. package/dist/chunk-POJP52GE.js.map +1 -0
  24. package/dist/{chunk-643GOUTG.cjs → chunk-V6HHPE5K.cjs} +13 -12
  25. package/dist/chunk-V6HHPE5K.cjs.map +1 -0
  26. package/dist/index.cjs +86 -83
  27. package/dist/index.d.cts +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +4 -5
  30. package/dist/launcher.cjs +14 -11
  31. package/dist/launcher.d.cts +4 -3
  32. package/dist/launcher.d.ts +4 -3
  33. package/dist/launcher.js +3 -4
  34. package/package.json +4 -4
  35. package/dist/chunk-643GOUTG.cjs.map +0 -1
  36. package/dist/chunk-H2Y2YW2Q.cjs.map +0 -1
  37. package/dist/chunk-NJWRZ55G.js.map +0 -1
  38. package/dist/chunk-OGPMGGYS.cjs.map +0 -1
  39. package/dist/chunk-OWUKWVEZ.cjs.map +0 -1
  40. package/dist/chunk-PRXHS57U.js +0 -40
  41. package/dist/chunk-PRXHS57U.js.map +0 -1
  42. package/dist/chunk-PYPO6F7L.cjs +0 -44
  43. package/dist/chunk-PYPO6F7L.cjs.map +0 -1
  44. package/dist/chunk-SF6LJTVJ.js.map +0 -1
  45. package/dist/chunk-WKRCCPSN.js +0 -48
  46. package/dist/chunk-WKRCCPSN.js.map +0 -1
  47. package/dist/chunk-Y7P7DDHD.js.map +0 -1
package/dist/chat.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { AgentRuntimeProvider, GreetingStorage, UseAgentConversation, UseAgentLauncher, greetedKey, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus } from '@vinaverse/react/agent';
1
+ export { AgentRuntimeProvider, GreetingStorage, UseAgentConversation, UseAgentLauncher, forgetGreeting, greetedKey, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus } from '@vinaverse/react/agent';
2
2
  import * as react from 'react';
3
3
  import { ComponentType, ReactElement, ReactNode, RefObject } from 'react';
4
4
  import * as _vinaverse_client_conversation from '@vinaverse/client/conversation';
5
5
  import { MessageItem, Welcome as Welcome$1, TimelineItem, CardItem, HeldCard, Question, ProposalOutcome, ConversationStore, SystemItem } from '@vinaverse/client/conversation';
6
- import { ReadCard, AgentCardTarget, AgentKey, AgentPlace, AgentFailureReason, AgentRating } from '@vinaverse/client/agent';
6
+ import { ReadCard, AgentCardTarget, AgentKey, AgentPlace, AgentEntryPoint, AgentFailureReason, AgentRating } from '@vinaverse/client/agent';
7
7
  import { ImageProps, StyleProp, ViewStyle } from 'react-native';
8
8
  import { CopyOverrides } from '@vinaverse/react';
9
9
  import { a as ThemeOverrides, C as ColorSchemeSetting } from './theme-BhiEGv64.js';
@@ -269,10 +269,19 @@ declare function VinaverseChatProvider(props: Omit<VinaverseChatProps, 'hideHead
269
269
  }): ReactNode;
270
270
  declare function VinaverseChat(props: VinaverseChatProps): ReactNode;
271
271
 
272
+ /**
273
+ * The full-screen states (`Ended`, `Unreachable`, `UnavailableScreen`) are slots: each gets everything its screen
274
+ * needs (why, the actions, a person to contact) and the kit's own part as `Default`, so an app replaces the layout and
275
+ * the words entirely, or only the words through `copy`.
276
+ */
272
277
  interface AgentEndedProps {
273
278
  readonly onStartNew: () => void;
279
+ /** Why: `ended`, `not_found`, `expired`, `mismatch`, `completed`. */
280
+ readonly reason: AgentFailureReason | null;
274
281
  /** The API's code (`conversation_not_found`, `conversation_expired`), when it gave one. */
275
282
  readonly code: string | null;
283
+ /** A person instead (the chat's `onContact`); absent when the app gave none. */
284
+ readonly onContact: (() => void) | undefined;
276
285
  }
277
286
  /** No agent here: switched off for this tenant, mode or person, or the backend refused the session. */
278
287
  interface AgentUnavailableScreenProps {
@@ -288,13 +297,15 @@ interface AgentUnreachableProps {
288
297
  readonly onRetry: () => void;
289
298
  /** Why: `network`, `server`, `rate_limited`, … */
290
299
  readonly reason: AgentFailureReason | null;
300
+ /** A person instead (the chat's `onContact`); absent when the app gave none. */
301
+ readonly onContact: (() => void) | undefined;
291
302
  }
292
303
  /** A slot gets the kit's own part as `Default`, to wrap rather than rewrite. */
293
304
  type Slot<P> = ComponentType<P & {
294
305
  readonly Default: ComponentType<P>;
295
306
  }>;
296
307
  interface AgentFooterProps {
297
- /** The newest whole reply's turn, to rate; null when there is none. */
308
+ /** The newest whole reply's turn, to rate; null when there is none or it was restored from before. */
298
309
  readonly turnId: string | null;
299
310
  readonly rating: AgentRating | undefined;
300
311
  readonly onRate: (rating: AgentRating) => void;
@@ -316,7 +327,8 @@ interface AgentChatProps extends Omit<VinaverseChatProps, 'conversation' | 'comp
316
327
  readonly agentKey: AgentKey;
317
328
  /** Where the person asks from, told to the agent as a session opens. */
318
329
  readonly place?: AgentPlace | null;
319
- readonly entryPoint?: string | null;
330
+ /** How the person came in: `launcher` and `ask` from the kit's parts, `deep_link`, or the app's own words. */
331
+ readonly entryPoint?: AgentEntryPoint | null;
320
332
  /** The question about this place, offered when the session was told another one (`moved`). */
321
333
  readonly askAbout?: string | null;
322
334
  /** A person: offered on a failed turn, "couldn't connect" and no agent. */
package/dist/chat.js CHANGED
@@ -1,5 +1,4 @@
1
- export { ActivityLine, AgentChat, AgentFooter, AgentRuntimeProvider, Avatar, Button, CardActions, CardCarousel, CardFrame, CardView, ChatHeader, ChatSkeleton, Composer, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, FailureActionButton, InfoCard, LinksCard, ListingCard, MessageBubble, MessageList, NextStepCard, ProposalCard, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, TimeSlotsCard, VinaverseChat, VinaverseChatProvider, Welcome, allowedImage, answerText, carousels, defaultCard, fieldText, greetedKey, itemType, monogram, newestWholeReply, ratingText, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus, useChat } from './chunk-SF6LJTVJ.js';
2
- export { announce, useNativeLifecycle, useReducedMotion } from './chunk-PRXHS57U.js';
3
- export { ThemeProvider, createTheme, themeProblems, useTheme } from './chunk-WKRCCPSN.js';
1
+ export { ActivityLine, AgentChat, AgentFooter, AgentRuntimeProvider, Avatar, Button, CardActions, CardCarousel, CardFrame, CardView, ChatHeader, ChatSkeleton, Composer, DefaultBubble, DefaultComposer, DefaultEnded, DefaultHeader, DefaultTurnFailed, DefaultUnavailable, DefaultUnavailableScreen, DefaultUnreachable, DisclosureBar, FailureActionButton, InfoCard, LinksCard, ListingCard, MessageBubble, MessageList, NextStepCard, ProposalCard, QuestionCard, Row, StatusBanner, StreamingBubble, SystemRow, TimeSlotsCard, VinaverseChat, VinaverseChatProvider, Welcome, allowedImage, answerText, carousels, defaultCard, fieldText, forgetGreeting, greetedKey, itemType, monogram, newestWholeReply, ratingText, useAgentConversation, useAgentFeatures, useAgentLauncher, useAgentName, useAgentProfile, useAgentRuntime, useAgentStatus, useChat } from './chunk-HTUXHZ7X.js';
2
+ export { ThemeProvider, announce, createTheme, themeProblems, useNativeLifecycle, useReducedMotion, useTheme } from './chunk-EFEXTVIT.js';
4
3
  //# sourceMappingURL=chat.js.map
5
4
  //# sourceMappingURL=chat.js.map
@@ -44,10 +44,54 @@ function ThemeProvider(props) {
44
44
  function useTheme() {
45
45
  return react.useContext(ThemeContext);
46
46
  }
47
+ function useAgentSweep(runtime) {
48
+ react.useEffect(() => {
49
+ const subscription = reactNative.AppState.addEventListener("change", (state) => {
50
+ if (state === "active") runtime.sweep();
51
+ });
52
+ return () => subscription.remove();
53
+ }, [runtime]);
54
+ }
55
+ function useNativeLifecycle(store) {
56
+ react.useEffect(() => {
57
+ const apply = (state) => store.setForeground(state === "active");
58
+ apply(reactNative.AppState.currentState);
59
+ const subscription = reactNative.AppState.addEventListener("change", apply);
60
+ return () => subscription.remove();
61
+ }, [store]);
62
+ }
63
+ function useReducedMotion() {
64
+ const [reduced, setReduced] = react.useState(false);
65
+ react.useEffect(() => {
66
+ let live = true;
67
+ reactNative.AccessibilityInfo.isReduceMotionEnabled().then(
68
+ (value) => {
69
+ if (live) setReduced(value);
70
+ },
71
+ () => void 0
72
+ );
73
+ const subscription = reactNative.AccessibilityInfo.addEventListener(
74
+ "reduceMotionChanged",
75
+ setReduced
76
+ );
77
+ return () => {
78
+ live = false;
79
+ subscription.remove();
80
+ };
81
+ }, []);
82
+ return reduced;
83
+ }
84
+ function announce(text) {
85
+ if (text) reactNative.AccessibilityInfo.announceForAccessibility(text);
86
+ }
47
87
 
48
88
  exports.ThemeProvider = ThemeProvider;
89
+ exports.announce = announce;
49
90
  exports.createTheme = createTheme;
50
91
  exports.themeProblems = themeProblems;
92
+ exports.useAgentSweep = useAgentSweep;
93
+ exports.useNativeLifecycle = useNativeLifecycle;
94
+ exports.useReducedMotion = useReducedMotion;
51
95
  exports.useTheme = useTheme;
52
- //# sourceMappingURL=chunk-OWUKWVEZ.cjs.map
53
- //# sourceMappingURL=chunk-OWUKWVEZ.cjs.map
96
+ //# sourceMappingURL=chunk-6QYDPGRS.cjs.map
97
+ //# sourceMappingURL=chunk-6QYDPGRS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/theme.tsx","../src/platform.ts"],"names":["colors","font","space","radius","motion","size","contrastProblems","createContext","useColorScheme","useMemo","useContext","useEffect","AppState","useState","AccessibilityInfo"],"mappings":"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","file":"chunk-6QYDPGRS.cjs","sourcesContent":["// The theme: the shared design tokens, a tenant's brand on top, light and dark. A tenant changes colors, fonts, radii\n// and spacing; the disclosure bar keeps a legible pair whatever the tenant's colors (see DisclosureBar).\nimport {\n type ColorScheme,\n type Colors,\n colors,\n contrastProblems,\n font,\n motion,\n radius,\n size,\n space,\n} from '@vinaverse/tokens';\nimport { createContext, type ReactNode, useContext, useMemo } from 'react';\nimport { useColorScheme } from 'react-native';\n\nexport interface Theme {\n readonly scheme: ColorScheme;\n readonly colors: Colors;\n readonly font: typeof font & { readonly family?: string };\n readonly space: typeof space;\n readonly radius: typeof radius;\n readonly motion: typeof motion;\n readonly size: typeof size;\n}\n\n/** A tenant's brand: colors per scheme, a font family, radii. Anything left out keeps the Vinaverse default. */\nexport interface ThemeOverrides {\n readonly light?: Partial<Colors>;\n readonly dark?: Partial<Colors>;\n readonly fontFamily?: string;\n readonly radius?: Partial<typeof radius>;\n readonly space?: Partial<typeof space>;\n}\n\nexport type ColorSchemeSetting = 'system' | 'light' | 'dark';\n\n/** The theme for a scheme, with the tenant's overrides on top. */\nexport function createTheme(\n scheme: ColorScheme,\n overrides: ThemeOverrides = {},\n): Theme {\n return {\n scheme,\n colors: { ...colors(scheme), ...overrides[scheme] },\n font: {\n ...font,\n ...(overrides.fontFamily ? { family: overrides.fontFamily } : {}),\n },\n space: { ...space, ...overrides.space },\n radius: { ...radius, ...overrides.radius },\n motion,\n size,\n };\n}\n\n/** The pairs a tenant's colors made hard to read, in either scheme, as messages for a development warning. */\nexport function themeProblems(overrides: ThemeOverrides = {}): string[] {\n return (['light', 'dark'] as const).flatMap((scheme) =>\n contrastProblems(createTheme(scheme, overrides).colors).map(\n (p) =>\n `${scheme}: ${p.foreground} on ${p.background} is ${p.ratio.toFixed(2)}:1, below ${p.minimum}:1`,\n ),\n );\n}\n\nconst ThemeContext = /* @__PURE__ */ createContext<Theme>(\n /* @__PURE__ */ createTheme('light'),\n);\n\nexport function ThemeProvider(props: {\n readonly theme?: ThemeOverrides | undefined;\n readonly colorScheme?: ColorSchemeSetting | undefined;\n readonly children?: ReactNode;\n}): ReactNode {\n const system = useColorScheme();\n const setting = props.colorScheme ?? 'system';\n const scheme: ColorScheme =\n setting === 'system' ? (system === 'dark' ? 'dark' : 'light') : setting;\n const overrides = props.theme;\n const value = useMemo(\n () => createTheme(scheme, overrides),\n [scheme, overrides],\n );\n return (\n <ThemeContext.Provider value={value}>\n {props.children}\n </ThemeContext.Provider>\n );\n}\n\nexport function useTheme(): Theme {\n return useContext(ThemeContext);\n}\n","// The React Native platform adapter: what the conversation store learns from the app (foreground, background) and\n// what the kit asks of the platform (reduced motion, screen reader announcements).\nimport { useEffect, useState } from 'react';\nimport { AccessibilityInfo, AppState, type AppStateStatus } from 'react-native';\n\n/** The part of the conversation store the adapter drives. */\nexport interface LifecycleTarget {\n setForeground(foreground: boolean): void;\n}\n\n/**\n * When the app comes back to the foreground, the agent runtime ends the conversations no view shows that are past\n * their session's end (timers do not run in the background). Every agent part calls it; once is enough.\n */\nexport function useAgentSweep(runtime: { sweep(): void }): void {\n useEffect(() => {\n const subscription = AppState.addEventListener('change', (state) => {\n if (state === 'active') runtime.sweep();\n });\n return () => subscription.remove();\n }, [runtime]);\n}\n\n/** Tells the store when the app comes to the foreground or goes to the background (it pings only in the foreground). */\nexport function useNativeLifecycle(store: LifecycleTarget): void {\n useEffect(() => {\n const apply = (state: AppStateStatus) =>\n store.setForeground(state === 'active');\n apply(AppState.currentState);\n const subscription = AppState.addEventListener('change', apply);\n return () => subscription.remove();\n }, [store]);\n}\n\n/** Whether the person asked for reduced motion: animations and animated scrolling stay off. */\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false);\n useEffect(() => {\n let live = true;\n AccessibilityInfo.isReduceMotionEnabled().then(\n (value) => {\n if (live) setReduced(value);\n },\n () => undefined,\n );\n const subscription = AccessibilityInfo.addEventListener(\n 'reduceMotionChanged',\n setReduced,\n );\n return () => {\n live = false;\n subscription.remove();\n };\n }, []);\n return reduced;\n}\n\n/** Reads a line to a screen reader, without moving focus. */\nexport function announce(text: string): void {\n if (text) AccessibilityInfo.announceForAccessibility(text);\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkPYPO6F7L_cjs = require('./chunk-PYPO6F7L.cjs');
4
- var chunkOWUKWVEZ_cjs = require('./chunk-OWUKWVEZ.cjs');
3
+ var chunk6QYDPGRS_cjs = require('./chunk-6QYDPGRS.cjs');
5
4
  var agent = require('@vinaverse/react/agent');
6
5
  var flashList = require('@shopify/flash-list');
7
6
  var react$1 = require('@vinaverse/react');
@@ -27,7 +26,7 @@ function useChat() {
27
26
  return value;
28
27
  }
29
28
  var Button = /* @__PURE__ */ react.memo(function Button2(props) {
30
- const { colors, radius, space, size: size2, font } = chunkOWUKWVEZ_cjs.useTheme();
29
+ const { colors, radius, space, size: size2, font } = chunk6QYDPGRS_cjs.useTheme();
31
30
  const variant = props.variant ?? "secondary";
32
31
  const inactive = props.disabled === true || props.busy === true;
33
32
  const filled = variant === "primary" || props.selected === true;
@@ -85,7 +84,7 @@ function cardOf(held) {
85
84
  return held.card;
86
85
  }
87
86
  function CardFrame(props) {
88
- const { colors, radius, space } = chunkOWUKWVEZ_cjs.useTheme();
87
+ const { colors, radius, space } = chunk6QYDPGRS_cjs.useTheme();
89
88
  return /* @__PURE__ */ jsxRuntime.jsx(
90
89
  reactNative.View,
91
90
  {
@@ -113,7 +112,7 @@ function CardFrame(props) {
113
112
  );
114
113
  }
115
114
  function Title(props) {
116
- const { colors, font } = chunkOWUKWVEZ_cjs.useTheme();
115
+ const { colors, font } = chunk6QYDPGRS_cjs.useTheme();
117
116
  return /* @__PURE__ */ jsxRuntime.jsx(
118
117
  reactNative.Text,
119
118
  {
@@ -130,7 +129,7 @@ function Title(props) {
130
129
  );
131
130
  }
132
131
  function Body(props) {
133
- const { colors, font } = chunkOWUKWVEZ_cjs.useTheme();
132
+ const { colors, font } = chunk6QYDPGRS_cjs.useTheme();
134
133
  return /* @__PURE__ */ jsxRuntime.jsx(
135
134
  reactNative.Text,
136
135
  {
@@ -173,7 +172,7 @@ function InfoCard(props) {
173
172
  const card = cardOf(props.card);
174
173
  const { locale, t } = react$1.useCopy();
175
174
  const { slots, timeZone } = useChat();
176
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
175
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
177
176
  const image = safeImage(card.image_url);
178
177
  const Img = slots.Image ?? reactNative.Image;
179
178
  const money = card.price ?? card.price_from;
@@ -227,7 +226,7 @@ function InfoCard(props) {
227
226
  );
228
227
  }
229
228
  function Badges(props) {
230
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
229
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
231
230
  if (!props.badges?.length) return null;
232
231
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { flexDirection: "row", flexWrap: "wrap", gap: space.xs }, children: props.badges.map((b) => /* @__PURE__ */ jsxRuntime.jsx(
233
232
  reactNative.Text,
@@ -247,7 +246,7 @@ function Badges(props) {
247
246
  }
248
247
  function CardActions(props) {
249
248
  const card = cardOf(props.card);
250
- const { space } = chunkOWUKWVEZ_cjs.useTheme();
249
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
251
250
  if (!card.actions?.length) return null;
252
251
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { flexDirection: "row", flexWrap: "wrap", gap: space.sm }, children: card.actions.map((a) => /* @__PURE__ */ jsxRuntime.jsx(
253
252
  Action,
@@ -314,7 +313,7 @@ function ListingCard(props) {
314
313
  const card = cardOf(props.card);
315
314
  const { locale, t } = react$1.useCopy();
316
315
  const { slots, timeZone, handlers, imagePolicy } = useChat();
317
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
316
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
318
317
  const [failed, setFailed] = react.useState(null);
319
318
  const photoUrl = allowedImage(
320
319
  card.images?.[0]?.url ?? card.image_url,
@@ -494,7 +493,7 @@ function ProposalCard(props) {
494
493
  const proposal = card.proposal;
495
494
  const { t, locale } = react$1.useCopy();
496
495
  const { store, handlers, timeZone } = useChat();
497
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
496
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
498
497
  const edit = useLink(proposal?.edit_deep_link, props.card);
499
498
  if (!proposal) return null;
500
499
  const settled = outcomeText(t, props.card.outcome, proposal.status);
@@ -618,7 +617,7 @@ function QuestionCard(props) {
618
617
  const question = held.question;
619
618
  const { store, handlers } = useChat();
620
619
  const { t, locale } = react$1.useCopy();
621
- const { colors, font, space } = chunkOWUKWVEZ_cjs.useTheme();
620
+ const { colors, font, space } = chunk6QYDPGRS_cjs.useTheme();
622
621
  const needsSocket = react$1.useConversationSelector(
623
622
  store,
624
623
  (v) => v.answersNeedWebSocket
@@ -676,7 +675,7 @@ function QuestionCard(props) {
676
675
  function Answer(props) {
677
676
  const { question, send, enabled } = props;
678
677
  const { t } = react$1.useCopy();
679
- const { space } = chunkOWUKWVEZ_cjs.useTheme();
678
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
680
679
  const { handlers } = useChat();
681
680
  const [draft, setDraft] = react.useState({});
682
681
  const kind = question.kind;
@@ -787,7 +786,7 @@ function ChoiceAnswer(props) {
787
786
  const { question, draft, onChange, enabled } = props;
788
787
  const { t } = react$1.useCopy();
789
788
  const { slots } = useChat();
790
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
789
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
791
790
  const [search, setSearch] = react.useState("");
792
791
  const multi = question.kind === "multi_choice" || question.kind === "image_choice";
793
792
  const values = draft.values ?? [];
@@ -893,7 +892,7 @@ function ChoiceAnswer(props) {
893
892
  ] });
894
893
  }
895
894
  function ChoiceLabel(props) {
896
- const { colors, font } = chunkOWUKWVEZ_cjs.useTheme();
895
+ const { colors, font } = chunk6QYDPGRS_cjs.useTheme();
897
896
  return /* @__PURE__ */ jsxRuntime.jsx(
898
897
  reactNative.Text,
899
898
  {
@@ -908,7 +907,7 @@ function ChoiceLabel(props) {
908
907
  }
909
908
  function OtherText(props) {
910
909
  const { t } = react$1.useCopy();
911
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
910
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
912
911
  const on = props.value !== void 0;
913
912
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { gap: space.xs }, children: [
914
913
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -947,7 +946,7 @@ function OtherText(props) {
947
946
  }
948
947
  function CharactersLeft(props) {
949
948
  const { t } = react$1.useCopy();
950
- const { colors, font } = chunkOWUKWVEZ_cjs.useTheme();
949
+ const { colors, font } = chunk6QYDPGRS_cjs.useTheme();
951
950
  const left = props.max - conversation.codePoints(props.text);
952
951
  return /* @__PURE__ */ jsxRuntime.jsx(
953
952
  reactNative.Text,
@@ -962,7 +961,7 @@ function CharactersLeft(props) {
962
961
  );
963
962
  }
964
963
  function TextAnswer(props) {
965
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
964
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
966
965
  const long = props.question.kind === "long_text";
967
966
  const max = props.question.text?.max_length ?? (long ? 2e3 : 200);
968
967
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { gap: space.xs }, children: [
@@ -993,7 +992,7 @@ function TextAnswer(props) {
993
992
  }
994
993
  function NumberAnswer(props) {
995
994
  const range = props.question.number ?? { min: 0, max: 100, step: 1 };
996
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
995
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
997
996
  const value = props.value ?? range.min;
998
997
  const clamp = (n) => Math.min(range.max, Math.max(range.min, Number(n.toFixed(6))));
999
998
  const shown = `${value}${props.question.number?.unit ? ` ${props.question.number.unit}` : ""}`;
@@ -1052,7 +1051,7 @@ function NumberAnswer(props) {
1052
1051
  }
1053
1052
  function ScaleAnswer(props) {
1054
1053
  const scale = props.question.scale;
1055
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1054
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1056
1055
  if (!scale) return null;
1057
1056
  const points = [];
1058
1057
  for (let n = scale.min; n <= scale.max && points.length < 21; n += scale.step)
@@ -1077,7 +1076,7 @@ function ScaleAnswer(props) {
1077
1076
  var iso = (y, m, d) => `${String(y).padStart(4, "0")}-${String(m + 1).padStart(2, "0")}-${String(d).padStart(2, "0")}`;
1078
1077
  function DateAnswer(props) {
1079
1078
  const { locale } = react$1.useCopy();
1080
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1079
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1081
1080
  const bounds = props.question.date;
1082
1081
  const start = props.value ?? bounds?.min ?? (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1083
1082
  const [month, setMonth] = react.useState(() => ({
@@ -1161,7 +1160,7 @@ function DateAnswer(props) {
1161
1160
  function RateEach(props) {
1162
1161
  const { question } = props;
1163
1162
  const { t } = react$1.useCopy();
1164
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1163
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1165
1164
  const answered = new Map(
1166
1165
  (question.row_answers ?? []).map((r) => [
1167
1166
  r.question_id,
@@ -1242,7 +1241,7 @@ function TimeSlotsCard(props) {
1242
1241
  const card = cardOf(props.card);
1243
1242
  const { locale } = react$1.useCopy();
1244
1243
  const { timeZone } = useChat();
1245
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1244
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
1246
1245
  const slots = (card.slots ?? []).map(
1247
1246
  (s) => react$1.formatTimeRange(s.start, s.end, locale, timeZone)
1248
1247
  );
@@ -1327,7 +1326,7 @@ function CardCarousel(props) {
1327
1326
  var ActivityLine = /* @__PURE__ */ react.memo(function ActivityLine2() {
1328
1327
  const { store } = useChat();
1329
1328
  const { t } = react$1.useCopy();
1330
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1329
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1331
1330
  const activity = react$1.useConversationSelector(store, (v) => v.activity);
1332
1331
  const waiting = react$1.useConversationSelector(
1333
1332
  store,
@@ -1347,7 +1346,7 @@ var ActivityLine = /* @__PURE__ */ react.memo(function ActivityLine2() {
1347
1346
  );
1348
1347
  });
1349
1348
  var Avatar = /* @__PURE__ */ react.memo(function Avatar2(props) {
1350
- const { colors, size: size2, font } = chunkOWUKWVEZ_cjs.useTheme();
1349
+ const { colors, size: size2, font } = chunk6QYDPGRS_cjs.useTheme();
1351
1350
  const { slots } = useChat();
1352
1351
  const box = {
1353
1352
  width: size2.avatar,
@@ -1393,7 +1392,7 @@ var Avatar = /* @__PURE__ */ react.memo(function Avatar2(props) {
1393
1392
  );
1394
1393
  });
1395
1394
  function DefaultHeader(props) {
1396
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1395
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1397
1396
  const { t } = react$1.useCopy();
1398
1397
  const person = props.takeoverBy !== null;
1399
1398
  const subtitle = person ? t("staffLabel", { by: props.takeoverBy || t("staffFallbackRole") }) : t("agentLabel");
@@ -1460,7 +1459,7 @@ var ChatHeader = /* @__PURE__ */ react.memo(function ChatHeader2() {
1460
1459
  });
1461
1460
  function DefaultComposer(props) {
1462
1461
  const { t, direction } = react$1.useCopy();
1463
- const { colors, radius, space, font, size: size2 } = chunkOWUKWVEZ_cjs.useTheme();
1462
+ const { colors, radius, space, font, size: size2 } = chunk6QYDPGRS_cjs.useTheme();
1464
1463
  const [text, setText] = react.useState("");
1465
1464
  const length = conversation.codePoints(text);
1466
1465
  const canSend = text.trim().length > 0 && length <= conversation.MAX_TEXT;
@@ -1561,7 +1560,7 @@ var Composer = /* @__PURE__ */ react.memo(function Composer2(props) {
1561
1560
  var DisclosureBar = /* @__PURE__ */ react.memo(function DisclosureBar2() {
1562
1561
  const { store } = useChat();
1563
1562
  const { t } = react$1.useCopy();
1564
- const theme = chunkOWUKWVEZ_cjs.useTheme();
1563
+ const theme = chunk6QYDPGRS_cjs.useTheme();
1565
1564
  const { space, font } = theme;
1566
1565
  const disclosure = react$1.useConversationSelector(store, (v) => v.disclosure);
1567
1566
  const [open, setOpen] = react.useState(false);
@@ -1600,7 +1599,7 @@ var DisclosureBar = /* @__PURE__ */ react.memo(function DisclosureBar2() {
1600
1599
  );
1601
1600
  });
1602
1601
  var ChatSkeleton = /* @__PURE__ */ react.memo(function ChatSkeleton2() {
1603
- const { colors, radius, space } = chunkOWUKWVEZ_cjs.useTheme();
1602
+ const { colors, radius, space } = chunk6QYDPGRS_cjs.useTheme();
1604
1603
  const row = (width, end) => /* @__PURE__ */ jsxRuntime.jsx(
1605
1604
  reactNative.View,
1606
1605
  {
@@ -1631,7 +1630,7 @@ var ChatSkeleton = /* @__PURE__ */ react.memo(function ChatSkeleton2() {
1631
1630
  );
1632
1631
  });
1633
1632
  function DefaultBubble(props) {
1634
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1633
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
1635
1634
  const role = props.item.role;
1636
1635
  const [background, foreground] = role === "person" ? [colors.personBubble, colors.personText] : role === "staff" ? [colors.staffBubble, colors.staffText] : [colors.agentBubble, colors.agentText];
1637
1636
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -1686,7 +1685,7 @@ function Frame(props) {
1686
1685
  const { item, text } = props;
1687
1686
  const { store, slots } = useChat();
1688
1687
  const { t } = react$1.useCopy();
1689
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1688
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1690
1689
  const author = useAuthor(item);
1691
1690
  const mine = item.role === "person";
1692
1691
  const status = item.state === "sending" ? t("messageSending") : item.state === "held" ? t("messageHeld") : item.state === "not_sent" ? item.rejection?.message || t("messageNotSent") : item.state === "delivered" ? t("messageDelivered") : item.partial ? t("messageCutOff") : null;
@@ -1828,7 +1827,7 @@ function DefaultTurnFailed(props) {
1828
1827
  ] });
1829
1828
  }
1830
1829
  function Line(props) {
1831
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1830
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
1832
1831
  return /* @__PURE__ */ jsxRuntime.jsx(
1833
1832
  reactNative.View,
1834
1833
  {
@@ -1854,7 +1853,7 @@ function Line(props) {
1854
1853
  );
1855
1854
  }
1856
1855
  var Welcome = /* @__PURE__ */ react.memo(function Welcome2(props) {
1857
- const { colors, radius, space, font } = chunkOWUKWVEZ_cjs.useTheme();
1856
+ const { colors, radius, space, font } = chunk6QYDPGRS_cjs.useTheme();
1858
1857
  return /* @__PURE__ */ jsxRuntime.jsxs(
1859
1858
  reactNative.View,
1860
1859
  {
@@ -1940,8 +1939,8 @@ var Row = /* @__PURE__ */ react.memo(function Row2(props) {
1940
1939
  var MessageList = /* @__PURE__ */ react.memo(function MessageList2() {
1941
1940
  const { store, slots, starters, handlers, imagePolicy } = useChat();
1942
1941
  const { t } = react$1.useCopy();
1943
- const { space } = chunkOWUKWVEZ_cjs.useTheme();
1944
- const reducedMotion = chunkPYPO6F7L_cjs.useReducedMotion();
1942
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
1943
+ const reducedMotion = chunk6QYDPGRS_cjs.useReducedMotion();
1945
1944
  const items = react$1.useConversationSelector(store, (v) => v.items);
1946
1945
  usePrefetchPhotos(items, handlers.current?.prefetchImage, imagePolicy?.hosts);
1947
1946
  const opening = react$1.useConversationSelector(
@@ -2052,7 +2051,7 @@ function useAnnounceReplies(items) {
2052
2051
  const author = last.role === "staff" ? t("staffLabel", {
2053
2052
  by: store.getSnapshot().takeover?.by || t("staffFallbackRole")
2054
2053
  }) : store.getSnapshot().agent.name ?? t("agentFallbackName");
2055
- (handlers.current?.announce ?? chunkPYPO6F7L_cjs.announce)(`${author}: ${last.text}`);
2054
+ (handlers.current?.announce ?? chunk6QYDPGRS_cjs.announce)(`${author}: ${last.text}`);
2056
2055
  }, [items, t, store, handlers]);
2057
2056
  }
2058
2057
  var CONNECTING_DELAY = tokens.motion.bannerDelay;
@@ -2123,7 +2122,7 @@ function DefaultUnavailable(props) {
2123
2122
  ] });
2124
2123
  }
2125
2124
  function Banner(props) {
2126
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
2125
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
2127
2126
  return /* @__PURE__ */ jsxRuntime.jsxs(
2128
2127
  reactNative.View,
2129
2128
  {
@@ -2192,21 +2191,21 @@ function VinaverseChatProvider(props) {
2192
2191
  imagePolicy
2193
2192
  ]
2194
2193
  );
2195
- chunkPYPO6F7L_cjs.useNativeLifecycle(conversation);
2194
+ chunk6QYDPGRS_cjs.useNativeLifecycle(conversation);
2196
2195
  react.useEffect(() => {
2197
2196
  conversation.start();
2198
2197
  }, [conversation]);
2199
2198
  const { onWarning, theme, copy } = props;
2200
2199
  react.useEffect(() => {
2201
2200
  if (!onWarning) return;
2202
- for (const problem of chunkOWUKWVEZ_cjs.themeProblems(theme))
2201
+ for (const problem of chunk6QYDPGRS_cjs.themeProblems(theme))
2203
2202
  onWarning(`Vinaverse theme: ${problem}`);
2204
2203
  for (const key of react$1.bannedWordsIn(copy ?? {}))
2205
2204
  onWarning(
2206
2205
  `Vinaverse copy: "${key}" says assistant, bot or crew; the copy says agent.`
2207
2206
  );
2208
2207
  }, [onWarning, theme, copy]);
2209
- return /* @__PURE__ */ jsxRuntime.jsx(react$1.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunkOWUKWVEZ_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(ChatContextProvider, { value, children: props.children }) }) });
2208
+ return /* @__PURE__ */ jsxRuntime.jsx(react$1.CopyProvider, { locale: props.locale, copy: props.copy, children: /* @__PURE__ */ jsxRuntime.jsx(chunk6QYDPGRS_cjs.ThemeProvider, { theme: props.theme, colorScheme: props.colorScheme, children: /* @__PURE__ */ jsxRuntime.jsx(ChatContextProvider, { value, children: props.children }) }) });
2210
2209
  }
2211
2210
  function VinaverseChat(props) {
2212
2211
  return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -2223,7 +2222,7 @@ function VinaverseChat(props) {
2223
2222
  ) });
2224
2223
  }
2225
2224
  function Layout(props) {
2226
- const { colors } = chunkOWUKWVEZ_cjs.useTheme();
2225
+ const { colors } = chunk6QYDPGRS_cjs.useTheme();
2227
2226
  const { direction } = react$1.useCopy();
2228
2227
  const { onError } = props;
2229
2228
  const reportError = react.useMemo(
@@ -2253,7 +2252,7 @@ function Layout(props) {
2253
2252
  }
2254
2253
  function Suggestion(props) {
2255
2254
  const { store, handlers } = useChat();
2256
- const { space } = chunkOWUKWVEZ_cjs.useTheme();
2255
+ const { space } = chunk6QYDPGRS_cjs.useTheme();
2257
2256
  return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { paddingHorizontal: space.lg, alignItems: "flex-start" }, children: /* @__PURE__ */ jsxRuntime.jsx(
2258
2257
  Button,
2259
2258
  {
@@ -2297,6 +2296,7 @@ function AgentChat(props) {
2297
2296
  ...chat
2298
2297
  } = props;
2299
2298
  const runtime = agent.useAgentRuntime();
2299
+ chunk6QYDPGRS_cjs.useAgentSweep(runtime);
2300
2300
  const { conversation, state, startNew } = agent.useAgentConversation(agentKey, {
2301
2301
  place: place ?? null,
2302
2302
  entryPoint: entryPoint ?? null
@@ -2345,30 +2345,23 @@ function AgentChat(props) {
2345
2345
  conversation: store,
2346
2346
  components: slots
2347
2347
  };
2348
- if (state.failure === "ended")
2349
- return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Ended ? /* @__PURE__ */ jsxRuntime.jsx(
2350
- Ended,
2351
- {
2352
- onStartNew: startNew,
2353
- code: state.code,
2354
- Default: DefaultEnded
2355
- }
2356
- ) : /* @__PURE__ */ jsxRuntime.jsx(DefaultEnded, { onStartNew: startNew, code: state.code }) }) });
2357
- if (state.failure === "unreachable")
2358
- return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Unreachable ? /* @__PURE__ */ jsxRuntime.jsx(
2359
- Unreachable,
2360
- {
2361
- onRetry: conversation.retry,
2362
- reason: state.reason,
2363
- Default: DefaultUnreachable
2364
- }
2365
- ) : /* @__PURE__ */ jsxRuntime.jsx(
2366
- DefaultUnreachable,
2367
- {
2368
- onRetry: conversation.retry,
2369
- reason: state.reason
2370
- }
2371
- ) }) });
2348
+ if (state.failure === "ended") {
2349
+ const own = {
2350
+ onStartNew: startNew,
2351
+ reason: state.reason,
2352
+ code: state.code,
2353
+ onContact
2354
+ };
2355
+ return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Ended ? /* @__PURE__ */ jsxRuntime.jsx(Ended, { ...own, Default: DefaultEnded }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultEnded, { ...own }) }) });
2356
+ }
2357
+ if (state.failure === "unreachable") {
2358
+ const own = {
2359
+ onRetry: conversation.retry,
2360
+ reason: state.reason,
2361
+ onContact
2362
+ };
2363
+ return /* @__PURE__ */ jsxRuntime.jsx(VinaverseChatProvider, { ...shared, children: /* @__PURE__ */ jsxRuntime.jsx(Centered, { children: Unreachable ? /* @__PURE__ */ jsxRuntime.jsx(Unreachable, { ...own, Default: DefaultUnreachable }) : /* @__PURE__ */ jsxRuntime.jsx(DefaultUnreachable, { ...own }) }) });
2364
+ }
2372
2365
  if (state.failure === "unavailable") {
2373
2366
  const own = {
2374
2367
  reason: state.reason,
@@ -2389,6 +2382,7 @@ function AgentChat(props) {
2389
2382
  store,
2390
2383
  state,
2391
2384
  rate: conversation.rate,
2385
+ canRate: conversation.canRate,
2392
2386
  Footer,
2393
2387
  onOpenPrivacy
2394
2388
  }
@@ -2397,7 +2391,8 @@ function AgentChat(props) {
2397
2391
  );
2398
2392
  }
2399
2393
  function FooterFor(props) {
2400
- const turnId = react$1.useConversationSelector(props.store, newestWholeReply);
2394
+ const newest = react$1.useConversationSelector(props.store, newestWholeReply);
2395
+ const turnId = newest && props.canRate(newest) ? newest : null;
2401
2396
  const own = {
2402
2397
  turnId,
2403
2398
  rating: turnId ? props.state.ratings.get(turnId) : void 0,
@@ -2419,7 +2414,7 @@ function newestWholeReply(view) {
2419
2414
  return null;
2420
2415
  }
2421
2416
  function Centered(props) {
2422
- const { colors, space } = chunkOWUKWVEZ_cjs.useTheme();
2417
+ const { colors, space } = chunk6QYDPGRS_cjs.useTheme();
2423
2418
  return /* @__PURE__ */ jsxRuntime.jsx(
2424
2419
  reactNative.View,
2425
2420
  {
@@ -2435,7 +2430,7 @@ function Centered(props) {
2435
2430
  );
2436
2431
  }
2437
2432
  function Notice(props) {
2438
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
2433
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
2439
2434
  return /* @__PURE__ */ jsxRuntime.jsxs(
2440
2435
  reactNative.View,
2441
2436
  {
@@ -2517,7 +2512,7 @@ function DefaultUnreachable(props) {
2517
2512
  }
2518
2513
  function AgentFooter(props) {
2519
2514
  const { t } = react$1.useCopy();
2520
- const { colors, space, font } = chunkOWUKWVEZ_cjs.useTheme();
2515
+ const { colors, space, font } = chunk6QYDPGRS_cjs.useTheme();
2521
2516
  const muted = { color: colors.textMuted, fontSize: font.size.sm };
2522
2517
  return /* @__PURE__ */ jsxRuntime.jsxs(
2523
2518
  reactNative.View,
@@ -2567,6 +2562,10 @@ Object.defineProperty(exports, "AgentRuntimeProvider", {
2567
2562
  enumerable: true,
2568
2563
  get: function () { return agent.AgentRuntimeProvider; }
2569
2564
  });
2565
+ Object.defineProperty(exports, "forgetGreeting", {
2566
+ enumerable: true,
2567
+ get: function () { return agent.forgetGreeting; }
2568
+ });
2570
2569
  Object.defineProperty(exports, "greetedKey", {
2571
2570
  enumerable: true,
2572
2571
  get: function () { return agent.greetedKey; }
@@ -2647,5 +2646,5 @@ exports.monogram = monogram;
2647
2646
  exports.newestWholeReply = newestWholeReply;
2648
2647
  exports.ratingText = ratingText;
2649
2648
  exports.useChat = useChat;
2650
- //# sourceMappingURL=chunk-H2Y2YW2Q.cjs.map
2651
- //# sourceMappingURL=chunk-H2Y2YW2Q.cjs.map
2649
+ //# sourceMappingURL=chunk-AGZ7IH7E.cjs.map
2650
+ //# sourceMappingURL=chunk-AGZ7IH7E.cjs.map