@adminide-stack/yantra-mobile 12.0.98-alpha.0 → 12.0.99-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/lib/bridge/handlers/SurfaceHostBridgeHandler.js +9 -2
  2. package/lib/bridge/handlers/SurfaceHostBridgeHandler.js.map +1 -1
  3. package/lib/compute.js +109 -1
  4. package/lib/compute.js.map +1 -1
  5. package/lib/config/env-config.js +11 -1
  6. package/lib/config/env-config.js.map +1 -1
  7. package/lib/features/agent-chat/NativeAgentChat.js.map +1 -1
  8. package/lib/features/apps/AppsCatalog.js +10 -0
  9. package/lib/features/apps/AppsCatalog.js.map +1 -1
  10. package/lib/features/apps/appArt.js +2 -1
  11. package/lib/features/apps/appArt.js.map +1 -1
  12. package/lib/features/apps/mobileAppCatalog.js +10 -0
  13. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  14. package/lib/features/apps/nativeAppHandoff.js +2 -1
  15. package/lib/features/apps/nativeAppHandoff.js.map +1 -1
  16. package/lib/features/apps/resolveSurfaceUrl.js +1 -2
  17. package/lib/features/apps/resolveSurfaceUrl.js.map +1 -1
  18. package/lib/features/attachments/useImageAttachments.js +8 -5
  19. package/lib/features/attachments/useImageAttachments.js.map +1 -1
  20. package/lib/features/chat/AssistantMarkdown.js +7 -6
  21. package/lib/features/chat/AssistantMarkdown.js.map +1 -1
  22. package/lib/features/chat/ChatTranscript.js +12 -2
  23. package/lib/features/chat/ChatTranscript.js.map +1 -1
  24. package/lib/features/devices/bleTransport.js +141 -0
  25. package/lib/features/devices/bleTransport.js.map +1 -0
  26. package/lib/features/devices/catalog.js +59 -0
  27. package/lib/features/devices/catalog.js.map +1 -0
  28. package/lib/features/devices/deviceStore.js +292 -0
  29. package/lib/features/devices/deviceStore.js.map +1 -0
  30. package/lib/features/devices/devices.js +68 -0
  31. package/lib/features/devices/devices.js.map +1 -0
  32. package/lib/features/devices/drivers.js +378 -0
  33. package/lib/features/devices/drivers.js.map +1 -0
  34. package/lib/features/devices/gatt/bytes.js +103 -0
  35. package/lib/features/devices/gatt/bytes.js.map +1 -0
  36. package/lib/features/devices/gatt/dateTime.js +23 -0
  37. package/lib/features/devices/gatt/dateTime.js.map +1 -0
  38. package/lib/features/devices/gatt/measurements.js +210 -0
  39. package/lib/features/devices/gatt/measurements.js.map +1 -0
  40. package/lib/features/devices/gatt/userData.js +57 -0
  41. package/lib/features/devices/gatt/userData.js.map +1 -0
  42. package/lib/features/devices/gatt/uuids.js +41 -0
  43. package/lib/features/devices/gatt/uuids.js.map +1 -0
  44. package/lib/features/devices/link.js +8 -0
  45. package/lib/features/devices/link.js.map +1 -0
  46. package/lib/features/devices/readings.js +158 -0
  47. package/lib/features/devices/readings.js.map +1 -0
  48. package/lib/features/devices/session.js +334 -0
  49. package/lib/features/devices/session.js.map +1 -0
  50. package/lib/features/expenses/ExpensesAgentChatPane.js +50 -0
  51. package/lib/features/expenses/ExpensesAgentChatPane.js.map +1 -0
  52. package/lib/features/expenses/ExpensesExperience.js +646 -0
  53. package/lib/features/expenses/ExpensesExperience.js.map +1 -0
  54. package/lib/features/expenses/claimFilters.js +94 -0
  55. package/lib/features/expenses/claimFilters.js.map +1 -0
  56. package/lib/features/expenses/components/AccountsPanel.js +464 -0
  57. package/lib/features/expenses/components/AccountsPanel.js.map +1 -0
  58. package/lib/features/expenses/components/BudgetsPanel.js +320 -0
  59. package/lib/features/expenses/components/BudgetsPanel.js.map +1 -0
  60. package/lib/features/expenses/components/CategoriesSheet.js +181 -0
  61. package/lib/features/expenses/components/CategoriesSheet.js.map +1 -0
  62. package/lib/features/expenses/components/ClaimDetail.js +309 -0
  63. package/lib/features/expenses/components/ClaimDetail.js.map +1 -0
  64. package/lib/features/expenses/components/ClaimForm.js +375 -0
  65. package/lib/features/expenses/components/ClaimForm.js.map +1 -0
  66. package/lib/features/expenses/components/ClaimRow.js +77 -0
  67. package/lib/features/expenses/components/ClaimRow.js.map +1 -0
  68. package/lib/features/expenses/components/ClaimsPanel.js +388 -0
  69. package/lib/features/expenses/components/ClaimsPanel.js.map +1 -0
  70. package/lib/features/expenses/components/DateSheet.js +214 -0
  71. package/lib/features/expenses/components/DateSheet.js.map +1 -0
  72. package/lib/features/expenses/components/ExpensesStates.js +274 -0
  73. package/lib/features/expenses/components/ExpensesStates.js.map +1 -0
  74. package/lib/features/expenses/components/ExpensesTabBar.js +83 -0
  75. package/lib/features/expenses/components/ExpensesTabBar.js.map +1 -0
  76. package/lib/features/expenses/components/FiltersSheet.js +137 -0
  77. package/lib/features/expenses/components/FiltersSheet.js.map +1 -0
  78. package/lib/features/expenses/components/InsightsPanel.js +362 -0
  79. package/lib/features/expenses/components/InsightsPanel.js.map +1 -0
  80. package/lib/features/expenses/components/RecurringPanel.js +370 -0
  81. package/lib/features/expenses/components/RecurringPanel.js.map +1 -0
  82. package/lib/features/expenses/components/Sheets.js +220 -0
  83. package/lib/features/expenses/components/Sheets.js.map +1 -0
  84. package/lib/features/expenses/components/ui.js +496 -0
  85. package/lib/features/expenses/components/ui.js.map +1 -0
  86. package/lib/features/expenses/expensesClient.js +398 -0
  87. package/lib/features/expenses/expensesClient.js.map +1 -0
  88. package/lib/features/expenses/expensesContext.js +30 -0
  89. package/lib/features/expenses/expensesContext.js.map +1 -0
  90. package/lib/features/expenses/expensesEndpoint.js +12 -0
  91. package/lib/features/expenses/expensesEndpoint.js.map +1 -0
  92. package/lib/features/expenses/expensesFormat.js +360 -0
  93. package/lib/features/expenses/expensesFormat.js.map +1 -0
  94. package/lib/features/expenses/expensesOperations.js +136 -0
  95. package/lib/features/expenses/expensesOperations.js.map +1 -0
  96. package/lib/features/expenses/expensesPrompts.js +81 -0
  97. package/lib/features/expenses/expensesPrompts.js.map +1 -0
  98. package/lib/features/expenses/expensesTheme.js +107 -0
  99. package/lib/features/expenses/expensesTheme.js.map +1 -0
  100. package/lib/features/expenses/nativeExpensesRegistry.js +15 -0
  101. package/lib/features/expenses/nativeExpensesRegistry.js.map +1 -0
  102. package/lib/features/expenses/receiptScan.js +242 -0
  103. package/lib/features/expenses/receiptScan.js.map +1 -0
  104. package/lib/features/expenses/useClaimsList.js +159 -0
  105. package/lib/features/expenses/useClaimsList.js.map +1 -0
  106. package/lib/features/expenses/useExpensesResource.js +68 -0
  107. package/lib/features/expenses/useExpensesResource.js.map +1 -0
  108. package/lib/features/health/HealthSyncRunner.js +24 -10
  109. package/lib/features/health/HealthSyncRunner.js.map +1 -1
  110. package/lib/features/health/buildDays.js +52 -5
  111. package/lib/features/health/buildDays.js.map +1 -1
  112. package/lib/features/health/fitnessClient.js +30 -3
  113. package/lib/features/health/fitnessClient.js.map +1 -1
  114. package/lib/features/health/healthConnectMapping.js +65 -2
  115. package/lib/features/health/healthConnectMapping.js.map +1 -1
  116. package/lib/features/health/healthConnectReader.js +23 -5
  117. package/lib/features/health/healthConnectReader.js.map +1 -1
  118. package/lib/features/health/healthConnectWriter.js +49 -0
  119. package/lib/features/health/healthConnectWriter.js.map +1 -0
  120. package/lib/features/health/healthkitMapping.js +58 -2
  121. package/lib/features/health/healthkitMapping.js.map +1 -1
  122. package/lib/features/health/healthkitReader.js +29 -7
  123. package/lib/features/health/healthkitReader.js.map +1 -1
  124. package/lib/features/health/healthkitWriter.js +55 -0
  125. package/lib/features/health/healthkitWriter.js.map +1 -0
  126. package/lib/features/health/model.js +8 -1
  127. package/lib/features/health/model.js.map +1 -1
  128. package/lib/features/health/ownSource.js +6 -0
  129. package/lib/features/health/ownSource.js.map +1 -0
  130. package/lib/features/health/reader.js +21 -0
  131. package/lib/features/health/reader.js.map +1 -1
  132. package/lib/features/health/types.js +15 -3
  133. package/lib/features/health/types.js.map +1 -1
  134. package/lib/features/health/writeMapping.js +218 -0
  135. package/lib/features/health/writeMapping.js.map +1 -0
  136. package/lib/features/links/ChatLinkOpenerProvider.js +56 -0
  137. package/lib/features/links/ChatLinkOpenerProvider.js.map +1 -0
  138. package/lib/features/links/chatLinkOpener.js +8 -0
  139. package/lib/features/links/chatLinkOpener.js.map +1 -0
  140. package/lib/features/links/openInApp.js +25 -0
  141. package/lib/features/links/openInApp.js.map +1 -0
  142. package/lib/features/messaging/ChatComponents.js +25 -6
  143. package/lib/features/messaging/ChatComponents.js.map +1 -1
  144. package/lib/features/messaging/LinkPreviewCard.js +103 -0
  145. package/lib/features/messaging/LinkPreviewCard.js.map +1 -0
  146. package/lib/features/messaging/NativeChatExperience.js +20 -7
  147. package/lib/features/messaging/NativeChatExperience.js.map +1 -1
  148. package/lib/features/messaging/ThreadScreen.js +4 -2
  149. package/lib/features/messaging/ThreadScreen.js.map +1 -1
  150. package/lib/features/messaging/chatLinks.js +64 -0
  151. package/lib/features/messaging/chatLinks.js.map +1 -0
  152. package/lib/features/messaging/linkPreview.js +64 -0
  153. package/lib/features/messaging/linkPreview.js.map +1 -0
  154. package/lib/index.js +1 -1
  155. package/lib/index.js.map +1 -1
  156. package/lib/routes.json +54 -0
  157. package/lib/screens/Account/index.js +39 -14
  158. package/lib/screens/Account/index.js.map +1 -1
  159. package/lib/screens/Chat/index.js +4 -3
  160. package/lib/screens/Chat/index.js.map +1 -1
  161. package/lib/screens/Devices/index.js +1055 -0
  162. package/lib/screens/Devices/index.js.map +1 -0
  163. package/lib/screens/ExpensesNative/index.js +98 -0
  164. package/lib/screens/ExpensesNative/index.js.map +1 -0
  165. package/lib/screens/ExpensesNative/useExpensesHostChat.js +63 -0
  166. package/lib/screens/ExpensesNative/useExpensesHostChat.js.map +1 -0
  167. package/lib/screens/Health/index.js +40 -7
  168. package/lib/screens/Health/index.js.map +1 -1
  169. package/lib/screens/WebBuilder/index.js +20 -0
  170. package/lib/screens/WebBuilder/index.js.map +1 -1
  171. package/lib/utils/hasNativeModule.js +9 -0
  172. package/lib/utils/hasNativeModule.js.map +1 -0
  173. package/package.json +4 -3
@@ -0,0 +1,1055 @@
1
+ import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{useState,useMemo,useCallback,useEffect,useRef}from'react';import {BackHandler,StyleSheet,View,Pressable,ActivityIndicator,ScrollView,Linking,Alert,Animated,Easing,Platform}from'react-native';import {Ionicons}from'@expo/vector-icons';import {Text}from'@admin-layout/gluestack-ui-mobile';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {mobileColors,mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {deviceKind,DEVICE_KINDS}from'../../features/devices/catalog.js';import {useDevices,useDeviceSession,platformWriter,deviceStore}from'../../features/devices/devices.js';import {describeReading}from'../../features/devices/readings.js';import {useHealthSync}from'../../features/health/healthSync.js';var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ const IS_IOS = Platform.OS === "ios";
18
+ const STORE_NAME = IS_IOS ? "Apple Health" : "Health Connect";
19
+ const WORKOUT_TYPES = [{
20
+ id: "run",
21
+ label: "Run"
22
+ }, {
23
+ id: "walk",
24
+ label: "Walk"
25
+ }, {
26
+ id: "cycle",
27
+ label: "Ride"
28
+ }, {
29
+ id: "strength",
30
+ label: "Strength"
31
+ }, {
32
+ id: "hiit",
33
+ label: "HIIT"
34
+ }, {
35
+ id: "other",
36
+ label: "Other"
37
+ }];
38
+ function DevicesScreen() {
39
+ var _a, _b, _c, _d, _e, _f;
40
+ const navigation = useNavigation();
41
+ const route = useRoute();
42
+ const {
43
+ isDark
44
+ } = useAppTheme();
45
+ const colors = mobileColors(isDark);
46
+ const insets = useSafeAreaInsets();
47
+ const devices = useDevices();
48
+ const [stack, setStack] = useState(() => {
49
+ var _a2;
50
+ return ((_a2 = route == null ? void 0 : route.params) == null ? void 0 : _a2.add) ? [{
51
+ name: "home"
52
+ }, {
53
+ name: "pick"
54
+ }] : [{
55
+ name: "home"
56
+ }];
57
+ });
58
+ const step = stack[stack.length - 1];
59
+ const units = (_b = (_a = devices.person) == null ? void 0 : _a.units) != null ? _b : "metric";
60
+ const orgName = useMemo(() => {
61
+ var _a2, _b2;
62
+ const raw = (_b2 = (_a2 = route == null ? void 0 : route.params) == null ? void 0 : _a2.orgName) != null ? _b2 : "";
63
+ return typeof raw === "string" && raw.trim() ? raw.trim() : null;
64
+ }, [(_c = route == null ? void 0 : route.params) == null ? void 0 : _c.orgName]);
65
+ const push = useCallback((next) => setStack((s) => [...s, next]), []);
66
+ const pop = useCallback(() => {
67
+ var _a2, _b2;
68
+ if (stack.length > 1) {
69
+ setStack((s) => s.slice(0, -1));
70
+ return true;
71
+ }
72
+ if ((_a2 = navigation == null ? void 0 : navigation.canGoBack) == null ? void 0 : _a2.call(navigation)) {
73
+ navigation.goBack();
74
+ return true;
75
+ }
76
+ (_b2 = navigation == null ? void 0 : navigation.dispatch) == null ? void 0 : _b2.call(navigation, CommonActions.navigate({
77
+ name: "MainStack.Account",
78
+ params: orgName ? {
79
+ orgName
80
+ } : void 0
81
+ }));
82
+ return true;
83
+ }, [stack.length, navigation, orgName]);
84
+ useEffect(() => {
85
+ const sub = BackHandler.addEventListener("hardwareBackPress", pop);
86
+ return () => sub.remove();
87
+ }, [pop]);
88
+ const openHealth = useCallback(() => {
89
+ var _a2;
90
+ (_a2 = navigation == null ? void 0 : navigation.navigate) == null ? void 0 : _a2.call(navigation, "MainStack.Health", orgName ? {
91
+ orgName
92
+ } : void 0);
93
+ }, [navigation, orgName]);
94
+ const title = step.name === "pick" ? "Add a device" : step.name === "measure" ? deviceKind(step.kind).title : step.name === "device" ? (_e = (_d = devices.devices.find((d) => d.id === step.id)) == null ? void 0 : _d.name) != null ? _e : "Device" : "Devices";
95
+ return /* @__PURE__ */ jsxs(SafeAreaView, { edges: ["top", "left", "right"], style: [styles.safe, {
96
+ backgroundColor: colors.bg
97
+ }], children: [
98
+ /* @__PURE__ */ jsxs(View, { style: [styles.header, {
99
+ paddingTop: insets.top > 0 ? 4 : 10
100
+ }], children: [
101
+ /* @__PURE__ */ jsx(Pressable, { onPress: pop, accessibilityRole: "button", accessibilityLabel: "Go back", style: ({
102
+ pressed
103
+ }) => [styles.backCircle, {
104
+ backgroundColor: colors.surface
105
+ }, pressed && styles.pressed], children: /* @__PURE__ */ jsx(Ionicons, { name: "chevron-back", size: 22, color: colors.text }) }),
106
+ /* @__PURE__ */ jsx(Text, { style: [styles.headerTitle, {
107
+ color: colors.text
108
+ }], numberOfLines: 1, children: title }),
109
+ /* @__PURE__ */ jsx(View, { style: styles.headerSpacer })
110
+ ] }),
111
+ step.name === "home" ? /* @__PURE__ */ jsx(Home, { colors, isDark, units, onAdd: () => push({
112
+ name: "pick"
113
+ }), onOpen: (id) => push({
114
+ name: "device",
115
+ id
116
+ }), onHealth: openHealth }) : null,
117
+ step.name === "pick" ? /* @__PURE__ */ jsx(PickKind, { colors, isDark, onPick: (kind) => push({
118
+ name: "measure",
119
+ kind
120
+ }) }) : null,
121
+ step.name === "measure" ? /* @__PURE__ */ jsx(Measure, { kind: step.kind, deviceId: step.deviceId, colors, units, onDone: () => setStack([{
122
+ name: "home"
123
+ }]), onHealth: openHealth }, `${step.kind}:${(_f = step.deviceId) != null ? _f : ""}`) : null,
124
+ step.name === "device" ? /* @__PURE__ */ jsx(DeviceDetail, { id: step.id, colors, units, onMeasure: (kind) => push({
125
+ name: "measure",
126
+ kind,
127
+ deviceId: step.id
128
+ }), onForgot: () => setStack([{
129
+ name: "home"
130
+ }]) }) : null
131
+ ] });
132
+ }
133
+ function Home({
134
+ colors,
135
+ isDark,
136
+ units,
137
+ onAdd,
138
+ onOpen,
139
+ onHealth
140
+ }) {
141
+ const devices = useDevices();
142
+ const now = Date.now();
143
+ if (!devices.loaded) return /* @__PURE__ */ jsx(ActivityIndicator, { style: styles.loading, color: colors.primary });
144
+ const latestOf = (d) => devices.readings.filter((r) => r.deviceId === d.id).reduce((a, b) => !a || b.at > a.at ? b : a, void 0);
145
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.scroll, children: [
146
+ devices.devices.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
147
+ /* @__PURE__ */ jsx(Text, { style: [styles.sectionTitle, {
148
+ color: colors.textMuted
149
+ }], children: "MY DEVICES" }),
150
+ /* @__PURE__ */ jsx(View, { style: [styles.card, {
151
+ backgroundColor: colors.surface
152
+ }], children: devices.devices.map((d, i) => {
153
+ const latest = latestOf(d);
154
+ return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
155
+ i > 0 ? /* @__PURE__ */ jsx(View, { style: [styles.rowLine, {
156
+ backgroundColor: colors.border
157
+ }] }) : null,
158
+ /* @__PURE__ */ jsxs(Pressable, { onPress: () => onOpen(d.id), accessibilityRole: "button", accessibilityLabel: d.name, style: ({
159
+ pressed
160
+ }) => [styles.deviceRow, pressed && {
161
+ backgroundColor: colors.surfaceMuted
162
+ }], children: [
163
+ /* @__PURE__ */ jsx(KindIcon, { kind: d.kind, colors }),
164
+ /* @__PURE__ */ jsxs(View, { style: styles.deviceText, children: [
165
+ /* @__PURE__ */ jsx(Text, { style: [styles.deviceName, {
166
+ color: colors.text
167
+ }], numberOfLines: 1, children: d.name }),
168
+ /* @__PURE__ */ jsx(Text, { style: [styles.deviceMeta, {
169
+ color: colors.textMuted
170
+ }], numberOfLines: 1, children: latest ? `${describeReading(latest, units)} \xB7 ${whenLabel(latest.at, now)}` : "No readings yet" })
171
+ ] }),
172
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-forward", size: 16, color: isDark ? "#64748b" : "#c4c4c4" })
173
+ ] })
174
+ ] }, d.id);
175
+ }) })
176
+ ] }) : /* @__PURE__ */ jsxs(View, { style: styles.hero, children: [
177
+ /* @__PURE__ */ jsx(View, { style: [styles.heroIcon, {
178
+ backgroundColor: colors.primarySoft
179
+ }], children: /* @__PURE__ */ jsx(Ionicons, { name: "bluetooth", size: 30, color: colors.primary }) }),
180
+ /* @__PURE__ */ jsx(Text, { style: [styles.heroTitle, {
181
+ color: colors.text
182
+ }], children: "Connect a device" }),
183
+ /* @__PURE__ */ jsxs(Text, { style: [styles.heroBody, {
184
+ color: colors.textMuted
185
+ }], children: [
186
+ "Pair a scale, blood-pressure monitor, heart-rate strap, pulse oximeter, thermometer or glucose meter. Each reading goes to your coach, and to ",
187
+ STORE_NAME,
188
+ " when you connected it."
189
+ ] })
190
+ ] }),
191
+ devices.lastError && devices.pendingDates.length ? /* @__PURE__ */ jsx(Notice, { colors, tone: "warning", icon: "cloud-offline-outline", text: `Readings are kept on this phone and sent when Yantra can reach your coach. ${devices.lastError}` }) : null,
192
+ /* @__PURE__ */ jsx(View, { style: styles.actions, children: /* @__PURE__ */ jsx(PrimaryButton, { label: "Add a device", onPress: onAdd }) }),
193
+ /* @__PURE__ */ jsxs(Text, { style: [styles.footnote, {
194
+ color: colors.textMuted
195
+ }], children: [
196
+ "Devices that use the Bluetooth health standards pair here. For a brand scale with its own app, such as RENPHO or Withings, turn on its ",
197
+ STORE_NAME,
198
+ " sync; Yantra reads it there."
199
+ ] }),
200
+ /* @__PURE__ */ jsxs(Pressable, { onPress: onHealth, accessibilityRole: "link", style: ({
201
+ pressed
202
+ }) => [styles.linkRow, pressed && styles.pressed], children: [
203
+ /* @__PURE__ */ jsxs(Text, { style: [styles.link, {
204
+ color: colors.primary
205
+ }], children: [
206
+ STORE_NAME,
207
+ " settings"
208
+ ] }),
209
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-forward", size: 14, color: colors.primary })
210
+ ] })
211
+ ] });
212
+ }
213
+ function PickKind({
214
+ colors,
215
+ isDark,
216
+ onPick
217
+ }) {
218
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.scroll, children: [
219
+ /* @__PURE__ */ jsx(Text, { style: [styles.question, {
220
+ color: colors.text
221
+ }], children: "Which device do you want to connect?" }),
222
+ /* @__PURE__ */ jsx(View, { style: styles.kindList, children: DEVICE_KINDS.map((k) => /* @__PURE__ */ jsxs(Pressable, { onPress: () => onPick(k.id), accessibilityRole: "button", accessibilityLabel: k.title, style: ({
223
+ pressed
224
+ }) => [styles.kindCard, {
225
+ backgroundColor: colors.surface
226
+ }, pressed && {
227
+ backgroundColor: colors.surfaceMuted
228
+ }], children: [
229
+ /* @__PURE__ */ jsx(KindIcon, { kind: k.id, colors, large: true }),
230
+ /* @__PURE__ */ jsxs(View, { style: styles.deviceText, children: [
231
+ /* @__PURE__ */ jsx(Text, { style: [styles.kindTitle, {
232
+ color: colors.text
233
+ }], children: k.title }),
234
+ /* @__PURE__ */ jsx(Text, { style: [styles.deviceMeta, {
235
+ color: colors.textMuted
236
+ }], children: k.subtitle })
237
+ ] }),
238
+ /* @__PURE__ */ jsx(Ionicons, { name: "chevron-forward", size: 16, color: isDark ? "#64748b" : "#c4c4c4" })
239
+ ] }, k.id)) })
240
+ ] });
241
+ }
242
+ function Measure({
243
+ kind,
244
+ deviceId,
245
+ colors,
246
+ units,
247
+ onDone,
248
+ onHealth
249
+ }) {
250
+ const {
251
+ snapshot,
252
+ session
253
+ } = useDeviceSession(kind, deviceId);
254
+ const {
255
+ state,
256
+ readings,
257
+ live,
258
+ recording,
259
+ notices
260
+ } = snapshot;
261
+ const info = deviceKind(kind);
262
+ const now = Date.now();
263
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.scroll, children: [
264
+ state.step === "starting" ? /* @__PURE__ */ jsx(ActivityIndicator, { style: styles.loading, color: colors.primary }) : null,
265
+ state.step === "unavailable" ? /* @__PURE__ */ jsx(Notice, { colors, tone: "warning", icon: "information-circle", text: state.reason }) : null,
266
+ state.step === "radio" ? /* @__PURE__ */ jsxs(View, { style: styles.center, children: [
267
+ /* @__PURE__ */ jsx(BluetoothPulse, { colors, active: false }),
268
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusTitle, {
269
+ color: colors.text
270
+ }], children: state.radio === "off" ? "Turn on Bluetooth" : state.radio === "unauthorized" ? "Allow Bluetooth for Yantra" : "This phone has no Bluetooth Yantra can use" }),
271
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusBody, {
272
+ color: colors.textMuted
273
+ }], children: state.radio === "off" ? "Yantra finds your device over Bluetooth." : state.radio === "unauthorized" ? "Yantra needs Bluetooth to find and read your device. Turn it on for Yantra in Settings." : "" }),
274
+ state.radio === "unauthorized" ? /* @__PURE__ */ jsx(PrimaryButton, { label: "Open Settings", onPress: () => void Linking.openSettings() }) : null,
275
+ state.radio === "off" ? /* @__PURE__ */ jsx(PrimaryButton, { label: "Try again", onPress: () => void (session == null ? void 0 : session.start()) }) : null
276
+ ] }) : null,
277
+ state.step === "scanning" ? /* @__PURE__ */ jsxs(Fragment, { children: [
278
+ /* @__PURE__ */ jsx(BluetoothPulse, { colors, active: true }),
279
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusTitle, {
280
+ color: colors.text
281
+ }], children: deviceId ? "Looking for your device" : "Looking for devices nearby" }),
282
+ /* @__PURE__ */ jsx(View, { style: [styles.card, styles.guidance, {
283
+ backgroundColor: colors.surface
284
+ }], children: info.steps.map((line, i) => /* @__PURE__ */ jsxs(View, { style: styles.guidanceRow, children: [
285
+ /* @__PURE__ */ jsx(View, { style: [styles.stepDot, {
286
+ backgroundColor: colors.primarySoft
287
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.stepNumber, {
288
+ color: colors.primary
289
+ }], children: i + 1 }) }),
290
+ /* @__PURE__ */ jsx(Text, { style: [styles.guidanceText, {
291
+ color: colors.text
292
+ }], children: line })
293
+ ] }, line)) }),
294
+ state.hint ? /* @__PURE__ */ jsx(Notice, { colors, tone: "warning", icon: "information-circle", text: `Nothing yet. ${state.hint} Keep it close to the phone.` }) : null,
295
+ state.found.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
296
+ /* @__PURE__ */ jsx(Text, { style: [styles.sectionTitle, {
297
+ color: colors.textMuted
298
+ }], children: "NEARBY" }),
299
+ /* @__PURE__ */ jsx(View, { style: [styles.card, {
300
+ backgroundColor: colors.surface
301
+ }], children: state.found.map((f, i) => /* @__PURE__ */ jsx(FoundRow, { found: f, first: i === 0, colors, onPress: () => void (session == null ? void 0 : session.pick(f)) }, f.id)) })
302
+ ] }) : null
303
+ ] }) : null,
304
+ state.step === "connecting" ? /* @__PURE__ */ jsxs(View, { style: styles.center, children: [
305
+ /* @__PURE__ */ jsx(ActivityIndicator, { color: colors.primary, size: "large" }),
306
+ /* @__PURE__ */ jsxs(Text, { style: [styles.statusTitle, {
307
+ color: colors.text
308
+ }], children: [
309
+ "Connecting to ",
310
+ state.device.name
311
+ ] }),
312
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusBody, {
313
+ color: colors.textMuted
314
+ }], children: "If your phone asks to pair, tap Pair." })
315
+ ] }) : null,
316
+ state.step === "connected" && !readings.length && !live ? /* @__PURE__ */ jsxs(View, { style: styles.center, children: [
317
+ /* @__PURE__ */ jsx(BluetoothPulse, { colors, active: true, connected: true }),
318
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusTitle, {
319
+ color: colors.text
320
+ }], children: info.waitingFor }),
321
+ /* @__PURE__ */ jsxs(Text, { style: [styles.statusBody, {
322
+ color: colors.textMuted
323
+ }], children: [
324
+ "Connected to ",
325
+ state.device.name,
326
+ "."
327
+ ] })
328
+ ] }) : null,
329
+ (state.step === "connected" || state.step === "ended") && live ? /* @__PURE__ */ jsx(LivePanel, { kind, colors, live, recording, connected: state.step === "connected", onStart: (type) => session == null ? void 0 : session.startRecording(type), onStop: () => void (session == null ? void 0 : session.stopRecording()), onSave: () => void (session == null ? void 0 : session.saveLive()) }) : null,
330
+ notices.map((n) => /* @__PURE__ */ jsx(Notice, { colors, tone: "warning", icon: "information-circle", text: n }, n)),
331
+ readings.length ? /* @__PURE__ */ jsx(ReadingsCard, { title: "JUST MEASURED", readings, colors, units, now }) : null,
332
+ readings.length ? /* @__PURE__ */ jsx(SavedLine, { colors, onHealth }) : null,
333
+ state.step === "ended" ? /* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
334
+ !readings.length ? /* @__PURE__ */ jsx(Text, { style: [styles.actionHint, {
335
+ color: colors.textMuted
336
+ }], children: "The device went to sleep before it sent a measurement." }) : null,
337
+ /* @__PURE__ */ jsx(PrimaryButton, { label: "Done", onPress: onDone }),
338
+ /* @__PURE__ */ jsx(SecondaryButton, { label: "Measure again", colors, onPress: () => session == null ? void 0 : session.scan() })
339
+ ] }) : null,
340
+ state.step === "connected" && readings.length ? /* @__PURE__ */ jsx(View, { style: styles.actions, children: /* @__PURE__ */ jsx(PrimaryButton, { label: "Done", onPress: onDone }) }) : null,
341
+ state.step === "error" ? /* @__PURE__ */ jsxs(View, { style: styles.center, children: [
342
+ /* @__PURE__ */ jsx(Ionicons, { name: "alert-circle", size: 40, color: colors.dangerText }),
343
+ /* @__PURE__ */ jsx(Text, { style: [styles.statusTitle, {
344
+ color: colors.text
345
+ }], children: state.message }),
346
+ /* @__PURE__ */ jsx(PrimaryButton, { label: "Try again", onPress: () => void (session == null ? void 0 : session.start()) })
347
+ ] }) : null
348
+ ] });
349
+ }
350
+ function LivePanel({
351
+ kind,
352
+ colors,
353
+ live,
354
+ recording,
355
+ connected,
356
+ onStart,
357
+ onStop,
358
+ onSave
359
+ }) {
360
+ var _a, _b, _c, _d, _e;
361
+ const [type, setType] = useState("run");
362
+ const [, tick] = useState(0);
363
+ useEffect(() => {
364
+ if (!recording) return void 0;
365
+ const t = setInterval(() => tick((n) => n + 1), 1e3);
366
+ return () => clearInterval(t);
367
+ }, [recording]);
368
+ if (kind === "heart-rate") {
369
+ const elapsed = recording ? Math.max(0, Math.floor((Date.now() - recording.startedAt) / 1e3)) : 0;
370
+ return /* @__PURE__ */ jsxs(View, { style: [styles.card, styles.livePanel, {
371
+ backgroundColor: colors.surface
372
+ }], children: [
373
+ /* @__PURE__ */ jsxs(Text, { style: [styles.liveValue, {
374
+ color: colors.text
375
+ }], accessibilityLabel: `Heart rate ${(_a = live.bpm) != null ? _a : 0} beats per minute`, children: [
376
+ (_b = live.bpm) != null ? _b : "--",
377
+ /* @__PURE__ */ jsx(Text, { style: [styles.liveUnit, {
378
+ color: colors.textMuted
379
+ }], children: " bpm" })
380
+ ] }),
381
+ recording ? /* @__PURE__ */ jsxs(Fragment, { children: [
382
+ /* @__PURE__ */ jsxs(Text, { style: [styles.liveMeta, {
383
+ color: colors.textMuted
384
+ }], children: [
385
+ clockOf(elapsed),
386
+ " \xB7 average ",
387
+ (_c = recording.avgHr) != null ? _c : "--",
388
+ " \xB7 max ",
389
+ (_d = recording.maxHr) != null ? _d : "--"
390
+ ] }),
391
+ /* @__PURE__ */ jsx(PrimaryButton, { label: "Stop and save", onPress: onStop })
392
+ ] }) : connected ? /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ /* @__PURE__ */ jsx(View, { style: styles.chips, children: WORKOUT_TYPES.map((w) => /* @__PURE__ */ jsx(Pressable, { onPress: () => setType(w.id), accessibilityRole: "radio", accessibilityState: {
394
+ selected: type === w.id
395
+ }, style: [styles.chip, {
396
+ borderColor: type === w.id ? colors.primary : colors.border
397
+ }, type === w.id && {
398
+ backgroundColor: colors.primarySoft
399
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.chipLabel, {
400
+ color: type === w.id ? colors.primary : colors.text
401
+ }], children: w.label }) }, w.id)) }),
402
+ /* @__PURE__ */ jsx(PrimaryButton, { label: "Start session", onPress: () => onStart(type) })
403
+ ] }) : null
404
+ ] });
405
+ }
406
+ return /* @__PURE__ */ jsxs(View, { style: [styles.card, styles.livePanel, {
407
+ backgroundColor: colors.surface
408
+ }], children: [
409
+ /* @__PURE__ */ jsxs(Text, { style: [styles.liveValue, {
410
+ color: colors.text
411
+ }], children: [
412
+ (_e = live.spo2) != null ? _e : "--",
413
+ /* @__PURE__ */ jsx(Text, { style: [styles.liveUnit, {
414
+ color: colors.textMuted
415
+ }], children: "%" })
416
+ ] }),
417
+ /* @__PURE__ */ jsxs(Text, { style: [styles.liveMeta, {
418
+ color: colors.textMuted
419
+ }], children: [
420
+ "Blood oxygen",
421
+ live.pulse ? ` \xB7 pulse ${live.pulse}` : ""
422
+ ] }),
423
+ connected ? /* @__PURE__ */ jsx(PrimaryButton, { label: "Save this reading", onPress: onSave }) : null
424
+ ] });
425
+ }
426
+ function DeviceDetail({
427
+ id,
428
+ colors,
429
+ units,
430
+ onMeasure,
431
+ onForgot
432
+ }) {
433
+ const devices = useDevices();
434
+ const device = devices.devices.find((d) => d.id === id);
435
+ const readings = useMemo(() => devices.readings.filter((r) => r.deviceId === id).sort((a, b) => b.at - a.at).slice(0, 20), [devices.readings, id]);
436
+ if (!device) return null;
437
+ const forget = () => Alert.alert(`Forget ${device.name}?`, "Its readings stay in Yantra. To use it again, pair it again.", [{
438
+ text: "Cancel",
439
+ style: "cancel"
440
+ }, {
441
+ text: "Forget",
442
+ style: "destructive",
443
+ onPress: () => void deviceStore.forget(id).then(onForgot)
444
+ }]);
445
+ return /* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.scroll, children: [
446
+ /* @__PURE__ */ jsxs(View, { style: styles.hero, children: [
447
+ /* @__PURE__ */ jsx(KindIcon, { kind: device.kind, colors, large: true }),
448
+ /* @__PURE__ */ jsx(Text, { style: [styles.heroTitle, {
449
+ color: colors.text
450
+ }], children: device.name }),
451
+ /* @__PURE__ */ jsxs(Text, { style: [styles.heroBody, {
452
+ color: colors.textMuted
453
+ }], children: [
454
+ deviceKind(device.kind).title,
455
+ device.scaleUser ? ` \xB7 user ${device.scaleUser.userIndex} on this scale` : ""
456
+ ] })
457
+ ] }),
458
+ /* @__PURE__ */ jsx(View, { style: styles.actions, children: /* @__PURE__ */ jsx(PrimaryButton, { label: device.kind === "heart-rate" ? "Start a session" : "Take a reading", onPress: () => onMeasure(device.kind) }) }),
459
+ readings.length ? /* @__PURE__ */ jsx(ReadingsCard, { title: "READINGS", readings, colors, units, now: Date.now() }) : /* @__PURE__ */ jsx(Text, { style: [styles.footnote, {
460
+ color: colors.textMuted
461
+ }], children: "No readings from this device yet." }),
462
+ /* @__PURE__ */ jsx(View, { style: [styles.card, styles.secondaryCard, {
463
+ backgroundColor: colors.surface
464
+ }], children: /* @__PURE__ */ jsx(Pressable, { onPress: forget, accessibilityRole: "button", style: ({
465
+ pressed
466
+ }) => [styles.row, pressed && {
467
+ backgroundColor: colors.surfaceMuted
468
+ }], children: /* @__PURE__ */ jsx(Text, { style: [styles.rowLabelWide, {
469
+ color: colors.dangerText
470
+ }], children: "Forget this device" }) }) })
471
+ ] });
472
+ }
473
+ function ReadingsCard({
474
+ title,
475
+ readings,
476
+ colors,
477
+ units,
478
+ now
479
+ }) {
480
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
481
+ /* @__PURE__ */ jsx(Text, { style: [styles.sectionTitle, {
482
+ color: colors.textMuted
483
+ }], children: title }),
484
+ /* @__PURE__ */ jsx(View, { style: [styles.card, {
485
+ backgroundColor: colors.surface
486
+ }], children: readings.map((r, i) => {
487
+ var _a;
488
+ return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
489
+ i > 0 ? /* @__PURE__ */ jsx(View, { style: [styles.rowLine, {
490
+ backgroundColor: colors.border
491
+ }] }) : null,
492
+ /* @__PURE__ */ jsxs(View, { style: styles.readingRow, children: [
493
+ /* @__PURE__ */ jsx(Text, { style: [styles.readingValue, {
494
+ color: colors.text
495
+ }], children: describeReading(r, units) }),
496
+ /* @__PURE__ */ jsx(Text, { style: [styles.readingWhen, {
497
+ color: colors.textMuted
498
+ }], children: whenLabel(r.at, now) }),
499
+ r.kind === "blood-pressure" && ((_a = r.problems) == null ? void 0 : _a.length) ? /* @__PURE__ */ jsx(Text, { style: [styles.readingNote, {
500
+ color: colors.warningText
501
+ }], children: r.problems.join(" ") }) : null
502
+ ] })
503
+ ] }, r.id);
504
+ }) })
505
+ ] });
506
+ }
507
+ function SavedLine({
508
+ colors,
509
+ onHealth
510
+ }) {
511
+ const health = useHealthSync();
512
+ const [asked, setAsked] = useState(null);
513
+ useEffect(() => {
514
+ let live = true;
515
+ void platformWriter().then(async (w) => {
516
+ const a = w ? await w.asked().catch(() => true) : true;
517
+ if (live) setAsked(a);
518
+ });
519
+ return () => {
520
+ live = false;
521
+ };
522
+ }, [health.sync.connected]);
523
+ const allowSaving = async () => {
524
+ const w = await platformWriter();
525
+ if (!w) return;
526
+ await w.requestAccess().catch(() => void 0);
527
+ setAsked(true);
528
+ void deviceStore.flush();
529
+ };
530
+ if (!health.sync.connected) {
531
+ return /* @__PURE__ */ jsxs(Pressable, { onPress: onHealth, accessibilityRole: "link", style: ({
532
+ pressed
533
+ }) => [styles.savedLine, pressed && styles.pressed], children: [
534
+ /* @__PURE__ */ jsx(Ionicons, { name: "checkmark-circle", size: 18, color: colors.successText }),
535
+ /* @__PURE__ */ jsxs(Text, { style: [styles.savedText, {
536
+ color: colors.textMuted
537
+ }], children: [
538
+ "Saved for your coach. ",
539
+ /* @__PURE__ */ jsxs(Text, { style: {
540
+ color: colors.primary
541
+ }, children: [
542
+ "Connect ",
543
+ STORE_NAME
544
+ ] }),
545
+ " to keep it there too."
546
+ ] })
547
+ ] });
548
+ }
549
+ if (asked === false) {
550
+ return /* @__PURE__ */ jsxs(View, { style: styles.savedBlock, children: [
551
+ /* @__PURE__ */ jsx(Text, { style: [styles.savedText, {
552
+ color: colors.textMuted
553
+ }], children: "Saved for your coach." }),
554
+ /* @__PURE__ */ jsx(SecondaryButton, { label: `Also save to ${STORE_NAME}`, colors, onPress: () => void allowSaving() })
555
+ ] });
556
+ }
557
+ return /* @__PURE__ */ jsxs(View, { style: styles.savedLine, children: [
558
+ /* @__PURE__ */ jsx(Ionicons, { name: "checkmark-circle", size: 18, color: colors.successText }),
559
+ /* @__PURE__ */ jsxs(Text, { style: [styles.savedText, {
560
+ color: colors.textMuted
561
+ }], children: [
562
+ "Saved for your coach and to ",
563
+ STORE_NAME,
564
+ "."
565
+ ] })
566
+ ] });
567
+ }
568
+ function FoundRow({
569
+ found,
570
+ first,
571
+ colors,
572
+ onPress
573
+ }) {
574
+ const bars = found.rssi === void 0 ? 1 : found.rssi > -60 ? 3 : found.rssi > -80 ? 2 : 1;
575
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
576
+ !first ? /* @__PURE__ */ jsx(View, { style: [styles.rowLine, {
577
+ backgroundColor: colors.border
578
+ }] }) : null,
579
+ /* @__PURE__ */ jsxs(Pressable, { onPress, accessibilityRole: "button", accessibilityLabel: `Connect ${found.name}`, style: ({
580
+ pressed
581
+ }) => [styles.deviceRow, pressed && {
582
+ backgroundColor: colors.surfaceMuted
583
+ }], children: [
584
+ found.kind ? /* @__PURE__ */ jsx(KindIcon, { kind: found.kind, colors }) : /* @__PURE__ */ jsx(Ionicons, { name: "bluetooth", size: 22, color: colors.primary }),
585
+ /* @__PURE__ */ jsx(Text, { style: [styles.deviceName, styles.deviceText, {
586
+ color: colors.text
587
+ }], numberOfLines: 1, children: found.name }),
588
+ /* @__PURE__ */ jsx(View, { style: styles.signal, accessibilityLabel: `Signal ${bars} of 3`, children: [1, 2, 3].map((b) => /* @__PURE__ */ jsx(View, { style: [styles.signalBar, {
589
+ height: 4 + b * 4,
590
+ backgroundColor: b <= bars ? colors.primary : colors.border
591
+ }] }, b)) })
592
+ ] })
593
+ ] });
594
+ }
595
+ function KindIcon({
596
+ kind,
597
+ colors,
598
+ large
599
+ }) {
600
+ const size = large ? 48 : 36;
601
+ return /* @__PURE__ */ jsx(View, { style: [styles.kindIcon, {
602
+ width: size,
603
+ height: size,
604
+ borderRadius: size / 2,
605
+ backgroundColor: colors.primarySoft
606
+ }], children: /* @__PURE__ */ jsx(Ionicons, { name: deviceKind(kind).icon, size: large ? 24 : 18, color: colors.primary }) });
607
+ }
608
+ function BluetoothPulse({
609
+ colors,
610
+ active,
611
+ connected
612
+ }) {
613
+ const pulse = useRef(new Animated.Value(0)).current;
614
+ useEffect(() => {
615
+ if (!active) return void 0;
616
+ const loop = Animated.loop(Animated.timing(pulse, {
617
+ toValue: 1,
618
+ duration: 1600,
619
+ easing: Easing.out(Easing.ease),
620
+ useNativeDriver: true
621
+ }));
622
+ loop.start();
623
+ return () => loop.stop();
624
+ }, [active, pulse]);
625
+ const scale = pulse.interpolate({
626
+ inputRange: [0, 1],
627
+ outputRange: [1, 1.9]
628
+ });
629
+ const opacity = pulse.interpolate({
630
+ inputRange: [0, 1],
631
+ outputRange: [0.45, 0]
632
+ });
633
+ return /* @__PURE__ */ jsxs(View, { style: styles.pulseBox, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: [
634
+ active ? /* @__PURE__ */ jsx(Animated.View, { style: [styles.pulseRing, {
635
+ backgroundColor: colors.primary,
636
+ opacity,
637
+ transform: [{
638
+ scale
639
+ }]
640
+ }] }) : null,
641
+ /* @__PURE__ */ jsx(View, { style: [styles.pulseCore, {
642
+ backgroundColor: connected ? colors.successText : colors.primary
643
+ }], children: /* @__PURE__ */ jsx(Ionicons, { name: connected ? "checkmark" : "bluetooth", size: 28, color: "#fff" }) })
644
+ ] });
645
+ }
646
+ function Notice({
647
+ colors,
648
+ tone,
649
+ icon,
650
+ text
651
+ }) {
652
+ const bg = tone === "danger" ? colors.dangerSoft : colors.warningSoft;
653
+ const fg = tone === "danger" ? colors.dangerText : colors.warningText;
654
+ return /* @__PURE__ */ jsxs(View, { style: [styles.notice, {
655
+ backgroundColor: bg
656
+ }], accessibilityRole: "alert", children: [
657
+ /* @__PURE__ */ jsx(Ionicons, { name: icon, size: 18, color: fg, style: styles.noticeIcon }),
658
+ /* @__PURE__ */ jsx(Text, { style: [styles.noticeText, {
659
+ color: fg
660
+ }], children: text })
661
+ ] });
662
+ }
663
+ function PrimaryButton({
664
+ label,
665
+ onPress
666
+ }) {
667
+ return /* @__PURE__ */ jsx(Pressable, { onPress, accessibilityRole: "button", accessibilityLabel: label, style: ({
668
+ pressed
669
+ }) => [styles.primary, pressed && styles.pressed], children: /* @__PURE__ */ jsx(Text, { style: styles.primaryLabel, children: label }) });
670
+ }
671
+ function SecondaryButton({
672
+ label,
673
+ onPress,
674
+ colors
675
+ }) {
676
+ return /* @__PURE__ */ jsx(Pressable, { onPress, accessibilityRole: "button", accessibilityLabel: label, style: ({
677
+ pressed
678
+ }) => [styles.secondary, {
679
+ borderColor: colors.border,
680
+ backgroundColor: colors.surface
681
+ }, pressed && styles.pressed], children: /* @__PURE__ */ jsx(Text, { style: [styles.secondaryLabel, {
682
+ color: colors.text
683
+ }], children: label }) });
684
+ }
685
+ function whenLabel(at, now) {
686
+ const d = new Date(at);
687
+ const time = d.toLocaleTimeString(void 0, {
688
+ hour: "numeric",
689
+ minute: "2-digit"
690
+ });
691
+ const startOf = (x) => new Date(x.getFullYear(), x.getMonth(), x.getDate()).getTime();
692
+ const days = Math.round((startOf(new Date(now)) - startOf(d)) / 864e5);
693
+ if (days === 0) return `Today, ${time}`;
694
+ if (days === 1) return `Yesterday, ${time}`;
695
+ return d.toLocaleDateString(void 0, {
696
+ month: "short",
697
+ day: "numeric"
698
+ });
699
+ }
700
+ function clockOf(seconds) {
701
+ const m = Math.floor(seconds / 60);
702
+ const s = seconds % 60;
703
+ return `${m}:${String(s).padStart(2, "0")}`;
704
+ }
705
+ const styles = StyleSheet.create({
706
+ safe: {
707
+ flex: 1
708
+ },
709
+ header: {
710
+ flexDirection: "row",
711
+ alignItems: "center",
712
+ paddingHorizontal: 16,
713
+ paddingBottom: 8,
714
+ minHeight: 52
715
+ },
716
+ backCircle: __spreadValues({
717
+ width: 40,
718
+ height: 40,
719
+ borderRadius: 20,
720
+ alignItems: "center",
721
+ justifyContent: "center"
722
+ }, mobileTokens.shadow.card),
723
+ headerTitle: {
724
+ flex: 1,
725
+ textAlign: "center",
726
+ fontSize: 17,
727
+ fontWeight: "600",
728
+ marginHorizontal: 8
729
+ },
730
+ headerSpacer: {
731
+ width: 40,
732
+ height: 40
733
+ },
734
+ pressed: {
735
+ opacity: 0.72
736
+ },
737
+ loading: {
738
+ marginTop: 48
739
+ },
740
+ scroll: {
741
+ paddingHorizontal: 16,
742
+ paddingBottom: 40
743
+ },
744
+ hero: {
745
+ alignItems: "center",
746
+ paddingTop: 8,
747
+ paddingBottom: 16,
748
+ gap: 10
749
+ },
750
+ heroIcon: {
751
+ width: 64,
752
+ height: 64,
753
+ borderRadius: 32,
754
+ alignItems: "center",
755
+ justifyContent: "center"
756
+ },
757
+ heroTitle: {
758
+ fontSize: 20,
759
+ fontWeight: "700",
760
+ textAlign: "center"
761
+ },
762
+ heroBody: {
763
+ fontSize: 15,
764
+ lineHeight: 21,
765
+ textAlign: "center",
766
+ paddingHorizontal: 8
767
+ },
768
+ card: {
769
+ borderRadius: 16,
770
+ overflow: "hidden"
771
+ },
772
+ secondaryCard: {
773
+ marginTop: 20
774
+ },
775
+ sectionTitle: {
776
+ fontSize: 13,
777
+ fontWeight: "600",
778
+ letterSpacing: 0.4,
779
+ marginTop: 24,
780
+ marginBottom: 8,
781
+ marginLeft: 16
782
+ },
783
+ row: {
784
+ flexDirection: "row",
785
+ alignItems: "center",
786
+ minHeight: 52,
787
+ paddingHorizontal: 16,
788
+ gap: 12
789
+ },
790
+ rowLabelWide: {
791
+ flex: 1,
792
+ fontSize: 16
793
+ },
794
+ rowLine: {
795
+ height: StyleSheet.hairlineWidth,
796
+ marginLeft: 16
797
+ },
798
+ deviceRow: {
799
+ flexDirection: "row",
800
+ alignItems: "center",
801
+ minHeight: 64,
802
+ paddingHorizontal: 16,
803
+ gap: 12
804
+ },
805
+ deviceText: {
806
+ flex: 1,
807
+ minWidth: 0
808
+ },
809
+ deviceName: {
810
+ fontSize: 16,
811
+ fontWeight: "600"
812
+ },
813
+ deviceMeta: {
814
+ fontSize: 14,
815
+ marginTop: 2
816
+ },
817
+ kindIcon: {
818
+ alignItems: "center",
819
+ justifyContent: "center"
820
+ },
821
+ question: {
822
+ fontSize: 22,
823
+ fontWeight: "700",
824
+ textAlign: "center",
825
+ marginTop: 8,
826
+ marginBottom: 20,
827
+ lineHeight: 28
828
+ },
829
+ kindList: {
830
+ gap: 10
831
+ },
832
+ kindCard: {
833
+ flexDirection: "row",
834
+ alignItems: "center",
835
+ borderRadius: 16,
836
+ padding: 14,
837
+ gap: 14
838
+ },
839
+ kindTitle: {
840
+ fontSize: 16,
841
+ fontWeight: "600"
842
+ },
843
+ center: {
844
+ alignItems: "center",
845
+ paddingTop: 24,
846
+ gap: 12
847
+ },
848
+ statusTitle: {
849
+ fontSize: 19,
850
+ fontWeight: "700",
851
+ textAlign: "center",
852
+ marginTop: 4
853
+ },
854
+ statusBody: {
855
+ fontSize: 15,
856
+ lineHeight: 21,
857
+ textAlign: "center",
858
+ paddingHorizontal: 8
859
+ },
860
+ guidance: {
861
+ marginTop: 16,
862
+ paddingVertical: 8
863
+ },
864
+ guidanceRow: {
865
+ flexDirection: "row",
866
+ alignItems: "flex-start",
867
+ paddingHorizontal: 16,
868
+ paddingVertical: 8,
869
+ gap: 12
870
+ },
871
+ stepDot: {
872
+ width: 24,
873
+ height: 24,
874
+ borderRadius: 12,
875
+ alignItems: "center",
876
+ justifyContent: "center",
877
+ marginTop: 1
878
+ },
879
+ stepNumber: {
880
+ fontSize: 13,
881
+ fontWeight: "700"
882
+ },
883
+ guidanceText: {
884
+ flex: 1,
885
+ fontSize: 15,
886
+ lineHeight: 22
887
+ },
888
+ pulseBox: {
889
+ alignSelf: "center",
890
+ width: 120,
891
+ height: 120,
892
+ alignItems: "center",
893
+ justifyContent: "center",
894
+ marginTop: 16
895
+ },
896
+ pulseRing: {
897
+ position: "absolute",
898
+ width: 64,
899
+ height: 64,
900
+ borderRadius: 32
901
+ },
902
+ pulseCore: {
903
+ width: 64,
904
+ height: 64,
905
+ borderRadius: 32,
906
+ alignItems: "center",
907
+ justifyContent: "center"
908
+ },
909
+ signal: {
910
+ flexDirection: "row",
911
+ alignItems: "flex-end",
912
+ gap: 2,
913
+ height: 16
914
+ },
915
+ signalBar: {
916
+ width: 4,
917
+ borderRadius: 1
918
+ },
919
+ livePanel: {
920
+ alignItems: "center",
921
+ padding: 20,
922
+ marginTop: 16,
923
+ gap: 12
924
+ },
925
+ liveValue: {
926
+ fontSize: 56,
927
+ fontWeight: "700",
928
+ fontVariant: ["tabular-nums"]
929
+ },
930
+ liveUnit: {
931
+ fontSize: 18,
932
+ fontWeight: "500"
933
+ },
934
+ liveMeta: {
935
+ fontSize: 15,
936
+ fontVariant: ["tabular-nums"]
937
+ },
938
+ chips: {
939
+ flexDirection: "row",
940
+ flexWrap: "wrap",
941
+ justifyContent: "center",
942
+ gap: 8
943
+ },
944
+ chip: {
945
+ borderWidth: 1,
946
+ borderRadius: 999,
947
+ paddingHorizontal: 14,
948
+ paddingVertical: 8
949
+ },
950
+ chipLabel: {
951
+ fontSize: 14,
952
+ fontWeight: "600"
953
+ },
954
+ readingRow: {
955
+ paddingHorizontal: 16,
956
+ paddingVertical: 12,
957
+ gap: 2
958
+ },
959
+ readingValue: {
960
+ fontSize: 16,
961
+ fontWeight: "600"
962
+ },
963
+ readingWhen: {
964
+ fontSize: 14
965
+ },
966
+ readingNote: {
967
+ fontSize: 14,
968
+ marginTop: 2
969
+ },
970
+ savedLine: {
971
+ flexDirection: "row",
972
+ alignItems: "center",
973
+ gap: 8,
974
+ marginTop: 12,
975
+ marginHorizontal: 4
976
+ },
977
+ savedBlock: {
978
+ marginTop: 12,
979
+ gap: 10
980
+ },
981
+ savedText: {
982
+ flex: 1,
983
+ fontSize: 14,
984
+ lineHeight: 20
985
+ },
986
+ notice: {
987
+ flexDirection: "row",
988
+ borderRadius: 14,
989
+ padding: 12,
990
+ marginTop: 12,
991
+ gap: 8
992
+ },
993
+ noticeIcon: {
994
+ marginTop: 1
995
+ },
996
+ noticeText: {
997
+ flex: 1,
998
+ fontSize: 14,
999
+ lineHeight: 20
1000
+ },
1001
+ actions: {
1002
+ marginTop: 20,
1003
+ gap: 10,
1004
+ alignItems: "stretch"
1005
+ },
1006
+ actionHint: {
1007
+ fontSize: 15,
1008
+ lineHeight: 21,
1009
+ textAlign: "center"
1010
+ },
1011
+ primary: {
1012
+ backgroundColor: mobileTokens.color.primary,
1013
+ borderRadius: 14,
1014
+ minHeight: 50,
1015
+ alignItems: "center",
1016
+ justifyContent: "center",
1017
+ paddingHorizontal: 18,
1018
+ alignSelf: "stretch"
1019
+ },
1020
+ primaryLabel: {
1021
+ color: "#fff",
1022
+ fontSize: 16,
1023
+ fontWeight: "600"
1024
+ },
1025
+ secondary: {
1026
+ borderRadius: 14,
1027
+ minHeight: 48,
1028
+ alignItems: "center",
1029
+ justifyContent: "center",
1030
+ borderWidth: 1,
1031
+ paddingHorizontal: 18
1032
+ },
1033
+ secondaryLabel: {
1034
+ fontSize: 16,
1035
+ fontWeight: "600"
1036
+ },
1037
+ footnote: {
1038
+ fontSize: 13,
1039
+ lineHeight: 18,
1040
+ marginTop: 16,
1041
+ marginHorizontal: 16
1042
+ },
1043
+ linkRow: {
1044
+ flexDirection: "row",
1045
+ alignItems: "center",
1046
+ gap: 4,
1047
+ marginTop: 10,
1048
+ marginHorizontal: 16,
1049
+ alignSelf: "flex-start"
1050
+ },
1051
+ link: {
1052
+ fontSize: 14,
1053
+ fontWeight: "600"
1054
+ }
1055
+ });export{DevicesScreen as default};//# sourceMappingURL=index.js.map