@everfur/sdk 0.3.0 → 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 (165) hide show
  1. package/CHANGELOG.md +69 -4
  2. package/README.md +6 -1
  3. package/dist/{Chat-DwAC2vhB.d.ts → Chat-BZZ-Py5l.d.ts} +3 -3
  4. package/dist/{Chat-DPUD6dnc.d.cts → Chat-Dq4fffIO.d.cts} +3 -3
  5. package/dist/{DepthViews-DNEM96Se.d.ts → DepthViews-BG3E25MD.d.ts} +1 -1
  6. package/dist/{DepthViews-DP0R-DhB.d.cts → DepthViews-B_hIypI6.d.cts} +1 -1
  7. package/dist/{DepthViews-DbFhR4Du.d.cts → DepthViews-CL75jyRA.d.cts} +1 -1
  8. package/dist/{DepthViews-D_3hl4xk.d.ts → DepthViews-CkYri51q.d.ts} +1 -1
  9. package/dist/animations/index.cjs +1 -1
  10. package/dist/animations/index.d.cts +3 -3
  11. package/dist/animations/index.d.ts +3 -3
  12. package/dist/animations/index.js +1 -1
  13. package/dist/{attachments-CQgFrEQ7.d.cts → attachments-BorG422I.d.cts} +2 -2
  14. package/dist/{attachments-5NeobOCd.d.ts → attachments-BrUWQYNK.d.ts} +5 -4
  15. package/dist/{attachments-D8T5re7e.d.cts → attachments-D_SECjr1.d.cts} +5 -4
  16. package/dist/{attachments-Bw3iMQgu.d.ts → attachments-DpldrvIW.d.ts} +2 -2
  17. package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
  18. package/dist/bookingCopy-SREvkG19.d.cts +732 -0
  19. package/dist/{entitlementRepository-DSbzuyAW.d.ts → branding-CsRdeNwK.d.cts} +1 -133
  20. package/dist/{entitlementRepository-DKdXFgTo.d.cts → branding-CsRdeNwK.d.ts} +1 -133
  21. package/dist/callCopy-DoQKG3-L.d.cts +40 -0
  22. package/dist/callCopy-DoQKG3-L.d.ts +40 -0
  23. package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
  24. package/dist/casesRepository-v6QczS9N.d.ts +51 -0
  25. package/dist/chat/index.cjs +1 -1
  26. package/dist/chat/index.d.cts +9 -8
  27. package/dist/chat/index.d.ts +9 -8
  28. package/dist/chat/index.js +1 -1
  29. package/dist/client/index.cjs +5 -5
  30. package/dist/client/index.d.cts +10 -8
  31. package/dist/client/index.d.ts +10 -8
  32. package/dist/client/index.js +5 -5
  33. package/dist/{config-CzTZGlfF.d.cts → config--Wu1Umhd.d.cts} +2 -2
  34. package/dist/{config-DW60uRb9.d.ts → config-C7eb_IMD.d.ts} +2 -2
  35. package/dist/consent/index.cjs +1 -1
  36. package/dist/consent/index.d.cts +5 -5
  37. package/dist/consent/index.d.ts +5 -5
  38. package/dist/consent/index.js +1 -1
  39. package/dist/{context-XvTzq1tE.d.cts → context-CL3lyuy1.d.cts} +6 -6
  40. package/dist/{context-DXhqHlPU.d.ts → context-CahAEha8.d.ts} +6 -6
  41. package/dist/{copy-Mjoo91aS.d.ts → copy-DdVFDL01.d.ts} +2 -2
  42. package/dist/{copy-bKDNigLb.d.cts → copy-UeUJVk8X.d.cts} +2 -2
  43. package/dist/core/index.cjs +7 -7
  44. package/dist/core/index.d.cts +118 -29
  45. package/dist/core/index.d.ts +118 -29
  46. package/dist/core/index.js +7 -7
  47. package/dist/{depth-CErXCU8J.d.cts → depth-D5HwcvKC.d.cts} +34 -3
  48. package/dist/{depth-DjDcJ6kH.d.ts → depth-DvPwPuT_.d.ts} +34 -3
  49. package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
  50. package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
  51. package/dist/{identity-DI4eVx9S.d.cts → identity-C2-08BZW.d.cts} +2 -2
  52. package/dist/{identity-BMx2SUOM.d.ts → identity-CEi9GRFZ.d.ts} +2 -2
  53. package/dist/index.cjs +6 -6
  54. package/dist/index.d.cts +17 -16
  55. package/dist/index.d.ts +17 -16
  56. package/dist/index.js +6 -6
  57. package/dist/notifications/index.cjs +2 -2
  58. package/dist/notifications/index.d.cts +2 -2
  59. package/dist/notifications/index.d.ts +2 -2
  60. package/dist/notifications/index.js +2 -2
  61. package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
  62. package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
  63. package/dist/{pets-CtQdRpWo.d.ts → pets-DJv2sj2H.d.ts} +1 -1
  64. package/dist/{pets-aB8q0JyX.d.cts → pets-JVCXgRgR.d.cts} +1 -1
  65. package/dist/{casesRepository-DHwtGRYY.d.cts → petsRepository-B_gKbAzJ.d.cts} +2 -48
  66. package/dist/{casesRepository-ClLv6qMl.d.ts → petsRepository-Bk6GDwLs.d.ts} +2 -48
  67. package/dist/photo/index.cjs +1 -1
  68. package/dist/photo/index.js +1 -1
  69. package/dist/{ports-DEBzEhbp.d.cts → ports-BY2ph0_y.d.cts} +5 -15
  70. package/dist/{ports-DMolTRzU.d.ts → ports-D7YW8qz9.d.ts} +5 -15
  71. package/dist/records/depth/index.cjs +2 -2
  72. package/dist/records/depth/index.d.cts +7 -7
  73. package/dist/records/depth/index.d.ts +7 -7
  74. package/dist/records/depth/index.js +2 -2
  75. package/dist/records/index.cjs +3 -3
  76. package/dist/records/index.d.cts +9 -9
  77. package/dist/records/index.d.ts +9 -9
  78. package/dist/records/index.js +3 -3
  79. package/dist/{requestFunnel-L-BQfi0z.d.cts → requestFunnel-BjDpqqvm.d.cts} +25 -2
  80. package/dist/{requestFunnel-CjW7uDuA.d.ts → requestFunnel-DFMGcluw.d.ts} +25 -2
  81. package/dist/{runtime-B8s-_hv8.d.cts → runtimeTypes-gZEJu-da.d.cts} +9 -99
  82. package/dist/{runtime-BR9ysG0J.d.ts → runtimeTypes-w5KqBMcs.d.ts} +9 -99
  83. package/dist/server/events/index.cjs +1 -1
  84. package/dist/server/events/index.d.cts +2 -2
  85. package/dist/server/events/index.d.ts +2 -2
  86. package/dist/server/events/index.js +1 -1
  87. package/dist/server/index.cjs +1 -1
  88. package/dist/server/index.d.cts +3 -3
  89. package/dist/server/index.d.ts +3 -3
  90. package/dist/server/index.js +1 -1
  91. package/dist/televet/booking/index.cjs +1 -0
  92. package/dist/televet/booking/index.d.cts +294 -0
  93. package/dist/televet/booking/index.d.ts +294 -0
  94. package/dist/televet/booking/index.js +1 -0
  95. package/dist/televet/call/index.cjs +1 -0
  96. package/dist/televet/call/index.d.cts +141 -0
  97. package/dist/televet/call/index.d.ts +141 -0
  98. package/dist/televet/call/index.js +1 -0
  99. package/dist/televet/index.cjs +1 -1
  100. package/dist/televet/index.d.cts +87 -5
  101. package/dist/televet/index.d.ts +87 -5
  102. package/dist/televet/index.js +1 -1
  103. package/dist/testing/index.cjs +3 -3
  104. package/dist/testing/index.d.cts +2 -2
  105. package/dist/testing/index.d.ts +2 -2
  106. package/dist/testing/index.js +3 -3
  107. package/dist/testing/rn/index.cjs +1 -1
  108. package/dist/testing/rn/index.d.cts +9 -8
  109. package/dist/testing/rn/index.d.ts +9 -8
  110. package/dist/testing/rn/index.js +1 -1
  111. package/dist/testing/web/index.cjs +1 -1
  112. package/dist/testing/web/index.d.cts +9 -8
  113. package/dist/testing/web/index.d.ts +9 -8
  114. package/dist/testing/web/index.js +1 -1
  115. package/dist/{timelineRows-DZed6dAM.d.ts → timelineRows-C15jxFFH.d.ts} +1 -1
  116. package/dist/{timelineRows-CaohZzXS.d.cts → timelineRows-odO8g9r2.d.cts} +1 -1
  117. package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
  118. package/dist/typeStyle-DmoyacDG.d.ts +111 -0
  119. package/dist/{useRecordsDepth-BHBzJ76R.d.cts → useRecordsDepth-C6rjEaLn.d.cts} +1 -1
  120. package/dist/{useRecordsDepth-BU-OhzH6.d.ts → useRecordsDepth-crhBllQK.d.ts} +1 -1
  121. package/dist/video/index.cjs +1 -1
  122. package/dist/video/index.js +1 -1
  123. package/dist/{view-DtSPYpKa.d.ts → view-Bxwxp4xD.d.ts} +2 -2
  124. package/dist/{view-C3qPIXGX.d.cts → view-DyitEO0m.d.cts} +2 -2
  125. package/dist/web/consent/index.cjs +1 -1
  126. package/dist/web/consent/index.d.cts +5 -5
  127. package/dist/web/consent/index.d.ts +5 -5
  128. package/dist/web/consent/index.js +1 -1
  129. package/dist/web/index.cjs +7 -7
  130. package/dist/web/index.d.cts +18 -17
  131. package/dist/web/index.d.ts +18 -17
  132. package/dist/web/index.js +7 -7
  133. package/dist/web/notifications/index.cjs +2 -2
  134. package/dist/web/notifications/index.d.cts +3 -3
  135. package/dist/web/notifications/index.d.ts +3 -3
  136. package/dist/web/notifications/index.js +2 -2
  137. package/dist/web/records/depth/index.cjs +2 -2
  138. package/dist/web/records/depth/index.d.cts +7 -7
  139. package/dist/web/records/depth/index.d.ts +7 -7
  140. package/dist/web/records/depth/index.js +2 -2
  141. package/dist/web/records/index.cjs +3 -3
  142. package/dist/web/records/index.d.cts +102 -11
  143. package/dist/web/records/index.d.ts +102 -11
  144. package/dist/web/records/index.js +3 -3
  145. package/dist/web/televet/booking/index.cjs +1 -0
  146. package/dist/web/televet/booking/index.d.cts +349 -0
  147. package/dist/web/televet/booking/index.d.ts +349 -0
  148. package/dist/web/televet/booking/index.js +1 -0
  149. package/dist/web/televet/call/index.cjs +1 -0
  150. package/dist/web/televet/call/index.d.cts +142 -0
  151. package/dist/web/televet/call/index.d.ts +142 -0
  152. package/dist/web/televet/call/index.js +1 -0
  153. package/dist/web/televet/index.cjs +1 -1
  154. package/dist/web/televet/index.d.cts +90 -4
  155. package/dist/web/televet/index.d.ts +90 -4
  156. package/dist/web/televet/index.js +1 -1
  157. package/package.json +72 -4
  158. package/televet/booking/package.json +8 -0
  159. package/televet/call/package.json +8 -0
  160. package/web/televet/booking/native-blocked.cjs +12 -0
  161. package/web/televet/booking/package.json +8 -0
  162. package/web/televet/call/native-blocked.cjs +12 -0
  163. package/web/televet/call/package.json +8 -0
  164. package/dist/typeStyle-0TydiZ1w.d.cts +0 -19
  165. package/dist/typeStyle-CWMsoe6b.d.ts +0 -19
@@ -0,0 +1,141 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { T as TelemetryPort } from '../../TelemetryPort-BDNr00hu.js';
4
+ import { O as OptionalModule } from '../../optionalModule-DbJmsq5f.js';
5
+ export { V as VET_CALL_CONSULT_MINUTES, a as VET_CALL_COPY, b as VetCallPhase, i as isSafeRoomUrl, c as isUsableRoomCredential } from '../../callCopy-DoQKG3-L.js';
6
+
7
+ /**
8
+ * A participant's media track. Daily types this `MediaStreamTrack | false | null`: `false` means the track
9
+ * is off, which renders the same as absent. The SDK never reads inside it, so it stays opaque.
10
+ */
11
+ type VetCallTrack = unknown;
12
+ /** One participant in the room, narrowed to what the call surface reads. */
13
+ interface VetCallParticipant {
14
+ readonly local: boolean;
15
+ readonly videoTrack?: VetCallTrack;
16
+ readonly audioTrack?: VetCallTrack;
17
+ }
18
+ /** The Daily events the call surface subscribes to. */
19
+ type VetCallEvent = 'participant-joined' | 'participant-updated' | 'participant-left' | 'left-meeting' | 'error';
20
+ type VetCallHandler = (...args: readonly unknown[]) => void;
21
+ /**
22
+ * The Daily call object, narrowed to the eight members the call surface actually calls. Narrow on purpose:
23
+ * the SDK never asks for host powers. `is_owner` is the CLINICIAN's and the server decides it when it mints
24
+ * the token; it starts recording and grants admit/eject, and nothing here requests either.
25
+ */
26
+ interface VetCallObject {
27
+ join(options: {
28
+ readonly url: string;
29
+ readonly token: string;
30
+ }): Promise<unknown>;
31
+ leave(): Promise<unknown>;
32
+ destroy(): Promise<unknown>;
33
+ participants(): Record<string, VetCallParticipant>;
34
+ setLocalAudio(enabled: boolean): unknown;
35
+ setLocalVideo(enabled: boolean): unknown;
36
+ on(event: VetCallEvent, handler: VetCallHandler): unknown;
37
+ off(event: VetCallEvent, handler: VetCallHandler): unknown;
38
+ }
39
+ /** The props the call surface renders `DailyMediaView` with. */
40
+ interface VetCallMediaViewProps {
41
+ readonly videoTrack: VetCallTrack;
42
+ readonly audioTrack: VetCallTrack;
43
+ readonly mirror?: boolean;
44
+ readonly objectFit?: 'cover' | 'contain';
45
+ readonly style?: unknown;
46
+ }
47
+ /** The shape of `@daily-co/react-native-daily-js` this package uses, and nothing else. */
48
+ interface EverfurDailyModule {
49
+ createCallObject(): VetCallObject;
50
+ readonly DailyMediaView: ComponentType<VetCallMediaViewProps>;
51
+ }
52
+ /** The thunk a partner registers. Typically `() => require('@daily-co/react-native-daily-js')`. */
53
+ type EverfurDailyLoader = () => unknown;
54
+ /**
55
+ * DEVELOPER-FACING, never rendered to a member. It is handed to `onUnavailable` and written to
56
+ * `console.warn` once, so a partner who mounts the call surface without the native peer reads what to do
57
+ * instead of watching a blank screen. End-user copy is never authored in this repository.
58
+ */
59
+ declare const EVERFUR_DAILY_SETUP: string;
60
+ /** A present-but-wrong-shape module (a version whose surface drifted) is treated as unavailable, not trusted. */
61
+ declare function isEverfurDailyModule(candidate: unknown): candidate is EverfurDailyModule;
62
+ /**
63
+ * Register the Daily native module for the in-app vet call. Call it ONCE, in your app entry, before any
64
+ * Everfur call surface mounts:
65
+ *
66
+ * ```ts
67
+ * import { registerEverfurDaily } from '@everfur/sdk/televet';
68
+ * registerEverfurDaily(() => require('@daily-co/react-native-daily-js'));
69
+ * ```
70
+ *
71
+ * Passing `null` unregisters it, which is what a test does between cases. Registering clears the memo, so a
72
+ * later registration always wins over an earlier failed load.
73
+ */
74
+ declare function registerEverfurDaily(next: EverfurDailyLoader | null): void;
75
+ /**
76
+ * The guarded load: a missing loader, a throwing loader and a wrong-shape module all settle to
77
+ * `{ available: false }`. NEVER throws, and never returns a partially usable module.
78
+ *
79
+ * Memoized, because the call surface asks on every render and a `require` on every render of a live video
80
+ * screen is work on the path that can least afford it.
81
+ */
82
+ declare function loadEverfurDaily(): OptionalModule<EverfurDailyModule>;
83
+
84
+ /** Why the call surface refused to render. Both values are DEVELOPER-facing, never shown to a member. */
85
+ type VetCallUnavailableReason = 'dailyMissing' | 'roomUnusable';
86
+ interface EverfurVetCallProps {
87
+ /** The `room_url` the server minted for this consult. Must be https; anything else is refused. */
88
+ readonly roomUrl: string;
89
+ /** The short-lived, per-participant join token. NEVER rendered, NEVER logged, NEVER a telemetry prop. */
90
+ readonly token: string;
91
+ /** Called once the member has left, so the host can pop the screen. */
92
+ readonly onLeave: () => void;
93
+ /** Shown in the lobby while the clinician has not joined. Null in production today; never invented. */
94
+ readonly clinicianName?: string | null | undefined;
95
+ /** The pet's display name for the lobby's prep line; absent, the pet-free form is used. */
96
+ readonly petName?: string | null | undefined;
97
+ /**
98
+ * Host/test seam: the Daily module, instead of the one `registerEverfurDaily` registered. A partner with
99
+ * its own module resolution passes it here and calls no register function at all.
100
+ */
101
+ readonly daily?: EverfurDailyModule | undefined;
102
+ /** Your analytics sink for the two call events. Defaults to a no-op; never receives a credential. */
103
+ readonly telemetry?: TelemetryPort | undefined;
104
+ /**
105
+ * Called instead of rendering when the call cannot run, with a developer-facing explanation. `dailyMissing`
106
+ * means the native modules are not registered; `roomUnusable` means the credential failed its floor.
107
+ */
108
+ readonly onUnavailable?: ((reason: VetCallUnavailableReason, detail: string) => void) | undefined;
109
+ /**
110
+ * What to draw when the call cannot run. THE SDK DRAWS NOTHING BY DEFAULT, and that is deliberate: there is
111
+ * no owner-approved member-facing sentence for "this app was built without the video modules", and this
112
+ * package does not author user-facing copy. The consumer app's own answer to a missing native module is to
113
+ * fall back to the browser (`televetJoin.ts`: "an owner on an old build still gets into the consult, in a
114
+ * browser, instead of a crash"), so the intended wiring here is the same:
115
+ *
116
+ * ```tsx
117
+ * <VetCall ... renderUnavailable={() => <VetVisitButton visitRef={visitRef} intent="join" />} />
118
+ * ```
119
+ */
120
+ readonly renderUnavailable?: ((reason: VetCallUnavailableReason, detail: string) => ReactNode) | undefined;
121
+ readonly style?: StyleProp<ViewStyle>;
122
+ }
123
+ /** The in-app consult. Mount it with the credentials `POST /consults/{id}/join` returned. */
124
+ declare function EverfurVetCall(props: EverfurVetCallProps): ReactNode;
125
+
126
+ interface EverfurVetCallLobbyProps {
127
+ /** Null until the consult carries a display name. NEVER invented. */
128
+ readonly clinicianName?: string | null | undefined;
129
+ /** Null when the roster has not resolved; the prep line degrades, it does not break. */
130
+ readonly petName?: string | null | undefined;
131
+ readonly micOn: boolean;
132
+ readonly cameraOn: boolean;
133
+ readonly onToggleMic: () => void;
134
+ readonly onToggleCamera: () => void;
135
+ readonly onLeave: () => void;
136
+ readonly style?: StyleProp<ViewStyle>;
137
+ }
138
+ /** The waiting room shown until the clinician's video track arrives. Mounted by `EverfurVetCall`. */
139
+ declare function EverfurVetCallLobby(props: EverfurVetCallLobbyProps): ReactNode;
140
+
141
+ export { EVERFUR_DAILY_SETUP, type EverfurDailyLoader, type EverfurDailyModule, EverfurVetCall, EverfurVetCallLobby, type EverfurVetCallLobbyProps, type EverfurVetCallProps, OptionalModule, TelemetryPort, type VetCallEvent, type VetCallHandler, type VetCallMediaViewProps, type VetCallObject, type VetCallParticipant, type VetCallTrack, type VetCallUnavailableReason, isEverfurDailyModule, loadEverfurDaily, registerEverfurDaily };
@@ -0,0 +1 @@
1
+ import {createContext,forwardRef,createElement,useMemo,useRef,useEffect,useState,useCallback,useContext}from'react';import {TextInput,useWindowDimensions,View,Pressable,StyleSheet,Text,Animated}from'react-native';import {useSafeAreaInsets}from'react-native-safe-area-context';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var fr=Object.defineProperty;var n=(e,r)=>fr(e,"name",{value:r,configurable:true});var yr=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function y(e,r){let t=e.type,a=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:a}:{fontFamily:a,fontWeight:t.weight[yr[r]]}}n(y,"face");var De=Object.freeze({track(){},trackExpectedFailure(){}});function Fe(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}n(Fe,"isSafeRoomUrl");function te(e,r){return Fe(e)&&r.trim().length>0}n(te,"isUsableRoomCredential");function Le(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(Le,"reportHostFailure");function mr(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(mr,"isThenable");function ne(e,...r){if(typeof e=="function")try{let t=e(...r);return mr(t)&&Promise.resolve(t).then(void 0,Le),t}catch(t){Le(t);return}}n(ne,"callHost");var Ve=new WeakMap;function pr(e){if(typeof e!="function")return;let r=Ve.get(e);if(r!==void 0)return r;let t=n((...a)=>{ne(e,...a);},"guarded");return Ve.set(e,t),t}n(pr,"guardHost");function Oe(e,r){let t=null;for(let a of r){let o=e[a];typeof o=="function"&&(t??={...e},t[a]=pr(o));}return t??e}n(Oe,"guardHostProps");var A=10,l=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:n(e=>{let r=e?.trim()??"";return r.length>0?`${r} is joining`:l.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:n(e=>{let r=e?.trim()??"";return r.length>0?`Have ${r} nearby and somewhere well lit.`:l.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:n(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again."});function Ie(e){let r=Math.max(0,Math.floor(e/1e3)),t=String(r%60).padStart(2,"0"),a=Math.floor(r%3600/60),o=Math.floor(r/3600);return o>0?`${o}:${String(a).padStart(2,"0")}:${t}`:`${a}:${t}`}n(Ie,"formatElapsed");function le(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))le(e[r]);}return e}n(le,"deepFreeze");var gr=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Pe={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Me={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Ae={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},br={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},vr={regular:"400",medium:"500",bold:"700"},Tr={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},hr=0,z="System",j="monospace",Er=["content","heading","control","compact","badge"];function Cr(e){let r={};for(let t of Er)r[t]=e;return r}n(Cr,"authoredTierSizes");function Be(){return {family:z,mono:j,fontUrl:null,families:{regular:z,medium:z,bold:z,mono:j,monoMedium:j,monoBold:j},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Ae,tierSizes:Cr(Ae),lineHeight:br,weight:vr,letterSpacing:Tr,scale:1,maxScale:hr,scaleCaps:gr}}n(Be,"baseType");var Ne={},oe=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function ae(e){return `cubic-bezier(${e.join(", ")})`}n(ae,"cssCubicBezier");var _e={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:ae(oe.standard),emphasized:ae(oe.emphasized),exit:ae(oe.exit)},reducedMotion:false},xr={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)"},ze=le({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:xr,space:Pe,radius:Me,type:Be(),motion:_e,slots:Ne}),kr={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)"};le({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:kr,space:Pe,radius:Me,type:Be(),motion:_e,slots:Ne});var je=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),He=globalThis,ie=He[je]??(He[je]=createContext(ze));ie.displayName??="EverfurThemeContext";function k(){return useContext(ie)}n(k,"useEverfurTheme");function Lr(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(Lr,"tierMultiplier");function m({tier:e="content",...r}){let{type:t}=k(),a=Lr(t,e);return createElement(Text,a===void 0?r:{maxFontSizeMultiplier:a,...r})}n(m,"Text");forwardRef(n(function(r,t){return createElement(TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function We(e,r,t){let a;try{a=r();}catch(p){return se(`optional peer '${e}' is not installed: ${Or(p)}`)}let o=Vr(a);return o==null?se(`optional peer '${e}' resolved to no module`):t&&!t(o)?se(`optional peer '${e}' is present but failed its shape check`):Object.freeze({available:true,module:o})}n(We,"optionalModule");function Vr(e){return typeof e=="object"&&e!==null&&"default"in e&&Object.keys(e).length<=2?e.default:e}n(Vr,"unwrapDefault");function se(e){return Object.freeze({available:false,module:null,reason:e})}n(se,"frozenUnavailable");function Or(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown load error"}n(Or,"describe");var de="[everfur] The in-app vet call needs the Daily native modules, which this app has not registered. Install @daily-co/react-native-daily-js, @daily-co/react-native-webrtc and (Expo) @daily-co/config-plugin-rn-daily-js, rebuild the native app (a JS-only OTA cannot add a native module), and call registerEverfurDaily(() => require('@daily-co/react-native-daily-js')) once in your app entry. ON EXPO GO THIS CANNOT BE FIXED BY INSTALLING: Expo Go runs a fixed set of native modules and cannot load Daily at any version, so you need a development build (expo prebuild, then run the native app) before the in-app call works at all. Until then, fall back to VetVisitButton, which opens the visit in the browser and needs no native module.",ue="@daily-co/react-native-daily-js",Ir=`optional peer '${ue}' has no registered loader`,Ge=`optional peer '${ue}' is present but failed its shape check`;function U(e){return typeof e=="object"&&e!==null}n(U,"isRecordLike");function Ar(e){return U(e)&&"box"in e}n(Ar,"isDailyBox");function Pr(e){let r=U(e.default)?e.default:{},t=e.createCallObject??r.createCallObject,a=e.DailyMediaView??r.DailyMediaView,o={createCallObject:t,DailyMediaView:a};return $e(o)?o:null}n(Pr,"normalizeDailyModule");function $e(e){if(!U(e)||typeof e.createCallObject!="function")return false;let r=e.DailyMediaView;return typeof r=="function"||typeof r=="object"&&r!==null}n($e,"isEverfurDailyModule");var Ye=null,g=null;function H(e){return Object.freeze({available:false,module:null,reason:e})}n(H,"unavailable");function Mr(e){Ye=e,g=null;}n(Mr,"registerEverfurDaily");function ce(){if(g!==null)return g;let e=Ye;if(e===null)return g=H(Ir),g;let r=We(ue,()=>({box:e()}),Ar);if(!r.available)return g=H(r.reason),g;let t=r.module.box;if(!U(t))return g=H(Ge),g;let a=Pr(t);return g=a===null?H(Ge):Object.freeze({available:true,module:a}),g}n(ce,"loadEverfurDaily");var v=Object.freeze({surface:"rgba(255,255,255,0.08)",surfaceRaised:"rgba(255,255,255,0.14)",surfaceActive:"rgba(255,255,255,0.24)",hairline:"rgba(255,255,255,0.18)",glyph:"rgba(255,255,255,0.72)",textSecondary:"rgba(255,255,255,0.78)",textTertiary:"rgba(255,255,255,0.56)"}),Ke=3,Xe=180,Ze=420,qe=.35,Ur=.6,Wr=360,Gr=132,$r=184,Yr=44;function Kr({reducedMotion:e,styles:r}){let t=useRef(Array.from({length:Ke},()=>new Animated.Value(qe))).current;return useEffect(()=>{if(e)return;let a=t.map((o,p)=>Animated.loop(Animated.sequence([Animated.delay(p*Xe),Animated.timing(o,{toValue:1,duration:Ze,useNativeDriver:true}),Animated.timing(o,{toValue:qe,duration:Ze,useNativeDriver:true}),Animated.delay((Ke-p-1)*Xe)])));for(let o of a)o.start();return ()=>{for(let o of a)o.stop();}},[e,t]),jsx(View,{style:r.dotRow,testID:"everfur-vet-lobby-dots",accessibilityElementsHidden:true,importantForAccessibility:"no",children:t.map((a,o)=>jsx(Animated.View,{style:[r.dot,{opacity:e?Ur:a}]},o))})}n(Kr,"WaitingDots");function Je({label:e,active:r,onPress:t,testID:a,styles:o}){return jsx(Pressable,{onPress:t,testID:a,accessibilityRole:"button",accessibilityState:{selected:!r},accessibilityLabel:e,style:[o.control,r?null:o.controlOff],children:jsx(m,{tier:"control",style:o.controlLabel,children:e})})}n(Je,"LobbyControl");function fe(e){let{clinicianName:r,petName:t,micOn:a,cameraOn:o,onToggleMic:p,onToggleCamera:L,onLeave:Y,style:M}=e,T=k(),i=useMemo(()=>Xr(T),[T]),h=useSafeAreaInsets(),{width:s}=useWindowDimensions(),x=s<Wr?Gr:$r;return jsxs(View,{style:[i.root,{paddingTop:h.top+T.space.sm,paddingBottom:h.bottom+T.space.lg},M],testID:"everfur-vet-lobby",children:[jsx(View,{style:i.topRow,children:jsx(Pressable,{onPress:Y,accessibilityRole:"button",accessibilityLabel:l.leaveCta,testID:"everfur-vet-lobby-leave",hitSlop:12,style:i.leaveHit,children:jsx(m,{tier:"control",style:i.leaveLabel,children:l.leaveCta})})}),jsxs(View,{style:i.center,children:[jsxs(View,{style:[i.avatar,{width:x,height:x,borderRadius:x/2}],testID:"everfur-vet-lobby-avatar",accessibilityElementsHidden:true,importantForAccessibility:"no",children:[jsx(View,{style:i.avatarGlyphHead}),jsx(View,{style:i.avatarGlyphBody})]}),jsxs(View,{accessibilityLiveRegion:"polite",accessible:true,children:[jsx(m,{tier:"heading",style:i.title,testID:"everfur-vet-lobby-title",children:l.lobbyTitle(r)}),jsx(m,{style:i.subtitle,testID:"everfur-vet-lobby-subtitle",children:l.lobbySubtitle})]}),jsx(Kr,{reducedMotion:T.motion.reducedMotion,styles:i})]}),jsxs(View,{style:i.prepCard,testID:"everfur-vet-lobby-prep",children:[jsx(m,{tier:"badge",style:i.prepLabel,children:l.lobbyPrepLabel}),jsx(m,{style:i.prepBody,children:l.lobbyPrep(t)})]}),jsxs(View,{style:i.controls,children:[jsx(Je,{label:a?l.muteCta:l.unmuteCta,active:a,onPress:p,testID:"everfur-vet-lobby-mic",styles:i}),jsx(Je,{label:o?l.cameraOffCta:l.cameraOnCta,active:o,onPress:L,testID:"everfur-vet-lobby-camera",styles:i})]}),jsx(m,{tier:"badge",style:i.duration,testID:"everfur-vet-lobby-duration",children:l.lobbyDuration(10)})]})}n(fe,"EverfurVetCallLobby");function Xr(e){let{color:r,space:t,radius:a,type:o}=e;return StyleSheet.create({root:{flex:1,backgroundColor:r.brand,paddingHorizontal:t.lg},topRow:{flexDirection:"row",alignItems:"center"},leaveHit:{minHeight:Yr,justifyContent:"center",paddingVertical:t.xs,paddingRight:t.md},leaveLabel:{...y(e,"medium"),color:r.text.onBrand,fontSize:o.size.body},center:{flex:1,alignItems:"center",justifyContent:"center"},avatar:{alignItems:"center",justifyContent:"center",borderWidth:2,borderColor:r.success,backgroundColor:v.surface,marginBottom:t.lg,overflow:"hidden"},avatarGlyphHead:{width:34,height:34,borderRadius:17,borderWidth:2,borderColor:v.glyph,marginBottom:6},avatarGlyphBody:{width:66,height:33,borderTopLeftRadius:33,borderTopRightRadius:33,borderWidth:2,borderBottomWidth:0,borderColor:v.glyph},title:{...y(e,"bold"),color:r.text.onBrand,fontSize:o.size.heading,lineHeight:Math.round(o.size.heading*o.lineHeight.snug),textAlign:"center",paddingHorizontal:t.sm},subtitle:{...y(e,"regular"),color:v.textSecondary,fontSize:o.size.body,textAlign:"center",marginTop:t.xs},dotRow:{flexDirection:"row",gap:t.xs,marginTop:t.lg},dot:{width:8,height:8,borderRadius:4,backgroundColor:r.success},prepCard:{borderRadius:a.lg,borderWidth:1,borderColor:v.hairline,backgroundColor:v.surface,padding:t.lg,marginBottom:t.lg},prepLabel:{...y(e,"medium"),color:r.accent,fontSize:o.size.micro,letterSpacing:1.2,marginBottom:t.sm},prepBody:{...y(e,"regular"),color:r.text.onBrand,fontSize:o.size.subtitle,lineHeight:Math.round(o.size.subtitle*o.lineHeight.relaxed)},controls:{flexDirection:"row",justifyContent:"center",gap:t.lg,marginBottom:t.lg},control:{minWidth:96,minHeight:48,paddingHorizontal:t.md,alignItems:"center",justifyContent:"center",borderRadius:a.pill,backgroundColor:v.surfaceRaised},controlOff:{backgroundColor:v.surfaceActive},controlLabel:{...y(e,"medium"),color:r.text.onBrand,fontSize:o.size.caption},duration:{...y(e,"medium"),color:v.textTertiary,fontSize:o.size.micro,letterSpacing:1.6,textAlign:"center"}})}n(Xr,"makeStyles");function me(e){return e??null}n(me,"asTrack");function qr(e){return !!e?.videoTrack}n(qr,"hasVideo");function pe({label:e,onPress:r,testID:t,muted:a=false,danger:o=false,styles:p}){return jsx(Pressable,{onPress:r,testID:t,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{selected:a},style:[p.control,a?p.controlMuted:null,o?p.controlDanger:null],children:jsx(m,{tier:"control",style:[p.controlLabel,a?p.controlLabelMuted:null],children:e})})}n(pe,"CallControl");function Jr(e){let{roomUrl:r,token:t,onLeave:a,clinicianName:o,petName:p,daily:L,telemetry:Y,onUnavailable:M,renderUnavailable:T,style:i}=Oe(e,["onLeave"]),h=k(),s=useMemo(()=>tt(h),[h]),x=useSafeAreaInsets(),ge=Y??De,K=useRef(ge);useEffect(()=>{K.current=ge;});let X=useRef(a);useEffect(()=>{X.current=a;});let V=useRef(null),[ar,B]=useState("joining"),[Z,lr]=useState(null),[be,ir]=useState(null),[q,sr]=useState(true),[N,dr]=useState(true),[O,ur]=useState(null),[ve,Te]=useState(0),he=te(r,t),R=useMemo(()=>he?L?{available:true,module:L,reason:""}:ce():null,[he,L]),I=R?.available?R.module:null,E=useMemo(()=>R===null?{reason:"roomUnusable",detail:"[everfur] The vet call needs an https room URL and a non-empty join token."}:R.available?null:{reason:"dailyMissing",detail:`${de} (${R.reason})`},[R]),J=useRef(false);useEffect(()=>{if(E===null){J.current=false;return}if(ne(M,E.reason,E.detail),!J.current){J.current=true;try{globalThis.console?.warn?.(E.detail);}catch{}}},[E,M]);let _=useCallback(async()=>{let u=V.current;if(V.current=null,!!u){try{await u.leave();}catch{}try{await u.destroy();}catch{}}},[]);useEffect(()=>{if(I===null)return;let u=false,f=I.createCallObject();V.current=f;let ee=n(()=>{let D=Object.values(f.participants());ir(D.find(re=>re.local)??null),lr(D.find(re=>!re.local)??null);},"syncParticipants"),we=["participant-joined","participant-updated","participant-left"];for(let D of we)f.on(D,ee);let Se=n(()=>{u||(B("left"),X.current());},"onLeftMeeting"),Re=n(()=>{u||B("error");},"onError");return f.on("left-meeting",Se),f.on("error",Re),f.join({url:r,token:t}).then(()=>{u||(B("joined"),ur(Date.now()),ee(),K.current.track("televet.call.joined",{provider:"daily"}));}).catch(()=>{u||(B("error"),K.current.trackExpectedFailure("televet.call.join_failed",{provider:"daily"}));}),()=>{u=true;for(let D of we)f.off(D,ee);f.off("left-meeting",Se),f.off("error",Re),_();}},[I,r,t,_]),useEffect(()=>{if(O===null)return;Te(Date.now()-O);let u=setInterval(()=>{Te(Date.now()-O);},1e3);return ()=>{clearInterval(u);}},[O]);let Ee=useCallback(()=>{let u=V.current;u&&sr(f=>(u.setLocalAudio(!f),!f));},[]),Ce=useCallback(()=>{let u=V.current;u&&dr(f=>(u.setLocalVideo(!f),!f));},[]),Q=useCallback(()=>{_().then(()=>X.current());},[_]);if(E!==null)return T?jsx(Fragment,{children:T(E.reason,E.detail)}):null;if(I===null)return null;if(ar==="error")return jsxs(View,{style:[s.centered,i],testID:"everfur-vet-call-error",children:[jsx(m,{style:s.status,accessibilityLiveRegion:"polite",children:l.joinFailedReason}),jsx(Pressable,{onPress:Q,accessibilityRole:"button",accessibilityLabel:l.leaveCta,testID:"everfur-vet-call-error-leave",style:s.errorLeaveHit,children:jsx(m,{tier:"control",style:s.errorLeave,children:l.leaveCta})})]});if(!qr(Z))return jsx(fe,{clinicianName:o,petName:p,micOn:q,cameraOn:N,onToggleMic:Ee,onToggleCamera:Ce,onLeave:Q,style:i});let xe=I.DailyMediaView,ke=o?.trim()??"",cr=ve>=10*6e4;return jsxs(View,{style:[s.root,i],testID:"everfur-vet-call",children:[jsx(View,{style:s.fill,testID:"everfur-vet-call-remote",children:jsx(xe,{videoTrack:me(Z?.videoTrack),audioTrack:me(Z?.audioTrack),mirror:false,objectFit:"cover",style:s.fill})}),jsxs(View,{style:[s.statusRow,{top:x.top+h.space.sm}],pointerEvents:"none",children:[ke.length>0?jsx(m,{tier:"compact",style:s.statusName,numberOfLines:1,testID:"everfur-vet-call-remote-name",children:ke}):null,O!==null?jsx(m,{tier:"badge",style:[s.statusMeta,cr?s.statusMetaOver:null],testID:"everfur-vet-call-elapsed",children:Ie(ve)}):null]}),jsx(View,{style:[s.selfView,{top:x.top+h.space.sm}],testID:"everfur-vet-call-self",children:be?.videoTrack&&N?jsx(xe,{videoTrack:me(be.videoTrack),audioTrack:null,mirror:true,objectFit:"cover",style:s.fill}):jsx(View,{style:s.selfViewOff,testID:"everfur-vet-call-self-off",children:jsx(m,{tier:"badge",style:s.selfViewOffLabel,children:l.cameraOnCta})})}),jsxs(View,{style:[s.controlBar,{bottom:x.bottom+h.space.lg}],children:[jsx(pe,{label:q?l.muteCta:l.unmuteCta,muted:!q,onPress:Ee,testID:"everfur-vet-call-mic",styles:s}),jsx(pe,{label:N?l.cameraOffCta:l.cameraOnCta,muted:!N,onPress:Ce,testID:"everfur-vet-call-camera",styles:s}),jsx(pe,{label:l.leaveCta,danger:true,onPress:Q,testID:"everfur-vet-call-leave",styles:s})]})]})}n(Jr,"EverfurVetCall");var rr="#141414",Qr="#1B1B1B",et="rgba(20,20,20,0.62)",rt="#141414",tr=104,nr={textShadowColor:"rgba(0,0,0,0.55)",textShadowRadius:6};function tt(e){let{color:r,space:t,radius:a,type:o}=e;return StyleSheet.create({root:{flex:1,backgroundColor:rr},fill:{...StyleSheet.absoluteFillObject},centered:{flex:1,alignItems:"center",justifyContent:"center",gap:t.lg,padding:t.xl,backgroundColor:rr},statusRow:{position:"absolute",left:t.md,right:tr+t.md*2,flexDirection:"column",alignItems:"flex-start",gap:2},statusName:{flexShrink:1,...y(e,"medium"),color:r.text.onBrand,fontSize:o.size.body,...nr},statusMeta:{...y(e,"mono"),color:r.text.onBrand,fontSize:o.size.caption,...nr},statusMetaOver:{color:r.danger},selfView:{position:"absolute",right:t.md,width:tr,height:148,borderRadius:a.lg,overflow:"hidden",backgroundColor:Qr,borderWidth:1,borderColor:"rgba(255,255,255,0.24)",shadowColor:"#000",shadowOpacity:.35,shadowRadius:12,shadowOffset:{width:0,height:4},elevation:6},selfViewOff:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xs},selfViewOffLabel:{...y(e,"medium"),color:"rgba(255,255,255,0.78)",fontSize:o.size.micro,textAlign:"center"},controlBar:{position:"absolute",left:0,right:0,flexDirection:"row",justifyContent:"center",alignItems:"center",gap:t.md},control:{minWidth:76,minHeight:56,paddingHorizontal:t.md,alignItems:"center",justifyContent:"center",borderRadius:a.pill,backgroundColor:et},controlMuted:{backgroundColor:r.text.onBrand},controlDanger:{backgroundColor:r.danger},controlLabel:{...y(e,"medium"),color:r.text.onBrand,fontSize:o.size.caption},controlLabelMuted:{color:rt},status:{...y(e,"medium"),fontSize:o.size.subtitle,lineHeight:Math.round(o.size.subtitle*o.lineHeight.relaxed),color:r.surface,textAlign:"center"},errorLeaveHit:{minHeight:44,minWidth:44,alignItems:"center",justifyContent:"center",paddingHorizontal:t.lg},errorLeave:{...y(e,"medium"),color:r.surface,fontSize:o.size.body,textDecorationLine:"underline"}})}n(tt,"makeStyles");export{de as EVERFUR_DAILY_SETUP,Jr as EverfurVetCall,fe as EverfurVetCallLobby,A as VET_CALL_CONSULT_MINUTES,l as VET_CALL_COPY,$e as isEverfurDailyModule,Fe as isSafeRoomUrl,te as isUsableRoomCredential,ce as loadEverfurDaily,Mr as registerEverfurDaily};
@@ -1 +1 @@
1
- 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var dr=Object.defineProperty;var n=(e,r)=>dr(e,"name",{value:r,configurable:true});var $=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($.map(e=>e.wireCode));var cr=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"}),me=Object.freeze($.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:cr[e.wireCode]}))),fr=new Map(me.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),pr=Object.freeze(["http_envelope",...[...new Set(me.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function N(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...pr]){let i=fr.get(o+t);if(i)return i}}n(N,"contractErrorFor");function yr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(yr,"contractDocUrl");function ve(e){return null}n(ve,"publishedDocUrl");var mr=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 be(e){return mr[e]}n(be,"categoryFor");function Ee(e){let r=N(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(o){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"}}n(Ee,"fromWire");var vr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Q(e){return vr.has(e)}n(Q,"isAutoRetryable");var br=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function ge(e){return Q(e)||br.has(e)}n(ge,"isRetryableCode");var Er=500,X=8e3,he=4;function _e(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Er*2**t,X);return Math.floor(r()*o)}n(_e,"backoffDelayMs");var gr=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 J(e){return gr[e]}n(J,"userFacingError");function Re(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(Re,"defineHidden");var hr=/^[a-z][a-z0-9_]{0,63}$/;function w(e,r){let t=N(r?.wireCode,r?.wireEnvelope),o={code:e,category:be(e),retryable:r?.retryable??ge(e),displayMessage:J(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&hr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&Re(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&Re(o,"raw",r.raw),Object.freeze(o)}n(w,"makeEverfurError");function Z(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(Z,"ok");function R(e){return Object.freeze({ok:false,error:e})}n(R,"err");var L=class L extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,L.prototype);}};n(L,"EverfurConfigError");var A=L;function Te(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})}n(Te,"errorFrame");function Tr(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(Tr,"authHeaders");function P(e,r){return {...e,headers:{...Cr(e.headers),...Tr(r)}}}n(P,"withAuthHeaders");function Cr(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(Cr,"stripAuthHeaders");async function Ce(e,r){if(r.mode==="anonymous")return r.transport.request(P(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return R(ee())}let o=await r.transport.request(P(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return R(ee())}let a=await r.transport.request(P(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?R(ee(a.error.httpStatus)):a}n(Ce,"authedSend");function ee(e){return w("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(ee,"authRejectedError");function xe(e){return w("internalError",{retryable:true,wireMessage:xr(e)})}n(xe,"networkError");function xr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(xr,"describeCause");var wr=3e4,Sr=X*2,kr="idempotency-key",Fr=new Set(["POST","PUT","PATCH","DELETE"]),Or=Object.freeze({onEvent(){}}),Vr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function Se(e){let r=e.observer??Or,t=e.timers??Vr,o=e.rng??Math.random,i=e.sleep??((d,c)=>qr(d,t,c)),a=e.maxAttempts??he,l=e.unaryTimeoutMs??wr,u=e.newIdempotencyKey??Ar(),s=n(d=>{try{r.onEvent(d);}catch{}},"emit");async function p(d,c,y){let h=y?.maxAttempts,f=Math.max(1,h??a),E=y?.idempotent??Fr.has(c.method)?u():null,k=Ir(c,E),F=0;for(;;){let g=n(x=>Object.freeze({call:d,method:c.method,path:c.path,attempt:F,...E?{idempotencyKey:E}:{},...x}),"stamp");s(g({phase:"attempt"}));let O=Br(l,t),D=Hr(O.signal,c.signal),V;try{V=await Ce({...k,signal:D.signal},e.auth);}catch(x){V=R(xe(x));}finally{D.dispose(),O.cancel();}if(V.ok)return s(g({phase:"settled",ok:true,reason:"ok"})),V;let m=V.error,_=zr(m,F,{maxAttempts:f,rng:o,now:t.now(),aborted:c.signal?.aborted===true,...h!==void 0?{perCallMaxAttempts:h}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),C={ok:false,code:m.code,reason:_.reason,...m.httpStatus!==void 0?{httpStatus:m.httpStatus}:{},...m.requestId!==void 0?{requestId:m.requestId}:{}};if(!_.retry)return s(g({phase:"settled",...C})),R(m);if(s(g({phase:"retry",...C,delayMs:_.delayMs})),await i(_.delayMs,c.signal),c.signal?.aborted===true)return s(g({phase:"settled",...C,reason:"aborted"})),R(m);F+=1;}}n(p,"send");async function v(d){return P(d,await Mr(e.auth))}n(v,"authorize");async function*b(d,c,y){s(Object.freeze({call:d,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,y);}catch{yield Te({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(b,"stream"),Object.freeze({send:p,authorize:v,stream:b})}n(Se,"createRequestFunnel");function Ir(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==kr&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(Ir,"assembleHeaders");function Ar(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(Ar,"defaultIdempotencyKeyFactory");var Pr=10;function zr(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=jr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!Q(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let l=n(()=>{if(t.policy===void 0)return null;let p;try{p=t.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(Pr,Math.floor(p)))},"policyCeiling"),u=t.perCallMaxAttempts??l()??t.maxAttempts;if(r+1>=u)return {retry:false,reason:"attempts-exhausted"};let s=Dr(e,t.now);return s!==null?s>Sr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:s}:{retry:true,reason:i,delayMs:_e(r,t.rng)}}n(zr,"decideRetry");function jr(e){let r=e.code==="unknown"?Ee(Ur(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(jr,"throttleKind");function Dr(e,r){let t=Nr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(Dr,"retryOverrideMs");function Nr(e){for(let r of ke(e)){let t=r.resets_at,o=Lr(t);if(o!==null)return o}return null}n(Nr,"findResetsAt");function ke(e){if(!we(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];we(o)&&r.push(o);}return r}n(ke,"candidateScopes");function Lr(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(Lr,"parseInstantMs");function Ur(e){for(let r of ke(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(Ur,"rawWireCode");function we(e){return typeof e=="object"&&e!==null}n(we,"isRecord");async function Mr(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}:{}}}n(Mr,"resolveDeviceAuth");function Br(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Br,"boundedSignal");function Hr(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Hr,"mergeSignals");function qr(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n(qr,"delayAbortable");var U=Object.freeze(["visit","join","summary","messages"]);function M(e){return typeof e=="string"&&U.includes(e)}n(M,"isVetVisitIntent");var Yr="/widget/v1/televet/handoffs",Wr="/widget/v1/televet/availability",Kr="/widget/v1/televet/chat-entry",Gr=/^[a-z0-9][a-z0-9_-]{0,39}$/,ze=/^[A-Za-z0-9_-]{22}$/,Fe="everfur_flow",Oe=32,Ve=128,Ie=64;function B(e){let r=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 r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n(B,"vetVisitErrorReasonOf");function Ae(e){return R(w("validationFailed",{retryable:false,wireMessage:e}))}n(Ae,"invalid");function re(e){return R(w("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(re,"unusable");function $r(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!Gr.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,l=r?.intent,u=a!=null;if(u){let s=typeof a=="string"?a.trim():"";if(s.length<1||[...s].length>Ie)return {ok:false,message:`visitRef must be 1..${Ie} characters`};t.visit_ref=s;}if(l!=null){if(!u)return {ok:false,message:"intent needs the visitRef it opens"};if(!M(l))return {ok:false,message:`intent must be one of ${U.join(", ")}`};t.intent=l;}return {ok:true,body:t}}n($r,"handoffBody");function Qr(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!M(t)?null:Object.freeze({visitRef:r,intent:t})}n(Qr,"parseVisitEcho");function je(e){let r=e.funnel??Se({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(Pe(t,"televet.visit.handoff_failed",{reason:B(i)}),R(i)),"failed");return {async createHandoff(i,a){let l;if(i!=null){let f=typeof i=="string"?[...i].length:0;if(f<1||f>Ve)return o(w("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Ve} characters`}));l=i;}let u=$r(l,a);if(!u.ok){let f=Ae(u.message);return f.ok?f:o(f.error)}let s=u.body,p=await r.send("televet.visit.handoff",{method:"POST",path:Yr,body:s},{idempotent:false,maxAttempts:1});if(!p.ok)return o(p.error);let v=Jr(p.value),b=s.return_to!==void 0,d=b?p.value?.flow_id:void 0;if(b&&(typeof d!="string"||!ze.test(d))){let f=re("the handoff response carried no usable return flow id");return f.ok?f:o(f.error)}let c=s.visit_ref!==void 0,y=c?Qr(p.value?.visit):null;if(c&&y===null){let f=re("the handoff response did not confirm the visit it opens");return f.ok?f:o(f.error)}let h=v===null?null:Object.freeze({...v,...b?{flowId:d}:{},...y!==null?{visit:y}:{}});return h===null?o(w("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(Pe(t,"televet.visit.handoff_created",{pet_scoped:s.pet_ref!==void 0}),Z(h))},async checkAvailability(i){if(typeof i!="string"||i.length>Oe)return Ae(`state must be at most ${Oe} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:Wr,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return R(a.error);let l=a.value?.available;return typeof l!="boolean"?re("the availability response carried no usable answer"):Z(Object.freeze({available:l}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:Kr},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(je,"createVetVisitController");function Xr(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Fe}=`)).map(a=>a.slice(Fe.length+1));return i.length!==1||!ze.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(Xr,"parseVetVisitReturn");function Jr(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!tt(r)?null:Object.freeze({url:r,expiresAt:t})}n(Jr,"parseHandoff");var Zr=new Set(["localhost","127.0.0.1","[::1]"]),et=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,rt=/[\s\u0000-\u001f\u007f]/;function tt(e){if(rt.test(e))return false;let r=et.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",l=t==="http"&&Zr.has(i);if(!a&&!l)return false;let u=e.indexOf("#");if(u<0)return false;let s=e.slice(u);return s.startsWith("#h=")&&s.length>3}n(tt,"isOpenableVisitUrl");function Pe(e,r,t){if(e)try{e.track(r,t);}catch{}}n(Pe,"safeTrack");var De=Symbol.for("@everfur/sdk#EverfurContext@v1"),Ne=globalThis,Le=Ne[De]??(Ne[De]=react.createContext(null));Le.displayName??="EverfurContext";function H(){let e=react.useContext(Le);if(e===null)throw new A("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(H,"useEverfurContext");var it=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 at(e){return it[e]}n(at,"requires");function Ue(e,r,t){let o=at(e),i=new Map;for(let u of r)i.set(u.resource,u);if(t?.isPending===true&&o.some(u=>!i.has(u)))return te({name:e,enabled:false,isPending:true,limits:{}});let a=st(o,i);return o.filter(u=>i.get(u)?.granted!==true).length===0?te({name:e,enabled:true,isPending:false,limits:a}):te({name:e,enabled:false,isPending:false,limits:a,disabled:lt(o,i)})}n(Ue,"decideCapability");function st(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,l]of Object.entries(i)){let u=t[a];t[a]=u===void 0?l:Math.min(u,l);}}return t}n(st,"mergeLimits");function lt(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:J("accessDenied"),level:"user_entitlement",recoverable:false})}n(lt,"disabledFor");function te(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(te,"freezeDecision");function Me(e){let{runtime:r}=H(),t=r.entitlements,o=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>Ue(e,o.decisions,{isPending:o.isPending}),[e,o])}n(Me,"useCapability");var He=Object.freeze({status:"idle",error:null,errorReason:null});function ft(e,r,t){let{usState:o,chat:i,scope:a}=t,l=r&&(o!==null||i),u=`${o??""}|${i?"chat":""}`,[s,p]=react.useState(null);if(react.useEffect(()=>{if(!l)return;let b=true,d=e.current;return p(null),n(async()=>{try{if(i&&!(d.chatEntryOpen&&await d.chatEntryOpen()))return !1;if(o===null)return !0;if(!d.checkAvailability)return !1;let y=await d.checkAvailability(o);return y.ok&&y.value.available}catch{return false}},"ask")().then(y=>{b&&p({key:u,open:y});}),()=>{b=false;}},[l,u,o,i,a,e]),!l)return null;let v=s!==null&&s.key===u;return {open:v&&s.open,pending:!v}}n(ft,"usePreflight");var pt=Object.freeze({status:"opening",error:null,errorReason:null});function Ye(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=H(),a=Me("televet"),l=a.enabled&&o!==null,u=r.usState??null,s=r.entry==="chat",p=r.petRef??null,v=react.useMemo(()=>{if(r.controller)return r.controller;let{services:m}=t.registry;return je({auth:m.authFor(o),telemetry:m.telemetry,...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}})},[t,o,i,r.controller]),b=react.useRef(v);b.current=v;let d=react.useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),c=ft(b,l,{usState:u,chat:s,scope:d}),y=l&&(c===null||c.open)&&(!s||p!==null),h=r.returnTo??null,[f,S]=react.useState(He),E=react.useRef(null),k=react.useRef({runtime:t,userRef:o,scopeEpoch:i});k.current={runtime:t,userRef:o,scopeEpoch:i};let F=react.useRef(v);F.current=v;let g=react.useRef(y);g.current=y;let O=react.useCallback((m,_)=>{if(E.current)return E.current;let C=n((T,I)=>(S({status:T==="cancelled"?"idle":"error",error:I,errorReason:T==="cancelled"?null:T}),Object.freeze({opened:false,reason:T,error:I})),"fail");if(!g.current)return Promise.resolve(C("unavailable",null));let x=e.prepare();if(!x.ok)return Promise.resolve(C(x.reason,null));let W=k.current,de=F.current;S(pt);let K=(async()=>{let T,I={...h!==null?{returnTo:h}:{},...s?{entry:"chat"}:{},..._!==null?{visitRef:_.visitRef}:{},..._!==null&&_.intent!==null&&_.intent!==void 0?{intent:_.intent}:{}},ce=Object.keys(I).length===0?void 0:I,fe=m===void 0?p:m;try{T=await(ce===void 0?de.createHandoff(fe):de.createHandoff(fe,ce));}catch{return e.abandon(x.value),C("unknown",null)}let G=k.current;if(G.runtime!==W.runtime||G.userRef!==W.userRef||G.scopeEpoch!==W.scopeEpoch)return e.abandon(x.value),C("cancelled",null);if(!T.ok)return e.abandon(x.value),C(B(T.error),T.error);let pe=await e.finish(x.value,T.value);return pe!==null?C(pe,null):(S(He),Object.freeze(T.value.flowId===void 0?{opened:true}:{opened:true,flowId:T.value.flowId}))})().finally(()=>{E.current===K&&(E.current=null);});return E.current=K,K},[e,p,h,s]),D=react.useCallback(m=>O(m,null),[O]),V=react.useCallback((m,_)=>O(void 0,{visitRef:m,intent:_??null}),[O]);return {available:y,isPending:a.isPending||(c?.pending??false),status:f.status,error:f.error,errorReason:f.errorReason,open:D,openVisit:V}}n(Ye,"useVetVisitWith");var vt=n(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function oe(e={}){let{openUrl:r,...t}=e,o=react.useMemo(()=>{let i=r??vt;return {prepare:n(()=>({ok:true,value:null}),"prepare"),async finish(a,l){try{return await i(l.url),null}catch{return "openFailed"}},abandon:n(()=>{},"abandon")}},[r]);return Ye(o,t)}n(oe,"useVetVisit");function se(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))se(e[r]);}return e}n(se,"deepFreeze");var bt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Ke={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Ge={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},We={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Et={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},gt={regular:"400",medium:"500",bold:"700"},ht={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},_t=0,q="System",Y="monospace",Rt=["content","heading","control","compact","badge"];function Tt(e){let r={};for(let t of Rt)r[t]=e;return r}n(Tt,"authoredTierSizes");function $e(){return {family:q,mono:Y,fontUrl:null,families:{regular:q,medium:q,bold:q,mono:Y,monoMedium:Y,monoBold:Y},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:We,tierSizes:Tt(We),lineHeight:Et,weight:gt,letterSpacing:ht,scale:1,maxScale:_t,scaleCaps:bt}}n($e,"baseType");var Qe={},ie=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function ae(e){return `cubic-bezier(${e.join(", ")})`}n(ae,"cssCubicBezier");var Xe={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:ae(ie.standard),emphasized:ae(ie.emphasized),exit:ae(ie.exit)},reducedMotion:false},Ct={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)"},Je=se({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ct,space:Ke,radius:Ge,type:$e(),motion:Xe,slots:Qe}),xt={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)"};se({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:xt,space:Ke,radius:Ge,type:$e(),motion:Xe,slots:Qe});var Ze=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),er=globalThis,le=er[Ze]??(er[Ze]=react.createContext(Je));le.displayName??="EverfurThemeContext";function j(){return react.useContext(le)}n(j,"useEverfurTheme");function Vt(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(Vt,"tierMultiplier");function tr({tier:e="content",...r}){let{type:t}=j(),o=Vt(t,e);return react.createElement(reactNative.Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(tr,"Text");react.forwardRef(n(function(r,t){return react.createElement(reactNative.TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function nr(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n(nr,"slotBox");function or(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(or,"slotText");var It=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function ir(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[It[r]]}}n(ir,"face");function ar(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(ar,"reportHostFailure");function At(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(At,"isThenable");function ue(e,...r){if(typeof e=="function")try{let t=e(...r);return At(t)&&Promise.resolve(t).then(void 0,ar),t}catch(t){ar(t);return}}n(ue,"callHost");var sr=Object.freeze({visitButton:"Talk to a vet"});var lr=44,Nt=.6;function Lt(e){let{petRef:r,label:t,openUrl:o,onOpened:i,onError:a,style:l,labelStyle:u,controller:s,returnTo:p,usState:v,entry:b,visitRef:d,intent:c}=e,y=oe({...p!==void 0?{returnTo:p}:{},...v!==void 0?{usState:v}:{},...b!==void 0?{entry:b}:{},...r!==void 0?{petRef:r}:{},...o!==void 0?{openUrl:o}:{},...s!==void 0?{controller:s}:{}}),h=j(),f=react.useMemo(()=>Ut(h),[h]),S=react.useRef(false);if(!y.available)return null;let E=y.status==="opening",k=t??sr.visitButton;return jsxRuntime.jsx(reactNative.Pressable,{onPress:n(()=>{E||S.current||(S.current=true,(d==null?y.open():y.openVisit(d,c??null)).then(g=>{g.opened?ue(i,g.flowId??null):g.reason!=="cancelled"&&ue(a,g.reason,g.error);}).finally(()=>{S.current=false;}));},"onPress"),accessibilityRole:"button",accessibilityLabel:k,accessibilityState:{busy:E,disabled:E},style:[f.button,E?f.busy:null,l],children:jsxRuntime.jsx(tr,{style:[f.label,u],children:k})})}n(Lt,"VetVisitButton");function Ut(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return reactNative.StyleSheet.create({button:{minHeight:lr,minWidth:lr,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.sm,borderRadius:o.pill,backgroundColor:r.primary,...nr(a.vetVisitButton)},busy:{opacity:Nt},label:{...ir(e,"medium"),color:r.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...or(a.vetVisitButton)}})}n(Ut,"makeStyles");exports.VET_VISIT_INTENTS=U;exports.VetVisitButton=Lt;exports.isVetVisitIntent=M;exports.parseVetVisitReturn=Xr;exports.useVetVisit=oe;exports.vetVisitErrorReasonOf=B;
1
+ 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var pr=Object.defineProperty;var n=(e,r)=>pr(e,"name",{value:r,configurable:true});var Q=null;function yr(e){Q=e;}n(yr,"registerEverfurTelevetFlow");function X(){return Q!==null}n(X,"hasEverfurTelevetFlow");function Z(e){let r=Q;if(r===null)return false;try{return r(e),!0}catch(t){return console.warn("[everfur] The in-app vet visit presenter registered with registerEverfurTelevetFlow threw, so this press fell back to the hosted visit in the browser. The member reached a vet, but your navigation did not run - check the destination you registered.",t),false}}n(Z,"presentEverfurTelevetFlow");var J=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(J.map(e=>e.wireCode));var mr=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"}),Ee=Object.freeze(J.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:mr[e.wireCode]}))),vr=new Map(Ee.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),br=Object.freeze(["http_envelope",...[...new Set(Ee.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function L(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let o of [r??"http_envelope",...br]){let i=vr.get(o+t);if(i)return i}}n(L,"contractErrorFor");function Er(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}n(Er,"contractDocUrl");function ge(e){return null}n(ge,"publishedDocUrl");var gr=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 he(e){return gr[e]}n(he,"categoryFor");function _e(e){let r=L(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),o=t.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(o){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"}}n(_e,"fromWire");var hr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ee(e){return hr.has(e)}n(ee,"isAutoRetryable");var _r=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Re(e){return ee(e)||_r.has(e)}n(Re,"isRetryableCode");var Rr=500,re=8e3,Te=4;function Ce(e,r=Math.random){let t=Math.max(0,e),o=Math.min(Rr*2**t,re);return Math.floor(r()*o)}n(Ce,"backoffDelayMs");var Tr=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 te(e){return Tr[e]}n(te,"userFacingError");function we(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}n(we,"defineHidden");var Cr=/^[a-z][a-z0-9_]{0,63}$/;function F(e,r){let t=L(r?.wireCode,r?.wireEnvelope),o={code:e,category:he(e),retryable:r?.retryable??Re(e),displayMessage:te(e)};if(r?.httpStatus!==void 0&&(o.httpStatus=r.httpStatus),r?.requestId&&(o.requestId=r.requestId),typeof r?.reasonCode=="string"&&Cr.test(r.reasonCode)&&(o.reasonCode=r.reasonCode),t);return r?.wireMessage&&we(o,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&we(o,"raw",r.raw),Object.freeze(o)}n(F,"makeEverfurError");function ne(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}n(ne,"ok");function h(e){return Object.freeze({ok:false,error:e})}n(h,"err");var U=class U extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,U.prototype);}};n(U,"EverfurConfigError");var z=U;function xe(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})}n(xe,"errorFrame");function Sr(e){let r={};return e.mode==="personalized"?r.authorization=`Bearer ${e.token}`:r["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(r["x-everfur-user-ref"]=e.userRef),e.sessionId&&(r["x-everfur-session-id"]=e.sessionId),r}n(Sr,"authHeaders");function j(e,r){return {...e,headers:{...kr(e.headers),...Sr(r)}}}n(j,"withAuthHeaders");function kr(e){if(!e)return {};let r={};for(let[t,o]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=o);}return r}n(kr,"stripAuthHeaders");async function Se(e,r){if(r.mode==="anonymous")return r.transport.request(j(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return h(oe())}let o=await r.transport.request(j(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return h(oe())}let a=await r.transport.request(j(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?h(oe(a.error.httpStatus)):a}n(Se,"authedSend");function oe(e){return F("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}n(oe,"authRejectedError");function ke(e){return F("internalError",{retryable:true,wireMessage:Fr(e)})}n(ke,"networkError");function Fr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}n(Fr,"describeCause");var Or=3e4,Vr=re*2,Ir="idempotency-key",Ar=new Set(["POST","PUT","PATCH","DELETE"]),Pr=Object.freeze({onEvent(){}}),zr=Object.freeze({setTimeout:n((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:n(e=>clearTimeout(e),"clearTimeout"),now:n(()=>Date.now(),"now")});function jr(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}n(jr,"seededIdempotencyKey");function Oe(e){let r=e.observer??Pr,t=e.timers??zr,o=e.rng??Math.random,i=e.sleep??((d,f)=>$r(d,t,f)),a=e.maxAttempts??Te,l=e.unaryTimeoutMs??Or,u=e.newIdempotencyKey??Nr(),s=n(d=>{try{r.onEvent(d);}catch{}},"emit");async function p(d,f,y){let _=y?.maxAttempts,c=Math.max(1,_??a),O=y?.idempotent??Ar.has(f.method),C=y?.idempotencyKey===void 0?null:jr(y.idempotencyKey),w=O?C??u():null,S=Dr(f,w),k=0;for(;;){let R=n(A=>Object.freeze({call:d,method:f.method,path:f.path,attempt:k,...w?{idempotencyKey:w}:{},...A}),"stamp");s(R({phase:"attempt"}));let V=Kr(l,t),I=Gr(V.signal,f.signal),m;try{m=await Se({...S,signal:I.signal},e.auth);}catch(A){m=h(ke(A));}finally{I.dispose(),V.cancel();}if(m.ok)return s(R({phase:"settled",ok:true,reason:"ok"})),m;let v=m.error,b=Ur(v,k,{maxAttempts:c,rng:o,now:t.now(),aborted:f.signal?.aborted===true,..._!==void 0?{perCallMaxAttempts:_}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),x={ok:false,code:v.code,reason:b.reason,...v.httpStatus!==void 0?{httpStatus:v.httpStatus}:{},...v.requestId!==void 0?{requestId:v.requestId}:{}};if(!b.retry)return s(R({phase:"settled",...x})),h(v);if(s(R({phase:"retry",...x,delayMs:b.delayMs})),await i(b.delayMs,f.signal),f.signal?.aborted===true)return s(R({phase:"settled",...x,reason:"aborted"})),h(v);k+=1;}}n(p,"send");async function E(d){return j(d,await Wr(e.auth))}n(E,"authorize");async function*g(d,f,y){s(Object.freeze({call:d,phase:"stream.open",method:f.method,path:f.path,attempt:0}));try{yield*e.auth.transport.stream(f,y);}catch{yield xe({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return n(g,"stream"),Object.freeze({send:p,authorize:E,stream:g})}n(Oe,"createRequestFunnel");function Dr(e,r){let t={};for(let[o,i]of Object.entries(e.headers??{}))o.toLowerCase()!==Ir&&(t[o]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}n(Dr,"assembleHeaders");function Nr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}n(Nr,"defaultIdempotencyKeyFactory");var Lr=10;function Ur(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let o=Mr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!ee(e.code))return {retry:false,reason:"terminal-code"};let i=o==="burst"?"burst-throttle":"retryable-code";if(n(()=>{if(t.policy===void 0)return false;try{return !t.policy.shouldRetry(e.code,r)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let l=n(()=>{if(t.policy===void 0)return null;let p;try{p=t.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(Lr,Math.floor(p)))},"policyCeiling"),u=t.perCallMaxAttempts??l()??t.maxAttempts;if(r+1>=u)return {retry:false,reason:"attempts-exhausted"};let s=Br(e,t.now);return s!==null?s>Vr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:s}:{retry:true,reason:i,delayMs:Ce(r,t.rng)}}n(Ur,"decideRetry");function Mr(e){let r=e.code==="unknown"?_e(Yr(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}n(Mr,"throttleKind");function Br(e,r){let t=qr(e.raw);if(t===null)return null;let o=t-r;return o>0?o:0}n(Br,"retryOverrideMs");function qr(e){for(let r of Ve(e)){let t=r.resets_at,o=Hr(t);if(o!==null)return o}return null}n(qr,"findResetsAt");function Ve(e){if(!Fe(e))return [];let r=[e];for(let t of ["error","detail"]){let o=e[t];Fe(o)&&r.push(o);}return r}n(Ve,"candidateScopes");function Hr(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 r=Date.parse(e);return Number.isFinite(r)?r:null}return null}n(Hr,"parseInstantMs");function Yr(e){for(let r of Ve(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}n(Yr,"rawWireCode");function Fe(e){return typeof e=="object"&&e!==null}n(Fe,"isRecord");async function Wr(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}:{}}}n(Wr,"resolveDeviceAuth");function Kr(e,r){let t=new AbortController,o=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:n(()=>r.clearTimeout(o),"cancel")}}n(Kr,"boundedSignal");function Gr(e,r){let t=n(()=>{},"noop");if(!r)return {signal:e,dispose:t};let o=new AbortController;if(e.aborted||r.aborted)return o.abort(),{signal:o.signal,dispose:t};let i=n(()=>o.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:o.signal,dispose:n(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}n(Gr,"mergeSignals");function $r(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(o=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),o();},e),a=n(()=>{r.clearTimeout(i),o();},"onAbort");t?.addEventListener("abort",a,{once:true});})}n($r,"delayAbortable");var M=Object.freeze(["visit","join","summary","messages"]);function B(e){return typeof e=="string"&&M.includes(e)}n(B,"isVetVisitIntent");var Qr="/widget/v1/televet/handoffs",Xr="/widget/v1/televet/availability",Zr="/widget/v1/televet/chat-entry",Jr=/^[a-z0-9][a-z0-9_-]{0,39}$/,Ne=/^[A-Za-z0-9_-]{22}$/,Ie="everfur_flow",Ae=32,Pe=128,ze=64;function q(e){let r=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 r===void 0?e.code==="internalError"?"network":"unknown":r===429?"rateLimited":r===404?"unavailable":r===403?"accessDenied":r===401?"authRejected":r===400||r===422?"invalidRequest":r>=500?"serverError":"unknown"}n(q,"vetVisitErrorReasonOf");function je(e){return h(F("validationFailed",{retryable:false,wireMessage:e}))}n(je,"invalid");function ie(e){return h(F("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}n(ie,"unusable");function et(e,r){let t={};e!==void 0&&(t.pet_ref=e);let o=r?.returnTo;if(o!=null){if(typeof o!="string"||!Jr.test(o))return {ok:false,message:"returnTo must be a registered return destination key"};t.return_to=o;}let i=r?.entry;if(i!=null){if(i!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};t.entry=i;}let a=r?.visitRef,l=r?.intent,u=a!=null;if(u){let s=typeof a=="string"?a.trim():"";if(s.length<1||[...s].length>ze)return {ok:false,message:`visitRef must be 1..${ze} characters`};t.visit_ref=s;}if(l!=null){if(!u)return {ok:false,message:"intent needs the visitRef it opens"};if(!B(l))return {ok:false,message:`intent must be one of ${M.join(", ")}`};t.intent=l;}return {ok:true,body:t}}n(et,"handoffBody");function rt(e){if(typeof e!="object"||e===null)return null;let{visit_ref:r,intent:t}=e;return typeof r!="string"||r.length===0||!B(t)?null:Object.freeze({visitRef:r,intent:t})}n(rt,"parseVisitEcho");function Le(e){let r=e.funnel??Oe({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),t=e.telemetry,o=n(i=>(De(t,"televet.visit.handoff_failed",{reason:q(i)}),h(i)),"failed");return {async createHandoff(i,a){let l;if(i!=null){let c=typeof i=="string"?[...i].length:0;if(c<1||c>Pe)return o(F("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Pe} characters`}));l=i;}let u=et(l,a);if(!u.ok){let c=je(u.message);return c.ok?c:o(c.error)}let s=u.body,p=await r.send("televet.visit.handoff",{method:"POST",path:Qr,body:s},{idempotent:false,maxAttempts:1});if(!p.ok)return o(p.error);let E=nt(p.value),g=s.return_to!==void 0,d=g?p.value?.flow_id:void 0;if(g&&(typeof d!="string"||!Ne.test(d))){let c=ie("the handoff response carried no usable return flow id");return c.ok?c:o(c.error)}let f=s.visit_ref!==void 0,y=f?rt(p.value?.visit):null;if(f&&y===null){let c=ie("the handoff response did not confirm the visit it opens");return c.ok?c:o(c.error)}let _=E===null?null:Object.freeze({...E,...g?{flowId:d}:{},...y!==null?{visit:y}:{}});return _===null?o(F("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(De(t,"televet.visit.handoff_created",{pet_scoped:s.pet_ref!==void 0}),ne(_))},async checkAvailability(i){if(typeof i!="string"||i.length>Ae)return je(`state must be at most ${Ae} characters`);let a=await r.send("televet.visit.availability",{method:"POST",path:Xr,body:{state:i}},{idempotent:false,maxAttempts:1});if(!a.ok)return h(a.error);let l=a.value?.available;return typeof l!="boolean"?ie("the availability response carried no usable answer"):ne(Object.freeze({available:l}))},async chatEntryOpen(){try{let i=await r.send("televet.visit.chat_entry",{method:"GET",path:Zr},{maxAttempts:1});return i.ok&&i.value?.open===!0}catch{return false}}}}n(Le,"createVetVisitController");function tt(e){if(typeof e!="string")return null;let r=e.indexOf("#"),t=r<0?e:e.slice(0,r),o=t.indexOf("?");if(o<0)return null;let i=t.slice(o+1).split("&").filter(a=>a.startsWith(`${Ie}=`)).map(a=>a.slice(Ie.length+1));return i.length!==1||!Ne.test(i[0]??"")?null:Object.freeze({flowId:i[0]})}n(tt,"parseVetVisitReturn");function nt(e){if(typeof e!="object"||e===null)return null;let{url:r,expires_at:t}=e;return typeof r!="string"||typeof t!="string"||t.length===0||!st(r)?null:Object.freeze({url:r,expiresAt:t})}n(nt,"parseHandoff");var ot=new Set(["localhost","127.0.0.1","[::1]"]),it=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,at=/[\s\u0000-\u001f\u007f]/;function st(e){if(at.test(e))return false;let r=it.exec(e);if(r===null)return false;let t=(r[1]??"").toLowerCase(),o=r[2]??"";if(o.length===0||o.includes("@"))return false;let i=o.replace(/:\d+$/,"").toLowerCase(),a=t==="https",l=t==="http"&&ot.has(i);if(!a&&!l)return false;let u=e.indexOf("#");if(u<0)return false;let s=e.slice(u);return s.startsWith("#h=")&&s.length>3}n(st,"isOpenableVisitUrl");function De(e,r,t){if(e)try{e.track(r,t);}catch{}}n(De,"safeTrack");var Ue=Symbol.for("@everfur/sdk#EverfurContext@v1"),Me=globalThis,Be=Me[Ue]??(Me[Ue]=react.createContext(null));Be.displayName??="EverfurContext";function H(){let e=react.useContext(Be);if(e===null)throw new z("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}n(H,"useEverfurContext");var dt=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 ct(e){return dt[e]}n(ct,"requires");function qe(e,r,t){let o=ct(e),i=new Map;for(let u of r)i.set(u.resource,u);if(t?.isPending===true&&o.some(u=>!i.has(u)))return ae({name:e,enabled:false,isPending:true,limits:{}});let a=ft(o,i);return o.filter(u=>i.get(u)?.granted!==true).length===0?ae({name:e,enabled:true,isPending:false,limits:a}):ae({name:e,enabled:false,isPending:false,limits:a,disabled:pt(o,i)})}n(qe,"decideCapability");function ft(e,r){let t={};for(let o of e){let i=r.get(o)?.limits;if(i)for(let[a,l]of Object.entries(i)){let u=t[a];t[a]=u===void 0?l:Math.min(u,l);}}return t}n(ft,"mergeLimits");function pt(e,r){for(let t of e){let o=r.get(t)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:te("accessDenied"),level:"user_entitlement",recoverable:false})}n(pt,"disabledFor");function ae(e){let r={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(r.disabled=e.disabled),Object.freeze(r)}n(ae,"freezeDecision");function He(e){let{runtime:r}=H(),t=r.entitlements,o=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>qe(e,o.decisions,{isPending:o.isPending}),[e,o])}n(He,"useCapability");var We=Object.freeze({status:"idle",error:null,errorReason:null});function bt(e,r,t){let{usState:o,chat:i,scope:a}=t,l=r&&(o!==null||i),u=`${o??""}|${i?"chat":""}`,[s,p]=react.useState(null);if(react.useEffect(()=>{if(!l)return;let g=true,d=e.current;return p(null),n(async()=>{try{if(i&&!(d.chatEntryOpen&&await d.chatEntryOpen()))return !1;if(o===null)return !0;if(!d.checkAvailability)return !1;let y=await d.checkAvailability(o);return y.ok&&y.value.available}catch{return false}},"ask")().then(y=>{g&&p({key:u,open:y});}),()=>{g=false;}},[l,u,o,i,a,e]),!l)return null;let E=s!==null&&s.key===u;return {open:E&&s.open,pending:!E}}n(bt,"usePreflight");var Et=Object.freeze({status:"opening",error:null,errorReason:null});function Ge(e,r={}){let{runtime:t,userRef:o,scopeEpoch:i}=H(),a=He("televet"),l=a.enabled&&o!==null,u=r.usState??null,s=r.entry==="chat",p=r.petRef??null,E=react.useMemo(()=>{if(r.controller)return r.controller;let{services:m}=t.registry;return Le({auth:m.authFor(o),telemetry:m.telemetry,...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}})},[t,o,i,r.controller]),g=react.useRef(E);g.current=E;let d=react.useMemo(()=>({runtime:t,userRef:o,scopeEpoch:i}),[t,o,i]),f=bt(g,l,{usState:u,chat:s,scope:d}),y=l&&(f===null||f.open)&&(!s||p!==null),_=r.returnTo??null,[c,O]=react.useState(We),C=react.useRef(null),w=react.useRef({runtime:t,userRef:o,scopeEpoch:i});w.current={runtime:t,userRef:o,scopeEpoch:i};let S=react.useRef(E);S.current=E;let k=react.useRef(y);k.current=y;let R=react.useCallback((m,v)=>{if(C.current)return C.current;let b=n((T,P)=>(O({status:T==="cancelled"?"idle":"error",error:P,errorReason:T==="cancelled"?null:T}),Object.freeze({opened:false,reason:T,error:P})),"fail");if(!k.current)return Promise.resolve(b("unavailable",null));let x=e.prepare();if(!x.ok)return Promise.resolve(b(x.reason,null));let A=w.current,pe=S.current;O(Et);let G=(async()=>{let T,P={..._!==null?{returnTo:_}:{},...s?{entry:"chat"}:{},...v!==null?{visitRef:v.visitRef}:{},...v!==null&&v.intent!==null&&v.intent!==void 0?{intent:v.intent}:{}},ye=Object.keys(P).length===0?void 0:P,me=m===void 0?p:m;try{T=await(ye===void 0?pe.createHandoff(me):pe.createHandoff(me,ye));}catch{return e.abandon(x.value),b("unknown",null)}let $=w.current;if($.runtime!==A.runtime||$.userRef!==A.userRef||$.scopeEpoch!==A.scopeEpoch)return e.abandon(x.value),b("cancelled",null);if(!T.ok)return e.abandon(x.value),b(q(T.error),T.error);let ve=await e.finish(x.value,T.value);return ve!==null?b(ve,null):(O(We),Object.freeze(T.value.flowId===void 0?{opened:true}:{opened:true,flowId:T.value.flowId}))})().finally(()=>{C.current===G&&(C.current=null);});return C.current=G,G},[e,p,_,s]),V=react.useCallback(m=>R(m,null),[R]),I=react.useCallback((m,v)=>R(void 0,{visitRef:m,intent:v??null}),[R]);return {available:y,isPending:a.isPending||(f?.pending??false),status:c.status,error:c.error,errorReason:c.errorReason,open:V,openVisit:I}}n(Ge,"useVetVisitWith");var _t=n(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function le(e={}){let{openUrl:r,...t}=e,o=react.useMemo(()=>{let i=r??_t;return {prepare:n(()=>({ok:true,value:null}),"prepare"),async finish(a,l){try{return await i(l.url),null}catch{return "openFailed"}},abandon:n(()=>{},"abandon")}},[r]);return Ge(o,t)}n(le,"useVetVisit");function ce(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ce(e[r]);}return e}n(ce,"deepFreeze");var Rt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Qe={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Xe={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},$e={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Tt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Ct={regular:"400",medium:"500",bold:"700"},wt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},xt=0,Y="System",W="monospace",St=["content","heading","control","compact","badge"];function kt(e){let r={};for(let t of St)r[t]=e;return r}n(kt,"authoredTierSizes");function Ze(){return {family:Y,mono:W,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:W,monoMedium:W,monoBold:W},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:$e,tierSizes:kt($e),lineHeight:Tt,weight:Ct,letterSpacing:wt,scale:1,maxScale:xt,scaleCaps:Rt}}n(Ze,"baseType");var Je={},ue=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function de(e){return `cubic-bezier(${e.join(", ")})`}n(de,"cssCubicBezier");var er={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:de(ue.standard),emphasized:de(ue.emphasized),exit:de(ue.exit)},reducedMotion:false},Ft={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)"},rr=ce({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ft,space:Qe,radius:Xe,type:Ze(),motion:er,slots:Je}),Ot={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)"};ce({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Ot,space:Qe,radius:Xe,type:Ze(),motion:er,slots:Je});var tr=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),nr=globalThis,fe=nr[tr]??(nr[tr]=react.createContext(rr));fe.displayName??="EverfurThemeContext";function N(){return react.useContext(fe)}n(N,"useEverfurTheme");function jt(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}n(jt,"tierMultiplier");function ir({tier:e="content",...r}){let{type:t}=N(),o=jt(t,e);return react.createElement(reactNative.Text,o===void 0?r:{maxFontSizeMultiplier:o,...r})}n(ir,"Text");react.forwardRef(n(function(r,t){return react.createElement(reactNative.TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));function ar(e,r){if(e===void 0)return {};let t={};return e.backgroundColor!==void 0&&(t.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(t.borderColor=e.borderColor,t.borderWidth=r??1),e.borderRadius!==void 0&&(t.borderRadius=e.borderRadius),t}n(ar,"slotBox");function sr(e){return e?.textColor===void 0?{}:{color:e.textColor}}n(sr,"slotText");var Dt=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function lr(e,r){let t=e.type,o=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:o}:{fontFamily:o,fontWeight:t.weight[Dt[r]]}}n(lr,"face");function ur(e){let r=globalThis.console;try{r?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}n(ur,"reportHostFailure");function Nt(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}n(Nt,"isThenable");function K(e,...r){if(typeof e=="function")try{let t=e(...r);return Nt(t)&&Promise.resolve(t).then(void 0,ur),t}catch(t){ur(t);return}}n(K,"callHost");var dr=Object.freeze({visitButton:"Talk to a vet"});var cr=44,qt=.6;function Ht(e){let{petRef:r,label:t,openUrl:o,onOpened:i,onError:a,style:l,labelStyle:u,controller:s,returnTo:p,usState:E,entry:g,visitRef:d,intent:f,onStartInApp:y,prefer:_}=e,c=le({...p!==void 0?{returnTo:p}:{},...E!==void 0?{usState:E}:{},...g!==void 0?{entry:g}:{},...r!==void 0?{petRef:r}:{},...o!==void 0?{openUrl:o}:{},...s!==void 0?{controller:s}:{}}),O=N(),C=react.useMemo(()=>Yt(O),[O]),w=react.useRef(false);if(!c.available)return null;let S=c.status==="opening",k=t??dr.visitButton,R=d!=null,V=_==="redirect"||R,I=!V&&y!==void 0,m=!V&&!I&&X();return jsxRuntime.jsx(reactNative.Pressable,{onPress:n(()=>{if(!(S||w.current)){if(I){K(y);return}m&&Z({...r!==void 0?{petRef:r}:{},...E!==void 0?{usState:E}:{}})||(w.current=true,(d==null?c.open():c.openVisit(d,f??null)).then(b=>{b.opened?K(i,b.flowId??null):b.reason!=="cancelled"&&K(a,b.reason,b.error);}).finally(()=>{w.current=false;}));}},"onPress"),accessibilityRole:"button",accessibilityLabel:k,accessibilityState:{busy:S,disabled:S},style:[C.button,S?C.busy:null,l],children:jsxRuntime.jsx(ir,{style:[C.label,u],children:k})})}n(Ht,"VetVisitButton");function Yt(e){let{color:r,space:t,radius:o,type:i,slots:a}=e;return reactNative.StyleSheet.create({button:{minHeight:cr,minWidth:cr,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.sm,borderRadius:o.pill,backgroundColor:r.primary,...ar(a.vetVisitButton)},busy:{opacity:qt},label:{...lr(e,"medium"),color:r.onPrimary,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,...sr(a.vetVisitButton)}})}n(Yt,"makeStyles");exports.VET_VISIT_INTENTS=M;exports.VetVisitButton=Ht;exports.hasEverfurTelevetFlow=X;exports.isVetVisitIntent=B;exports.parseVetVisitReturn=tt;exports.presentEverfurTelevetFlow=Z;exports.registerEverfurTelevetFlow=yr;exports.useVetVisit=le;exports.vetVisitErrorReasonOf=q;
@@ -1,14 +1,63 @@
1
+ import { P as PetRef } from '../ids-B2GAAifq.cjs';
2
+ export { B as Brand, _ as __brand } from '../ids-B2GAAifq.cjs';
1
3
  import { U as UseVetVisitOptions, a as UseVetVisitState, V as VetVisitEntry, b as VetVisitErrorReason, c as VetVisitController } from '../useVetVisit-Bc84hWUU.cjs';
2
4
  export { d as VetVisitAvailability, e as VetVisitHandoff, f as VetVisitHandoffOptions, g as VetVisitHandoffVisit, h as VetVisitOpenResult, i as VetVisitReturn, j as VetVisitStatus, p as parseVetVisitReturn, v as vetVisitErrorReasonOf } from '../useVetVisit-Bc84hWUU.cjs';
3
5
  import { ReactNode } from 'react';
4
6
  import { StyleProp, ViewStyle, TextStyle } from 'react-native';
5
7
  import { E as EverfurError } from '../EverfurResult-DN9pL2Ab.cjs';
6
8
  export { a as EverfurErrorCategory, b as EverfurErrorCode, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.cjs';
7
- import { P as PetRef } from '../ids-B2GAAifq.cjs';
8
- export { B as Brand, _ as __brand } from '../ids-B2GAAifq.cjs';
9
9
  import { V as VetVisitIntent } from '../visitIntent-D7_yVp1I.cjs';
10
10
  export { a as VET_VISIT_INTENTS, i as isVetVisitIntent } from '../visitIntent-D7_yVp1I.cjs';
11
11
 
12
+ /**
13
+ * What the button hands the host when it opens the in-app visit.
14
+ *
15
+ * Deliberately the scoping the BUTTON was given and nothing more. The host already holds the session, the
16
+ * theme and the navigator; what it cannot know is which pet and which state this particular button was
17
+ * placed for, so that, and only that, travels.
18
+ */
19
+ interface EverfurTelevetFlowRequest {
20
+ /** The pet this button was scoped to, when it was scoped to one. */
21
+ readonly petRef?: PetRef | null | undefined;
22
+ /** The member's US state, when the host gave one. The booking screens preflight availability with it. */
23
+ readonly usState?: string | null | undefined;
24
+ }
25
+ /**
26
+ * The host's presenter: show the Everfur booking flow. Called on press, and expected to navigate or present.
27
+ *
28
+ * It returns nothing. The button is not waiting on it and has nothing to do with the result: presenting a
29
+ * screen is the host's business, and a presenter that throws is contained (see `presentEverfurTelevetFlow`)
30
+ * rather than allowed to break the press.
31
+ */
32
+ type EverfurTelevetFlowPresenter = (request: EverfurTelevetFlowRequest) => void;
33
+ /**
34
+ * Register how this app presents the in-app vet visit. Call it ONCE, in your app entry:
35
+ *
36
+ * ```ts
37
+ * import { registerEverfurTelevetFlow } from '@everfur/sdk/televet';
38
+ * registerEverfurTelevetFlow(() => navigationRef.navigate('EverfurBooking'));
39
+ * ```
40
+ *
41
+ * From that line on, every `VetVisitButton` in the app opens your screen instead of the system browser, with
42
+ * no other change at any call site. Passing `null` unregisters it, which is what a test does between cases
43
+ * and what a partner does to go back to the hosted visit everywhere at once.
44
+ */
45
+ declare function registerEverfurTelevetFlow(next: EverfurTelevetFlowPresenter | null): void;
46
+ /** Is an in-app flow registered? The button asks this to choose its destination before it mints anything. */
47
+ declare function hasEverfurTelevetFlow(): boolean;
48
+ /**
49
+ * Present the registered flow. Answers whether the visit was HANDED OVER, which is what lets the caller fall
50
+ * through to the hosted handoff rather than leave the member on a screen that never opened.
51
+ *
52
+ * A THROWING PRESENTER IS NOT A DEAD BUTTON. A host navigator can throw (an unmounted ref, a route that was
53
+ * renamed), and the member pressing the button has no idea any of that happened. So a throw is caught and
54
+ * reported as "not handed over", and the caller then mints and opens the hosted visit: the member reaches a
55
+ * vet either way, which is the floor this whole file is built around. The throw is not swallowed silently -
56
+ * it is re-surfaced to the partner's engineer through the console, because a navigator that throws on every
57
+ * press is a defect in their app that they need to see.
58
+ */
59
+ declare function presentEverfurTelevetFlow(request: EverfurTelevetFlowRequest): boolean;
60
+
12
61
  interface UseNativeVetVisitOptions extends UseVetVisitOptions {
13
62
  /**
14
63
  * Opens the minted visit URL. Defaults to `Linking.openURL`. Receives a single-use URL: open it once, now,
@@ -28,7 +77,12 @@ interface VetVisitButtonProps {
28
77
  readonly petRef?: PetRef | null | undefined;
29
78
  /** The button label. Defaults to Everfur's label. */
30
79
  readonly label?: string | undefined;
31
- /** Opens the minted URL. Defaults to `Linking.openURL` (the system browser). */
80
+ /**
81
+ * Opens the minted URL when the press REDIRECTS. Defaults to `Linking.openURL` (the system browser).
82
+ *
83
+ * This is the redirect path's opener, not the button's destination. Which destination a press takes is
84
+ * `prefer` plus what the app registered; see the note on `prefer`.
85
+ */
32
86
  readonly openUrl?: ((url: string) => Promise<unknown>) | undefined;
33
87
  /** Called after the URL was handed to the browser, with the return flow id when `returnTo` was given. */
34
88
  readonly onOpened?: ((flowId: string | null) => void) | undefined;
@@ -47,6 +101,34 @@ interface VetVisitButtonProps {
47
101
  readonly intent?: VetVisitIntent | null | undefined;
48
102
  /** Called when the visit could not be opened. `error` is null for a device-side failure. */
49
103
  readonly onError?: ((reason: VetVisitErrorReason, error: EverfurError | null) => void) | undefined;
104
+ /**
105
+ * Open the IN-APP booking flow (`EverfurTelevet`) instead of handing off to the hosted visit.
106
+ *
107
+ * ADDITIVE, AND THE DEFAULT IS UNCHANGED. A 0.3.0 integration that does not pass this keeps the handoff it
108
+ * already ships, byte for byte: nothing about an existing button moves. The flow is a component the host
109
+ * mounts, and the SDK owns no navigator, so the host is the only thing that can say where it lives - which
110
+ * is why this is a callback and not a `mode` flag the button could not honour.
111
+ *
112
+ * `visitRef` still wins over it: a tapped push that names an existing visit opens THAT visit, and there is
113
+ * no in-app surface for one yet. Sending an owner into a fresh booking funnel because they tapped a reminder
114
+ * for the visit they already have is the wrong screen, loudly.
115
+ */
116
+ readonly onStartInApp?: (() => void) | undefined;
117
+ /**
118
+ * Which destination a press takes. Defaults to `'in-app'`.
119
+ *
120
+ * THE DEFAULT CHANGED IN 0.4.0, AND ONLY FOR AN APP THAT REGISTERED A FLOW. `'in-app'` opens the flow this
121
+ * app registered with `registerEverfurTelevetFlow`; with nothing registered there is no flow to open, so
122
+ * the press mints and opens the hosted visit exactly as 0.3.0 did. That is the floor: an app that upgrades
123
+ * and changes nothing keeps a working button, and the member always reaches a vet.
124
+ *
125
+ * `'redirect'` is the explicit opt-in back to the browser handoff. It ignores the registry entirely, which
126
+ * is what a partner wants for a surface they deliberately keep hosted.
127
+ *
128
+ * `visitRef` still wins over both: a tapped push that names an existing visit opens THAT visit, and there
129
+ * is no in-app surface for one yet.
130
+ */
131
+ readonly prefer?: 'in-app' | 'redirect' | undefined;
50
132
  /** Merged over the button's own style. */
51
133
  readonly style?: StyleProp<ViewStyle>;
52
134
  /** Merged over the label's own style. */
@@ -54,7 +136,7 @@ interface VetVisitButtonProps {
54
136
  /** Host/test seam: inject a controller instead of building one from the provider's session. */
55
137
  readonly controller?: VetVisitController | undefined;
56
138
  }
57
- /** Opens the hosted Everfur vet visit in the browser. Renders nothing unless vet visits are granted. */
139
+ /** Opens the Everfur vet visit, in-app by default. Renders nothing unless vet visits are granted. */
58
140
  declare function VetVisitButton(props: VetVisitButtonProps): ReactNode;
59
141
 
60
- export { EverfurError, PetRef, type UseNativeVetVisitOptions, UseVetVisitOptions, UseVetVisitState, VetVisitButton, type VetVisitButtonProps, VetVisitController, VetVisitEntry, VetVisitErrorReason, VetVisitIntent, useVetVisit };
142
+ export { EverfurError, type EverfurTelevetFlowPresenter, type EverfurTelevetFlowRequest, PetRef, type UseNativeVetVisitOptions, UseVetVisitOptions, UseVetVisitState, VetVisitButton, type VetVisitButtonProps, VetVisitController, VetVisitEntry, VetVisitErrorReason, VetVisitIntent, hasEverfurTelevetFlow, presentEverfurTelevetFlow, registerEverfurTelevetFlow, useVetVisit };