@everfur/sdk 0.15.0 → 0.15.1

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 (300) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/LICENSE.md +1 -0
  3. package/README.md +12 -5
  4. package/SDK-LICENSE.txt +130 -0
  5. package/THIRD_PARTY_NOTICES +9 -0
  6. package/dist/CameraPort.d-Cv31Pz7g.d.cts +1 -0
  7. package/dist/CameraPort.d-Cv31Pz7g.d.ts +1 -0
  8. package/dist/{Chat.d-CtfANk3A.d.cts → Chat.d-BO5iJsR2.d.cts} +12 -3
  9. package/dist/{Chat.d-a7Ksz7NZ.d.ts → Chat.d-BlsnQwCQ.d.ts} +12 -3
  10. package/dist/{DepthViews.d-DbJejGm3.d.ts → DepthViews.d--1daZblh.d.cts} +2 -1
  11. package/dist/{DepthViews.d-dXWL6ToG.d.cts → DepthViews.d-BuEWI6Ln.d.ts} +2 -1
  12. package/dist/{DepthViews.d-CuBElgEc.d.ts → DepthViews.d-CKTnEeUo.d.ts} +2 -1
  13. package/dist/{DepthViews.d-BqMnWSMu.d.cts → DepthViews.d-PuBGdAYk.d.cts} +2 -1
  14. package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +1 -0
  15. package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +1 -0
  16. package/dist/EverfurError.d-8NHtlgzA.d.cts +1 -0
  17. package/dist/EverfurError.d-8NHtlgzA.d.ts +1 -0
  18. package/dist/EverfurResult.d-BFH-3s6E.d.cts +1 -0
  19. package/dist/EverfurResult.d-D_-254ZY.d.ts +1 -0
  20. package/dist/IntakeMedia.d-4a89XrP7.d.ts +1 -0
  21. package/dist/IntakeMedia.d-DGxrhgIW.d.ts +1 -0
  22. package/dist/IntakeMedia.d-DUPR4lVM.d.cts +1 -0
  23. package/dist/IntakeMedia.d-JJCUvQu7.d.cts +1 -0
  24. package/dist/LICENSE.md +1 -0
  25. package/dist/LifecyclePort.d-Cr1p33a7.d.cts +1 -0
  26. package/dist/LifecyclePort.d-Cr1p33a7.d.ts +1 -0
  27. package/dist/PhotoController.d-BzCJOE7e.d.cts +1 -0
  28. package/dist/PhotoController.d-D0XiUUOl.d.ts +1 -0
  29. package/dist/{RecordsPage.d-DKrZ9rHX.d.ts → RecordsPage.d-CBB8sfoY.d.ts} +2 -1
  30. package/dist/{RecordsPage.d-DRPdUAo4.d.cts → RecordsPage.d-Dq5gpQG0.d.cts} +2 -1
  31. package/dist/SDK-LICENSE.txt +130 -0
  32. package/dist/THIRD_PARTY_NOTICES +9 -0
  33. package/dist/TelemetryPort.d-BDNr00hu.d.cts +1 -0
  34. package/dist/TelemetryPort.d-BDNr00hu.d.ts +1 -0
  35. package/dist/animations/index.cjs +2 -1
  36. package/dist/animations/index.d.cts +22 -21
  37. package/dist/animations/index.d.ts +22 -21
  38. package/dist/animations/index.js +2 -1
  39. package/dist/{attachments.d-CoQhXrP9.d.ts → attachments.d-C2nkIyDB.d.ts} +3 -2
  40. package/dist/{attachments.d-BGn2_knv.d.ts → attachments.d-DFP9yvz9.d.ts} +7 -6
  41. package/dist/{attachments.d-CpaOfi2g.d.cts → attachments.d-DRHsJkni.d.cts} +7 -6
  42. package/dist/{attachments.d-CqHMGoER.d.cts → attachments.d-DRUC35Ti.d.cts} +3 -2
  43. package/dist/{bookingCopy.d-BwCOCZUj.d.ts → bookingCopy.d-CFL-1Be2.d.ts} +3 -2
  44. package/dist/{bookingCopy.d-Bnq2zk0F.d.cts → bookingCopy.d-bF_QknDC.d.cts} +3 -2
  45. package/dist/branding.d-Bbc6p1XY.d.cts +1 -0
  46. package/dist/branding.d-y6c0UwhE.d.ts +1 -0
  47. package/dist/cacheEpoch.d-DknKn3S0.d.cts +1 -0
  48. package/dist/cacheEpoch.d-DknKn3S0.d.ts +1 -0
  49. package/dist/callCopy.d-Bw6oZT54.d.cts +1 -0
  50. package/dist/callCopy.d-Bw6oZT54.d.ts +1 -0
  51. package/dist/callRoom.d-B1DoYdJe.d.cts +1 -0
  52. package/dist/callRoom.d-Dqm1rUqT.d.ts +1 -0
  53. package/dist/{casesRepository.d-CsUJ2Oyb.d.cts → casesRepository.d-BMOnT1fg.d.cts} +2 -1
  54. package/dist/{casesRepository.d-DG83Ggbq.d.ts → casesRepository.d-C__BnffJ.d.ts} +2 -1
  55. package/dist/chat/index.cjs +13 -12
  56. package/dist/chat/index.d.cts +10 -9
  57. package/dist/chat/index.d.ts +10 -9
  58. package/dist/chat/index.js +13 -12
  59. package/dist/client/index.cjs +2 -1
  60. package/dist/client/index.d.cts +7 -6
  61. package/dist/client/index.d.ts +7 -6
  62. package/dist/client/index.js +2 -1
  63. package/dist/{clinicBatch.d-BLpbpS51.d.cts → clinicBatch.d-C5deJ4xY.d.cts} +3 -2
  64. package/dist/{clinicBatch.d-Byjx4y_W.d.ts → clinicBatch.d-D68RYvc3.d.ts} +3 -2
  65. package/dist/clinicModels.d-BXgKZqDb.d.cts +1 -0
  66. package/dist/clinicModels.d-CaS64-P-.d.ts +1 -0
  67. package/dist/clinicRequestProps.d-1dCtouGA.d.cts +1 -0
  68. package/dist/clinicRequestProps.d-CjsMg_OD.d.ts +1 -0
  69. package/dist/{config.d-C0WgjutL.d.cts → config.d-BQgrIDdu.d.cts} +2 -1
  70. package/dist/{config.d-zd2eTb2L.d.ts → config.d-XSMThgVj.d.ts} +2 -1
  71. package/dist/consent/index.cjs +1 -0
  72. package/dist/consent/index.d.cts +6 -5
  73. package/dist/consent/index.d.ts +6 -5
  74. package/dist/consent/index.js +1 -0
  75. package/dist/{context.d-Du_UPxa1.d.cts → context.d-Ba8YyJpk.d.cts} +6 -5
  76. package/dist/{context.d-BBjmV0rz.d.ts → context.d-xoh5vmxS.d.ts} +6 -5
  77. package/dist/{copy.d-Da_PP2K3.d.cts → copy.d-Cq-s-UUv.d.cts} +3 -2
  78. package/dist/{copy.d-D_VVj01o.d.ts → copy.d-HV9fU5kh.d.ts} +3 -2
  79. package/dist/core/index.cjs +2 -1
  80. package/dist/core/index.d.cts +14 -13
  81. package/dist/core/index.d.ts +14 -13
  82. package/dist/core/index.js +2 -1
  83. package/dist/{depth.d-BEedifOR.d.ts → depth.d-D7kKiYl7.d.ts} +3 -2
  84. package/dist/{depth.d-RTV61QNf.d.cts → depth.d-DYnkz8Re.d.cts} +3 -2
  85. package/dist/{entitlementRepository.d-C-stdRyA.d.cts → entitlementRepository.d-B_kEPLhz.d.cts} +3 -2
  86. package/dist/{entitlementRepository.d-BwThmh3V.d.ts → entitlementRepository.d-DmnUZLl_.d.ts} +3 -2
  87. package/dist/features.d-DrQxTw3-.d.cts +1 -0
  88. package/dist/features.d-DrQxTw3-.d.ts +1 -0
  89. package/dist/{focus.d-Dsm39DjO.d.cts → focus.d-BHm_QtQ9.d.cts} +3 -2
  90. package/dist/{focus.d-CtotIyEt.d.ts → focus.d-CjL6Cj0m.d.ts} +3 -2
  91. package/dist/health-plan/index.cjs +2 -1
  92. package/dist/health-plan/index.d.cts +9 -8
  93. package/dist/health-plan/index.d.ts +9 -8
  94. package/dist/health-plan/index.js +2 -1
  95. package/dist/{idempotency.d-Cv-B7SfC.d.ts → idempotency.d-BSRK8od4.d.cts} +2 -1
  96. package/dist/{idempotency.d-Bfm7oIxS.d.cts → idempotency.d-CFc4CCc9.d.ts} +2 -1
  97. package/dist/{identity.d-BksOEa6m.d.ts → identity.d-Be2Es9Td.d.ts} +2 -1
  98. package/dist/{identity.d-CioQhZrq.d.cts → identity.d-HbwYQ4-z.d.cts} +2 -1
  99. package/dist/ids.d-B2GAAifq.d.cts +1 -0
  100. package/dist/ids.d-B2GAAifq.d.ts +1 -0
  101. package/dist/index.cjs +14 -13
  102. package/dist/index.d.cts +13 -12
  103. package/dist/index.d.ts +13 -12
  104. package/dist/index.js +14 -13
  105. package/dist/{introEvents.d-tOi4o3F4.d.ts → introEvents.d-DflJ6J9H.d.ts} +2 -1
  106. package/dist/{introEvents.d-fAZitxMA.d.cts → introEvents.d-Dr34KIaD.d.cts} +2 -1
  107. package/dist/introEvents.d-dS3fJCH1.d.cts +1 -0
  108. package/dist/introEvents.d-dS3fJCH1.d.ts +1 -0
  109. package/dist/models.d-BSqvbTE1.d.cts +1 -0
  110. package/dist/models.d-DOwnr8fi.d.ts +1 -0
  111. package/dist/notifications/index.cjs +1 -0
  112. package/dist/notifications/index.d.cts +5 -4
  113. package/dist/notifications/index.d.ts +5 -4
  114. package/dist/notifications/index.js +1 -0
  115. package/dist/{optInView.d-B8zTORO2.d.ts → optInView.d-3mbj1mR6.d.ts} +15 -2
  116. package/dist/{optInView.d-BkNSv4Gk.d.cts → optInView.d-D23o1gtT.d.cts} +15 -2
  117. package/dist/optionalModule.d-DbJmsq5f.d.cts +1 -0
  118. package/dist/optionalModule.d-DbJmsq5f.d.ts +1 -0
  119. package/dist/{parse.d-BgjO82mY.d.cts → parse.d-4lUXdmvY.d.cts} +2 -1
  120. package/dist/{parse.d-B5JHS6Pr.d.ts → parse.d-BERabxHw.d.ts} +2 -1
  121. package/dist/{pets.d-B_LoizOv.d.cts → pets.d-CHU0UbXt.d.cts} +2 -1
  122. package/dist/{pets.d-OWxskXCP.d.ts → pets.d-D_ayuqjp.d.ts} +2 -1
  123. package/dist/{petsRepository.d-B5DWzU7C.d.cts → petsRepository.d-Bwfe8yuR.d.cts} +2 -1
  124. package/dist/{petsRepository.d-Ba3xhJcj.d.ts → petsRepository.d-DUaAWoTv.d.ts} +2 -1
  125. package/dist/photo/index.cjs +1 -0
  126. package/dist/photo/index.d.cts +1 -0
  127. package/dist/photo/index.d.ts +1 -0
  128. package/dist/photo/index.js +1 -0
  129. package/dist/{planSignals.d-DtxZoWGM.d.ts → planSignals.d-CON9gTvJ.d.ts} +3 -2
  130. package/dist/{planSignals.d-Cl6n5QpS.d.cts → planSignals.d-Dha2CMDF.d.cts} +3 -2
  131. package/dist/ports.d-BX4f4UsB.d.cts +1 -0
  132. package/dist/ports.d-BX4f4UsB.d.ts +1 -0
  133. package/dist/{ports.d-gZNTn8Qf.d.cts → ports.d-ClbPRUtx.d.cts} +5 -4
  134. package/dist/{ports.d-BDtwHxmW.d.ts → ports.d-DzEJMVRs.d.ts} +5 -4
  135. package/dist/presentation.d-vy8kTGfR.d.cts +1 -0
  136. package/dist/presentation.d-vy8kTGfR.d.ts +1 -0
  137. package/dist/profile.d-CSs1wlXT.d.cts +1 -0
  138. package/dist/profile.d-CSs1wlXT.d.ts +1 -0
  139. package/dist/projection.d-CeIUsbSk.d.cts +1 -0
  140. package/dist/projection.d-CeIUsbSk.d.ts +1 -0
  141. package/dist/quickPrompts.d-NM_81Jc1.d.cts +1 -0
  142. package/dist/quickPrompts.d-NM_81Jc1.d.ts +1 -0
  143. package/dist/records/depth/index.cjs +1 -0
  144. package/dist/records/depth/index.d.cts +10 -9
  145. package/dist/records/depth/index.d.ts +10 -9
  146. package/dist/records/depth/index.js +1 -0
  147. package/dist/records/index.cjs +3 -2
  148. package/dist/records/index.d.cts +11 -10
  149. package/dist/records/index.d.ts +11 -10
  150. package/dist/records/index.js +3 -2
  151. package/dist/recordsAsk.d-C5CGSi3j.d.cts +1 -0
  152. package/dist/recordsAsk.d-C5CGSi3j.d.ts +1 -0
  153. package/dist/{requestFunnel.d-CR4akGCY.d.cts → requestFunnel.d-JoqddYSx.d.cts} +3 -2
  154. package/dist/{requestFunnel.d-DFf9C__p.d.ts → requestFunnel.d-YabU6G-Z.d.ts} +3 -2
  155. package/dist/resolve.d-CoQWUy1Y.d.cts +1 -0
  156. package/dist/resolve.d-CoQWUy1Y.d.ts +1 -0
  157. package/dist/{runtimeTypes.d-CHdH-y2c.d.cts → runtimeTypes.d-Cv38YuzP.d.cts} +5 -4
  158. package/dist/{runtimeTypes.d-BqBOrZxa.d.ts → runtimeTypes.d-DQTBJAbk.d.ts} +5 -4
  159. package/dist/{screenProps.d-CVqFJw-J.d.ts → screenProps.d-BuJLzFkN.d.ts} +2 -1
  160. package/dist/{screenProps.d-B1dIANI0.d.cts → screenProps.d-C-AuHoyF.d.cts} +2 -1
  161. package/dist/server/events/index.cjs +2 -1
  162. package/dist/server/events/index.d.cts +3 -2
  163. package/dist/server/events/index.d.ts +3 -2
  164. package/dist/server/events/index.js +2 -1
  165. package/dist/server/index.cjs +2 -1
  166. package/dist/server/index.d.cts +4 -3
  167. package/dist/server/index.d.ts +4 -3
  168. package/dist/server/index.js +2 -1
  169. package/dist/sheetCopy.d-CAhLOxjc.d.cts +1 -0
  170. package/dist/sheetCopy.d-CAhLOxjc.d.ts +1 -0
  171. package/dist/sheetSeam.d-B09jf4YC.d.ts +1 -0
  172. package/dist/sheetSeam.d-BBuEIVsa.d.cts +1 -0
  173. package/dist/shop/index.cjs +1 -0
  174. package/dist/shop/index.d.cts +4 -3
  175. package/dist/shop/index.d.ts +4 -3
  176. package/dist/shop/index.js +1 -0
  177. package/dist/species.d-BXAIMh7I.d.cts +1 -0
  178. package/dist/species.d-BXAIMh7I.d.ts +1 -0
  179. package/dist/tabs/index.cjs +1 -0
  180. package/dist/tabs/index.d.cts +7 -6
  181. package/dist/tabs/index.d.ts +7 -6
  182. package/dist/tabs/index.js +1 -0
  183. package/dist/tabsModel.d-BfIQg6yS.d.cts +1 -0
  184. package/dist/tabsModel.d-BfIQg6yS.d.ts +1 -0
  185. package/dist/televet/booking/index.cjs +1 -0
  186. package/dist/televet/booking/index.d.cts +7 -6
  187. package/dist/televet/booking/index.d.ts +7 -6
  188. package/dist/televet/booking/index.js +1 -0
  189. package/dist/televet/call/index.cjs +1 -0
  190. package/dist/televet/call/index.d.cts +1 -0
  191. package/dist/televet/call/index.d.ts +1 -0
  192. package/dist/televet/call/index.js +1 -0
  193. package/dist/televet/index.cjs +1 -0
  194. package/dist/televet/index.d.cts +1 -0
  195. package/dist/televet/index.d.ts +1 -0
  196. package/dist/televet/index.js +1 -0
  197. package/dist/televetGlobal.d-CC-DrqkQ.d.ts +1 -0
  198. package/dist/televetGlobal.d-CKwDCbmN.d.cts +1 -0
  199. package/dist/testing/index.cjs +1 -0
  200. package/dist/testing/index.d.cts +2 -1
  201. package/dist/testing/index.d.ts +2 -1
  202. package/dist/testing/index.js +1 -0
  203. package/dist/testing/rn/index.cjs +2 -2
  204. package/dist/testing/rn/index.d.cts +11 -9
  205. package/dist/testing/rn/index.d.ts +11 -9
  206. package/dist/testing/rn/index.js +2 -2
  207. package/dist/testing/web/index.cjs +1 -0
  208. package/dist/testing/web/index.d.cts +8 -7
  209. package/dist/testing/web/index.d.ts +8 -7
  210. package/dist/testing/web/index.js +1 -0
  211. package/dist/texting/index.cjs +2 -1
  212. package/dist/texting/index.d.cts +9 -6
  213. package/dist/texting/index.d.ts +9 -6
  214. package/dist/texting/index.js +2 -1
  215. package/dist/{threadOptions.d-DZ0AoQGk.d.ts → threadOptions.d-8x_1evAr.d.ts} +3 -2
  216. package/dist/{threadOptions.d-CnSfFVMr.d.cts → threadOptions.d-DBrmOwmb.d.cts} +3 -2
  217. package/dist/{timelineRows.d-CF1KvLcQ.d.cts → timelineRows.d-B6lLC8Ud.d.cts} +2 -1
  218. package/dist/{timelineRows.d-CtL0y7y1.d.ts → timelineRows.d-Brlkti-G.d.ts} +2 -1
  219. package/dist/tokens.d-BUVqme2D.d.cts +1 -0
  220. package/dist/tokens.d-BUVqme2D.d.ts +1 -0
  221. package/dist/typeStyle.d-B3Kdtjie.d.ts +1 -0
  222. package/dist/typeStyle.d-DmlwyJq-.d.cts +1 -0
  223. package/dist/uploadTransport.d-CWL7CdWP.d.cts +1 -0
  224. package/dist/uploadTransport.d-EGoUl7gX.d.ts +1 -0
  225. package/dist/useIntroSeen.d-CTWFUthO.d.cts +1 -0
  226. package/dist/useIntroSeen.d-CTWFUthO.d.ts +1 -0
  227. package/dist/{usePresentation.d-CZS0qlLI.d.cts → usePresentation.d-BcdCIuEU.d.cts} +2 -1
  228. package/dist/{usePresentation.d-BsR08Wxt.d.ts → usePresentation.d-Bne14SlX.d.ts} +2 -1
  229. package/dist/useRecords.d-BYNX01El.d.cts +1 -0
  230. package/dist/useRecords.d-DWk61a4c.d.ts +1 -0
  231. package/dist/{useRecordsDepth.d-DTAxFf5s.d.ts → useRecordsDepth.d-Cd6J03o5.d.ts} +2 -1
  232. package/dist/{useRecordsDepth.d-k-zYIHTe.d.cts → useRecordsDepth.d-DAa169VY.d.cts} +2 -1
  233. package/dist/useVetVisit.d-BtdwhmgD.d.cts +1 -0
  234. package/dist/useVetVisit.d-DoYQimyt.d.ts +1 -0
  235. package/dist/video/index.cjs +1 -0
  236. package/dist/video/index.d.cts +1 -0
  237. package/dist/video/index.d.ts +1 -0
  238. package/dist/video/index.js +1 -0
  239. package/dist/{view.d-CAWQjcY_.d.cts → view.d-3d5_O7Xk.d.cts} +4 -3
  240. package/dist/{view.d-BE7VOlsB.d.ts → view.d-DkGM8GNA.d.ts} +4 -3
  241. package/dist/visitIntent.d-D7_yVp1I.d.cts +1 -0
  242. package/dist/visitIntent.d-D7_yVp1I.d.ts +1 -0
  243. package/dist/web/consent/index.cjs +1 -0
  244. package/dist/web/consent/index.d.cts +6 -5
  245. package/dist/web/consent/index.d.ts +6 -5
  246. package/dist/web/consent/index.js +1 -0
  247. package/dist/web/health-plan/index.cjs +2 -1
  248. package/dist/web/health-plan/index.d.cts +11 -10
  249. package/dist/web/health-plan/index.d.ts +11 -10
  250. package/dist/web/health-plan/index.js +2 -1
  251. package/dist/web/index.cjs +16 -13
  252. package/dist/web/index.d.cts +31 -22
  253. package/dist/web/index.d.ts +31 -22
  254. package/dist/web/index.js +16 -13
  255. package/dist/web/intro/index.cjs +1 -0
  256. package/dist/web/intro/index.d.cts +7 -6
  257. package/dist/web/intro/index.d.ts +7 -6
  258. package/dist/web/intro/index.js +1 -0
  259. package/dist/web/notifications/index.cjs +1 -0
  260. package/dist/web/notifications/index.d.cts +4 -3
  261. package/dist/web/notifications/index.d.ts +4 -3
  262. package/dist/web/notifications/index.js +1 -0
  263. package/dist/web/records/depth/index.cjs +1 -0
  264. package/dist/web/records/depth/index.d.cts +10 -9
  265. package/dist/web/records/depth/index.d.ts +10 -9
  266. package/dist/web/records/depth/index.js +1 -0
  267. package/dist/web/records/index.cjs +1 -0
  268. package/dist/web/records/index.d.cts +12 -11
  269. package/dist/web/records/index.d.ts +12 -11
  270. package/dist/web/records/index.js +1 -0
  271. package/dist/web/records/upload/index.cjs +1 -0
  272. package/dist/web/records/upload/index.d.cts +1 -0
  273. package/dist/web/records/upload/index.d.ts +1 -0
  274. package/dist/web/records/upload/index.js +1 -0
  275. package/dist/web/records-sheet/index.cjs +3 -2
  276. package/dist/web/records-sheet/index.d.cts +1 -0
  277. package/dist/web/records-sheet/index.d.ts +1 -0
  278. package/dist/web/records-sheet/index.js +3 -2
  279. package/dist/web/shop/index.cjs +1 -0
  280. package/dist/web/shop/index.d.cts +4 -3
  281. package/dist/web/shop/index.d.ts +4 -3
  282. package/dist/web/shop/index.js +1 -0
  283. package/dist/web/televet/booking/index.cjs +1 -0
  284. package/dist/web/televet/booking/index.d.cts +7 -6
  285. package/dist/web/televet/booking/index.d.ts +7 -6
  286. package/dist/web/televet/booking/index.js +1 -0
  287. package/dist/web/televet/call/index.cjs +1 -0
  288. package/dist/web/televet/call/index.d.cts +1 -0
  289. package/dist/web/televet/call/index.d.ts +1 -0
  290. package/dist/web/televet/call/index.js +1 -0
  291. package/dist/web/televet/index.cjs +1 -0
  292. package/dist/web/televet/index.d.cts +1 -0
  293. package/dist/web/televet/index.d.ts +1 -0
  294. package/dist/web/televet/index.js +1 -0
  295. package/dist/web/texting/index.cjs +2 -1
  296. package/dist/web/texting/index.d.cts +9 -6
  297. package/dist/web/texting/index.d.ts +9 -6
  298. package/dist/web/texting/index.js +2 -1
  299. package/package.json +10 -5
  300. package/LICENSE +0 -21
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
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 */
1
2
  "use strict";var zod=require("zod"),react=require("react"),reactNativeSafeAreaContext=require("react-native-safe-area-context"),EventSource=require("react-native-sse"),reactNative=require("react-native"),jsxRuntime=require("react/jsx-runtime"),bookingExperience=require("@everfur/sdk/televet/booking"),texting=require("@everfur/sdk/texting");function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=="default"){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}})}})}n.default=e;return Object.freeze(n)}var EventSource__default=/*#__PURE__*/_interopDefault(EventSource);var bookingExperience__namespace=/*#__PURE__*/_interopNamespace(bookingExperience);var texting__namespace=/*#__PURE__*/_interopNamespace(texting);function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function serverLength(value){return[...value].length}function ok(value,warning){/* @__PURE__ */
2
3
  return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
3
4
  return Object.freeze({ok:false,error:error})}function isOk(r){return r.ok}function isErr(r){return!r.ok}var EverfurThrownError=class _EverfurThrownError extends Error{constructor(error){super(`${error.code}: ${error.displayMessage}`),this.name="EverfurThrownError",this.error=error,this.code=error.code,this.category=error.category,Object.setPrototypeOf(this,_EverfurThrownError.prototype)}};function unwrap(r){if(r.ok)return r.value;throw new EverfurThrownError(r.error)}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var MAX_USER_REF_LEN=128,MAX_PET_REF_LEN=128,CONTROL_CHAR=/[\u0000-\u001F\u007F]/,UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function petRef(raw){let v=raw,length=serverLength(v);if(length===0||length>MAX_PET_REF_LEN)throw new EverfurConfigError("invalid-argument",`petRef must be 1..${MAX_PET_REF_LEN} characters`);if(CONTROL_CHAR.test(v))throw new EverfurConfigError("invalid-argument","petRef must be printable (no control characters)");return v}function userRef(raw){let v=raw,length=serverLength(v);if(length===0||length>MAX_USER_REF_LEN)throw new EverfurConfigError("invalid-argument",`userRef must be 1..${MAX_USER_REF_LEN} characters`);if(v.includes("@"))throw new EverfurConfigError("invalid-argument","userRef must not contain '@'");if(CONTROL_CHAR.test(v))throw new EverfurConfigError("invalid-argument","userRef must be printable (no control characters)");return v}function conversationId(raw){if(!UUID_RE.test(raw))throw new EverfurConfigError("invalid-argument","conversationId must be a UUID");return raw}var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
@@ -102,7 +103,7 @@ return Object.freeze({kind:"done",terminal:true,conversationId:fields.conversati
102
103
  return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:fields.serverRequestId??null})}function analysisStartedFrame(requestId,lastEventId,serverRequestId=null){/* @__PURE__ */
103
104
  return Object.freeze({kind:"analysisStarted",requestId:requestId,lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}function analysisCompleteFrame(fields,serverRequestId=null){/* @__PURE__ */
104
105
  return Object.freeze({kind:"analysisComplete",terminal:false,resultId:fields.resultId,analysisType:fields.analysisType,modelVersion:fields.modelVersion,confidence:fields.confidence,detections:/* @__PURE__ */Object.freeze([...fields.detections]),interpretation:fields.interpretation,lastEventId:fields.lastEventId,serverRequestId:serverRequestId})}function unknownFrame(raw,lastEventId,serverRequestId=null){/* @__PURE__ */
105
- return Object.freeze({kind:"unknown",raw:{...raw},lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}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 createIdentityProvider(userRef2,getToken,onMinted,onRejected){let cached=null,rejectionReported=false,inFlight3=null,revoked=false,load=()=>inFlight3||(inFlight3=(async()=>{try{let minted=await getToken(),token=typeof minted=="string"?minted:minted?.token;if(typeof token!="string"||token.length===0)throw new EverfurConfigError("invalid-argument","TokenProvider returned an empty token");return cached=token,rejectionReported=!1,onMinted?.(typeof minted=="string"?null:expiryMs(minted.expiresAt)),token}finally{inFlight3=null}})(),inFlight3);return{userRef:userRef2,async currentToken(opts){if(revoked)throw new EverfurConfigError("not-initialized","This identity was cleared (sign-out); mint a new one.");return opts?.forceRefresh&&(cached=null),cached!==null?cached:load()},hasToken(){return!revoked&&cached!==null},clear(){revoked=true,cached=null},reportRejected(){revoked||rejectionReported||(rejectionReported=true,onRejected?.())}}}function expiryMs(value){if(value===void 0)return null;let ms=typeof value=="number"?value<1e11?value*1e3:value:new Date(value).getTime();return Number.isFinite(ms)?ms:null}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}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}var DAILY_QUOTA_WIRE_CODE="DAILY_QUOTA_EXCEEDED",THROTTLES=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function foldDailyQuotaWireCode(code,body){if(!THROTTLES.has(code.toUpperCase().replace(/[^A-Z0-9]/g,"")))return code;let b=body,limit=b?.daily_limit??b?.error?.daily_limit;return typeof limit=="number"&&Number.isFinite(limit)?DAILY_QUOTA_WIRE_CODE:code}var BLOCK_SEPARATOR=`\n\n`,MAX_PENDING_BLOCK_CHARS=1048576,wireObjectSchema=/* @__PURE__ */zod.z.record(/* @__PURE__ */zod.z.string(),/* @__PURE__ */zod.z.unknown()),URGENCY_LEVELS=["emergency","schedule_soon","home_care"];async function*parseSse(bytes,serverRequestId=null){let resolvedRequestId=null,requestIdNow=()=>(resolvedRequestId!==null||(resolvedRequestId=typeof serverRequestId=="function"?serverRequestId():serverRequestId),resolvedRequestId),decoder=new TextDecoder("utf-8"),buffer="",scanFrom=0,sawDelta=false;for await(let chunk of bytes){for(buffer+=decoder.decode(chunk,{stream:true});;){let sep=buffer.indexOf(BLOCK_SEPARATOR,scanFrom);if(sep===-1)break;let block=buffer.slice(0,sep);buffer=buffer.slice(sep+BLOCK_SEPARATOR.length),scanFrom=0;let frame=parseBlock(block,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}if(scanFrom=buffer.length>0?buffer.length-1:0,buffer.length>MAX_PENDING_BLOCK_CHARS){yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()});return}}if(buffer+=decoder.decode(),buffer.trim().length>0){let frame=parseBlock(buffer,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()})}function parseBlock(block,serverRequestId){let id=null,dataLines=[];for(let rawLine of block.split(`\n`)){let line=rawLine.replace(/\s+$/,"");line.length===0||line.startsWith(":")||(line.startsWith("id:")?id=line.slice(3).trim():line.startsWith("data:")&&dataLines.push(line.slice(5).replace(/^ /,"")))}if(dataLines.length===0)return null;let decoded;try{decoded=JSON.parse(dataLines.join(`\n`))}catch{return null}if(typeof decoded!="object"||decoded===null||Array.isArray(decoded))return null;let parsed=wireObjectSchema.safeParse(decoded);return parsed.success?frameFromWire(parsed.data,id,serverRequestId):null}function frameFromWire(json,lastEventId,serverRequestId){let type=json.type,event=json.event;if(type==="error"||"error"in json)return errorFrame({code:asString(json.code)??"unknown",retryable:json.retryable===true,wireMessage:asString(json.error),synthesized:false,lastEventId:lastEventId,serverRequestId:serverRequestId});if(type==="done"||json.done===true)return doneFrame({conversationId:asString(json.conversation_id)??"",messageId:asString(json.message_id),title:asString(json.title),followUpQuestions:asStringList(json.follow_up_questions),citations:asMapList(json.citations),citationStatus:asString(json.citation_status),urgencyLevel:asUrgency(json.urgency_level),urgencyReason:asString(json.urgency_reason),urgencyProvided:urgencySlotProvided(json),resultId:asString(json.result_id),lastEventId:lastEventId},serverRequestId);if(type==="accepted"||json.status==="reasoning")return acceptedFrame(asString(json.stream_id),lastEventId,serverRequestId);if(type==="heartbeat"||json.heartbeat===true)return heartbeatFrame(lastEventId,serverRequestId);if(type==="text.delta"||"delta"in json||"token"in json){let delta=asString(json.delta)??asString(json.token)??"";return deltaFrame(delta,lastEventId,serverRequestId)}return event==="analysis_started"?analysisStartedFrame(asString(json.request_id),lastEventId,serverRequestId):event==="analysis_complete"?analysisCompleteFrame({resultId:asString(json.result_id),analysisType:asString(json.analysis_type),modelVersion:asString(json.model_version),confidence:asNumber(json.confidence),detections:asMapList(json.detections),interpretation:asString(json.interpretation),lastEventId:lastEventId},serverRequestId):unknownFrame(json,lastEventId,serverRequestId)}function asString(v){return typeof v=="string"?v:null}function asNumber(v){return typeof v=="number"&&Number.isFinite(v)?v:null}function asUrgency(v){return typeof v=="string"&&URGENCY_LEVELS.includes(v)?v:null}function urgencySlotProvided(json){if(!Object.prototype.hasOwnProperty.call(json,"urgency_level"))return false;let raw=json.urgency_level;return raw===null||asUrgency(raw)!==null}function asStringList(v){return Array.isArray(v)?v.map(e=>typeof e=="string"?e:String(e)):[]}function isPlainObject(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function asMapList(v){return Array.isArray(v)?v.filter(isPlainObject):[]}var SDK_VERSION="0.15.0",SDK_PLATFORM="react-native",DEFAULT_CONTRACT_VERSION="2026-09-19",ENV_API_BASE_URL="EVERFUR_API_BASE_URL";function configFailure(reason,message){/* @__PURE__ */
106
+ return Object.freeze({kind:"unknown",raw:{...raw},lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}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 createIdentityProvider(userRef2,getToken,onMinted,onRejected){let cached=null,rejectionReported=false,inFlight3=null,revoked=false,load=()=>inFlight3||(inFlight3=(async()=>{try{let minted=await getToken(),token=typeof minted=="string"?minted:minted?.token;if(typeof token!="string"||token.length===0)throw new EverfurConfigError("invalid-argument","TokenProvider returned an empty token");return cached=token,rejectionReported=!1,onMinted?.(typeof minted=="string"?null:expiryMs(minted.expiresAt)),token}finally{inFlight3=null}})(),inFlight3);return{userRef:userRef2,async currentToken(opts){if(revoked)throw new EverfurConfigError("not-initialized","This identity was cleared (sign-out); mint a new one.");return opts?.forceRefresh&&(cached=null),cached!==null?cached:load()},hasToken(){return!revoked&&cached!==null},clear(){revoked=true,cached=null},reportRejected(){revoked||rejectionReported||(rejectionReported=true,onRejected?.())}}}function expiryMs(value){if(value===void 0)return null;let ms=typeof value=="number"?value<1e11?value*1e3:value:new Date(value).getTime();return Number.isFinite(ms)?ms:null}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}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}var DAILY_QUOTA_WIRE_CODE="DAILY_QUOTA_EXCEEDED",THROTTLES=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function foldDailyQuotaWireCode(code,body){if(!THROTTLES.has(code.toUpperCase().replace(/[^A-Z0-9]/g,"")))return code;let b=body,limit=b?.daily_limit??b?.error?.daily_limit;return typeof limit=="number"&&Number.isFinite(limit)?DAILY_QUOTA_WIRE_CODE:code}var BLOCK_SEPARATOR=`\n\n`,MAX_PENDING_BLOCK_CHARS=1048576,wireObjectSchema=/* @__PURE__ */zod.z.record(/* @__PURE__ */zod.z.string(),/* @__PURE__ */zod.z.unknown()),URGENCY_LEVELS=["emergency","schedule_soon","home_care"];async function*parseSse(bytes,serverRequestId=null){let resolvedRequestId=null,requestIdNow=()=>(resolvedRequestId!==null||(resolvedRequestId=typeof serverRequestId=="function"?serverRequestId():serverRequestId),resolvedRequestId),decoder=new TextDecoder("utf-8"),buffer="",scanFrom=0,sawDelta=false;for await(let chunk of bytes){for(buffer+=decoder.decode(chunk,{stream:true});;){let sep=buffer.indexOf(BLOCK_SEPARATOR,scanFrom);if(sep===-1)break;let block=buffer.slice(0,sep);buffer=buffer.slice(sep+BLOCK_SEPARATOR.length),scanFrom=0;let frame=parseBlock(block,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}if(scanFrom=buffer.length>0?buffer.length-1:0,buffer.length>MAX_PENDING_BLOCK_CHARS){yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()});return}}if(buffer+=decoder.decode(),buffer.trim().length>0){let frame=parseBlock(buffer,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()})}function parseBlock(block,serverRequestId){let id=null,dataLines=[];for(let rawLine of block.split(`\n`)){let line=rawLine.replace(/\s+$/,"");line.length===0||line.startsWith(":")||(line.startsWith("id:")?id=line.slice(3).trim():line.startsWith("data:")&&dataLines.push(line.slice(5).replace(/^ /,"")))}if(dataLines.length===0)return null;let decoded;try{decoded=JSON.parse(dataLines.join(`\n`))}catch{return null}if(typeof decoded!="object"||decoded===null||Array.isArray(decoded))return null;let parsed=wireObjectSchema.safeParse(decoded);return parsed.success?frameFromWire(parsed.data,id,serverRequestId):null}function frameFromWire(json,lastEventId,serverRequestId){let type=json.type,event=json.event;if(type==="error"||"error"in json)return errorFrame({code:asString(json.code)??"unknown",retryable:json.retryable===true,wireMessage:asString(json.error),synthesized:false,lastEventId:lastEventId,serverRequestId:serverRequestId});if(type==="done"||json.done===true)return doneFrame({conversationId:asString(json.conversation_id)??"",messageId:asString(json.message_id),title:asString(json.title),followUpQuestions:asStringList(json.follow_up_questions),citations:asMapList(json.citations),citationStatus:asString(json.citation_status),urgencyLevel:asUrgency(json.urgency_level),urgencyReason:asString(json.urgency_reason),urgencyProvided:urgencySlotProvided(json),resultId:asString(json.result_id),lastEventId:lastEventId},serverRequestId);if(type==="accepted"||json.status==="reasoning")return acceptedFrame(asString(json.stream_id),lastEventId,serverRequestId);if(type==="heartbeat"||json.heartbeat===true)return heartbeatFrame(lastEventId,serverRequestId);if(type==="text.delta"||"delta"in json||"token"in json){let delta=asString(json.delta)??asString(json.token)??"";return deltaFrame(delta,lastEventId,serverRequestId)}return event==="analysis_started"?analysisStartedFrame(asString(json.request_id),lastEventId,serverRequestId):event==="analysis_complete"?analysisCompleteFrame({resultId:asString(json.result_id),analysisType:asString(json.analysis_type),modelVersion:asString(json.model_version),confidence:asNumber(json.confidence),detections:asMapList(json.detections),interpretation:asString(json.interpretation),lastEventId:lastEventId},serverRequestId):unknownFrame(json,lastEventId,serverRequestId)}function asString(v){return typeof v=="string"?v:null}function asNumber(v){return typeof v=="number"&&Number.isFinite(v)?v:null}function asUrgency(v){return typeof v=="string"&&URGENCY_LEVELS.includes(v)?v:null}function urgencySlotProvided(json){if(!Object.prototype.hasOwnProperty.call(json,"urgency_level"))return false;let raw=json.urgency_level;return raw===null||asUrgency(raw)!==null}function asStringList(v){return Array.isArray(v)?v.map(e=>typeof e=="string"?e:String(e)):[]}function isPlainObject(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function asMapList(v){return Array.isArray(v)?v.filter(isPlainObject):[]}var SDK_VERSION="0.15.1",SDK_PLATFORM="react-native",DEFAULT_CONTRACT_VERSION="2026-09-19",ENV_API_BASE_URL="EVERFUR_API_BASE_URL";function configFailure(reason,message){/* @__PURE__ */
106
107
  return Object.freeze({ok:false,failure:/* @__PURE__ */Object.freeze({reason:reason,message:message})})}function checkPublishableKey(raw){let publishableKey=typeof raw=="string"?raw.trim():"";return publishableKey.length===0?{reason:"missing-publishable-key",message:"publishableKey is required"}:/^sk[_-]/i.test(publishableKey)?{reason:"secret-key-as-publishable-key",message:"publishableKey looks like a SECRET key (sk_...). A device must never hold a partner secret key: use the pk_ publishable key here, and keep the secret key on your server."}:null}function tryResolveClientConfig(config,options){let keyFailure=checkPublishableKey(config?.publishableKey);if(keyFailure!==null)/* @__PURE__ */
107
108
  return Object.freeze({ok:false,failure:keyFailure});let publishableKey=config.publishableKey.trim(),baseUrl=tryResolveApiBaseUrl(config.apiBaseUrl);if(!baseUrl.ok)return baseUrl;let contractVersion=config.contractVersion?.trim()||DEFAULT_CONTRACT_VERSION;/* @__PURE__ */
108
109
  return Object.freeze({ok:true,config:/* @__PURE__ */Object.freeze({publishableKey:publishableKey,apiBaseUrl:baseUrl.value,contractVersion:contractVersion,sdkVersion:SDK_VERSION,platform:options?.platform??SDK_PLATFORM,debug:config.debug===true})})}function tryResolveApiBaseUrl(apiBaseUrl){let explicit=apiBaseUrl?.trim(),candidate=explicit&&explicit.length>0?explicit:readEnv(ENV_API_BASE_URL);return candidate?normalizeBaseUrl(candidate):configFailure("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${ENV_API_BASE_URL}. The SDK never ships a hardcoded host.`)}function buildBaseHeaders(cfg){return{"X-Everfur-SDK-Version":cfg.sdkVersion,"X-Everfur-SDK-Platform":cfg.platform,"X-Everfur-Contract":cfg.contractVersion}}var ABSOLUTE_URL=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/;function hostOf(authority){return authority.slice(authority.lastIndexOf("@")+1).replace(/:\d+$/,"").toLowerCase()}function isPrintableHost(host){return host.length===0||host.includes("@")?false:host.startsWith("[")&&host.endsWith("]")?true:!host.includes(":")}function canEchoOrigin(rawTrimmed,host){let schemeEnd=rawTrimmed.indexOf("://");return schemeEnd<0||rawTrimmed.slice(schemeEnd+3).includes("@")?false:isPrintableHost(host)}function safeOrigin(scheme,host){return`${scheme}://${host}`}function normalizeBaseUrl(raw){let trimmed=raw.trim(),match=ABSOLUTE_URL.exec(trimmed);if(match===null||match[2]===void 0||match[2].length===0)return configFailure("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let scheme=(match[1]??"").toLowerCase(),host=hostOf(match[2]);if(host.length===0)return configFailure("malformed-api-base-url","apiBaseUrl is not a valid absolute URL");let shown=canEchoOrigin(trimmed,host)?`: ${safeOrigin(scheme,host)}`:"";if(scheme!=="https"){if(!(scheme==="http"&&isLoopbackHost(host)))return scheme==="http"?configFailure("insecure-api-base-url",`apiBaseUrl must use https (cleartext http is only allowed for localhost)${shown}`):configFailure("unsupported-api-base-url-scheme",`apiBaseUrl must be http(s)${shown}`)}let value=trimmed.endsWith("/")?trimmed.slice(0,-1):trimmed;/* @__PURE__ */
@@ -142,7 +143,6 @@ return jsxRuntime.jsx(reactNative.View,{style:[styles2.offstate,style],accessibl
142
143
  /* @__PURE__ */Object.freeze({key:"unclear",label:CHAT_COPY.feedbackReasonUnclear,feedbackType:"unclear"}),
143
144
  /* @__PURE__ */Object.freeze({key:"other",label:CHAT_COPY.feedbackReasonOther,feedbackType:"not_helpful"})]),SENTIMENT_OPTIONS=/* @__PURE__ */Object.freeze([
144
145
  /* @__PURE__ */Object.freeze({sentiment:"up",label:CHAT_COPY.feedbackHelpful}),
145
- /* @__PURE__ */Object.freeze({sentiment:"neutral",label:CHAT_COPY.feedbackNeutral}),
146
146
  /* @__PURE__ */Object.freeze({sentiment:"down",label:CHAT_COPY.feedbackNotHelpful})]);function sentimentToFeedbackType(sentiment){switch(sentiment){case"up":return"helpful";case"neutral":return"neutral";case"down":return"not_helpful"}}function feedbackTypeFor(sentiment,reason){if(sentiment==="down"&&reason!==null){let option=FEEDBACK_REASONS.find(entry=>entry.key===reason);if(option!==void 0)return option.feedbackType}return sentimentToFeedbackType(sentiment)}var NOT_READY=/* @__PURE__ */new WeakSet;function chatNotReadyResult(){let error=makeEverfurError("internalError",{retryable:true});return NOT_READY.add(error),err(error)}function isChatNotReadyResult(result){if(typeof result!="object"||result===null||result.ok!==false)return false;let error=result.error;return typeof error=="object"&&error!==null&&NOT_READY.has(error)}function useStalePetHold(runtime,userRef2,petRef2,scopeEpoch){let[owner,setOwner]=react.useState({pet:petRef2,user:userRef2}),adopt=owner.pet!==petRef2||owner.user===null&&userRef2!==null;adopt&&setOwner({pet:petRef2,user:userRef2});let current=adopt?{user:userRef2}:owner,held=petRef2!==null&&current.user!==null&&current.user!==userRef2;return react.useEffect(()=>{if(!held||userRef2===null||petRef2===null)return;let live=true,repository=createPetsRepository(runtime.registry.services.authFor(userRef2)),check=async()=>{let listed=await repository.list();live&&listed.ok&&listed.value.some(pet=>pet.petRef===petRef2)&&setOwner({pet:petRef2,user:userRef2})};check();let unsubscribe=subscribePetsChanged(runtime,()=>{check()});return()=>{live=false,unsubscribe()}},[held,runtime,userRef2,petRef2,scopeEpoch]),held}var BOOTSTRAP_SNAPSHOT=/* @__PURE__ */Object.freeze({status:"idle",messages:/* @__PURE__ */Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:/* @__PURE__ */Object.freeze([]),unreadCount:null});function useEverfurChat(opts){let{runtime:runtime,userRef:userRef2,activePet:activePet,scopeEpoch:scopeEpoch}=useEverfurContext(),petRef2=opts?.petRef??activePet??null,conversationId2=opts?.conversationId??null,held=useStalePetHold(runtime,userRef2,petRef2,scopeEpoch),scope=react.useMemo(()=>({runtime:runtime,userRef:userRef2,petRef:petRef2,conversationId:conversationId2,scopeEpoch:scopeEpoch,held:held}),[runtime,userRef2,petRef2,conversationId2,scopeEpoch,held]),[binding,setBinding]=react.useState(null),controller=held?null:binding?.scope===scope?binding.controller:runtime.registry.peekChat({userRef:userRef2,petRef:petRef2,conversationId:conversationId2}),active=react.useRef(null);react.useEffect(()=>{if(held)return;let acquired=runtime.registry.acquireChat({userRef:userRef2,petRef:petRef2,conversationId:conversationId2});return active.current=acquired,setBinding({scope:scope,controller:acquired}),()=>{active.current=null,setBinding(current=>current?.controller===acquired?null:current),runtime.registry.releaseChat(acquired)}},[runtime,userRef2,petRef2,conversationId2,scopeEpoch,held,scope]);let subscribe2=react.useCallback(onChange=>controller?controller.subscribe(onChange):NOOP_UNSUBSCRIBE,[controller]),getSnapshot=react.useCallback(()=>controller?controller.getSnapshot():BOOTSTRAP_SNAPSHOT,[controller]),snapshot2=react.useSyncExternalStore(subscribe2,getSnapshot,getSnapshot),send=react.useCallback((text3,opts2)=>controller&&active.current===controller&&!controller.getSnapshot().isBootstrapping?driveToResult(controller,controller.send(text3,opts2?.imageS3Keys===void 0?{}:{imageS3Keys:opts2.imageS3Keys}),()=>active.current===controller):Promise.resolve(notReadyError()),[controller]),askEverfur=react.useCallback(prompt=>controller&&active.current===controller&&!controller.getSnapshot().isBootstrapping?driveToResult(controller,controller.askEverfur(prompt),()=>active.current===controller):Promise.resolve(notReadyError()),[controller]),retryLast=react.useCallback(()=>controller&&active.current===controller?driveToResult(controller,controller.retryLast(),()=>active.current===controller):Promise.resolve(notReadyError()),[controller]),stop=react.useCallback(()=>{controller&&active.current===controller&&controller.stop()},[controller]),newConversation=react.useCallback(()=>{controller&&active.current===controller&&controller.newConversation()},[controller]),[ratings,setRatings]=react.useState({controller:null,byMessage:{}}),sentimentByMessage=ratings.controller===controller?ratings.byMessage:EMPTY_RATINGS,feedback=react.useCallback(async(responseId,sentiment,reason,notes)=>{if(!controller||active.current!==controller)return err(makeEverfurError("accessDenied"));let key=String(responseId),previous=ratings.controller===controller?ratings.byMessage[key]:void 0;if(previous===sentiment&&reason==null)return setRatings(current=>{let rest={...current.controller===controller?current.byMessage:{}};return delete rest[key],{controller:controller,byMessage:rest}}),ok(/* @__PURE__ */Object.freeze({feedbackId:""}));setRatings(current=>({controller:controller,byMessage:{...current.controller===controller?current.byMessage:{},[key]:sentiment}}));let result=await controller.submitFeedback(responseId,feedbackTypeFor(sentiment,reason??null),notes??null);return active.current!==controller?err(makeEverfurError("accessDenied")):(result.ok||setRatings(current=>{let rest={...current.controller===controller?current.byMessage:{}};return previous===void 0?delete rest[key]:rest[key]=previous,{controller:controller,byMessage:rest}}),result)},[controller,ratings]),history=react.useMemo(()=>{let run=async operation=>{if(!controller||active.current!==controller)return err(makeEverfurError("accessDenied"));let result=await operation(controller);return active.current===controller?result:err(makeEverfurError("accessDenied"))};return{listConversations:options=>run(current=>current.listConversations({...petRef2?{petRef:petRef2}:{},...options})),getMessages:(id,options)=>run(current=>current.getMessages(id,options)),resumeConversation:id=>run(current=>current.resumeConversation(id)),loadOlderMessages:()=>run(current=>current.loadOlderMessages()),markRead:()=>run(current=>current.markRead()),refreshActiveThread:()=>run(current=>current.refreshActiveThread()),answerCheckin:(caseId,answer)=>run(current=>current.answerCheckin(caseId,answer)),openCheckin:target=>run(current=>current.openCheckin(target))}},[controller,petRef2]);return react.useMemo(()=>({status:snapshot2.status,messages:snapshot2.messages,conversationId:snapshot2.conversationId,petRef:petRef2,error:snapshot2.error,isStreaming:snapshot2.isStreaming,isBootstrapping:snapshot2.isBootstrapping,historyCursor:snapshot2.historyCursor??null,isLoadingHistory:snapshot2.isLoadingHistory??false,stopped:snapshot2.stopped??false,reconnecting:snapshot2.reconnecting??false,...history,suggestedPrompts:snapshot2.suggestedPrompts,unreadCount:snapshot2.unreadCount,hasUnreadThreads:snapshot2.hasUnreadThreads??false,newConversation:newConversation,sentimentByMessage:sentimentByMessage,feedback:feedback,send:send,askEverfur:askEverfur,retryLast:retryLast,stop:stop}),[snapshot2,petRef2,send,askEverfur,retryLast,stop,history,newConversation,sentimentByMessage,feedback])}var NOOP_UNSUBSCRIBE=()=>{},EMPTY_RATINGS=/* @__PURE__ */Object.freeze({});async function driveToResult(controller,iterable,current){for await(let _frame of iterable);if(!current())return err(makeEverfurError("accessDenied"));let snapshot2=controller.getSnapshot();return snapshot2.status==="error"&&snapshot2.error!==null?err(snapshot2.error):ok(lastAssistantResponseId(snapshot2.messages))}function lastAssistantResponseId(messages){for(let i=messages.length-1;i>=0;i-=1){let message=messages[i];if(message&&message.role==="assistant"&&message.responseId!==void 0)return message.responseId}return null}function notReadyError(){return chatNotReadyResult()}var REF_MAX2=128;var ICONS=/* @__PURE__ */new Set(["shield","arrow","check","star","truck","refresh","card","alert","x","chat","repeat","calendar","flame","box","cart","minus","plus","chev","pulse","file","kit","dna","heart","bottle","harness","ramp"]),TONES=/* @__PURE__ */new Set(["y","c","g","r"]),TRACK_STATES=/* @__PURE__ */new Set(["done","now","next"]),obj=value=>value!==null&&typeof value=="object"&&!Array.isArray(value)?value:null,str4=(value,max=1e3)=>typeof value=="string"&&value.trim().length>0&&value.length<=max?value.trim():null,kindOf=value=>typeof value=="string"&&/^[A-Za-z0-9_-]{1,40}$/.test(value)?value:null,iconOf=value=>typeof value=="string"&&ICONS.has(value)?value:null;function imageOf(value){let s=str4(value,2048);return s===null||/\s/.test(s)?null:/^https:\/\/[^/]/i.test(s)||/^\/(?![/\\])/.test(s)?s:null}var idOf=value=>typeof value=="number"&&Number.isInteger(value)?String(value):str4(value,REF_MAX2);function weightOf(value){return typeof value=="number"&&Number.isFinite(value)&&value>0?value:null}function clean(fields){/* @__PURE__ */
147
147
  return Object.freeze(Object.fromEntries(Object.entries(fields).filter(([,v])=>v!=null)))}function listOf(value,each,max=20){if(!Array.isArray(value))return null;let out=[];for(let row of value){if(out.length>=max)break;let mapped=each(row);mapped!==null&&out.push(mapped)}return out.length===0?null:/* @__PURE__ */Object.freeze(out)}var words=(value,max=12,len=300)=>listOf(value,v=>str4(v,len),max);function focusOf(value){let o=obj(value),kicker=str4(o?.kicker,120),title=str4(o?.title,300);if(o===null||kicker===null||title===null)return null;let risk=obj(o.risk),odds=obj(o.odds),quote=obj(o.quote),jump=obj(o.jump);return clean({kicker:kicker,title:title,sources:listOf(o.sources,r=>{let label=str4(obj(r)?.label,60);return label===null?null:clean({label:label,kind:kindOf(obj(r)?.kind)})},6),risk:str4(risk?.lead,300)===null?null:clean({lead:str4(risk?.lead,300),body:str4(risk?.body),kind:kindOf(risk?.kind)}),odds:str4(odds?.label,120)===null||str4(odds?.from,20)===null||str4(odds?.to,20)===null?null:clean({label:str4(odds?.label,120),tag:str4(odds?.tag,40),from:str4(odds?.from,20),to:str4(odds?.to,20),toLabel:str4(odds?.toLabel,120)}),quote:str4(quote?.text)===null?null:clean({kicker:str4(quote?.kicker,120),tag:str4(quote?.tag,40),text:str4(quote?.text)}),jump:str4(jump?.title,300)===null||str4(jump?.go,60)===null?null:clean({title:str4(jump?.title,300),go:str4(jump?.go,60)})})}function routineOf(value){let o=obj(value),title=str4(o?.title,300),steps=listOf(o?.steps,r=>{let s=obj(r),t=str4(s?.title,300),tone=s?.tone;return t===null?null:clean({title:t,body:str4(s?.body),source:str4(s?.source,200),tone:typeof tone=="string"&&TONES.has(tone)?tone:null,icon:iconOf(s?.icon),fromVet:s?.fromVet===true?true:null})});return title===null||steps===null?null:clean({title:title,label:str4(o?.label,60),steps:steps})}function pickOf(value){let o=obj(value),title=str4(o?.title,300);if(o===null||title===null)return null;let rating=obj(o.rating),reviews=obj(o.reviews),why=obj(o.why),score=obj(why?.score),dose=obj(o.dose),ingredients=obj(o.ingredients),reviewItems=listOf(reviews?.items,r=>{let v=obj(r),stars=v?.stars,text3=str4(v?.text),by=str4(v?.by,80);return typeof stars!="number"||!Number.isFinite(stars)||stars<1||stars>5||text3===null||by===null?null:clean({stars:Math.round(stars),text:text3,by:by})},5),whyRows=listOf(why?.rows,r=>{let v=obj(r),chip=str4(v?.chip,40),t=str4(v?.title,300);return chip===null||t===null?null:clean({chip:chip,kind:kindOf(v?.kind),title:t,body:str4(v?.body)})}),stats=listOf(dose?.stats,r=>{let v=obj(r),val=str4(v?.value,40),label=str4(v?.label,120),kind=v?.kind;return val===null||label===null?null:clean({value:val,label:label,kind:kind==="weight"||kind==="dose"||kind==="days"?kind:null})},6),ingredientItems=words(ingredients?.items,12,80);return clean({title:title,none:o.none===true?true:null,hidden:o.none===true&&o.hidden===true?true:null,productId:idOf(o.productId),partnerSku:str4(o.partnerSku,200),rating:str4(rating?.value,20)===null?null:clean({value:str4(rating?.value,20),label:str4(rating?.label,120)}),line:str4(o.line),reviews:str4(reviews?.label,200)===null||reviewItems===null?null:clean({label:str4(reviews?.label,200),items:reviewItems}),checkoutLine:str4(o.checkoutLine,300),why:str4(why?.title,200)===null||whyRows===null?null:clean({title:str4(why?.title,200),rows:whyRows,score:str4(score?.text,200)===null||str4(score?.value,20)===null?null:clean({text:str4(score?.text,200),value:str4(score?.value,20)})}),dose:str4(dose?.title,200)===null||stats===null?null:clean({title:str4(dose?.title,200),stats:stats,note:str4(dose?.note)}),doseLabel:str4(o.doseLabel,120),ingredients:ingredientItems===null?null:clean({label:str4(ingredients?.label,200),items:ingredientItems}),proof:str4(o.proof,300),trust:listOf(o.trust,r=>{let v=obj(r),icon=iconOf(v?.icon),label=str4(v?.label,120);return icon===null||label===null?null:clean({icon:icon,label:label})},6),more:str4(o.more,120),fine:str4(o.fine),checkin:str4(o.checkin,200)})}function signsOf(value){let o=obj(value),title=str4(o?.title,200),items=listOf(o?.items,r=>{let v=obj(r),t=str4(v?.title,300),body=str4(v?.body);return t===null||body===null?null:clean({title:t,body:body,urgent:v?.urgent===true?true:null,callVet:v?.callVet===true?true:null})});return title===null||items===null?null:clean({title:title,items:items})}function checkupOf(value){let o=obj(value),title=str4(o?.title,200),questions=words(o?.questions,12,300),add=str4(o?.add,80),added=str4(o?.added,80);return title===null||questions===null||add===null||added===null?null:clean({title:title,questions:questions,add:add,added:added})}function extrasOf(value){let o=obj(value),title=str4(o?.title,200),items=listOf(o?.items,r=>{let v=obj(r),key=str4(v?.key,REF_MAX2),t=str4(v?.title,300),action=str4(v?.action,80),productId=idOf(v?.productId),added=str4(v?.added,80)??(productId!==null?action:null);return key===null||t===null||action===null||added===null?null:clean({key:key,productId:productId,title:t,body:str4(v?.body),price:str4(v?.price,40),was:str4(v?.was,40),tag:str4(v?.tag,40),imageUrl:imageOf(v?.imageUrl),icon:iconOf(v?.icon),kind:kindOf(v?.kind),action:action,added:added,owned:v?.owned===true?true:null})},6);return title===null||items===null?null:clean({title:title,items:items})}function waitOf(value){let o=obj(value),kicker=str4(o?.kicker,120),title=str4(o?.title,120);return o===null||kicker===null||title===null?null:clean({kicker:kicker,title:title,icon:iconOf(o.icon),track:listOf(o.track,r=>{let v=obj(r),t=str4(v?.title,120),state=v?.state;return t===null?null:clean({title:t,detail:str4(v?.detail,120),state:typeof state=="string"&&TRACK_STATES.has(state)?state:null,tag:str4(v?.tag,40)})},6),heading:str4(o.heading,200),rows:listOf(o.rows,r=>{let v=obj(r),icon=iconOf(v?.icon),label=str4(v?.label,120);if(icon===null||label===null)return null;if(v?.fromVet===true)return clean({icon:icon,label:label,text:"",fromVet:true});let text3=str4(v?.text,300);return text3===null?null:clean({icon:icon,label:label,text:text3})},6),note:str4(o.note,300),action:str4(o.action,80)})}function healthPlanFocusDesignFromWire(raw){let o=obj(raw),title=str4(o?.title,300),pick5=pickOf(o?.pick);if(o===null||title===null||pick5===null)return null;let byline=obj(o.byline);return clean({eyebrow:str4(o.eyebrow,120),title:title,subtitle:str4(o.subtitle,300),subtitleNoRecords:str4(o.subtitleNoRecords,300),headImageUrl:imageOf(o.headImageUrl),byline:str4(byline?.name,120)===null?null:clean({name:str4(byline?.name,120),role:str4(byline?.role,120),imageUrl:imageOf(byline?.imageUrl),shortName:str4(byline?.shortName,60)}),focus:focusOf(o.focus),routine:routineOf(o.routine),pick:pick5,signs:signsOf(o.signs),checkup:checkupOf(o.checkup),extras:extrasOf(o.extras),wait:waitOf(o.wait),fine:str4(o.fine),checkoutRows:listOf(o.checkoutRows,r=>{let v=obj(r),icon=iconOf(v?.icon),label=str4(v?.label,60),val=str4(v?.value,200);return icon===null||label===null||val===null?null:clean({icon:icon,label:label,value:val})},6)})}function healthPlanPageFromWire(raw,petRef2){let o=obj(raw);if(o===null||!("page"in o))return null;let pet=obj(o.pet),sex=pet?.sex;/* @__PURE__ */
148
148
  return Object.freeze({petRef:str4(o.pet_ref,REF_MAX2)??petRef2,pet:/* @__PURE__ */Object.freeze({name:str4(pet?.name,120),species:str4(pet?.species,60),sex:sex==="female"||sex==="male"?sex:null,breed:str4(pet?.breed,120),weightKg:weightOf(pet?.weight_kg),weightLb:weightOf(pet?.weight_lb)}),checkout:o.checkout==="everfur_stripe"?"everfur_stripe":"partner",page:healthPlanFocusDesignFromWire(o.page),vetReviewed:o.vet_reviewed===true,trackingTextsEnabled:o.tracking_texts_enabled===true})}function invalid3(wireMessage){return makeEverfurError("validationFailed",{retryable:false,wireMessage:wireMessage})}function malformed4(call){return makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:`${call}: the response was not the expected shape`})}function disposed(verb){return makeEverfurError("runtimeDisposed",{retryable:false,wireMessage:`the Everfur runtime is disposed; ${verb} was called after unmount`})}var validRef=value=>typeof value=="string"&&value.length>0&&value.length<=REF_MAX2;function base(petRef2){return`/widget/v1/pets/${encodeURIComponent(petRef2)}/plan`}async function readPage(funnel,petRef2,opts){if(!validRef(petRef2))return err(invalid3("petRef must be 1..128 characters"));let res=await funnel.send("healthPlan.page.read",{method:"GET",path:`${base(petRef2)}/page`,...opts?.signal?{signal:opts.signal}:{}});if(!res.ok)return err(res.error);let page=healthPlanPageFromWire(res.value,petRef2);return page===null?err(malformed4("healthPlan.page.read")):ok(page)}var readers=/* @__PURE__ */new WeakMap;function createHealthPlanPageReader(runtime){let known=readers.get(runtime);if(known!==void 0)return known;let reader=makeHealthPlanPageReader(runtime);return readers.set(runtime,reader),reader}function makeHealthPlanPageReader(runtime){return{getPage:(petRef2,opts)=>{if(runtime.isDisposed)return Promise.resolve(err(disposed("getPage")));let{services:services}=runtime.registry,funnel=withPlainNotFound(createRequestFunnel({auth:services.authFor(null),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}}));return readPage(funnel,petRef2,opts)}}}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable2(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable2(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function callHostAsync(fn,...args){let started;try{started=fn(...args)}catch(error){return reportHostFailure(error),Promise.resolve({ok:false,error:error})}return Promise.resolve(started).then(value=>({ok:true,value:value}),error=>({ok:false,error:error}))}var HEALTH_PLAN_STALE_MS=6e4;function useHealthPlanRevalidation({lifecycle:lifecycle,refreshKey:refreshKey,readyAt:readyAt,revalidate:revalidate,refresh:refresh,now:now=Date.now}){let latest=react.useRef({readyAt:readyAt,revalidate:revalidate,refresh:refresh??revalidate,now:now});latest.current={readyAt:readyAt,revalidate:revalidate,refresh:refresh??revalidate,now:now},react.useEffect(()=>{if(lifecycle==null)return;let stop=callHost(()=>lifecycle.onForeground(()=>{let{readyAt:at,revalidate:run,now:clock}=latest.current;at!==null&&clock()-at>=HEALTH_PLAN_STALE_MS&&run()}));return()=>{typeof stop=="function"&&callHost(stop)}},[lifecycle]);let seenKey=react.useRef(refreshKey);react.useEffect(()=>{Object.is(seenKey.current,refreshKey)||(seenKey.current=refreshKey,latest.current.refresh())},[refreshKey])}var HEALTH_PLAN_PAGE_SHARE_MS=HEALTH_PLAN_STALE_MS,SHARED_READS_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#HealthPlanPageReads@v1");function sharedReads(){let host=globalThis,stored2=host[SHARED_READS_SYMBOL];if(stored2 instanceof WeakMap)return stored2;let made=/* @__PURE__ */new WeakMap;return host[SHARED_READS_SYMBOL]=made,made}function readShared(reader,runtime,userRef2,petRef2,fresh2){let all=sharedReads(),reads=all.get(runtime);reads===void 0&&(reads=/* @__PURE__ */new Map,all.set(runtime,reads));let map=reads,key=`${userRef2}\0${petRef2}`,hit=map.get(key);if(!fresh2&&hit!==void 0&&(hit.at===null||Date.now()-hit.at<HEALTH_PLAN_PAGE_SHARE_MS))return hit.promise;let entry={at:null,promise:reader.getPage(petRef2).then(res=>(map.get(key)===entry&&(res.ok||isNotFoundError(res.error)?entry.at=Date.now():map.delete(key)),res))};return map.set(key,entry),entry.promise}function useHealthPlanPage(options){let{userRef:userRef2,runtime:runtime}=useEverfurContext(),own=react.useMemo(()=>createHealthPlanPageReader(runtime),[runtime]),hostRepository=options.repository,repository=hostRepository??own,getPage=react.useCallback((pet,fresh2)=>hostRepository!==void 0||userRef2==null?repository.getPage(pet):readShared(own,runtime,userRef2,pet,fresh2),[hostRepository,repository,own,runtime,userRef2]),{petRef:petRef2}=options,enabled=options.enabled!==false&&userRef2!=null&&petRef2!==null,[state,setState]=react.useState({phase:"idle",petRef:null,page:null,error:null}),epoch=react.useRef(0),quiet=react.useRef(0),read=react.useCallback(async fresh2=>{let mine=++epoch.current;if(!enabled||petRef2===null){setState(prev=>prev.phase==="idle"&&prev.petRef===null?prev:{phase:"idle",petRef:null,page:null,error:null});return}setState(prev=>({phase:"loading",petRef:petRef2,page:prev.petRef===petRef2?prev.page:null,error:null}));let res=await getPage(petRef2,fresh2);mine===epoch.current&&(res.ok?setState({phase:"ready",petRef:petRef2,page:res.value,error:null,readyAt:Date.now()}):isNotFoundError(res.error)?setState({phase:"ready",petRef:petRef2,page:null,error:null,missing:true,readyAt:Date.now()}):setState({phase:"failed",petRef:petRef2,page:null,error:res.error}))},[enabled,petRef2,getPage]),load=react.useCallback(()=>read(true),[read]),ready=state.phase==="ready"&&state.petRef===petRef2,revalidate=react.useCallback(async()=>{if(!enabled||petRef2===null||!ready)return;let mine=epoch.current,seq=++quiet.current,res=await getPage(petRef2,true);mine!==epoch.current||seq!==quiet.current||!res.ok||setState(prev=>prev.phase==="ready"&&prev.petRef===petRef2?{phase:"ready",petRef:petRef2,page:res.value,error:null,readyAt:Date.now()}:prev)},[enabled,petRef2,ready,getPage]);useHealthPlanRevalidation({lifecycle:options.lifecycle,refreshKey:options.refreshKey,readyAt:ready?state.readyAt??null:null,revalidate:()=>{revalidate()},refresh:()=>{ready?revalidate():load()}}),react.useEffect(()=>(read(false),()=>{epoch.current+=1}),[read]);let stale=enabled&&state.petRef!==petRef2;return react.useMemo(()=>({phase:stale?"loading":state.phase,page:stale?null:state.page,error:stale?null:state.error,missing:!stale&&state.missing===true,refresh:load}),[stale,state,load])}var NO_SNAPSHOT=/* @__PURE__ */Object.freeze({branding:null}),NO_STORE=/* @__PURE__ */Object.freeze({subscribe:()=>()=>{},getSnapshot:()=>NO_SNAPSHOT});function keyOf(input){return input?Object.keys(input).sort().map(k=>`${k}=${String(input[k])}`).join("&"):""}function useEverfurPresentationState(client){let{runtime:runtime}=useEverfurContext(),store=runtime?.entitlements??NO_STORE,readBranding=react.useCallback(()=>store.getSnapshot()?.branding??null,[store]),branding=react.useSyncExternalStore(store.subscribe,readBranding,readBranding),clientKey=keyOf(client);return react.useMemo(()=>{let locked=branding?.lockedFields??null;return{presentation:resolvePresentation({server:branding?.presentation??null,locked:locked,client:client??null}),isLocked:field=>isPresentationFieldLocked(field,locked)}},[branding,clientKey])}function definedPresentation(input){let out={};for(let[key,value]of Object.entries(input))value!==void 0&&(out[key]=value);return out}function selectView2(state){return state.isBootstrapping?"loading":state.status==="error"&&state.error&&state.messages.length===0?"error":state.messages.length===0?"empty":"populated"}function needsNewConversation(error){return error.code==="accessDenied"||error.code==="conversationNotFound"}function turnNotice(state,host="native"){if(state.messages.length===0)return null;let error=state.status==="error"?state.error:null;if(error!==null){let startNew=needsNewConversation(error),web=host==="web";return{tone:"error",title:startNew?CHAT_COPY.turnUnreachableTitle:web?CHAT_COPY.turnFailedTitleWeb:CHAT_COPY.turnFailedTitle,body:error.displayMessage,actionLabel:startNew?CHAT_COPY.turnStartNewChat:web?CHAT_COPY.retry:CHAT_COPY.turnRetry,action:startNew?"startNew":"retry"}}return state.stopped===true?{tone:"neutral",title:CHAT_COPY.turnStoppedTitle,body:CHAT_COPY.turnStoppedBody,actionLabel:CHAT_COPY.turnRetry,action:"retry"}:null}function awaitingAssistant(messages,isStreaming){let lastMessage=messages[messages.length-1];return isStreaming&&(lastMessage===void 0||lastMessage.role==="user")}var MAX_VISIBLE_FOLLOW_UPS=3,NO_FOLLOW_UPS=/* @__PURE__ */Object.freeze([]);function visibleFollowUps(state){let last=state.messages[state.messages.length-1];if(state.isStreaming||state.status==="error"||last===void 0||last.role!=="assistant")return NO_FOLLOW_UPS;let seen=/* @__PURE__ */new Set,out=[];for(let prompt of state.suggestedPrompts){let text3=prompt.trim(),key=text3.replace(/\s+/g," ").toLowerCase();if(!(key.length===0||seen.has(key))&&(seen.add(key),out.push(text3),out.length===MAX_VISIBLE_FOLLOW_UPS))break}/* @__PURE__ */
@@ -218,7 +218,7 @@ return jsxRuntime.jsxs(reactNative.View,{style:styles2.anchor,pointerEvents:"box
218
218
  /* @__PURE__ */jsxRuntime.jsx(reactNative.Image,{source:{uri:row.previewUri},style:styles2.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),uploading?/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.uploadingOverlay,children:/* @__PURE__ */jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:theme.color.surface})}):null,flash?/* @__PURE__ */jsxRuntime.jsx(SuccessFlash,{styles:styles2,onDone:()=>setFlash(false)}):null]})}),failed?/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:fillCopy(CHAT_COPY.retryUpload,{filename:row.filename}),style:styles2.failedOverlay,onPress:()=>onRetry(row.id),children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.failedInner,children:/* @__PURE__ */jsxRuntime.jsx(CloseGlyph,{size:SUCCESS_GLYPH,color:theme.color.surface,strokeWidth:2})})}):null,
219
219
  /* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:fillCopy(CHAT_COPY.removeAttachment,{filename:row.filename}),hitSlop:6,containerStyle:styles2.removeSlot,style:styles2.removeButton,onPress:()=>onRemove(row.id),children:/* @__PURE__ */jsxRuntime.jsx(CloseGlyph,{size:REMOVE_GLYPH,color:theme.color.surface,strokeWidth:1.5})})]})}function SuccessFlash({styles:styles2,onDone:onDone}){let theme=useEverfurTheme(),motion=useChatMotion(),opacity=react.useRef(null);opacity.current===null&&(opacity.current=new reactNative.Animated.Value(0));let value=opacity.current;return react.useEffect(()=>{let animation=reactNative.Animated.sequence([reactNative.Animated.timing(value,{toValue:1,duration:SUCCESS_FLASH_FADE_IN_MS,useNativeDriver:true}),reactNative.Animated.delay(motion.uploadFlashMs),reactNative.Animated.timing(value,{toValue:0,duration:SUCCESS_FLASH_FADE_OUT_MS,useNativeDriver:true})]);return animation.start(({finished:finished})=>{finished&&onDone()}),()=>animation.stop()},[value,motion.uploadFlashMs,onDone]),/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[styles2.successOverlay,{opacity:value}],children:/* @__PURE__ */jsxRuntime.jsx(CheckGlyph,{size:SUCCESS_GLYPH,color:theme.color.surface,strokeWidth:2})})}function SentImages({images:images,onPreview:onPreview}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles3(theme),[theme]);if(images.length===0)return null;let single=images.length===1;/* @__PURE__ */
220
220
  return jsxRuntime.jsx(reactNative.View,{style:single?styles2.sentSingle:styles2.sentGrid,children:images.map((image,index)=>/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:fillCopy(CHAT_COPY.attachedImage,{filename:image.filename}),onPress:()=>onPreview(image),children:/* @__PURE__ */jsxRuntime.jsx(reactNative.Image,{source:{uri:image.uri},style:single?styles2.singleImage:styles2.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${image.uri}-${index}`))})}function makeStyles3(theme){let c=theme.color,t=theme.type;return reactNative.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:THUMB_SIZE,height:THUMB_SIZE,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:CARD_RADIUS,overflow:"hidden",backgroundColor:c.composerFill,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:c.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...ABSOLUTE_FILL,alignItems:"center",justifyContent:"center",backgroundColor:withAlpha(theme.color.brandInk,UPLOADING_ALPHA)??theme.color.brandSofter},successOverlay:{...ABSOLUTE_FILL,alignItems:"center",justifyContent:"center",backgroundColor:SUCCESS_OVERLAY},failedOverlay:{...ABSOLUTE_FILL,borderRadius:CARD_RADIUS,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:FAILED_OVERLAY},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:REMOVE_SIZE,height:REMOVE_SIZE,borderRadius:REMOVE_SIZE/2,backgroundColor:REMOVE_BG,borderWidth:1.5,borderColor:c.surface,alignItems:"center",justifyContent:"center"},rejected:{...face(theme,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:c.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:SINGLE_IMAGE,height:SINGLE_IMAGE,borderRadius:SINGLE_IMAGE_RADIUS,backgroundColor:IMAGE_ON_BRAND},gridImage:{width:GRID_IMAGE,height:GRID_IMAGE,borderRadius:GRID_IMAGE_RADIUS,backgroundColor:IMAGE_ON_BRAND}})}var NO_URI2="chat attachment upload: the file handle has no uri",FAILED2="chat attachment upload failed";function filePartOf(file){return{uri:file.uri,name:sanitizeFilename(file.name),type:file.mimeType}}function createRnChatAttachmentTransport(options={}){/* @__PURE__ */
221
- return Object.freeze({postMultipart(policy,file,opts){if(typeof file.uri!="string"||file.uri.length===0)return Promise.reject(new Error(NO_URI2));let{signal:signal,onProgress:onProgress}=opts,failed=()=>Promise.reject(new Error(FAILED2));return signal?.aborted===true?failed():postRnMultipart({url:policy.upload_url,fields:policy.upload_fields,file:filePartOf(file),signal:signal,fetch:options.fetch}).then(stored2=>{if(!stored2)return failed();onProgress?.(1)},failed)}})}function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function ownGroundSlot(slot){return slot===void 0||slot.backgroundColor!==void 0?slot:slot.borderRadius===void 0?void 0:{borderRadius:slot.borderRadius}}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}var SPINNER_DELAY_MS=300,THANKS_VISIBLE_MS=3e3,MIN_SURFACE_HEIGHT=120,MIN_TOUCH_TARGET=44,INPUT_MAX_HEIGHT=120,BUBBLE_MAX_WIDTH="88%",BUBBLE_MAX_WIDTH_CAP=520,HALF_STEP=2,BUBBLE_EDGE_WIDTH=.5,BUBBLE_LEAD_USER=1.5,BUBBLE_LEAD_ASSISTANT=1.6,PENDING_OPACITY=.6,COMPOSER_MIN_HEIGHT=56,COMPOSER_BORDER_WIDTH=1.5,COMPOSER_PADDING_RIGHT=5,COMPOSER_PADDING_VERTICAL=5,INPUT_MIN_HEIGHT=36,INPUT_LINE_HEIGHT=20,APP_BODY_SIZE=14,SEND_CONTROL_SIZE=MIN_TOUCH_TARGET,TEXT_ACTION_HIT_SLOP=4,SEND_GLYPH_SIZE=24,STOP_GLYPH_SIZE=22,SEND_DISABLED_OPACITY=.4,ATTACH_CONTROL_SIZE=MIN_TOUCH_TARGET,ATTACH_GLYPH_SIZE=20,ATTACH_DISABLED_OPACITY=.4,EMPTY_MIN_HEIGHT=480,FOLLOW_UP_HEADING_SIZE=12,FOLLOW_UP_HEADING_TRACKING=.72,FOLLOW_UP_ROW_MIN_HEIGHT=48,RULE_WIDTH=1,FOOTNOTE_SIZE=12,FOOTNOTE_LINE=18,EMPTY_PADDING_TOP="12%",ASSISTANT_AVATAR_SIZE=20;function useChatTheme(){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles4(theme),[theme]);return{theme:theme,styles:styles2}}function makeStyles4(theme){let c=theme.color,s=theme.space,r=theme.radius,t=theme.type,userLine=Math.round(t.size.body*BUBBLE_LEAD_USER),assistantLine=Math.round(t.size.body*BUBBLE_LEAD_ASSISTANT),inputLine=Math.round(INPUT_LINE_HEIGHT*t.size.body/APP_BODY_SIZE),rule=c.borderRingCream,slots=theme.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:MIN_SURFACE_HEIGHT,backgroundColor:c.chatGround},body:{flex:1},centered:{minHeight:MIN_SURFACE_HEIGHT,flexGrow:1,alignItems:"center",justifyContent:"center",padding:s.xl},homeEmpty:{flexGrow:1},emptyContent:{flexGrow:1,alignItems:"stretch",justifyContent:"flex-start",paddingTop:EMPTY_PADDING_TOP,paddingHorizontal:s.lg,paddingBottom:s.lg,minHeight:EMPTY_MIN_HEIGHT,gap:s.lg},errorText:{...face(theme,"regular"),fontSize:t.size.subtitle,lineHeight:t.size.subtitle*t.lineHeight.snug,color:c.danger,textAlign:"center",marginBottom:s.md},retryButton:{minHeight:MIN_TOUCH_TARGET,minWidth:MIN_TOUCH_TARGET,alignItems:"center",justifyContent:"center",paddingHorizontal:s.xl,paddingVertical:s.sm,borderRadius:r.pill,backgroundColor:c.brand,...slotBox(slots.primaryButton)},retryLabel:{...face(theme,"medium"),color:c.onPrimary,fontSize:t.size.body,...slotText(slots.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:s.sm,paddingHorizontal:s.lg,paddingVertical:s.sm,backgroundColor:c.surfaceCream},setupNoticeText:{...face(theme,"regular"),color:c.danger,fontSize:t.size.caption,flexShrink:1},turnNotice:{gap:s.xs,padding:s.md,borderRadius:r.lg,backgroundColor:c.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:c.brandBorder,alignItems:"flex-start",...slotBox(slots.card,reactNative.StyleSheet.hairlineWidth)},turnNoticeError:{borderColor:c.danger},turnNoticeTitle:{...headingFace(theme,"bold"),color:c.text.primary,fontSize:t.size.body,...slotText(slots.card)},turnNoticeTitleError:{color:c.danger},turnNoticeBody:{...face(theme,"regular"),color:c.text.secondary,fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,...slotText(slots.card)},turnNoticeAction:{minHeight:MIN_TOUCH_TARGET,justifyContent:"center"},turnNoticeActionLabel:{...face(theme,"medium"),color:c.brandInk,fontSize:t.size.body},setupNoticeAction:{...face(theme,"medium"),color:c.brandInk,fontSize:t.size.caption},reconnectingCaption:{...face(theme,"medium"),color:c.text.secondary,fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},readingLine:{...face(theme,"regular"),color:c.text.muted,fontSize:t.size.bodyTight,lineHeight:Math.round(t.size.bodyTight*t.lineHeight.relaxed)},list:{flex:1},listContent:{padding:s.lg,gap:s.xl},rowBlock:{gap:s.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:s.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:BUBBLE_MAX_WIDTH,alignItems:"flex-start"},bubbleSideUser:{alignItems:"flex-end"},bubbleUser:{maxWidth:BUBBLE_MAX_WIDTH_CAP,paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,backgroundColor:c.bubbleUser,...c.primaryEdge!==c.primary&&c.bubbleUser===c.primary?{borderWidth:BUBBLE_EDGE_WIDTH,borderColor:c.primaryEdge}:{},borderRadius:r.lg,borderBottomRightRadius:r.xs,...slotBox(slots.userBubble,BUBBLE_EDGE_WIDTH)},bubbleAssistant:slots.assistantBubble?.backgroundColor===void 0?{...slotBox(slots.assistantBubble,BUBBLE_EDGE_WIDTH)}:{paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,borderRadius:r.lg,...slotBox(slots.assistantBubble,BUBBLE_EDGE_WIDTH)},bubbleVet:{maxWidth:BUBBLE_MAX_WIDTH_CAP,paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,backgroundColor:c.bubbleVet,borderRadius:r.lg,borderTopLeftRadius:r.xs,...slotBox(slots.vetBubble,BUBBLE_EDGE_WIDTH)},bubblePending:{opacity:PENDING_OPACITY},bubbleTextUser:{...face(theme,"regular"),color:c.onPrimary,fontSize:t.size.body,lineHeight:userLine,...slotText(slots.userBubble)},bubbleTextAssistant:{...face(theme,"regular"),color:c.text.primary,fontSize:t.size.body,lineHeight:assistantLine,...slotText(slots.assistantBubble)},bubbleTextVet:{...face(theme,"regular"),color:c.onBubbleVet,fontSize:t.size.body,lineHeight:userLine,...slotText(slots.vetBubble)},assistantName:{...face(theme,"bold"),color:c.brandInk,fontSize:t.size.bodyTight,marginBottom:s.xs},assistantSender:{flexDirection:"row",alignItems:"center",gap:s.sm,marginBottom:s.xs},assistantAvatar:{width:ASSISTANT_AVATAR_SIZE,height:ASSISTANT_AVATAR_SIZE,borderRadius:ASSISTANT_AVATAR_SIZE/2},assistantNameInRow:{marginBottom:0},vetHeader:{flexDirection:"row",alignItems:"baseline",gap:s.sm,marginBottom:s.xs},vetSender:{...face(theme,"bold"),color:c.text.primary,fontSize:t.size.bodyTight},vetTime:{...face(theme,"regular"),color:c.text.muted,fontSize:t.size.caption},bubbleBold:face(theme,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:face(theme,"mono"),followUps:{alignSelf:"stretch",marginTop:s.md},followUpsHeading:{...face(theme,"monoBold"),color:c.text.muted,fontSize:FOLLOW_UP_HEADING_SIZE,textTransform:"uppercase",letterSpacing:FOLLOW_UP_HEADING_TRACKING,paddingBottom:s.sm,borderBottomWidth:RULE_WIDTH,borderBottomColor:rule},followUpSlot:{alignSelf:"stretch"},followUpSlotRuled:{borderTopWidth:RULE_WIDTH,borderTopColor:rule},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:s.md,minHeight:FOLLOW_UP_ROW_MIN_HEIGHT,paddingVertical:s.sm+HALF_STEP,...slots.chip?.backgroundColor!==void 0||slots.chip?.borderColor!==void 0?{paddingHorizontal:s.md}:{},...slotBox(slots.chip)},followUpText:{...face(theme,"bold"),flex:1,color:c.brandInk,fontSize:t.size.bodyTight,...slotText(slots.chip)},composerOuter:{position:"relative"},askEntry:{marginHorizontal:s.md,marginTop:s.xs},composer:{marginHorizontal:s.md,marginTop:s.xs,minHeight:COMPOSER_MIN_HEIGHT,justifyContent:"center",paddingLeft:s.sm,paddingRight:COMPOSER_PADDING_RIGHT,paddingVertical:COMPOSER_PADDING_VERTICAL,backgroundColor:c.composerFill,borderWidth:COMPOSER_BORDER_WIDTH,borderColor:c.composerBorder,borderRadius:r.pill,...slotBox(slots.composerInput,COMPOSER_BORDER_WIDTH)},composerRow:{flexDirection:"row",alignItems:"center",gap:s.xs,minHeight:INPUT_MIN_HEIGHT},attachControl:{width:ATTACH_CONTROL_SIZE,height:ATTACH_CONTROL_SIZE,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:ATTACH_DISABLED_OPACITY},input:{flex:1,minHeight:INPUT_MIN_HEIGHT,maxHeight:INPUT_MAX_HEIGHT,paddingHorizontal:0,paddingVertical:0,...face(theme,"regular"),fontSize:t.size.body,lineHeight:inputLine,color:c.text.primary,...slotText(slots.composerInput)},sendControl:{minHeight:SEND_CONTROL_SIZE,minWidth:SEND_CONTROL_SIZE,alignItems:"center",justifyContent:"center"},sendDisc:{width:SEND_CONTROL_SIZE,height:SEND_CONTROL_SIZE,borderRadius:SEND_CONTROL_SIZE/2,alignItems:"center",justifyContent:"center",...slotBox(slots.sendButton)},sendControlDisabled:{opacity:SEND_DISABLED_OPACITY},footnote:{...face(theme,"regular"),color:c.text.muted,fontSize:FOOTNOTE_SIZE,lineHeight:FOOTNOTE_LINE,textAlign:"center",marginTop:s.sm,marginBottom:s.xs,paddingHorizontal:s.lg},poweredBy:{...face(theme,"regular"),color:c.text.muted,fontSize:t.size.micro,textAlign:"center",paddingBottom:s.xs}})}var DEFAULT_SOURCES=/* @__PURE__ */Object.freeze(["photo"]),DEFAULT_MAX_PER_MESSAGE=1,COMPACT_HEIGHT=52,COMPACT_RING=1.5,COMPACT_INSET_TOP=10,COMPACT_INSET_SIDE=14,COMPACT_INSET_FOOT=10,COMPACT_DISC=40,COMPACT_ARROW=20,COMPACT_DIM_OPACITY=.3;function composerPlaceholder(branded,petName,petPlaceholder){let named=typeof petName=="string"&&petName.trim()!=="";return petPlaceholder&&named?forPet(CHAT_COPY.placeholder,petName):branded!==null?branded:forPet(CHAT_COPY.placeholder,petName)}function ComposerWithAttachments({attachments:attachments,...rest}){let transport=react.useMemo(()=>createRnChatAttachmentTransport(),[]),state=useChatAttachments({maxPerMessage:attachments.maxPerMessage??DEFAULT_MAX_PER_MESSAGE,transport:transport}),bound=react.useMemo(()=>({state:state,sources:attachments.sources??DEFAULT_SOURCES,pick:attachments.pick}),[state,attachments.sources,attachments.pick]);/* @__PURE__ */
221
+ return Object.freeze({postMultipart(policy,file,opts){if(typeof file.uri!="string"||file.uri.length===0)return Promise.reject(new Error(NO_URI2));let{signal:signal,onProgress:onProgress}=opts,failed=()=>Promise.reject(new Error(FAILED2));return signal?.aborted===true?failed():postRnMultipart({url:policy.upload_url,fields:policy.upload_fields,file:filePartOf(file),signal:signal,fetch:options.fetch}).then(stored2=>{if(!stored2)return failed();onProgress?.(1)},failed)}})}function slotBox(slot,borderWidth){if(slot===void 0)return{};let out={};return slot.backgroundColor!==void 0&&(out.backgroundColor=slot.backgroundColor),slot.borderColor!==void 0&&(out.borderColor=slot.borderColor,out.borderWidth=borderWidth??1),slot.borderRadius!==void 0&&(out.borderRadius=slot.borderRadius),out}function ownGroundSlot(slot){return slot===void 0||slot.backgroundColor!==void 0?slot:slot.borderRadius===void 0?void 0:{borderRadius:slot.borderRadius}}function slotText(slot){return slot?.textColor===void 0?{}:{color:slot.textColor}}var SPINNER_DELAY_MS=300,THANKS_VISIBLE_MS=3e3,MIN_SURFACE_HEIGHT=120,MIN_TOUCH_TARGET=44,INPUT_MAX_HEIGHT=120,BUBBLE_MAX_WIDTH="88%",BUBBLE_MAX_WIDTH_CAP=520,HALF_STEP=2,BUBBLE_EDGE_WIDTH=.5,BUBBLE_LEAD_USER=1.5,BUBBLE_LEAD_ASSISTANT=1.6,PENDING_OPACITY=.6,COMPOSER_MIN_HEIGHT=56,COMPOSER_BORDER_WIDTH=1.5,COMPOSER_PADDING_RIGHT=5,COMPOSER_PADDING_VERTICAL=5,INPUT_MIN_HEIGHT=36,INPUT_LINE_HEIGHT=20,APP_BODY_SIZE=14,SEND_CONTROL_SIZE=MIN_TOUCH_TARGET,TEXT_ACTION_HIT_SLOP=4,SEND_GLYPH_SIZE=24,STOP_GLYPH_SIZE=22,SEND_DISABLED_OPACITY=.4,ATTACH_CONTROL_SIZE=MIN_TOUCH_TARGET,ATTACH_GLYPH_SIZE=20,ATTACH_DISABLED_OPACITY=.4,EMPTY_MIN_HEIGHT=480,FOLLOW_UP_HEADING_SIZE=12,FOLLOW_UP_HEADING_TRACKING=.72,FOLLOW_UP_ROW_MIN_HEIGHT=48,RULE_WIDTH=1,FOOTNOTE_SIZE=12,FOOTNOTE_LINE=18,EMPTY_PADDING_TOP="12%",ASSISTANT_AVATAR_SIZE=20;function useChatTheme(){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles4(theme),[theme]);return{theme:theme,styles:styles2}}function makeStyles4(theme){let c=theme.color,s=theme.space,r=theme.radius,t=theme.type,userLine=Math.round(t.size.body*BUBBLE_LEAD_USER),assistantLine=Math.round(t.size.body*BUBBLE_LEAD_ASSISTANT),inputLine=Math.round(INPUT_LINE_HEIGHT*t.size.body/APP_BODY_SIZE),rule=c.borderRingCream,slots=theme.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:MIN_SURFACE_HEIGHT,backgroundColor:c.chatGround},body:{flex:1},centered:{minHeight:MIN_SURFACE_HEIGHT,flexGrow:1,alignItems:"center",justifyContent:"center",padding:s.xl},homeEmpty:{flexGrow:1},emptyContent:{flexGrow:1,alignItems:"stretch",justifyContent:"flex-start",paddingTop:EMPTY_PADDING_TOP,paddingHorizontal:s.lg,paddingBottom:s.lg,minHeight:EMPTY_MIN_HEIGHT,gap:s.lg},errorText:{...face(theme,"regular"),fontSize:t.size.subtitle,lineHeight:t.size.subtitle*t.lineHeight.snug,color:c.danger,textAlign:"center",marginBottom:s.md},retryButton:{minHeight:MIN_TOUCH_TARGET,minWidth:MIN_TOUCH_TARGET,alignItems:"center",justifyContent:"center",paddingHorizontal:s.xl,paddingVertical:s.sm,borderRadius:r.pill,backgroundColor:c.brand,...slotBox(slots.primaryButton)},retryLabel:{...face(theme,"medium"),color:c.onPrimary,fontSize:t.size.body,...slotText(slots.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:s.sm,paddingHorizontal:s.lg,paddingVertical:s.sm,backgroundColor:c.surfaceCream},setupNoticeText:{...face(theme,"regular"),color:c.danger,fontSize:t.size.caption,flexShrink:1},turnNotice:{gap:s.xs,padding:s.md,borderRadius:r.lg,backgroundColor:c.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:c.brandBorder,alignItems:"flex-start",...slotBox(slots.card,reactNative.StyleSheet.hairlineWidth)},turnNoticeError:{borderColor:c.danger},turnNoticeTitle:{...headingFace(theme,"bold"),color:c.text.primary,fontSize:t.size.body,...slotText(slots.card)},turnNoticeTitleError:{color:c.danger},turnNoticeBody:{...face(theme,"regular"),color:c.text.secondary,fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,...slotText(slots.card)},turnNoticeAction:{minHeight:MIN_TOUCH_TARGET,justifyContent:"center"},turnNoticeActionLabel:{...face(theme,"medium"),color:c.brandInk,fontSize:t.size.body},setupNoticeAction:{...face(theme,"medium"),color:c.brandInk,fontSize:t.size.caption},reconnectingCaption:{...face(theme,"medium"),color:c.text.secondary,fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},readingBox:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:s.xs,paddingVertical:s.md,paddingHorizontal:s.md+s.xs/2,backgroundColor:c.surfaceSubtle,borderRadius:r.md},readingDot:{width:6,height:6,borderRadius:r.pill,backgroundColor:c.brandInk},list:{flex:1},listContent:{padding:s.lg,gap:s.xl},rowBlock:{gap:s.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:s.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:BUBBLE_MAX_WIDTH,alignItems:"flex-start"},bubbleSideUser:{alignItems:"flex-end"},bubbleUser:{maxWidth:BUBBLE_MAX_WIDTH_CAP,paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,backgroundColor:c.bubbleUser,...c.primaryEdge!==c.primary&&c.bubbleUser===c.primary?{borderWidth:BUBBLE_EDGE_WIDTH,borderColor:c.primaryEdge}:{},borderRadius:r.lg,borderBottomRightRadius:r.xs,...slotBox(slots.userBubble,BUBBLE_EDGE_WIDTH)},bubbleAssistant:slots.assistantBubble?.backgroundColor===void 0?{...slotBox(slots.assistantBubble,BUBBLE_EDGE_WIDTH)}:{paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,borderRadius:r.lg,...slotBox(slots.assistantBubble,BUBBLE_EDGE_WIDTH)},bubbleVet:{maxWidth:BUBBLE_MAX_WIDTH_CAP,paddingVertical:s.md,paddingHorizontal:s.lg+HALF_STEP,backgroundColor:c.bubbleVet,borderRadius:r.lg,borderTopLeftRadius:r.xs,...slotBox(slots.vetBubble,BUBBLE_EDGE_WIDTH)},bubblePending:{opacity:PENDING_OPACITY},bubbleTextUser:{...face(theme,"regular"),color:c.onPrimary,fontSize:t.size.body,lineHeight:userLine,...slotText(slots.userBubble)},bubbleTextAssistant:{...face(theme,"regular"),color:c.text.primary,fontSize:t.size.body,lineHeight:assistantLine,...slotText(slots.assistantBubble)},bubbleTextVet:{...face(theme,"regular"),color:c.onBubbleVet,fontSize:t.size.body,lineHeight:userLine,...slotText(slots.vetBubble)},assistantName:{...face(theme,"bold"),color:c.brandInk,fontSize:t.size.bodyTight,marginBottom:s.xs},assistantSender:{flexDirection:"row",alignItems:"center",gap:s.sm,marginBottom:s.xs},assistantAvatar:{width:ASSISTANT_AVATAR_SIZE,height:ASSISTANT_AVATAR_SIZE,borderRadius:ASSISTANT_AVATAR_SIZE/2},assistantNameInRow:{marginBottom:0},vetHeader:{flexDirection:"row",alignItems:"baseline",gap:s.sm,marginBottom:s.xs},vetSender:{...face(theme,"bold"),color:c.text.primary,fontSize:t.size.bodyTight},vetTime:{...face(theme,"regular"),color:c.text.muted,fontSize:t.size.caption},bubbleBold:face(theme,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:face(theme,"mono"),followUps:{alignSelf:"stretch",marginTop:s.md},followUpsHeading:{...face(theme,"monoBold"),color:c.text.muted,fontSize:FOLLOW_UP_HEADING_SIZE,textTransform:"uppercase",letterSpacing:FOLLOW_UP_HEADING_TRACKING,paddingBottom:s.sm,borderBottomWidth:RULE_WIDTH,borderBottomColor:rule},followUpSlot:{alignSelf:"stretch"},followUpSlotRuled:{borderTopWidth:RULE_WIDTH,borderTopColor:rule},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:s.md,minHeight:FOLLOW_UP_ROW_MIN_HEIGHT,paddingVertical:s.sm+HALF_STEP,...slots.chip?.backgroundColor!==void 0||slots.chip?.borderColor!==void 0?{paddingHorizontal:s.md}:{},...slotBox(slots.chip)},followUpText:{...face(theme,"bold"),flex:1,color:c.brandInk,fontSize:t.size.bodyTight,...slotText(slots.chip)},composerOuter:{position:"relative"},askEntry:{marginHorizontal:s.md,marginTop:s.xs},composer:{marginHorizontal:s.md,marginTop:s.xs,minHeight:COMPOSER_MIN_HEIGHT,justifyContent:"center",paddingLeft:s.sm,paddingRight:COMPOSER_PADDING_RIGHT,paddingVertical:COMPOSER_PADDING_VERTICAL,backgroundColor:c.composerFill,borderWidth:COMPOSER_BORDER_WIDTH,borderColor:c.composerBorder,borderRadius:r.pill,...slotBox(slots.composerInput,COMPOSER_BORDER_WIDTH)},composerRow:{flexDirection:"row",alignItems:"center",gap:s.xs,minHeight:INPUT_MIN_HEIGHT},attachControl:{width:ATTACH_CONTROL_SIZE,height:ATTACH_CONTROL_SIZE,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:ATTACH_DISABLED_OPACITY},input:{flex:1,minHeight:INPUT_MIN_HEIGHT,maxHeight:INPUT_MAX_HEIGHT,paddingHorizontal:0,paddingVertical:0,...face(theme,"regular"),fontSize:t.size.body,lineHeight:inputLine,color:c.text.primary,...slotText(slots.composerInput)},sendControl:{minHeight:SEND_CONTROL_SIZE,minWidth:SEND_CONTROL_SIZE,alignItems:"center",justifyContent:"center"},sendDisc:{width:SEND_CONTROL_SIZE,height:SEND_CONTROL_SIZE,borderRadius:SEND_CONTROL_SIZE/2,alignItems:"center",justifyContent:"center",...slotBox(slots.sendButton)},sendControlDisabled:{opacity:SEND_DISABLED_OPACITY},footnote:{...face(theme,"regular"),color:c.text.muted,fontSize:FOOTNOTE_SIZE,lineHeight:FOOTNOTE_LINE,textAlign:"center",marginTop:s.sm,marginBottom:s.xs,paddingHorizontal:s.lg},poweredBy:{...face(theme,"regular"),color:c.text.muted,fontSize:t.size.micro,textAlign:"center",paddingBottom:s.xs}})}var DEFAULT_SOURCES=/* @__PURE__ */Object.freeze(["photo"]),DEFAULT_MAX_PER_MESSAGE=1,COMPACT_HEIGHT=52,COMPACT_RING=1.5,COMPACT_INSET_TOP=10,COMPACT_INSET_SIDE=14,COMPACT_INSET_FOOT=10,COMPACT_DISC=40,COMPACT_ARROW=20,COMPACT_DIM_OPACITY=.3;function composerPlaceholder(branded,petName,petPlaceholder){let named=typeof petName=="string"&&petName.trim()!=="";return petPlaceholder&&named?forPet(CHAT_COPY.placeholder,petName):branded!==null?branded:forPet(CHAT_COPY.placeholder,petName)}function ComposerWithAttachments({attachments:attachments,...rest}){let transport=react.useMemo(()=>createRnChatAttachmentTransport(),[]),state=useChatAttachments({maxPerMessage:attachments.maxPerMessage??DEFAULT_MAX_PER_MESSAGE,transport:transport}),bound=react.useMemo(()=>({state:state,sources:attachments.sources??DEFAULT_SOURCES,pick:attachments.pick}),[state,attachments.sources,attachments.pick]);/* @__PURE__ */
222
222
  return jsxRuntime.jsx(Composer,{...rest,attachments:bound})}function Composer({send:send,stop:stop,isStreaming:isStreaming,conversationId:conversationId2,attachments:attachments,seed:seed,draftStore:draftStore,onStage:onStage,onPreview:onPreview,petName:petName,compact:compact=false,petPlaceholder:petPlaceholder=false,dimEmptySend:dimEmptySend=false}){let{theme:theme,styles:styles2}=useChatTheme(),compactStyles=react.useMemo(()=>makeCompactStyles(theme),[theme]),motion=useChatMotion(),[draft,setDraft]=useChatDraft(send,conversationId2,seed);usePersistedDraft(draftStore,conversationId2===null?null:String(conversationId2),draft,setDraft);let[pickerOpen,setPickerOpen]=react.useState(false),[pickFailed,setPickFailed]=react.useState(false);react.useEffect(()=>{setPickFailed(false)},[conversationId2]);let placeholder=composerPlaceholder(theme.meta.placeholder,petName,petPlaceholder),uploading=attachments?.state.uploading??false,uploadFailed=attachments?.state.failed??false,sendBlocked=uploading||uploadFailed,rows=attachments?.state.attachments??NO_ROWS;useAnimateLayoutOn(rows.length,motion);let onSend=react.useCallback(()=>{let text3=draft.trim();if(text3.length===0||sendBlocked||[...text3].length>MESSAGE_MAX_CHARS)return;let keys=attachments?.state.s3Keys??NO_KEYS;attachments!==null&&keys.length>0?(onStage(attachments.state.attachments.filter(row=>row.status==="uploaded").map(row=>({uri:row.previewUri,filename:row.filename}))),send(text3,{imageS3Keys:keys}),attachments.state.clear()):send(text3),setDraft(""),setPickFailed(false)},[draft,send,sendBlocked,attachments,onStage]),onStop=react.useCallback(()=>{stop()},[stop]),pickFrom=react.useCallback(source=>{setPickerOpen(false),attachments!==null&&(setPickFailed(false),attachments.state.dismissRejected(),callHostAsync(attachments.pick,source).then(outcome=>{if(!outcome.ok){setPickFailed(true);return}outcome.value!==null&&attachments.state.add(outcome.value)}))},[attachments]),isOverLimit=react.useMemo(()=>[...draft.trim()].length>MESSAGE_MAX_CHARS,[draft]),sendDisabled=isOverLimit||sendBlocked||draft.trim().length===0,sendDimmed=isOverLimit||sendBlocked||dimEmptySend&&draft.trim().length===0,slotsFull=attachments!==null&&rows.length>=attachments.state.maxPerMessage,sendInk=theme.slots.sendButton?.textColor??theme.color.brandInk,compactInk=theme.slots.sendButton?.textColor??theme.color.surface;/* @__PURE__ */
223
223
  return jsxRuntime.jsxs(reactNative.View,{style:styles2.composerOuter,children:[attachments!==null&&pickerOpen?/* @__PURE__ */jsxRuntime.jsx(AttachmentPickerPopover,{sources:attachments.sources,full:slotsFull,onPick:pickFrom,onClose:()=>setPickerOpen(false)}):null,
224
224
  /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:compact?[styles2.composer,compactStyles.bar]:styles2.composer,children:[attachments!==null?/* @__PURE__ */jsxRuntime.jsx(AttachmentStrip,{attachments:rows,rejected:pickFailed?PICK_FAILED:attachments.state.rejected,uploadFailed:uploadFailed,onRetry:attachments.state.retry,onRemove:attachments.state.remove,onPreview:row=>onPreview({uri:row.previewUri,label:row.filename})}):null,
@@ -249,8 +249,9 @@ return jsxRuntime.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel
249
249
  /* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.meta,numberOfLines:1,children:isActive?`${CHAT_COPY.activePrefix}${meta}`:meta})]}),isActive?/* @__PURE__ */jsxRuntime.jsx(CheckGlyph,{size:CHECK_SIZE,color:theme.color.brandInk}):null]},pet.petRef)})}),onAddPet!==null?/* @__PURE__ */jsxRuntime.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.addAnotherPet,style:styles2.addRow,onPress:onAddPet,children:[
250
250
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.addDisc,children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.addPlus,children:"+"})}),
251
251
  /* @__PURE__ */jsxRuntime.jsx(Text,{style:styles2.addLabel,children:CHAT_COPY.addAnotherPet})]}):null,
252
- /* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.close,containerStyle:styles2.closeSlot,style:styles2.closeButton,onPress:onClose,children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.closeText,children:CHAT_COPY.close})})]})]})}):null}function makeStyles7(theme){let c=theme.color,r=theme.radius,dialogText=slotText(theme.slots.dialog);return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:BACKDROP2},panel:{backgroundColor:c.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:PANEL_RADIUS,borderTopRightRadius:PANEL_RADIUS,gap:14,maxHeight:PANEL_MAX_HEIGHT,...sheetSlotBox(theme.slots.dialog)},title:{...headingFace(theme,"bold"),fontSize:18,lineHeight:22,color:c.brandInk,...dialogText},list:{maxHeight:LIST_MAX_HEIGHT,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:MIN_TOUCH_TARGET3,paddingHorizontal:8},addDisc:{width:ROW_RING_SIZE,height:ROW_RING_SIZE,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:ROW_RING_STROKE,borderStyle:"dashed",borderColor:c.brandBorder,backgroundColor:c.surfaceCream},addPlus:{...face(theme,"bold"),fontSize:20,lineHeight:22,color:c.brandInk},addLabel:{...face(theme,"bold"),fontSize:15,lineHeight:20,color:c.text.primary,...dialogText},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:c.brandBorder,backgroundColor:c.surface},rowActive:{borderColor:c.brandInk,backgroundColor:c.brandSoft},copy:{flex:1,gap:2},name:{...face(theme,"bold"),fontSize:15,lineHeight:18,color:c.text.primary},meta:{...face(theme,"monoBold"),fontSize:11,lineHeight:13,color:c.text.muted,textTransform:"uppercase",letterSpacing:META_TRACKING},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:CLOSE_RADIUS,backgroundColor:c.brandSoft},closeText:{...face(theme,"bold"),color:c.brandInk,fontSize:13,lineHeight:16,letterSpacing:META_TRACKING}})}var MIN_TOUCH_TARGET4=44,ICON_BUTTON_SIZE=36,MENU_GLYPH_SIZE=22,UNREAD_DOT_SIZE=9,UNREAD_DOT_RING=1.5,UNREAD_DOT_INSET=6,HEADER_AVATAR_SIZE=35,HEADER_RING_STROKE=1.75,ADD_BADGE_SIZE=12.4,ADD_BADGE_BORDER=.5,ADD_BADGE_GLYPH=8,LOGO_HEIGHT=28,LOGO_MAX_WIDTH=160,ROW_PADDING=16,CENTRE_GAP=8;function headerPet(pets,petRef2){return headerPetOf(pets,petRef2)}function ChatHeader({pets:pets,petRef:petRef2,historyUnread:historyUnread,onOpenHistory:onOpenHistory,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles8(theme),[theme]),[switcherOpen,setSwitcherOpen]=react.useState(false),shown=headerPet(pets.pets,petRef2),canSwitch=pets.pets.length>=2,shownPetRef=petRef2??shown?.petRef??null,name=petDisplayName(shown),[measures,setMeasures]=react.useState(UNMEASURED),measure=react.useCallback(key=>event=>{let width=event.nativeEvent.layout.width;setMeasures(prev=>nextMeasures(prev,key,width))},[]),onRowLayout=react.useMemo(()=>measure("row"),[measure]),onLeadingLayout=react.useMemo(()=>measure("leading"),[measure]),onTrailingLayout=react.useMemo(()=>measure("trailing"),[measure]),reserved=2*ROW_PADDING+2*(theme.slots.header?.borderColor!==void 0?1:0)+2*CENTRE_GAP,sideMins=balanceHeaderSides(measures,reserved,LOGO_MAX_WIDTH),select=next=>{setSwitcherOpen(false),pets.setActivePet(next),callHost(onPetChange,next)},addPet=onAddPet===void 0?null:()=>{setSwitcherOpen(false),callHost(onAddPet)};/* @__PURE__ */
253
- return jsxRuntime.jsxs(reactNative.View,{style:styles2.row,onLayout:onRowLayout,children:[
252
+ /* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.close,containerStyle:styles2.closeSlot,style:styles2.closeButton,onPress:onClose,children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.closeText,children:CHAT_COPY.close})})]})]})}):null}function makeStyles7(theme){let c=theme.color,r=theme.radius,dialogText=slotText(theme.slots.dialog);return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:BACKDROP2},panel:{backgroundColor:c.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:PANEL_RADIUS,borderTopRightRadius:PANEL_RADIUS,gap:14,maxHeight:PANEL_MAX_HEIGHT,...sheetSlotBox(theme.slots.dialog)},title:{...headingFace(theme,"bold"),fontSize:18,lineHeight:22,color:c.brandInk,...dialogText},list:{maxHeight:LIST_MAX_HEIGHT,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:MIN_TOUCH_TARGET3,paddingHorizontal:8},addDisc:{width:ROW_RING_SIZE,height:ROW_RING_SIZE,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:ROW_RING_STROKE,borderStyle:"dashed",borderColor:c.brandBorder,backgroundColor:c.surfaceCream},addPlus:{...face(theme,"bold"),fontSize:20,lineHeight:22,color:c.brandInk},addLabel:{...face(theme,"bold"),fontSize:15,lineHeight:20,color:c.text.primary,...dialogText},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:c.brandBorder,backgroundColor:c.surface},rowActive:{borderColor:c.brandInk,backgroundColor:c.brandSoft},copy:{flex:1,gap:2},name:{...face(theme,"bold"),fontSize:15,lineHeight:18,color:c.text.primary},meta:{...face(theme,"monoBold"),fontSize:11,lineHeight:13,color:c.text.muted,textTransform:"uppercase",letterSpacing:META_TRACKING},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:CLOSE_RADIUS,backgroundColor:c.brandSoft},closeText:{...face(theme,"bold"),color:c.brandInk,fontSize:13,lineHeight:16,letterSpacing:META_TRACKING}})}var MIN_TOUCH_TARGET4=44,ICON_BUTTON_SIZE=36,MENU_GLYPH_SIZE=22,UNREAD_DOT_SIZE=9,UNREAD_DOT_RING=1.5,UNREAD_DOT_INSET=6,HEADER_AVATAR_SIZE=35,HEADER_RING_STROKE=1.75,ADD_BADGE_SIZE=12.4,ADD_BADGE_BORDER=.5,ADD_BADGE_GLYPH=8,LOGO_HEIGHT=28,LOGO_MAX_WIDTH=160,ROW_PADDING=16,CENTRE_GAP=8;function headerPet(pets,petRef2){return headerPetOf(pets,petRef2)}function ChatHeader({pets:pets,petRef:petRef2,historyUnread:historyUnread,onOpenHistory:onOpenHistory,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet,textingEntry:textingEntry=null}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles8(theme),[theme]),[switcherOpen,setSwitcherOpen]=react.useState(false),shown=headerPet(pets.pets,petRef2),canSwitch=pets.pets.length>=2,shownPetRef=petRef2??shown?.petRef??null,name=petDisplayName(shown),[measures,setMeasures]=react.useState(UNMEASURED),measure=react.useCallback(key=>event=>{let width=event.nativeEvent.layout.width;setMeasures(prev=>nextMeasures(prev,key,width))},[]),onRowLayout=react.useMemo(()=>measure("row"),[measure]),onLeadingLayout=react.useMemo(()=>measure("leading"),[measure]),onTrailingLayout=react.useMemo(()=>measure("trailing"),[measure]),reserved=2*ROW_PADDING+2*(theme.slots.header?.borderColor!==void 0?1:0)+2*CENTRE_GAP,sideMins=balanceHeaderSides(measures,reserved,LOGO_MAX_WIDTH),select=next=>{setSwitcherOpen(false),pets.setActivePet(next),callHost(onPetChange,next)},addPet=onAddPet===void 0?null:()=>{setSwitcherOpen(false),callHost(onAddPet)};/* @__PURE__ */
253
+ return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
254
+ /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles2.row,onLayout:onRowLayout,children:[
254
255
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:[styles2.leading,sideMins.leading===void 0?null:{minWidth:sideMins.leading}],children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.sideContent,onLayout:onLeadingLayout,children:/* @__PURE__ */jsxRuntime.jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:historyUnread?`${CHAT_COPY.openHistoryNative}${CHAT_COPY.newReplySuffix}`:CHAT_COPY.openHistoryNative,containerStyle:styles2.iconSlot,style:styles2.iconButton,onPress:onOpenHistory,children:[
255
256
  /* @__PURE__ */jsxRuntime.jsx(MenuGlyph,{size:MENU_GLYPH_SIZE,color:theme.slots.header?.textColor??theme.color.text.primary,strokeWidth:2}),historyUnread?/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.unreadDot,pointerEvents:"none"}):null]})})}),
256
257
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.centre,pointerEvents:"box-none",children:/* @__PURE__ */jsxRuntime.jsx(BrandLogo,{logoUrl:theme.meta.logoUrl,name:theme.meta.displayName,barStyle:styles2.logoBar,logoStyle:styles2.logo})}),
@@ -259,7 +260,8 @@ return jsxRuntime.jsxs(reactNative.View,{style:styles2.row,onLayout:onRowLayout,
259
260
  /* @__PURE__ */jsxRuntime.jsx(PetDisc,{pet:shown,size:HEADER_AVATAR_SIZE,ringStroke:HEADER_RING_STROKE}),
260
261
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */jsxRuntime.jsx(PlusGlyph,{size:ADD_BADGE_GLYPH,color:theme.color.brandInk,strokeWidth:2})})]}):pets.loading&&shown===null?
261
262
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.avatarWrap,accessible:true,accessibilityLabel:CHAT_COPY.yourPet,children:/* @__PURE__ */jsxRuntime.jsx(Ring,{size:HEADER_AVATAR_SIZE,strokeWidth:HEADER_RING_STROKE,color:theme.color.mark,children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.placeholderDisc})})}):/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:shown===null?CHAT_COPY.yourPet:name,children:/* @__PURE__ */jsxRuntime.jsx(PetDisc,{pet:shown,size:HEADER_AVATAR_SIZE,ringStroke:HEADER_RING_STROKE})})})]})}),
262
- /* @__PURE__ */jsxRuntime.jsx(PetSwitcherSheet,{visible:switcherOpen,pets:pets.pets,activePetRef:shown?.petRef??null,onSelect:select,onAddPet:addPet,onClose:()=>setSwitcherOpen(false)})]})}function makeStyles8(theme){let c=theme.color,placeholderInner=HEADER_AVATAR_SIZE-HEADER_RING_STROKE*2,header=theme.slots.header;return reactNative.StyleSheet.create({vetEntry:{minHeight:MIN_TOUCH_TARGET4,justifyContent:"center",paddingHorizontal:12,borderRadius:theme.radius.pill,backgroundColor:c.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:c.controlEdge},vetEntryLabel:{...face(theme,"bold"),color:c.brandInk,fontSize:theme.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:ROW_PADDING,paddingVertical:10,backgroundColor:c.surface,...slotBox(header)},iconSlot:{borderRadius:ICON_BUTTON_SIZE/2},iconButton:{width:ICON_BUTTON_SIZE,height:ICON_BUTTON_SIZE,borderRadius:ICON_BUTTON_SIZE/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:UNREAD_DOT_INSET,right:UNREAD_DOT_INSET,width:UNREAD_DOT_SIZE,height:UNREAD_DOT_SIZE,borderRadius:UNREAD_DOT_SIZE,backgroundColor:c.danger,borderWidth:UNREAD_DOT_RING,borderColor:header?.backgroundColor??c.surface},leading:{flexShrink:0,alignItems:"flex-start"},trailing:{flexShrink:0,alignItems:"flex-end"},sideContent:{flexDirection:"row",alignItems:"center"},trailingContent:{flexDirection:"row",alignItems:"center",gap:theme.space.sm},centre:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,marginHorizontal:CENTRE_GAP,alignItems:"center",justifyContent:"center"},logoBar:{alignSelf:"stretch",alignItems:"center"},logo:{height:LOGO_HEIGHT,width:LOGO_MAX_WIDTH,maxWidth:"100%"},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:HEADER_AVATAR_SIZE/2},avatarWrap:{width:HEADER_AVATAR_SIZE,height:HEADER_AVATAR_SIZE,position:"relative"},placeholderDisc:{width:placeholderInner,height:placeholderInner,borderRadius:placeholderInner/2,backgroundColor:c.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:ADD_BADGE_SIZE,height:ADD_BADGE_SIZE,borderRadius:ADD_BADGE_SIZE/2,borderWidth:ADD_BADGE_BORDER,borderColor:c.mark,backgroundColor:c.surface,alignItems:"center",justifyContent:"center"}})}var MIN_TOUCH_TARGET5=44,SCRIM="rgba(17,17,17,0.55)",SHEET_RADIUS=26,HANDLE_WIDTH=36,HANDLE_HEIGHT=4,RADIO_SIZE=20,BADGE_SIZE=38,BADGE_GLYPH=18,RADIO_CHECK=12;function FeedbackReasons({visible:visible,onSubmit:onSubmit,onSkip:onSkip}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles9(theme),[theme]),[reason,setReason]=react.useState(null),[note,setNote]=react.useState(""),[pending,setPending]=react.useState(false),[failed,setFailed]=react.useState(false),reset=()=>{setReason(null),setNote(""),setPending(false),setFailed(false)},skip=()=>{pending||(reset(),onSkip())},submit=async()=>{if(pending)return;setPending(true),setFailed(false);let trimmed=note.trim();await onSubmit(reason,trimmed.length>0?trimmed:null)?reset():(setPending(false),setFailed(true))};if(!visible)return null;let overLimit=[...note].length>FEEDBACK_NOTES_MAX_CHARS;/* @__PURE__ */
263
+ /* @__PURE__ */jsxRuntime.jsx(PetSwitcherSheet,{visible:switcherOpen,pets:pets.pets,activePetRef:shown?.petRef??null,onSelect:select,onAddPet:addPet,onClose:()=>setSwitcherOpen(false)})]}),textingEntry===null?null:/* @__PURE__ */jsxRuntime.jsx(TextingEntryRow,{entry:textingEntry,place:"header"})]})}function TextingEntryRow({entry:entry,place:place}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles8(theme),[theme]);/* @__PURE__ */
264
+ return jsxRuntime.jsx(reactNative.View,{style:place==="header"?styles2.textingEntryRowHeader:styles2.textingEntryRowThread,children:/* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:entry.label,containerStyle:styles2.textingEntrySlot,style:styles2.vetEntry,onPress:entry.onOpen,testID:"everfur-texting-entry",children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.vetEntryLabel,numberOfLines:1,children:entry.label})})})}function makeStyles8(theme){let c=theme.color,placeholderInner=HEADER_AVATAR_SIZE-HEADER_RING_STROKE*2,header=theme.slots.header;return reactNative.StyleSheet.create({vetEntry:{minHeight:MIN_TOUCH_TARGET4,justifyContent:"center",paddingHorizontal:12,borderRadius:theme.radius.pill,backgroundColor:c.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:c.controlEdge},vetEntryLabel:{...face(theme,"bold"),color:c.brandInk,fontSize:theme.type.size.caption},textingEntrySlot:{borderRadius:theme.radius.pill,maxWidth:"100%"},textingEntryRowHeader:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:ROW_PADDING,paddingBottom:10,backgroundColor:header?.backgroundColor??c.surface},textingEntryRowThread:{flexDirection:"row",justifyContent:"flex-end",paddingHorizontal:ROW_PADDING,paddingTop:theme.space.sm},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:ROW_PADDING,paddingVertical:10,backgroundColor:c.surface,...slotBox(header)},iconSlot:{borderRadius:ICON_BUTTON_SIZE/2},iconButton:{width:ICON_BUTTON_SIZE,height:ICON_BUTTON_SIZE,borderRadius:ICON_BUTTON_SIZE/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:UNREAD_DOT_INSET,right:UNREAD_DOT_INSET,width:UNREAD_DOT_SIZE,height:UNREAD_DOT_SIZE,borderRadius:UNREAD_DOT_SIZE,backgroundColor:c.danger,borderWidth:UNREAD_DOT_RING,borderColor:header?.backgroundColor??c.surface},leading:{flexShrink:0,alignItems:"flex-start"},trailing:{flexShrink:0,alignItems:"flex-end"},sideContent:{flexDirection:"row",alignItems:"center"},trailingContent:{flexDirection:"row",alignItems:"center",gap:theme.space.sm},centre:{flexGrow:1,flexShrink:1,flexBasis:0,minWidth:0,marginHorizontal:CENTRE_GAP,alignItems:"center",justifyContent:"center"},logoBar:{alignSelf:"stretch",alignItems:"center"},logo:{height:LOGO_HEIGHT,width:LOGO_MAX_WIDTH,maxWidth:"100%"},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:HEADER_AVATAR_SIZE/2},avatarWrap:{width:HEADER_AVATAR_SIZE,height:HEADER_AVATAR_SIZE,position:"relative"},placeholderDisc:{width:placeholderInner,height:placeholderInner,borderRadius:placeholderInner/2,backgroundColor:c.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:ADD_BADGE_SIZE,height:ADD_BADGE_SIZE,borderRadius:ADD_BADGE_SIZE/2,borderWidth:ADD_BADGE_BORDER,borderColor:c.mark,backgroundColor:c.surface,alignItems:"center",justifyContent:"center"}})}var MIN_TOUCH_TARGET5=44,SCRIM="rgba(17,17,17,0.55)",SHEET_RADIUS=26,HANDLE_WIDTH=36,HANDLE_HEIGHT=4,RADIO_SIZE=20,BADGE_SIZE=38,BADGE_GLYPH=18,RADIO_CHECK=12;function FeedbackReasons({visible:visible,onSubmit:onSubmit,onSkip:onSkip}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles9(theme),[theme]),[reason,setReason]=react.useState(null),[note,setNote]=react.useState(""),[pending,setPending]=react.useState(false),[failed,setFailed]=react.useState(false),reset=()=>{setReason(null),setNote(""),setPending(false),setFailed(false)},skip=()=>{pending||(reset(),onSkip())},submit=async()=>{if(pending)return;setPending(true),setFailed(false);let trimmed=note.trim();await onSubmit(reason,trimmed.length>0?trimmed:null)?reset():(setPending(false),setFailed(true))};if(!visible)return null;let overLimit=[...note].length>FEEDBACK_NOTES_MAX_CHARS;/* @__PURE__ */
263
265
  return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:theme.motion.reducedMotion?"none":"slide",onRequestClose:skip,children:/* @__PURE__ */jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:styles2.root,children:[
264
266
  /* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{style:styles2.scrim,onPress:skip,accessibilityRole:"button",accessibilityLabel:CHAT_COPY.feedbackSkipA11y}),
265
267
  /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles2.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[
@@ -390,7 +392,7 @@ return jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE_
390
392
  /* @__PURE__ */jsxRuntime.jsx(Text,{style:[styles2.cardTitle,linked?styles2.cardTitleLink:null],numberOfLines:2,children:card.title}),linked?/* @__PURE__ */jsxRuntime.jsx(ArrowUpRightGlyph,{size:LINK_GLYPH,color:theme.color.linkInk,strokeWidth:1.5}):null]}),card.meta!==null?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.cardMeta,numberOfLines:1,children:card.meta}):null,card.excerpt!==null?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles2.cardExcerpt,numberOfLines:3,children:card.excerpt}):null]});if(card.url!==null&&open!==void 0){let url=card.url;/* @__PURE__ */
391
393
  return jsxRuntime.jsx(PressScale,{accessibilityRole:"link",accessibilityLabel:label,style:styles2.card,onPress:()=>open(url),children:inner})}/* @__PURE__ */
392
394
  return jsxRuntime.jsx(reactNative.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:label,style:styles2.card,children:inner})}function makeStyles18(theme){let c=theme.color,s=theme.space,r=theme.radius,size=theme.type.size,cardText=slotText(theme.slots.card);return reactNative.StyleSheet.create({block:{gap:s.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:r.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:s.xs+2,paddingHorizontal:s.md,paddingVertical:s.xs+2,borderRadius:r.pill,backgroundColor:c.brandSoft},toggleLabel:{...face(theme,"monoBold"),fontSize:size.micro,lineHeight:size.micro,letterSpacing:TOGGLE_TRACKING,color:c.brandInk,textTransform:"uppercase"},row:{gap:s.sm,paddingRight:s.xl,paddingTop:s.xs},card:{width:CARD_WIDTH,borderRadius:r.md,borderWidth:1,borderColor:c.brandBorder,backgroundColor:c.surface,padding:s.md,gap:s.xs+2,...slotBox(theme.slots.card,1)},cardHeader:{flexDirection:"row",alignItems:"center",gap:s.sm},tierDot:{width:TIER_DOT,height:TIER_DOT,borderRadius:r.pill},cardTitle:{...headingFace(theme,"bold"),flex:1,fontSize:size.bodyTight,lineHeight:TITLE_LINE,color:c.text.primary,letterSpacing:TITLE_TRACKING,...cardText},cardTitleLink:{color:c.linkInk},cardMeta:{...face(theme,"monoMedium"),fontSize:size.nano,lineHeight:META_LINE,letterSpacing:theme.type.letterSpacing.monoWide,color:c.text.metaCool,textTransform:"uppercase",...cardText},cardExcerpt:{...face(theme,"regular"),fontSize:size.tiny,lineHeight:EXCERPT_LINE,color:c.text.muted,...cardText}})}var ICON_SIZE=15,ICON_HIT_SLOP=15,THUMB_HIT_SLOP=6,SENTIMENT_ROTATE=/* @__PURE__ */Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function MessageFooter({message:message,onCopy:onCopy,sentiment:sentiment=null,onSentiment:onSentiment,thanks:thanks=false}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles19(theme),[theme]),motion=useChatMotion(),isUser=message.role==="user",timeLabel=react.useMemo(()=>formatMessageTime(message.createdAt),[message.createdAt]),canCopy=onCopy!==void 0&&message.role!=="vet"&&message.text.length>0,thumbs=message.role==="assistant"&&onSentiment!==void 0&&message.responseId!==void 0,[justCopied,setJustCopied]=react.useState(false),resetTimer=react.useRef(null);react.useEffect(()=>()=>{resetTimer.current&&clearTimeout(resetTimer.current)},[]);let copy=()=>{onCopy!==void 0&&(callHostAsync(onCopy,message.text),setJustCopied(true),resetTimer.current&&clearTimeout(resetTimer.current),resetTimer.current=setTimeout(()=>{setJustCopied(false),resetTimer.current=null},motion.copiedMs))};return timeLabel===null&&!canCopy&&!thumbs?null:/* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles2.wrap,children:[
393
- /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:[styles2.row,isUser?styles2.rowUser:styles2.rowAssistant],children:[timeLabel!==null?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.timestamp,children:timeLabel}):null,canCopy?/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:justCopied?CHAT_COPY.copied:isUser?CHAT_COPY.copyUserMessage:CHAT_COPY.copyAssistantMessage,hitSlop:ICON_HIT_SLOP,onPress:copy,style:styles2.iconHit,children:justCopied?/* @__PURE__ */jsxRuntime.jsx(CheckGlyph,{size:ICON_SIZE,color:theme.color.success,strokeWidth:2}):/* @__PURE__ */jsxRuntime.jsx(CopyGlyph,{size:ICON_SIZE,color:theme.color.text.timestamp,strokeWidth:1.5})}):null,thumbs?SENTIMENT_OPTIONS.map(({sentiment:kind,label:label})=>/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{selected:sentiment===kind},hitSlop:THUMB_HIT_SLOP,onPress:()=>onSentiment?.(kind),style:styles2.iconHit,children:/* @__PURE__ */jsxRuntime.jsx(ThumbGlyph,{size:ICON_SIZE,color:theme.color.sentiment[kind],active:sentiment===kind,rotate:SENTIMENT_ROTATE[kind],strokeWidth:1.5})},kind)):null]}),thanks?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles2.thanks,accessibilityLiveRegion:"polite",children:CHAT_COPY.feedbackThanks}):null]})}function makeStyles19(theme){let t=theme.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...face(theme,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:theme.color.text.timestamp,textAlign:"center"},iconHit:{width:ICON_SIZE,height:ICON_SIZE,alignItems:"center",justifyContent:"center"},thanks:{...face(theme,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:theme.color.text.secondary}})}var QUICK_PROMPT_BRAND_EDGE="#10462E";var QUICK_PROMPT_TEXT_COLOR="#000000",PILL_ACTIVITY_ON_WHITE="#83E0B4",PROMPTS=/* @__PURE__ */Object.freeze([
395
+ /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:[styles2.row,isUser?styles2.rowUser:styles2.rowAssistant],children:[timeLabel!==null?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.timestamp,children:timeLabel}):null,canCopy?/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:justCopied?CHAT_COPY.copied:isUser?CHAT_COPY.copyUserMessage:CHAT_COPY.copyAssistantMessage,hitSlop:ICON_HIT_SLOP,onPress:copy,style:styles2.iconHit,children:justCopied?/* @__PURE__ */jsxRuntime.jsx(CheckGlyph,{size:ICON_SIZE,color:theme.color.success,strokeWidth:2}):/* @__PURE__ */jsxRuntime.jsx(CopyGlyph,{size:ICON_SIZE,color:theme.color.text.timestamp,strokeWidth:1.5})}):null,thumbs?SENTIMENT_OPTIONS.map(({sentiment:kind,label:label})=>/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{selected:sentiment===kind},hitSlop:THUMB_HIT_SLOP,onPress:()=>onSentiment?.(kind),style:styles2.iconHit,children:/* @__PURE__ */jsxRuntime.jsx(ThumbGlyph,{size:ICON_SIZE,color:sentiment===kind?theme.color.sentiment[kind]:theme.color.text.timestamp,active:sentiment===kind,rotate:SENTIMENT_ROTATE[kind],strokeWidth:1.5})},kind)):null]}),thanks?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles2.thanks,accessibilityLiveRegion:"polite",children:CHAT_COPY.feedbackThanks}):null]})}function makeStyles19(theme){let t=theme.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...face(theme,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:theme.color.text.timestamp,textAlign:"center"},iconHit:{width:ICON_SIZE,height:ICON_SIZE,alignItems:"center",justifyContent:"center"},thanks:{...face(theme,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:theme.color.text.secondary}})}var QUICK_PROMPT_BRAND_EDGE="#10462E";var QUICK_PROMPT_TEXT_COLOR="#000000",PILL_ACTIVITY_ON_WHITE="#83E0B4",PROMPTS=/* @__PURE__ */Object.freeze([
394
396
  /* @__PURE__ */Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),
395
397
  /* @__PURE__ */Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:PILL_ACTIVITY_ON_WHITE,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),
396
398
  /* @__PURE__ */Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:QUICK_PROMPT_BRAND_EDGE,brandEdge:true,borderWidth:1}),
@@ -401,8 +403,7 @@ return Object.freeze(PROMPTS.flatMap(template=>{let own=template.intent==="vet_r
401
403
  /* @__PURE__ */Object.freeze({tint:"#DDEFC4",ink:"#262523"}),
402
404
  /* @__PURE__ */Object.freeze({tint:"#FFD8D6",ink:"#262523"})]);function QuickPrompts({pet:pet,petRef:petRef2,onSend:onSend,onVetPrep:onVetPrep,vet:vet,starterPrompts:starterPrompts,emptyState:emptyState,centered:centered=false}){let theme=useEverfurTheme(),styles2=react.useMemo(()=>makeStyles20(theme),[theme]),hostChips=react.useMemo(()=>resolveStarterPrompts(starterPrompts),[starterPrompts]),drawn=react.useMemo(()=>hostChips!==null?hostChips.map(host=>({prompt:{id:host.id,intent:"send",label:host.label,background:host.tint??theme.color.highlight,borderColor:"transparent",borderWidth:1},send:host.prompt,paint:host.tint===null?null:{fill:host.tint,ink:host.ink??theme.color.text.primary}})):resolveQuickPrompts(pet,theme.color.brandInk).map(prompt=>({prompt:prompt,send:prompt.label,paint:null})),[hostChips,pet,theme.color.brandInk,theme.color.highlight,theme.color.text.primary]),hostCycle=emptyState?.chipTints!==void 0,cycle=react.useMemo(()=>(emptyState?.chipTints??(theme.brightness==="light"?RAPH_CHIP_TINTS:[])).filter(t=>typeof t.tint=="string"&&t.tint.trim()!==""),[emptyState?.chipTints,theme.brightness]),chips=react.useMemo(()=>cycle.length===0?drawn:drawn.map((d,index)=>{if(d.paint!==null)return d;let t=cycle[index%cycle.length];return{...d,paint:{fill:t.tint,ink:t.ink??theme.color.text.primary},...hostCycle?{}:{cycleDefault:true}}}),[drawn,cycle,hostCycle,theme.color.text.primary]),themed=react.useMemo(()=>quickPromptThemePaint(isEverfurLightLook(theme),{fill:theme.color.highlight,ink:theme.color.onHighlight}),[theme]),hostChipThemed=react.useMemo(()=>({fill:theme.color.highlight,ink:theme.color.onHighlight}),[theme.color.highlight,theme.color.onHighlight]),hostTitle=emptyState?.title?.trim(),title=hostTitle!==void 0&&hostTitle!==""?hostTitle:emptyStateTitle(pet),home=useAskHome(),homeTitle=useAskHomeTitle(),titleNode=home!==null&&homeTitle!==null?/* @__PURE__ */jsxRuntime.jsx(homeTitle.Title,{text:title,style:[styles2.title,home.text(".serif",".ask-empty h2"),styles2.centerText],measureCh:homeTitle.titleCh}):/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"heading",style:centered?[styles2.title,styles2.centerText]:styles2.title,accessibilityRole:"header",children:title});/* @__PURE__ */
403
405
  return jsxRuntime.jsxs(reactNative.View,{style:home!==null?styles2.homeBlock:styles2.block,children:[titleNode,
404
- /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:home!==null?[styles2.list,styles2.listCentered,home.view(".ask-chips",".ask-empty .ask-chips")]:centered?[styles2.list,styles2.listCentered]:styles2.list,accessibilityLabel:CHAT_COPY.suggestions,children:chips.map(({prompt:prompt,send:send,paint:paint,cycleDefault:cycleDefault},index)=>/* @__PURE__ */jsxRuntime.jsx(Chip,{prompt:prompt,send:send,themed:paint??(hostChips!==null?hostChipThemed:themed),index:index,petRef:petRef2,onSend:onSend,onVetPrep:onVetPrep,vet:vet,pet:pet,styles:styles2,tinted:paint!==null&&cycleDefault!==true,soft:paint!==null,centered:centered},prompt.id))})]})}function Chip({prompt:prompt,send:send,themed:themed,index:index,pet:pet,petRef:petRef2,onSend:onSend,onVetPrep:onVetPrep,vet:vet,styles:styles2,tinted:tinted,soft:soft,centered:centered}){let motion=useChatMotion(),fade=useFadeIn(motion.followUpInMs,{delayMs:followUpDelayMs(motion,index),risePx:motion.promptRisePx}),home=useAskHome(),edge=home!==null?[styles2.chipHome,home.view(".chip")]:centered&&soft?styles2.chipNoEdge:styles2.chipEdge,fill={backgroundColor:themed?.fill??prompt.background},paint=styles2.chipSlot===null?fill:tinted?{...styles2.chipSlot,...fill}:{...fill,...styles2.chipSlot},base2=home!==null?[styles2.chipLabel,home.text(".chip")]:centered?[styles2.chipLabel,styles2.centerText]:[styles2.chipLabel],slop=home!==null?CHIP_HOME_SLOP:CHIP_HIT_SLOP,label=themed===null?styles2.chipSlotLabel===null?base2:[...base2,styles2.chipSlotLabel]:tinted?[...base2,...styles2.chipSlotLabel===null?[]:[styles2.chipSlotLabel],{color:themed.ink}]:[...base2,{color:themed.ink},...styles2.chipSlotLabel===null?[]:[styles2.chipSlotLabel]];return prompt.intent==="vet_report"?onVetPrep!==void 0?/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>{callHost(onVetPrep,pet)},children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:label,children:prompt.label})})}):petRef2===null?null:/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(VetVisitButton,{entry:"chat",petRef:petRef2,label:prompt.label,...vet?.returnTo!==void 0?{returnTo:vet.returnTo}:{},...vet?.usState!==void 0?{usState:vet.usState}:{},...vet?.prefer!==void 0?{prefer:vet.prefer}:{},style:[styles2.chip,edge,paint],labelStyle:label})}):/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>onSend(send),children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:label,children:prompt.label})})})}function makeStyles20(theme){let chip=ownGroundSlot(theme.slots.chip),chipText=slotText(chip);return{chipSlot:chip===void 0?null:slotBox(chip,CHIP_EDGE_WIDTH),chipSlotLabel:chipText.color===void 0?null:chipText,...makeSheet(theme)}}function makeSheet(theme){let c=theme.color,s=theme.space,t=theme.type;return reactNative.StyleSheet.create({block:{gap:s.lg,alignItems:"stretch",width:"100%"},homeBlock:{alignItems:"stretch",width:"100%"},chipHome:{borderWidth:0,minHeight:0},title:{...headingFace(theme,"medium"),fontSize:t.size.heading,lineHeight:Math.round(t.size.heading*t.lineHeight.snug),color:c.brandInk,letterSpacing:t.size.heading*TITLE_TRACKING_EM,textAlign:"left"},list:{width:"100%",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",gap:s.sm+CHIP_GAP_EXTRA},listCentered:{flexDirection:"column",flexWrap:"nowrap",alignItems:"stretch"},centerText:{textAlign:"center"},chipNoEdge:{borderWidth:CHIP_EDGE_WIDTH,borderColor:"transparent"},chip:{borderRadius:theme.radius.pill,paddingHorizontal:s.lg+CHIP_PAD_X_EXTRA,paddingVertical:s.sm,minHeight:CHIP_MIN_HEIGHT,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipEdge:{borderWidth:CHIP_EDGE_WIDTH,borderColor:withAlpha(c.brandInk,CHIP_EDGE_ALPHA)??c.borderRingCream},chipLabel:{...face(theme,"bold"),fontSize:t.size.bodyTight,lineHeight:Math.round(t.size.bodyTight*CHIP_LEAD),color:QUICK_PROMPT_TEXT_COLOR,textAlign:"left"}})}function TypingIndicator({petName:petName=null}){let{styles:styles2}=useChatTheme(),line=forPet(CHAT_COPY.reading,petName);/* @__PURE__ */
405
- return jsxRuntime.jsx(Text,{tier:"compact",style:styles2.readingLine,accessibilityRole:"text",accessibilityLabel:line,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:line})}function resolveTurnScrollTarget(assistantTop,userTop,inset){let replyTarget=assistantTop-inset,target=userTop!=null?Math.min(replyTarget,userTop):replyTarget;return Math.max(0,target)}function latestTurn(messages){let assistantIndex=messages.length-1,last=messages[assistantIndex];if(last===void 0||last.role!=="assistant")return null;let above=messages[assistantIndex-1];return{assistantIndex:assistantIndex,userIndex:above!==void 0&&above.role==="user"?assistantIndex-1:null}}function nextFollowOffset(anchor,current,maxOffset){let end=Math.max(0,maxOffset),target=anchor===null?end:Math.min(Math.max(0,anchor),end);return target>current+1?target:null}var ASIDE_REVEAL_MARGIN=16;function useThreadFollow(rows,isStreaming,aside=null){let ref=react.useRef(null),following=react.useRef(true),wasStreaming=react.useRef(isStreaming),offset=react.useRef(0),viewport=react.useRef(0),content=react.useRef(0),tops=react.useRef(/* @__PURE__ */new Map),asideBottom=react.useRef(null),asideOwed=react.useRef(false),turn=latestTurn(rows),assistantId=turn===null?null:rows[turn.assistantIndex]?.id??null,userId=turn===null||turn.userIndex===null?null:rows[turn.userIndex]?.id??null,follow=react.useCallback(()=>{let view=ref.current;if(view===null||!following.current||viewport.current===0)return;let anchor=null;if(assistantId!==null){let assistantTop=tops.current.get(assistantId);if(assistantTop===void 0)return;let userTop=userId===null?null:tops.current.get(userId)??null;anchor=resolveTurnScrollTarget(assistantTop,userTop,96)}let next=nextFollowOffset(anchor,offset.current,content.current-viewport.current);if(next!==null&&(offset.current=next,view.scrollTo({y:next,animated:false})),!asideOwed.current||asideBottom.current===null)return;let reveal=nextFollowOffset(asideBottom.current+ASIDE_REVEAL_MARGIN-viewport.current,offset.current,content.current-viewport.current);reveal!==null&&(offset.current=reveal,view.scrollTo({y:reveal,animated:false}))},[assistantId,userId]);react.useEffect(()=>{asideOwed.current=aside!==null,aside===null&&(asideBottom.current=null),follow()},[aside,follow]),react.useEffect(()=>{isStreaming&&!wasStreaming.current&&(following.current=true,asideOwed.current=false),wasStreaming.current=isStreaming,follow()},[rows,isStreaming,follow]);let onLayout=react.useCallback(event=>{viewport.current=event.nativeEvent.layout.height,follow()},[follow]),onContentSizeChange=react.useCallback((_width,height)=>{content.current=height,viewport.current>0&&(offset.current=Math.min(offset.current,Math.max(0,height-viewport.current))),follow()},[follow]),onScroll=react.useCallback(event=>{offset.current=event.nativeEvent.contentOffset.y},[]),onScrollBeginDrag=react.useCallback(()=>{following.current=false,asideOwed.current=false},[]),onScrollEnd=react.useCallback(event=>{let{contentOffset:contentOffset,contentSize:contentSize,layoutMeasurement:layoutMeasurement}=event.nativeEvent;offset.current=contentOffset.y,following.current=contentSize.height-contentOffset.y-layoutMeasurement.height<=24},[]),rowLayout=react.useCallback(id=>event=>{tops.current.set(id,event.nativeEvent.layout.y),(id===assistantId||id===userId)&&follow()},[assistantId,userId,follow]),asideLayout=react.useCallback(event=>{let{y:y,height:height}=event.nativeEvent.layout;asideBottom.current=y+height,follow()},[follow]);return{ref:ref,onLayout:onLayout,onContentSizeChange:onContentSizeChange,onScroll:onScroll,onScrollBeginDrag:onScrollBeginDrag,onScrollEnd:onScrollEnd,rowLayout:rowLayout,asideLayout:asideLayout}}function renderView(view,chat,extras){switch(view){case"loading":return extras.renderPending?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:extras.renderPending,fallback:/* @__PURE__ */jsxRuntime.jsx(LoadingState,{})}):/* @__PURE__ */jsxRuntime.jsx(LoadingState,{});case"empty":/* @__PURE__ */
406
+ /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:home!==null?[styles2.list,styles2.listCentered,home.view(".ask-chips",".ask-empty .ask-chips")]:centered?[styles2.list,styles2.listCentered]:styles2.list,accessibilityLabel:CHAT_COPY.suggestions,children:chips.map(({prompt:prompt,send:send,paint:paint,cycleDefault:cycleDefault},index)=>/* @__PURE__ */jsxRuntime.jsx(Chip,{prompt:prompt,send:send,themed:paint??(hostChips!==null?hostChipThemed:themed),index:index,petRef:petRef2,onSend:onSend,onVetPrep:onVetPrep,vet:vet,pet:pet,styles:styles2,tinted:paint!==null&&cycleDefault!==true,soft:paint!==null,centered:centered},prompt.id))})]})}function Chip({prompt:prompt,send:send,themed:themed,index:index,pet:pet,petRef:petRef2,onSend:onSend,onVetPrep:onVetPrep,vet:vet,styles:styles2,tinted:tinted,soft:soft,centered:centered}){let motion=useChatMotion(),fade=useFadeIn(motion.followUpInMs,{delayMs:followUpDelayMs(motion,index),risePx:motion.promptRisePx}),home=useAskHome(),edge=home!==null?[styles2.chipHome,home.view(".chip")]:centered&&soft?styles2.chipNoEdge:styles2.chipEdge,fill={backgroundColor:themed?.fill??prompt.background},paint=styles2.chipSlot===null?fill:tinted?{...styles2.chipSlot,...fill}:{...fill,...styles2.chipSlot},base2=home!==null?[styles2.chipLabel,home.text(".chip")]:centered?[styles2.chipLabel,styles2.centerText]:[styles2.chipLabel],slop=home!==null?CHIP_HOME_SLOP:CHIP_HIT_SLOP,label=themed===null?styles2.chipSlotLabel===null?base2:[...base2,styles2.chipSlotLabel]:tinted?[...base2,...styles2.chipSlotLabel===null?[]:[styles2.chipSlotLabel],{color:themed.ink}]:[...base2,{color:themed.ink},...styles2.chipSlotLabel===null?[]:[styles2.chipSlotLabel]];return prompt.intent==="vet_report"?onVetPrep!==void 0?/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>{callHost(onVetPrep,pet)},children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:label,children:prompt.label})})}):petRef2===null?null:/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(VetVisitButton,{entry:"chat",petRef:petRef2,label:prompt.label,...vet?.returnTo!==void 0?{returnTo:vet.returnTo}:{},...vet?.usState!==void 0?{usState:vet.usState}:{},...vet?.prefer!==void 0?{prefer:vet.prefer}:{},style:[styles2.chip,edge,paint],labelStyle:label})}):/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:fade,children:/* @__PURE__ */jsxRuntime.jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>onSend(send),children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:label,children:prompt.label})})})}function makeStyles20(theme){let chip=ownGroundSlot(theme.slots.chip),chipText=slotText(chip);return{chipSlot:chip===void 0?null:slotBox(chip,CHIP_EDGE_WIDTH),chipSlotLabel:chipText.color===void 0?null:chipText,...makeSheet(theme)}}function makeSheet(theme){let c=theme.color,s=theme.space,t=theme.type;return reactNative.StyleSheet.create({block:{gap:s.lg,alignItems:"stretch",width:"100%"},homeBlock:{alignItems:"stretch",width:"100%"},chipHome:{borderWidth:0,minHeight:0},title:{...headingFace(theme,"medium"),fontSize:t.size.heading,lineHeight:Math.round(t.size.heading*t.lineHeight.snug),color:c.brandInk,letterSpacing:t.size.heading*TITLE_TRACKING_EM,textAlign:"left"},list:{width:"100%",flexDirection:"row",flexWrap:"wrap",justifyContent:"flex-start",gap:s.sm+CHIP_GAP_EXTRA},listCentered:{flexDirection:"column",flexWrap:"nowrap",alignItems:"stretch"},centerText:{textAlign:"center"},chipNoEdge:{borderWidth:CHIP_EDGE_WIDTH,borderColor:"transparent"},chip:{borderRadius:theme.radius.pill,paddingHorizontal:s.lg+CHIP_PAD_X_EXTRA,paddingVertical:s.sm,minHeight:CHIP_MIN_HEIGHT,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipEdge:{borderWidth:CHIP_EDGE_WIDTH,borderColor:withAlpha(c.brandInk,CHIP_EDGE_ALPHA)??c.borderRingCream},chipLabel:{...face(theme,"bold"),fontSize:t.size.bodyTight,lineHeight:Math.round(t.size.bodyTight*CHIP_LEAD),color:QUICK_PROMPT_TEXT_COLOR,textAlign:"left"}})}var LOOP_MS=1e3,STAGGER_MS=150,OPACITY_REST=.25,OPACITY_STATIC=.5,DOT_COUNT=3;function TypingIndicator({petName:petName=null}){let{theme:theme,styles:styles2}=useChatTheme(),reducedMotion=theme.motion.reducedMotion,line=forPet(CHAT_COPY.reading,petName),values=react.useRef(Array.from({length:DOT_COUNT},()=>new reactNative.Animated.Value(0))).current;return react.useEffect(()=>{if(reducedMotion)return;let loops=values.map((value,index)=>reactNative.Animated.loop(reactNative.Animated.sequence([reactNative.Animated.delay(index*STAGGER_MS),reactNative.Animated.timing(value,{toValue:1,duration:LOOP_MS*.4,useNativeDriver:true}),reactNative.Animated.timing(value,{toValue:0,duration:LOOP_MS*.6,useNativeDriver:true}),reactNative.Animated.delay((DOT_COUNT-index-1)*STAGGER_MS)])));for(let loop of loops)loop.start();return()=>{for(let loop of loops)loop.stop()}},[reducedMotion,values]),/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.readingBox,accessible:true,accessibilityRole:"text",accessibilityLabel:line,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:values.map((value,index)=>/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{accessibilityElementsHidden:true,importantForAccessibility:"no",style:[styles2.readingDot,reducedMotion?{opacity:OPACITY_STATIC}:{opacity:value.interpolate({inputRange:[0,1],outputRange:[OPACITY_REST,1]}),transform:[{translateY:value.interpolate({inputRange:[0,1],outputRange:[0,-3]})}]}]},index))})}function resolveTurnScrollTarget(assistantTop,userTop,inset){let replyTarget=assistantTop-inset,target=userTop!=null?Math.min(replyTarget,userTop):replyTarget;return Math.max(0,target)}function latestTurn(messages){let assistantIndex=messages.length-1,last=messages[assistantIndex];if(last===void 0||last.role!=="assistant")return null;let above=messages[assistantIndex-1];return{assistantIndex:assistantIndex,userIndex:above!==void 0&&above.role==="user"?assistantIndex-1:null}}function nextFollowOffset(anchor,current,maxOffset){let end=Math.max(0,maxOffset),target=anchor===null?end:Math.min(Math.max(0,anchor),end);return target>current+1?target:null}var ASIDE_REVEAL_MARGIN=16;function useThreadFollow(rows,isStreaming,aside=null){let ref=react.useRef(null),following=react.useRef(true),wasStreaming=react.useRef(isStreaming),offset=react.useRef(0),viewport=react.useRef(0),content=react.useRef(0),tops=react.useRef(/* @__PURE__ */new Map),asideBottom=react.useRef(null),asideOwed=react.useRef(false),turn=latestTurn(rows),assistantId=turn===null?null:rows[turn.assistantIndex]?.id??null,userId=turn===null||turn.userIndex===null?null:rows[turn.userIndex]?.id??null,follow=react.useCallback(()=>{let view=ref.current;if(view===null||!following.current||viewport.current===0)return;let anchor=null;if(assistantId!==null){let assistantTop=tops.current.get(assistantId);if(assistantTop===void 0)return;let userTop=userId===null?null:tops.current.get(userId)??null;anchor=resolveTurnScrollTarget(assistantTop,userTop,96)}let next=nextFollowOffset(anchor,offset.current,content.current-viewport.current);if(next!==null&&(offset.current=next,view.scrollTo({y:next,animated:false})),!asideOwed.current||asideBottom.current===null)return;let reveal=nextFollowOffset(asideBottom.current+ASIDE_REVEAL_MARGIN-viewport.current,offset.current,content.current-viewport.current);reveal!==null&&(offset.current=reveal,view.scrollTo({y:reveal,animated:false}))},[assistantId,userId]);react.useEffect(()=>{asideOwed.current=aside!==null,aside===null&&(asideBottom.current=null),follow()},[aside,follow]),react.useEffect(()=>{isStreaming&&!wasStreaming.current&&(following.current=true,asideOwed.current=false),wasStreaming.current=isStreaming,follow()},[rows,isStreaming,follow]);let onLayout=react.useCallback(event=>{viewport.current=event.nativeEvent.layout.height,follow()},[follow]),onContentSizeChange=react.useCallback((_width,height)=>{content.current=height,viewport.current>0&&(offset.current=Math.min(offset.current,Math.max(0,height-viewport.current))),follow()},[follow]),onScroll=react.useCallback(event=>{offset.current=event.nativeEvent.contentOffset.y},[]),onScrollBeginDrag=react.useCallback(()=>{following.current=false,asideOwed.current=false},[]),onScrollEnd=react.useCallback(event=>{let{contentOffset:contentOffset,contentSize:contentSize,layoutMeasurement:layoutMeasurement}=event.nativeEvent;offset.current=contentOffset.y,following.current=contentSize.height-contentOffset.y-layoutMeasurement.height<=24},[]),rowLayout=react.useCallback(id=>event=>{tops.current.set(id,event.nativeEvent.layout.y),(id===assistantId||id===userId)&&follow()},[assistantId,userId,follow]),asideLayout=react.useCallback(event=>{let{y:y,height:height}=event.nativeEvent.layout;asideBottom.current=y+height,follow()},[follow]);return{ref:ref,onLayout:onLayout,onContentSizeChange:onContentSizeChange,onScroll:onScroll,onScrollBeginDrag:onScrollBeginDrag,onScrollEnd:onScrollEnd,rowLayout:rowLayout,asideLayout:asideLayout}}function renderView(view,chat,extras){switch(view){case"loading":return extras.renderPending?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:extras.renderPending,fallback:/* @__PURE__ */jsxRuntime.jsx(LoadingState,{})}):/* @__PURE__ */jsxRuntime.jsx(LoadingState,{});case"empty":/* @__PURE__ */
406
407
  return jsxRuntime.jsx(EmptyState,{pet:extras.shownPet,petRef:chat.petRef,onSelectPrompt:extras.onSelectPrompt,onVetPrep:extras.onVetPrep,vet:extras.vet,top:extras.threadTop,topCard:extras.topCard,starterPrompts:extras.starterPrompts,emptyState:extras.emptyState,centered:extras.emptyCentered===true,foot:extras.threadFoot??null});case"error":/* @__PURE__ */
407
408
  return jsxRuntime.jsx(ErrorState,{error:chat.error,onRetry:chat.retryLast,onAddPet:extras.onAddPet});case"populated":/* @__PURE__ */
408
409
  return jsxRuntime.jsx(PopulatedState,{messages:chat.messages,prompts:followUpsWithPolicy(chat,extras.followUpPolicy),actions:extras.answerCards?followUpActionsFor(chat,extras.answerCards):NO_ACTIONS,answerCards:extras.answerCards??null,threadTop:extras.threadTop,threadAside:extras.threadAside,threadAsideKey:extras.threadAsideKey??null,threadFoot:extras.threadFoot??null,onSelectPrompt:extras.onSelectPrompt,isStreaming:chat.isStreaming,onAnswerCheckin:chat.petRef?chat.answerCheckin:null,onCopy:extras.onCopy,sentimentByMessage:chat.sentimentByMessage,onSentiment:extras.onSentiment,thanksFor:extras.thanksFor,imagesByMessage:extras.imagesByMessage,onPreview:extras.onPreview,notice:extras.notice,reconnecting:chat.reconnecting===true,onRetry:chat.retryLast,onStartNew:chat.newConversation,petRef:chat.petRef,onFindVet:extras.onCheckinFindVet,vet:extras.vet,onOpenUrl:extras.onOpenUrl,petName:extras.shownPet?.name??null});default:return assertNever(view)}}function LoadingState(){let{theme:theme,styles:styles2}=useChatTheme(),[visible,setVisible]=react.useState(false);return react.useEffect(()=>{let id=setTimeout(()=>setVisible(true),SPINNER_DELAY_MS);return()=>clearTimeout(id)},[]),/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:CHAT_COPY.loading,children:visible?/* @__PURE__ */jsxRuntime.jsx(reactNative.ActivityIndicator,{color:theme.color.brandInk}):null})}function EmptyState({pet:pet,petRef:petRef2,onSelectPrompt:onSelectPrompt,onVetPrep:onVetPrep,vet:vet,top:top,topCard:topCard,starterPrompts:starterPrompts,emptyState:emptyState,centered:centered,foot:foot}){let{styles:styles2}=useChatTheme(),home=useAskHome();if(home!==null){let{minHeight:minHeight,...box2}=home.view(".ask-empty");/* @__PURE__ */
@@ -425,17 +426,17 @@ return jsxRuntime.jsxs(reactNative.View,{style:[styles2.turnNotice,error?styles2
425
426
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:[styles2.row,isUser?styles2.rowUser:styles2.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${sender}: ${message.text}`,accessibilityState:message.pending===true?{busy:true}:void 0,children:/* @__PURE__ */jsxRuntime.jsxs(reactNative.Animated.View,{style:[styles2.bubble,isUser?styles2.bubbleSideUser:null,enter],children:[senderLine,isVet?/* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles2.vetHeader,children:[
426
427
  /* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.vetSender,children:sender}),vetTime!==null?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.vetTime,children:vetTime}):null]}):null,
427
428
  /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:[isUser?styles2.bubbleUser:isVet?styles2.bubbleVet:styles2.bubbleAssistant,message.pending?styles2.bubblePending:null],children:[isUser&&images.length>0?/* @__PURE__ */jsxRuntime.jsx(SentImages,{images:images,onPreview:image=>onPreview({uri:image.uri,label:image.filename})}):null,
428
- /* @__PURE__ */jsxRuntime.jsx(Text,{style:isUser?styles2.bubbleTextUser:isVet?styles2.bubbleTextVet:styles2.bubbleTextAssistant,children:isAssistant?renderInlineMarkdown(shown,{bold:styles2.bubbleBold,italic:styles2.bubbleItalic,code:styles2.bubbleCode}):message.text})]})]})}),isAssistant&&!revealing?/* @__PURE__ */jsxRuntime.jsx(CitationCards,{citations:message.citations,onOpenUrl:onOpenUrl}):null,settled?/* @__PURE__ */jsxRuntime.jsx(MessageFooter,{message:message,onCopy:onCopy,sentiment:sentiment,onSentiment:message.responseId===void 0?void 0:rate,thanks:thanks}):null]})}var URGENT_LEVELS=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(chat){if(chat.isBootstrapping===true||chat.isLoadingHistory===true||chat.isStreaming===true||chat.status==="error"||chat.stopped===true)return false;let last=chat.messages[chat.messages.length-1];return last===void 0||last.role!=="assistant"||last.pending===true||last.checkin!==void 0||last.text.trim().length===0?false:!(typeof last.urgencyLevel=="string"&&URGENT_LEVELS.has(last.urgencyLevel))}var NO_SNAPSHOT2=()=>null;function useTextingGranted(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=react.useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT2:source.getSnapshot,snapshot2=react.useSyncExternalStore(subscribe2,read,read);return react.useMemo(()=>snapshot2!==null&&decideCapability("texting",snapshot2.decisions,{isPending:snapshot2.isPending}).enabled,[snapshot2])}var NOTHING=/* @__PURE__ */Object.freeze({runner:null,line:null,entry:null,stage:null});function useChatTextingAsk(enabled,chat){let[ask,setAsk]=react.useState(null);if(!enabled)return NOTHING;let runner=/* @__PURE__ */jsxRuntime.jsx(AskRunner,{ready:textingAskThreadReady(chat),onAsk:setAsk});if(ask===null||ask.stage==="hidden"||ask.stage==="dismissed")return{runner:runner,line:null,entry:null,stage:null};let lines=texting__namespace.textingAskLines(ask),line=/* @__PURE__ */jsxRuntime.jsx(AskLine,{stage:ask.stage,text:ask.stage==="verified"?lines.verified:lines.line,accept:lines.accept,dismiss:lines.dismiss,onAccept:ask.accept,onDismiss:ask.dismiss}),entry=ask.stage==="enrolling"?/* @__PURE__ */jsxRuntime.jsx(texting__namespace.ChatTextingAskComposer,{ask:ask}):null;return{runner:runner,line:line,entry:entry,stage:ask.stage}}function AskRunner({ready:ready,onAsk:onAsk}){let{userRef:userRef2}=useEverfurContext(),granted=useTextingGranted(),wanted=userRef2!==null&&granted;return react.useEffect(()=>{wanted||onAsk(null)},[wanted,onAsk]),wanted?/* @__PURE__ */jsxRuntime.jsx(texting__namespace.ChatTextingAskController,{enabled:true,ready:ready,onAsk:onAsk}):null}function AskLine({stage:stage,text:text3,accept:accept,dismiss:dismiss,onAccept:onAccept,onDismiss:onDismiss}){let{theme:theme,styles:styles2}=useChatTheme(),named=!theme.meta.hidePoweredBy,sender=named?CHAT_COPY.assistantName:CHAT_COPY.senderAssistant,senderLine=theme.meta.assistantAvatarUrl!==null?/* @__PURE__ */jsxRuntime.jsx(AssistantSender,{avatarUrl:theme.meta.assistantAvatarUrl,named:named,styles:styles2}):named?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.assistantName,children:CHAT_COPY.assistantName}):null;/* @__PURE__ */
429
+ /* @__PURE__ */jsxRuntime.jsx(Text,{style:isUser?styles2.bubbleTextUser:isVet?styles2.bubbleTextVet:styles2.bubbleTextAssistant,children:isAssistant?renderInlineMarkdown(shown,{bold:styles2.bubbleBold,italic:styles2.bubbleItalic,code:styles2.bubbleCode}):message.text})]})]})}),isAssistant&&!revealing?/* @__PURE__ */jsxRuntime.jsx(CitationCards,{citations:message.citations,onOpenUrl:onOpenUrl}):null,settled?/* @__PURE__ */jsxRuntime.jsx(MessageFooter,{message:message,onCopy:onCopy,sentiment:sentiment,onSentiment:message.responseId===void 0?void 0:rate,thanks:thanks}):null]})}var URGENT_LEVELS=/* @__PURE__ */new Set(["emergency","schedule_soon"]);function textingAskThreadReady(chat){if(chat.isBootstrapping===true||chat.isLoadingHistory===true||chat.isStreaming===true||chat.status==="error"||chat.stopped===true)return false;let last=chat.messages[chat.messages.length-1];return last===void 0||last.role!=="assistant"||last.pending===true||last.checkin!==void 0||last.text.trim().length===0?false:!(typeof last.urgencyLevel=="string"&&URGENT_LEVELS.has(last.urgencyLevel))}var NO_SNAPSHOT2=()=>null;function useTextingGranted(){let{runtime:runtime}=useEverfurContext(),source=runtime.entitlements??null,subscribe2=react.useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT2:source.getSnapshot,snapshot2=react.useSyncExternalStore(subscribe2,read,read);return react.useMemo(()=>snapshot2!==null&&decideCapability("texting",snapshot2.decisions,{isPending:snapshot2.isPending}).enabled,[snapshot2])}var NOTHING=/* @__PURE__ */Object.freeze({runner:null,line:null,entry:null,stage:null,headerEntry:null});function useChatTextingAsk(enabled,chat,headerEntry=false){let[ask,setAsk]=react.useState(null);if(!enabled)return NOTHING;let runner=/* @__PURE__ */jsxRuntime.jsx(AskRunner,{ready:textingAskThreadReady(chat),onAsk:setAsk,entry:headerEntry}),chip=headerEntry&&ask!==null&&ask.canOpen?{label:texting__namespace.textingAskLines(ask).accept,onOpen:ask.open}:null;if(ask===null||ask.stage==="hidden"||ask.stage==="dismissed")return{runner:runner,line:null,entry:null,stage:null,headerEntry:chip};let lines=texting__namespace.textingAskLines(ask),line=/* @__PURE__ */jsxRuntime.jsx(AskLine,{stage:ask.stage,text:ask.stage==="verified"?lines.verified:lines.line,accept:lines.accept,dismiss:lines.dismiss,onAccept:ask.accept,onDismiss:ask.dismiss}),entry=ask.stage==="enrolling"?/* @__PURE__ */jsxRuntime.jsx(texting__namespace.ChatTextingAskComposer,{ask:ask}):null;return{runner:runner,line:line,entry:entry,stage:ask.stage,headerEntry:chip}}function AskRunner({ready:ready,onAsk:onAsk,entry:entry}){let{userRef:userRef2}=useEverfurContext(),granted=useTextingGranted(),wanted=userRef2!==null&&granted;return react.useEffect(()=>{wanted||onAsk(null)},[wanted,onAsk]),wanted?/* @__PURE__ */jsxRuntime.jsx(texting__namespace.ChatTextingAskController,{enabled:true,ready:ready,onAsk:onAsk,entry:entry}):null}function AskLine({stage:stage,text:text3,accept:accept,dismiss:dismiss,onAccept:onAccept,onDismiss:onDismiss}){let{theme:theme,styles:styles2}=useChatTheme(),named=!theme.meta.hidePoweredBy,sender=named?CHAT_COPY.assistantName:CHAT_COPY.senderAssistant,senderLine=theme.meta.assistantAvatarUrl!==null?/* @__PURE__ */jsxRuntime.jsx(AssistantSender,{avatarUrl:theme.meta.assistantAvatarUrl,named:named,styles:styles2}):named?/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.assistantName,children:CHAT_COPY.assistantName}):null;/* @__PURE__ */
429
430
  return jsxRuntime.jsxs(reactNative.View,{style:[styles2.rowBlock,styles2.rowBlockAssistant],testID:`everfur-texting-ask-${stage}`,children:[
430
431
  /* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:[styles2.row,styles2.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${sender}: ${text3}`,children:[senderLine,
431
432
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:[styles2.bubble,styles2.bubbleAssistant],children:/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles2.bubbleTextAssistant,children:text3})})]}),stage==="offered"?/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.followUps,children:[{label:accept,onPress:onAccept,testID:"everfur-texting-ask-accept"},{label:dismiss,onPress:onDismiss,testID:"everfur-texting-ask-dismiss"}].map((answer,index)=>/* @__PURE__ */jsxRuntime.jsx(PressScale,{onPress:answer.onPress,accessibilityRole:"button",accessibilityLabel:answer.label,containerStyle:[styles2.followUpSlot,index>0?styles2.followUpSlotRuled:null],style:styles2.followUpRow,testID:answer.testID,children:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"control",style:styles2.followUpText,children:answer.label})},answer.testID))}):null]})}function EverfurChat(props){let{style:style,renderPending:renderPending}=props;/* @__PURE__ */
432
433
  return jsxRuntime.jsx(CapabilityGate,{capability:"chat",style:style,...renderPending?{renderPending:renderPending}:{},children:/* @__PURE__ */jsxRuntime.jsx(ChatBody,{...props})})}function useOptionalEverfurContext(){try{return useEverfurContext()}catch{return null}}function hostPresentation(props){return definedPresentation({...props.presentation,chatComposerUpload:props.presentation?.chatComposerUpload??(props.attachments===void 0?void 0:true)})}function ChatBody(props){let context=useOptionalEverfurContext();return context===null?/* @__PURE__ */jsxRuntime.jsx(ChatBodyAlone,{...props}):/* @__PURE__ */jsxRuntime.jsx(ChatBodyInProvider,{...props,activePet:context.activePet})}function ChatBodyAlone(props){let client=hostPresentation(props),key=JSON.stringify(client),settings=react.useMemo(()=>({presentation:resolvePresentation({server:null,locked:null,client:client}),isLocked:()=>false,planPage:null,inProvider:false}),[key]);/* @__PURE__ */
433
434
  return jsxRuntime.jsx(ChatSurface,{...props,settings:settings})}function ChatBodyInProvider({activePet:activePet,...props}){let{presentation:presentation,isLocked:isLocked2}=useEverfurPresentationState(hostPresentation(props)),planEnabled=useCapabilityEnabled("healthPlan"),wantsPlan=presentation.chatTopCard==="focus"&&props.topCard===void 0&&planEnabled,plan=useHealthPlanPage({petRef:props.petRef??activePet??null,enabled:wantsPlan}),planPage=wantsPlan&&plan.phase==="ready"?plan.page:null,settings=react.useMemo(()=>({presentation:presentation,isLocked:isLocked2,planPage:planPage,inProvider:true}),[presentation,isLocked2,planPage]);/* @__PURE__ */
434
- return jsxRuntime.jsx(ChatSurface,{...props,settings:settings})}function ChatSurface({settings:settings,petRef:petRef2,conversationId:conversationId2,style:style,renderPending:renderPending,onCopy:onCopy,onPetChange:onPetChange,onVetPrep:onVetPrep,onFindVet:onFindVet,renderVetAction:renderVetAction,attachments:attachments,pet:pet,onAddPet:onAddPet,checkinTarget:checkinTarget,initialAsk:initialAsk,initialAskKey:initialAskKey,composerSeed:composerSeed,lifecycle:lifecycle,draftStore:draftStore,vetReturnTo:vetReturnTo,vetUsState:vetUsState,vetPrefer:vetPrefer,onOpenUrl:onOpenUrl,keyboardVerticalOffset:keyboardVerticalOffset,topCard:hostTopCard,onOpenHealthPlan:onOpenHealthPlan,answerCards:answerCards,historySheet:historySheet,historyBar:historyBar,starterPrompts:starterPrompts,emptyState:emptyState,header:header=true}){let{presentation:presentation,isLocked:isLocked2,planPage:planPage}=settings,{theme:theme,styles:styles2}=useChatTheme(),askHomeFactory=useAskHomeFactory(),askHome=react.useMemo(()=>askHomeFactory===null?null:askHomeFactory(theme),[askHomeFactory,theme]),hostPoweredBy=useHostPoweredBy(),motion=useChatMotion(),chatOpts=react.useMemo(()=>buildChatOpts(petRef2,conversationId2),[petRef2,conversationId2]),chat=useEverfurChat(chatOpts),view=selectView2(chat),pets=useChatPets(),history=useHistoryPanel(chat),insets=reactNativeSafeAreaContext.useSafeAreaInsets(),notice=turnNotice(chat),onCheckinFindVet=react.useMemo(()=>onFindVet===void 0?void 0:()=>{callHost(onFindVet,"emergency")},[onFindVet]),vet=react.useMemo(()=>vetReturnTo===void 0&&vetUsState===void 0&&vetPrefer===void 0?void 0:{returnTo:vetReturnTo,usState:vetUsState,prefer:vetPrefer},[vetReturnTo,vetUsState,vetPrefer]),shownPet=headerPet(pets.pets,chat.petRef),urgencySource=react.useMemo(()=>latestUrgencySource(chat.messages,shownPet?.name??null),[chat.messages,shownPet?.name]),urgency=useUrgencySurface(urgencySource);useSettleAnnouncement(chat),useAnimateLayoutOn(urgency.showBanner,motion),useCheckinTarget(chat.openCheckin,checkinTarget),useInitialAsk(chat.askEverfur,chat.isBootstrapping,initialAsk,initialAskKey);let seed=react.useMemo(()=>sanitizeSeedPrompt(composerSeed),[composerSeed]);useChatLifecycle(lifecycle,{conversationId:chat.conversationId===null?null:String(chat.conversationId),isTurnInFlight:chat.isStreaming,refresh:chat.refreshActiveThread});let historyUnread=(chat.hasUnreadThreads??false)||history.rows.some(row=>row.unreadCount!==null&&row.unreadCount>0)||(chat.unreadCount??0)>0,sentImages=useSentImages(chat.messages),[preview,setPreview]=react.useState(null),closePreview=react.useCallback(()=>setPreview(null),[]),[feedbackTarget,setFeedbackTarget]=react.useState(null),[thanksFor,setThanksFor]=react.useState(null),thanksTimer=react.useRef(null);react.useEffect(()=>()=>{thanksTimer.current&&clearTimeout(thanksTimer.current)},[]);let showThanks=react.useCallback(responseId=>{setThanksFor(String(responseId)),thanksTimer.current&&clearTimeout(thanksTimer.current),thanksTimer.current=setTimeout(()=>{setThanksFor(null),thanksTimer.current=null},THANKS_VISIBLE_MS)},[]),onSentiment=react.useCallback((message,sentiment)=>{let responseId=message.responseId;if(responseId===void 0)return;let recorded=chat.sentimentByMessage[String(responseId)];chat.feedback(responseId,sentiment),sentiment==="down"&&recorded!=="down"&&setFeedbackTarget(responseId)},[chat]),submitReasons=react.useCallback(async(reason,notes)=>feedbackTarget===null||!(await chat.feedback(feedbackTarget,"down",reason??"other",notes)).ok?false:(setFeedbackTarget(null),showThanks(feedbackTarget),true),[chat,feedbackTarget,showThanks]),skipReasons=react.useCallback(()=>setFeedbackTarget(null),[]),onSelectPrompt=react.useCallback(prompt=>{chat.send(prompt)},[chat.send]),openCitation=react.useMemo(()=>onOpenUrl===void 0?void 0:url=>{callHost(onOpenUrl,url,"citation")},[onOpenUrl]),avoidBehavior=reactNative.Platform.OS==="ios"?"padding":void 0,keyboard=useChatKeyboardOffset(keyboardVerticalOffset,avoidBehavior!==void 0),topInset=keyboard.topInWindow===null?insets.top:Math.max(0,insets.top-keyboard.topInWindow),keyboardOpen=useKeyboardOpen(),planCard=react.useMemo(()=>hostTopCard===void 0?healthPlanTopCard(planPage,{onOpenPlan:onOpenHealthPlan}):void 0,[hostTopCard,planPage,onOpenHealthPlan]),card=presentation.chatTopCard==="focus"?hostTopCard??planCard:void 0,[cardOpen,setCardOpen]=react.useState(true),onCardAsk=react.useCallback(prompt=>{chat.send(prompt)},[chat.send]),followUpPolicy=react.useMemo(()=>followUpPolicyFor(void 0,presentation,isLocked2("chatFollowUpCount")),[presentation,isLocked2]),sheet=presentation.chatHistoryStyle==="sheet",threadEmpty=chat.messages.length===0,pill=card!==void 0?/* @__PURE__ */jsxRuntime.jsx(TopCardPill,{card:card,open:cardOpen,onOpenChange:setCardOpen}):null,barNode=historyBar!==void 0?/* @__PURE__ */jsxRuntime.jsx(HistoryBar,{bar:historyBar,history:history,empty:threadEmpty,unread:historyUnread,extra:pill}):null,barInThread=presentation.chatHistoryBar==="scroll"&&(view==="empty"||view==="populated"),cardNode=card===void 0?null:/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
435
- /* @__PURE__ */jsxRuntime.jsx(TopCard,{card:card,open:cardOpen,onOpenChange:setCardOpen,ask:onCardAsk}),historyBar===void 0?pill:null]}),barShown=historyBar!==void 0,historyLoad=history.load,historyOpen=history.open;react.useEffect(()=>{barShown&&!historyOpen&&historyLoad()},[barShown,historyOpen,chat.conversationId,historyLoad]);let composerProps={send:chat.send,stop:chat.stop,isStreaming:chat.isStreaming,conversationId:chat.conversationId,seed:seed,draftStore:draftStore,onStage:sentImages.stage,onPreview:setPreview,petName:shownPet?.name??null,compact:presentation.chatComposerStyle==="compact",petPlaceholder:presentation.chatComposerPlaceholder==="pet_name",dimEmptySend:presentation.chatSendButton==="dim_when_empty"},textingAsk=useChatTextingAsk(presentation.chatTextingAsk&&settings.inProvider,chat),uploadOn=attachments!==void 0&&presentation.chatComposerUpload,bannerHidden=!presentation.chatGeneralBanner&&urgency.source?.level==="general",footnoteInThread=askHome!==null&&presentation.safetyDisclaimerPlacement==="answer_footer"&&(view==="empty"||view==="populated"),footnote=/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.footnote,accessibilityRole:"text",children:CHAT_COPY.footnoteNative});
435
+ return jsxRuntime.jsx(ChatSurface,{...props,settings:settings})}function ChatSurface({settings:settings,petRef:petRef2,conversationId:conversationId2,style:style,renderPending:renderPending,onCopy:onCopy,onPetChange:onPetChange,onVetPrep:onVetPrep,onFindVet:onFindVet,renderVetAction:renderVetAction,attachments:attachments,pet:pet,onAddPet:onAddPet,checkinTarget:checkinTarget,initialAsk:initialAsk,initialAskKey:initialAskKey,composerSeed:composerSeed,lifecycle:lifecycle,draftStore:draftStore,vetReturnTo:vetReturnTo,vetUsState:vetUsState,vetPrefer:vetPrefer,onOpenUrl:onOpenUrl,keyboardVerticalOffset:keyboardVerticalOffset,topCard:hostTopCard,onOpenHealthPlan:onOpenHealthPlan,answerCards:answerCards,historySheet:historySheet,historyBar:historyBar,starterPrompts:starterPrompts,emptyState:emptyState,header:header=true,textingEntry:textingEntry=true}){let{presentation:presentation,isLocked:isLocked2,planPage:planPage}=settings,{theme:theme,styles:styles2}=useChatTheme(),askHomeFactory=useAskHomeFactory(),askHome=react.useMemo(()=>askHomeFactory===null?null:askHomeFactory(theme),[askHomeFactory,theme]),hostPoweredBy=useHostPoweredBy(),motion=useChatMotion(),chatOpts=react.useMemo(()=>buildChatOpts(petRef2,conversationId2),[petRef2,conversationId2]),chat=useEverfurChat(chatOpts),view=selectView2(chat),pets=useChatPets(),history=useHistoryPanel(chat),insets=reactNativeSafeAreaContext.useSafeAreaInsets(),notice=turnNotice(chat),onCheckinFindVet=react.useMemo(()=>onFindVet===void 0?void 0:()=>{callHost(onFindVet,"emergency")},[onFindVet]),vet=react.useMemo(()=>vetReturnTo===void 0&&vetUsState===void 0&&vetPrefer===void 0?void 0:{returnTo:vetReturnTo,usState:vetUsState,prefer:vetPrefer},[vetReturnTo,vetUsState,vetPrefer]),shownPet=headerPet(pets.pets,chat.petRef),urgencySource=react.useMemo(()=>latestUrgencySource(chat.messages,shownPet?.name??null),[chat.messages,shownPet?.name]),urgency=useUrgencySurface(urgencySource);useSettleAnnouncement(chat),useAnimateLayoutOn(urgency.showBanner,motion),useCheckinTarget(chat.openCheckin,checkinTarget),useInitialAsk(chat.askEverfur,chat.isBootstrapping,initialAsk,initialAskKey);let seed=react.useMemo(()=>sanitizeSeedPrompt(composerSeed),[composerSeed]);useChatLifecycle(lifecycle,{conversationId:chat.conversationId===null?null:String(chat.conversationId),isTurnInFlight:chat.isStreaming,refresh:chat.refreshActiveThread});let historyUnread=(chat.hasUnreadThreads??false)||history.rows.some(row=>row.unreadCount!==null&&row.unreadCount>0)||(chat.unreadCount??0)>0,sentImages=useSentImages(chat.messages),[preview,setPreview]=react.useState(null),closePreview=react.useCallback(()=>setPreview(null),[]),[feedbackTarget,setFeedbackTarget]=react.useState(null),[thanksFor,setThanksFor]=react.useState(null),thanksTimer=react.useRef(null);react.useEffect(()=>()=>{thanksTimer.current&&clearTimeout(thanksTimer.current)},[]);let showThanks=react.useCallback(responseId=>{setThanksFor(String(responseId)),thanksTimer.current&&clearTimeout(thanksTimer.current),thanksTimer.current=setTimeout(()=>{setThanksFor(null),thanksTimer.current=null},THANKS_VISIBLE_MS)},[]),onSentiment=react.useCallback((message,sentiment)=>{let responseId=message.responseId;if(responseId===void 0)return;let recorded=chat.sentimentByMessage[String(responseId)];chat.feedback(responseId,sentiment),sentiment==="down"&&recorded!=="down"&&setFeedbackTarget(responseId)},[chat]),submitReasons=react.useCallback(async(reason,notes)=>feedbackTarget===null||!(await chat.feedback(feedbackTarget,"down",reason??"other",notes)).ok?false:(setFeedbackTarget(null),showThanks(feedbackTarget),true),[chat,feedbackTarget,showThanks]),skipReasons=react.useCallback(()=>setFeedbackTarget(null),[]),onSelectPrompt=react.useCallback(prompt=>{chat.send(prompt)},[chat.send]),openCitation=react.useMemo(()=>onOpenUrl===void 0?void 0:url=>{callHost(onOpenUrl,url,"citation")},[onOpenUrl]),avoidBehavior=reactNative.Platform.OS==="ios"?"padding":void 0,keyboard=useChatKeyboardOffset(keyboardVerticalOffset,avoidBehavior!==void 0),topInset=keyboard.topInWindow===null?insets.top:Math.max(0,insets.top-keyboard.topInWindow),keyboardOpen=useKeyboardOpen(),planCard=react.useMemo(()=>hostTopCard===void 0?healthPlanTopCard(planPage,{onOpenPlan:onOpenHealthPlan}):void 0,[hostTopCard,planPage,onOpenHealthPlan]),card=presentation.chatTopCard==="focus"?hostTopCard??planCard:void 0,[cardOpen,setCardOpen]=react.useState(true),onCardAsk=react.useCallback(prompt=>{chat.send(prompt)},[chat.send]),followUpPolicy=react.useMemo(()=>followUpPolicyFor(void 0,presentation,isLocked2("chatFollowUpCount")),[presentation,isLocked2]),sheet=presentation.chatHistoryStyle==="sheet",threadEmpty=chat.messages.length===0,pill=card!==void 0?/* @__PURE__ */jsxRuntime.jsx(TopCardPill,{card:card,open:cardOpen,onOpenChange:setCardOpen}):null,barNode=historyBar!==void 0?/* @__PURE__ */jsxRuntime.jsx(HistoryBar,{bar:historyBar,history:history,empty:threadEmpty,unread:historyUnread,extra:pill}):null,barInThread=presentation.chatHistoryBar==="scroll"&&(view==="empty"||view==="populated"),cardNode=card===void 0?null:/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
436
+ /* @__PURE__ */jsxRuntime.jsx(TopCard,{card:card,open:cardOpen,onOpenChange:setCardOpen,ask:onCardAsk}),historyBar===void 0?pill:null]}),barShown=historyBar!==void 0,historyLoad=history.load,historyOpen=history.open;react.useEffect(()=>{barShown&&!historyOpen&&historyLoad()},[barShown,historyOpen,chat.conversationId,historyLoad]);let composerProps={send:chat.send,stop:chat.stop,isStreaming:chat.isStreaming,conversationId:chat.conversationId,seed:seed,draftStore:draftStore,onStage:sentImages.stage,onPreview:setPreview,petName:shownPet?.name??null,compact:presentation.chatComposerStyle==="compact",petPlaceholder:presentation.chatComposerPlaceholder==="pet_name",dimEmptySend:presentation.chatSendButton==="dim_when_empty"},textingAsk=useChatTextingAsk(presentation.chatTextingAsk&&settings.inProvider,chat,textingEntry),uploadOn=attachments!==void 0&&presentation.chatComposerUpload,bannerHidden=!presentation.chatGeneralBanner&&urgency.source?.level==="general",footnoteInThread=askHome!==null&&presentation.safetyDisclaimerPlacement==="answer_footer"&&(view==="empty"||view==="populated"),footnote=/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.footnote,accessibilityRole:"text",children:CHAT_COPY.footnoteNative});
436
437
  /* @__PURE__ */
437
438
  return jsxRuntime.jsx(AskHomeContext.Provider,{value:askHome,children:/* @__PURE__ */jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:[styles2.container,{paddingTop:topInset},style],behavior:avoidBehavior,...keyboard.avoidingProps,children:[
438
- /* @__PURE__ */jsxRuntime.jsx(KeyboardOffsetProbe,{probeRef:keyboard.probeRef}),header?/* @__PURE__ */jsxRuntime.jsx(ChatHeader,{pets:pets,petRef:chat.petRef,historyUnread:historyUnread,onOpenHistory:history.show,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet}):null,pet!==void 0?/* @__PURE__ */jsxRuntime.jsx(PetSetupNotice,{petRef:petRef2??null,pet:pet,onRegistered:pets.refresh}):null,barInThread?null:barNode,bannerHidden?null:/* @__PURE__ */jsxRuntime.jsx(UrgencyBanner,{surface:urgency,petRef:chat.petRef,renderVetAction:renderVetAction,onFindVet:onFindVet,vet:vet,compact:keyboardOpen}),
439
+ /* @__PURE__ */jsxRuntime.jsx(KeyboardOffsetProbe,{probeRef:keyboard.probeRef}),header?/* @__PURE__ */jsxRuntime.jsx(ChatHeader,{pets:pets,petRef:chat.petRef,historyUnread:historyUnread,onOpenHistory:history.show,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet,textingEntry:textingAsk.headerEntry}):null,pet!==void 0?/* @__PURE__ */jsxRuntime.jsx(PetSetupNotice,{petRef:petRef2??null,pet:pet,onRegistered:pets.refresh}):null,!header&&textingAsk.headerEntry!==null?/* @__PURE__ */jsxRuntime.jsx(TextingEntryRow,{entry:textingAsk.headerEntry,place:"thread"}):null,barInThread?null:barNode,bannerHidden?null:/* @__PURE__ */jsxRuntime.jsx(UrgencyBanner,{surface:urgency,petRef:chat.petRef,renderVetAction:renderVetAction,onFindVet:onFindVet,vet:vet,compact:keyboardOpen}),
439
440
  /* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.body,children:renderView(view,chat,{notice:notice,vet:vet,onCheckinFindVet:onCheckinFindVet,onSelectPrompt:onSelectPrompt,renderPending:renderPending,shownPet:shownPet,onVetPrep:onVetPrep,onCopy:onCopy,onSentiment:onSentiment,thanksFor:thanksFor,imagesByMessage:sentImages.byMessage,onPreview:setPreview,onAddPet:onAddPet,onOpenUrl:openCitation,threadTop:barInThread?barNode:null,topCard:cardNode,starterPrompts:starterPrompts,emptyState:emptyState,emptyCentered:presentation.chatAnswerStyle==="cards",followUpPolicy:followUpPolicy,answerCards:presentation.chatAnswerStyle==="cards"?answerCards??NO_ANSWER_CARDS:null,threadFoot:footnoteInThread?footnote:null,threadAside:textingAsk.line,threadAsideKey:textingAsk.stage})}),textingAsk.runner,textingAsk.entry!==null?/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.composerOuter,children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles2.askEntry,children:textingAsk.entry})}):uploadOn&&attachments!==void 0?/* @__PURE__ */jsxRuntime.jsx(ComposerWithAttachments,{...composerProps,attachments:attachments}):/* @__PURE__ */jsxRuntime.jsx(Composer,{...composerProps,attachments:null}),footnoteInThread?null:footnote,theme.meta.hidePoweredBy||hostPoweredBy?null:/* @__PURE__ */jsxRuntime.jsx(Text,{tier:"compact",style:styles2.poweredBy,accessibilityRole:"text",accessibilityLabel:CHAT_COPY.poweredBy,children:CHAT_COPY.poweredBy}),sheet?/* @__PURE__ */jsxRuntime.jsx(HistorySheet,{chat:chat,history:history,sheet:historySheet}):/* @__PURE__ */jsxRuntime.jsx(HistoryDrawer,{chat:chat,history:history}),
440
441
  /* @__PURE__ */jsxRuntime.jsx(FeedbackReasons,{visible:feedbackTarget!==null,onSubmit:submitReasons,onSkip:skipReasons}),
441
442
  /* @__PURE__ */jsxRuntime.jsx(AttachmentImageLightbox,{uri:preview?.uri??null,label:preview?.label??"",onClose:closePreview}),
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
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 */
1
2
  export { B as Brand, a as ClientId, C as ConversationId, D as DocumentId, J as JobId, P as PetRef, R as RecordsRequestId, b as ResponseId, U as UserRef, _ as __brand, c as conversationId, p as petRef, u as userRef } from './ids.d-B2GAAifq.cjs';
2
3
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as categoryFor, i as isRetryableCode, u as userFacingError } from './EverfurError.d-8NHtlgzA.cjs';
3
4
  export { a as EverfurConfigError, E as EverfurResult, b as EverfurThrownError, i as isErr, c as isOk, u as unwrap } from './EverfurResult.d-BFH-3s6E.cjs';
4
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-C0WgjutL.cjs';
5
- export { M as MintedToken, T as TokenProvider } from './identity.d-CioQhZrq.cjs';
6
- export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-CHdH-y2c.cjs';
5
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-BQgrIDdu.cjs';
6
+ export { M as MintedToken, T as TokenProvider } from './identity.d-HbwYQ4-z.cjs';
7
+ export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-Cv38YuzP.cjs';
7
8
  export { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
8
9
  export { E as EverfurFaceStyle, a as EverfurThemeAdjustment, f as face, h as headingFace, p as previewTheme, t as themeAdjustments } from './typeStyle.d-DmlwyJq-.cjs';
9
10
  import { C as CapabilityName, a as CapabilityDecision } from './resolve.d-CoQWUy1Y.cjs';
@@ -12,18 +13,18 @@ export { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.cjs';
12
13
  export { I as ImageCachePort, K as KvPort } from './cacheEpoch.d-DknKn3S0.cjs';
13
14
  export { C as CameraPort, a as CaptureOptions, M as MediaSource } from './CameraPort.d-Cv31Pz7g.cjs';
14
15
  export { F as FileHandle, b as FilePort, a as UploadPolicyWire, U as UploadTransport } from './ports.d-BX4f4UsB.cjs';
15
- export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-gZNTn8Qf.cjs';
16
+ export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-ClbPRUtx.cjs';
16
17
  export { R as RecordsDocumentPicker, a as RnRecordsUploadFetch, b as RnRecordsUploadTransportOptions, c as createRnRecordsUploadTransport } from './uploadTransport.d-CWL7CdWP.cjs';
17
- export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-CsUJ2Oyb.cjs';
18
+ export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-BMOnT1fg.cjs';
18
19
  import { ReactNode } from 'react';
19
- import { E as EverfurProviderProps } from './context.d-Du_UPxa1.cjs';
20
- export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-Du_UPxa1.cjs';
20
+ import { E as EverfurProviderProps } from './context.d-Ba8YyJpk.cjs';
21
+ export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-Ba8YyJpk.cjs';
21
22
  import { StyleProp, ViewStyle } from 'react-native';
22
- export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, c as UseChatAttachmentsOptions, d as UseChatAttachmentsState, e as UseEverfurChatState, f as UseEverfurPetsState, u as useChatAttachments, g as useEverfurChat, h as useEverfurPets } from './attachments.d-CpaOfi2g.cjs';
23
- export { E as EverfurChat, a as EverfurChatAnswerCard, b as EverfurChatAnswerCards, c as EverfurChatAnswerContext, d as EverfurChatAttachments, e as EverfurChatEmptyState, f as EverfurChatFollowUpAction, g as EverfurChatHistoryBar, h as EverfurChatHistorySheet, i as EverfurChatProps, j as EverfurChatTopCard } from './Chat.d-CtfANk3A.cjs';
23
+ export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, c as UseChatAttachmentsOptions, d as UseChatAttachmentsState, e as UseEverfurChatState, f as UseEverfurPetsState, u as useChatAttachments, g as useEverfurChat, h as useEverfurPets } from './attachments.d-DRHsJkni.cjs';
24
+ export { E as EverfurChat, a as EverfurChatAnswerCard, b as EverfurChatAnswerCards, c as EverfurChatAnswerContext, d as EverfurChatAttachments, e as EverfurChatEmptyState, f as EverfurChatFollowUpAction, g as EverfurChatHistoryBar, h as EverfurChatHistorySheet, i as EverfurChatProps, j as EverfurChatTopCard } from './Chat.d-BO5iJsR2.cjs';
24
25
  export { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.cjs';
25
- export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-B5DWzU7C.cjs';
26
- export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-CqHMGoER.cjs';
26
+ export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-Bwfe8yuR.cjs';
27
+ export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-DRUC35Ti.cjs';
27
28
  export { E as EverfurChatAnswerStyle, a as EverfurChatComposerPlaceholder, b as EverfurChatComposerStyle, c as EverfurChatHistoryBarSetting, d as EverfurChatHistoryStyle, e as EverfurChatSendButtonSetting, f as EverfurChatTopCardSetting, g as EverfurHealthPlanLayout, h as EverfurPresentation, i as EverfurPresentationInput, j as EverfurSafetyDisclaimerPlacement } from './presentation.d-vy8kTGfR.cjs';
28
29
  export { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.cjs';
29
30
  export { b as PetActivityLevel, c as PetAllergy, d as PetAllergySeverity, e as PetBirthDatePrecision, f as PetCondition, a as PetHealthProfile, P as PetHealthProfileInput, g as PetIndoorOutdoor, h as PetMedication, i as PetSex } from './profile.d-CSs1wlXT.cjs';
@@ -31,7 +32,7 @@ export { C as CanonicalPetSpecies, c as canonicalPetSpecies } from './species.d-
31
32
  import { E as EverfurThemeInput } from './branding.d-Bbc6p1XY.cjs';
32
33
  export { A as APPEARANCE_PRESETS, a as APPEARANCE_PRESET_NAMES, b as APPEARANCE_SIZE_RANGES, c as EverfurAppearance, d as EverfurAppearanceFont, e as EverfurAppearancePreset, f as EverfurAppearanceRules, g as EverfurAppearanceVariables, h as EverfurThemeFontFaceKey, i as EverfurThemeFontUrlsInput, j as EverfurThemeFontsInput, k as EverfurThemeSlotInput, l as EverfurThemeSlotsInput, m as expandAppearance } from './branding.d-Bbc6p1XY.cjs';
33
34
  export { E as EverfurColorTokens, a as EverfurFontFaceKey, b as EverfurFontFamilies, c as EverfurFontSource, d as EverfurFontWeight, e as EverfurLetterSpacingTokens, f as EverfurLineHeightTokens, g as EverfurMotionDurationTokens, h as EverfurMotionTokens, i as EverfurRadiusTokens, j as EverfurSpaceTokens, k as EverfurSpringToken, l as EverfurTextColorTokens, m as EverfurTheme, n as EverfurThemeMeta, o as EverfurThemeSlot, p as EverfurThemeSlotKey, q as EverfurThemeSlotName, r as EverfurThemeSlots, s as EverfurTypeSizeTokens, t as EverfurTypeTokens, u as EverfurWeightTokens, T as THEME_SLOT_KEYS, v as THEME_SLOT_KEYS_BY_SLOT, w as THEME_SLOT_NAMES, x as themeSlotKeysFor } from './tokens.d-BUVqme2D.cjs';
34
- import './requestFunnel.d-CR4akGCY.cjs';
35
+ import './requestFunnel.d-JoqddYSx.cjs';
35
36
 
36
37
  /**
37
38
  * Wrap the tree ONCE, high. Mounting constructs the runtime (transport, identity, registry,
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
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 */
1
2
  export { B as Brand, a as ClientId, C as ConversationId, D as DocumentId, J as JobId, P as PetRef, R as RecordsRequestId, b as ResponseId, U as UserRef, _ as __brand, c as conversationId, p as petRef, u as userRef } from './ids.d-B2GAAifq.js';
2
3
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as categoryFor, i as isRetryableCode, u as userFacingError } from './EverfurError.d-8NHtlgzA.js';
3
4
  export { a as EverfurConfigError, E as EverfurResult, b as EverfurThrownError, i as isErr, c as isOk, u as unwrap } from './EverfurResult.d-D_-254ZY.js';
4
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-zd2eTb2L.js';
5
- export { M as MintedToken, T as TokenProvider } from './identity.d-BksOEa6m.js';
6
- export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-BqBOrZxa.js';
5
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-XSMThgVj.js';
6
+ export { M as MintedToken, T as TokenProvider } from './identity.d-Be2Es9Td.js';
7
+ export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-DQTBJAbk.js';
7
8
  export { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
8
9
  export { E as EverfurFaceStyle, a as EverfurThemeAdjustment, f as face, h as headingFace, p as previewTheme, t as themeAdjustments } from './typeStyle.d-B3Kdtjie.js';
9
10
  import { C as CapabilityName, a as CapabilityDecision } from './resolve.d-CoQWUy1Y.js';
@@ -12,18 +13,18 @@ export { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.js';
12
13
  export { I as ImageCachePort, K as KvPort } from './cacheEpoch.d-DknKn3S0.js';
13
14
  export { C as CameraPort, a as CaptureOptions, M as MediaSource } from './CameraPort.d-Cv31Pz7g.js';
14
15
  export { F as FileHandle, b as FilePort, a as UploadPolicyWire, U as UploadTransport } from './ports.d-BX4f4UsB.js';
15
- export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-BDtwHxmW.js';
16
+ export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-DzEJMVRs.js';
16
17
  export { R as RecordsDocumentPicker, a as RnRecordsUploadFetch, b as RnRecordsUploadTransportOptions, c as createRnRecordsUploadTransport } from './uploadTransport.d-EGoUl7gX.js';
17
- export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-DG83Ggbq.js';
18
+ export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-C__BnffJ.js';
18
19
  import { ReactNode } from 'react';
19
- import { E as EverfurProviderProps } from './context.d-BBjmV0rz.js';
20
- export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-BBjmV0rz.js';
20
+ import { E as EverfurProviderProps } from './context.d-xoh5vmxS.js';
21
+ export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-xoh5vmxS.js';
21
22
  import { StyleProp, ViewStyle } from 'react-native';
22
- export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, c as UseChatAttachmentsOptions, d as UseChatAttachmentsState, e as UseEverfurChatState, f as UseEverfurPetsState, u as useChatAttachments, g as useEverfurChat, h as useEverfurPets } from './attachments.d-BGn2_knv.js';
23
- export { E as EverfurChat, a as EverfurChatAnswerCard, b as EverfurChatAnswerCards, c as EverfurChatAnswerContext, d as EverfurChatAttachments, e as EverfurChatEmptyState, f as EverfurChatFollowUpAction, g as EverfurChatHistoryBar, h as EverfurChatHistorySheet, i as EverfurChatProps, j as EverfurChatTopCard } from './Chat.d-a7Ksz7NZ.js';
23
+ export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, c as UseChatAttachmentsOptions, d as UseChatAttachmentsState, e as UseEverfurChatState, f as UseEverfurPetsState, u as useChatAttachments, g as useEverfurChat, h as useEverfurPets } from './attachments.d-DFP9yvz9.js';
24
+ export { E as EverfurChat, a as EverfurChatAnswerCard, b as EverfurChatAnswerCards, c as EverfurChatAnswerContext, d as EverfurChatAttachments, e as EverfurChatEmptyState, f as EverfurChatFollowUpAction, g as EverfurChatHistoryBar, h as EverfurChatHistorySheet, i as EverfurChatProps, j as EverfurChatTopCard } from './Chat.d-BlsnQwCQ.js';
24
25
  export { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.js';
25
- export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-Ba3xhJcj.js';
26
- export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-CoQhXrP9.js';
26
+ export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-DUaAWoTv.js';
27
+ export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-C2nkIyDB.js';
27
28
  export { E as EverfurChatAnswerStyle, a as EverfurChatComposerPlaceholder, b as EverfurChatComposerStyle, c as EverfurChatHistoryBarSetting, d as EverfurChatHistoryStyle, e as EverfurChatSendButtonSetting, f as EverfurChatTopCardSetting, g as EverfurHealthPlanLayout, h as EverfurPresentation, i as EverfurPresentationInput, j as EverfurSafetyDisclaimerPlacement } from './presentation.d-vy8kTGfR.js';
28
29
  export { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.js';
29
30
  export { b as PetActivityLevel, c as PetAllergy, d as PetAllergySeverity, e as PetBirthDatePrecision, f as PetCondition, a as PetHealthProfile, P as PetHealthProfileInput, g as PetIndoorOutdoor, h as PetMedication, i as PetSex } from './profile.d-CSs1wlXT.js';
@@ -31,7 +32,7 @@ export { C as CanonicalPetSpecies, c as canonicalPetSpecies } from './species.d-
31
32
  import { E as EverfurThemeInput } from './branding.d-y6c0UwhE.js';
32
33
  export { A as APPEARANCE_PRESETS, a as APPEARANCE_PRESET_NAMES, b as APPEARANCE_SIZE_RANGES, c as EverfurAppearance, d as EverfurAppearanceFont, e as EverfurAppearancePreset, f as EverfurAppearanceRules, g as EverfurAppearanceVariables, h as EverfurThemeFontFaceKey, i as EverfurThemeFontUrlsInput, j as EverfurThemeFontsInput, k as EverfurThemeSlotInput, l as EverfurThemeSlotsInput, m as expandAppearance } from './branding.d-y6c0UwhE.js';
33
34
  export { E as EverfurColorTokens, a as EverfurFontFaceKey, b as EverfurFontFamilies, c as EverfurFontSource, d as EverfurFontWeight, e as EverfurLetterSpacingTokens, f as EverfurLineHeightTokens, g as EverfurMotionDurationTokens, h as EverfurMotionTokens, i as EverfurRadiusTokens, j as EverfurSpaceTokens, k as EverfurSpringToken, l as EverfurTextColorTokens, m as EverfurTheme, n as EverfurThemeMeta, o as EverfurThemeSlot, p as EverfurThemeSlotKey, q as EverfurThemeSlotName, r as EverfurThemeSlots, s as EverfurTypeSizeTokens, t as EverfurTypeTokens, u as EverfurWeightTokens, T as THEME_SLOT_KEYS, v as THEME_SLOT_KEYS_BY_SLOT, w as THEME_SLOT_NAMES, x as themeSlotKeysFor } from './tokens.d-BUVqme2D.js';
34
- import './requestFunnel.d-DFf9C__p.js';
35
+ import './requestFunnel.d-YabU6G-Z.js';
35
36
 
36
37
  /**
37
38
  * Wrap the tree ONCE, high. Mounting constructs the runtime (transport, identity, registry,