@everfur/sdk 0.1.1 → 0.4.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 (219) hide show
  1. package/CHANGELOG.md +703 -4
  2. package/README.md +63 -23
  3. package/consent/package.json +8 -0
  4. package/dist/Chat-BZZ-Py5l.d.ts +128 -0
  5. package/dist/Chat-Dq4fffIO.d.cts +128 -0
  6. package/dist/DepthViews-BG3E25MD.d.ts +16 -0
  7. package/dist/DepthViews-B_hIypI6.d.cts +19 -0
  8. package/dist/DepthViews-CL75jyRA.d.cts +16 -0
  9. package/dist/DepthViews-CkYri51q.d.ts +19 -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-BorG422I.d.cts +146 -0
  21. package/dist/attachments-BrUWQYNK.d.ts +257 -0
  22. package/dist/attachments-D_SECjr1.d.cts +257 -0
  23. package/dist/attachments-DpldrvIW.d.ts +146 -0
  24. package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
  25. package/dist/bookingCopy-SREvkG19.d.cts +732 -0
  26. package/dist/branding-CsRdeNwK.d.cts +566 -0
  27. package/dist/branding-CsRdeNwK.d.ts +566 -0
  28. package/dist/callCopy-DoQKG3-L.d.cts +40 -0
  29. package/dist/callCopy-DoQKG3-L.d.ts +40 -0
  30. package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
  31. package/dist/casesRepository-v6QczS9N.d.ts +51 -0
  32. package/dist/chat/index.cjs +1 -1170
  33. package/dist/chat/index.d.cts +32 -53
  34. package/dist/chat/index.d.ts +32 -53
  35. package/dist/chat/index.js +1 -1167
  36. package/dist/client/index.cjs +9 -2315
  37. package/dist/client/index.d.cts +80 -16
  38. package/dist/client/index.d.ts +80 -16
  39. package/dist/client/index.js +9 -2215
  40. package/dist/{config-CiJ0PVBB.d.ts → config--Wu1Umhd.d.cts} +64 -26
  41. package/dist/{config-BSjBdxrZ.d.cts → config-C7eb_IMD.d.ts} +64 -26
  42. package/dist/consent/index.cjs +1 -0
  43. package/dist/consent/index.d.cts +33 -0
  44. package/dist/consent/index.d.ts +33 -0
  45. package/dist/consent/index.js +1 -0
  46. package/dist/context-CL3lyuy1.d.cts +159 -0
  47. package/dist/context-CahAEha8.d.ts +159 -0
  48. package/dist/copy-DdVFDL01.d.ts +198 -0
  49. package/dist/copy-UeUJVk8X.d.cts +198 -0
  50. package/dist/core/index.cjs +13 -3178
  51. package/dist/core/index.d.cts +164 -29
  52. package/dist/core/index.d.ts +164 -29
  53. package/dist/core/index.js +13 -3166
  54. package/dist/depth-D5HwcvKC.d.cts +533 -0
  55. package/dist/depth-DvPwPuT_.d.ts +533 -0
  56. package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
  57. package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
  58. package/dist/{identity-Brl-lDd6.d.cts → identity-C2-08BZW.d.cts} +20 -7
  59. package/dist/{identity-DK9zORrG.d.ts → identity-CEi9GRFZ.d.ts} +20 -7
  60. package/dist/{ids-CJ1S6adf.d.cts → ids-B2GAAifq.d.cts} +1 -1
  61. package/dist/{ids-CJ1S6adf.d.ts → ids-B2GAAifq.d.ts} +1 -1
  62. package/dist/index.cjs +12 -4494
  63. package/dist/index.d.cts +30 -121
  64. package/dist/index.d.ts +30 -121
  65. package/dist/index.js +12 -4470
  66. package/dist/models-B-Uh2LTf.d.ts +214 -0
  67. package/dist/models-D2EUxPZY.d.cts +214 -0
  68. package/dist/notifications/index.cjs +2 -0
  69. package/dist/notifications/index.d.cts +17 -0
  70. package/dist/notifications/index.d.ts +17 -0
  71. package/dist/notifications/index.js +2 -0
  72. package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
  73. package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
  74. package/dist/pets-DJv2sj2H.d.ts +92 -0
  75. package/dist/pets-JVCXgRgR.d.cts +92 -0
  76. package/dist/petsRepository-B_gKbAzJ.d.cts +142 -0
  77. package/dist/petsRepository-Bk6GDwLs.d.ts +142 -0
  78. package/dist/photo/index.cjs +1 -2189
  79. package/dist/photo/index.d.cts +6 -6
  80. package/dist/photo/index.d.ts +6 -6
  81. package/dist/photo/index.js +1 -2186
  82. package/dist/ports-BN6RHF9W.d.cts +48 -0
  83. package/dist/ports-BN6RHF9W.d.ts +48 -0
  84. package/dist/ports-BY2ph0_y.d.cts +376 -0
  85. package/dist/ports-D7YW8qz9.d.ts +376 -0
  86. package/dist/profile-CSs1wlXT.d.cts +93 -0
  87. package/dist/profile-CSs1wlXT.d.ts +93 -0
  88. package/dist/records/depth/index.cjs +2 -0
  89. package/dist/records/depth/index.d.cts +13 -0
  90. package/dist/records/depth/index.d.ts +13 -0
  91. package/dist/records/depth/index.js +2 -0
  92. package/dist/records/index.cjs +3 -2839
  93. package/dist/records/index.d.cts +137 -203
  94. package/dist/records/index.d.ts +137 -203
  95. package/dist/records/index.js +3 -2833
  96. package/dist/requestFunnel-BjDpqqvm.d.cts +110 -0
  97. package/dist/requestFunnel-DFMGcluw.d.ts +110 -0
  98. package/dist/{resolve-Dq_4_agU.d.ts → resolve-D4Ywz5OS.d.cts} +10 -4
  99. package/dist/{resolve-Dq_4_agU.d.cts → resolve-D4Ywz5OS.d.ts} +10 -4
  100. package/dist/{runtime-Bvr8yqXm.d.cts → runtimeTypes-gZEJu-da.d.cts} +104 -132
  101. package/dist/{runtime-BIYzf9cK.d.ts → runtimeTypes-w5KqBMcs.d.ts} +104 -132
  102. package/dist/server/events/index.cjs +2 -0
  103. package/dist/server/events/index.d.cts +550 -0
  104. package/dist/server/events/index.d.ts +550 -0
  105. package/dist/server/events/index.js +2 -0
  106. package/dist/server/index.cjs +2 -533
  107. package/dist/server/index.d.cts +73 -18
  108. package/dist/server/index.d.ts +73 -18
  109. package/dist/server/index.js +2 -530
  110. package/dist/species-BXAIMh7I.d.cts +9 -0
  111. package/dist/species-BXAIMh7I.d.ts +9 -0
  112. package/dist/televet/booking/index.cjs +1 -0
  113. package/dist/televet/booking/index.d.cts +294 -0
  114. package/dist/televet/booking/index.d.ts +294 -0
  115. package/dist/televet/booking/index.js +1 -0
  116. package/dist/televet/call/index.cjs +1 -0
  117. package/dist/televet/call/index.d.cts +141 -0
  118. package/dist/televet/call/index.d.ts +141 -0
  119. package/dist/televet/call/index.js +1 -0
  120. package/dist/televet/index.cjs +1 -0
  121. package/dist/televet/index.d.cts +142 -0
  122. package/dist/televet/index.d.ts +142 -0
  123. package/dist/televet/index.js +1 -0
  124. package/dist/testing/index.cjs +5 -823
  125. package/dist/testing/index.d.cts +18 -4
  126. package/dist/testing/index.d.ts +18 -4
  127. package/dist/testing/index.js +5 -820
  128. package/dist/testing/rn/index.cjs +1 -449
  129. package/dist/testing/rn/index.d.cts +18 -29
  130. package/dist/testing/rn/index.d.ts +18 -29
  131. package/dist/testing/rn/index.js +1 -444
  132. package/dist/testing/web/index.cjs +1 -0
  133. package/dist/testing/web/index.d.cts +132 -0
  134. package/dist/testing/web/index.d.ts +132 -0
  135. package/dist/testing/web/index.js +1 -0
  136. package/dist/timelineRows-C15jxFFH.d.ts +19 -0
  137. package/dist/timelineRows-odO8g9r2.d.cts +19 -0
  138. package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
  139. package/dist/typeStyle-DmoyacDG.d.ts +111 -0
  140. package/dist/uploadTransport-D0M0T4hN.d.ts +38 -0
  141. package/dist/uploadTransport-DKJHs3Yj.d.cts +38 -0
  142. package/dist/useRecordsDepth-C6rjEaLn.d.cts +237 -0
  143. package/dist/useRecordsDepth-crhBllQK.d.ts +237 -0
  144. package/dist/useVetVisit-Bc84hWUU.d.cts +187 -0
  145. package/dist/useVetVisit-CjmMa896.d.ts +187 -0
  146. package/dist/video/index.cjs +1 -1941
  147. package/dist/video/index.d.cts +4 -4
  148. package/dist/video/index.d.ts +4 -4
  149. package/dist/video/index.js +1 -1938
  150. package/dist/view-Bxwxp4xD.d.ts +310 -0
  151. package/dist/view-DyitEO0m.d.cts +310 -0
  152. package/dist/visitIntent-D7_yVp1I.d.cts +8 -0
  153. package/dist/visitIntent-D7_yVp1I.d.ts +8 -0
  154. package/dist/web/consent/index.cjs +1 -0
  155. package/dist/web/consent/index.d.cts +34 -0
  156. package/dist/web/consent/index.d.ts +34 -0
  157. package/dist/web/consent/index.js +1 -0
  158. package/dist/web/index.cjs +14 -0
  159. package/dist/web/index.d.cts +218 -0
  160. package/dist/web/index.d.ts +218 -0
  161. package/dist/web/index.js +14 -0
  162. package/dist/web/notifications/index.cjs +2 -0
  163. package/dist/web/notifications/index.d.cts +213 -0
  164. package/dist/web/notifications/index.d.ts +213 -0
  165. package/dist/web/notifications/index.js +2 -0
  166. package/dist/web/records/depth/index.cjs +2 -0
  167. package/dist/web/records/depth/index.d.cts +12 -0
  168. package/dist/web/records/depth/index.d.ts +12 -0
  169. package/dist/web/records/depth/index.js +2 -0
  170. package/dist/web/records/index.cjs +4 -0
  171. package/dist/web/records/index.d.cts +285 -0
  172. package/dist/web/records/index.d.ts +285 -0
  173. package/dist/web/records/index.js +4 -0
  174. package/dist/web/televet/booking/index.cjs +1 -0
  175. package/dist/web/televet/booking/index.d.cts +349 -0
  176. package/dist/web/televet/booking/index.d.ts +349 -0
  177. package/dist/web/televet/booking/index.js +1 -0
  178. package/dist/web/televet/call/index.cjs +1 -0
  179. package/dist/web/televet/call/index.d.cts +142 -0
  180. package/dist/web/televet/call/index.d.ts +142 -0
  181. package/dist/web/televet/call/index.js +1 -0
  182. package/dist/web/televet/index.cjs +1 -0
  183. package/dist/web/televet/index.d.cts +136 -0
  184. package/dist/web/televet/index.d.ts +136 -0
  185. package/dist/web/televet/index.js +1 -0
  186. package/notifications/package.json +8 -0
  187. package/package.json +266 -10
  188. package/records/depth/package.json +8 -0
  189. package/server/events/device-blocked.cjs +15 -0
  190. package/server/events/package.json +9 -0
  191. package/televet/booking/package.json +8 -0
  192. package/televet/call/package.json +8 -0
  193. package/televet/package.json +8 -0
  194. package/testing/web/native-blocked.cjs +12 -0
  195. package/testing/web/package.json +8 -0
  196. package/web/consent/native-blocked.cjs +12 -0
  197. package/web/consent/package.json +8 -0
  198. package/web/native-blocked.cjs +12 -0
  199. package/web/notifications/native-blocked.cjs +12 -0
  200. package/web/notifications/package.json +8 -0
  201. package/web/package.json +8 -0
  202. package/web/records/depth/native-blocked.cjs +12 -0
  203. package/web/records/depth/package.json +8 -0
  204. package/web/records/native-blocked.cjs +12 -0
  205. package/web/records/package.json +8 -0
  206. package/web/televet/booking/native-blocked.cjs +12 -0
  207. package/web/televet/booking/package.json +8 -0
  208. package/web/televet/call/native-blocked.cjs +12 -0
  209. package/web/televet/call/package.json +8 -0
  210. package/web/televet/native-blocked.cjs +12 -0
  211. package/web/televet/package.json +8 -0
  212. package/dist/ChatController-CKdBvPj2.d.ts +0 -146
  213. package/dist/ChatController-CpUMvvZf.d.cts +0 -146
  214. package/dist/FilePort-BabWrv7I.d.cts +0 -22
  215. package/dist/FilePort-BabWrv7I.d.ts +0 -22
  216. package/dist/petsRepository-BEGb97M9.d.cts +0 -326
  217. package/dist/petsRepository-Bu18r2kK.d.ts +0 -326
  218. package/dist/requestFunnel-DuUH-kAe.d.cts +0 -28
  219. package/dist/requestFunnel-dio5OmR9.d.ts +0 -28
@@ -0,0 +1,294 @@
1
+ import { ReactNode, ComponentType, ReactElement } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { P as PetRef } from '../../ids-B2GAAifq.js';
4
+ export { B as Brand, _ as __brand } from '../../ids-B2GAAifq.js';
5
+ import { T as TelevetConsult, a as TelevetBookingStep, b as TelevetBookingController, c as TelevetSlot } from '../../bookingCopy-CqtDYvCR.js';
6
+ export { C as CANCELLATION_POLICY_VERSION_MAX, d as CONSULT_KINDS, e as CONSULT_MINUTES, f as CONSULT_STATUSES, g as ConsultKind, h as ConsultStatus, M as MEDIA_REFS_MAX, R as REASON_TEXT_MAX, i as TELEVET_BOOKING_BASE, j as TELEVET_BOOKING_COPY, k as TELEVET_BOOKING_STEPS, l as TERMINAL_CONSULT_STATUSES, m as TelevetBookingAction, n as TelevetBookingBody, o as TelevetBookingContext, p as TelevetBookingControllerDeps, q as TelevetBookingCopy, r as TelevetBookingDraft, s as TelevetBookingEntitlement, t as TelevetBookingRefusal, u as TelevetBookingState, v as TelevetCancellationPolicy, w as TelevetClinician, x as TelevetRead, y as TelevetSlotHold, z as TelevetStatePolicy, A as TelevetWrite, B as attestation, D as canConfirm, E as createTelevetBookingController, F as currentStep, G as emptyTelevetDraft, H as formatVisitRange, I as formatWhen, J as formatWhenWithDay, K as hasPreviousStep, L as initialTelevetBookingState, N as isHoldExpired, O as isSkipped, P as isTelevetBookingCopyReady, Q as isWellFormedStateCode, S as televetBookingKey, U as televetBookingReducer, V as televetBookingRefusal, W as televetHoldCall, X as televetRescheduleCall, Y as useTelevetBookConsult, Z as useTelevetBookingAvailable, _ as useTelevetBookingController, $ as useTelevetBookingEntitlement, a0 as useTelevetCancellationPolicy, a1 as useTelevetClinicians, a2 as useTelevetHoldSlot, a3 as useTelevetNextSlot, a4 as useTelevetRescheduleConsult, a5 as useTelevetSlots, a6 as useTelevetStatePolicy, a7 as validateBookingBody } from '../../bookingCopy-CqtDYvCR.js';
7
+ export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../../EverfurResult-DN9pL2Ab.js';
8
+ export { W as WidgetPet } from '../../petsRepository-Bk6GDwLs.js';
9
+ import '../../requestFunnel-DFMGcluw.js';
10
+ import '../../ErrorPolicyPort-CwbfmxzJ.js';
11
+ import '../../config-C7eb_IMD.js';
12
+ import '../../identity-CEi9GRFZ.js';
13
+ import '../../TelemetryPort-BDNr00hu.js';
14
+ import '../../profile-CSs1wlXT.js';
15
+
16
+ /** The calendar entry a booked visit asks the host to write. */
17
+ interface TelevetCalendarEvent {
18
+ /**
19
+ * A stable key for THIS consult's entry.
20
+ *
21
+ * Keyed on the CONSULT so a re-tap updates the same entry rather than writing a second event for one visit,
22
+ * and so a later cancel or reschedule can address the SAME row. A host that ignores the key writes duplicates
23
+ * the owner has to clean up by hand.
24
+ */
25
+ readonly key: string;
26
+ readonly title: string;
27
+ readonly startDate: Date;
28
+ readonly endDate: Date;
29
+ /** The reminder offset in minutes, negative for "before". The platform queues its own at the same offset. */
30
+ readonly alarmOffsetMinutes: number;
31
+ }
32
+ /** Writes the entry. Resolves true when it landed; false for a refused permission or no calendar at all. */
33
+ type TelevetCalendarWriter = (event: TelevetCalendarEvent) => Promise<boolean>;
34
+ /** The calendar key for a consult. One definition, so a cancel and a reschedule address the booked row. */
35
+ declare function televetConsultCalendarKey(consultId: string): string;
36
+ interface TelevetBookedScreenProps {
37
+ readonly consult: TelevetConsult;
38
+ readonly petName: string | null;
39
+ readonly onDone: () => void;
40
+ /** Absent, there is no Add to calendar control. */
41
+ readonly onAddToCalendar?: TelevetCalendarWriter | undefined;
42
+ /**
43
+ * Has the host PROVEN it can host the call in app? Defaults to false.
44
+ *
45
+ * Fail closed: a host that has not said so is assumed not to have the native video modules, and the in-app
46
+ * join promise is withheld rather than printed on a hope.
47
+ */
48
+ readonly canJoinInApp?: boolean;
49
+ }
50
+ declare function TelevetBookedScreen({ consult, petName, onDone, onAddToCalendar, canJoinInApp, }: TelevetBookedScreenProps): ReactNode;
51
+
52
+ /**
53
+ * The host's own discard confirmation.
54
+ *
55
+ * Receives the ported title, body and the two button labels, and resolves true to leave. A partner with its
56
+ * own dialog system passes this; absent, the SDK uses React Native's `Alert`, which is what the consumer does.
57
+ */
58
+ type TelevetDiscardConfirm = (prompt: {
59
+ readonly title: string;
60
+ readonly body: string;
61
+ readonly confirmLabel: string;
62
+ readonly keepLabel: string;
63
+ }) => Promise<boolean>;
64
+ interface TelevetBookingChromeProps {
65
+ readonly step: TelevetBookingStep;
66
+ readonly furthestIndex: number;
67
+ /** The title on the bar. The reschedule flow passes its own, so the bar never says "Book a visit" there. */
68
+ readonly title?: string;
69
+ /** False on the first visible step, where Back would leave the flow entirely. */
70
+ readonly canGoBack: boolean;
71
+ /**
72
+ * Has the owner entered anything worth losing?
73
+ *
74
+ * Gates the discard confirm. A confirm on an untouched flow is a pointless obstacle; NO confirm on a flow
75
+ * holding typed clinical text is the actual defect, because that text is volatile component state with no
76
+ * draft to restore it from.
77
+ */
78
+ readonly isDirty: boolean;
79
+ readonly onBack: () => void;
80
+ readonly onClose: () => void;
81
+ readonly onConfirmDiscard?: TelevetDiscardConfirm | undefined;
82
+ }
83
+ declare function TelevetBookingChrome({ step, furthestIndex, title, canGoBack, isDirty, onBack, onClose, onConfirmDiscard, }: TelevetBookingChromeProps): ReactNode;
84
+ /**
85
+ * The back control's spoken label.
86
+ *
87
+ * "Back" is the platform word for the control and is not product copy, which is why it is a constant here and
88
+ * not a key in the ported deck: the consumer gets it from its shared back button, which owns the same string.
89
+ */
90
+ declare const BACK_LABEL = "Back";
91
+
92
+ /** A picked-but-not-yet-uploaded attachment, in the host's own terms. */
93
+ interface TelevetIntakeMediaItem {
94
+ readonly uri: string;
95
+ readonly filename: string;
96
+ readonly mimeType: string;
97
+ readonly fileSize: number;
98
+ }
99
+ /**
100
+ * The host's media picker.
101
+ *
102
+ * Resolves the picks, or null when the owner cancelled or the permission was refused. The SDK takes no picker
103
+ * dependency: on the consumer app this is expo-image-picker behind `pickMediaFromLibrary`, and a partner
104
+ * supplies whichever picker its app already has.
105
+ *
106
+ * `limit` is the remaining headroom, so the host can cap its own selection rather than returning picks this
107
+ * row has to silently discard.
108
+ */
109
+ type TelevetMediaPicker = (limit: number) => Promise<readonly TelevetIntakeMediaItem[] | null>;
110
+ interface TelevetIntakeMediaProps {
111
+ readonly media: readonly TelevetIntakeMediaItem[];
112
+ readonly onChange: (next: readonly TelevetIntakeMediaItem[]) => void;
113
+ /** Absent, the row renders nothing at all. There is no disabled Add control. */
114
+ readonly onPickMedia?: TelevetMediaPicker | undefined;
115
+ }
116
+ declare function TelevetIntakeMedia({ media, onChange, onPickMedia }: TelevetIntakeMediaProps): ReactNode;
117
+
118
+ /**
119
+ * Why a booking did not complete.
120
+ *
121
+ * `not_entitled` is separated from `failed` because the two need opposite affordances: a transient failure
122
+ * invites a retry, and a 402 must not. `unavailable` is separated from both because no retry can succeed.
123
+ */
124
+ type TelevetBookingFailure = 'taken' | 'expired' | 'failed' | 'not_entitled'
125
+ /** The remedy is a DIFFERENT VET, not a different time: re-picking a slot with the same clinician refuses again. */
126
+ | 'clinician_unavailable'
127
+ /** Per-owner caps. The remedy is WAITING, so this must never render as an invitation to press again. */
128
+ | 'rate_limited'
129
+ /** The partner booking surface is not served here. The remedy is the hosted visit, not a retry. */
130
+ | 'unavailable' | null;
131
+ /** What the host can tell us about a location it could not resolve, so the right card renders. */
132
+ type TelevetLocationStatus = 'unknown' | 'blocked' | 'unavailable';
133
+ interface EverfurTelevetBookingProps {
134
+ /** The pet the visit is for. Seeds the draft; a one-pet roster skips the picker entirely. */
135
+ readonly petRef?: PetRef | null;
136
+ /** The owner's two-letter US state. The SDK never reads a device location for it. */
137
+ readonly usState?: string | null;
138
+ /** Host/test seam: inject a booking controller instead of building one from the provider's session. */
139
+ readonly controller?: TelevetBookingController;
140
+ readonly onBooked?: (consult: TelevetConsult) => void;
141
+ /** Leaves the flow. The flow never navigates itself, so the same screens work in a modal, a tab or a stack. */
142
+ readonly onExit?: () => void;
143
+ /** Leaves the flow to create a pet, then comes back. Absent, the empty roster has no action. */
144
+ readonly onAddPet?: () => void;
145
+ /** The host's media picker for the intake step. Absent, there is no attachment row. */
146
+ readonly onPickMedia?: TelevetMediaPicker;
147
+ /** The host's calendar writer for the confirmation. Absent, there is no Add to calendar control. */
148
+ readonly onAddToCalendar?: TelevetCalendarWriter;
149
+ /** The host's own discard dialog. Absent, the SDK uses React Native's `Alert`. */
150
+ readonly onConfirmDiscard?: TelevetDiscardConfirm;
151
+ /** Asks the host to resolve the owner's state again. Absent, the location cards render without an action. */
152
+ readonly onRequestLocation?: () => void;
153
+ /** Why the host has no state for us, so the right card renders. */
154
+ readonly locationStatus?: TelevetLocationStatus;
155
+ /**
156
+ * Has the host PROVEN it can host the call in app? Defaults to false.
157
+ *
158
+ * Fail closed: without the native video modules the confirmation must not promise an in-app join.
159
+ */
160
+ readonly canJoinInApp?: boolean;
161
+ /**
162
+ * What to render when the partner booking surface is not served for this tenant.
163
+ *
164
+ * THE FLOW WILL NOT DEAD-END. Absent this, an unserved surface renders the paused card, which is a state but
165
+ * not a way forward; the prebuilt flow passes the hosted-visit handoff here so the owner still reaches a vet.
166
+ */
167
+ readonly renderUnavailable?: () => ReactNode;
168
+ readonly style?: StyleProp<ViewStyle>;
169
+ readonly testID?: string;
170
+ }
171
+ declare function EverfurTelevetBooking(props: EverfurTelevetBookingProps): ReactNode;
172
+
173
+ /** The screens of the televet stack. */
174
+ type TelevetScreen = {
175
+ readonly name: 'booking';
176
+ } | {
177
+ readonly name: 'reschedule';
178
+ readonly consult: TelevetConsult;
179
+ };
180
+ interface EverfurTelevetProps {
181
+ /** The pet the visit is for. Seeds the draft; a one-pet roster skips the picker entirely. */
182
+ readonly petRef?: PetRef | null;
183
+ /** The owner's two-letter US state. The SDK never reads a device location for it. */
184
+ readonly usState?: string | null;
185
+ /** Host/test seam: inject a booking controller instead of building one from the provider's session. */
186
+ readonly controller?: TelevetBookingController;
187
+ readonly onBooked?: (consult: TelevetConsult) => void;
188
+ /** The root screen's exit; absent, the root's Close does nothing and the host navigator owns leaving. */
189
+ readonly onExit?: () => void;
190
+ readonly onAddPet?: () => void;
191
+ readonly onPickMedia?: TelevetMediaPicker;
192
+ readonly onAddToCalendar?: TelevetCalendarWriter;
193
+ readonly onConfirmDiscard?: TelevetDiscardConfirm;
194
+ readonly onRequestLocation?: () => void;
195
+ readonly locationStatus?: TelevetLocationStatus;
196
+ /**
197
+ * Has the host installed the native video modules and wired the call surface? Defaults to FALSE.
198
+ *
199
+ * Fail closed. A partner that has not said so gets a confirmation that promises only what it can keep.
200
+ */
201
+ readonly canJoinInApp?: boolean;
202
+ /**
203
+ * Replace the hosted-visit fallback shown when the in-app booking surface is not served.
204
+ *
205
+ * The default is the published `VetVisitButton`, which mints the single-use handoff and opens the hosted
206
+ * Everfur visit. Passing `null` here is not a way to remove it: a flow with no fallback dead-ends, so an
207
+ * explicit render prop is the only way to change it.
208
+ */
209
+ readonly renderUnavailable?: () => ReactNode;
210
+ /** The screen the flow starts on; the booking flow when omitted. */
211
+ readonly initialScreen?: TelevetScreen;
212
+ readonly style?: StyleProp<ViewStyle>;
213
+ /** Your own placeholder while the entitlement verdict is pending on a cold mount. */
214
+ readonly renderPending?: () => ReactNode;
215
+ }
216
+ declare function EverfurTelevetFlow(props: EverfurTelevetProps): ReactNode;
217
+ /** The public prebuilt televet surface: the flow, starting at booking. */
218
+ declare const EverfurTelevet: typeof EverfurTelevetFlow;
219
+
220
+ interface EverfurTelevetRescheduleProps {
221
+ /** The consult being moved. Null while the host is still loading it. */
222
+ readonly consult: TelevetConsult | null;
223
+ readonly onRescheduled?: (moved: TelevetConsult) => void;
224
+ /** Backing out. Never destructive: the original consult is left exactly as it was. */
225
+ readonly onCancel?: () => void;
226
+ /** Host/test seam: inject a booking controller instead of building one from the provider's session. */
227
+ readonly controller?: TelevetBookingController;
228
+ readonly style?: StyleProp<ViewStyle>;
229
+ readonly testID?: string;
230
+ }
231
+ declare function EverfurTelevetReschedule(props: EverfurTelevetRescheduleProps): ReactNode;
232
+
233
+ interface TelevetDay {
234
+ readonly key: string;
235
+ readonly iso: string;
236
+ readonly weekday: string;
237
+ readonly dayNumber: string;
238
+ }
239
+ interface TelevetDayStripProps {
240
+ readonly slots: readonly TelevetSlot[];
241
+ readonly selectedDayKey: string | null;
242
+ readonly onSelectDay: (day: TelevetDay) => void;
243
+ }
244
+ /** The day strip. Renders nothing when the window holds no readable day. */
245
+ declare function TelevetDayStrip({ slots, selectedDayKey, onSelectDay }: TelevetDayStripProps): ReactNode;
246
+ /**
247
+ * The distinct local days the slots cover, in server order.
248
+ *
249
+ * Exported for the picker, which needs the first day to seed the selection, and for the suite.
250
+ */
251
+ declare function televetDaysFromSlots(slots: readonly TelevetSlot[]): readonly TelevetDay[];
252
+
253
+ interface TelevetSlotPickerProps {
254
+ /** The server's full window. Never truncated: the day filter is what bounds it. */
255
+ readonly slots: readonly TelevetSlot[];
256
+ /** The slot whose hold is in flight, or null. Disables the whole grid. */
257
+ readonly busySlotId: string | null;
258
+ readonly onPick: (slot: TelevetSlot) => void;
259
+ /** Rendered above the strip, for example a failure line from the container. */
260
+ readonly ListHeaderComponent?: ComponentType | ReactElement | null;
261
+ readonly rowTestIdPrefix?: string;
262
+ readonly testID?: string;
263
+ }
264
+ declare function TelevetSlotPicker({ slots, busySlotId, onPick, ListHeaderComponent, rowTestIdPrefix, testID, }: TelevetSlotPickerProps): ReactNode;
265
+
266
+ /** One "label ... value" row in the summary card. */
267
+ declare function TelevetSummaryRow({ label, value, last, testID, }: {
268
+ readonly label: string;
269
+ readonly value: string;
270
+ /** The last row draws no divider, so the card does not end on a line. */
271
+ readonly last?: boolean;
272
+ readonly testID?: string;
273
+ }): ReactNode;
274
+ /**
275
+ * A consent tick.
276
+ *
277
+ * A REAL CHECKBOX, not a pill button. A filled pill reads as "press to continue" while a checkbox reads as
278
+ * "you are agreeing to this", and these ticks are the owner's licensure attestation and their cancellation
279
+ * agreement. `accessibilityRole="checkbox"` with a `checked` state is also what makes a screen reader announce
280
+ * it as an agreement rather than a button.
281
+ */
282
+ declare function TelevetConsentCheckbox({ label, checked, onToggle, testID, }: {
283
+ readonly label: string;
284
+ readonly checked: boolean;
285
+ readonly onToggle: (next: boolean) => void;
286
+ readonly testID?: string;
287
+ }): ReactNode;
288
+ /** The summary card's own frame, exported so the container does not re-declare it. */
289
+ declare function TelevetSummaryCard({ children, testID }: {
290
+ readonly children: ReactNode;
291
+ readonly testID?: string;
292
+ }): ReactNode;
293
+
294
+ export { BACK_LABEL, EverfurTelevet, EverfurTelevetBooking, type EverfurTelevetBookingProps, EverfurTelevetFlow, type EverfurTelevetProps, EverfurTelevetReschedule, type EverfurTelevetRescheduleProps, PetRef, TelevetBookedScreen, type TelevetBookedScreenProps, TelevetBookingChrome, type TelevetBookingChromeProps, TelevetBookingController, type TelevetBookingFailure, TelevetBookingStep, type TelevetCalendarEvent, type TelevetCalendarWriter, TelevetConsentCheckbox, TelevetConsult, type TelevetDay, TelevetDayStrip, type TelevetDayStripProps, type TelevetDiscardConfirm, TelevetIntakeMedia, type TelevetIntakeMediaItem, type TelevetIntakeMediaProps, type TelevetLocationStatus, type TelevetMediaPicker, type TelevetScreen, TelevetSlot, TelevetSlotPicker, type TelevetSlotPickerProps, TelevetSummaryCard, TelevetSummaryRow, televetConsultCalendarKey, televetDaysFromSlots };
@@ -0,0 +1 @@
1
+ import {createContext,forwardRef,createElement,useMemo,useState,useEffect,useReducer,useCallback,useRef,useContext,Component,useSyncExternalStore}from'react';import {TextInput,Linking,View,StyleSheet,Alert,BackHandler,Pressable,Image,ActivityIndicator,ScrollView,Text}from'react-native';import {jsxs,jsx}from'react/jsx-runtime';var Wi=Object.defineProperty;var o=(e,t)=>Wi(e,"name",{value:t,configurable:true});function mt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(mt,"assertNever");function un(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(un,"errorFrame");function Zt(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(Zt,"reportHostFailure");function $i(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o($i,"isThenable");function Qe(e,...t){if(typeof e=="function")try{let r=e(...t);return $i(r)&&Promise.resolve(r).then(void 0,Zt),r}catch(r){Zt(r);return}}o(Qe,"callHost");var cn=new WeakMap;function Yi(e){if(typeof e!="function")return;let t=cn.get(e);if(t!==void 0)return t;let r=o((...n)=>{Qe(e,...n);},"guarded");return cn.set(e,r),r}o(Yi,"guardHost");function je(e,t){let r=null;for(let n of t){let i=e[n];typeof i=="function"&&(r??={...e},r[n]=Yi(i));}return r??e}o(je,"guardHostProps");function gt(e,...t){let r;try{r=e(...t);}catch(n){return Zt(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}o(gt,"callHostAsync");var m=o(e=>e,"DRAFT"),Gi=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Xi(e){return Gi.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Xi,"isPlaceholderCopy");function ue(e,t){let r=e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(i);return r}o(ue,"fill");var c=Object.freeze({stateBlockedTitle:m("Not available in this state yet"),noCliniciansTitle:m("No vets available right now"),noCliniciansBody:m("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:m("Check again"),yourVetTitle:m("Your Vet"),reviewsLabel:m("reviews"),rescheduleFromTemplate:m("Moving your visit on {when}"),rescheduleFailed:m("That did not move. Your original time is unchanged."),keepExistingCta:m("Keep my current time"),bookingPausedTitle:m("Booking is not available right now."),slotsErrorTitle:m("Could not load times"),noSlotsTitle:m("No times available"),nextOpeningTemplate:m("Next opening across our vets: {when}"),seeOtherVetsCta:m("See other vets"),retryCta:m("Try again"),holdExpired:m("That time is no longer held. Pick another."),slotTaken:m("That time was just taken. Pick another."),reasonPlaceholder:m("What is going on with your pet?"),reasonTooLong:m("That is too long. Please shorten it."),shareRecordsOff:m("Share health records with this vet"),confirmNotEntitled:m("A Pro membership is needed to book a video visit."),confirmFailed:m("That did not book. Try again."),navTitle:m("Book a visit"),rescheduleNavTitle:m("Change your visit"),close:m("Close"),continueCta:m("Continue"),petSelectTitle:m("Who is this visit for?"),addPetCta:m("Add a pet"),locationUnknownTitle:m("We need your location to find a vet"),locationUnknownBody:m("Turn on location for Everfur, then try again."),locationUnknownCta:m("Allow location"),locationBlockedTitle:m("Location is turned off"),locationBlockedBody:m("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:m("Open Settings"),locationUnavailableTitle:m("We could not read your location"),locationUnavailableBody:m("Try again in a moment."),stateAttestTemplate:m("I confirm my pet and I are in {state} right now."),describeHeading:m("or Type to the vet what you're seeing"),describeHelpLong:m("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:m("ADD PHOTO OR VIDEO"),removePhotoLabel:m("Remove photo"),summaryPet:m("Pet"),summaryVet:m("Vet"),summaryWhen:m("When"),summaryLength:m("Length"),summaryReason:m("Reason"),summaryLengthTemplate:m("{n} minutes"),confirmCta:m("Confirm visit"),bookedTitle:m("You are booked."),addToCalendarCta:m("Add to calendar"),doneCta:m("Done"),booked:Object.freeze({remindPromise:m("We will notify you 30 minutes before."),summaryPromise:m("{pet}'s summary goes to the vet ahead of the call."),joinPromise:m("Join right here in the app. No links to hunt for."),backToPet:m("Back to {pet}"),calendarAdded:m("Added to your calendar"),calendarFailedBody:m("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:m("Closes without saving"),discardTitle:m("Leave without booking?"),discardBody:m("Your answers will not be saved."),discardConfirmCta:m("Leave"),discardKeepCta:m("Keep going"),noPetsTitle:m("No pets on this account"),loadFailedTitle:m("Could not load"),retryCta:m("Try again")}),emergency:Object.freeze({bannerTitle:m("This cannot wait for a scheduled call."),keepBookingCta:m("I have handled this, keep booking"),lede:m("What you are describing is the kind of thing vets want to see in person, now. Please call one of these first.")}),visit:Object.freeze({title:m("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function fn(e=c){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>fn(t))}o(fn,"televetBookingCopyValues");function ce(){return fn().every(e=>e.trim().length>0&&!Xi(e))}o(ce,"isTelevetBookingCopyReady");function tr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))tr(e[t]);}return e}o(tr,"deepFreeze");var Zi=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),yn={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},mn={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},pn={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ji={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},el={regular:"400",medium:"500",bold:"700"},tl={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},rl=0,vt="System",bt="monospace",nl=["content","heading","control","compact","badge"];function ol(e){let t={};for(let r of nl)t[r]=e;return t}o(ol,"authoredTierSizes");function gn(){return {family:vt,mono:bt,fontUrl:null,families:{regular:vt,medium:vt,bold:vt,mono:bt,monoMedium:bt,monoBold:bt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:pn,tierSizes:ol(pn),lineHeight:Ji,weight:el,letterSpacing:tl,scale:1,maxScale:rl,scaleCaps:Zi}}o(gn,"baseType");var vn={},Jt=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function er(e){return `cubic-bezier(${e.join(", ")})`}o(er,"cssCubicBezier");var bn={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:er(Jt.standard),emphasized:er(Jt.emphasized),exit:er(Jt.exit)},reducedMotion:false},il={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)"},hn=tr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:il,space:yn,radius:mn,type:gn(),motion:bn,slots:vn}),ll={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)"};tr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:ll,space:yn,radius:mn,type:gn(),motion:bn,slots:vn});var Tn=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),En=globalThis,rr=En[Tn]??(En[Tn]=createContext(hn));rr.displayName??="EverfurThemeContext";function C(){return useContext(rr)}o(C,"useEverfurTheme");function fl(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}o(fl,"tierMultiplier");function b({tier:e="content",...t}){let{type:r}=C(),n=fl(r,e);return createElement(Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}o(b,"Text");var _n=forwardRef(o(function(t,r){return createElement(TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var pl=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function E(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[pl[t]]}}o(E,"face");var ir=class ir extends Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(ir,"HostRenderBoundary");var nr=ir;function ml({render:e}){return e()}o(ml,"RenderHost");function or({render:e,fallback:t,resetKey:r}){return createElement(nr,{fallback:t,resetKey:r,children:createElement(ml,{render:e})})}o(or,"HostRender");var lr=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(lr.map(e=>e.wireCode));var gl=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"}),Cn=Object.freeze(lr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:gl[e.wireCode]}))),vl=new Map(Cn.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),bl=Object.freeze(["http_envelope",...[...new Set(Cn.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function ht(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...bl]){let i=vl.get(n+r);if(i)return i}}o(ht,"contractErrorFor");function hl(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(hl,"contractDocUrl");function xn(e){return null}o(xn,"publishedDocUrl");var Tl=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 wn(e){return Tl[e]}o(wn,"categoryFor");function Pn(e){let t=ht(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(Pn,"fromWire");var El=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ar(e){return El.has(e)}o(ar,"isAutoRetryable");var kl=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function In(e){return ar(e)||kl.has(e)}o(In,"isRetryableCode");var _l=500,sr=8e3,On=4;function An(e,t=Math.random){let r=Math.max(0,e),n=Math.min(_l*2**r,sr);return Math.floor(t()*n)}o(An,"backoffDelayMs");var Sl=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 dr(e){return Sl[e]}o(dr,"userFacingError");function Fn(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Fn,"defineHidden");var Rl=/^[a-z][a-z0-9_]{0,63}$/;function U(e,t){let r=ht(t?.wireCode,t?.wireEnvelope),n={code:e,category:wn(e),retryable:t?.retryable??In(e),displayMessage:dr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Rl.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Fn(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Fn(n,"raw",t.raw),Object.freeze(n)}o(U,"makeEverfurError");var Cl=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function xl(e){return Cl[e]}o(xl,"requires");function Dn(e,t,r){let n=xl(e),i=new Map;for(let s of t)i.set(s.resource,s);if(r?.isPending===true&&n.some(s=>!i.has(s)))return ur({name:e,enabled:false,isPending:true,limits:{}});let l=wl(n,i);return n.filter(s=>i.get(s)?.granted!==true).length===0?ur({name:e,enabled:true,isPending:false,limits:l}):ur({name:e,enabled:false,isPending:false,limits:l,disabled:Pl(n,i)})}o(Dn,"decideCapability");function wl(e,t){let r={};for(let n of e){let i=t.get(n)?.limits;if(i)for(let[l,a]of Object.entries(i)){let s=r[l];r[l]=s===void 0?a:Math.min(s,a);}}return r}o(wl,"mergeLimits");function Pl(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:dr("accessDenied"),level:"user_entitlement",recoverable:false})}o(Pl,"disabledFor");function ur(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}o(ur,"freezeDecision");function F(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(F,"ok");function R(e){return Object.freeze({ok:false,error:e})}o(R,"err");var Tt=class Tt extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Tt.prototype);}};o(Tt,"EverfurConfigError");var Ze=Tt;var Vn=Symbol.for("@everfur/sdk#EverfurContext@v1"),Bn=globalThis,Nn=Bn[Vn]??(Bn[Vn]=createContext(null));Nn.displayName??="EverfurContext";function fe(){let e=useContext(Nn);if(e===null)throw new Ze("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(fe,"useEverfurContext");function we(e){let{runtime:t}=fe(),r=t.entitlements,n=useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return useMemo(()=>Dn(e,n.decisions,{isPending:n.isPending}),[e,n])}o(we,"useCapability");var Dl=48;function Vl(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Vl,"selectView");function Mn(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:l}=e,a=we(t),s=useMemo(()=>Vl(a),[a]);switch(s){case "enabled":return r;case "pending":return i?jsx(or,{render:i,fallback:jsx(zn,{capability:t,style:l})}):jsx(zn,{capability:t,style:l});case "disabled":return n?jsx(or,{render:()=>n(a),fallback:jsx(jn,{decision:a,style:l}),resetKey:a}):jsx(jn,{decision:a,style:l});default:return mt(s)}}o(Mn,"CapabilityGate");function zn({capability:e,style:t}){let r=C(),n=useMemo(()=>Hn(r),[r]);return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsx(View,{style:n.skeletonBar})})}o(zn,"PendingSkeleton");function jn({decision:e,style:t}){let r=C(),n=useMemo(()=>Hn(r),[r]),i=e.disabled?.reason??"";return jsx(View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?jsx(b,{style:n.offstateText,children:i}):null})}o(jn,"OffState");function Hn(e){let{color:t,space:r,radius:n,type:i}=e;return StyleSheet.create({offstate:{minHeight:Dl,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...E(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}o(Hn,"makeStyles");function Et(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(Et,"details");function Bl(e){let t=Et(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(Bl,"categoriesOf");function Un(e){let t=Et(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Un,"retryAfterOf");function Wn(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=Et(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o(Wn,"messageOf");function Nl(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=Et(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(Nl,"codeOf");function Pe(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Un(e),message:Wn(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(Nl(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Un(e),message:Wn(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:Bl(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Pe,"televetBookingRefusal");function Ll(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(Ll,"authHeaders");function Je(e,t){return {...e,headers:{...zl(e.headers),...Ll(t)}}}o(Je,"withAuthHeaders");function zl(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(zl,"stripAuthHeaders");async function qn(e,t){if(t.mode==="anonymous")return t.transport.request(Je(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return R(pr())}let n=await t.transport.request(Je(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 R(pr())}let l=await t.transport.request(Je(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?R(pr(l.error.httpStatus)):l}o(qn,"authedSend");function pr(e){return U("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(pr,"authRejectedError");function Kn(e){return U("internalError",{retryable:true,wireMessage:jl(e)})}o(Kn,"networkError");function jl(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(jl,"describeCause");var Ml=3e4,Hl=sr*2,Ul="idempotency-key",Wl=new Set(["POST","PUT","PATCH","DELETE"]),ql=Object.freeze({onEvent(){}}),Kl=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function $l(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o($l,"seededIdempotencyKey");function Ie(e){let t=e.observer??ql,r=e.timers??Kl,n=e.rng??Math.random,i=e.sleep??((p,y)=>la(p,r,y)),l=e.maxAttempts??On,a=e.unaryTimeoutMs??Ml,s=e.newIdempotencyKey??Gl(),u=o(p=>{try{t.onEvent(p);}catch{}},"emit");async function d(p,y,h){let x=h?.maxAttempts,T=Math.max(1,x??l),_=h?.idempotent??Wl.has(y.method),V=h?.idempotencyKey===void 0?null:$l(h.idempotencyKey),w=_?V??s():null,O=Yl(y,w),P=0;for(;;){let I=o(ee=>Object.freeze({call:p,method:y.method,path:y.path,attempt:P,...w?{idempotencyKey:w}:{},...ee}),"stamp");u(I({phase:"attempt"}));let te=oa(a,r),Q=ia(te.signal,y.signal),B;try{B=await qn({...O,signal:Q.signal},e.auth);}catch(ee){B=R(Kn(ee));}finally{Q.dispose(),te.cancel();}if(B.ok)return u(I({phase:"settled",ok:true,reason:"ok"})),B;let k=B.error,A=Ql(k,P,{maxAttempts:T,rng:n,now:r.now(),aborted:y.signal?.aborted===true,...x!==void 0?{perCallMaxAttempts:x}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Z={ok:false,code:k.code,reason:A.reason,...k.httpStatus!==void 0?{httpStatus:k.httpStatus}:{},...k.requestId!==void 0?{requestId:k.requestId}:{}};if(!A.retry)return u(I({phase:"settled",...Z})),R(k);if(u(I({phase:"retry",...Z,delayMs:A.delayMs})),await i(A.delayMs,y.signal),y.signal?.aborted===true)return u(I({phase:"settled",...Z,reason:"aborted"})),R(k);P+=1;}}o(d,"send");async function f(p){return Je(p,await na(e.auth))}o(f,"authorize");async function*v(p,y,h){u(Object.freeze({call:p,phase:"stream.open",method:y.method,path:y.path,attempt:0}));try{yield*e.auth.transport.stream(y,h);}catch{yield un({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(v,"stream"),Object.freeze({send:d,authorize:f,stream:v})}o(Ie,"createRequestFunnel");function Yl(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==Ul&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(Yl,"assembleHeaders");function Gl(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(Gl,"defaultIdempotencyKeyFactory");var Xl=10;function Ql(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Zl(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!ar(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 a=o(()=>{if(r.policy===void 0)return null;let d;try{d=r.policy.maxAttempts(e.code);}catch{return null}return typeof d!="number"||!Number.isFinite(d)?null:Math.max(1,Math.min(Xl,Math.floor(d)))},"policyCeiling"),s=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=s)return {retry:false,reason:"attempts-exhausted"};let u=Jl(e,r.now);return u!==null?u>Hl?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:u}:{retry:true,reason:i,delayMs:An(t,r.rng)}}o(Ql,"decideRetry");function Zl(e){let t=e.code==="unknown"?Pn(ra(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(Zl,"throttleKind");function Jl(e,t){let r=ea(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}o(Jl,"retryOverrideMs");function ea(e){for(let t of Yn(e)){let r=t.resets_at,n=ta(r);if(n!==null)return n}return null}o(ea,"findResetsAt");function Yn(e){if(!$n(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];$n(n)&&t.push(n);}return t}o(Yn,"candidateScopes");function ta(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(ta,"parseInstantMs");function ra(e){for(let t of Yn(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(ra,"rawWireCode");function $n(e){return typeof e=="object"&&e!==null}o($n,"isRecord");async function na(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(na,"resolveDeviceAuth");function oa(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(oa,"boundedSignal");function ia(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(ia,"mergeSignals");function la(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n();},e),l=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",l,{once:true});})}o(la,"delayAbortable");function kt(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(kt,"hasLoneSurrogate");function _t(e){return [...e].length}o(_t,"serverLength");var Gn=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Xn(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Gn,t)?Gn[t]:null}o(Xn,"canonicalPetSpecies");var Qn=50,aa=128,yr=120,Zn=120,sa=2e3,Jn=120,da=80,ro=new Set(["male","female","unknown"]),no=new Set(["day","month","year"]),oo=new Set(["low","medium","high","athletic"]),io=new Set(["indoor","outdoor","both"]),lo=new Set(["mild","moderate","severe"]),ua=/^(\d{4})-(\d{2})-(\d{2})$/,ao=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],so=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...ao,...so].map(([e])=>e));function ca(e){let t=ua.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}o(ca,"isRealDate");var tt=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),fa=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),Rt=o((e,t)=>typeof t=="string"&&ca(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),oe=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(kt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return `${r} is required and must not be blank`;let l=_t(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},"text"),pa={sex:tt(ro),spayedNeutered:fa,birthDate:Rt,birthDatePrecision:tt(no),activityLevel:tt(oo),indoorOutdoor:tt(io),foodBrand:oe(Jn),foodType:oe(Jn),microchipId:oe(da)},mr=["ref","ref",false,oe(aa,{required:true,trimmed:true})],gr=["notes","notes",false,oe(sa,{trimmed:true})],eo=[mr,["name","name",true,oe(yr,{required:true,trimmed:true})],["dose","dose",false,oe(Zn,{trimmed:true})],["frequency","frequency",false,oe(Zn,{trimmed:true})],["startDate","start_date",false,Rt],["endDate","end_date",false,Rt],gr],ya={allergies:[mr,["allergen","allergen",true,oe(yr,{required:true,trimmed:true})],["severity","severity",false,tt(lo)],gr],medications:eo,supplements:eo,conditions:[mr,["conditionName","condition_name",true,oe(yr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Rt],gr]};function ma(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let i=r,l={};for(let[u,d,f,v]of ya[e]){let p=i[u];if(p==null){if(f)return {error:`${n}.${u} is required`};p===null&&(l[d]=null);continue}let y=v(`${n}.${u}`,p);if(y!==null)return {error:y};l[d]=p;}let a=l.start_date,s=l.end_date;return typeof a=="string"&&typeof s=="string"&&s<a?{error:`${n}.endDate must not be before startDate`}:{item:l}}o(ma,"itemToWire");function ga(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Qn)return {error:`${e} has ${t.length} items; the server accepts at most ${Qn}`};let r=[],n=new Set;for(let i=0;i<t.length;i+=1){let l=ma(e,i,t[i]);if("error"in l)return l;let a=l.item.ref;if(typeof a=="string"){let s=a.trim();if(n.has(s))return {error:`${e}: ref ${JSON.stringify(s)} is used twice; a ref names one item`};n.add(s);}r.push(l.item);}return {items:r}}o(ga,"listToWire");function uo(e,t){let r=e,n={};for(let[a,s]of ao){let u=r[a];if(u!==void 0){if(u!==null){let d=pa[a](a,u);if(d!==null)return {error:d}}n[s]=u;}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,s]of so){let u=r[a];if(u===void 0)continue;let d=ga(a,u);if("error"in d)return d;n[s]=d.items;}return Object.keys(n).length>0&&t!==void 0&&Xn(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}o(uo,"petHealthToWire");var z=o(e=>typeof e=="string"?e:null,"str"),et=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),va=o(e=>typeof e=="boolean"?e:null,"bool");function St(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}o(St,"itemsFromWire");function to(e){let t=z(e.name);return t===null||t.length===0?null:Object.freeze({ref:z(e.ref),name:t,dose:z(e.dose),frequency:z(e.frequency),startDate:z(e.start_date),endDate:z(e.end_date),notes:z(e.notes)})}o(to,"medicationFromWire");function co(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:et(ro,e.sex),spayedNeutered:va(e.spayed_neutered),birthDate:z(e.birth_date),birthDatePrecision:et(no,e.birth_date_precision),activityLevel:et(oo,e.activity_level),indoorOutdoor:et(io,e.indoor_outdoor),foodBrand:z(e.food_brand),foodType:z(e.food_type),microchipId:z(e.microchip_id),allergies:St(e.allergies,r=>{let n=z(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:z(r.ref),allergen:n,severity:et(lo,r.severity),notes:z(r.notes)})}),medications:St(e.medications,to),supplements:St(e.supplements,to),conditions:St(e.conditions,r=>{let n=z(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:z(r.ref),conditionName:n,diagnosedDate:z(r.diagnosed_date),notes:z(r.notes)})})})}o(co,"petHealthFromWire");var yo=100,mo=50,go=100,vo=50,bo=500,ba=128,ha=6e4;function le(e){return U("validationFailed",{retryable:false,wireMessage:e})}o(le,"invalid");function Oe(e,t,r){if(typeof t!="string")return le(`${e} must be a string`);let n=_t(t);return n<=r?null:le(`${e} is ${n} characters; the server accepts at most ${r}`)}o(Oe,"checkString");function Ct(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:le(`${e} must be a finite number between 0 and ${r}`)}o(Ct,"outOfRange");function fo(e,t){if(typeof e!="string")return le("pet_ref must be a string");if(e.trim().length===0)return le("pet_ref must not be blank");if(kt(e))return le("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return le("profile must be an object");let r=[Oe("pet_ref",e,ba)];return t?.name!==void 0&&r.push(Oe("name",t.name,yo)),t?.species!==void 0&&r.push(Oe("species",t.species,mo)),t?.breed!==void 0&&r.push(Oe("breed",t.breed,go)),t?.ageYears!==void 0&&r.push(Ct("age_years",t.ageYears,vo)),t?.weightKg!==void 0&&r.push(Ct("weight_kg",t.weightKg,bo)),r.find(n=>n!==null)??null}o(fo,"validate");function ho(e,t){let r=uo(e,t);return "error"in r?{error:le(r.error)}:r}o(ho,"healthToWire");function Ta(e){if(typeof e!="object"||e===null)return {error:le("patch must be an object")};let t=e,r=[["name","name",l=>Oe("name",l,yo)],["species","species",l=>Oe("species",l,mo)],["breed","breed",l=>Oe("breed",l,go)],["ageYears","age_years",l=>Ct("age_years",l,vo)],["weightKg","weight_kg",l=>Ct("weight_kg",l,bo)]],n={};for(let[l,a,s]of r){let u=t[l];if(u!==void 0){if(u!==null){let d=s(u);if(d!==null)return {error:d}}n[a]=u;}}let i=ho(t,t.species);return "error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:le("patch must change at least one field")}:{body:n})}o(Ta,"patchToWire");function Ea(e){if(e==null)return {body:{}};let t=ho(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}o(Ea,"toWire");var ie=o(e=>typeof e=="string"?e:null,"str"),xt=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function po(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:ie(r.pet_ref)??t,name:ie(r.name),species:ie(r.species),breed:ie(r.breed),ageYears:xt(r.age_years),weightKg:xt(r.weight_kg)})}o(po,"fromWire");function To(e){if(typeof e!="object"||e===null)return null;let t=e,r=ie(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:ie(t.pet_id),petRef:r,name:ie(t.name),species:ie(t.species),breed:ie(t.breed),ageYears:xt(t.age_years),weightKg:xt(t.weight_kg),updatedAt:ie(t.updated_at)})}o(To,"widgetPetFromWire");function ka(e){let t=To(e);return t===null?null:Object.freeze({...t,...co(e)})}o(ka,"widgetPetProfileFromWire");function _a(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=To(r);return n===null?[]:[n]}))}o(_a,"petListFromWire");function Eo(e){return Sa(Ie({auth:e}),Ie({auth:e,unaryTimeoutMs:ha}))}o(Eo,"createPetsRepository");function Sa(e,t=e){let r=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),n=o(i=>fo(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?F(_a(l.value)):R(l.error)},async registerPet(i,l,a){let s=fo(i,l);if(s!==null)return R(s);let u=Ea(l);if("error"in u)return R(u.error);let f={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:u.body},v=await e.send("pets.registerPet",a?.signal?{...f,signal:a.signal}:f);return v.ok?F(po(v.value,i)):R(v.error)},async updatePet(i,l,a){let s=n(i);if(typeof s!="string")return R(s);let u=Ta(l);if("error"in u)return R(u.error);let d=await e.send("pets.updatePet",r({method:"PATCH",path:s,body:u.body},a?.signal));return d.ok?F(po(d.value,i)):R(d.error)},async getPetProfile(i,l){let a=n(i);if(typeof a!="string")return R(a);let s=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},l?.signal));if(!s.ok)return R(s.error);let u=ka(s.value);return u===null?R(U("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):F(u)},async deletePet(i,l){let a=n(i);if(typeof a!="string")return R(a);let s=await e.send("pets.deletePet",r({method:"DELETE",path:a},l?.signal));return s.ok?F(void 0):R(s.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?F(void 0):R(l.error)}}}o(Sa,"createPetsRepositoryOver");function ko(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=fe(),i=useMemo(()=>Eo(e.registry.services.authFor(t)),[e,t,n]),[l,a]=useState({repository:i,pets:[],loading:true,error:null}),s=l.repository===i?l:{pets:[],loading:true,error:null},u=useRef(0),d=useCallback(async()=>{let v=++u.current;a(y=>({...y,repository:i,loading:true,error:null,pets:y.repository===i?y.pets:[]}));let p=await i.list();v===u.current&&a(p.ok?{repository:i,pets:p.value,loading:false,error:null}:y=>({repository:i,pets:y.repository===i?y.pets:[],loading:false,error:p.error}));},[i]);useEffect(()=>(d(),()=>{u.current+=1;}),[d]);let f=useMemo(()=>r===null?null:s.pets.find(v=>v.petRef===r)??null,[r,s.pets]);return useMemo(()=>({pets:s.pets,activePet:f,loading:s.loading,error:s.error,refresh:d}),[s.pets,s.loading,s.error,f,d])}o(ko,"useEverfurPets");var Ro=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],Pa=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),Co=["wellness","prescription"],wt=64,pe=2e3,Pt=10;function ae(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(ae,"isWellFormedStateCode");function he(e){return typeof e=="object"&&e!==null?e:null}o(he,"row");function W(e){return typeof e=="string"&&e.length>0?e:null}o(W,"str");function Ae(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(Ae,"trimmedOrNull");function rt(e,t){return typeof e=="boolean"?e:t}o(rt,"bool");function _o(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(_o,"num");function So(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(So,"closed");function nt(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let i=t(n);i!==null&&r.push(i);}return Object.freeze(r)}o(nt,"parseList");function xo(e,t){let r=he(e);return r===null?null:Object.freeze({state:W(r.state)??t,wellnessAvailable:rt(r.wellness_available,false),prescriptionsAvailable:rt(r.prescriptions_available,false),cancellationPolicyText:Ae(r.cancellation_policy_text)})}o(xo,"parseStatePolicy");function wo(e){let t=he(e);if(t===null)return null;let r=Ae(t.summary),n=Ae(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(wo,"parseCancellationPolicy");function Po(e){let t=he(e);if(t===null)return null;let r=W(t.clinician_id),n=W(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:Ae(t.credentials_text),rating:_o(t.rating),ratingCount:_o(t.rating_count),bio:Ae(t.bio),photoRef:W(t.photo_ref),licensedStates:nt(t.licensed_states,i=>{let l=he(i),a=l===null?null:W(l.state);return a===null?null:Object.freeze({state:a,canPrescribe:rt(l?.can_prescribe,false)})})})}o(Po,"parseClinician");function br(e){let t=he(e);if(t===null)return null;let r=W(t.slot_id),n=W(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:W(t.ends_at)??n})}o(br,"parseSlot");function Io(e){let t=he(e);if(t===null)return null;let r=W(t.slot_id),n=W(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(Io,"parseSlotHold");function hr(e){let t=he(e);if(t===null)return null;let r=W(t.consult_id),n=W(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:W(t.pet_id)??"",clinicianId:W(t.clinician_id)??"",clinicianName:Ae(t.display_name),reasonText:Ae(t.reason_text),mediaRefs:nt(t.media_refs,i=>W(i)),status:So(Ro,t.status),kind:So(Co,t.kind),scheduledAt:n,emergencyFlagged:rt(t.emergency_flagged,false)})}o(hr,"parseConsult");function Oo(e){let t=he(e);return Object.freeze({active:rt(t?.active,false)})}o(Oo,"parseBookingEntitlement");var Fe=Object.freeze(["pet","reason","clinician","time","review","booked"]),Ao=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Er(e,t={}){let r=Object.freeze({...Ao,...t}),n=Tr(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Er,"initialTelevetBookingState");function It(e,t){return e==="pet"?t.ownedPetCount<=1:false}o(It,"isSkipped");function Ot(e){return Fe[e]}o(Ot,"stepAt");function Tr(e,t){for(let r=e;r<Fe.length;r+=1){let n=Ot(r);if(n&&!It(n,t))return r}return Fe.length-1}o(Tr,"nextVisible");function Fo(e,t){for(let r=e;r>=0;r-=1){let n=Ot(r);if(n&&!It(n,t))return r}return null}o(Fo,"previousVisible");function kr(e,t){return Fo(e.index-1,t)!==null}o(kr,"hasPreviousStep");function _r(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Tr(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(Ot(e.index)==="booked")return e;let n=Fo(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=Fe.indexOf(t.step);if(n<0)return e;let i=It(t.step,r)?Tr(n,r):n;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(_r,"televetBookingReducer");function Sr(e){return Ot(e.index)??"pet"}o(Sr,"currentStep");function At(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&ae(e.state)&&r.length>0&&r.length<=pe}o(At,"canConfirm");function Rr(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(Rr,"isHoldExpired");function Cr(e){return `televet.book.${e}`}o(Cr,"televetBookingKey");function xr(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(xr,"attestation");function Te(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(Te,"parse");function Me(e){let t=Te(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(Me,"formatClock");function Ia(e){let t=Te(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(Ia,"formatDate");var He=10;function ot(e){let t=Te(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"":""}o(ot,"formatZone");function Oa(e){let t=Te(e);if(!t)return "";let r=new Date(t.getTime()+He*6e4).toISOString(),n=ot(e),i=`${Me(e)} - ${Me(r)}`;return n&&n!==""?`${i} ${n}`:i}o(Oa,"formatVisitRange");function Do(e){let t=Ia(e),r=[Me(e),ot(e)].filter(Boolean).join(" ");return [t,r].filter(Boolean).join(", ")}o(Do,"formatWhen");function ye(e){let t=Te(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),Do(e)].filter(Boolean).join(", "):""}o(ye,"formatWhenWithDay");function Ft(e){let t=Te(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(Ft,"localDayKey");function Vo(e){let t=Te(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(Vo,"formatMonthLabel");function Bo(e){let t=Te(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(Bo,"formatFullDayLabel");var ke="/widget/v1/televet",Aa=`${ke}/state-policy`,Fa=`${ke}/vets`,Lo=`${ke}/slots`,Da=`${ke}/slots/next`,zo=`${ke}/consults`,Va=`${ke}/entitlement`,Ba=`${ke}/cancellation-policy`;function jo(e){return `${Lo}/${encodeURIComponent(e)}/hold`}o(jo,"televetHoldCall");function Mo(e){return `${zo}/${encodeURIComponent(e)}/reschedule`}o(Mo,"televetRescheduleCall");function Ee(e){return R(U("validationFailed",{retryable:false,wireMessage:e}))}o(Ee,"invalid");function Dt(e){return R(U("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Dt,"unusable");function Vt(e){return e.httpStatus===404}o(Vt,"isDark");function wr(e,t,r){try{e?.track(t,r);}catch{}}o(wr,"safeTrack");function Ho(e){if(e.pet_id.trim().length===0)return "pet_id is required";if(e.clinician_id.trim().length===0)return "clinician_id is required";if(e.slot_id.trim().length===0)return "slot_id is required";if(!ae(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>pe?`reason_text must be at most ${pe} characters`:Na(e)}o(Ho,"validateBookingBody");function Na(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>wt?`cancellation_policy_version must be at most ${wt} characters`:null}o(Na,"attestationRefusal");function Pr(e){let t=e.funnel??Ie({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,i){let l=n.trim();if(!ae(l))return Ee("state must be a two-letter US state code");let a=await t.send("televet.booking.state_policy",{method:"GET",path:`${Aa}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!a.ok)return Vt(a.error)?F(Object.freeze({state:l,wellnessAvailable:false,prescriptionsAvailable:false,cancellationPolicyText:null})):R(a.error);let s=xo(a.value,l);return s===null?Dt("the state policy response was unreadable"):F(s)},async entitlement(n){let i=await t.send("televet.booking.entitlement",{method:"GET",path:Va,...n?{signal:n}:{}});return i.ok?F(Oo(i.value)):Vt(i.error)?F(Object.freeze({active:false})):R(i.error)},async cancellationPolicy(n){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:Ba,...n?{signal:n}:{}});return i.ok?F(wo(i.value)):F(null)},async clinicians(n,i){let l=n.trim();if(!ae(l))return Ee("state must be a two-letter US state code");let a=await t.send("televet.booking.clinicians",{method:"GET",path:Fa,query:{state:l},...i?{signal:i}:{}});return a.ok?F(nt(No(a.value,"vets"),Po)):Vt(a.error)?F(Object.freeze([])):R(a.error)},async slots(n,i){let l=n.trim();if(l.length===0)return Ee("clinicianId is required");let a=await t.send("televet.booking.slots",{method:"GET",path:Lo,query:{clinician_id:l},...i?{signal:i}:{}});return a.ok?F(nt(No(a.value,"slots"),br)):Vt(a.error)?F(Object.freeze([])):R(a.error)},async nextSlot(n){let i=await t.send("televet.booking.next_slot",{method:"GET",path:Da,...n?{signal:n}:{}});return i.ok?F(br(za(i.value,"slot"))):F(null)},async holdSlot(n){let i=n.trim();if(i.length===0)return Ee("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:jo(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return wr(r,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),R(l.error);let a=Io(l.value);return a===null?Dt("the hold response carried no usable expiry"):F(a)},async book(n,i){let l=Ho(n);if(l!==null)return Ee(l);let a=i.trim();if(a.length===0)return Ee("idempotencyKey is required");let s=await t.send("televet.booking.book",{method:"POST",path:zo,body:La(n)},{idempotent:true,idempotencyKey:a,maxAttempts:1});if(!s.ok)return wr(r,"televet.booking.book_failed",{status:s.error.httpStatus??null}),R(s.error);let u=hr(s.value);return u===null?Dt("the booking response was unreadable"):F(u)},async reschedule(n,i){let l=n.trim(),a=i.trim();if(l.length===0)return Ee("consultId is required");if(a.length===0)return Ee("slotId is required");let s=await t.send("televet.booking.reschedule",{method:"POST",path:Mo(l),body:{new_slot_id:a}},{idempotent:false,maxAttempts:1});if(!s.ok)return wr(r,"televet.booking.reschedule_failed",{status:s.error.httpStatus??null}),R(s.error);let u=hr(s.value);return u===null?Dt("the reschedule response was unreadable"):F(u)}}}o(Pr,"createTelevetBookingController");function La(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(La,"bookingWireBody");function No(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(No,"rows");function za(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(za,"unwrap");function it(e){let{runtime:t,userRef:r,scopeEpoch:n}=fe();return useMemo(()=>{if(e)return e;if(r===null)return null;let{services:i}=t.registry;return Pr({auth:i.authFor(r),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,r,n,e])}o(it,"useTelevetBookingController");function ja(){let{userRef:e}=fe(),t=we("televet");return useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(ja,"useTelevetBookingAvailable");function Ue(e,t,r){let[n,i]=useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[l,a]=useState(0),s=useRef(r);s.current=r,useEffect(()=>{let f=s.current;if(!t||f===null){i({key:e,data:null,isPending:false,error:null});return}let v=new AbortController,p=true;return i(y=>y.key===e?{...y,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let y;try{y=await f(v.signal);}catch{p&&i({key:e,data:null,isPending:false,error:null});return}p&&(y.ok?i({key:e,data:y.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:y.error}));})(),()=>{p=false,v.abort();}},[e,t,l]);let u=useCallback(()=>a(f=>f+1),[]),d=n.key===e;return useMemo(()=>({enabled:t,data:d?n.data:null,isPending:t&&(!d||n.isPending),isError:d&&n.error!==null,error:d?n.error:null,refetch:u}),[t,d,n.data,n.isPending,n.error,u])}o(Ue,"useTelevetRead");function Or(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&ae(r),i=t?.statePolicy;return Ue(`state-policy:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Or,"useTelevetStatePolicy");function Ar(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return Ue("entitlement",t,t&&r?n=>r.call(e,n):null)}o(Ar,"useTelevetBookingEntitlement");function Fr(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return Ue("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(Fr,"useTelevetCancellationPolicy");function Dr(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&ae(r),i=t?.clinicians;return Ue(`clinicians:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Dr,"useTelevetClinicians");function lt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return Ue(`slots:${r}`,n,n&&t?i=>t.slots(r,i):null)}o(lt,"useTelevetSlots");function Vr(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return Ue("next-slot",t,t&&r?n=>r.call(e,n):null)}o(Vr,"useTelevetNextSlot");function Br(e){let[t,r]=useState(null),n=useRef(true),i=useRef(false),l=useRef(e);l.current=e,useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let a=useCallback((...s)=>{let u=l.current;if(u===null||i.current)return;let d=s[s.length-1],f=typeof d=="object"&&d!==null&&("onSuccess"in d||"onError"in d),v=f?d:void 0,p=f?s.slice(0,-1):s;i.current=true,r({variables:p[0]??null}),(async()=>{let y=null;try{y=await u(...p);}catch{y=null;}i.current=false,n.current&&r(null),y!==null&&(y.ok?v?.onSuccess?.(y.value):v?.onError?.(y.error));})();},[]);return useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:a}),[t,a])}o(Br,"useTelevetWrite");function at(e){return Br(e?t=>e.holdSlot(t):null)}o(at,"useTelevetHoldSlot");function Nr(e){return Br(e?(t,r)=>e.book(t,r):null)}o(Nr,"useTelevetBookConsult");function Lr(e,t){return Br(t&&e?r=>t.reschedule(e,r):null)}o(Lr,"useTelevetRescheduleConsult");function qo(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}o(qo,"slotBox");function Ko(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(Ko,"slotText");var $o=Object.freeze({visitButton:"Talk to a vet"});var Yo=null;function Go(){return Yo!==null}o(Go,"hasEverfurTelevetFlow");function Xo(e){return false;}o(Xo,"presentEverfurTelevetFlow");var zr=Object.freeze(["visit","join","summary","messages"]);function jr(e){return typeof e=="string"&&zr.includes(e)}o(jr,"isVetVisitIntent");var Ma="/widget/v1/televet/handoffs",Ha="/widget/v1/televet/availability",Ua="/widget/v1/televet/chat-entry",Wa=/^[a-z0-9][a-z0-9_-]{0,39}$/,qa=/^[A-Za-z0-9_-]{22}$/;var Qo=32,Zo=128,Jo=64;function Hr(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}o(Hr,"vetVisitErrorReasonOf");function ei(e){return R(U("validationFailed",{retryable:false,wireMessage:e}))}o(ei,"invalid");function Mr(e){return R(U("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(Mr,"unusable");function Ka(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!Wa.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let i=t?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=i;}let l=t?.visitRef,a=t?.intent,s=l!=null;if(s){let u=typeof l=="string"?l.trim():"";if(u.length<1||[...u].length>Jo)return {ok:false,message:`visitRef must be 1..${Jo} characters`};r.visit_ref=u;}if(a!=null){if(!s)return {ok:false,message:"intent needs the visitRef it opens"};if(!jr(a))return {ok:false,message:`intent must be one of ${zr.join(", ")}`};r.intent=a;}return {ok:true,body:r}}o(Ka,"handoffBody");function $a(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!jr(r)?null:Object.freeze({visitRef:t,intent:r})}o($a,"parseVisitEcho");function ri(e){let t=e.funnel??Ie({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=o(i=>(ti(r,"televet.visit.handoff_failed",{reason:Hr(i)}),R(i)),"failed");return {async createHandoff(i,l){let a;if(i!=null){let T=typeof i=="string"?[...i].length:0;if(T<1||T>Zo)return n(U("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Zo} characters`}));a=i;}let s=Ka(a,l);if(!s.ok){let T=ei(s.message);return T.ok?T:n(T.error)}let u=s.body,d=await t.send("televet.visit.handoff",{method:"POST",path:Ma,body:u},{idempotent:false,maxAttempts:1});if(!d.ok)return n(d.error);let f=Ya(d.value),v=u.return_to!==void 0,p=v?d.value?.flow_id:void 0;if(v&&(typeof p!="string"||!qa.test(p))){let T=Mr("the handoff response carried no usable return flow id");return T.ok?T:n(T.error)}let y=u.visit_ref!==void 0,h=y?$a(d.value?.visit):null;if(y&&h===null){let T=Mr("the handoff response did not confirm the visit it opens");return T.ok?T:n(T.error)}let x=f===null?null:Object.freeze({...f,...v?{flowId:p}:{},...h!==null?{visit:h}:{}});return x===null?n(U("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(ti(r,"televet.visit.handoff_created",{pet_scoped:u.pet_ref!==void 0}),F(x))},async checkAvailability(i){if(typeof i!="string"||i.length>Qo)return ei(`state must be at most ${Qo} characters`);let l=await t.send("televet.visit.availability",{method:"POST",path:Ha,body:{state:i}},{idempotent:false,maxAttempts:1});if(!l.ok)return R(l.error);let a=l.value?.available;return typeof a!="boolean"?Mr("the availability response carried no usable answer"):F(Object.freeze({available:a}))},async chatEntryOpen(){try{let i=await t.send("televet.visit.chat_entry",{method:"GET",path:Ua},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}o(ri,"createVetVisitController");function Ya(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Za(t)?null:Object.freeze({url:t,expiresAt:r})}o(Ya,"parseHandoff");var Ga=new Set(["localhost","127.0.0.1","[::1]"]),Xa=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Qa=/[\s\u0000-\u001f\u007f]/;function Za(e){if(Qa.test(e))return false;let t=Xa.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let i=n.replace(/:\d+$/,"").toLowerCase(),l=r==="https",a=r==="http"&&Ga.has(i);if(!l&&!a)return false;let s=e.indexOf("#");if(s<0)return false;let u=e.slice(s);return u.startsWith("#h=")&&u.length>3}o(Za,"isOpenableVisitUrl");function ti(e,t,r){if(e)try{e.track(t,r);}catch{}}o(ti,"safeTrack");var oi=Object.freeze({status:"idle",error:null,errorReason:null});function es(e,t,r){let{usState:n,chat:i,scope:l}=r,a=t&&(n!==null||i),s=`${n??""}|${i?"chat":""}`,[u,d]=useState(null);if(useEffect(()=>{if(!a)return;let v=true,p=e.current;return d(null),o(async()=>{try{if(i&&!(p.chatEntryOpen&&await p.chatEntryOpen()))return !1;if(n===null)return !0;if(!p.checkAvailability)return !1;let h=await p.checkAvailability(n);return h.ok&&h.value.available}catch{return false}},"ask")().then(h=>{v&&d({key:s,open:h});}),()=>{v=false;}},[a,s,n,i,l,e]),!a)return null;let f=u!==null&&u.key===s;return {open:f&&u.open,pending:!f}}o(es,"usePreflight");var ts=Object.freeze({status:"opening",error:null,errorReason:null});function li(e,t={}){let{runtime:r,userRef:n,scopeEpoch:i}=fe(),l=we("televet"),a=l.enabled&&n!==null,s=t.usState??null,u=t.entry==="chat",d=t.petRef??null,f=useMemo(()=>{if(t.controller)return t.controller;let{services:B}=r.registry;return ri({auth:B.authFor(n),telemetry:B.telemetry,...B.errorPolicy?{errorPolicy:B.errorPolicy}:{}})},[r,n,i,t.controller]),v=useRef(f);v.current=f;let p=useMemo(()=>({runtime:r,userRef:n,scopeEpoch:i}),[r,n,i]),y=es(v,a,{usState:s,chat:u,scope:p}),h=a&&(y===null||y.open)&&(!u||d!==null),x=t.returnTo??null,[T,_]=useState(oi),V=useRef(null),w=useRef({runtime:r,userRef:n,scopeEpoch:i});w.current={runtime:r,userRef:n,scopeEpoch:i};let O=useRef(f);O.current=f;let P=useRef(h);P.current=h;let I=useCallback((B,k)=>{if(V.current)return V.current;let A=o((K,ve)=>(_({status:K==="cancelled"?"idle":"error",error:ve,errorReason:K==="cancelled"?null:K}),Object.freeze({opened:false,reason:K,error:ve})),"fail");if(!P.current)return Promise.resolve(A("unavailable",null));let Z=e.prepare();if(!Z.ok)return Promise.resolve(A(Z.reason,null));let ee=w.current,se=O.current;_(ts);let Ye=(async()=>{let K,ve={...x!==null?{returnTo:x}:{},...u?{entry:"chat"}:{},...k!==null?{visitRef:k.visitRef}:{},...k!==null&&k.intent!==null&&k.intent!==void 0?{intent:k.intent}:{}},Ce=Object.keys(ve).length===0?void 0:ve,Ge=B===void 0?d:B;try{K=await(Ce===void 0?se.createHandoff(Ge):se.createHandoff(Ge,Ce));}catch{return e.abandon(Z.value),A("unknown",null)}let be=w.current;if(be.runtime!==ee.runtime||be.userRef!==ee.userRef||be.scopeEpoch!==ee.scopeEpoch)return e.abandon(Z.value),A("cancelled",null);if(!K.ok)return e.abandon(Z.value),A(Hr(K.error),K.error);let Xe=await e.finish(Z.value,K.value);return Xe!==null?A(Xe,null):(_(oi),Object.freeze(K.value.flowId===void 0?{opened:true}:{opened:true,flowId:K.value.flowId}))})().finally(()=>{V.current===Ye&&(V.current=null);});return V.current=Ye,Ye},[e,d,x,u]),te=useCallback(B=>I(B,null),[I]),Q=useCallback((B,k)=>I(void 0,{visitRef:B,intent:k??null}),[I]);return {available:h,isPending:l.isPending||(y?.pending??false),status:T.status,error:T.error,errorReason:T.errorReason,open:te,openVisit:Q}}o(li,"useVetVisitWith");var os=o(e=>Linking.openURL(e),"defaultOpenUrl");function ai(e={}){let{openUrl:t,...r}=e,n=useMemo(()=>{let i=t??os;return {prepare:o(()=>({ok:true,value:null}),"prepare"),async finish(l,a){try{return await i(a.url),null}catch{return "openFailed"}},abandon:o(()=>{},"abandon")}},[t]);return li(n,r)}o(ai,"useVetVisit");var si=44,ds=.6;function Lt(e){let{petRef:t,label:r,openUrl:n,onOpened:i,onError:l,style:a,labelStyle:s,controller:u,returnTo:d,usState:f,entry:v,visitRef:p,intent:y,onStartInApp:h,prefer:x}=e,T=ai({...d!==void 0?{returnTo:d}:{},...f!==void 0?{usState:f}:{},...v!==void 0?{entry:v}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...u!==void 0?{controller:u}:{}}),_=C(),V=useMemo(()=>us(_),[_]),w=useRef(false);if(!T.available)return null;let O=T.status==="opening",P=r??$o.visitButton,I=p!=null,te=x==="redirect"||I,Q=!te&&h!==void 0;return jsx(Pressable,{onPress:o(()=>{if(!(O||w.current)){if(Q){Qe(h);return}(w.current=true,(p==null?T.open():T.openVisit(p,y??null)).then(A=>{A.opened?Qe(i,A.flowId??null):A.reason!=="cancelled"&&Qe(l,A.reason,A.error);}).finally(()=>{w.current=false;}));}},"onPress"),accessibilityRole:"button",accessibilityLabel:P,accessibilityState:{busy:O,disabled:O},style:[V.button,O?V.busy:null,a],children:jsx(b,{style:[V.label,s],children:P})})}o(Lt,"VetVisitButton");function us(e){let{color:t,space:r,radius:n,type:i,slots:l}=e;return StyleSheet.create({button:{minHeight:si,minWidth:si,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...qo(l.vetVisitButton)},busy:{opacity:ds},label:{...E(e,"medium"),color:t.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...Ko(l.vetVisitButton)}})}o(us,"makeStyles");var Y=44;function j(){let e=C();return useMemo(()=>ms(e),[e])}o(j,"useBookingStyles");function $({label:e,onPress:t,kind:r="primary",disabled:n=false,loading:i=false,fullWidth:l=true,accessibilityLabel:a,testID:s,style:u}){let d=j(),f=C(),v=n||i;return jsxs(Pressable,{onPress:t,disabled:v,accessibilityRole:"button",accessibilityLabel:a??e,accessibilityState:{disabled:v,busy:i},style:[d.button,r==="primary"?d.buttonPrimary:d.buttonSecondary,l?d.buttonFull:d.buttonAuto,v?d.buttonDisabled:null,u],testID:s,children:[i?jsx(ActivityIndicator,{size:"small",color:r==="primary"?f.color.onPrimary:f.color.brand}):null,jsx(b,{tier:"control",style:r==="primary"?d.buttonPrimaryLabel:d.buttonSecondaryLabel,children:e})]})}o($,"TelevetButton");function L({title:e,message:t,actionLabel:r,onAction:n,testID:i}){let l=j(),a=typeof r=="string"&&r.length>0&&typeof n=="function";return jsxs(View,{style:l.stateCard,testID:i,children:[jsx(b,{style:l.stateTitle,accessibilityRole:"header",children:e}),t?jsx(b,{style:l.stateMessage,children:t}):null,a?jsx($,{label:r,onPress:n,kind:"secondary",fullWidth:false}):null]})}o(L,"TelevetStateCard");function Ve({height:e,width:t="100%",testID:r}){let n=j();return jsx(View,{style:[n.skeleton,{height:e,width:t}],testID:r,accessibilityElementsHidden:true,importantForAccessibility:"no"})}o(Ve,"TelevetSkeletonBlock");function G({message:e,assertive:t=false,testID:r,style:n}){let i=j();return jsx(b,{style:[i.failure,n],accessibilityLiveRegion:t?"assertive":"polite",testID:r,children:e})}o(G,"TelevetFailureLine");function ms(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},stepFill:{flex:1,minHeight:0,gap:r.md},list:{gap:r.sm},button:{minHeight:Y,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:Y},buttonPrimary:{backgroundColor:t.primary},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent"},buttonDisabled:{opacity:.45},buttonPrimaryLabel:{...E(e,"medium"),color:t.onPrimary,fontSize:l.body,lineHeight:l.body*a.snug},buttonSecondaryLabel:{...E(e,"medium"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.snug},stateCard:{minHeight:140,justifyContent:"center",gap:r.sm,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder},stateTitle:{...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},stateMessage:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},skeleton:{borderRadius:n.md,backgroundColor:t.skeleton},failure:{...E(e,"regular"),color:t.danger,fontSize:l.caption,lineHeight:l.caption*a.normal},stepTitle:{...E(e,"bold"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.snug},stepHelp:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal},divider:{height:1,backgroundColor:t.brandBorder},scrollRoot:{flex:1,minHeight:0},scrollBody:{flex:1},scrollFooter:{paddingTop:r.md,paddingBottom:r.lg}})}o(ms,"makeBookingStyles");function fi(e){return `televet-consult-${e}`}o(fi,"televetConsultCalendarKey");function qr({consult:e,petName:t,onDone:r,onAddToCalendar:n,canJoinInApp:i=false}){let l=C(),a=j(),s=useMemo(()=>hs(l),[l]),[u,d]=useState("idle"),f=o(async()=>{if(!n)return;d("saving");let p=new Date(e.scheduledAt);if(Number.isNaN(p.getTime())){d("failed");return}let y=await gt(n,{key:fi(e.consultId),title:c.visit.title,startDate:p,endDate:new Date(p.getTime()+He*6e4),alarmOffsetMinutes:-30});d(y.ok&&y.value===true?"saved":"failed");},"addToCalendar"),v=[c.booked.remindPromise,ue(c.booked.summaryPromise,{pet:t??""}),...i?[c.booked.joinPromise]:[]];return ce()?jsxs(View,{style:s.screen,testID:"televet-booked",children:[jsx(View,{style:s.header,children:jsx($,{label:c.doneCta,kind:"secondary",fullWidth:false,onPress:r,testID:"televet-booked-done"})}),jsx(View,{style:s.avatar,accessibilityElementsHidden:true,importantForAccessibility:"no"}),jsx(b,{tier:"heading",style:s.title,accessibilityRole:"header",children:c.bookedTitle}),jsx(b,{style:s.when,children:ye(e.scheduledAt)}),jsx(View,{style:s.steps,testID:"televet-booked-steps",children:v.map((p,y)=>jsxs(View,{style:s.step,children:[jsx(View,{style:s.stepNumber,accessibilityElementsHidden:true,importantForAccessibility:"no",children:jsx(b,{tier:"badge",style:s.stepNumberText,children:String(y+1)})}),jsx(b,{style:s.stepText,children:p.trim()})]},p))}),jsxs(View,{style:s.actions,children:[n?jsx($,{label:u==="saved"?c.booked.calendarAdded:c.addToCalendarCta,kind:"primary",loading:u==="saving",disabled:u==="saving"||u==="saved",onPress:()=>{f();},testID:"televet-booked-calendar"}):null,u==="failed"?jsx(b,{style:[a.failure,s.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:c.booked.calendarFailedBody}):null,jsx($,{label:t?ue(c.booked.backToPet,{pet:t}):c.doneCta,kind:"secondary",onPress:r,testID:"televet-booked-back"})]})]}):jsx(View,{style:s.screen,testID:"televet-booked-copy-unapproved"})}o(qr,"TelevetBookedScreen");function hs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},header:{alignItems:"flex-end",paddingBottom:r.lg},avatar:{alignSelf:"center",width:120,height:120,borderRadius:60,backgroundColor:t.surfaceSubtle,borderWidth:2,borderColor:t.success},title:{textAlign:"center",...E(e,"bold"),color:t.brand,fontSize:l.verdict,lineHeight:l.verdict*a.tight,letterSpacing:-0.7,paddingTop:r.lg},when:{textAlign:"center",...E(e,"regular"),color:t.text.metaCool,fontSize:l.subtitle,lineHeight:l.subtitle*a.normal},steps:{marginTop:r.xl,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder,gap:r.lg},step:{flexDirection:"row",alignItems:"flex-start",gap:r.md},stepNumber:{width:26,height:26,borderRadius:13,backgroundColor:t.primary,alignItems:"center",justifyContent:"center"},stepNumberText:{...E(e,"medium"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},stepText:{flex:1,...E(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},actions:{marginTop:"auto",paddingBottom:r.xl,gap:r.md},calendarNote:{textAlign:"center"}})}o(hs,"makeStyles");function Kr({step:e,furthestIndex:t,title:r,canGoBack:n,isDirty:i,onBack:l,onClose:a,onConfirmDiscard:s}){let u=C(),d=useMemo(()=>Ss(u),[u]),f=useMemo(()=>()=>{if(!i){a();return}let h={title:c.chrome.discardTitle,body:c.chrome.discardBody,confirmLabel:c.chrome.discardConfirmCta,keepLabel:c.chrome.discardKeepCta};if(s){Promise.resolve(s(h)).then(x=>{x&&a();},()=>{});return}Alert.alert(h.title,h.body,[{text:h.keepLabel,style:"cancel"},{text:h.confirmLabel,style:"destructive",onPress:a}]);},[i,a,s]);useEffect(()=>{let h=o(()=>n?(l(),true):(f(),true),"onBackPress"),x=BackHandler.addEventListener("hardwareBackPress",h);return ()=>{x.remove();}},[n,l,f]);let v=Fe.length,y=e==="booked"?1:Math.min(1,(t+1)/v);return jsxs(View,{style:d.wrap,children:[jsxs(View,{style:d.bar,children:[jsx(View,{style:d.side,children:jsx(Pressable,{onPress:n?l:f,accessibilityRole:"button",accessibilityLabel:gi,testID:"televet-booking-back",style:d.tap,children:jsx(View,{style:d.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})}),jsx(b,{tier:"heading",style:d.title,accessibilityRole:"header",children:r??c.navTitle}),jsx(View,{style:[d.side,d.sideRight],children:jsx(Pressable,{onPress:f,accessibilityRole:"button",accessibilityLabel:c.close,accessibilityHint:c.chrome.closeHint,testID:"televet-booking-close",style:d.tap,children:jsx(b,{tier:"control",style:d.close,children:c.close})})})]}),jsx(View,{style:d.railTrack,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsx(View,{style:[d.railFill,{width:`${Math.round(y*100)}%`}],testID:"televet-booking-rail"})})]})}o(Kr,"TelevetBookingChrome");var gi="Back";function Ss(e){let{color:t,space:r,type:n}=e,{size:i,lineHeight:l}=n;return StyleSheet.create({wrap:{backgroundColor:t.surface},bar:{flexDirection:"row",alignItems:"center",paddingHorizontal:r.lg,minHeight:56},side:{minWidth:64,justifyContent:"center"},sideRight:{alignItems:"flex-end"},tap:{minHeight:Y,minWidth:Y,justifyContent:"center",paddingHorizontal:r.xs},chevron:{width:10,height:10,borderLeftWidth:2,borderBottomWidth:2,borderColor:t.brand,transform:[{rotate:"45deg"}]},title:{flex:1,textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},close:{...E(e,"medium"),color:t.brand,fontSize:i.subtitle,lineHeight:i.subtitle*l.normal},railTrack:{height:4,backgroundColor:t.surfaceSubtle},railFill:{height:4,backgroundColor:t.success}})}o(Ss,"makeStyles");function vi(e){let t=[],r=Rs(e.ageYears);r!==null&&t.push(`${String(r)} yr${r===1?"":"s"} old`);let n=e.weightKg;typeof n=="number"&&Number.isFinite(n)&&n>0&&t.push(`${String(Math.round(n))} kg`);let i=e.breed?.trim();return i&&t.push(i),t.join(" \xB7 ")}o(vi,"formatTelevetPetMetaLine");function Rs(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(Rs,"wholeYears");function Yr({media:e,onChange:t,onPickMedia:r}){let n=C(),i=useMemo(()=>Fs(n),[n]),l=Pt-e.length,[a,s]=useState(false);if(!r)return null;let u=o(async()=>{if(!(a||l<=0)){s(true);try{let d=await gt(r,l);if(!d.ok||d.value===null||d.value.length===0)return;let f=new Set(e.map(p=>p.uri)),v=d.value.filter(p=>typeof p?.uri=="string"&&p.uri.length>0&&!f.has(p.uri));if(v.length===0)return;t([...e,...v].slice(0,Pt));}finally{s(false);}}},"pick");return jsxs(View,{style:i.row,children:[e.map((d,f)=>jsxs(View,{style:i.thumb,children:[jsx(Image,{source:{uri:d.uri},style:i.thumbImage,resizeMode:"cover"}),d.mimeType?.startsWith("video/")?jsx(View,{style:i.videoBadge,testID:`televet-intake-media-video-${String(f)}`,children:jsx(b,{tier:"badge",style:i.videoBadgeText,children:As})}):null,jsx(Pressable,{onPress:()=>t(e.filter((v,p)=>p!==f)),accessibilityRole:"button",accessibilityLabel:c.removePhotoLabel,testID:`televet-intake-media-remove-${String(f)}`,style:i.remove,children:jsx(b,{tier:"control",style:i.removeGlyph,children:Os})})]},`${d.uri}-${String(f)}`)),l>0?jsx(Pressable,{onPress:()=>{u();},disabled:a,accessibilityRole:"button",accessibilityLabel:c.addPhotoCta,accessibilityState:{busy:a,disabled:a},testID:"televet-intake-add-media",style:[i.dropzone,a?i.dropzoneBusy:null],children:a?jsx(ActivityIndicator,{testID:"televet-intake-media-busy"}):jsx(b,{tier:"compact",style:i.dropzoneText,children:c.addPhotoCta})}):null]})}o(Yr,"TelevetIntakeMedia");var Os="\xD7",As="\u25B6",zt=92;function Fs(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({row:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingTop:r.sm},thumb:{width:zt,height:zt,borderRadius:n.md,backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:n.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:n.sm,backgroundColor:t.shadow},videoBadgeText:{color:t.text.onBrand,fontSize:l.nano},remove:{position:"absolute",top:-8,right:-8,width:Y-16,height:Y-16,borderRadius:Y/2,backgroundColor:t.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...E(e,"medium"),color:t.surface,fontSize:l.subtitle,lineHeight:l.subtitle,includeFontPadding:false},dropzone:{width:zt,height:zt,borderRadius:n.md,borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.sm},dropzoneBusy:{opacity:.6},dropzoneText:{...E(e,"mono"),color:t.text.metaCool,fontSize:l.nano,lineHeight:l.nano*a.normal,letterSpacing:.3,textAlign:"center"}})}o(Fs,"makeStyles");function Ne({label:e,value:t,last:r=false,testID:n}){let i=C(),l=useMemo(()=>Zr(i),[i]);return jsxs(View,{style:[l.row,r?l.rowLast:null],testID:n,children:[jsx(b,{style:l.rowLabel,children:e}),jsx(b,{style:l.rowValue,children:t})]})}o(Ne,"TelevetSummaryRow");function dt({label:e,checked:t,onToggle:r,testID:n}){let i=C(),l=useMemo(()=>Zr(i),[i]);return jsxs(Pressable,{onPress:()=>r(!t),accessibilityRole:"checkbox",accessibilityLabel:e,accessibilityState:{checked:t},testID:n,style:l.consent,children:[jsx(View,{style:[l.box,t?l.boxChecked:null],children:t?jsx(b,{tier:"badge",style:l.tick,children:Bs}):null}),jsx(b,{style:l.consentLabel,children:e})]})}o(dt,"TelevetConsentCheckbox");var Bs="\u2713";function Qr({children:e,testID:t}){let r=C(),n=useMemo(()=>Zr(r),[r]);return jsx(View,{style:n.card,testID:t,children:e})}o(Qr,"TelevetSummaryCard");function Zr(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({card:{borderRadius:n.lg,borderWidth:1,borderColor:t.brandBorder,paddingHorizontal:r.lg},row:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:r.lg,paddingVertical:r.lg,borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{...E(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},rowValue:{flexShrink:1,textAlign:"right",...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:Y,padding:r.lg,borderRadius:n.md,backgroundColor:t.surfaceSubtle},box:{width:22,height:22,borderRadius:n.xs,borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...E(e,"bold"),color:t.onPrimary,fontSize:l.caption,lineHeight:l.caption,includeFontPadding:false},consentLabel:{flex:1,...E(e,"regular"),color:t.text.metaCool,fontSize:l.body,lineHeight:l.body*a.normal}})}o(Zr,"makeStyles");function Jr({slots:e,selectedDayKey:t,onSelectDay:r}){let n=C(),i=useMemo(()=>Ms(n),[n]),l=useMemo(()=>Mt(e),[e]),a=l[0];return a===void 0?null:jsxs(View,{children:[jsx(b,{tier:"compact",style:i.month,testID:"televet-day-strip-month",children:Vo(a.iso)}),jsx(ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:i.strip,testID:"televet-day-strip",children:l.map(s=>{let u=s.key===t;return jsxs(Pressable,{onPress:()=>r(s),accessibilityRole:"button",accessibilityLabel:Bo(s.iso),accessibilityState:{selected:u},testID:`televet-day-${s.key}`,style:[i.day,u?i.daySelected:null],children:[jsx(b,{tier:"compact",style:[i.dayWeekday,u?i.dayTextSelected:null],children:s.weekday}),jsx(b,{tier:"compact",style:[i.dayNumber,u?i.dayTextSelected:null],children:s.dayNumber})]},s.key)})})]})}o(Jr,"TelevetDayStrip");function Mt(e){let t=new Map;for(let r of e){let n=Ft(r.startsAt);if(t.has(n))continue;let i=new Date(r.startsAt);Number.isNaN(i.getTime())||t.set(n,Object.freeze({key:n,iso:r.startsAt,weekday:i.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(i.getDate())}));}return Object.freeze([...t.values()])}o(Mt,"televetDaysFromSlots");function Ms(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({month:{textAlign:"center",...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug,paddingBottom:r.md},strip:{gap:r.sm,paddingHorizontal:r.xs},day:{width:52,minHeight:Y,paddingVertical:r.md,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",gap:2},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...E(e,"mono"),color:t.text.secondary,fontSize:l.tiny,lineHeight:l.tiny*a.tight},dayNumber:{...E(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading*a.tight},dayTextSelected:{color:t.onPrimary}})}o(Ms,"makeStyles");function ct({slots:e,busySlotId:t,onPick:r,ListHeaderComponent:n,rowTestIdPrefix:i="televet-slot",testID:l="televet-slot-list"}){let a=C(),s=useMemo(()=>$s(a),[a]),u=useMemo(()=>Mt(e),[e]),[d,f]=useState(null),v=d??u[0]?.key??null,p=useMemo(()=>v?e.filter(_=>Ft(_.startsAt)===v):[],[e,v]),y=n,h=useMemo(()=>p.map(_=>ot(_.startsAt)),[p]),x=useMemo(()=>new Set(h.filter(_=>_.length>0)).size>1,[h]),T=p[0];return jsxs(View,{style:s.root,testID:l,children:[y?jsx(y,{}):null,jsx(Jr,{slots:e,selectedDayKey:v,onSelectDay:_=>f(_.key)}),T&&!x?jsx(b,{tier:"compact",style:s.zone,testID:"televet-slot-zone",children:ot(T.startsAt)}):null,jsx(ScrollView,{style:s.gridScroll,contentContainerStyle:s.grid,showsVerticalScrollIndicator:false,children:p.map((_,V)=>{let w=t===_.slotId,O=t!==null,P=x?h[V]??"":"";return jsxs(Pressable,{onPress:()=>r(_),disabled:O,accessibilityRole:"button",accessibilityLabel:[Me(_.startsAt),P].filter(I=>I.length>0).join(" "),accessibilityState:{disabled:O,busy:w},testID:`${i}-${_.slotId}`,style:[s.chip,w?s.chipBusy:null,O&&!w?s.chipDisabled:null],children:[jsx(b,{tier:"compact",style:[s.chipLabel,w?s.chipLabelBusy:null],children:Me(_.startsAt)}),P.length>0?jsx(b,{tier:"compact",style:[s.chipZone,w?s.chipLabelBusy:null],testID:`${i}-${_.slotId}-zone`,children:P}):null]},_.slotId)})})]})}o(ct,"TelevetSlotPicker");function $s(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({root:{flex:1,minHeight:0},gridScroll:{flex:1},zone:{textAlign:"center",...E(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4,paddingVertical:r.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingBottom:r.xl},chip:{minWidth:96,flexGrow:1,flexBasis:"28%",minHeight:48,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45},chipLabel:{...E(e,"regular"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.tight},chipLabelBusy:{color:t.onPrimary},chipZone:{...E(e,"mono"),color:t.text.muted,fontSize:l.tiny,lineHeight:l.tiny*a.normal,letterSpacing:.4}})}o($s,"makeStyles");function Ht(e,t){return t?e.find(n=>n.petRef===t||n.petId===t)?.name??null:null}o(Ht,"nameOf");function Ri({pets:e,isPending:t,isError:r,onRetry:n,selectedId:i,onSelect:l,onAddPet:a}){let s=j(),u=C(),d=useMemo(()=>Le(u),[u]);return t?jsx(View,{style:s.list,testID:"televet-pets-loading",children:[0,1].map(f=>jsx(Ve,{height:64},f))}):r?jsx(View,{testID:"televet-pets-error",children:jsx(L,{title:c.chrome.loadFailedTitle,actionLabel:c.chrome.retryCta,onAction:n})}):e.length===0?jsx(View,{testID:"televet-pets-empty",children:jsx(L,{title:c.chrome.noPetsTitle,actionLabel:c.addPetCta,onAction:a})}):jsxs(View,{style:s.stepFill,children:[jsx(b,{tier:"heading",style:s.stepTitle,accessibilityRole:"header",children:c.petSelectTitle}),jsxs(ScrollView,{contentContainerStyle:s.list,testID:"televet-pets",children:[e.map(f=>{let v=i===f.petRef,p=vi(f),y=f.name??"";return jsx(Si,{name:y,meta:p,selected:v,onPress:()=>l(f.petRef),testID:`televet-pet-${f.petRef}`},f.petRef)}),a?jsx(Si,{name:c.addPetCta,meta:"",selected:false,onPress:a,testID:"televet-pet-add",glyph:Xs}):null]}),jsx(View,{style:d.spacer})]})}o(Ri,"PetStep");function Si({name:e,meta:t,selected:r,onPress:n,testID:i,glyph:l}){let a=C(),s=useMemo(()=>Le(a),[a]);return jsxs(View,{style:[s.petRow,r?s.petRowSelected:null],children:[jsx($,{label:e,onPress:n,kind:"secondary",accessibilityLabel:e,testID:i,style:s.petRowButton}),jsxs(View,{style:s.petRowText,pointerEvents:"none",children:[jsx(View,{style:s.petDisc,children:jsx(b,{tier:"compact",style:s.petDiscGlyph,children:l??Ci(e)})}),t?jsx(b,{tier:"compact",style:s.petRowMeta,children:t}):null]})]})}o(Si,"PetRow");function Ci(e){let t=e.trim();return t.length===0?Gs:t.slice(0,1).toUpperCase()}o(Ci,"initialOf");function xi({clinicians:e,isPending:t,isError:r,selectedId:n,onSelect:i,onRetry:l}){let a=j(),s=C(),u=useMemo(()=>Le(s),[s]);if(t)return jsx(View,{style:a.list,testID:"televet-clinicians-loading",children:jsx(Ve,{height:96})});if(r)return jsx(View,{testID:"televet-clinicians-error",children:jsx(L,{title:c.chrome.loadFailedTitle,actionLabel:c.chrome.retryCta,onAction:l})});if(e.length===0)return jsx(View,{testID:"televet-clinicians-empty",children:jsx(L,{title:c.noCliniciansTitle,message:c.noCliniciansBody,actionLabel:c.noCliniciansRetryCta,onAction:l})});let d=e.find(f=>f.clinicianId===n)??e[0];return d===void 0?null:jsxs(View,{style:a.list,testID:"televet-clinicians",children:[jsx(b,{tier:"heading",style:a.stepTitle,accessibilityRole:"header",children:c.yourVetTitle}),jsxs(View,{style:u.vetRow,children:[jsx(View,{style:u.vetAvatar,children:jsx(b,{tier:"heading",style:u.vetAvatarText,children:Ci(d.displayName)})}),jsxs(View,{style:u.vetIdentity,children:[jsx(b,{style:u.vetName,children:d.displayName}),d.credentials?jsx(b,{style:u.vetCredentials,children:d.credentials}):null,d.rating!==null&&d.ratingCount!==null?jsx(b,{tier:"compact",style:u.vetRating,testID:"televet-vet-rating",children:`\u2605 ${String(d.rating)} \xB7 ${String(d.ratingCount)} ${c.reviewsLabel}`}):null]})]}),d.bio?jsx(b,{style:u.vetBio,testID:"televet-vet-bio",children:d.bio}):null,jsx(View,{style:a.divider}),jsx($,{label:c.continueCta,kind:"primary",onPress:()=>i(d.clinicianId),testID:`televet-clinician-${d.clinicianId}`})]})}o(xi,"ClinicianStep");function wi({slots:e,enabled:t,isPending:r,isError:n,busySlotId:i,failure:l,nextOpening:a,onPick:s,onRetry:u,onSeeOtherVets:d}){let f=j();return t?r?jsx(View,{style:f.list,testID:"televet-slots-loading",children:[0,1,2].map(v=>jsx(Ve,{height:48},v))}):n?jsx(L,{title:c.slotsErrorTitle,actionLabel:c.retryCta,onAction:u,testID:"televet-slots-error"}):e.length===0?jsx(View,{testID:"televet-slots-empty",children:jsx(L,{title:c.noSlotsTitle,message:a?ue(c.nextOpeningTemplate,{when:ye(a.startsAt)}):void 0,actionLabel:a?c.seeOtherVetsCta:void 0,onAction:a?d:void 0})}):jsxs(View,{style:f.stepFill,testID:"televet-slots",children:[l==="expired"?jsx(G,{message:c.holdExpired}):null,l==="taken"?jsx(G,{message:c.slotTaken}):null,jsx(ct,{slots:e,busySlotId:i,onPick:s})]}):jsx(View,{testID:"televet-slots-unavailable",children:jsx(L,{title:c.bookingPausedTitle})})}o(wi,"SlotStep");function Pi({value:e,onChange:t,onNext:r,media:n,onChangeMedia:i,onPickMedia:l}){let a=j(),s=C(),u=useMemo(()=>Le(s),[s]),d=e.trim(),f=d.length>0&&d.length<=pe;return jsxs(View,{style:a.scrollRoot,testID:"televet-booking-reason",children:[jsxs(ScrollView,{style:a.scrollBody,contentContainerStyle:a.list,keyboardShouldPersistTaps:"handled",keyboardDismissMode:"interactive",showsVerticalScrollIndicator:false,testID:"televet-booking-reason-scroll",children:[jsx(b,{tier:"heading",style:a.stepTitle,accessibilityRole:"header",children:c.describeHeading}),jsx(b,{style:a.stepHelp,children:c.describeHelpLong}),jsx(_n,{value:e,onChangeText:t,multiline:true,placeholder:c.reasonPlaceholder,placeholderTextColor:s.color.text.placeholder,style:u.reasonInput,testID:"televet-reason-input"}),d.length>pe?jsx(G,{message:c.reasonTooLong}):null,jsx(Yr,{media:n,onChange:i,...l?{onPickMedia:l}:{}})]}),jsx(View,{style:a.scrollFooter,children:jsx($,{label:c.continueCta,kind:"primary",disabled:!f,onPress:r,testID:"televet-reason-next"})})]})}o(Pi,"ReasonStep");function Ii({when:e,clinician:t,petName:r,reason:n,shareRecords:i,onToggleShare:l,stateCode:a,stateAttested:s,onToggleStateAttest:u,cancellationTerms:d,termsAttested:f,onToggleTermsAttest:v,canConfirm:p,busy:y,failure:h,rateLimitMessage:x,onConfirm:T,emergency:_,onAcknowledgeEmergency:V,onSeeOtherVets:w}){let O=j(),P=C(),I=useMemo(()=>Le(P),[P]);return jsxs(View,{style:O.scrollRoot,testID:"televet-booking-review",children:[jsxs(ScrollView,{style:O.scrollBody,contentContainerStyle:O.list,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[jsxs(Qr,{testID:"televet-review-summary",children:[r?jsx(Ne,{label:c.summaryPet,value:r,testID:"televet-review-row-pet"}):null,t?jsx(Ne,{label:c.summaryVet,value:t,testID:"televet-review-row-vet"}):null,jsx(Ne,{label:c.summaryWhen,value:e,testID:"televet-review-row-when"}),jsx(Ne,{label:c.summaryLength,value:ue(c.summaryLengthTemplate,{n:String(He)}),testID:"televet-review-row-length"}),n?jsx(Ne,{label:c.summaryReason,value:n,last:true,testID:"televet-review-row-reason"}):null]}),jsx(dt,{label:c.shareRecordsOff,checked:i,onToggle:l,testID:"televet-review-share-records"}),d?jsx(dt,{label:d,checked:f,onToggle:v,testID:"televet-review-terms-attest"}):null,a?jsx(dt,{label:ue(c.stateAttestTemplate,{state:a}),checked:s,onToggle:u,testID:"televet-review-state-attest"}):null,_?jsxs(View,{style:I.emergencyBanner,testID:"televet-review-emergency",children:[jsx(b,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:I.emergencyTitle,children:c.emergency.bannerTitle}),jsx(b,{style:I.emergencyLede,children:c.emergency.lede}),_.length>0?jsx(b,{style:I.emergencyLede,testID:"televet-review-emergency-categories",children:_.join(", ")}):null,jsx($,{label:c.emergency.keepBookingCta,kind:"secondary",loading:y,disabled:y,onPress:V,testID:"televet-review-emergency-ack"})]}):null,h==="failed"?jsx(G,{message:c.confirmFailed}):null,h==="clinician_unavailable"?jsxs(View,{style:O.list,testID:"televet-review-clinician-unavailable",children:[jsx(G,{message:c.confirmFailed}),jsx($,{label:c.seeOtherVetsCta,kind:"secondary",onPress:w,testID:"televet-review-see-other-vets"})]}):null,h==="rate_limited"&&x?jsx(G,{message:x,testID:"televet-review-rate-limited"}):null,h==="rate_limited"&&!x?jsx(G,{message:c.confirmFailed}):null,h==="not_entitled"?jsx(G,{message:c.confirmNotEntitled,testID:"televet-review-not-entitled"}):null]}),_?null:jsx(View,{style:O.scrollFooter,children:jsx($,{label:c.confirmCta,kind:"primary",loading:y,disabled:!p||y||!!a&&!s||!!d&&!f,onPress:T,testID:"televet-review-confirm"})})]})}o(Ii,"ReviewStep");var Gs="\u25CB",Xs="+";function Le(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:a}=i;return StyleSheet.create({marker:{minHeight:1},spacer:{height:r.md},petRow:{gap:r.xs,paddingVertical:r.xs},petRowSelected:{opacity:1},petRowButton:{alignSelf:"stretch",justifyContent:"flex-start"},petRowText:{flexDirection:"row",alignItems:"center",gap:r.sm,paddingHorizontal:r.md},petDisc:{width:28,height:28,borderRadius:14,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...E(e,"medium"),color:t.brand,fontSize:l.caption,lineHeight:l.caption},petRowMeta:{flexShrink:1,...E(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRow:{flexDirection:"row",alignItems:"center",gap:r.md},vetAvatar:{width:64,height:64,borderRadius:32,backgroundColor:t.surfaceSubtle,alignItems:"center",justifyContent:"center"},vetAvatarText:{...E(e,"medium"),color:t.brand,fontSize:l.heading,lineHeight:l.heading},vetIdentity:{flex:1,gap:2},vetName:{...E(e,"medium"),color:t.brand,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},vetCredentials:{...E(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:l.caption*a.normal},vetRating:{...E(e,"regular"),color:t.text.secondary,fontSize:l.caption,lineHeight:l.caption*a.normal},vetBio:{...E(e,"regular"),color:t.brand,fontSize:l.body,lineHeight:l.body*a.normal},reasonInput:{minHeight:120,textAlignVertical:"top",borderWidth:1,borderColor:t.brandBorder,borderRadius:n.md,padding:r.md,...E(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal},emergencyBanner:{gap:r.md,padding:r.lg,borderRadius:n.lg,borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical},emergencyTitle:{...E(e,"bold"),color:t.errorRed,fontSize:l.subtitle,lineHeight:l.subtitle*a.snug},emergencyLede:{...E(e,"regular"),color:t.text.primary,fontSize:l.body,lineHeight:l.body*a.normal}})}o(Le,"makeLocalStyles");function rn(e){let{petRef:t,usState:r,controller:n,onBooked:i,onExit:l,onAddPet:a,onPickMedia:s,onAddToCalendar:u,onConfirmDiscard:d,onRequestLocation:f,locationStatus:v="unknown",canJoinInApp:p=false,renderUnavailable:y,style:h,testID:x}=je(e,["onBooked","onExit","onAddPet","onRequestLocation"]),T=j(),_=C(),V=useMemo(()=>Le(_),[_]),w=it(n),O=ko(),P=O.pets,I=P.length,te=useMemo(()=>({ownedPetCount:I}),[I]),[Q,B]=useReducer((M,re)=>_r(M,re,te),void 0,()=>Er({ownedPetCount:0},{petId:t??null,state:r??null})),k=useCallback(M=>B(M),[]),[A,Z]=useState(""),[ee,se]=useState(null),[on,Ye]=useState(null),[K,ve]=useState(null),[Ce,Ge]=useState(false),[be,Xe]=useState(false),[Di,Vi]=useState([]),[Wt,Bi]=useState(null),{draft:S}=Q,J=Sr(Q),ln=useRef(S.state);ln.current!==S.state&&(ln.current=S.state,Ce&&Ge(false),be&&Xe(false));let qt=Or(S.state,w),Kt=Fr(w),an=Ar(w),xe=Dr(S.state,w),ze=lt(S.clinicianId,w),Ni=Vr(w).data??null,yt=at(w),$t=Nr(w),Yt=r??null;useEffect(()=>{Yt&&!S.state&&k({type:"patch",patch:{state:Yt}});},[Yt,S.state,k]),useEffect(()=>{t&&!S.petId&&k({type:"patch",patch:{petId:t}});},[t,S.petId,k]);let Gt=P.length===1?P[0]?.petRef??null:null;useEffect(()=>{Gt&&!S.petId&&k({type:"patch",patch:{petId:Gt}});},[Gt,S.petId,k]);let sn=useRef(J);sn.current=J;let dn=useRef(0);useEffect(()=>{I!==dn.current&&(dn.current=I,k({type:"goTo",step:sn.current}));},[I,k]);let Xt=xe.data?.[0]?.clinicianId??null;useEffect(()=>{Xt&&!S.clinicianId&&k({type:"patch",patch:{clinicianId:Xt}});},[Xt,S.clinicianId,k]);let Li=useCallback(M=>{se(null),yt.mutate(M.slotId,{onSuccess:o(re=>{k({type:"patch",patch:{slot:M,holdExpiresAt:re.expiresAt,idempotencyKey:Cr(M.slotId)}}),k({type:"next"});},"onSuccess"),onError:o(re=>se(Pe(re).kind==="unavailable"?"unavailable":"taken"),"onError")});},[yt,k]),Qt=useCallback(M=>{if(!(!At(S,A)||!S.idempotencyKey)){if(Rr(S,Date.now())){se("expired"),k({type:"goTo",step:"time"});return}se(null),ve(null),$t.mutate({pet_id:S.petId,clinician_id:S.clinicianId,slot_id:S.slot.slotId,state:S.state,reason_text:A.trim(),species:null,media_refs:[],emergency_acknowledged:M,share_health_records:S.shareHealthRecords,...xr(Ce,be,Kt.data)},S.idempotencyKey,{onSuccess:o(re=>{Bi(re),k({type:"goTo",step:"booked"}),i?.(re);},"onSuccess"),onError:o(re=>{let de=Pe(re);if(de.kind==="emergency"){ve(de.categories);return}if(de.kind==="rate_limited"){Ye(de.message),se("rate_limited");return}se(de.kind==="not_entitled"?"not_entitled":de.kind==="slot_taken"?"taken":de.kind==="clinician_unavailable"?"clinician_unavailable":de.kind==="unavailable"?"unavailable":"failed"),de.kind==="slot_taken"&&k({type:"goTo",step:"time"});},"onError")});}},[S,A,$t,k,i,Ce,be,Kt.data]),zi=useCallback(()=>Qt(false),[Qt]),ji=qt.enabled&&qt.data!==null&&!qt.data.wellnessAvailable,Mi=an.enabled&&an.data?.active===false,Hi=A.trim().length>0||!!S.slot||!!S.clinicianId,Ui=w===null||ee==="unavailable";return ce()?jsxs(View,{style:[T.screen,h],testID:x??"televet-booking",children:[jsx(Kr,{step:J,furthestIndex:Q.furthestIndex,canGoBack:kr(Q,te)&&J!=="booked",isDirty:Hi,onBack:()=>k({type:"back"}),onClose:()=>l?.(),...d?{onConfirmDiscard:d}:{}}),Ui?jsx(View,{style:T.stepFill,testID:"televet-booking-unavailable",children:y?y():jsx(L,{title:c.bookingPausedTitle})}):Mi?jsx(View,{testID:"televet-booking-not-entitled",children:jsx(L,{title:c.confirmNotEntitled})}):ji?jsx(View,{testID:"televet-booking-state-blocked",children:jsx(L,{title:c.stateBlockedTitle})}):J==="time"?jsx(wi,{slots:ze.data??[],enabled:ze.enabled,isPending:ze.enabled&&ze.isPending,isError:ze.isError,busySlotId:yt.isPending?yt.variables:null,failure:ee,nextOpening:Ni,onPick:Li,onRetry:()=>ze.refetch(),onSeeOtherVets:()=>k({type:"goTo",step:"clinician"})}):J==="review"?jsx(Ii,{when:S.slot?ye(S.slot.startsAt):"",petName:Ht(P,S.petId),reason:A.trim(),clinician:xe.data?.find(M=>M.clinicianId===S.clinicianId)?.displayName??null,shareRecords:S.shareHealthRecords,stateCode:S.state,stateAttested:Ce,onToggleStateAttest:Ge,cancellationTerms:Kt.data?.summary??null,termsAttested:be,onToggleTermsAttest:Xe,onToggleShare:M=>k({type:"patch",patch:{shareHealthRecords:M}}),canConfirm:At(S,A),busy:$t.isPending,failure:ee,rateLimitMessage:on,onConfirm:zi,emergency:K,onAcknowledgeEmergency:()=>Qt(true),onSeeOtherVets:()=>k({type:"goTo",step:"clinician"})}):J==="booked"?jsx(View,{style:T.stepFill,testID:"televet-booking-booked",children:Wt?jsx(qr,{consult:Wt,petName:Ht(P,Wt.petId)??Ht(P,S.petId),onDone:()=>l?.(),canJoinInApp:p,...u?{onAddToCalendar:u}:{}}):null}):J==="clinician"&&!S.state?jsx(View,{testID:"televet-booking-location-unknown",children:jsx(L,{title:v==="blocked"?c.locationBlockedTitle:v==="unavailable"?c.locationUnavailableTitle:c.locationUnknownTitle,message:v==="blocked"?c.locationBlockedBody:v==="unavailable"?c.locationUnavailableBody:c.locationUnknownBody,actionLabel:f?v==="blocked"?c.locationBlockedCta:c.locationUnknownCta:void 0,onAction:f})}):J==="clinician"?jsx(xi,{clinicians:xe.data??[],isPending:xe.enabled&&xe.isPending,isError:xe.isError,selectedId:S.clinicianId,onRetry:()=>xe.refetch(),onSelect:M=>{k({type:"patch",patch:{clinicianId:M}}),k({type:"next"});}}):J==="reason"?jsx(Pi,{value:A,onChange:Z,media:Di,onChangeMedia:Vi,...s?{onPickMedia:s}:{},onNext:()=>k({type:"next"})}):J==="pet"?jsx(Ri,{pets:P,isPending:O.loading,isError:O.error!==null,onRetry:()=>{O.refresh();},onAddPet:a,selectedId:S.petId,onSelect:M=>{k({type:"patch",patch:{petId:M}}),k({type:"next"});}}):jsx(View,{style:V.marker,testID:`televet-booking-step-${J}`})]}):jsx(View,{style:[T.screen,h],testID:x??"televet-booking",children:jsx(View,{style:T.stepFill,testID:"televet-booking-copy-unapproved",children:y?y():jsx(Lt,{...t!==void 0?{petRef:t}:{},...r!==void 0?{usState:r}:{}})})})}o(rn,"EverfurTelevetBooking");function nn(e){let{consult:t,onRescheduled:r,onCancel:n,controller:i,style:l,testID:a}=je(e,["onRescheduled","onCancel"]),s=j(),u=it(i),d=lt(t?.clinicianId??null,u),f=at(u),v=Lr(t?.consultId??null,u),[p,y]=useState(null),h=useCallback(T=>{y(null),f.mutate(T.slotId,{onSuccess:o(()=>{v.mutate(T.slotId,{onSuccess:o(_=>r?.(_),"onSuccess"),onError:o(_=>y(Pe(_).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(_=>y(Pe(_).kind==="unavailable"?"unavailable":"taken"),"onError")});},[f,v,r]),x=f.isPending||v.isPending;return ce()?t?jsxs(View,{style:[s.stepFill,l],testID:a??"televet-reschedule",children:[jsx(b,{tier:"compact",style:s.stepHelp,children:ue(c.rescheduleFromTemplate,{when:ye(t.scheduledAt)})}),p==="taken"?jsx(G,{message:c.slotTaken}):null,p==="failed"?jsx(G,{message:c.rescheduleFailed}):null,p==="unavailable"?jsx(G,{message:c.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,d.enabled?d.isPending?jsx(View,{style:s.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(T=>jsx(Ve,{height:48},T))}):d.isError?jsx(L,{title:c.slotsErrorTitle,actionLabel:c.retryCta,onAction:()=>d.refetch(),testID:"televet-reschedule-slots-error"}):(d.data??[]).length===0?jsx(View,{testID:"televet-reschedule-empty",children:jsx(L,{title:c.noSlotsTitle})}):jsx(ct,{slots:d.data??[],busySlotId:x?f.variables:null,onPick:h,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsx(View,{testID:"televet-reschedule-paused",children:jsx(L,{title:c.bookingPausedTitle})}),jsx($,{label:c.keepExistingCta,kind:"secondary",disabled:x,onPress:()=>n?.(),testID:"televet-reschedule-keep"})]}):jsx(View,{style:[s.list,l],testID:"televet-reschedule-loading",children:[0,1].map(T=>jsx(Ve,{height:48},T))}):jsx(View,{style:[s.stepFill,l],testID:"televet-reschedule-copy-unapproved"})}o(nn,"EverfurTelevetReschedule");var Ai=Object.freeze({name:"booking"});function ad(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});default:return e}}o(ad,"navReducer");function Fi(e){let{style:t,renderPending:r,...n}=je(e,["onExit","onBooked","onAddPet","onRequestLocation"]);return jsx(Mn,{capability:"televet",style:t,...r?{renderPending:r}:{},children:jsx(sd,{...n,style:t})})}o(Fi,"EverfurTelevetFlow");function sd({petRef:e,usState:t,controller:r,onBooked:n,onExit:i,onAddPet:l,onPickMedia:a,onAddToCalendar:s,onConfirmDiscard:u,onRequestLocation:d,locationStatus:f,canJoinInApp:v=false,renderUnavailable:p,initialScreen:y,style:h}){let x=j(),[T,_]=useReducer(ad,y??Ai,P=>Object.freeze({stack:Object.freeze([P])})),V=T.stack[T.stack.length-1]??Ai,w=T.stack.length;useEffect(()=>{let P=o(()=>w<=1?false:(_({type:"pop"}),true),"onBackPress"),I=BackHandler.addEventListener("hardwareBackPress",P);return ()=>{I.remove();}},[w]);let O=useCallback(()=>p?p():jsxs(View,{style:x.list,testID:"televet-hosted-fallback",children:[ce()?jsx(L,{title:c.bookingPausedTitle}):null,jsx(Lt,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{}})]}),[p,x.list,e,t]);switch(V.name){case "booking":return jsx(rn,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...r?{controller:r}:{},...n?{onBooked:n}:{},...i?{onExit:i}:{},...l?{onAddPet:l}:{},...a?{onPickMedia:a}:{},...s?{onAddToCalendar:s}:{},...u?{onConfirmDiscard:u}:{},...d?{onRequestLocation:d}:{},...f?{locationStatus:f}:{},canJoinInApp:v,renderUnavailable:O,style:h});case "reschedule":return jsx(nn,{consult:V.consult,...r?{controller:r}:{},onRescheduled:()=>_({type:"pop"}),onCancel:()=>_({type:"pop"}),style:h});default:return mt(V)}}o(sd,"TelevetFlowBody");var dd=Fi;export{gi as BACK_LABEL,wt as CANCELLATION_POLICY_VERSION_MAX,Co as CONSULT_KINDS,He as CONSULT_MINUTES,Ro as CONSULT_STATUSES,dd as EverfurTelevet,rn as EverfurTelevetBooking,Fi as EverfurTelevetFlow,nn as EverfurTelevetReschedule,Pt as MEDIA_REFS_MAX,pe as REASON_TEXT_MAX,ke as TELEVET_BOOKING_BASE,c as TELEVET_BOOKING_COPY,Fe as TELEVET_BOOKING_STEPS,Pa as TERMINAL_CONSULT_STATUSES,qr as TelevetBookedScreen,Kr as TelevetBookingChrome,dt as TelevetConsentCheckbox,Jr as TelevetDayStrip,Yr as TelevetIntakeMedia,ct as TelevetSlotPicker,Qr as TelevetSummaryCard,Ne as TelevetSummaryRow,xr as attestation,At as canConfirm,Pr as createTelevetBookingController,Sr as currentStep,Ao as emptyTelevetDraft,Oa as formatVisitRange,Do as formatWhen,ye as formatWhenWithDay,kr as hasPreviousStep,Er as initialTelevetBookingState,Rr as isHoldExpired,It as isSkipped,ce as isTelevetBookingCopyReady,ae as isWellFormedStateCode,Cr as televetBookingKey,_r as televetBookingReducer,Pe as televetBookingRefusal,fi as televetConsultCalendarKey,Mt as televetDaysFromSlots,jo as televetHoldCall,Mo as televetRescheduleCall,Nr as useTelevetBookConsult,ja as useTelevetBookingAvailable,it as useTelevetBookingController,Ar as useTelevetBookingEntitlement,Fr as useTelevetCancellationPolicy,Dr as useTelevetClinicians,at as useTelevetHoldSlot,Vr as useTelevetNextSlot,Lr as useTelevetRescheduleConsult,lt as useTelevetSlots,Or as useTelevetStatePolicy,Ho as validateBookingBody};