@everfur/sdk 0.18.3 → 0.20.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 (221) hide show
  1. package/CHANGELOG.md +141 -0
  2. package/dist/{Chat.d-CKKuXVw5.d.ts → Chat.d-D61LLPJh.d.ts} +1 -1
  3. package/dist/{Chat.d-BEbRI8FZ.d.cts → Chat.d-IpxKa9gS.d.cts} +1 -1
  4. package/dist/{DepthViews.d-CiU4f98J.d.ts → DepthViews.d-C8EsR8Gq.d.ts} +1 -1
  5. package/dist/{DepthViews.d-BiePRa3Z.d.cts → DepthViews.d-CDIL4mPa.d.cts} +1 -1
  6. package/dist/{DepthViews.d-Chn2xwZu.d.cts → DepthViews.d-Q1nqdH8n.d.cts} +1 -1
  7. package/dist/{DepthViews.d-_WMIpymE.d.ts → DepthViews.d-w2o4Nf7r.d.ts} +1 -1
  8. package/dist/{RecordsPage.d-CtNzoxre.d.cts → RecordsPage.d-BSjZOHu8.d.cts} +11 -5
  9. package/dist/{RecordsPage.d-CRRJM35Q.d.ts → RecordsPage.d-DqhM_rCr.d.ts} +11 -5
  10. package/dist/animations/index.cjs +1 -94
  11. package/dist/animations/index.d.cts +3 -3
  12. package/dist/animations/index.d.ts +3 -3
  13. package/dist/animations/index.js +1 -94
  14. package/dist/{attachments.d-BLEOCUU7.d.cts → attachments.d-BviU_Tja.d.cts} +2 -2
  15. package/dist/{attachments.d-DRkqNR-o.d.ts → attachments.d-DZVfHHnY.d.ts} +2 -2
  16. package/dist/{bookingCopy.d-CrUufdoE.d.ts → bookingCopy.d-5V3erfXD.d.ts} +2 -2
  17. package/dist/{bookingCopy.d-CoiNXrY8.d.cts → bookingCopy.d-DlzUPsFE.d.cts} +2 -2
  18. package/dist/{casesRepository.d-OyZOSNNv.d.cts → casesRepository.d-7Us2O-z8.d.cts} +1 -1
  19. package/dist/{casesRepository.d-DhI69yuj.d.ts → casesRepository.d-Dqg-KbpA.d.ts} +1 -1
  20. package/dist/chat/index.cjs +29 -119
  21. package/dist/chat/index.d.cts +11 -10
  22. package/dist/chat/index.d.ts +11 -10
  23. package/dist/chat/index.js +30 -120
  24. package/dist/chat/lite/index.cjs +29 -119
  25. package/dist/chat/lite/index.d.cts +11 -10
  26. package/dist/chat/lite/index.d.ts +11 -10
  27. package/dist/chat/lite/index.js +30 -120
  28. package/dist/{attachments.d-CeXw6R7_.d.cts → chatHandoffToken.d-B9pjkEfl.d.cts} +33 -9
  29. package/dist/{attachments.d-d1rWAw9K.d.ts → chatHandoffToken.d-TYcD8NIi.d.ts} +33 -9
  30. package/dist/{ports.d-CIfa_XF6.d.ts → chatTypes.d-DPALEQoW.d.ts} +41 -52
  31. package/dist/{ports.d--OjPUqPb.d.cts → chatTypes.d-RnQ5R4zP.d.cts} +41 -52
  32. package/dist/client/index.cjs +2 -95
  33. package/dist/client/index.d.cts +7 -7
  34. package/dist/client/index.d.ts +7 -7
  35. package/dist/client/index.js +2 -95
  36. package/dist/{clinicBatch.d-DVahpaN3.d.cts → clinicBatch.d-C6MzLj3X.d.cts} +3 -3
  37. package/dist/{clinicBatch.d-CcqnQ7-d.d.ts → clinicBatch.d-t9hkown2.d.ts} +3 -3
  38. package/dist/{clinicRequestProps.d-CjsMg_OD.d.ts → clinicRequestProps.d-BuMuGoVZ.d.ts} +1 -1
  39. package/dist/{clinicRequestProps.d-1dCtouGA.d.cts → clinicRequestProps.d-DjzUdDFx.d.cts} +1 -1
  40. package/dist/{config.d-KX-EkQ9j.d.ts → config.d-BnZkxI5a.d.ts} +1 -1
  41. package/dist/{config.d-Z_fyOZke.d.cts → config.d-DoC-XaJ0.d.cts} +1 -1
  42. package/dist/consent/index.cjs +2 -95
  43. package/dist/consent/index.d.cts +5 -5
  44. package/dist/consent/index.d.ts +5 -5
  45. package/dist/consent/index.js +2 -95
  46. package/dist/{context.d-DV5E_2Fs.d.cts → context.d-BAh7C7T4.d.cts} +7 -6
  47. package/dist/{context.d-DY6d4qXG.d.ts → context.d-z2zIjKEb.d.ts} +7 -6
  48. package/dist/{copy.d-CMY9OoCC.d.cts → copy.d-BkX6G-Ws.d.cts} +2 -2
  49. package/dist/{copy.d-BPzpKGGc.d.ts → copy.d-DLxgHsZZ.d.ts} +2 -2
  50. package/dist/core/index.cjs +6 -99
  51. package/dist/core/index.d.cts +15 -14
  52. package/dist/core/index.d.ts +15 -14
  53. package/dist/core/index.js +6 -99
  54. package/dist/{depth.d-qVYPByPb.d.cts → depth.d-aXddCjyh.d.cts} +3 -3
  55. package/dist/{depth.d-B_qNSgXr.d.ts → depth.d-z2FlzY3x.d.ts} +3 -3
  56. package/dist/{entitlementRepository.d-CwTVi7he.d.cts → entitlementRepository.d-CDCF8eFx.d.cts} +2 -2
  57. package/dist/{entitlementRepository.d-BXDWPyP8.d.ts → entitlementRepository.d-Cgmy4Opa.d.ts} +2 -2
  58. package/dist/{focus.d-BPofD7ow.d.ts → focus.d-C2fd_5MW.d.ts} +2 -2
  59. package/dist/{focus.d-DJD4lWFB.d.cts → focus.d-q_sXGhLn.d.cts} +2 -2
  60. package/dist/health-plan/index.cjs +1 -94
  61. package/dist/health-plan/index.d.cts +10 -10
  62. package/dist/health-plan/index.d.ts +10 -10
  63. package/dist/health-plan/index.js +1 -94
  64. package/dist/{idempotency.d-BmYuCb-n.d.cts → idempotency.d-Bqdyv_yn.d.cts} +1 -1
  65. package/dist/{idempotency.d-BVO0mU2R.d.ts → idempotency.d-DlAPAxD5.d.ts} +1 -1
  66. package/dist/{identity.d-CRVNfZzQ.d.ts → identity.d-BWZiaByn.d.ts} +1 -1
  67. package/dist/{identity.d-3ROlHbnP.d.cts → identity.d-CooKscNj.d.cts} +1 -1
  68. package/dist/index.cjs +30 -120
  69. package/dist/index.d.cts +14 -13
  70. package/dist/index.d.ts +14 -13
  71. package/dist/index.js +31 -121
  72. package/dist/{introEvents.d-DGQDEPJi.d.cts → introEvents.d-C8bDDiK6.d.cts} +1 -1
  73. package/dist/{introEvents.d-cvMxJfYd.d.ts → introEvents.d-baVM016i.d.ts} +1 -1
  74. package/dist/{models.d-BSqvbTE1.d.cts → models.d-BN53M9sU.d.cts} +52 -1
  75. package/dist/{models.d-DOwnr8fi.d.ts → models.d-Bhq9p6Wa.d.ts} +52 -1
  76. package/dist/notifications/inbox/index.cjs +44 -0
  77. package/dist/notifications/inbox/index.d.cts +50 -0
  78. package/dist/notifications/inbox/index.d.ts +50 -0
  79. package/dist/notifications/inbox/index.js +44 -0
  80. package/dist/notifications/index.cjs +18 -98
  81. package/dist/notifications/index.d.cts +12 -6
  82. package/dist/notifications/index.d.ts +12 -6
  83. package/dist/notifications/index.js +18 -98
  84. package/dist/{optInView.d-DIGu47Lz.d.ts → optInView.d-C04aX0Hs.d.ts} +2 -2
  85. package/dist/{optInView.d-CU1U_K-B.d.cts → optInView.d-D_D7fs6C.d.cts} +2 -2
  86. package/dist/parse.d-DYsx1Q2V.d.cts +168 -0
  87. package/dist/parse.d-Do0sdAgm.d.ts +168 -0
  88. package/dist/{pets.d-BRsbR8QU.d.ts → pets.d-CkFNO-x-.d.ts} +1 -1
  89. package/dist/{pets.d-5SMtOAwB.d.cts → pets.d-oJ2OIY22.d.cts} +1 -1
  90. package/dist/{petsRepository.d-DWsChqAS.d.ts → petsRepository.d-CKCi6rtp.d.ts} +1 -1
  91. package/dist/{petsRepository.d-DEnoZn92.d.cts → petsRepository.d-VWMyIeIJ.d.cts} +1 -1
  92. package/dist/photo/index.cjs +1 -94
  93. package/dist/photo/index.js +1 -94
  94. package/dist/records/depth/index.cjs +2 -95
  95. package/dist/records/depth/index.d.cts +11 -11
  96. package/dist/records/depth/index.d.ts +11 -11
  97. package/dist/records/depth/index.js +2 -95
  98. package/dist/records/index.cjs +17 -108
  99. package/dist/records/index.d.cts +47 -17
  100. package/dist/records/index.d.ts +47 -17
  101. package/dist/records/index.js +17 -108
  102. package/dist/{requestFunnel.d-CQX_Z1Hi.d.cts → requestFunnel.d-By0-I8Cp.d.cts} +2 -2
  103. package/dist/{requestFunnel.d-DSvCGf4J.d.ts → requestFunnel.d-DVCytzTE.d.ts} +2 -2
  104. package/dist/{parse.d-icynBIS-.d.ts → route.d-Ay-lRct1.d.ts} +90 -53
  105. package/dist/{parse.d-GzZJYu__.d.cts → route.d-DQDX6QFn.d.cts} +90 -53
  106. package/dist/{runtimeTypes.d-Be_vhOER.d.ts → runtimeTypes.d-C49Cgb9c.d.ts} +39 -5
  107. package/dist/{runtimeTypes.d-sXpNYnJp.d.cts → runtimeTypes.d-DUVNpR6g.d.cts} +39 -5
  108. package/dist/{screenProps.d-DpMK2_gi.d.ts → screenProps.d-B_arD3Lh.d.ts} +2 -2
  109. package/dist/{screenProps.d-BW6PZh5k.d.cts → screenProps.d-BgxlmfG5.d.cts} +2 -2
  110. package/dist/server/events/index.cjs +2 -95
  111. package/dist/server/events/index.d.cts +92 -5
  112. package/dist/server/events/index.d.ts +92 -5
  113. package/dist/server/events/index.js +2 -95
  114. package/dist/server/index.cjs +2 -95
  115. package/dist/server/index.d.cts +3 -3
  116. package/dist/server/index.d.ts +3 -3
  117. package/dist/server/index.js +2 -95
  118. package/dist/{sheetSeam.d-BBuEIVsa.d.cts → sheetSeam.d-B9iQqG_I.d.cts} +2 -2
  119. package/dist/{sheetSeam.d-B09jf4YC.d.ts → sheetSeam.d-CtuKILqp.d.ts} +2 -2
  120. package/dist/shop/index.d.cts +3 -3
  121. package/dist/shop/index.d.ts +3 -3
  122. package/dist/tabs/index.cjs +3 -96
  123. package/dist/tabs/index.d.cts +8 -8
  124. package/dist/tabs/index.d.ts +8 -8
  125. package/dist/tabs/index.js +3 -96
  126. package/dist/televet/booking/index.cjs +1 -94
  127. package/dist/televet/booking/index.d.cts +6 -6
  128. package/dist/televet/booking/index.d.ts +6 -6
  129. package/dist/televet/booking/index.js +1 -94
  130. package/dist/televet/index.cjs +1 -94
  131. package/dist/televet/index.js +1 -94
  132. package/dist/testing/index.cjs +1 -94
  133. package/dist/testing/index.d.cts +1 -1
  134. package/dist/testing/index.d.ts +1 -1
  135. package/dist/testing/index.js +1 -94
  136. package/dist/testing/rn/index.cjs +1 -94
  137. package/dist/testing/rn/index.d.cts +9 -8
  138. package/dist/testing/rn/index.d.ts +9 -8
  139. package/dist/testing/rn/index.js +1 -94
  140. package/dist/testing/web/index.cjs +1 -94
  141. package/dist/testing/web/index.d.cts +10 -9
  142. package/dist/testing/web/index.d.ts +10 -9
  143. package/dist/testing/web/index.js +1 -94
  144. package/dist/texting/index.cjs +1 -94
  145. package/dist/texting/index.d.cts +5 -5
  146. package/dist/texting/index.d.ts +5 -5
  147. package/dist/texting/index.js +1 -94
  148. package/dist/{threadOptions.d-DMOn3mmj.d.ts → threadOptions.d-Cbhjjb9_.d.ts} +2 -2
  149. package/dist/{threadOptions.d-Csmb-XgL.d.cts → threadOptions.d-pZXzsd2d.d.cts} +2 -2
  150. package/dist/{timelineRows.d-B0XZevKx.d.ts → timelineRows.d-BHxMeZzl.d.ts} +1 -1
  151. package/dist/{timelineRows.d-Kllr7Mcu.d.cts → timelineRows.d-DlMs82N1.d.cts} +1 -1
  152. package/dist/unreadStore.d-gCsleb6l.d.ts +74 -0
  153. package/dist/unreadStore.d-w5x6lEpR.d.cts +74 -0
  154. package/dist/{useHealthPlanSubscription.d-bNRntgWe.d.ts → useHealthPlanSubscription.d-BoC7H85G.d.ts} +2 -2
  155. package/dist/{useHealthPlanSubscription.d-C-c_mQ4u.d.cts → useHealthPlanSubscription.d-CZn06-lu.d.cts} +2 -2
  156. package/dist/useInboxUnread.d-DW0dpWdv.d.cts +206 -0
  157. package/dist/useInboxUnread.d-vYpOXVRv.d.ts +206 -0
  158. package/dist/{usePresentation.d-CmQgbrZr.d.ts → usePresentation.d-CgvwGb2A.d.ts} +2 -2
  159. package/dist/{usePresentation.d-BHKhBKQn.d.cts → usePresentation.d-CyCEJ6nj.d.cts} +2 -2
  160. package/dist/{useRecords.d-BYNX01El.d.cts → useRecords.d-BMSW4aRD.d.cts} +46 -3
  161. package/dist/{useRecords.d-DWk61a4c.d.ts → useRecords.d-Cv1nhZrv.d.ts} +46 -3
  162. package/dist/{useRecordsDepth.d-BilHZaR4.d.ts → useRecordsDepth.d-CbXhWbx7.d.ts} +1 -1
  163. package/dist/{useRecordsDepth.d-WW_2cWwU.d.cts → useRecordsDepth.d-CcbL98FD.d.cts} +1 -1
  164. package/dist/{appStateLifecycle.d-JuPhh7Oy.d.ts → useUnread.d-BsZKbLp9.d.ts} +49 -14
  165. package/dist/{appStateLifecycle.d-BQcy4J5O.d.cts → useUnread.d-CfF2Cx-q.d.cts} +49 -14
  166. package/dist/video/index.cjs +1 -94
  167. package/dist/video/index.js +1 -94
  168. package/dist/{view.d-BTnjZu2S.d.cts → view.d-CF3AP3T7.d.cts} +5 -5
  169. package/dist/{view.d-BtN_L_UF.d.ts → view.d-DdyOf0T0.d.ts} +5 -5
  170. package/dist/web/consent/index.cjs +2 -95
  171. package/dist/web/consent/index.d.cts +5 -5
  172. package/dist/web/consent/index.d.ts +5 -5
  173. package/dist/web/consent/index.js +2 -95
  174. package/dist/web/health-plan/index.cjs +1 -94
  175. package/dist/web/health-plan/index.d.cts +12 -12
  176. package/dist/web/health-plan/index.d.ts +12 -12
  177. package/dist/web/health-plan/index.js +1 -94
  178. package/dist/web/inbox/index.cjs +49 -0
  179. package/dist/web/inbox/index.d.cts +191 -0
  180. package/dist/web/inbox/index.d.ts +191 -0
  181. package/dist/web/inbox/index.js +49 -0
  182. package/dist/web/index.cjs +28 -118
  183. package/dist/web/index.d.cts +80 -40
  184. package/dist/web/index.d.ts +80 -40
  185. package/dist/web/index.js +28 -118
  186. package/dist/web/intro/index.cjs +3 -96
  187. package/dist/web/intro/index.d.cts +8 -8
  188. package/dist/web/intro/index.d.ts +8 -8
  189. package/dist/web/intro/index.js +3 -96
  190. package/dist/web/notifications/index.cjs +16 -96
  191. package/dist/web/notifications/index.d.cts +8 -3
  192. package/dist/web/notifications/index.d.ts +8 -3
  193. package/dist/web/notifications/index.js +16 -96
  194. package/dist/web/records/depth/index.cjs +2 -95
  195. package/dist/web/records/depth/index.d.cts +11 -11
  196. package/dist/web/records/depth/index.d.ts +11 -11
  197. package/dist/web/records/depth/index.js +2 -95
  198. package/dist/web/records/index.cjs +16 -107
  199. package/dist/web/records/index.d.cts +43 -19
  200. package/dist/web/records/index.d.ts +43 -19
  201. package/dist/web/records/index.js +16 -107
  202. package/dist/web/records-sheet/index.cjs +2 -95
  203. package/dist/web/records-sheet/index.d.cts +4 -4
  204. package/dist/web/records-sheet/index.d.ts +4 -4
  205. package/dist/web/records-sheet/index.js +2 -95
  206. package/dist/web/shop/index.d.cts +3 -3
  207. package/dist/web/shop/index.d.ts +3 -3
  208. package/dist/web/televet/booking/index.cjs +1 -94
  209. package/dist/web/televet/booking/index.d.cts +6 -6
  210. package/dist/web/televet/booking/index.d.ts +6 -6
  211. package/dist/web/televet/booking/index.js +1 -94
  212. package/dist/web/televet/index.cjs +1 -94
  213. package/dist/web/televet/index.js +1 -94
  214. package/dist/web/texting/index.cjs +1 -94
  215. package/dist/web/texting/index.d.cts +5 -5
  216. package/dist/web/texting/index.d.ts +5 -5
  217. package/dist/web/texting/index.js +1 -94
  218. package/notifications/inbox/package.json +8 -0
  219. package/package.json +29 -1
  220. package/web/inbox/native-blocked.cjs +12 -0
  221. package/web/inbox/package.json +8 -0
@@ -0,0 +1,168 @@
1
+ /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
+ import { R as RecordsRequestId, P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.js';
3
+ import { V as VetVisitIntent } from './visitIntent.d-D7_yVp1I.js';
4
+
5
+ /**
6
+ * The event types Everfur builds a push target for (`partner_target.py` TARGET_BUILDERS), in its order. The member
7
+ * events, the urgency verdict and the endpoint test event reach the partner's webhook only and never a device, and
8
+ * `visit.completed`, `visit.rescheduled` and `visit.ended` carry no consumer copy, so they are never pushed either;
9
+ * they are listed because the platform builds their target.
10
+ */
11
+ declare const EVERFUR_NOTIFICATION_EVENT_TYPES: readonly ["record_request.updated", "record.ready", "pet.vaccination.due", "visit.booked", "visit.cancelled", "visit.completed", "visit.no_show", "visit.rescheduled", "visit.reminder", "visit.followup_sent", "visit.message_received", "visit.ended", "chat.follow_up_due", "chat.reminder_due", "record.activation", "chat.engagement_message", "visit.notes_ready", "visit.vet_joined", "visit.summary_sent", "chat.answer_ready", "chat.follow_up_day5_due", "care.medication_check_due", "care.dose_due", "care.refill_due", "care.prevention_due", "care.meal_due", "care.nose_to_tail_due", "care.reminder_due", "record.labs_ready", "record.update_available", "order.updated", "order.prescription_updated", "walk.reminder", "walk.reminder_offer", "weather.heat", "weather.storm", "weather.air_quality", "weather.ice", "weather.pollen", "safety.danger_day", "safety.food_recall", "insight.week", "insight.birthday", "insight.weight_trend", "insight.monthly_notes", "insight.year_summary", "pet.adoption_day", "tip.weekly", "tip.daily", "tip.question_guide", "pack.walk_logged", "pack.question", "pack.reactions", "pack.care_handoff", "pack.photo_ready", "mood.check_in_due", "streak.at_risk", "streak.milestone", "membership.first_visit", "membership.renewal", "membership.invite", "support.replied"];
12
+ /** One pushed event type. */
13
+ type EverfurNotificationEventType = (typeof EVERFUR_NOTIFICATION_EVENT_TYPES)[number];
14
+ /** A push's event type: one this release knows, or a newer one passed through as the platform named it. */
15
+ type EverfurNotificationEventName = EverfurNotificationEventType | (string & Record<never, never>);
16
+
17
+ /** The version of the routing block this release reads. */
18
+ declare const EVERFUR_NOTIFICATION_VERSION = 1;
19
+ /**
20
+ * The target kinds this release reads: the five the platform has always built (`partner_target.py` TARGET_KINDS), then
21
+ * the ones the consumer apps' messages bring, in the wire spec's order. A kind outside the list reads as `unknown`.
22
+ */
23
+ declare const EVERFUR_NOTIFICATION_TARGET_KINDS: readonly ["record_request", "pet", "visit", "case", "chat", "records", "vaccine", "medication", "labs", "order", "health_plan", "tip", "walk", "weather", "pack", "mood", "card", "membership", "support", "offer", "inbox"];
24
+ /** One target kind. */
25
+ type EverfurNotificationTargetKind = (typeof EVERFUR_NOTIFICATION_TARGET_KINDS)[number];
26
+
27
+ /**
28
+ * What a visit push names to open, when it names one: the four the hosted visit page opens, then three finer steps,
29
+ * the visit's preparation, its waiting room and the vet's notes.
30
+ */
31
+ type EverfurVisitPushIntent = 'visit' | 'join' | 'summary' | 'messages' | 'prep' | 'waiting' | 'notes';
32
+ /** What a medication push is about: a check on a new medicine, a refill coming up, a dose. */
33
+ type EverfurMedicationIntent = 'check' | 'refill' | 'dose';
34
+ /** What an order push is about: its status, or its prescription. */
35
+ type EverfurOrderIntent = 'status' | 'prescription';
36
+ /** What a tapped notification is about, keyed on `kind`. The optional references are null when the push carried none. */
37
+ type EverfurNotificationTarget = {
38
+ /**
39
+ * A records request (`record_request.updated`, `record.ready`, and `record.activation`, which says what the
40
+ * request's parse found): open that request.
41
+ */
42
+ readonly kind: 'record_request';
43
+ readonly requestId: RecordsRequestId;
44
+ readonly petRef: PetRef | null;
45
+ } | {
46
+ /** A pet: `pet.vaccination.due` opens that pet's records, `chat.reminder_due` that pet's chat. */
47
+ readonly kind: 'pet';
48
+ readonly petRef: PetRef;
49
+ } | {
50
+ /**
51
+ * A vet visit (`visit.*`): open that visit. `visitRef` is the partner visit reference the visit events carry.
52
+ * `intent` is what to open for it, derived from the event type with the consumer app's routing (the push
53
+ * itself carries none): `visit` for a booking or a change to it, `join` for a reminder, `messages` for the
54
+ * vet's reply or the follow-up, `summary` for a completed visit. Pass both to `useVetVisit().openVisit`.
55
+ * `null` for a cancelled or missed visit: there is nothing left to open, so route to a new booking.
56
+ */
57
+ readonly kind: 'visit';
58
+ readonly visitRef: string;
59
+ readonly petRef: PetRef | null;
60
+ readonly intent: VetVisitIntent | null;
61
+ /**
62
+ * What the push itself named, when it named something: then `intent` is what the hosted page opens for it
63
+ * (`prep` the visit, `waiting` the call, `notes` the summary). Absent when the push named nothing.
64
+ */
65
+ readonly pushIntent?: EverfurVisitPushIntent;
66
+ } | {
67
+ /** A follow-up case (`chat.follow_up_due`): open the conversation the check-in landed in. */
68
+ readonly kind: 'case';
69
+ readonly caseRef: string;
70
+ readonly conversationId: ConversationId | null;
71
+ readonly petRef: PetRef | null;
72
+ } | {
73
+ /**
74
+ * A message Everfur left in a pet's chat (`chat.engagement_message`): open that pet's chat. Opening it is what
75
+ * places the message in the thread, so pass the target to EverfurChat as `checkinTarget`. `conversationId`
76
+ * is null while the platform does not name the thread.
77
+ */
78
+ readonly kind: 'chat';
79
+ readonly petRef: PetRef;
80
+ readonly conversationId: ConversationId | null;
81
+ } | {
82
+ /** A pet's records: open them. */
83
+ readonly kind: 'records';
84
+ readonly petRef: PetRef;
85
+ } | {
86
+ /** A pet's vaccines: open its records. */
87
+ readonly kind: 'vaccine';
88
+ readonly petRef: PetRef;
89
+ } | {
90
+ /**
91
+ * A medicine of the pet's: a check on a new one, a refill coming up, or a dose. `intent` null when not named. No
92
+ * SDK surface: yours, or the inbox.
93
+ */
94
+ readonly kind: 'medication';
95
+ readonly petRef: PetRef;
96
+ readonly medicationRef: string | null;
97
+ readonly intent: EverfurMedicationIntent | null;
98
+ } | {
99
+ /** New lab results for the pet. */
100
+ readonly kind: 'labs';
101
+ readonly petRef: PetRef;
102
+ readonly resultRef: string | null;
103
+ } | {
104
+ /** An order: its status or its prescription. No SDK surface: yours, or the inbox. */
105
+ readonly kind: 'order';
106
+ readonly orderRef: string;
107
+ readonly intent: EverfurOrderIntent | null;
108
+ } | {
109
+ /** The Health Plan, for a pet or for the member. */
110
+ readonly kind: 'health_plan';
111
+ readonly petRef: PetRef | null;
112
+ } | {
113
+ /** A tip on a topic (`topic` is a key, not words to show). */
114
+ readonly kind: 'tip';
115
+ readonly topic: string;
116
+ readonly petRef: PetRef | null;
117
+ } | {
118
+ /** A walk. No SDK surface: yours, or the inbox. */
119
+ readonly kind: 'walk';
120
+ readonly petRef: PetRef | null;
121
+ } | {
122
+ /** Weather, the pack (the member's household and friends), the membership, support: no SDK surface. */
123
+ readonly kind: 'weather' | 'pack' | 'membership' | 'support';
124
+ } | {
125
+ /** The pet's mood check. No SDK surface: yours, or the inbox. */
126
+ readonly kind: 'mood';
127
+ readonly petRef: PetRef;
128
+ } | {
129
+ /** A card (a recall, a birthday, the pet's week). No SDK surface: yours, or the inbox. */
130
+ readonly kind: 'card';
131
+ readonly cardRef: string;
132
+ } | {
133
+ /** An offer. No SDK surface: yours, or the inbox. */
134
+ readonly kind: 'offer';
135
+ readonly offerRef: string;
136
+ } | {
137
+ /** The member's inbox: the item `itemId` (`inb_...`), or the inbox itself when null. */
138
+ readonly kind: 'inbox';
139
+ readonly itemId: string | null;
140
+ } | {
141
+ /**
142
+ * A kind this release does not know, sent by a newer platform. `wireKind` is the kind as sent and `fields` the
143
+ * target's string values under their wire keys (`pet_ref`...), each a short opaque string. Route it yourself,
144
+ * or open the inbox (`routeEverfurNotification` does both).
145
+ */
146
+ readonly kind: 'unknown';
147
+ readonly wireKind: string;
148
+ readonly fields: Readonly<Record<string, string>>;
149
+ };
150
+ /** A parsed push: the event it announces and the thing to open. Frozen. */
151
+ interface EverfurNotification {
152
+ /** `evt_` plus the public event id, the same id the webhook envelope for this event carries. */
153
+ readonly eventId: string;
154
+ readonly eventType: EverfurNotificationEventName;
155
+ readonly target: EverfurNotificationTarget;
156
+ /** The inbox item (`inb_...`) that holds the same message, when Everfur kept one. Absent otherwise. */
157
+ readonly inboxItemId?: string;
158
+ }
159
+ /**
160
+ * Read the Everfur routing block out of a received push, or null when there is none or it is not one Everfur would
161
+ * send. Pure and total: it never throws, whatever it is handed.
162
+ *
163
+ * Pass the object your notification library gave you: an expo-notifications `Notification` or `NotificationResponse`,
164
+ * an FCM `RemoteMessage`, or its `data` map. Route on `target.kind`; `eventType` says why the push was sent.
165
+ */
166
+ declare function parseEverfurNotification(payload: unknown): EverfurNotification | null;
167
+
168
+ export { EVERFUR_NOTIFICATION_EVENT_TYPES as E, EVERFUR_NOTIFICATION_TARGET_KINDS as a, EVERFUR_NOTIFICATION_VERSION as b, type EverfurMedicationIntent as c, type EverfurNotification as d, type EverfurNotificationEventName as e, type EverfurNotificationEventType as f, type EverfurNotificationTarget as g, type EverfurNotificationTargetKind as h, type EverfurOrderIntent as i, type EverfurVisitPushIntent as j, parseEverfurNotification as p };
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
3
- import { j as FetchLike } from './config.d-KX-EkQ9j.js';
3
+ import { j as FetchLike } from './config.d-BnZkxI5a.js';
4
4
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
5
5
 
6
6
  /** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
3
- import { j as FetchLike } from './config.d-Z_fyOZke.cjs';
3
+ import { j as FetchLike } from './config.d-DoC-XaJ0.cjs';
4
4
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
5
5
 
6
6
  /** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
3
- import { A as AuthContext } from './identity.d-CRVNfZzQ.js';
3
+ import { A as AuthContext } from './identity.d-BWZiaByn.js';
4
4
  import { P as PetRef } from './ids.d-B2GAAifq.js';
5
5
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
3
- import { A as AuthContext } from './identity.d-3ROlHbnP.cjs';
3
+ import { A as AuthContext } from './identity.d-CooKscNj.cjs';
4
4
  import { P as PetRef } from './ids.d-B2GAAifq.cjs';
5
5
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
6
6
 
@@ -1,98 +1,5 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- "use strict";var react=require("react"),reactNative=require("react-native"),jsxRuntime=require("react/jsx-runtime");var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
3
- /* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
4
- /* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
5
- /* @__PURE__ */Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),
6
- /* @__PURE__ */Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),
7
- /* @__PURE__ */Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),
8
- /* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),
9
- /* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),
10
- /* @__PURE__ */Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),
11
- /* @__PURE__ */Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),
12
- /* @__PURE__ */Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),
13
- /* @__PURE__ */Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),
14
- /* @__PURE__ */Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),
15
- /* @__PURE__ */Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),
16
- /* @__PURE__ */Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),
17
- /* @__PURE__ */Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),
18
- /* @__PURE__ */Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),
19
- /* @__PURE__ */Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),
20
- /* @__PURE__ */Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),
21
- /* @__PURE__ */Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),
22
- /* @__PURE__ */Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),
23
- /* @__PURE__ */Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),
24
- /* @__PURE__ */Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),
25
- /* @__PURE__ */Object.freeze({wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false}),
26
- /* @__PURE__ */Object.freeze({wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false}),
27
- /* @__PURE__ */Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
28
- /* @__PURE__ */Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),
29
- /* @__PURE__ */Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),
30
- /* @__PURE__ */Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
31
- /* @__PURE__ */Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
32
- /* @__PURE__ */Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
33
- /* @__PURE__ */Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
34
- /* @__PURE__ */Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
35
- /* @__PURE__ */Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),
36
- /* @__PURE__ */Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),
37
- /* @__PURE__ */Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
38
- /* @__PURE__ */Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),
39
- /* @__PURE__ */Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),
40
- /* @__PURE__ */Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),
41
- /* @__PURE__ */Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),
42
- /* @__PURE__ */Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),
43
- /* @__PURE__ */Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),
44
- /* @__PURE__ */Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),
45
- /* @__PURE__ */Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),
46
- /* @__PURE__ */Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),
47
- /* @__PURE__ */Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),
48
- /* @__PURE__ */Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),
49
- /* @__PURE__ */Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),
50
- /* @__PURE__ */Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),
51
- /* @__PURE__ */Object.freeze({wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false}),
52
- /* @__PURE__ */Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
53
- /* @__PURE__ */Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
54
- /* @__PURE__ */Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),
55
- /* @__PURE__ */Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
56
- /* @__PURE__ */Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),
57
- /* @__PURE__ */Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
58
- /* @__PURE__ */Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
59
- /* @__PURE__ */Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),
60
- /* @__PURE__ */Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),
61
- /* @__PURE__ */Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),
62
- /* @__PURE__ */Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),
63
- /* @__PURE__ */Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
64
- /* @__PURE__ */Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),
65
- /* @__PURE__ */Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
66
- /* @__PURE__ */Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),
67
- /* @__PURE__ */Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
68
- /* @__PURE__ */Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
69
- /* @__PURE__ */Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
70
- /* @__PURE__ */Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),
71
- /* @__PURE__ */Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
72
- /* @__PURE__ */Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),
73
- /* @__PURE__ */Object.freeze({wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false}),
74
- /* @__PURE__ */Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),
75
- /* @__PURE__ */Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),
76
- /* @__PURE__ */Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
77
- /* @__PURE__ */Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
78
- /* @__PURE__ */Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),
79
- /* @__PURE__ */Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
80
- /* @__PURE__ */Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),
81
- /* @__PURE__ */Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),
82
- /* @__PURE__ */Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
83
- /* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),
84
- /* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
85
- /* @__PURE__ */Object.freeze({wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false}),
86
- /* @__PURE__ */Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),
87
- /* @__PURE__ */Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),
88
- /* @__PURE__ */Object.freeze({wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
89
- /* @__PURE__ */Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),
90
- /* @__PURE__ */Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),
91
- /* @__PURE__ */Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
92
- /* @__PURE__ */Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
93
- /* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),
94
- /* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
95
- /* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */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",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",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",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"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 categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";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"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */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:ACCESS_DENIED_COPY,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:VALIDATION_FAILED_COPY,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.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
2
+ "use strict";var react=require("react"),reactNative=require("react-native"),jsxRuntime=require("react/jsx-runtime");var RETRYABILITY_ROWS=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze(RETRYABILITY_ROWS.map(row=>/* @__PURE__ */Object.freeze(row)));/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */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",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",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",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"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 categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";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"}}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */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:ACCESS_DENIED_COPY,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:VALIDATION_FAILED_COPY,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.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
96
3
  return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
97
4
  return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
98
5
  return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(