@everfur/sdk 0.1.0 → 0.3.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 (187) hide show
  1. package/CHANGELOG.md +648 -1
  2. package/README.md +58 -23
  3. package/consent/package.json +8 -0
  4. package/dist/Chat-DPUD6dnc.d.cts +128 -0
  5. package/dist/Chat-DwAC2vhB.d.ts +128 -0
  6. package/dist/DepthViews-DNEM96Se.d.ts +16 -0
  7. package/dist/DepthViews-DP0R-DhB.d.cts +19 -0
  8. package/dist/DepthViews-D_3hl4xk.d.ts +19 -0
  9. package/dist/DepthViews-DbFhR4Du.d.cts +16 -0
  10. package/dist/ErrorPolicyPort-CNf4uQZP.d.cts +22 -0
  11. package/dist/ErrorPolicyPort-CwbfmxzJ.d.ts +22 -0
  12. package/dist/{EverfurResult-D92-uL82.d.cts → EverfurResult-DN9pL2Ab.d.cts} +11 -10
  13. package/dist/{EverfurResult-D92-uL82.d.ts → EverfurResult-DN9pL2Ab.d.ts} +11 -10
  14. package/dist/{PhotoController-BItt5M7u.d.cts → PhotoController-3l7MT9jA.d.cts} +1 -1
  15. package/dist/{PhotoController-D8zMTdcW.d.ts → PhotoController-vzY5bfY_.d.ts} +1 -1
  16. package/dist/animations/index.cjs +1 -1997
  17. package/dist/animations/index.d.cts +35 -35
  18. package/dist/animations/index.d.ts +35 -35
  19. package/dist/animations/index.js +1 -1972
  20. package/dist/attachments-5NeobOCd.d.ts +256 -0
  21. package/dist/attachments-Bw3iMQgu.d.ts +146 -0
  22. package/dist/attachments-CQgFrEQ7.d.cts +146 -0
  23. package/dist/attachments-D8T5re7e.d.cts +256 -0
  24. package/dist/casesRepository-ClLv6qMl.d.ts +188 -0
  25. package/dist/casesRepository-DHwtGRYY.d.cts +188 -0
  26. package/dist/chat/index.cjs +1 -1170
  27. package/dist/chat/index.d.cts +31 -53
  28. package/dist/chat/index.d.ts +31 -53
  29. package/dist/chat/index.js +1 -1167
  30. package/dist/client/index.cjs +9 -2315
  31. package/dist/client/index.d.cts +77 -15
  32. package/dist/client/index.d.ts +77 -15
  33. package/dist/client/index.js +9 -2215
  34. package/dist/{config-CiJ0PVBB.d.ts → config-CzTZGlfF.d.cts} +63 -25
  35. package/dist/{config-BSjBdxrZ.d.cts → config-DW60uRb9.d.ts} +63 -25
  36. package/dist/consent/index.cjs +1 -0
  37. package/dist/consent/index.d.cts +33 -0
  38. package/dist/consent/index.d.ts +33 -0
  39. package/dist/consent/index.js +1 -0
  40. package/dist/context-DXhqHlPU.d.ts +159 -0
  41. package/dist/context-XvTzq1tE.d.cts +159 -0
  42. package/dist/copy-Mjoo91aS.d.ts +198 -0
  43. package/dist/copy-bKDNigLb.d.cts +198 -0
  44. package/dist/core/index.cjs +13 -3175
  45. package/dist/core/index.d.cts +58 -12
  46. package/dist/core/index.d.ts +58 -12
  47. package/dist/core/index.js +13 -3163
  48. package/dist/depth-CErXCU8J.d.cts +502 -0
  49. package/dist/depth-DjDcJ6kH.d.ts +502 -0
  50. package/dist/entitlementRepository-DKdXFgTo.d.cts +698 -0
  51. package/dist/entitlementRepository-DSbzuyAW.d.ts +698 -0
  52. package/dist/{identity-DK9zORrG.d.ts → identity-BMx2SUOM.d.ts} +19 -6
  53. package/dist/{identity-Brl-lDd6.d.cts → identity-DI4eVx9S.d.cts} +19 -6
  54. package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
  55. package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
  56. package/dist/index.cjs +12 -4488
  57. package/dist/index.d.cts +29 -121
  58. package/dist/index.d.ts +29 -121
  59. package/dist/index.js +12 -4464
  60. package/dist/models-B-Uh2LTf.d.ts +214 -0
  61. package/dist/models-D2EUxPZY.d.cts +214 -0
  62. package/dist/notifications/index.cjs +2 -0
  63. package/dist/notifications/index.d.cts +17 -0
  64. package/dist/notifications/index.d.ts +17 -0
  65. package/dist/notifications/index.js +2 -0
  66. package/dist/pets-CtQdRpWo.d.ts +92 -0
  67. package/dist/pets-aB8q0JyX.d.cts +92 -0
  68. package/dist/photo/index.cjs +1 -2189
  69. package/dist/photo/index.d.cts +6 -6
  70. package/dist/photo/index.d.ts +6 -6
  71. package/dist/photo/index.js +1 -2186
  72. package/dist/ports-BN6RHF9W.d.cts +48 -0
  73. package/dist/ports-BN6RHF9W.d.ts +48 -0
  74. package/dist/ports-DEBzEhbp.d.cts +386 -0
  75. package/dist/ports-DMolTRzU.d.ts +386 -0
  76. package/dist/profile-CSs1wlXT.d.cts +93 -0
  77. package/dist/profile-CSs1wlXT.d.ts +93 -0
  78. package/dist/records/depth/index.cjs +2 -0
  79. package/dist/records/depth/index.d.cts +13 -0
  80. package/dist/records/depth/index.d.ts +13 -0
  81. package/dist/records/depth/index.js +2 -0
  82. package/dist/records/index.cjs +3 -2839
  83. package/dist/records/index.d.cts +137 -203
  84. package/dist/records/index.d.ts +137 -203
  85. package/dist/records/index.js +3 -2833
  86. package/dist/requestFunnel-CjW7uDuA.d.ts +87 -0
  87. package/dist/requestFunnel-L-BQfi0z.d.cts +87 -0
  88. package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
  89. package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
  90. package/dist/{runtime-BgQnA594.d.cts → runtime-B8s-_hv8.d.cts} +134 -59
  91. package/dist/{runtime-CBA-LvdM.d.ts → runtime-BR9ysG0J.d.ts} +134 -59
  92. package/dist/server/events/index.cjs +2 -0
  93. package/dist/server/events/index.d.cts +550 -0
  94. package/dist/server/events/index.d.ts +550 -0
  95. package/dist/server/events/index.js +2 -0
  96. package/dist/server/index.cjs +2 -533
  97. package/dist/server/index.d.cts +73 -18
  98. package/dist/server/index.d.ts +73 -18
  99. package/dist/server/index.js +2 -530
  100. package/dist/species-BXAIMh7I.d.cts +9 -0
  101. package/dist/species-BXAIMh7I.d.ts +9 -0
  102. package/dist/televet/index.cjs +1 -0
  103. package/dist/televet/index.d.cts +60 -0
  104. package/dist/televet/index.d.ts +60 -0
  105. package/dist/televet/index.js +1 -0
  106. package/dist/testing/index.cjs +5 -823
  107. package/dist/testing/index.d.cts +17 -3
  108. package/dist/testing/index.d.ts +17 -3
  109. package/dist/testing/index.js +5 -820
  110. package/dist/testing/rn/index.cjs +1 -449
  111. package/dist/testing/rn/index.d.cts +17 -29
  112. package/dist/testing/rn/index.d.ts +17 -29
  113. package/dist/testing/rn/index.js +1 -444
  114. package/dist/testing/web/index.cjs +1 -0
  115. package/dist/testing/web/index.d.cts +131 -0
  116. package/dist/testing/web/index.d.ts +131 -0
  117. package/dist/testing/web/index.js +1 -0
  118. package/dist/timelineRows-CaohZzXS.d.cts +19 -0
  119. package/dist/timelineRows-DZed6dAM.d.ts +19 -0
  120. package/dist/typeStyle-0TydiZ1w.d.cts +19 -0
  121. package/dist/typeStyle-CWMsoe6b.d.ts +19 -0
  122. package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
  123. package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
  124. package/dist/useRecordsDepth-BHBzJ76R.d.cts +237 -0
  125. package/dist/useRecordsDepth-BU-OhzH6.d.ts +237 -0
  126. package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
  127. package/dist/useVetVisit-CjmMa896.d.ts +187 -0
  128. package/dist/video/index.cjs +1 -1941
  129. package/dist/video/index.d.cts +4 -4
  130. package/dist/video/index.d.ts +4 -4
  131. package/dist/video/index.js +1 -1938
  132. package/dist/view-C3qPIXGX.d.cts +310 -0
  133. package/dist/view-DtSPYpKa.d.ts +310 -0
  134. package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
  135. package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
  136. package/dist/web/consent/index.cjs +1 -0
  137. package/dist/web/consent/index.d.cts +34 -0
  138. package/dist/web/consent/index.d.ts +34 -0
  139. package/dist/web/consent/index.js +1 -0
  140. package/dist/web/index.cjs +14 -0
  141. package/dist/web/index.d.cts +217 -0
  142. package/dist/web/index.d.ts +217 -0
  143. package/dist/web/index.js +14 -0
  144. package/dist/web/notifications/index.cjs +2 -0
  145. package/dist/web/notifications/index.d.cts +213 -0
  146. package/dist/web/notifications/index.d.ts +213 -0
  147. package/dist/web/notifications/index.js +2 -0
  148. package/dist/web/records/depth/index.cjs +2 -0
  149. package/dist/web/records/depth/index.d.cts +12 -0
  150. package/dist/web/records/depth/index.d.ts +12 -0
  151. package/dist/web/records/depth/index.js +2 -0
  152. package/dist/web/records/index.cjs +4 -0
  153. package/dist/web/records/index.d.cts +194 -0
  154. package/dist/web/records/index.d.ts +194 -0
  155. package/dist/web/records/index.js +4 -0
  156. package/dist/web/televet/index.cjs +1 -0
  157. package/dist/web/televet/index.d.cts +50 -0
  158. package/dist/web/televet/index.d.ts +50 -0
  159. package/dist/web/televet/index.js +1 -0
  160. package/notifications/package.json +8 -0
  161. package/package.json +197 -9
  162. package/records/depth/package.json +8 -0
  163. package/server/events/device-blocked.cjs +15 -0
  164. package/server/events/package.json +9 -0
  165. package/televet/package.json +8 -0
  166. package/testing/web/native-blocked.cjs +12 -0
  167. package/testing/web/package.json +8 -0
  168. package/web/consent/native-blocked.cjs +12 -0
  169. package/web/consent/package.json +8 -0
  170. package/web/native-blocked.cjs +12 -0
  171. package/web/notifications/native-blocked.cjs +12 -0
  172. package/web/notifications/package.json +8 -0
  173. package/web/package.json +8 -0
  174. package/web/records/depth/native-blocked.cjs +12 -0
  175. package/web/records/depth/package.json +8 -0
  176. package/web/records/native-blocked.cjs +12 -0
  177. package/web/records/package.json +8 -0
  178. package/web/televet/native-blocked.cjs +12 -0
  179. package/web/televet/package.json +8 -0
  180. package/dist/ChatController-CKdBvPj2.d.ts +0 -146
  181. package/dist/ChatController-CpUMvvZf.d.cts +0 -146
  182. package/dist/FilePort-BabWrv7I.d.cts +0 -22
  183. package/dist/FilePort-BabWrv7I.d.ts +0 -22
  184. package/dist/petsRepository-BEGb97M9.d.cts +0 -326
  185. package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
  186. package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
  187. package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
@@ -1,17 +1,22 @@
1
- import { h as EntitlementSnapshot } from '../../runtime-CBA-LvdM.js';
2
- export { C as ClientBranding } from '../../petsRepository-Bu18r2kK.js';
3
- export { a as CapabilityDisabled, c as DisabledLevel, E as EntitlementDecision } from '../../resolve-Dq_4_agU.js';
1
+ export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../../EverfurResult-DN9pL2Ab.js';
2
+ export { B as Brand, P as PetRef, R as RecordsRequestId, _ as __brand } from '../../ids-B2GAAifq.js';
3
+ export { E as EntitlementSnapshot } from '../../runtime-BR9ysG0J.js';
4
+ export { C as ClientBranding, R as RadiusScale, S as SurfaceStyle } from '../../entitlementRepository-DSbzuyAW.js';
5
+ export { b as CapabilityDisabled, D as DisabledLevel, E as EntitlementDecision } from '../../resolve-D4Ywz5OS.js';
6
+ export { c as RecordsRequestStatus, d as RecordsRequestView, e as RecordsSimpleStatus } from '../../models-B-Uh2LTf.js';
4
7
  import { ReactNode } from 'react';
5
- import { R as RiskTier } from '../../PhotoController-D8zMTdcW.js';
6
- import '../../EverfurResult-D92-uL82.js';
7
- import '../../identity-DK9zORrG.js';
8
- import '../../ids-CJ1S6adf.js';
9
- import '../../config-CiJ0PVBB.js';
8
+ import { R as RiskTier } from '../../PhotoController-vzY5bfY_.js';
9
+ export { EverfurTestEntitlements, RecordsSandboxActionResult, RecordsSandboxClinicReply, RecordsSandboxController, RecordsSandboxResult, VetVisitSandboxActionResult, VetVisitSandboxController, VetVisitSandboxEvent, VetVisitSandboxReminderStage, VetVisitSandboxResult, VetVisitSandboxStatus, VetVisitSandboxVisit, useEverfurRecordsSandbox, useEverfurTestEntitlements, useEverfurVetVisitSandbox } from '../web/index.js';
10
+ import '../../config-DW60uRb9.js';
11
+ import '../../casesRepository-ClLv6qMl.js';
12
+ import '../../identity-BMx2SUOM.js';
13
+ import '../../profile-CSs1wlXT.js';
10
14
  import '../../cacheEpoch-DknKn3S0.js';
11
15
  import '../../TelemetryPort-BDNr00hu.js';
12
- import '../../ChatController-CKdBvPj2.js';
13
- import '../../requestFunnel-dio5OmR9.js';
14
- import '../../FilePort-BabWrv7I.js';
16
+ import '../../ports-DMolTRzU.js';
17
+ import '../../requestFunnel-CjW7uDuA.js';
18
+ import '../../ErrorPolicyPort-CwbfmxzJ.js';
19
+ import '../../ports-BN6RHF9W.js';
15
20
  import '../../CameraPort-Cv31Pz7g.js';
16
21
  import '../../projection-CeIUsbSk.js';
17
22
 
@@ -29,21 +34,4 @@ declare function SeverityBadge({ riskTier }: {
29
34
  readonly riskTier: RiskTier | null;
30
35
  }): ReactNode;
31
36
 
32
- /** The testing seam handle: apply a resolved verdict to THIS provider's runtime. */
33
- interface EverfurTestEntitlements {
34
- /**
35
- * Replace the entitlement verdict the current <EverfurProvider>'s runtime renders. Drives the SDK's own
36
- * `useCapability` / `CapabilityGate` across every subpath (they read this one store), so a test/demo can
37
- * flip a capability on or off and watch the real gates react. Render-only: the server stays authoritative.
38
- */
39
- apply(snapshot: EntitlementSnapshot): void;
40
- }
41
- /**
42
- * TEST / DEMO ONLY. Obtain a handle to push a simulated server entitlement verdict into the enclosing
43
- * <EverfurProvider>'s runtime. Must be called inside an <EverfurProvider>.
44
- *
45
- * @throws {EverfurConfigError} kind 'not-initialized' when called outside an <EverfurProvider>.
46
- */
47
- declare function useEverfurTestEntitlements(): EverfurTestEntitlements;
48
-
49
- export { AnalyzingIndicator, EntitlementSnapshot, type EverfurTestEntitlements, RiskTier, SeverityBadge, TypingIndicator, useEverfurTestEntitlements };
37
+ export { AnalyzingIndicator, RiskTier, SeverityBadge, TypingIndicator };
@@ -1,444 +1 @@
1
- import { createContext, useMemo, useRef, useEffect, useState, useContext } from 'react';
2
- import 'react-native-safe-area-context';
3
- import { View, Animated, StyleSheet, Easing, Text } from 'react-native';
4
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
-
6
- // src/rn/testing.ts
7
-
8
- // src/client/errors/EverfurResult.ts
9
- var EverfurConfigError = class _EverfurConfigError extends Error {
10
- constructor(kind, message) {
11
- super(message);
12
- this.name = "EverfurConfigError";
13
- this.kind = kind;
14
- Object.setPrototypeOf(this, _EverfurConfigError.prototype);
15
- }
16
- };
17
-
18
- // src/client/theme/tokens.ts
19
- function deepFreeze(value) {
20
- if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
21
- Object.freeze(value);
22
- for (const key of Object.keys(value)) {
23
- deepFreeze(value[key]);
24
- }
25
- }
26
- return value;
27
- }
28
- var SPACE = { xs: 4, sm: 8, md: 12, lg: 16, xl: 24, xxl: 32 };
29
- var RADIUS = { tile: 5, xs: 6, sm: 10, md: 14, lg: 20, xl: 28, pill: 500 };
30
- var TYPE_SIZE = {
31
- nano: 8,
32
- small: 9,
33
- micro: 10,
34
- tiny: 11,
35
- caption: 12,
36
- bodyTight: 13,
37
- body: 14,
38
- subtitle: 16,
39
- heading: 18,
40
- verdict: 24
41
- };
42
- var LINE_HEIGHT = { tight: 1.15, snug: 1.3, normal: 1.4, relaxed: 1.55 };
43
- var WEIGHT = { regular: "400", medium: "500", bold: "700" };
44
- var LETTER_SPACING = {
45
- eyebrow: 1,
46
- monoWide: 0.9,
47
- headerBrand: -0.42,
48
- tight: -0.35
49
- };
50
- function baseType() {
51
- return {
52
- family: "System",
53
- mono: "monospace",
54
- fontUrl: null,
55
- size: TYPE_SIZE,
56
- lineHeight: LINE_HEIGHT,
57
- weight: WEIGHT,
58
- letterSpacing: LETTER_SPACING
59
- };
60
- }
61
- var MOTION = {
62
- duration: { instant: 80, fast: 140, normal: 220, slow: 320 },
63
- spring: { gentle: { damping: 18, stiffness: 200 } },
64
- easing: { standard: "cubic-bezier(0.4, 0, 0.2, 1)" },
65
- reducedMotion: false
66
- };
67
- var LIGHT_COLOR = {
68
- brand: "#10462E",
69
- brandSoft: "rgba(16,70,46,0.10)",
70
- brandSofter: "rgba(16,70,46,0.15)",
71
- brandBorder: "rgba(16,70,46,0.18)",
72
- borderHairlineGreen: "rgba(16,70,46,0.25)",
73
- surface: "#FFFFFF",
74
- surfaceCream: "#FDFBF8",
75
- surfaceSubtle: "#EFE9E3",
76
- background: "#FFFFFF",
77
- borderRingCream: "#D8D2C8",
78
- text: {
79
- primary: "#111111",
80
- secondary: "#0E462E",
81
- muted: "#6E6660",
82
- placeholder: "rgba(0,0,0,0.30)",
83
- onBrand: "#FFFFFF",
84
- metaCool: "#3D3D3D"
85
- },
86
- primary: "#10462E",
87
- onPrimary: "#FFFFFF",
88
- accent: "#10462E",
89
- onAccent: "#FFFFFF",
90
- accentEdge: "#07C168",
91
- success: "#07C168",
92
- danger: "#B91C1C",
93
- errorRed: "#FF1B00",
94
- warningStrong: "#A45610",
95
- cautionAccent: "#D9821D",
96
- riskConcern: "#EFA700",
97
- badgeBgPositive: "rgba(7,193,104,0.12)",
98
- badgeBgCaution: "rgba(217,130,29,0.14)",
99
- badgeBgCritical: "rgba(185,28,28,0.12)",
100
- badgeBgNeutral: "rgba(110,102,96,0.12)",
101
- bubbleUser: "#10462E",
102
- bubbleAssistant: "#FFFFFF",
103
- skeleton: "#EFE9E3",
104
- scanButtonPink: "#FFC3BC",
105
- checkupCardLowRiskBg: "rgba(7,193,104,0.10)",
106
- checkupCardConcernBg: "rgba(239,167,0,0.10)"
107
- };
108
- var EVERFUR_LIGHT = deepFreeze({
109
- brightness: "light",
110
- meta: { displayName: "Everfur", logoUrl: null, placeholder: null, hidePoweredBy: false },
111
- color: LIGHT_COLOR,
112
- space: SPACE,
113
- radius: RADIUS,
114
- type: baseType(),
115
- motion: MOTION
116
- });
117
- var DARK_COLOR = {
118
- brand: "#6BD39A",
119
- brandSoft: "rgba(107,211,154,0.12)",
120
- brandSofter: "rgba(107,211,154,0.18)",
121
- brandBorder: "rgba(107,211,154,0.22)",
122
- borderHairlineGreen: "rgba(107,211,154,0.28)",
123
- surface: "#1C1F23",
124
- surfaceCream: "#23272C",
125
- surfaceSubtle: "#23272C",
126
- background: "#15171A",
127
- borderRingCream: "#3A3F45",
128
- text: {
129
- primary: "#F5F3F0",
130
- secondary: "#A9E4C4",
131
- muted: "#9A938C",
132
- placeholder: "rgba(255,255,255,0.35)",
133
- onBrand: "#0E1F17",
134
- metaCool: "#C9C9C9"
135
- },
136
- primary: "#6BD39A",
137
- onPrimary: "#0E1F17",
138
- accent: "#6BD39A",
139
- onAccent: "#0E1F17",
140
- accentEdge: "#34D888",
141
- success: "#07C168",
142
- danger: "#B91C1C",
143
- errorRed: "#FF1B00",
144
- warningStrong: "#A45610",
145
- cautionAccent: "#D9821D",
146
- riskConcern: "#EFA700",
147
- badgeBgPositive: "rgba(7,193,104,0.18)",
148
- badgeBgCaution: "rgba(217,130,29,0.20)",
149
- badgeBgCritical: "rgba(185,28,28,0.22)",
150
- badgeBgNeutral: "rgba(255,255,255,0.10)",
151
- bubbleUser: "#6BD39A",
152
- bubbleAssistant: "#1C1F23",
153
- skeleton: "#23272C",
154
- scanButtonPink: "#FFC3BC",
155
- checkupCardLowRiskBg: "rgba(7,193,104,0.16)",
156
- checkupCardConcernBg: "rgba(239,167,0,0.16)"
157
- };
158
- deepFreeze({
159
- brightness: "dark",
160
- meta: { displayName: "Everfur", logoUrl: null, placeholder: null, hidePoweredBy: false },
161
- color: DARK_COLOR,
162
- space: SPACE,
163
- radius: RADIUS,
164
- type: baseType(),
165
- motion: MOTION
166
- });
167
- var EVERFUR_THEME_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("@everfur/sdk#EverfurThemeContext@v1");
168
- var globalThemeHost = globalThis;
169
- var EverfurThemeContext = globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL] ?? (globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL] = createContext(EVERFUR_LIGHT));
170
- EverfurThemeContext.displayName ??= "EverfurThemeContext";
171
- function useEverfurTheme() {
172
- return useContext(EverfurThemeContext);
173
- }
174
-
175
- // src/rn/facade.ts
176
- var EVERFUR_CONTEXT_SYMBOL = /* @__PURE__ */ Symbol.for("@everfur/sdk#EverfurContext@v1");
177
- var globalContextHost = globalThis;
178
- var EverfurContext = globalContextHost[EVERFUR_CONTEXT_SYMBOL] ?? (globalContextHost[EVERFUR_CONTEXT_SYMBOL] = createContext(null));
179
- EverfurContext.displayName ??= "EverfurContext";
180
- function useEverfurContext() {
181
- const ctx = useContext(EverfurContext);
182
- if (ctx === null) {
183
- throw new EverfurConfigError(
184
- "not-initialized",
185
- "Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high."
186
- );
187
- }
188
- return ctx;
189
- }
190
- var DOT_SIZE = 6;
191
- var LOOP_MS = 520;
192
- var STAGGER_MS = Math.round(LOOP_MS * 0.18);
193
- var OPACITY_REST = 0.44;
194
- var OPACITY_STATIC = 0.5;
195
- var TRI_IN = [0, 0.5, 1];
196
- var DOT_INDICES = [0, 1, 2];
197
- function TypingIndicator() {
198
- const theme = useEverfurTheme();
199
- const styles = useMemo(() => makeStyles(theme), [theme]);
200
- const animate = !theme.motion.reducedMotion;
201
- return /* @__PURE__ */ jsx(
202
- View,
203
- {
204
- style: styles.card,
205
- accessible: true,
206
- accessibilityRole: "text",
207
- accessibilityLabel: "Assistant is typing",
208
- accessibilityLiveRegion: "polite",
209
- accessibilityState: { busy: true },
210
- children: DOT_INDICES.map(
211
- (index) => animate ? /* @__PURE__ */ jsx(AnimatedDot, { index, style: styles.dot }, index) : /* @__PURE__ */ jsx(View, { style: [styles.dot, styles.dotStatic] }, index)
212
- )
213
- }
214
- );
215
- }
216
- function AnimatedDot({ index, style }) {
217
- const t = useRef(new Animated.Value(0)).current;
218
- useEffect(() => {
219
- const anim = Animated.sequence([
220
- Animated.delay(index * STAGGER_MS),
221
- Animated.loop(Animated.timing(t, { toValue: 1, duration: LOOP_MS, useNativeDriver: true }))
222
- ]);
223
- anim.start();
224
- return () => anim.stop();
225
- }, [t, index]);
226
- const opacity = t.interpolate({ inputRange: TRI_IN, outputRange: [OPACITY_REST, 1, OPACITY_REST] });
227
- const translateY = t.interpolate({ inputRange: TRI_IN, outputRange: [0, -3.5, 0] });
228
- return /* @__PURE__ */ jsx(Animated.View, { style: [style, { opacity, transform: [{ translateY }] }] });
229
- }
230
- function makeStyles(theme) {
231
- const c = theme.color;
232
- const s = theme.space;
233
- const r = theme.radius;
234
- return StyleSheet.create({
235
- card: {
236
- alignSelf: "flex-start",
237
- flexDirection: "row",
238
- alignItems: "center",
239
- gap: s.xs,
240
- paddingHorizontal: s.md,
241
- paddingVertical: s.sm,
242
- backgroundColor: c.surfaceCream,
243
- borderRadius: r.md,
244
- borderWidth: StyleSheet.hairlineWidth,
245
- borderColor: c.brandBorder
246
- },
247
- dot: { width: DOT_SIZE, height: DOT_SIZE, borderRadius: r.pill, backgroundColor: c.brand },
248
- dotStatic: { opacity: OPACITY_STATIC }
249
- });
250
- }
251
- var ROTATION_PERIOD_MS = 1400;
252
- var REVEAL_DELAY_MS = 300;
253
- function AnalyzingIndicator() {
254
- const theme = useEverfurTheme();
255
- const styles = useMemo(() => makeStyles2(theme), [theme]);
256
- const reduced = theme.motion.reducedMotion;
257
- const [visible, setVisible] = useState(false);
258
- useEffect(() => {
259
- const id = setTimeout(() => setVisible(true), REVEAL_DELAY_MS);
260
- return () => clearTimeout(id);
261
- }, []);
262
- const spin = useRef(new Animated.Value(0)).current;
263
- useEffect(() => {
264
- if (reduced || !visible) return;
265
- const loop = Animated.loop(
266
- Animated.timing(spin, {
267
- toValue: 1,
268
- duration: ROTATION_PERIOD_MS,
269
- easing: Easing.linear,
270
- useNativeDriver: true
271
- })
272
- );
273
- loop.start();
274
- return () => loop.stop();
275
- }, [reduced, visible, spin]);
276
- const arcMotionStyle = reduced ? null : { transform: [{ rotate: spin.interpolate({ inputRange: [0, 1], outputRange: ["0deg", "360deg"] }) }] };
277
- return /* @__PURE__ */ jsx(
278
- View,
279
- {
280
- style: styles.wrap,
281
- accessible: true,
282
- accessibilityState: { busy: true },
283
- accessibilityLabel: "Analyzing photo",
284
- children: visible ? /* @__PURE__ */ jsxs(Fragment, { children: [
285
- /* @__PURE__ */ jsx(Animated.View, { style: [styles.ring, arcMotionStyle] }),
286
- /* @__PURE__ */ jsx(Text, { style: styles.statusLine, children: "Analyzing" })
287
- ] }) : null
288
- }
289
- );
290
- }
291
- function makeStyles2(theme) {
292
- const { color, space, radius, type } = theme;
293
- const medium = type.weight.medium;
294
- const ringSize = space.xxl * 2;
295
- const ringThickness = space.xs;
296
- return StyleSheet.create({
297
- wrap: {
298
- flexGrow: 1,
299
- alignItems: "center",
300
- justifyContent: "center",
301
- padding: space.xl,
302
- gap: space.md
303
- },
304
- // One rotating ring: success on the top/right, cream on the remainder. Only the success sweep is perceptible
305
- // (the cream half is uniform), so this reads as a cream ring with a rotating success arc - the mobile look.
306
- ring: {
307
- width: ringSize,
308
- height: ringSize,
309
- borderRadius: radius.pill,
310
- borderWidth: ringThickness,
311
- borderTopColor: color.success,
312
- borderRightColor: color.success,
313
- borderBottomColor: color.borderRingCream,
314
- borderLeftColor: color.borderRingCream
315
- },
316
- // Neutral SDK-owned structural status word (not clinical / product copy), on the brand-green secondary ramp
317
- // so it sits in the same family as the verdict hero. Legible in both themes via the token.
318
- statusLine: {
319
- color: color.text.secondary,
320
- fontFamily: type.family,
321
- fontSize: type.size.subtitle,
322
- lineHeight: type.size.subtitle * type.lineHeight.snug,
323
- fontWeight: medium,
324
- letterSpacing: type.letterSpacing.tight,
325
- textAlign: "center"
326
- }
327
- });
328
- }
329
- var PULSE_PERIOD_MS = 1100;
330
- var PULSE_MAX_SCALE = 1.6;
331
- var PULSE_START_OPACITY = 0.35;
332
- function toneSpec(theme, tier) {
333
- const { color } = theme;
334
- switch (tier) {
335
- case "low_risk":
336
- return { accent: color.success, wash: color.badgeBgPositive, label: "Low risk", pulse: false };
337
- case "concern":
338
- return { accent: color.cautionAccent, wash: color.badgeBgCaution, label: "Concern", pulse: true };
339
- case "uncertain":
340
- return { accent: color.text.muted, wash: color.badgeBgNeutral, label: "Uncertain", pulse: false };
341
- }
342
- }
343
- function SeverityBadge({ riskTier }) {
344
- const theme = useEverfurTheme();
345
- const styles = useMemo(() => makeStyles3(theme), [theme]);
346
- const pulse = useRef(new Animated.Value(0)).current;
347
- const spec = riskTier === null ? null : toneSpec(theme, riskTier);
348
- const shouldPulse = spec !== null && spec.pulse && !theme.motion.reducedMotion;
349
- useEffect(() => {
350
- if (!shouldPulse) return;
351
- const loop = Animated.loop(
352
- Animated.timing(pulse, {
353
- toValue: 1,
354
- duration: PULSE_PERIOD_MS,
355
- easing: Easing.out(Easing.quad),
356
- useNativeDriver: true
357
- })
358
- );
359
- loop.start();
360
- return () => loop.stop();
361
- }, [shouldPulse, pulse]);
362
- if (spec === null) return null;
363
- return /* @__PURE__ */ jsxs(
364
- View,
365
- {
366
- style: [styles.pill, { backgroundColor: spec.wash }],
367
- accessible: true,
368
- accessibilityRole: "text",
369
- accessibilityLabel: spec.label,
370
- children: [
371
- /* @__PURE__ */ jsxs(View, { style: styles.dotWrap, children: [
372
- shouldPulse ? /* @__PURE__ */ jsx(
373
- Animated.View,
374
- {
375
- pointerEvents: "none",
376
- style: [
377
- styles.dotRing,
378
- {
379
- backgroundColor: spec.accent,
380
- opacity: pulse.interpolate({ inputRange: [0, 1], outputRange: [PULSE_START_OPACITY, 0] }),
381
- transform: [{ scale: pulse.interpolate({ inputRange: [0, 1], outputRange: [1, PULSE_MAX_SCALE] }) }]
382
- }
383
- ]
384
- }
385
- ) : null,
386
- /* @__PURE__ */ jsx(View, { style: [styles.dot, { backgroundColor: spec.accent }] })
387
- ] }),
388
- /* @__PURE__ */ jsx(Text, { style: [styles.label, { color: spec.accent }], children: spec.label })
389
- ]
390
- }
391
- );
392
- }
393
- function makeStyles3(theme) {
394
- const { space, radius, type } = theme;
395
- const bold = type.weight.bold;
396
- const dotSize = space.sm;
397
- return StyleSheet.create({
398
- pill: {
399
- alignSelf: "flex-start",
400
- flexDirection: "row",
401
- alignItems: "center",
402
- gap: space.sm,
403
- paddingHorizontal: space.md,
404
- paddingVertical: space.xs,
405
- borderRadius: radius.pill
406
- },
407
- dotWrap: {
408
- width: dotSize,
409
- height: dotSize,
410
- alignItems: "center",
411
- justifyContent: "center"
412
- },
413
- dot: {
414
- width: dotSize,
415
- height: dotSize,
416
- borderRadius: radius.pill
417
- },
418
- // The pulsing attention ring behind the dot (concern only). backgroundColor + animated opacity/scale set inline.
419
- dotRing: {
420
- position: "absolute",
421
- width: dotSize,
422
- height: dotSize,
423
- borderRadius: radius.pill
424
- },
425
- label: {
426
- fontFamily: type.family,
427
- fontSize: type.size.caption,
428
- lineHeight: type.size.caption * type.lineHeight.snug,
429
- fontWeight: bold,
430
- letterSpacing: type.letterSpacing.eyebrow
431
- }
432
- });
433
- }
434
-
435
- // src/rn/testing.ts
436
- function useEverfurTestEntitlements() {
437
- const { runtime } = useEverfurContext();
438
- return useMemo(
439
- () => ({ apply: (snapshot) => runtime.updateEntitlements(snapshot) }),
440
- [runtime]
441
- );
442
- }
443
-
444
- export { AnalyzingIndicator, SeverityBadge, TypingIndicator, useEverfurTestEntitlements };
1
+ import {createContext,forwardRef,useMemo,useRef,useEffect,createElement,useState,useContext}from'react';import {View,Animated,StyleSheet,TextInput,Easing,Text}from'react-native';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {z as z$1}from'zod';var ot=Object.defineProperty;var o=(e,t)=>ot(e,"name",{value:t,configurable:true});var ie=Object.freeze({placeholder:"Message",send:"Send",stop:"Stop",retry:"Try again",followUps:"Follow up questions",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function G(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))G(e[t]);}return e}o(G,"deepFreeze");var at=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),le={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ue={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},se={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},it={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},st={regular:"400",medium:"500",bold:"700"},lt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},ut=0,k="System",F="monospace",dt=["content","heading","control","compact","badge"];function ct(e){let t={};for(let r of dt)t[r]=e;return t}o(ct,"authoredTierSizes");function de(){return {family:k,mono:F,fontUrl:null,families:{regular:k,medium:k,bold:k,mono:F,monoMedium:F,monoBold:F},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:se,tierSizes:ct(se),lineHeight:it,weight:st,letterSpacing:lt,scale:1,maxScale:ut,scaleCaps:at}}o(de,"baseType");var ce={},Y=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function W(e){return `cubic-bezier(${e.join(", ")})`}o(W,"cssCubicBezier");var pe={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:W(Y.standard),emphasized:W(Y.emphasized),exit:W(Y.exit)},reducedMotion:false},pt={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},fe=G({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:pt,space:le,radius:ue,type:de(),motion:pe,slots:ce}),ft={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};G({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ft,space:le,radius:ue,type:de(),motion:pe,slots:ce});var me=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),ye=globalThis,K=ye[me]??(ye[me]=createContext(fe));K.displayName??="EverfurThemeContext";function g(){return useContext(K)}o(g,"useEverfurTheme");var ve=6,_e=520,Et=Math.round(_e*.18),he=.44,_t=.5,Ee=[0,.5,1],Rt=[0,1,2];function St(){let e=g(),t=useMemo(()=>Ct(e),[e]),r=!e.motion.reducedMotion;return jsx(View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:ie.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:Rt.map(n=>r?jsx(wt,{index:n,style:t.dot},n):jsx(View,{style:[t.dot,t.dotStatic]},n))})}o(St,"TypingIndicator");function wt({index:e,style:t}){let r=useRef(new Animated.Value(0)).current;useEffect(()=>{let s=Animated.sequence([Animated.delay(e*Et),Animated.loop(Animated.timing(r,{toValue:1,duration:_e,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:Ee,outputRange:[he,1,he]}),i=r.interpolate({inputRange:Ee,outputRange:[0,-3.5,0]});return jsx(Animated.View,{style:[t,{opacity:n,transform:[{translateY:i}]}]})}o(wt,"AnimatedDot");function Ct(e){let t=e.color,r=e.space,n=e.radius;return StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:ve,height:ve,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:_t}})}o(Ct,"makeStyles");function Ft(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}o(Ft,"tierMultiplier");function A({tier:e="content",...t}){let{type:r}=g(),n=Ft(r,e);return createElement(Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}o(A,"Text");forwardRef(o(function(t,r){return createElement(TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var Dt=1400,Mt=300;function Lt(){let e=g(),t=useMemo(()=>Nt(e),[e]),r=e.motion.reducedMotion,[n,i]=useState(false);useEffect(()=>{let d=setTimeout(()=>i(true),Mt);return ()=>clearTimeout(d)},[]);let s=useRef(new Animated.Value(0)).current;useEffect(()=>{if(r||!n)return;let d=Animated.loop(Animated.timing(s,{toValue:1,duration:Dt,easing:Easing.linear,useNativeDriver:true}));return d.start(),()=>d.stop()},[r,n,s]);let l=r?null:{transform:[{rotate:s.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};return jsx(View,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:n?jsxs(Fragment,{children:[jsx(Animated.View,{style:[t.ring,l]}),jsx(A,{style:t.statusLine,children:"Analyzing"})]}):null})}o(Lt,"AnalyzingIndicator");function Nt(e){let{color:t,space:r,radius:n,type:i}=e,s=i.weight.medium,l=r.xxl*2,d=r.xs;return StyleSheet.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.md},ring:{width:l,height:l,borderRadius:n.pill,borderWidth:d,borderTopColor:t.success,borderRightColor:t.success,borderBottomColor:t.borderRingCream,borderLeftColor:t.borderRingCream},statusLine:{color:t.text.secondary,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.snug,fontWeight:s,letterSpacing:i.letterSpacing.tight,textAlign:"center"}})}o(Nt,"makeStyles");var Wt=1100,Gt=1.6,Kt=.35;function $t(e,t){let{color:r}=e;switch(t){case "low_risk":return {accent:r.success,wash:r.badgeBgPositive,label:"Low risk",pulse:false};case "concern":return {accent:r.cautionAccent,wash:r.badgeBgCaution,label:"Concern",pulse:true};case "uncertain":return {accent:r.text.muted,wash:r.badgeBgNeutral,label:"Uncertain",pulse:false}}}o($t,"toneSpec");function Qt({riskTier:e}){let t=g(),r=useMemo(()=>Xt(t),[t]),n=useRef(new Animated.Value(0)).current,i=e===null?null:$t(t,e),s=i!==null&&i.pulse&&!t.motion.reducedMotion;return useEffect(()=>{if(!s)return;let l=Animated.loop(Animated.timing(n,{toValue:1,duration:Wt,easing:Easing.out(Easing.quad),useNativeDriver:true}));return l.start(),()=>l.stop()},[s,n]),i===null?null:jsxs(View,{style:[r.pill,{backgroundColor:i.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:i.label,children:[jsxs(View,{style:r.dotWrap,children:[s?jsx(Animated.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:i.accent,opacity:n.interpolate({inputRange:[0,1],outputRange:[Kt,0]}),transform:[{scale:n.interpolate({inputRange:[0,1],outputRange:[1,Gt]})}]}]}):null,jsx(View,{style:[r.dot,{backgroundColor:i.accent}]})]}),jsx(A,{style:[r.label,{color:i.accent}],children:i.label})]})}o(Qt,"SeverityBadge");function Xt(e){let{space:t,radius:r,type:n}=e,i=n.weight.bold,s=t.sm;return StyleSheet.create({pill:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:t.sm,paddingHorizontal:t.md,paddingVertical:t.xs,borderRadius:r.pill},dotWrap:{width:s,height:s,alignItems:"center",justifyContent:"center"},dot:{width:s,height:s,borderRadius:r.pill},dotRing:{position:"absolute",width:s,height:s,borderRadius:r.pill},label:{fontFamily:n.family,fontSize:n.size.caption,lineHeight:n.size.caption*n.lineHeight.snug,fontWeight:i,letterSpacing:n.letterSpacing.eyebrow}})}o(Xt,"makeStyles");function j(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(j,"ok");function u(e){return Object.freeze({ok:false,error:e})}o(u,"err");var z=class z extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,z.prototype);}};o(z,"EverfurConfigError");var S=z;var Te=Symbol.for("@everfur/sdk#EverfurContext@v1"),xe=globalThis,ke=xe[Te]??(xe[Te]=createContext(null));ke.displayName??="EverfurContext";function E(){let e=useContext(ke);if(e===null)throw new S("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(E,"useEverfurContext");function tr(){let{runtime:e}=E();return useMemo(()=>({apply:o(t=>e.updateEntitlements(t),"apply")}),[e])}o(tr,"useEverfurTestEntitlements");var J=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(J.map(e=>e.wireCode));var rr=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),Oe=Object.freeze(J.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:rr[e.wireCode]}))),nr=new Map(Oe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),or=Object.freeze(["http_envelope",...[...new Set(Oe.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function D(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...or]){let i=nr.get(n+r);if(i)return i}}o(D,"contractErrorFor");function ar(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(ar,"contractDocUrl");function Ae(e){return null}o(Ae,"publishedDocUrl");var ir=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Ie(e){return ir[e]}o(Ie,"categoryFor");function Pe(e){let t=D(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Pe,"fromWire");var sr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Z(e){return sr.has(e)}o(Z,"isAutoRetryable");var lr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function ze(e){return Z(e)||lr.has(e)}o(ze,"isRetryableCode");var ur=500,ee=8e3,je=4;function De(e,t=Math.random){let r=Math.max(0,e),n=Math.min(ur*2**r,ee);return Math.floor(t()*n)}o(De,"backoffDelayMs");var dr=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function cr(e){return dr[e]}o(cr,"userFacingError");function Me(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Me,"defineHidden");var pr=/^[a-z][a-z0-9_]{0,63}$/;function m(e,t){let r=D(t?.wireCode,t?.wireEnvelope),n={code:e,category:Ie(e),retryable:t?.retryable??ze(e),displayMessage:cr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&pr.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Me(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Me(n,"raw",t.raw),Object.freeze(n)}o(m,"makeEverfurError");function Le(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(Le,"errorFrame");function yr(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}o(yr,"authHeaders");function w(e,t){return {...e,headers:{...gr(e.headers),...yr(t)}}}o(w,"withAuthHeaders");function gr(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=n);}return t}o(gr,"stripAuthHeaders");async function Ne(e,t){if(t.mode==="anonymous")return t.transport.request(w(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return u(te())}let n=await t.transport.request(w(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return u(te())}let s=await t.transport.request(w(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?u(te(s.error.httpStatus)):s}o(Ne,"authedSend");function te(e){return m("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(te,"authRejectedError");function Ue(e){return m("internalError",{retryable:true,wireMessage:br(e)})}o(Ue,"networkError");function br(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(br,"describeCause");var vr=3e4,hr=ee*2,Er="idempotency-key",_r=new Set(["POST","PUT","PATCH","DELETE"]),Rr=Object.freeze({onEvent(){}}),Sr=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function M(e){let t=e.observer??Rr,r=e.timers??Sr,n=e.rng??Math.random,i=e.sleep??((y,c)=>Dr(y,r,c)),s=e.maxAttempts??je,l=e.unaryTimeoutMs??vr,d=e.newIdempotencyKey??Cr(),p=o(y=>{try{t.onEvent(y);}catch{}},"emit");async function f(y,c,T){let U=T?.maxAttempts,rt=Math.max(1,U??s),V=T?.idempotent??_r.has(c.method)?d():null,nt=wr(c,V),q=0;for(;;){let _=o(H=>Object.freeze({call:y,method:c.method,path:c.path,attempt:q,...V?{idempotencyKey:V}:{},...H}),"stamp");p(_({phase:"attempt"}));let oe=zr(l,r),ae=jr(oe.signal,c.signal),R;try{R=await Ne({...nt,signal:ae.signal},e.auth);}catch(H){R=u(Ue(H));}finally{ae.dispose(),oe.cancel();}if(R.ok)return p(_({phase:"settled",ok:true,reason:"ok"})),R;let b=R.error,x=xr(b,q,{maxAttempts:rt,rng:n,now:r.now(),aborted:c.signal?.aborted===true,...U!==void 0?{perCallMaxAttempts:U}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),B={ok:false,code:b.code,reason:x.reason,...b.httpStatus!==void 0?{httpStatus:b.httpStatus}:{},...b.requestId!==void 0?{requestId:b.requestId}:{}};if(!x.retry)return p(_({phase:"settled",...B})),u(b);if(p(_({phase:"retry",...B,delayMs:x.delayMs})),await i(x.delayMs,c.signal),c.signal?.aborted===true)return p(_({phase:"settled",...B,reason:"aborted"})),u(b);q+=1;}}o(f,"send");async function C(y){return w(y,await Pr(e.auth))}o(C,"authorize");async function*tt(y,c,T){p(Object.freeze({call:y,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,T);}catch{yield Le({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(tt,"stream"),Object.freeze({send:f,authorize:C,stream:tt})}o(M,"createRequestFunnel");function wr(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Er&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(wr,"assembleHeaders");function Cr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(Cr,"defaultIdempotencyKeyFactory");var Tr=10;function xr(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=kr(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Z(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let l=o(()=>{if(r.policy===void 0)return null;let f;try{f=r.policy.maxAttempts(e.code);}catch{return null}return typeof f!="number"||!Number.isFinite(f)?null:Math.max(1,Math.min(Tr,Math.floor(f)))},"policyCeiling"),d=r.perCallMaxAttempts??l()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let p=Fr(e,r.now);return p!==null?p>hr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:p}:{retry:true,reason:i,delayMs:De(t,r.rng)}}o(xr,"decideRetry");function kr(e){let t=e.code==="unknown"?Pe(Ir(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(kr,"throttleKind");function Fr(e,t){let r=Or(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}o(Fr,"retryOverrideMs");function Or(e){for(let t of qe(e)){let r=t.resets_at,n=Ar(r);if(n!==null)return n}return null}o(Or,"findResetsAt");function qe(e){if(!Ve(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Ve(n)&&t.push(n);}return t}o(qe,"candidateScopes");function Ar(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}o(Ar,"parseInstantMs");function Ir(e){for(let t of qe(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(Ir,"rawWireCode");function Ve(e){return typeof e=="object"&&e!==null}o(Ve,"isRecord");async function Pr(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(Pr,"resolveDeviceAuth");function zr(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(zr,"boundedSignal");function jr(e,t){let r=o(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(jr,"mergeSignals");function Dr(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}o(Dr,"delayAbortable");function L(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}o(L,"hasLoneSurrogate");function Be(e){return [...e].length}o(Be,"serverLength");var We=new Set(["requested","awaiting_clinic","awaiting_upload","received","parsing","in_review","published","failed","revoked"]),He=Object.freeze({submitted:"requested",sent:"requested",dispatching:"requested",awaiting_response:"awaiting_clinic",clinic_responded_no_records:"awaiting_clinic",records_received:"received",parsing_failed:"in_review",review_email_failed:"in_review",clinic_declined:"failed"});function Mr(e){let t=Object.prototype.hasOwnProperty.call(He,e)?He[e]:void 0;if(t!==void 0)return t;let r=e;return We.has(r)?r:"parsing"}o(Mr,"normalizeStatus");var Lr=z$1.object({request_id:z$1.string().min(1),pet_ref:z$1.string().min(1),status:z$1.string(),simple_status:z$1.string().nullish(),simple_status_detail:z$1.string().nullish(),status_label:z$1.string().optional(),dispatch_status:z$1.string().nullish(),can_retry_send:z$1.boolean().optional(),can_revoke:z$1.boolean().optional(),can_convert_to_upload:z$1.boolean().optional(),can_update_clinic_email:z$1.boolean().optional(),reminder_count:z$1.number().int().nonnegative().optional(),last_reminder_at:z$1.string().nullish(),waiting_expectation:z$1.string().nullish(),document_count:z$1.number().optional(),held_item_count:z$1.number().optional(),received_at:z$1.string().nullish(),parsing_started_at:z$1.string().nullish(),review_started_at:z$1.string().nullish(),created_at:z$1.string().optional(),updated_at:z$1.string().optional(),source:z$1.string().nullish().catch(null),action_needed_label:z$1.string().nullish().catch(null),failure_reason:z$1.string().nullish().catch(null),failure_code:z$1.string().nullish().catch(null),recovery_stage:z$1.string().nullish().catch(null),show_clinic_phone:z$1.boolean().optional().catch(void 0),clinic_name:z$1.string().nullish().catch(null),clinic_email:z$1.string().nullish().catch(null),clinic_phone:z$1.string().nullish().catch(null),converted_to_upload_at:z$1.string().nullish().catch(null),request_group_id:z$1.string().nullish().catch(null)}).passthrough();function Ge(e){let t=Lr.safeParse(e);if(!t.success)return null;let r=t.data,n=Nr(r.simple_status),i=n==="requested"&&(r.status==="awaiting_upload"||r.simple_status_detail==="awaiting_owner_upload")?"awaiting_upload":n==="parsing"&&(r.simple_status_detail==="in_review"||r.simple_status_detail==="review_email_failed")?"in_review":n??Mr(r.status);return Object.freeze({id:r.request_id,petRef:r.pet_ref,status:i,simpleStatus:n,simpleStatusDetail:r.simple_status_detail??null,statusLabel:r.status_label??"",dispatchStatus:r.dispatch_status??null,canRetrySend:r.can_retry_send===true,canRevoke:r.can_revoke===true,canConvertToUpload:r.can_convert_to_upload===true,canUpdateClinicEmail:r.can_update_clinic_email===true,reminderCount:r.reminder_count??0,lastReminderAt:r.last_reminder_at??null,waitingExpectation:r.waiting_expectation??null,documentCount:Ye(r.document_count,0),heldItemCount:Ye(r.held_item_count,0),receivedAt:r.received_at??null,parsingStartedAt:r.parsing_started_at??null,reviewStartedAt:r.review_started_at??null,createdAt:r.created_at??"",updatedAt:r.updated_at??"",wireStatus:r.status,source:r.source??null,actionNeededLabel:r.action_needed_label??null,failureReason:r.failure_reason??null,failureCode:r.failure_code??null,recoveryStage:r.recovery_stage??null,showClinicPhone:r.show_clinic_phone===true,clinicName:r.clinic_name??null,clinicEmail:r.clinic_email??null,clinicPhone:r.clinic_phone??null,convertedToUploadAt:r.converted_to_upload_at??null,requestGroupId:r.request_group_id??null})}o(Ge,"mapRequestView");z$1.object({request_group_id:z$1.string().min(1),pet_ref:z$1.string().min(1),total:z$1.number().int().nonnegative(),responded:z$1.number().int().nonnegative(),pending:z$1.number().int().nonnegative(),members:z$1.array(z$1.unknown())});function Nr(e){return !e||e==="awaiting_upload"||e==="in_review"?null:We.has(e)?e:null}o(Nr,"normalizeSimpleStatus");z$1.object({source_doc_id:z$1.string().min(1),request_id:z$1.string().min(1)});var Ur=z$1.object({label:z$1.string(),value:z$1.string()}),Vr=z$1.object({key:z$1.string(),category:z$1.string().optional(),label:z$1.string().optional(),value:z$1.string().nullish(),unit:z$1.string().nullish(),observed_at:z$1.string().nullish(),status:z$1.string().nullish(),origin:z$1.string().nullish(),canonical_key:z$1.string().nullish()}),qr=z$1.object({at:z$1.string(),value:z$1.number().nullish(),display:z$1.string().nullish(),origin:z$1.string().nullish()}),Br=z$1.object({key:z$1.string(),label:z$1.string().optional(),points:z$1.array(qr).optional()}),Hr=z$1.object({title:z$1.string(),detail:z$1.string().nullish(),due_at:z$1.string().nullish()}),Yr=z$1.object({doc_id:z$1.string(),title:z$1.string().nullish(),page_count:z$1.number().nullish(),received_at:z$1.string().nullish()});z$1.object({identity:z$1.array(Ur).optional(),entities:z$1.array(Vr).optional(),entity_series:z$1.array(Br).optional(),forward_looking:z$1.array(Hr).optional(),documents:z$1.array(Yr).optional()});z$1.object({pet_ref:z$1.string().optional(),granted:z$1.boolean().optional(),version:z$1.string().nullish(),granted_at:z$1.string().nullish()});function Ye(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}o(Ye,"numberOr");var Wr="/widget/v1/records/sandbox/requests",Ke=64,Gr=new Set(["records","no_records","declined"]),Kr=new Set(["applied","already_applied","not_applicable"]);function N(e){return m("validationFailed",{retryable:false,wireMessage:e})}o(N,"invalid");function $r(e){return typeof e!="string"||e.length===0?N("request_id is required and must be a non-empty string"):L(e)?N("request_id contains an unpaired surrogate and cannot be encoded"):[...e].length>Ke?N(`request_id is longer than ${Ke} characters`):null}o($r,"requestIdError");function Qr(e){if(typeof e!="object"||e===null)return null;let{result:t,request:r}=e;if(typeof t!="string"||!Kr.has(t))return null;let n=Ge(r);return n===null?null:Object.freeze({result:t,request:n})}o(Qr,"mapActionResult");function $e(e){let t=e.funnel??M({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=o(async(n,i,s,l)=>{let d=$r(i);if(d!==null)return u(d);let p=`${Wr}/${encodeURIComponent(i)}/${s}`,f=await t.send(n,l===void 0?{method:"POST",path:p}:{method:"POST",path:p,body:l});if(!f.ok)return u(f.error);let C=Qr(f.value);return C===null?u(m("internalError",{retryable:false})):j(C)},"run");return {simulateClinicReply(n,i){return typeof i!="string"||!Gr.has(i)?Promise.resolve(u(N("outcome must be records, no_records or declined"))):r("records.sandbox.clinicReply",n,"clinic-reply",{outcome:i})},publishSampleRecord(n){return r("records.sandbox.publishSample",n,"publish-sample")}}}o($e,"createRecordsSandboxController");function Jr(){let{runtime:e,userRef:t,scopeEpoch:r}=E();return useMemo(()=>{let{services:n}=e.registry;return $e({auth:n.authFor(t),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{}})},[e,t,r])}o(Jr,"useEverfurRecordsSandbox");var re="/widget/v1/televet/sandbox/visits",Zr=128,Qe=64,Ze=new Set(["booked","cancelled","completed","no_show"]),en=new Set(["applied","already_applied","not_applicable"]),Xe=new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),Je=new Set(["24h","30m"]);function v(e){return m("validationFailed",{retryable:false,wireMessage:e})}o(v,"invalid");function ne(e,t,r){return typeof t!="string"||t.length===0?v(`${e} is required and must be a non-empty string`):L(t)?v(`${e} contains an unpaired surrogate and cannot be encoded`):Be(t)>r?v(`${e} is longer than ${r} characters`):null}o(ne,"textError");function tn(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:r}=e;if(typeof t!="string"||!en.has(t)||typeof r!="object"||r===null)return null;let{visit_ref:n,pet_ref:i,status:s,scheduled_at:l}=r;return typeof n!="string"||n.length===0||typeof i!="string"||i.length===0||typeof s!="string"||!Ze.has(s)||typeof l!="string"||l.length===0?null:Object.freeze({result:t,visit:Object.freeze({visitRef:n,petRef:i,status:s,scheduledAt:l})})}o(tn,"mapActionResult");function et(e){let t=e.funnel??M({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=o(async(n,i,s)=>{let l=await t.send(n,{method:"POST",path:i,body:s},{idempotent:false,maxAttempts:1});if(!l.ok)return u(l.error);let d=tn(l.value);return d===null?u(m("internalError",{retryable:false})):j(d)},"run");return {createVisit(n){let i=ne("pet_ref",n,Zr);return i!==null?Promise.resolve(u(i)):r("televet.sandbox.createVisit",re,{pet_ref:n})},advanceVisit(n,i){let s=ne("visit_ref",n,Qe);if(s!==null)return Promise.resolve(u(s));if(typeof i!="string"||!Ze.has(i))return Promise.resolve(u(v("to must be booked, cancelled, completed or no_show")));let l=`${re}/${encodeURIComponent(n)}/advance`;return r("televet.sandbox.advanceVisit",l,{to:i})},simulateVisitEvent(n,i,s){let l=ne("visit_ref",n,Qe);if(l!==null)return Promise.resolve(u(l));if(typeof i!="string"||!Xe.has(i))return Promise.resolve(u(v(`event must be one of ${[...Xe].join(", ")}`)));if(i==="reminder"){if(typeof s!="string"||!Je.has(s))return Promise.resolve(u(v(`stage must be one of ${[...Je].join(", ")} for a reminder`)))}else if(s!==void 0)return Promise.resolve(u(v("stage is only for a reminder")));let d=`${re}/${encodeURIComponent(n)}/simulate`;return r("televet.sandbox.simulateVisitEvent",d,s===void 0?{event:i}:{event:i,stage:s})}}}o(et,"createVetVisitSandboxController");function nn(){let{runtime:e,userRef:t,scopeEpoch:r}=E();return useMemo(()=>{let{services:n}=e.registry;return et({auth:n.authFor(t),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{}})},[e,t,r])}o(nn,"useEverfurVetVisitSandbox");export{Lt as AnalyzingIndicator,Qt as SeverityBadge,St as TypingIndicator,Jr as useEverfurRecordsSandbox,tr as useEverfurTestEntitlements,nn as useEverfurVetVisitSandbox};