@everfur/sdk 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +251 -4
  2. package/README.md +9 -3
  3. package/dist/{Chat-DwAC2vhB.d.ts → Chat-BOX-03ho.d.ts} +17 -3
  4. package/dist/{Chat-DPUD6dnc.d.cts → Chat-TA-aTcVF.d.cts} +17 -3
  5. package/dist/{DepthViews-DP0R-DhB.d.cts → DepthViews-CgjX2AJ5.d.ts} +1 -1
  6. package/dist/{DepthViews-DbFhR4Du.d.cts → DepthViews-Cviea-ri.d.cts} +1 -1
  7. package/dist/{DepthViews-DNEM96Se.d.ts → DepthViews-D2dRqWRq.d.ts} +1 -1
  8. package/dist/{DepthViews-D_3hl4xk.d.ts → DepthViews-DSFyaSeL.d.cts} +1 -1
  9. package/dist/{ErrorPolicyPort-CwbfmxzJ.d.ts → ErrorPolicyPort-D22LUVrK.d.ts} +1 -1
  10. package/dist/{ErrorPolicyPort-CNf4uQZP.d.cts → ErrorPolicyPort-D6CybiqJ.d.cts} +1 -1
  11. package/dist/{EverfurResult-DN9pL2Ab.d.cts → EverfurError-DmELDpXp.d.cts} +1 -67
  12. package/dist/{EverfurResult-DN9pL2Ab.d.ts → EverfurError-DmELDpXp.d.ts} +1 -67
  13. package/dist/EverfurResult-SGvHKsCB.d.ts +69 -0
  14. package/dist/EverfurResult-ZtH-YV1h.d.cts +69 -0
  15. package/dist/animations/index.cjs +1 -1
  16. package/dist/animations/index.d.cts +6 -5
  17. package/dist/animations/index.d.ts +6 -5
  18. package/dist/animations/index.js +1 -1
  19. package/dist/{attachments-5NeobOCd.d.ts → attachments-C_vtFu2f.d.ts} +7 -5
  20. package/dist/{attachments-D8T5re7e.d.cts → attachments-DHvnITuE.d.cts} +7 -5
  21. package/dist/{attachments-Bw3iMQgu.d.ts → attachments-oD5U2fXI.d.ts} +3 -3
  22. package/dist/{attachments-CQgFrEQ7.d.cts → attachments-pIdGOQfm.d.cts} +3 -3
  23. package/dist/bookingCopy-CJir9mjb.d.ts +1135 -0
  24. package/dist/bookingCopy-DfuA13dh.d.cts +1135 -0
  25. package/dist/branding-Xb_wL8N1.d.cts +212 -0
  26. package/dist/branding-xpQ056sM.d.ts +212 -0
  27. package/dist/callCopy-rDH9JTFo.d.cts +45 -0
  28. package/dist/callCopy-rDH9JTFo.d.ts +45 -0
  29. package/dist/callRoom-7wrE3RP2.d.ts +62 -0
  30. package/dist/callRoom-B_EqaUzx.d.cts +62 -0
  31. package/dist/casesRepository-B-Eg8ZJ3.d.cts +63 -0
  32. package/dist/casesRepository-DHgIYKN9.d.ts +63 -0
  33. package/dist/chat/index.cjs +1 -1
  34. package/dist/chat/index.d.cts +12 -10
  35. package/dist/chat/index.d.ts +12 -10
  36. package/dist/chat/index.js +1 -1
  37. package/dist/client/index.cjs +5 -5
  38. package/dist/client/index.d.cts +15 -11
  39. package/dist/client/index.d.ts +15 -11
  40. package/dist/client/index.js +5 -5
  41. package/dist/{config-CzTZGlfF.d.cts → config-ClI7QxB0.d.ts} +4 -3
  42. package/dist/{config-DW60uRb9.d.ts → config-DAFbf721.d.cts} +4 -3
  43. package/dist/consent/index.cjs +1 -1
  44. package/dist/consent/index.d.cts +9 -8
  45. package/dist/consent/index.d.ts +9 -8
  46. package/dist/consent/index.js +1 -1
  47. package/dist/{context-XvTzq1tE.d.cts → context-B-dUM1Qf.d.cts} +9 -8
  48. package/dist/{context-DXhqHlPU.d.ts → context-CZbgF_OH.d.ts} +9 -8
  49. package/dist/{copy-Mjoo91aS.d.ts → copy-CeRH3NXy.d.ts} +5 -4
  50. package/dist/{copy-bKDNigLb.d.cts → copy-CneuYdrO.d.cts} +5 -4
  51. package/dist/core/index.cjs +9 -9
  52. package/dist/core/index.d.cts +123 -32
  53. package/dist/core/index.d.ts +123 -32
  54. package/dist/core/index.js +9 -9
  55. package/dist/{depth-CErXCU8J.d.cts → depth-B3NFKlF9.d.cts} +38 -6
  56. package/dist/{depth-DjDcJ6kH.d.ts → depth-DO3Ko_qs.d.ts} +38 -6
  57. package/dist/entitlementRepository-74kW5mK0.d.ts +43 -0
  58. package/dist/entitlementRepository-m6zLUmiB.d.cts +43 -0
  59. package/dist/{identity-DI4eVx9S.d.cts → identity-C7uxGwfT.d.cts} +3 -3
  60. package/dist/{identity-BMx2SUOM.d.ts → identity-CLAUq-K4.d.ts} +3 -3
  61. package/dist/index.cjs +6 -6
  62. package/dist/index.d.cts +20 -17
  63. package/dist/index.d.ts +20 -17
  64. package/dist/index.js +6 -6
  65. package/dist/{models-D2EUxPZY.d.cts → models-Bn2z0NNo.d.cts} +1 -1
  66. package/dist/{models-B-Uh2LTf.d.ts → models-DSqA5Ahs.d.ts} +1 -1
  67. package/dist/notifications/index.cjs +2 -2
  68. package/dist/notifications/index.d.cts +5 -4
  69. package/dist/notifications/index.d.ts +5 -4
  70. package/dist/notifications/index.js +2 -2
  71. package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
  72. package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
  73. package/dist/{pets-aB8q0JyX.d.cts → pets-BoB5B7kp.d.cts} +2 -2
  74. package/dist/{pets-CtQdRpWo.d.ts → pets-w4M9d-Dn.d.ts} +2 -2
  75. package/dist/{casesRepository-ClLv6qMl.d.ts → petsRepository-BjKJ8UsN.d.ts} +3 -49
  76. package/dist/{casesRepository-DHwtGRYY.d.cts → petsRepository-DZZoEG3r.d.cts} +3 -49
  77. package/dist/photo/index.cjs +1 -1
  78. package/dist/photo/index.d.cts +3 -2
  79. package/dist/photo/index.d.ts +3 -2
  80. package/dist/photo/index.js +1 -1
  81. package/dist/{ports-DMolTRzU.d.ts → ports-BO3bzTJg.d.ts} +14 -17
  82. package/dist/{ports-DEBzEhbp.d.cts → ports-C2EVK416.d.cts} +14 -17
  83. package/dist/records/depth/index.cjs +2 -2
  84. package/dist/records/depth/index.d.cts +11 -10
  85. package/dist/records/depth/index.d.ts +11 -10
  86. package/dist/records/depth/index.js +2 -2
  87. package/dist/records/index.cjs +3 -3
  88. package/dist/records/index.d.cts +25 -14
  89. package/dist/records/index.d.ts +25 -14
  90. package/dist/records/index.js +3 -3
  91. package/dist/{requestFunnel-CjW7uDuA.d.ts → requestFunnel-D7ipek3e.d.ts} +28 -4
  92. package/dist/{requestFunnel-L-BQfi0z.d.cts → requestFunnel-Djjwgoe9.d.cts} +28 -4
  93. package/dist/{runtime-BR9ysG0J.d.ts → runtimeTypes-CTL3yToK.d.ts} +10 -100
  94. package/dist/{runtime-B8s-_hv8.d.cts → runtimeTypes-D2C9uD85.d.cts} +10 -100
  95. package/dist/server/events/index.cjs +1 -1
  96. package/dist/server/events/index.d.cts +4 -3
  97. package/dist/server/events/index.d.ts +4 -3
  98. package/dist/server/events/index.js +1 -1
  99. package/dist/server/index.cjs +1 -1
  100. package/dist/server/index.d.cts +5 -4
  101. package/dist/server/index.d.ts +5 -4
  102. package/dist/server/index.js +1 -1
  103. package/dist/televet/booking/index.cjs +1 -0
  104. package/dist/televet/booking/index.d.cts +566 -0
  105. package/dist/televet/booking/index.d.ts +566 -0
  106. package/dist/televet/booking/index.js +1 -0
  107. package/dist/televet/call/index.cjs +1 -0
  108. package/dist/televet/call/index.d.cts +161 -0
  109. package/dist/televet/call/index.d.ts +161 -0
  110. package/dist/televet/call/index.js +1 -0
  111. package/dist/televet/index.cjs +1 -1
  112. package/dist/televet/index.d.cts +64 -12
  113. package/dist/televet/index.d.ts +64 -12
  114. package/dist/televet/index.js +1 -1
  115. package/dist/televetGlobal-CEk0_cW9.d.cts +34 -0
  116. package/dist/televetGlobal-Cs9Wbqsy.d.ts +34 -0
  117. package/dist/testing/index.cjs +4 -4
  118. package/dist/testing/index.d.cts +4 -3
  119. package/dist/testing/index.d.ts +4 -3
  120. package/dist/testing/index.js +4 -4
  121. package/dist/testing/rn/index.cjs +1 -1
  122. package/dist/testing/rn/index.d.cts +13 -10
  123. package/dist/testing/rn/index.d.ts +13 -10
  124. package/dist/testing/rn/index.js +1 -1
  125. package/dist/testing/web/index.cjs +1 -1
  126. package/dist/testing/web/index.d.cts +14 -12
  127. package/dist/testing/web/index.d.ts +14 -12
  128. package/dist/testing/web/index.js +1 -1
  129. package/dist/{timelineRows-DZed6dAM.d.ts → timelineRows-7yFNK_rU.d.ts} +1 -1
  130. package/dist/{timelineRows-CaohZzXS.d.cts → timelineRows-CzR1T2DR.d.cts} +1 -1
  131. package/dist/tokens-CIngRkvt.d.cts +362 -0
  132. package/dist/tokens-CIngRkvt.d.ts +362 -0
  133. package/dist/typeStyle-DHJzDaUo.d.cts +112 -0
  134. package/dist/typeStyle-YPS_MXeI.d.ts +112 -0
  135. package/dist/{useRecordsDepth-BHBzJ76R.d.cts → useRecordsDepth-Bnw36jPr.d.cts} +24 -5
  136. package/dist/{useRecordsDepth-BU-OhzH6.d.ts → useRecordsDepth-DFF7Faxx.d.ts} +24 -5
  137. package/dist/{useVetVisit-CjmMa896.d.ts → useVetVisit-BsjoDO-n.d.ts} +21 -6
  138. package/dist/{useVetVisit-Bc84hWUU.d.cts → useVetVisit-Ds8f1peV.d.cts} +21 -6
  139. package/dist/video/index.cjs +1 -1
  140. package/dist/video/index.d.cts +3 -2
  141. package/dist/video/index.d.ts +3 -2
  142. package/dist/video/index.js +1 -1
  143. package/dist/{view-DtSPYpKa.d.ts → view-BqcOYFTr.d.ts} +5 -4
  144. package/dist/{view-C3qPIXGX.d.cts → view-CaJs8WFH.d.cts} +5 -4
  145. package/dist/web/consent/index.cjs +1 -1
  146. package/dist/web/consent/index.d.cts +9 -8
  147. package/dist/web/consent/index.d.ts +9 -8
  148. package/dist/web/consent/index.js +1 -1
  149. package/dist/web/index.cjs +10 -10
  150. package/dist/web/index.d.cts +43 -19
  151. package/dist/web/index.d.ts +43 -19
  152. package/dist/web/index.js +10 -10
  153. package/dist/web/notifications/index.cjs +2 -2
  154. package/dist/web/notifications/index.d.cts +7 -6
  155. package/dist/web/notifications/index.d.ts +7 -6
  156. package/dist/web/notifications/index.js +2 -2
  157. package/dist/web/records/depth/index.cjs +2 -2
  158. package/dist/web/records/depth/index.d.cts +11 -10
  159. package/dist/web/records/depth/index.d.ts +11 -10
  160. package/dist/web/records/depth/index.js +2 -2
  161. package/dist/web/records/index.cjs +3 -3
  162. package/dist/web/records/index.d.cts +123 -14
  163. package/dist/web/records/index.d.ts +123 -14
  164. package/dist/web/records/index.js +3 -3
  165. package/dist/web/televet/booking/index.cjs +2 -0
  166. package/dist/web/televet/booking/index.d.cts +770 -0
  167. package/dist/web/televet/booking/index.d.ts +770 -0
  168. package/dist/web/televet/booking/index.js +2 -0
  169. package/dist/web/televet/call/index.cjs +1 -0
  170. package/dist/web/televet/call/index.d.cts +144 -0
  171. package/dist/web/televet/call/index.d.ts +144 -0
  172. package/dist/web/televet/call/index.js +1 -0
  173. package/dist/web/televet/index.cjs +1 -1
  174. package/dist/web/televet/index.d.cts +61 -9
  175. package/dist/web/televet/index.d.ts +61 -9
  176. package/dist/web/televet/index.js +1 -1
  177. package/package.json +74 -5
  178. package/televet/booking/package.json +8 -0
  179. package/televet/call/package.json +8 -0
  180. package/web/televet/booking/native-blocked.cjs +12 -0
  181. package/web/televet/booking/package.json +8 -0
  182. package/web/televet/call/native-blocked.cjs +12 -0
  183. package/web/televet/call/package.json +8 -0
  184. package/dist/entitlementRepository-DKdXFgTo.d.cts +0 -698
  185. package/dist/entitlementRepository-DSbzuyAW.d.ts +0 -698
  186. package/dist/typeStyle-0TydiZ1w.d.cts +0 -19
  187. package/dist/typeStyle-CWMsoe6b.d.ts +0 -19
@@ -1,7 +1,8 @@
1
1
  import { R as RecordsRequestId, P as PetRef } from './ids-B2GAAifq.js';
2
- import { a5 as RecordsClinicSearchInput, a6 as RecordsClinicSearchPage, a7 as RecordsRecentClinicsInput, a8 as RecordsAuthorizationCopy, a9 as CreateClinicRequestInput, aa as RecordsSignatureUploadPolicy, l as RecordsClinic, O as RecordsClinicBatch, P as RecordsClinicBatchClient, m as RecordsDepthClient } from './depth-DjDcJ6kH.js';
3
- import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
4
- import { f as RecordsRequestGroupView, d as RecordsRequestView } from './models-B-Uh2LTf.js';
2
+ import { a6 as RecordsClinicSearchInput, a7 as RecordsClinicSearchPage, a8 as RecordsRecentClinicsInput, a9 as RecordsAuthorizationCopy, aa as CreateClinicRequestInput, ab as RecordsSignatureUploadPolicy, l as RecordsClinic, P as RecordsClinicBatch, Q as RecordsClinicBatchClient, m as RecordsDepthClient } from './depth-DO3Ko_qs.js';
3
+ import { E as EverfurResult } from './EverfurResult-SGvHKsCB.js';
4
+ import { f as RecordsRequestGroupView, d as RecordsRequestView } from './models-DSqA5Ahs.js';
5
+ import { E as EverfurError } from './EverfurError-DmELDpXp.js';
5
6
 
6
7
  interface RecordsClinicController {
7
8
  searchClinics(input?: RecordsClinicSearchInput): Promise<EverfurResult<RecordsClinicSearchPage>>;
@@ -126,6 +127,15 @@ type RecordsScreen = {
126
127
  readonly clinic: ClinicDraft;
127
128
  } | {
128
129
  readonly name: 'upload';
130
+ }
131
+ /**
132
+ * Every upload and clinic request for the pet, each with its own status: the consumer's
133
+ * `RecordsRequestListScreen` (everfur-mobile src/features/records/ui/RecordsRequestListScreen.tsx, the
134
+ * `/records/requests` route the dashboard's `RecordsRequestsStatusCard` opens). On the web it is the
135
+ * records page's own request list.
136
+ */
137
+ | {
138
+ readonly name: 'requests';
129
139
  };
130
140
  interface RecordsNavState {
131
141
  readonly stack: readonly RecordsScreen[];
@@ -187,9 +197,18 @@ type RecordsAskHandler = (prompt: string, entityRef: RecordsAskEntityRef) => voi
187
197
 
188
198
  type ClinicLocation = NonNullable<RecordsClinicSearchInput['location']>;
189
199
 
190
- type RecordsUrlKind = 'share_link' | 'record_pdf';
200
+ /**
201
+ * What a URL handed to `onOpenUrl` is: a revocable share link, the full record PDF (a short-lived presigned
202
+ * GET), or one file the member uploaded onto a request (`request_document`, web only; also short-lived).
203
+ */
204
+ type RecordsUrlKind = 'share_link' | 'record_pdf' | 'request_document';
191
205
  interface RecordsHostSeams {
192
- /** Open a share link or the record PDF. Default: `Linking.openURL` on React Native, `window.open` on the web. */
206
+ /**
207
+ * Share a link, or save or preview a file, your app's way. Default, which never leaves your app: React
208
+ * Native shares the link through the OS share sheet (`Share.share`) and offers the PDF's short-lived link
209
+ * the same way (pass this seam to share the FILE, e.g. expo-file-system + expo-sharing); the web shares
210
+ * the link with `navigator.share`, else copies it, and saves a file in place with no new tab.
211
+ */
193
212
  readonly onOpenUrl?: (url: string, kind: RecordsUrlKind) => void | Promise<void>;
194
213
  /** Copy a share link. Web default: `navigator.clipboard.writeText`; React Native has no default (see above). */
195
214
  readonly onCopy?: (text: string) => Promise<void>;
@@ -1,5 +1,6 @@
1
- import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.js';
1
+ import { E as EverfurError } from './EverfurError-DmELDpXp.js';
2
2
  import { P as PetRef } from './ids-B2GAAifq.js';
3
+ import { E as EverfurResult } from './EverfurResult-SGvHKsCB.js';
3
4
  import { V as VetVisitIntent } from './visitIntent-D7_yVp1I.js';
4
5
 
5
6
  /** What the hosted page will open for a handoff minted with `visitRef`: the platform's own echo. */
@@ -138,9 +139,20 @@ interface UseVetVisitOptions {
138
139
  readonly usState?: string | null;
139
140
  /**
140
141
  * `'chat'` for the entry inside Chat. `available` then also needs Everfur's chat entry switch and a pet (the
141
- * one the chat is about); the visit itself is the same hosted visit.
142
+ * one the chat is about); the visit itself opens wherever `prefer` says.
142
143
  */
143
144
  readonly entry?: VetVisitEntry | null;
145
+ /**
146
+ * Where `open()` and `openVisit()` take the member. Defaults to `'in-app'`.
147
+ *
148
+ * `'in-app'` opens the visit INSIDE your app: your registered presenter (`registerEverfurTelevetFlow`) if
149
+ * there is one, else the in-app experience Everfur provides, rendered by a mounted `EverfurTelevetHost`.
150
+ * Nothing is minted and nothing leaves the app.
151
+ *
152
+ * `'redirect'` is the explicit opt-in to the hosted Everfur visit: a handoff is minted and opened in a new
153
+ * tab (web) or the system browser (React Native). Use it only for a surface you deliberately keep hosted.
154
+ */
155
+ readonly prefer?: 'in-app' | 'redirect' | undefined;
144
156
  }
145
157
  /** What `useVetVisit` returns. The handoff URL is never part of it. */
146
158
  interface UseVetVisitState {
@@ -159,8 +171,9 @@ interface UseVetVisitState {
159
171
  /** The closed reason for the last failure, or null. */
160
172
  readonly errorReason: VetVisitErrorReason | null;
161
173
  /**
162
- * Mint a handoff and open the hosted Everfur visit. Call it directly from a press or click handler. A second
163
- * call while one is in flight returns the same promise rather than minting a second handoff.
174
+ * Open a vet visit: in your app by default, or the hosted Everfur visit when `prefer` is `'redirect'`. Call
175
+ * it directly from a press or click handler. On the hosted path a second call while one is in flight
176
+ * returns the same promise rather than minting a second handoff.
164
177
  */
165
178
  open(petRef?: PetRef | null): Promise<VetVisitOpenResult>;
166
179
  /**
@@ -178,8 +191,10 @@ interface UseVetVisitState {
178
191
  * A `null` intent on a target means the visit is over without happening (cancelled, missed): there is
179
192
  * nothing left to open, so call `open()` to book a new one instead.
180
193
  *
181
- * Everfur resolves the reference at the mint against this member's own visits, so one that is not theirs
182
- * settles `invalidRequest` and opens nothing. Shares the single-flight rule with `open`.
194
+ * In-app by default, like `open`: the request carries `visitRef` and `intent` to your presenter or to the
195
+ * SDK-owned experience. With `prefer: 'redirect'`, Everfur resolves the reference at the mint against this
196
+ * member's own visits, so one that is not theirs settles `invalidRequest` and opens nothing, and the call
197
+ * shares the single-flight rule with `open`.
183
198
  */
184
199
  openVisit(visitRef: string, intent?: VetVisitIntent | null): Promise<VetVisitOpenResult>;
185
200
  }
@@ -1,5 +1,6 @@
1
- import { c as EverfurResult, E as EverfurError } from './EverfurResult-DN9pL2Ab.cjs';
1
+ import { E as EverfurError } from './EverfurError-DmELDpXp.cjs';
2
2
  import { P as PetRef } from './ids-B2GAAifq.cjs';
3
+ import { E as EverfurResult } from './EverfurResult-ZtH-YV1h.cjs';
3
4
  import { V as VetVisitIntent } from './visitIntent-D7_yVp1I.cjs';
4
5
 
5
6
  /** What the hosted page will open for a handoff minted with `visitRef`: the platform's own echo. */
@@ -138,9 +139,20 @@ interface UseVetVisitOptions {
138
139
  readonly usState?: string | null;
139
140
  /**
140
141
  * `'chat'` for the entry inside Chat. `available` then also needs Everfur's chat entry switch and a pet (the
141
- * one the chat is about); the visit itself is the same hosted visit.
142
+ * one the chat is about); the visit itself opens wherever `prefer` says.
142
143
  */
143
144
  readonly entry?: VetVisitEntry | null;
145
+ /**
146
+ * Where `open()` and `openVisit()` take the member. Defaults to `'in-app'`.
147
+ *
148
+ * `'in-app'` opens the visit INSIDE your app: your registered presenter (`registerEverfurTelevetFlow`) if
149
+ * there is one, else the in-app experience Everfur provides, rendered by a mounted `EverfurTelevetHost`.
150
+ * Nothing is minted and nothing leaves the app.
151
+ *
152
+ * `'redirect'` is the explicit opt-in to the hosted Everfur visit: a handoff is minted and opened in a new
153
+ * tab (web) or the system browser (React Native). Use it only for a surface you deliberately keep hosted.
154
+ */
155
+ readonly prefer?: 'in-app' | 'redirect' | undefined;
144
156
  }
145
157
  /** What `useVetVisit` returns. The handoff URL is never part of it. */
146
158
  interface UseVetVisitState {
@@ -159,8 +171,9 @@ interface UseVetVisitState {
159
171
  /** The closed reason for the last failure, or null. */
160
172
  readonly errorReason: VetVisitErrorReason | null;
161
173
  /**
162
- * Mint a handoff and open the hosted Everfur visit. Call it directly from a press or click handler. A second
163
- * call while one is in flight returns the same promise rather than minting a second handoff.
174
+ * Open a vet visit: in your app by default, or the hosted Everfur visit when `prefer` is `'redirect'`. Call
175
+ * it directly from a press or click handler. On the hosted path a second call while one is in flight
176
+ * returns the same promise rather than minting a second handoff.
164
177
  */
165
178
  open(petRef?: PetRef | null): Promise<VetVisitOpenResult>;
166
179
  /**
@@ -178,8 +191,10 @@ interface UseVetVisitState {
178
191
  * A `null` intent on a target means the visit is over without happening (cancelled, missed): there is
179
192
  * nothing left to open, so call `open()` to book a new one instead.
180
193
  *
181
- * Everfur resolves the reference at the mint against this member's own visits, so one that is not theirs
182
- * settles `invalidRequest` and opens nothing. Shares the single-flight rule with `open`.
194
+ * In-app by default, like `open`: the request carries `visitRef` and `intent` to your presenter or to the
195
+ * SDK-owned experience. With `prefer: 'redirect'`, Everfur resolves the reference at the mint against this
196
+ * member's own visits, so one that is not theirs settles `invalidRequest` and opens nothing, and the call
197
+ * shares the single-flight rule with `open`.
183
198
  */
184
199
  openVisit(visitRef: string, intent?: VetVisitIntent | null): Promise<VetVisitOpenResult>;
185
200
  }
@@ -1 +1 @@
1
- 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var Mr=Object.defineProperty;var o=(e,r)=>Mr(e,"name",{value:r,configurable:true});var re=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(re.map(e=>e.wireCode));var Lr=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"}),we=Object.freeze(re.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Lr[e.wireCode]}))),Ur=new Map(we.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Br=Object.freeze(["http_envelope",...[...new Set(we.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function V(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...Br]){let i=Ur.get(n+t);if(i)return i}}o(V,"contractErrorFor");function Vr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Vr,"contractDocUrl");function Fe(e){return null}o(Fe,"publishedDocUrl");var qr=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 Oe(e){return qr[e]}o(Oe,"categoryFor");function Pe(e){let r=V(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),n=t.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Pe,"fromWire");var Hr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function te(e){return Hr.has(e)}o(te,"isAutoRetryable");var Kr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ie(e){return te(e)||Kr.has(e)}o(Ie,"isRetryableCode");var Gr=500,ne=8e3,Ae=4;function ze(e,r=Math.random){let t=Math.max(0,e),n=Math.min(Gr*2**t,ne);return Math.floor(r()*n)}o(ze,"backoffDelayMs");var Yr=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 oe(e){return Yr[e]}o(oe,"userFacingError");function je(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(je,"defineHidden");var Wr=/^[a-z][a-z0-9_]{0,63}$/;function m(e,r){let t=V(r?.wireCode,r?.wireEnvelope),n={code:e,category:Oe(e),retryable:r?.retryable??Ie(e),displayMessage:oe(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&Wr.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&je(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&je(n,"raw",r.raw),Object.freeze(n)}o(m,"makeEverfurError");function j(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}o(j,"ok");function y(e){return Object.freeze({ok:false,error:e})}o(y,"err");var q=class q extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,q.prototype);}};o(q,"EverfurConfigError");var z=q;function H(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(H,"assertNever");function De(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(De,"errorFrame");function Qr(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}o(Qr,"authHeaders");function D(e,r){return {...e,headers:{...Xr(e.headers),...Qr(r)}}}o(D,"withAuthHeaders");function Xr(e){if(!e)return {};let r={};for(let[t,n]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=n);}return r}o(Xr,"stripAuthHeaders");async function Ne(e,r){if(r.mode==="anonymous")return r.transport.request(D(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return y(ie())}let n=await r.transport.request(D(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return y(ie())}let a=await r.transport.request(D(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?y(ie(a.error.httpStatus)):a}o(Ne,"authedSend");function ie(e){return m("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(ie,"authRejectedError");function Me(e){return m("internalError",{retryable:true,wireMessage:Zr(e)})}o(Me,"networkError");function Zr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(Zr,"describeCause");var et=3e4,rt=ne*2,tt="idempotency-key",nt=new Set(["POST","PUT","PATCH","DELETE"]),ot=Object.freeze({onEvent(){}}),it=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function Ue(e){let r=e.observer??ot,t=e.timers??it,n=e.rng??Math.random,i=e.sleep??((h,g)=>vt(h,t,g)),a=e.maxAttempts??Ae,s=e.unaryTimeoutMs??et,l=e.newIdempotencyKey??st(),u=o(h=>{try{r.onEvent(h);}catch{}},"emit");async function p(h,g,v){let k=v?.maxAttempts,w=Math.max(1,k??a),Q=v?.idempotent??nt.has(g.method)?l():null,Nr=at(g,Q),X=0;for(;;){let I=o(ee=>Object.freeze({call:h,method:g.method,path:g.path,attempt:X,...Q?{idempotencyKey:Q}:{},...ee}),"stamp");u(I({phase:"attempt"}));let Te=bt(s,t),ke=gt(Te.signal,g.signal),A;try{A=await Ne({...Nr,signal:ke.signal},e.auth);}catch(ee){A=y(Me(ee));}finally{ke.dispose(),Te.cancel();}if(A.ok)return u(I({phase:"settled",ok:true,reason:"ok"})),A;let T=A.error,B=dt(T,X,{maxAttempts:w,rng:n,now:t.now(),aborted:g.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Z={ok:false,code:T.code,reason:B.reason,...T.httpStatus!==void 0?{httpStatus:T.httpStatus}:{},...T.requestId!==void 0?{requestId:T.requestId}:{}};if(!B.retry)return u(I({phase:"settled",...Z})),y(T);if(u(I({phase:"retry",...Z,delayMs:B.delayMs})),await i(B.delayMs,g.signal),g.signal?.aborted===true)return u(I({phase:"settled",...Z,reason:"aborted"})),y(T);X+=1;}}o(p,"send");async function f(h){return D(h,await mt(e.auth))}o(f,"authorize");async function*R(h,g,v){u(Object.freeze({call:h,phase:"stream.open",method:g.method,path:g.path,attempt:0}));try{yield*e.auth.transport.stream(g,v);}catch{yield De({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(R,"stream"),Object.freeze({send:p,authorize:f,stream:R})}o(Ue,"createRequestFunnel");function at(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==tt&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(at,"assembleHeaders");function st(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(st,"defaultIdempotencyKeyFactory");var lt=10;function dt(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=ut(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!te(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{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 s=o(()=>{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(lt,Math.floor(p)))},"policyCeiling"),l=t.perCallMaxAttempts??s()??t.maxAttempts;if(r+1>=l)return {retry:false,reason:"attempts-exhausted"};let u=ct(e,t.now);return u!==null?u>rt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:u}:{retry:true,reason:i,delayMs:ze(r,t.rng)}}o(dt,"decideRetry");function ut(e){let r=e.code==="unknown"?Pe(yt(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(ut,"throttleKind");function ct(e,r){let t=pt(e.raw);if(t===null)return null;let n=t-r;return n>0?n:0}o(ct,"retryOverrideMs");function pt(e){for(let r of Be(e)){let t=r.resets_at,n=ft(t);if(n!==null)return n}return null}o(pt,"findResetsAt");function Be(e){if(!Le(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];Le(n)&&r.push(n);}return r}o(Be,"candidateScopes");function ft(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}o(ft,"parseInstantMs");function yt(e){for(let r of Be(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(yt,"rawWireCode");function Le(e){return typeof e=="object"&&e!==null}o(Le,"isRecord");async function mt(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(mt,"resolveDeviceAuth");function bt(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(bt,"boundedSignal");function gt(e,r){let t=o(()=>{},"noop");if(!r)return {signal:e,dispose:t};let n=new AbortController;if(e.aborted||r.aborted)return n.abort(),{signal:n.signal,dispose:t};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}o(gt,"mergeSignals");function vt(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(n=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),n();},e),a=o(()=>{r.clearTimeout(i),n();},"onAbort");t?.addEventListener("abort",a,{once:true});})}o(vt,"delayAbortable");var Ve=Object.freeze({track(){},trackExpectedFailure(){}});function qe(e){let r={uri:e.uri,mimeType:e.mimeType},t=G(e);return t!==null&&(r.sizeBytes=t),Object.freeze(r)}o(qe,"fileHandleFromMedia");function G(e){let r=e.byteSize??e.sizeBytes;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}o(G,"mediaByteSize");function He(e){let r=e.durationSeconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.round(r*1e3):null}o(He,"mediaDurationMs");function Ke(e,r){return Object.freeze(r===void 0?{mode:e}:{mode:e,maxDurationSeconds:r})}o(Ke,"captureOptionsFor");function ae(e){return e!=null&&e.isAvailable===true}o(ae,"isCaptureAvailable");var Ge=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function Ye(e,r,t){return new Promise(n=>{if(r.aborted){n();return}let i={handle:void 0},a=o(()=>{t.clearTimeout(i.handle),r.removeEventListener("abort",a),n();},"done");i.handle=t.setTimeout(a,e),r.addEventListener("abort",a,{once:true});})}o(Ye,"delayAbortable");function ht(e,r){if(!r)return e;let t=new AbortController;if(e.aborted||r.aborted)return t.abort(),t.signal;let n=o(()=>t.abort(),"onAbort");return e.addEventListener("abort",n,{once:true}),r.addEventListener("abort",n,{once:true}),t.signal}o(ht,"mergeSignals");var se=class se{constructor(r){this.listeners=new Set;this.epoch=0;this.inFlight=null;this.snapshot=Object.freeze({...r});}subscribe(r){return this.listeners.add(r),()=>{this.listeners.delete(r);}}getSnapshot(){return this.snapshot}patch(r){this.snapshot=Object.freeze({...this.snapshot,...r});for(let t of this.listeners)t();}beginOperation(r){this.inFlight?.abort();let t=new AbortController;this.inFlight=t;let n=this.epoch;return {signal:r?ht(t.signal,r):t.signal,epoch:n,settle:o(()=>{this.inFlight===t&&(this.inFlight=null);},"settle")}}alive(r){return r===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null;}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear();}};o(se,"MediaStore");var K=se;function We(e){for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r);if(t>=55296&&t<=56319){let n=e.charCodeAt(r+1);if(!(n>=56320&&n<=57343))return true;r+=1;}else if(t>=56320&&t<=57343)return true}return false}o(We,"hasLoneSurrogate");var Et=Object.freeze(["primary_label","primary_confidence","subtype_label","subtype_display","subtype_confidence","risk_tier","confidence_tier","copy_short","disease_name","disease_framing","model_version","skin_v2","eye_v2","llm_checkup"]),_t=Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),Rt=new Set(["skin_v2","eye_v2","llm_checkup"]),St=new Set(["primary_confidence","subtype_confidence"]),Ct=new Set(["low_risk","concern","uncertain"]),Tt=new Set(["possible","probable"]),kt=Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function Je(e){let r=c(e)?e:{},t={};for(let i of Et){if(!(i in r))continue;let a=r[i],s=xt(i,a);s!==F&&(t[i]=s);}let n=0;for(let i of _t)i in r&&(n+=1);return Object.freeze({metadata:Object.freeze(t),droppedOperatorKeys:n})}o(Je,"projectDetectionMetadata");var F=Symbol("drop");function xt(e,r){if(Rt.has(e))return typeof r=="boolean"?r:F;if(St.has(e))return $e(r)?r:F;if(e==="risk_tier")return typeof r=="string"&&Ct.has(r)?r:F;if(e==="confidence_tier")return typeof r=="string"&&Tt.has(r)?r:F;if(typeof r!="string")return F;let t=kt[e]??256;return r.length>t?r.slice(0,t):r}o(xt,"acceptKey");function $e(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}o($e,"isUnitConfidence");function Qe(e){if(!c(e))return null;let r=b(e.summary),t=b(e.disclaimer),n=le(e.recommendations??e.recommendation);return r===null&&t===null&&n.length===0?null:Object.freeze({summary:r??"",recommendations:Object.freeze(n),disclaimer:t??""})}o(Qe,"parseInterpretation");function Xe(e){if(!c(e))return {};if(c(e.metadata))return e.metadata;let r=e.detections;if(Array.isArray(r)&&r.length>0){let t=r[0];if(c(t)&&c(t.metadata))return t.metadata;if(c(t))return t}return e}o(Xe,"locateDetectionMetadata");function Ze(e){return c(e)?c(e.interpretation)?e.interpretation:e:null}o(Ze,"locateInterpretation");function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(c,"isRecord");function b(e){return typeof e=="string"&&e.length>0?e:null}o(b,"asString");function le(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0):[]}o(le,"asStringList");function er(e){return $e(e)?e:null}o(er,"asUnitNumber");function O(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(O,"asFiniteNumber");var Y=Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:o(e=>We(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`,"job")});async function tr(e,r){let t={purpose:r.purpose,content_type:r.contentType};r.byteSize!==null&&(t.byte_size=r.byteSize);let n={method:"POST",path:Y.initiate,body:t,...r.signal?{signal:r.signal}:{}},i=await e.send("media.initiateUpload",n);if(!i.ok)return y(i.error);let a=wt(i.value);return a===null?y(m("mediaUploadFailed",{retryable:false})):j(a)}o(tr,"initiateUpload");function wt(e){if(!c(e))return null;let r=b(e.url),t=b(e.s3_key);if(r===null||t===null)return null;let n=e.fields,i={};if(c(n))for(let[a,s]of Object.entries(n))typeof s=="string"&&(i[a]=s);return Object.freeze({url:r,fields:Object.freeze(i),s3Key:t,expiresAt:O(e.expires_at)})}o(wt,"parsePresigned");async function nr(e,r,t,n,i){try{return await e.presignedPut(qe(r),{target:t,idempotencyKey:n,...i?{signal:i}:{}}),j(void 0)}catch{return y(m("mediaUploadFailed",{retryable:false}))}}o(nr,"stageUpload");async function or(e,r,t,n,i){let a={method:"POST",path:r,body:t,...i?{signal:i}:{}},s=await e.send("media.analyze",a);if(s.ok){let u=Ft(s.value);return u!==null?{kind:"async",job:u}:{kind:"sync",body:s.value}}let l=n(s.error.httpStatus,s.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:s.error}}o(or,"submitAnalyze");function Ft(e){if(!c(e))return null;let r=b(e.job_id);if(r===null)return null;let t=b(e.status);return t!==null&&At(t)?null:Object.freeze({jobId:r,estimatedSeconds:O(e.estimated_completion_seconds)})}o(Ft,"parseAsyncJob");var Ot=2e3,rr=5e3,Pt=9e4;async function ir(e,r,t){let{timers:n,signal:i,alive:a}=t,s=n.now(),l=Math.max(Pt,(t.estimatedSeconds??0)*1e3),u=Ot;for(;;){if(i.aborted||!a())return {kind:"aborted"};if(await Ye(u,i,n),i.aborted||!a())return {kind:"aborted"};if(n.now()-s>l)return {kind:"timeout"};let p=Y.job(r);if(p===null)return {kind:"notFound"};let f=await e.send("media.pollJob",{method:"GET",path:p,...i?{signal:i}:{}},{maxAttempts:1});if(i.aborted||!a())return {kind:"aborted"};if(!f.ok){if(f.error.httpStatus===404)return {kind:"notFound"};u=Math.min(rr,u+1e3);continue}let R=It(f.value);if(R==="COMPLETED")return {kind:"complete",body:f.value};if(R==="FAILED")return {kind:"failed",error:zt(f.value)};u=Math.min(rr,u+1e3);}}o(ir,"pollJob");function It(e){return c(e)?(b(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}o(It,"jobStatusOf");function At(e){let r=e.toUpperCase();return r==="COMPLETED"||r==="FAILED"}o(At,"isTerminalStatus");function zt(e){let r=c(e)?b(e.error)??b(e.error_code):null;return m("internalError",{retryable:false,...r?{wireMessage:r}:{}})}o(zt,"jobFailureError");function ar(){return null}o(ar,"detectNoGate");function sr(e,r){let t={s3_key:e};return r.type!==void 0&&(t.type=r.type),r.petRef!=null&&(t.pet_id=r.petRef),r.precheckToken!=null&&(t.precheck_token=r.precheckToken),t}o(sr,"analyzeBody");function lr(e){return new de(e)}o(lr,"createVideoController");var ue=class ue extends K{constructor(r){super({status:"idle",job:null,result:null,error:null,isCaptureAvailable:ae(r.camera),progress:0}),this.funnel=r.funnel??Ue({auth:r.auth,...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}}),this.camera=r.camera,this.upload=r.upload,this.defaultPetRef=r.petRef??null,this.telemetry=r.telemetry??Ve,this.timers=r.timers??Ge,this.makeIdempotencyKey=r.makeIdempotencyKey??Lt();}async capture(r){if(!ae(this.camera))return y(m("unknown",{retryable:false}));let t;try{t=await this.camera.capture(Ke("video",15));}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle",progress:0}),y(m("unknown",{retryable:false}))}return this.submit(t,r?.petRef!==void 0?{petRef:r.petRef}:void 0)}async submit(r,t){let n=this.beginOperation(t?.signal),i=t?.petRef??this.defaultPetRef,a=this.makeIdempotencyKey(),s=this.timers.now();this.patch({status:"uploading",progress:0,error:null,result:null,job:null});try{let l=await tr(this.funnel,{purpose:"gait_video",contentType:r.mimeType,byteSize:G(r),signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return x();if(!l.ok)return this.fail(n,l.error);let u=await nr(this.upload,r,l.value,a,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return x();if(!u.ok)return this.telemetry.track("analysis.upload",{capability:"video",purpose:"gait_video",outcome:"failed"}),this.fail(n,u.error);this.patch({progress:1}),this.telemetry.track("analysis.upload",{capability:"video",purpose:"gait_video",byteSize:G(r)??0,durationMs:He(r)??0,outcome:"ok"}),this.patch({status:"analyzing"});let p=await or(this.funnel,Y.videoAnalyze,sr(l.value.s3Key,{petRef:i}),ar,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return x();if(p.kind==="error")return this.fail(n,p.error);if(p.kind==="gate")return this.fail(n,m("unknown",{retryable:!1}));if(p.kind==="sync"){let h=Mt(p.body)??"";return this.complete(n,p.body,h,s)}let f=p.job;this.patch({job:{id:f.jobId,state:"processing"}});let R=await ir(this.funnel,f.jobId,{timers:this.timers,signal:n.signal,alive:o(()=>this.alive(n.epoch),"alive"),estimatedSeconds:f.estimatedSeconds});if(n.signal.aborted||!this.alive(n.epoch))return x();switch(R.kind){case "aborted":return x();case "complete":return this.complete(n,R.body,f.jobId,s);case "failed":return this.fail(n,R.error);case "timeout":return this.fail(n,m("streamTimeout",{retryable:!0}));case "notFound":return this.patch({job:null}),this.fail(n,m("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(n,m("internalError",{retryable:!1}))}}finally{n.settle();}}cancel(){this.inFlight?.abort(),this.inFlight=null,(this.snapshot.status==="uploading"||this.snapshot.status==="analyzing")&&this.patch({status:"idle",progress:0});}complete(r,t,n,i){if(!this.alive(r.epoch))return x();let a=jt(t,n);return a.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:a.droppedOperatorKeys}),this.telemetry.track("analysis.quality_gate",{usable:a.result.quality.usable,reasons:a.result.quality.reasons}),this.patch({status:"complete",progress:1,result:a.result,error:null,job:{id:n,state:"complete"}}),this.telemetry.track("analysis.result",{capability:"video",modelVersion:a.result.modelVersion??"",timeToResultMs:this.timers.now()-i}),j(n)}fail(r,t){return this.alive(r.epoch)?(this.patch({status:"error",error:t,progress:0}),this.telemetry.trackExpectedFailure("analysis.error",{code:t.code,...t.httpStatus!==void 0?{httpStatus:t.httpStatus}:{}}),y(t)):x()}};o(ue,"VideoController");var de=ue;function jt(e,r){let t=Je(Xe(e)),n=Qe(Ze(e)),i=b(t.metadata.model_version)??(c(e)?b(e.model_version):null);return {result:Object.freeze({jobId:r,analysisType:"gait",detections:Dt(e),interpretation:n,modelVersion:i,quality:Nt(e)}),droppedOperatorKeys:t.droppedOperatorKeys}}o(jt,"mapVideoResult");function Dt(e){let r=c(e)?e.detections:null;if(!Array.isArray(r))return Object.freeze([]);let t=[];for(let n of r){if(!c(n))continue;let i=b(n.label)??b(n.name);i!==null&&t.push(Object.freeze({label:i,confidence:er(n.confidence)??0,timestampMs:O(n.timestamp_ms??n.timestamp),durationMs:O(n.duration_ms??n.duration)}));}return Object.freeze(t)}o(Dt,"parseVideoDetections");function Nt(e){let r=c(e)?e.quality:null;if(!c(r))return Object.freeze({usable:true,reasons:Object.freeze([])});let t=r.usable;return Object.freeze({usable:typeof t=="boolean"?t:true,reasons:Object.freeze(le(r.reasons))})}o(Nt,"parseQuality");function Mt(e){return c(e)?b(e.result_id)??b(e.request_id)??b(e.job_id):null}o(Mt,"resultIdOf");function x(){return y(m("unknown",{retryable:false}))}o(x,"abortedResult");function Lt(){let e=0;return ()=>`video-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}o(Lt,"defaultIdempotencyFactory");var dr=Symbol.for("@everfur/sdk#EverfurContext@v1"),ur=globalThis,cr=ur[dr]??(ur[dr]=react.createContext(null));cr.displayName??="EverfurContext";function W(){let e=react.useContext(cr);if(e===null)throw new z("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(W,"useEverfurContext");var Gt=Object.freeze({status:"idle",job:null,result:null,error:null,isCaptureAvailable:false,progress:0}),Yt=o(()=>{},"NOOP_UNSUBSCRIBE");function ce(e){let{runtime:r,userRef:t,activePet:n,scopeEpoch:i}=W(),a=e?.petRef??n??null,[s,l]=react.useState(null);react.useEffect(()=>{let{services:v}=r.registry,k=r.registry.acquire("video",`${t??""}|${a??""}`,()=>lr({...v.errorPolicy?{errorPolicy:v.errorPolicy}:{},auth:v.authFor(t),camera:v.camera,upload:v.upload,petRef:a,telemetry:v.telemetry}),w=>w.dispose());return l(k),()=>{l(w=>w===k?null:w),r.registry.release(k);}},[r,t,a,i]);let u=react.useCallback(v=>s?s.subscribe(v):Yt,[s]),p=react.useCallback(()=>s?s.getSnapshot():Gt,[s]),f=react.useSyncExternalStore(u,p,p),R=react.useCallback(v=>s?s.submit(v):Promise.resolve(pr()),[s]),h=react.useCallback(()=>s?s.capture():Promise.resolve(pr()),[s]),g=react.useCallback(()=>{s?.cancel();},[s]);return react.useMemo(()=>({status:f.status,job:f.job,result:f.result,error:f.error,isCaptureAvailable:f.isCaptureAvailable,progress:f.progress,isBootstrapping:s===null,submit:R,capture:h,cancel:g}),[f,s,R,h,g])}o(ce,"useEverfurVideo");function pr(){return y(m("internalError",{retryable:true}))}o(pr,"notReadyError");function ye(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ye(e[r]);}return e}o(ye,"deepFreeze");var Wt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),yr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},mr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},fr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Jt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},$t={regular:"400",medium:"500",bold:"700"},Qt={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Xt=0,J="System",$="monospace",Zt=["content","heading","control","compact","badge"];function en(e){let r={};for(let t of Zt)r[t]=e;return r}o(en,"authoredTierSizes");function br(){return {family:J,mono:$,fontUrl:null,families:{regular:J,medium:J,bold:J,mono:$,monoMedium:$,monoBold:$},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:fr,tierSizes:en(fr),lineHeight:Jt,weight:$t,letterSpacing:Qt,scale:1,maxScale:Xt,scaleCaps:Wt}}o(br,"baseType");var gr={},pe=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function fe(e){return `cubic-bezier(${e.join(", ")})`}o(fe,"cssCubicBezier");var vr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:fe(pe.standard),emphasized:fe(pe.emphasized),exit:fe(pe.exit)},reducedMotion:false},rn={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)"},hr=ye({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:rn,space:yr,radius:mr,type:br(),motion:vr,slots:gr}),tn={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)"};ye({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tn,space:yr,radius:mr,type:br(),motion:vr,slots:gr});var Er=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),_r=globalThis,me=_r[Er]??(_r[Er]=react.createContext(hr));me.displayName??="EverfurThemeContext";function S(){return react.useContext(me)}o(S,"useEverfurTheme");function dn(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}o(dn,"tierMultiplier");function E({tier:e="content",...r}){let{type:t}=S(),n=dn(t,e);return react.createElement(reactNative.Text,n===void 0?r:{maxFontSizeMultiplier:n,...r})}o(E,"Text");react.forwardRef(o(function(r,t){return react.createElement(reactNative.TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));var un=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function M(e,r){let t=e.type,n=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:n}:{fontFamily:n,fontWeight:t.weight[un[r]]}}o(M,"face");var ve=class ve extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,n){return Object.is(t.resetKey,n.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(ve,"HostRenderBoundary");var be=ve;function pn({render:e}){return e()}o(pn,"RenderHost");function ge({render:e,fallback:r,resetKey:t}){return react.createElement(be,{fallback:r,resetKey:t,children:react.createElement(pn,{render:e})})}o(ge,"HostRender");var fn=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 yn(e){return fn[e]}o(yn,"requires");function Cr(e,r,t){let n=yn(e),i=new Map;for(let l of r)i.set(l.resource,l);if(t?.isPending===true&&n.some(l=>!i.has(l)))return he({name:e,enabled:false,isPending:true,limits:{}});let a=mn(n,i);return n.filter(l=>i.get(l)?.granted!==true).length===0?he({name:e,enabled:true,isPending:false,limits:a}):he({name:e,enabled:false,isPending:false,limits:a,disabled:bn(n,i)})}o(Cr,"decideCapability");function mn(e,r){let t={};for(let n of e){let i=r.get(n)?.limits;if(i)for(let[a,s]of Object.entries(i)){let l=t[a];t[a]=l===void 0?s:Math.min(l,s);}}return t}o(mn,"mergeLimits");function bn(e,r){for(let t of e){let n=r.get(t)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:oe("accessDenied"),level:"user_entitlement",recoverable:false})}o(bn,"disabledFor");function he(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)}o(he,"freezeDecision");function Ee(e){let{runtime:r}=W(),t=r.entitlements,n=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>Cr(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ee,"useCapability");var hn=48;function En(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(En,"selectView");function wr(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:a}=e,s=Ee(r),l=react.useMemo(()=>En(s),[s]);switch(l){case "enabled":return t;case "pending":return i?jsxRuntime.jsx(ge,{render:i,fallback:jsxRuntime.jsx(kr,{capability:r,style:a})}):jsxRuntime.jsx(kr,{capability:r,style:a});case "disabled":return n?jsxRuntime.jsx(ge,{render:()=>n(s),fallback:jsxRuntime.jsx(xr,{decision:s,style:a}),resetKey:s}):jsxRuntime.jsx(xr,{decision:s,style:a});default:return H(l)}}o(wr,"CapabilityGate");function kr({capability:e,style:r}){let t=S(),n=react.useMemo(()=>Fr(t),[t]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,r],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}o(kr,"PendingSkeleton");function xr({decision:e,style:r}){let t=S(),n=react.useMemo(()=>Fr(t),[t]),i=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,r],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?jsxRuntime.jsx(E,{style:n.offstateText,children:i}):null})}o(xr,"OffState");function Fr(e){let{color:r,space:t,radius:n,type:i}=e;return reactNative.StyleSheet.create({offstate:{minHeight:hn,justifyContent:"center",paddingHorizontal:t.lg,paddingVertical:t.md,backgroundColor:r.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.brandBorder},offstateText:{...M(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:r.text.muted},skeletonBar:{height:t.md,borderRadius:n.xs,backgroundColor:r.brandSofter}})}o(Fr,"makeStyles");var L=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Ir(e){let r=S(),t=react.useMemo(()=>Sn(r),[r]);return jsxRuntime.jsxs(reactNative.View,{style:[t.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${L.title}. ${L.body}`,children:[jsxRuntime.jsx(E,{style:t.title,children:L.title}),jsxRuntime.jsx(E,{style:t.body,children:L.body})]})}o(Ir,"ClinicalDisclaimer");function Sn(e){let{color:r,space:t,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:t.lg,paddingVertical:t.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:r.borderHairlineGreen,backgroundColor:r.surfaceCream,gap:t.xs},title:{...M(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:r.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...M(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:r.text.muted}})}o(Sn,"makeStyles");var Fn=300,Ce=120,Ar=44,zr=40,On=160;function Pn(e){let{petRef:r,style:t}=e;return jsxRuntime.jsx(wr,{capability:"video",style:t,children:jsxRuntime.jsx(An,{petRef:r,style:t})})}o(Pn,"EverfurVideo");function In(e){return e.isBootstrapping||e.status==="uploading"||e.status==="analyzing"?"loading":e.status==="error"&&e.error?"error":e.status==="complete"&&e.result?"populated":e.isCaptureAvailable?"empty":"native"}o(In,"selectView");function An({petRef:e,style:r}){let t=react.useMemo(()=>e!==void 0?{petRef:e}:void 0,[e]),n=ce(t),i=In(n),{styles:a}=P();return jsxRuntime.jsxs(reactNative.View,{style:[a.container,r],children:[jsxRuntime.jsx(reactNative.View,{style:a.body,children:zn(i,n)}),jsxRuntime.jsx(Ir,{})]})}o(An,"VideoBody");function zn(e,r){switch(e){case "loading":return jsxRuntime.jsx(jn,{progress:r.progress});case "native":return jsxRuntime.jsx(Dn,{});case "empty":return jsxRuntime.jsx(Nn,{onCapture:r.capture});case "error":return jsxRuntime.jsx(Mn,{error:r.error,onRetry:r.capture});case "populated":return jsxRuntime.jsx(Ln,{result:r.result});default:return H(e)}}o(zn,"renderView");function jn({progress:e}){let{theme:r,styles:t}=P(),[n,i]=react.useState(false);react.useEffect(()=>{let s=setTimeout(()=>i(true),Fn);return ()=>clearTimeout(s)},[]);let a=Math.max(0,Math.min(1,e));return jsxRuntime.jsxs(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing video",children:[n?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:r.color.brand}):null,n&&a>0&&a<1?jsxRuntime.jsx(reactNative.View,{style:t.progressTrack,accessibilityRole:"progressbar",children:jsxRuntime.jsx(reactNative.View,{style:[t.progressFill,{width:`${Math.round(a*100)}%`}]})}):null]})}o(jn,"LoadingState");function Dn(){let{styles:e}=P();return jsxRuntime.jsx(reactNative.View,{style:e.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:jsxRuntime.jsx(reactNative.View,{style:e.emptyGlyph})})}o(Dn,"NativeUnavailableState");function Nn({onCapture:e}){let{styles:r}=P();return jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Record a short clip to check gait",children:jsxRuntime.jsx(reactNative.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Record video",style:r.primaryButton,children:jsxRuntime.jsx(E,{style:r.primaryLabel,children:"Record video"})})})}o(Nn,"EmptyState");function Mn({error:e,onRetry:r}){let{styles:t}=P();return jsxRuntime.jsxs(reactNative.View,{style:t.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(E,{style:t.errorText,children:e.displayMessage}),e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:"Try again",style:t.primaryButton,children:jsxRuntime.jsx(E,{style:t.primaryLabel,children:"Try again"})}):null]})}o(Mn,"ErrorState");function Ln({result:e}){let{styles:r}=P();return e.quality.usable?jsxRuntime.jsxs(reactNative.ScrollView,{style:r.list,contentContainerStyle:r.listContent,accessibilityLabel:"Gait analysis result",children:[e.detections.map((t,n)=>jsxRuntime.jsx(reactNative.View,{style:r.resultRow,children:jsxRuntime.jsx(E,{style:r.resultLabel,children:t.label})},`${t.label}-${n}`)),e.interpretation?jsxRuntime.jsxs(reactNative.View,{style:r.interpretationBlock,children:[jsxRuntime.jsx(E,{style:r.summaryText,children:e.interpretation.summary}),jsxRuntime.jsx(E,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]}):jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Result uncertain",children:jsxRuntime.jsx(E,{style:r.uncertainText,children:"We could not get a clear read from this clip. Try recording again."})})}o(Ln,"ResultState");function P(){let e=S();return react.useMemo(()=>({theme:e,styles:Un(e)}),[e])}o(P,"useVideoStyles");function Un(e){let{color:r,space:t,radius:n,type:i}=e,a=i.weight.bold,s=i.weight.medium;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Ce,backgroundColor:r.background},body:{flex:1},centered:{minHeight:Ce,flexGrow:1,alignItems:"center",justifyContent:"center",padding:t.xl},offstate:{minHeight:Ce,alignItems:"center",justifyContent:"center",padding:t.xl},emptyGlyph:{width:zr,height:zr,borderRadius:n.pill,backgroundColor:r.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.borderHairlineGreen},primaryButton:{minHeight:Ar,minWidth:Ar,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.md,borderRadius:n.pill,backgroundColor:r.primary,shadowColor:r.brandSofter,shadowOffset:{width:0,height:t.xs},shadowOpacity:1,shadowRadius:t.sm,elevation:t.xs},primaryLabel:{color:r.onPrimary,fontFamily:i.family,fontSize:i.size.body,fontWeight:a,letterSpacing:i.letterSpacing.tight},errorText:{color:r.danger,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal,fontWeight:s,textAlign:"center",marginBottom:t.md},uncertainText:{color:r.text.muted,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal,textAlign:"center"},progressTrack:{marginTop:t.lg,height:t.sm,width:On,borderRadius:n.pill,backgroundColor:r.skeleton,overflow:"hidden"},progressFill:{height:t.sm,borderRadius:n.pill,backgroundColor:r.brand},list:{flex:1},listContent:{padding:t.lg,gap:t.md},resultRow:{paddingVertical:t.sm,paddingHorizontal:t.md,borderRadius:n.sm,backgroundColor:r.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.brandBorder},resultLabel:{color:r.text.primary,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,fontWeight:s},interpretationBlock:{marginTop:t.sm,gap:t.sm},summaryText:{color:r.text.primary,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal},disclaimerText:{color:r.text.muted,fontFamily:i.family,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.relaxed}})}o(Un,"makeStyles");exports.EverfurVideo=Pn;exports.useEverfurVideo=ce;
1
+ 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var Ur=Object.defineProperty;var o=(e,r)=>Ur(e,"name",{value:r,configurable:true});var re=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(re.map(e=>e.wireCode));var Br=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"}),we=Object.freeze(re.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Br[e.wireCode]}))),Vr=new Map(we.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),qr=Object.freeze(["http_envelope",...[...new Set(we.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function V(e,r){if(typeof e!="string")return;let t=e.trim().toUpperCase();if(t.length!==0)for(let n of [r??"http_envelope",...qr]){let i=Vr.get(n+t);if(i)return i}}o(V,"contractErrorFor");function Hr(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Hr,"contractDocUrl");function Fe(e){return null}o(Fe,"publishedDocUrl");var Kr=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 Oe(e){return Kr[e]}o(Oe,"categoryFor");function Pe(e){let r=V(e);if(r)return r.normalized;let t=(e??"").trim().toUpperCase(),n=t.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(t.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}o(Pe,"fromWire");var Gr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function te(e){return Gr.has(e)}o(te,"isAutoRetryable");var Yr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ie(e){return te(e)||Yr.has(e)}o(Ie,"isRetryableCode");var Wr=500,ne=8e3,Ae=4;function ze(e,r=Math.random){let t=Math.max(0,e),n=Math.min(Wr*2**t,ne);return Math.floor(r()*n)}o(ze,"backoffDelayMs");var Jr=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 oe(e){return Jr[e]}o(oe,"userFacingError");function je(e,r,t){Object.defineProperty(e,r,{value:t,enumerable:false,writable:false,configurable:false});}o(je,"defineHidden");var $r=/^[a-z][a-z0-9_]{0,63}$/;function m(e,r){let t=V(r?.wireCode,r?.wireEnvelope),n={code:e,category:Oe(e),retryable:r?.retryable??Ie(e),displayMessage:oe(e)};if(r?.httpStatus!==void 0&&(n.httpStatus=r.httpStatus),r?.requestId&&(n.requestId=r.requestId),typeof r?.reasonCode=="string"&&$r.test(r.reasonCode)&&(n.reasonCode=r.reasonCode),t);return r?.wireMessage&&je(n,"wireMessage",r.wireMessage),r?.raw!==void 0&&r.raw!==null&&je(n,"raw",r.raw),Object.freeze(n)}o(m,"makeEverfurError");function j(e,r){return Object.freeze(r===void 0?{ok:true,value:e}:{ok:true,value:e,warning:r})}o(j,"ok");function y(e){return Object.freeze({ok:false,error:e})}o(y,"err");var q=class q extends Error{constructor(r,t){super(t),this.name="EverfurConfigError",this.kind=r,Object.setPrototypeOf(this,q.prototype);}};o(q,"EverfurConfigError");var z=q;function H(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(H,"assertNever");function De(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}o(De,"errorFrame");function Zr(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}o(Zr,"authHeaders");function D(e,r){return {...e,headers:{...et(e.headers),...Zr(r)}}}o(D,"withAuthHeaders");function et(e){if(!e)return {};let r={};for(let[t,n]of Object.entries(e)){let i=t.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(r[t]=n);}return r}o(et,"stripAuthHeaders");async function Ne(e,r){if(r.mode==="anonymous")return r.transport.request(D(e,{mode:"anonymous",publishableKey:r.publishableKey,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));let t;try{t=await r.identity.currentToken();}catch{return y(ie())}let n=await r.transport.request(D(e,{mode:"personalized",token:t,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await r.identity.currentToken({forceRefresh:!0});}catch{return y(ie())}let a=await r.transport.request(D(e,{mode:"personalized",token:i,userRef:r.userRef,...r.sessionId?{sessionId:r.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?y(ie(a.error.httpStatus)):a}o(Ne,"authedSend");function ie(e){return m("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(ie,"authRejectedError");function Me(e){return m("internalError",{retryable:true,wireMessage:rt(e)})}o(Me,"networkError");function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(rt,"describeCause");var tt=3e4,nt=ne*2,ot="idempotency-key",it=new Set(["POST","PUT","PATCH","DELETE"]),at=Object.freeze({onEvent(){}}),st=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function lt(e){let r=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return r.length===0?null:`efs_${r}`.slice(0,128)}o(lt,"seededIdempotencyKey");function Ue(e){let r=e.observer??at,t=e.timers??st,n=e.rng??Math.random,i=e.sleep??((h,g)=>_t(h,t,g)),a=e.maxAttempts??Ae,s=e.unaryTimeoutMs??tt,l=e.newIdempotencyKey??ut(),u=o(h=>{try{r.onEvent(h);}catch{}},"emit");async function p(h,g,v){let k=v?.maxAttempts,w=Math.max(1,k??a),Nr=v?.idempotent??it.has(g.method),Mr=v?.idempotencyKey===void 0?null:lt(v.idempotencyKey),Q=Nr?Mr??l():null,Lr=dt(g,Q),X=0;for(;;){let I=o(ee=>Object.freeze({call:h,method:g.method,path:g.path,attempt:X,...Q?{idempotencyKey:Q}:{},...ee}),"stamp");u(I({phase:"attempt"}));let Te=ht(s,t),ke=Et(Te.signal,g.signal),A;try{A=await Ne({...Lr,signal:ke.signal},e.auth);}catch(ee){A=y(Me(ee));}finally{ke.dispose(),Te.cancel();}if(A.ok)return u(I({phase:"settled",ok:true,reason:"ok"})),A;let T=A.error,B=pt(T,X,{maxAttempts:w,rng:n,now:t.now(),aborted:g.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),Z={ok:false,code:T.code,reason:B.reason,...T.httpStatus!==void 0?{httpStatus:T.httpStatus}:{},...T.requestId!==void 0?{requestId:T.requestId}:{}};if(!B.retry)return u(I({phase:"settled",...Z})),y(T);if(u(I({phase:"retry",...Z,delayMs:B.delayMs})),await i(B.delayMs,g.signal),g.signal?.aborted===true)return u(I({phase:"settled",...Z,reason:"aborted"})),y(T);X+=1;}}o(p,"send");async function f(h){return D(h,await vt(e.auth))}o(f,"authorize");async function*R(h,g,v){u(Object.freeze({call:h,phase:"stream.open",method:g.method,path:g.path,attempt:0}));try{yield*e.auth.transport.stream(g,v);}catch{yield De({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(R,"stream"),Object.freeze({send:p,authorize:f,stream:R})}o(Ue,"createRequestFunnel");function dt(e,r){let t={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==ot&&(t[n]=i);return r!==null&&(t["Idempotency-Key"]=r),{...e,headers:t}}o(dt,"assembleHeaders");function ut(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(ut,"defaultIdempotencyKeyFactory");var ct=10;function pt(e,r,t){if(t.aborted)return {retry:false,reason:"aborted"};let n=ft(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!te(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{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 s=o(()=>{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(ct,Math.floor(p)))},"policyCeiling"),l=t.perCallMaxAttempts??s()??t.maxAttempts;if(r+1>=l)return {retry:false,reason:"attempts-exhausted"};let u=yt(e,t.now);return u!==null?u>nt?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:u}:{retry:true,reason:i,delayMs:ze(r,t.rng)}}o(pt,"decideRetry");function ft(e){let r=e.code==="unknown"?Pe(gt(e.raw)):e.code;return r==="quotaExceeded"?"quota":r==="rateLimited"||e.httpStatus===429?"burst":null}o(ft,"throttleKind");function yt(e,r){let t=mt(e.raw);if(t===null)return null;let n=t-r;return n>0?n:0}o(yt,"retryOverrideMs");function mt(e){for(let r of Be(e)){let t=r.resets_at,n=bt(t);if(n!==null)return n}return null}o(mt,"findResetsAt");function Be(e){if(!Le(e))return [];let r=[e];for(let t of ["error","detail"]){let n=e[t];Le(n)&&r.push(n);}return r}o(Be,"candidateScopes");function bt(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}o(bt,"parseInstantMs");function gt(e){for(let r of Be(e)){let t=r.code;if(typeof t=="string"&&t.length>0)return t}return null}o(gt,"rawWireCode");function Le(e){return typeof e=="object"&&e!==null}o(Le,"isRecord");async function vt(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}o(vt,"resolveDeviceAuth");function ht(e,r){let t=new AbortController,n=r.setTimeout(()=>t.abort(),e);return {signal:t.signal,cancel:o(()=>r.clearTimeout(n),"cancel")}}o(ht,"boundedSignal");function Et(e,r){let t=o(()=>{},"noop");if(!r)return {signal:e,dispose:t};let n=new AbortController;if(e.aborted||r.aborted)return n.abort(),{signal:n.signal,dispose:t};let i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),r.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),r.removeEventListener("abort",i);},"dispose")}}o(Et,"mergeSignals");function _t(e,r,t){return e<=0||t?.aborted===true?Promise.resolve():new Promise(n=>{let i=r.setTimeout(()=>{t?.removeEventListener("abort",a),n();},e),a=o(()=>{r.clearTimeout(i),n();},"onAbort");t?.addEventListener("abort",a,{once:true});})}o(_t,"delayAbortable");var Ve=Object.freeze({track(){},trackExpectedFailure(){}});function qe(e){let r={uri:e.uri,mimeType:e.mimeType},t=G(e);return t!==null&&(r.sizeBytes=t),Object.freeze(r)}o(qe,"fileHandleFromMedia");function G(e){let r=e.byteSize??e.sizeBytes;return typeof r=="number"&&Number.isFinite(r)&&r>=0?r:null}o(G,"mediaByteSize");function He(e){let r=e.durationSeconds;return typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.round(r*1e3):null}o(He,"mediaDurationMs");function Ke(e,r){return Object.freeze(r===void 0?{mode:e}:{mode:e,maxDurationSeconds:r})}o(Ke,"captureOptionsFor");function ae(e){return e!=null&&e.isAvailable===true}o(ae,"isCaptureAvailable");var Ge=Object.freeze({setTimeout:o((e,r)=>setTimeout(e,r),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function Ye(e,r,t){return new Promise(n=>{if(r.aborted){n();return}let i={handle:void 0},a=o(()=>{t.clearTimeout(i.handle),r.removeEventListener("abort",a),n();},"done");i.handle=t.setTimeout(a,e),r.addEventListener("abort",a,{once:true});})}o(Ye,"delayAbortable");function Rt(e,r){if(!r)return e;let t=new AbortController;if(e.aborted||r.aborted)return t.abort(),t.signal;let n=o(()=>t.abort(),"onAbort");return e.addEventListener("abort",n,{once:true}),r.addEventListener("abort",n,{once:true}),t.signal}o(Rt,"mergeSignals");var se=class se{constructor(r){this.listeners=new Set;this.epoch=0;this.inFlight=null;this.snapshot=Object.freeze({...r});}subscribe(r){return this.listeners.add(r),()=>{this.listeners.delete(r);}}getSnapshot(){return this.snapshot}patch(r){this.snapshot=Object.freeze({...this.snapshot,...r});for(let t of this.listeners)t();}beginOperation(r){this.inFlight?.abort();let t=new AbortController;this.inFlight=t;let n=this.epoch;return {signal:r?Rt(t.signal,r):t.signal,epoch:n,settle:o(()=>{this.inFlight===t&&(this.inFlight=null);},"settle")}}alive(r){return r===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null;}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear();}};o(se,"MediaStore");var K=se;function We(e){for(let r=0;r<e.length;r+=1){let t=e.charCodeAt(r);if(t>=55296&&t<=56319){let n=e.charCodeAt(r+1);if(!(n>=56320&&n<=57343))return true;r+=1;}else if(t>=56320&&t<=57343)return true}return false}o(We,"hasLoneSurrogate");var St=Object.freeze(["primary_label","primary_confidence","subtype_label","subtype_display","subtype_confidence","risk_tier","confidence_tier","copy_short","disease_name","disease_framing","model_version","skin_v2","eye_v2","llm_checkup"]),Ct=Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),Tt=new Set(["skin_v2","eye_v2","llm_checkup"]),kt=new Set(["primary_confidence","subtype_confidence"]),xt=new Set(["low_risk","concern","uncertain"]),wt=new Set(["possible","probable"]),Ft=Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function Je(e){let r=c(e)?e:{},t={};for(let i of St){if(!(i in r))continue;let a=r[i],s=Ot(i,a);s!==F&&(t[i]=s);}let n=0;for(let i of Ct)i in r&&(n+=1);return Object.freeze({metadata:Object.freeze(t),droppedOperatorKeys:n})}o(Je,"projectDetectionMetadata");var F=Symbol("drop");function Ot(e,r){if(Tt.has(e))return typeof r=="boolean"?r:F;if(kt.has(e))return $e(r)?r:F;if(e==="risk_tier")return typeof r=="string"&&xt.has(r)?r:F;if(e==="confidence_tier")return typeof r=="string"&&wt.has(r)?r:F;if(typeof r!="string")return F;let t=Ft[e]??256;return r.length>t?r.slice(0,t):r}o(Ot,"acceptKey");function $e(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}o($e,"isUnitConfidence");function Qe(e){if(!c(e))return null;let r=b(e.summary),t=b(e.disclaimer),n=le(e.recommendations??e.recommendation);return r===null&&t===null&&n.length===0?null:Object.freeze({summary:r??"",recommendations:Object.freeze(n),disclaimer:t??""})}o(Qe,"parseInterpretation");function Xe(e){if(!c(e))return {};if(c(e.metadata))return e.metadata;let r=e.detections;if(Array.isArray(r)&&r.length>0){let t=r[0];if(c(t)&&c(t.metadata))return t.metadata;if(c(t))return t}return e}o(Xe,"locateDetectionMetadata");function Ze(e){return c(e)?c(e.interpretation)?e.interpretation:e:null}o(Ze,"locateInterpretation");function c(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(c,"isRecord");function b(e){return typeof e=="string"&&e.length>0?e:null}o(b,"asString");function le(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.length>0):[]}o(le,"asStringList");function er(e){return $e(e)?e:null}o(er,"asUnitNumber");function O(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(O,"asFiniteNumber");var Y=Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:o(e=>We(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`,"job")});async function tr(e,r){let t={purpose:r.purpose,content_type:r.contentType};r.byteSize!==null&&(t.byte_size=r.byteSize);let n={method:"POST",path:Y.initiate,body:t,...r.signal?{signal:r.signal}:{}},i=await e.send("media.initiateUpload",n);if(!i.ok)return y(i.error);let a=Pt(i.value);return a===null?y(m("mediaUploadFailed",{retryable:false})):j(a)}o(tr,"initiateUpload");function Pt(e){if(!c(e))return null;let r=b(e.url),t=b(e.s3_key);if(r===null||t===null)return null;let n=e.fields,i={};if(c(n))for(let[a,s]of Object.entries(n))typeof s=="string"&&(i[a]=s);return Object.freeze({url:r,fields:Object.freeze(i),s3Key:t,expiresAt:O(e.expires_at)})}o(Pt,"parsePresigned");async function nr(e,r,t,n,i){try{return await e.presignedPut(qe(r),{target:t,idempotencyKey:n,...i?{signal:i}:{}}),j(void 0)}catch{return y(m("mediaUploadFailed",{retryable:false}))}}o(nr,"stageUpload");async function or(e,r,t,n,i){let a={method:"POST",path:r,body:t,...i?{signal:i}:{}},s=await e.send("media.analyze",a);if(s.ok){let u=It(s.value);return u!==null?{kind:"async",job:u}:{kind:"sync",body:s.value}}let l=n(s.error.httpStatus,s.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:s.error}}o(or,"submitAnalyze");function It(e){if(!c(e))return null;let r=b(e.job_id);if(r===null)return null;let t=b(e.status);return t!==null&&Dt(t)?null:Object.freeze({jobId:r,estimatedSeconds:O(e.estimated_completion_seconds)})}o(It,"parseAsyncJob");var At=2e3,rr=5e3,zt=9e4;async function ir(e,r,t){let{timers:n,signal:i,alive:a}=t,s=n.now(),l=Math.max(zt,(t.estimatedSeconds??0)*1e3),u=At;for(;;){if(i.aborted||!a())return {kind:"aborted"};if(await Ye(u,i,n),i.aborted||!a())return {kind:"aborted"};if(n.now()-s>l)return {kind:"timeout"};let p=Y.job(r);if(p===null)return {kind:"notFound"};let f=await e.send("media.pollJob",{method:"GET",path:p,...i?{signal:i}:{}},{maxAttempts:1});if(i.aborted||!a())return {kind:"aborted"};if(!f.ok){if(f.error.httpStatus===404)return {kind:"notFound"};u=Math.min(rr,u+1e3);continue}let R=jt(f.value);if(R==="COMPLETED")return {kind:"complete",body:f.value};if(R==="FAILED")return {kind:"failed",error:Nt(f.value)};u=Math.min(rr,u+1e3);}}o(ir,"pollJob");function jt(e){return c(e)?(b(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}o(jt,"jobStatusOf");function Dt(e){let r=e.toUpperCase();return r==="COMPLETED"||r==="FAILED"}o(Dt,"isTerminalStatus");function Nt(e){let r=c(e)?b(e.error)??b(e.error_code):null;return m("internalError",{retryable:false,...r?{wireMessage:r}:{}})}o(Nt,"jobFailureError");function ar(){return null}o(ar,"detectNoGate");function sr(e,r){let t={s3_key:e};return r.type!==void 0&&(t.type=r.type),r.petRef!=null&&(t.pet_id=r.petRef),r.precheckToken!=null&&(t.precheck_token=r.precheckToken),t}o(sr,"analyzeBody");function lr(e){return new de(e)}o(lr,"createVideoController");var ue=class ue extends K{constructor(r){super({status:"idle",job:null,result:null,error:null,isCaptureAvailable:ae(r.camera),progress:0}),this.funnel=r.funnel??Ue({auth:r.auth,...r.errorPolicy?{errorPolicy:r.errorPolicy}:{}}),this.camera=r.camera,this.upload=r.upload,this.defaultPetRef=r.petRef??null,this.telemetry=r.telemetry??Ve,this.timers=r.timers??Ge,this.makeIdempotencyKey=r.makeIdempotencyKey??Vt();}async capture(r){if(!ae(this.camera))return y(m("unknown",{retryable:false}));let t;try{t=await this.camera.capture(Ke("video",15));}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle",progress:0}),y(m("unknown",{retryable:false}))}return this.submit(t,r?.petRef!==void 0?{petRef:r.petRef}:void 0)}async submit(r,t){let n=this.beginOperation(t?.signal),i=t?.petRef??this.defaultPetRef,a=this.makeIdempotencyKey(),s=this.timers.now();this.patch({status:"uploading",progress:0,error:null,result:null,job:null});try{let l=await tr(this.funnel,{purpose:"gait_video",contentType:r.mimeType,byteSize:G(r),signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return x();if(!l.ok)return this.fail(n,l.error);let u=await nr(this.upload,r,l.value,a,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return x();if(!u.ok)return this.telemetry.track("analysis.upload",{capability:"video",purpose:"gait_video",outcome:"failed"}),this.fail(n,u.error);this.patch({progress:1}),this.telemetry.track("analysis.upload",{capability:"video",purpose:"gait_video",byteSize:G(r)??0,durationMs:He(r)??0,outcome:"ok"}),this.patch({status:"analyzing"});let p=await or(this.funnel,Y.videoAnalyze,sr(l.value.s3Key,{petRef:i}),ar,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return x();if(p.kind==="error")return this.fail(n,p.error);if(p.kind==="gate")return this.fail(n,m("unknown",{retryable:!1}));if(p.kind==="sync"){let h=Bt(p.body)??"";return this.complete(n,p.body,h,s)}let f=p.job;this.patch({job:{id:f.jobId,state:"processing"}});let R=await ir(this.funnel,f.jobId,{timers:this.timers,signal:n.signal,alive:o(()=>this.alive(n.epoch),"alive"),estimatedSeconds:f.estimatedSeconds});if(n.signal.aborted||!this.alive(n.epoch))return x();switch(R.kind){case "aborted":return x();case "complete":return this.complete(n,R.body,f.jobId,s);case "failed":return this.fail(n,R.error);case "timeout":return this.fail(n,m("streamTimeout",{retryable:!0}));case "notFound":return this.patch({job:null}),this.fail(n,m("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(n,m("internalError",{retryable:!1}))}}finally{n.settle();}}cancel(){this.inFlight?.abort(),this.inFlight=null,(this.snapshot.status==="uploading"||this.snapshot.status==="analyzing")&&this.patch({status:"idle",progress:0});}complete(r,t,n,i){if(!this.alive(r.epoch))return x();let a=Mt(t,n);return a.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:a.droppedOperatorKeys}),this.telemetry.track("analysis.quality_gate",{usable:a.result.quality.usable,reasons:a.result.quality.reasons}),this.patch({status:"complete",progress:1,result:a.result,error:null,job:{id:n,state:"complete"}}),this.telemetry.track("analysis.result",{capability:"video",modelVersion:a.result.modelVersion??"",timeToResultMs:this.timers.now()-i}),j(n)}fail(r,t){return this.alive(r.epoch)?(this.patch({status:"error",error:t,progress:0}),this.telemetry.trackExpectedFailure("analysis.error",{code:t.code,...t.httpStatus!==void 0?{httpStatus:t.httpStatus}:{}}),y(t)):x()}};o(ue,"VideoController");var de=ue;function Mt(e,r){let t=Je(Xe(e)),n=Qe(Ze(e)),i=b(t.metadata.model_version)??(c(e)?b(e.model_version):null);return {result:Object.freeze({jobId:r,analysisType:"gait",detections:Lt(e),interpretation:n,modelVersion:i,quality:Ut(e)}),droppedOperatorKeys:t.droppedOperatorKeys}}o(Mt,"mapVideoResult");function Lt(e){let r=c(e)?e.detections:null;if(!Array.isArray(r))return Object.freeze([]);let t=[];for(let n of r){if(!c(n))continue;let i=b(n.label)??b(n.name);i!==null&&t.push(Object.freeze({label:i,confidence:er(n.confidence)??0,timestampMs:O(n.timestamp_ms??n.timestamp),durationMs:O(n.duration_ms??n.duration)}));}return Object.freeze(t)}o(Lt,"parseVideoDetections");function Ut(e){let r=c(e)?e.quality:null;if(!c(r))return Object.freeze({usable:true,reasons:Object.freeze([])});let t=r.usable;return Object.freeze({usable:typeof t=="boolean"?t:true,reasons:Object.freeze(le(r.reasons))})}o(Ut,"parseQuality");function Bt(e){return c(e)?b(e.result_id)??b(e.request_id)??b(e.job_id):null}o(Bt,"resultIdOf");function x(){return y(m("unknown",{retryable:false}))}o(x,"abortedResult");function Vt(){let e=0;return ()=>`video-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}o(Vt,"defaultIdempotencyFactory");var dr=Symbol.for("@everfur/sdk#EverfurContext@v1"),ur=globalThis,cr=ur[dr]??(ur[dr]=react.createContext(null));cr.displayName??="EverfurContext";function W(){let e=react.useContext(cr);if(e===null)throw new z("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(W,"useEverfurContext");var Jt=Object.freeze({status:"idle",job:null,result:null,error:null,isCaptureAvailable:false,progress:0}),$t=o(()=>{},"NOOP_UNSUBSCRIBE");function ce(e){let{runtime:r,userRef:t,activePet:n,scopeEpoch:i}=W(),a=e?.petRef??n??null,[s,l]=react.useState(null);react.useEffect(()=>{let{services:v}=r.registry,k=r.registry.acquire("video",`${t??""}|${a??""}`,()=>lr({...v.errorPolicy?{errorPolicy:v.errorPolicy}:{},auth:v.authFor(t),camera:v.camera,upload:v.upload,petRef:a,telemetry:v.telemetry}),w=>w.dispose());return l(k),()=>{l(w=>w===k?null:w),r.registry.release(k);}},[r,t,a,i]);let u=react.useCallback(v=>s?s.subscribe(v):$t,[s]),p=react.useCallback(()=>s?s.getSnapshot():Jt,[s]),f=react.useSyncExternalStore(u,p,p),R=react.useCallback(v=>s?s.submit(v):Promise.resolve(pr()),[s]),h=react.useCallback(()=>s?s.capture():Promise.resolve(pr()),[s]),g=react.useCallback(()=>{s?.cancel();},[s]);return react.useMemo(()=>({status:f.status,job:f.job,result:f.result,error:f.error,isCaptureAvailable:f.isCaptureAvailable,progress:f.progress,isBootstrapping:s===null,submit:R,capture:h,cancel:g}),[f,s,R,h,g])}o(ce,"useEverfurVideo");function pr(){return y(m("internalError",{retryable:true}))}o(pr,"notReadyError");function ye(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let r of Object.keys(e))ye(e[r]);}return e}o(ye,"deepFreeze");var Qt=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),yr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},mr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},fr={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Xt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Zt={regular:"400",medium:"500",bold:"700"},en={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},rn=0,J="System",$="monospace",tn=["content","heading","control","compact","badge"];function nn(e){let r={};for(let t of tn)r[t]=e;return r}o(nn,"authoredTierSizes");function br(){return {family:J,mono:$,fontUrl:null,families:{regular:J,medium:J,bold:J,mono:$,monoMedium:$,monoBold:$},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:fr,tierSizes:nn(fr),lineHeight:Xt,weight:Zt,letterSpacing:en,scale:1,maxScale:rn,scaleCaps:Qt}}o(br,"baseType");var gr={},pe=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function fe(e){return `cubic-bezier(${e.join(", ")})`}o(fe,"cssCubicBezier");var vr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:fe(pe.standard),emphasized:fe(pe.emphasized),exit:fe(pe.exit)},reducedMotion:false},on={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)"},hr=ye({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:on,space:yr,radius:mr,type:br(),motion:vr,slots:gr}),an={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)"};ye({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:an,space:yr,radius:mr,type:br(),motion:vr,slots:gr});var Er=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),_r=globalThis,me=_r[Er]??(_r[Er]=react.createContext(hr));me.displayName??="EverfurThemeContext";function S(){return react.useContext(me)}o(S,"useEverfurTheme");function pn(e,r){let t=e.scaleCaps[r];return t>0?t:void 0}o(pn,"tierMultiplier");function E({tier:e="content",...r}){let{type:t}=S(),n=pn(t,e);return react.createElement(reactNative.Text,n===void 0?r:{maxFontSizeMultiplier:n,...r})}o(E,"Text");react.forwardRef(o(function(r,t){return react.createElement(reactNative.TextInput,{...r,...t===null?{}:{ref:t}})},"TextInput"));var fn=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function M(e,r){let t=e.type,n=t.families[r];return r==="mono"||t.namedFaces[r]?{fontFamily:n}:{fontFamily:n,fontWeight:t.weight[fn[r]]}}o(M,"face");var ve=class ve extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(t,n){return Object.is(t.resetKey,n.key)?null:{failed:false,key:t.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};o(ve,"HostRenderBoundary");var be=ve;function mn({render:e}){return e()}o(mn,"RenderHost");function ge({render:e,fallback:r,resetKey:t}){return react.createElement(be,{fallback:r,resetKey:t,children:react.createElement(mn,{render:e})})}o(ge,"HostRender");var bn=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 gn(e){return bn[e]}o(gn,"requires");function Cr(e,r,t){let n=gn(e),i=new Map;for(let l of r)i.set(l.resource,l);if(t?.isPending===true&&n.some(l=>!i.has(l)))return he({name:e,enabled:false,isPending:true,limits:{}});let a=vn(n,i);return n.filter(l=>i.get(l)?.granted!==true).length===0?he({name:e,enabled:true,isPending:false,limits:a}):he({name:e,enabled:false,isPending:false,limits:a,disabled:hn(n,i)})}o(Cr,"decideCapability");function vn(e,r){let t={};for(let n of e){let i=r.get(n)?.limits;if(i)for(let[a,s]of Object.entries(i)){let l=t[a];t[a]=l===void 0?s:Math.min(l,s);}}return t}o(vn,"mergeLimits");function hn(e,r){for(let t of e){let n=r.get(t)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:oe("accessDenied"),level:"user_entitlement",recoverable:false})}o(hn,"disabledFor");function he(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)}o(he,"freezeDecision");function Ee(e){let{runtime:r}=W(),t=r.entitlements,n=react.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);return react.useMemo(()=>Cr(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ee,"useCapability");var Rn=48;function Sn(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(Sn,"selectView");function wr(e){let{capability:r,children:t,renderDisabled:n,renderPending:i,style:a}=e,s=Ee(r),l=react.useMemo(()=>Sn(s),[s]);switch(l){case "enabled":return t;case "pending":return i?jsxRuntime.jsx(ge,{render:i,fallback:jsxRuntime.jsx(kr,{capability:r,style:a})}):jsxRuntime.jsx(kr,{capability:r,style:a});case "disabled":return n?jsxRuntime.jsx(ge,{render:()=>n(s),fallback:jsxRuntime.jsx(xr,{decision:s,style:a}),resetKey:s}):jsxRuntime.jsx(xr,{decision:s,style:a});default:return H(l)}}o(wr,"CapabilityGate");function kr({capability:e,style:r}){let t=S(),n=react.useMemo(()=>Fr(t),[t]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,r],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}o(kr,"PendingSkeleton");function xr({decision:e,style:r}){let t=S(),n=react.useMemo(()=>Fr(t),[t]),i=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,r],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?jsxRuntime.jsx(E,{style:n.offstateText,children:i}):null})}o(xr,"OffState");function Fr(e){let{color:r,space:t,radius:n,type:i}=e;return reactNative.StyleSheet.create({offstate:{minHeight:Rn,justifyContent:"center",paddingHorizontal:t.lg,paddingVertical:t.md,backgroundColor:r.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.brandBorder},offstateText:{...M(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:r.text.muted},skeletonBar:{height:t.md,borderRadius:n.xs,backgroundColor:r.brandSofter}})}o(Fr,"makeStyles");var L=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Ir(e){let r=S(),t=react.useMemo(()=>kn(r),[r]);return jsxRuntime.jsxs(reactNative.View,{style:[t.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${L.title}. ${L.body}`,children:[jsxRuntime.jsx(E,{style:t.title,children:L.title}),jsxRuntime.jsx(E,{style:t.body,children:L.body})]})}o(Ir,"ClinicalDisclaimer");function kn(e){let{color:r,space:t,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:t.lg,paddingVertical:t.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:r.borderHairlineGreen,backgroundColor:r.surfaceCream,gap:t.xs},title:{...M(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:r.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...M(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:r.text.muted}})}o(kn,"makeStyles");var In=300,Ce=120,Ar=44,zr=40,An=160;function zn(e){let{petRef:r,style:t}=e;return jsxRuntime.jsx(wr,{capability:"video",style:t,children:jsxRuntime.jsx(Dn,{petRef:r,style:t})})}o(zn,"EverfurVideo");function jn(e){return e.isBootstrapping||e.status==="uploading"||e.status==="analyzing"?"loading":e.status==="error"&&e.error?"error":e.status==="complete"&&e.result?"populated":e.isCaptureAvailable?"empty":"native"}o(jn,"selectView");function Dn({petRef:e,style:r}){let t=react.useMemo(()=>e!==void 0?{petRef:e}:void 0,[e]),n=ce(t),i=jn(n),{styles:a}=P();return jsxRuntime.jsxs(reactNative.View,{style:[a.container,r],children:[jsxRuntime.jsx(reactNative.View,{style:a.body,children:Nn(i,n)}),jsxRuntime.jsx(Ir,{})]})}o(Dn,"VideoBody");function Nn(e,r){switch(e){case "loading":return jsxRuntime.jsx(Mn,{progress:r.progress});case "native":return jsxRuntime.jsx(Ln,{});case "empty":return jsxRuntime.jsx(Un,{onCapture:r.capture});case "error":return jsxRuntime.jsx(Bn,{error:r.error,onRetry:r.capture});case "populated":return jsxRuntime.jsx(Vn,{result:r.result});default:return H(e)}}o(Nn,"renderView");function Mn({progress:e}){let{theme:r,styles:t}=P(),[n,i]=react.useState(false);react.useEffect(()=>{let s=setTimeout(()=>i(true),In);return ()=>clearTimeout(s)},[]);let a=Math.max(0,Math.min(1,e));return jsxRuntime.jsxs(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing video",children:[n?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:r.color.brand}):null,n&&a>0&&a<1?jsxRuntime.jsx(reactNative.View,{style:t.progressTrack,accessibilityRole:"progressbar",children:jsxRuntime.jsx(reactNative.View,{style:[t.progressFill,{width:`${Math.round(a*100)}%`}]})}):null]})}o(Mn,"LoadingState");function Ln(){let{styles:e}=P();return jsxRuntime.jsx(reactNative.View,{style:e.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:jsxRuntime.jsx(reactNative.View,{style:e.emptyGlyph})})}o(Ln,"NativeUnavailableState");function Un({onCapture:e}){let{styles:r}=P();return jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Record a short clip to check gait",children:jsxRuntime.jsx(reactNative.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Record video",style:r.primaryButton,children:jsxRuntime.jsx(E,{style:r.primaryLabel,children:"Record video"})})})}o(Un,"EmptyState");function Bn({error:e,onRetry:r}){let{styles:t}=P();return jsxRuntime.jsxs(reactNative.View,{style:t.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(E,{style:t.errorText,children:e.displayMessage}),e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:r,accessibilityRole:"button",accessibilityLabel:"Try again",style:t.primaryButton,children:jsxRuntime.jsx(E,{style:t.primaryLabel,children:"Try again"})}):null]})}o(Bn,"ErrorState");function Vn({result:e}){let{styles:r}=P();return e.quality.usable?jsxRuntime.jsxs(reactNative.ScrollView,{style:r.list,contentContainerStyle:r.listContent,accessibilityLabel:"Gait analysis result",children:[e.detections.map((t,n)=>jsxRuntime.jsx(reactNative.View,{style:r.resultRow,children:jsxRuntime.jsx(E,{style:r.resultLabel,children:t.label})},`${t.label}-${n}`)),e.interpretation?jsxRuntime.jsxs(reactNative.View,{style:r.interpretationBlock,children:[jsxRuntime.jsx(E,{style:r.summaryText,children:e.interpretation.summary}),jsxRuntime.jsx(E,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]}):jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Result uncertain",children:jsxRuntime.jsx(E,{style:r.uncertainText,children:"We could not get a clear read from this clip. Try recording again."})})}o(Vn,"ResultState");function P(){let e=S();return react.useMemo(()=>({theme:e,styles:qn(e)}),[e])}o(P,"useVideoStyles");function qn(e){let{color:r,space:t,radius:n,type:i}=e,a=i.weight.bold,s=i.weight.medium;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Ce,backgroundColor:r.background},body:{flex:1},centered:{minHeight:Ce,flexGrow:1,alignItems:"center",justifyContent:"center",padding:t.xl},offstate:{minHeight:Ce,alignItems:"center",justifyContent:"center",padding:t.xl},emptyGlyph:{width:zr,height:zr,borderRadius:n.pill,backgroundColor:r.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.borderHairlineGreen},primaryButton:{minHeight:Ar,minWidth:Ar,alignItems:"center",justifyContent:"center",paddingHorizontal:t.xl,paddingVertical:t.md,borderRadius:n.pill,backgroundColor:r.primary,shadowColor:r.brandSofter,shadowOffset:{width:0,height:t.xs},shadowOpacity:1,shadowRadius:t.sm,elevation:t.xs},primaryLabel:{color:r.onPrimary,fontFamily:i.family,fontSize:i.size.body,fontWeight:a,letterSpacing:i.letterSpacing.tight},errorText:{color:r.danger,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal,fontWeight:s,textAlign:"center",marginBottom:t.md},uncertainText:{color:r.text.muted,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal,textAlign:"center"},progressTrack:{marginTop:t.lg,height:t.sm,width:An,borderRadius:n.pill,backgroundColor:r.skeleton,overflow:"hidden"},progressFill:{height:t.sm,borderRadius:n.pill,backgroundColor:r.brand},list:{flex:1},listContent:{padding:t.lg,gap:t.md},resultRow:{paddingVertical:t.sm,paddingHorizontal:t.md,borderRadius:n.sm,backgroundColor:r.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:r.brandBorder},resultLabel:{color:r.text.primary,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.normal,fontWeight:s},interpretationBlock:{marginTop:t.sm,gap:t.sm},summaryText:{color:r.text.primary,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.normal},disclaimerText:{color:r.text.muted,fontFamily:i.family,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.relaxed}})}o(qn,"makeStyles");exports.EverfurVideo=zn;exports.useEverfurVideo=ce;
@@ -1,5 +1,6 @@
1
- import { E as EverfurError, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.cjs';
2
- export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurResult-DN9pL2Ab.cjs';
1
+ import { E as EverfurError } from '../EverfurError-DmELDpXp.cjs';
2
+ export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-DmELDpXp.cjs';
3
+ import { E as EverfurResult } from '../EverfurResult-ZtH-YV1h.cjs';
3
4
  import { J as JobId, P as PetRef } from '../ids-B2GAAifq.cjs';
4
5
  export { B as Brand, _ as __brand } from '../ids-B2GAAifq.cjs';
5
6
  import { M as MediaSource } from '../CameraPort-Cv31Pz7g.cjs';
@@ -1,5 +1,6 @@
1
- import { E as EverfurError, c as EverfurResult } from '../EverfurResult-DN9pL2Ab.js';
2
- export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurResult-DN9pL2Ab.js';
1
+ import { E as EverfurError } from '../EverfurError-DmELDpXp.js';
2
+ export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-DmELDpXp.js';
3
+ import { E as EverfurResult } from '../EverfurResult-SGvHKsCB.js';
3
4
  import { J as JobId, P as PetRef } from '../ids-B2GAAifq.js';
4
5
  export { B as Brand, _ as __brand } from '../ids-B2GAAifq.js';
5
6
  import { M as MediaSource } from '../CameraPort-Cv31Pz7g.js';