@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
@@ -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
  import{createContext,forwardRef,createElement,useMemo,useState,useRef,useEffect,useCallback,useSyncExternalStore,useContext,Fragment as Fragment$1,Component}from"react";import{TextInput as TextInput$1,StyleSheet,Platform,KeyboardAvoidingView,View,Pressable,Text as Text$1,Dimensions,Keyboard,Modal,ScrollView,ActivityIndicator,Image,AccessibilityInfo,UIManager,LayoutAnimation,Animated,useWindowDimensions,FlatList,Linking}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{jsx,jsxs,Fragment}from"react/jsx-runtime";import*as bookingExperience from"@everfur/sdk/televet/booking";import*as texting from"@everfur/sdk/texting";var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
2
3
  /* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
3
4
  /* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
@@ -100,7 +101,6 @@ return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _Everf
100
101
  /* @__PURE__ */Object.freeze({key:"unclear",label:CHAT_COPY.feedbackReasonUnclear,feedbackType:"unclear"}),
101
102
  /* @__PURE__ */Object.freeze({key:"other",label:CHAT_COPY.feedbackReasonOther,feedbackType:"not_helpful"})]),SENTIMENT_OPTIONS=/* @__PURE__ */Object.freeze([
102
103
  /* @__PURE__ */Object.freeze({sentiment:"up",label:CHAT_COPY.feedbackHelpful}),
103
- /* @__PURE__ */Object.freeze({sentiment:"neutral",label:CHAT_COPY.feedbackNeutral}),
104
104
  /* @__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 assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
105
105
  return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base2=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base2,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
106
106
  /* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
@@ -189,7 +189,7 @@ return jsxs(View,{style:styles2.anchor,pointerEvents:"box-none",children:[
189
189
  /* @__PURE__ */jsx(Image,{source:{uri:row.previewUri},style:styles2.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),uploading?/* @__PURE__ */jsx(View,{style:styles2.uploadingOverlay,children:/* @__PURE__ */jsx(ActivityIndicator,{size:"small",color:theme.color.surface})}):null,flash?/* @__PURE__ */jsx(SuccessFlash,{styles:styles2,onDone:()=>setFlash(false)}):null]})}),failed?/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:fillCopy(CHAT_COPY.retryUpload,{filename:row.filename}),style:styles2.failedOverlay,onPress:()=>onRetry(row.id),children:/* @__PURE__ */jsx(View,{style:styles2.failedInner,children:/* @__PURE__ */jsx(CloseGlyph,{size:SUCCESS_GLYPH,color:theme.color.surface,strokeWidth:2})})}):null,
190
190
  /* @__PURE__ */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__ */jsx(CloseGlyph,{size:REMOVE_GLYPH,color:theme.color.surface,strokeWidth:1.5})})]})}function SuccessFlash({styles:styles2,onDone:onDone}){let theme=useEverfurTheme(),motion=useChatMotion(),opacity=useRef(null);opacity.current===null&&(opacity.current=new Animated.Value(0));let value=opacity.current;return useEffect(()=>{let animation=Animated.sequence([Animated.timing(value,{toValue:1,duration:SUCCESS_FLASH_FADE_IN_MS,useNativeDriver:true}),Animated.delay(motion.uploadFlashMs),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__ */jsx(Animated.View,{pointerEvents:"none",style:[styles2.successOverlay,{opacity:value}],children:/* @__PURE__ */jsx(CheckGlyph,{size:SUCCESS_GLYPH,color:theme.color.surface,strokeWidth:2})})}function SentImages({images:images,onPreview:onPreview}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles3(theme),[theme]);if(images.length===0)return null;let single=images.length===1;/* @__PURE__ */
191
191
  return jsx(View,{style:single?styles2.sentSingle:styles2.sentGrid,children:images.map((image,index)=>/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:fillCopy(CHAT_COPY.attachedImage,{filename:image.filename}),onPress:()=>onPreview(image),children:/* @__PURE__ */jsx(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 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: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 FILE_FIELD="file",NOT_SENT="multipart upload failed";function postRnMultipart(post){let form;try{form=new FormData;for(let[name,value]of Object.entries(post.fields))form.append(name,value);form.append(FILE_FIELD,post.file)}catch{return Promise.reject(new Error(NOT_SENT))}return post.fetch!==void 0?postWithFetch(post.fetch,post.url,form,post.signal):postWithXhr(post.url,form,post.signal)}function stored(status){return status>=200&&status<300}function postWithXhr(url,form,signal){return new Promise((resolve,reject)=>{let Xhr=globalThis.XMLHttpRequest;if(typeof Xhr!="function"||signal?.aborted===true){reject(new Error(NOT_SENT));return}let onAbort=null,release=()=>{onAbort!==null&&signal?.removeEventListener("abort",onAbort)},fail=()=>{release(),reject(new Error(NOT_SENT))};try{let xhr=new Xhr;xhr.open("POST",url),xhr.withCredentials=!1,xhr.onload=()=>{release(),resolve(stored(xhr.status))},xhr.onerror=fail,xhr.ontimeout=fail,xhr.onabort=fail,signal!==void 0&&(onAbort=()=>{try{xhr.abort()}finally{fail()}},signal.addEventListener("abort",onAbort,{once:!0})),xhr.send(form)}catch{fail()}})}function postWithFetch(send,url,form,signal){return Promise.resolve().then(()=>send(url,{method:"POST",body:form,credentials:"omit",...signal?{signal:signal}:{}})).then(res=>res.ok)}var NO_URI="chat attachment upload: the file handle has no uri",FAILED="chat attachment upload failed";function filePartOf(file){return{uri:file.uri,name:sanitizeFilename(file.name),type:file.mimeType}}function createRnChatAttachmentTransport(options={}){/* @__PURE__ */
192
- return Object.freeze({postMultipart(policy,file,opts){if(typeof file.uri!="string"||file.uri.length===0)return Promise.reject(new Error(NO_URI));let{signal:signal,onProgress:onProgress}=opts,failed=()=>Promise.reject(new Error(FAILED));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=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 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:StyleSheet.hairlineWidth,borderColor:c.brandBorder,alignItems:"flex-start",...slotBox(slots.card,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=useMemo(()=>createRnChatAttachmentTransport(),[]),state=useChatAttachments({maxPerMessage:attachments.maxPerMessage??DEFAULT_MAX_PER_MESSAGE,transport:transport}),bound=useMemo(()=>({state:state,sources:attachments.sources??DEFAULT_SOURCES,pick:attachments.pick}),[state,attachments.sources,attachments.pick]);/* @__PURE__ */
192
+ return Object.freeze({postMultipart(policy,file,opts){if(typeof file.uri!="string"||file.uri.length===0)return Promise.reject(new Error(NO_URI));let{signal:signal,onProgress:onProgress}=opts,failed=()=>Promise.reject(new Error(FAILED));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=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 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:StyleSheet.hairlineWidth,borderColor:c.brandBorder,alignItems:"flex-start",...slotBox(slots.card,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=useMemo(()=>createRnChatAttachmentTransport(),[]),state=useChatAttachments({maxPerMessage:attachments.maxPerMessage??DEFAULT_MAX_PER_MESSAGE,transport:transport}),bound=useMemo(()=>({state:state,sources:attachments.sources??DEFAULT_SOURCES,pick:attachments.pick}),[state,attachments.sources,attachments.pick]);/* @__PURE__ */
193
193
  return jsx(Composer,{...rest,attachments:bound})}function Composer({send:send,stop:stop,isStreaming:isStreaming,conversationId:conversationId,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=useMemo(()=>makeCompactStyles(theme),[theme]),motion=useChatMotion(),[draft,setDraft]=useChatDraft(send,conversationId,seed);usePersistedDraft(draftStore,conversationId===null?null:String(conversationId),draft,setDraft);let[pickerOpen,setPickerOpen]=useState(false),[pickFailed,setPickFailed]=useState(false);useEffect(()=>{setPickFailed(false)},[conversationId]);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=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=useCallback(()=>{stop()},[stop]),pickFrom=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=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__ */
194
194
  return jsxs(View,{style:styles2.composerOuter,children:[attachments!==null&&pickerOpen?/* @__PURE__ */jsx(AttachmentPickerPopover,{sources:attachments.sources,full:slotsFull,onPick:pickFrom,onClose:()=>setPickerOpen(false)}):null,
195
195
  /* @__PURE__ */jsxs(View,{style:compact?[styles2.composer,compactStyles.bar]:styles2.composer,children:[attachments!==null?/* @__PURE__ */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,
@@ -220,8 +220,9 @@ return jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:fillCopy(i
220
220
  /* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.meta,numberOfLines:1,children:isActive?`${CHAT_COPY.activePrefix}${meta}`:meta})]}),isActive?/* @__PURE__ */jsx(CheckGlyph,{size:CHECK_SIZE,color:theme.color.brandInk}):null]},pet.petRef)})}),onAddPet!==null?/* @__PURE__ */jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.addAnotherPet,style:styles2.addRow,onPress:onAddPet,children:[
221
221
  /* @__PURE__ */jsx(View,{style:styles2.addDisc,children:/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.addPlus,children:"+"})}),
222
222
  /* @__PURE__ */jsx(Text,{style:styles2.addLabel,children:CHAT_COPY.addAnotherPet})]}):null,
223
- /* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.close,containerStyle:styles2.closeSlot,style:styles2.closeButton,onPress:onClose,children:/* @__PURE__ */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 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,petRef){return headerPetOf(pets,petRef)}function ChatHeader({pets:pets,petRef:petRef,historyUnread:historyUnread,onOpenHistory:onOpenHistory,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles8(theme),[theme]),[switcherOpen,setSwitcherOpen]=useState(false),shown=headerPet(pets.pets,petRef),canSwitch=pets.pets.length>=2,shownPetRef=petRef??shown?.petRef??null,name=petDisplayName(shown),[measures,setMeasures]=useState(UNMEASURED),measure=useCallback(key=>event=>{let width=event.nativeEvent.layout.width;setMeasures(prev=>nextMeasures(prev,key,width))},[]),onRowLayout=useMemo(()=>measure("row"),[measure]),onLeadingLayout=useMemo(()=>measure("leading"),[measure]),onTrailingLayout=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__ */
224
- return jsxs(View,{style:styles2.row,onLayout:onRowLayout,children:[
223
+ /* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:CHAT_COPY.close,containerStyle:styles2.closeSlot,style:styles2.closeButton,onPress:onClose,children:/* @__PURE__ */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 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,petRef){return headerPetOf(pets,petRef)}function ChatHeader({pets:pets,petRef:petRef,historyUnread:historyUnread,onOpenHistory:onOpenHistory,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet,textingEntry:textingEntry=null}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles8(theme),[theme]),[switcherOpen,setSwitcherOpen]=useState(false),shown=headerPet(pets.pets,petRef),canSwitch=pets.pets.length>=2,shownPetRef=petRef??shown?.petRef??null,name=petDisplayName(shown),[measures,setMeasures]=useState(UNMEASURED),measure=useCallback(key=>event=>{let width=event.nativeEvent.layout.width;setMeasures(prev=>nextMeasures(prev,key,width))},[]),onRowLayout=useMemo(()=>measure("row"),[measure]),onLeadingLayout=useMemo(()=>measure("leading"),[measure]),onTrailingLayout=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__ */
224
+ return jsxs(Fragment,{children:[
225
+ /* @__PURE__ */jsxs(View,{style:styles2.row,onLayout:onRowLayout,children:[
225
226
  /* @__PURE__ */jsx(View,{style:[styles2.leading,sideMins.leading===void 0?null:{minWidth:sideMins.leading}],children:/* @__PURE__ */jsx(View,{style:styles2.sideContent,onLayout:onLeadingLayout,children:/* @__PURE__ */jsxs(PressScale,{accessibilityRole:"button",accessibilityLabel:historyUnread?`${CHAT_COPY.openHistoryNative}${CHAT_COPY.newReplySuffix}`:CHAT_COPY.openHistoryNative,containerStyle:styles2.iconSlot,style:styles2.iconButton,onPress:onOpenHistory,children:[
226
227
  /* @__PURE__ */jsx(MenuGlyph,{size:MENU_GLYPH_SIZE,color:theme.slots.header?.textColor??theme.color.text.primary,strokeWidth:2}),historyUnread?/* @__PURE__ */jsx(View,{style:styles2.unreadDot,pointerEvents:"none"}):null]})})}),
227
228
  /* @__PURE__ */jsx(View,{style:styles2.centre,pointerEvents:"box-none",children:/* @__PURE__ */jsx(BrandLogo,{logoUrl:theme.meta.logoUrl,name:theme.meta.displayName,barStyle:styles2.logoBar,logoStyle:styles2.logo})}),
@@ -230,7 +231,8 @@ return jsxs(View,{style:styles2.row,onLayout:onRowLayout,children:[
230
231
  /* @__PURE__ */jsx(PetDisc,{pet:shown,size:HEADER_AVATAR_SIZE,ringStroke:HEADER_RING_STROKE}),
231
232
  /* @__PURE__ */jsx(View,{style:styles2.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */jsx(PlusGlyph,{size:ADD_BADGE_GLYPH,color:theme.color.brandInk,strokeWidth:2})})]}):pets.loading&&shown===null?
232
233
  /* @__PURE__ */jsx(View,{style:styles2.avatarWrap,accessible:true,accessibilityLabel:CHAT_COPY.yourPet,children:/* @__PURE__ */jsx(Ring,{size:HEADER_AVATAR_SIZE,strokeWidth:HEADER_RING_STROKE,color:theme.color.mark,children:/* @__PURE__ */jsx(View,{style:styles2.placeholderDisc})})}):/* @__PURE__ */jsx(View,{style:styles2.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:shown===null?CHAT_COPY.yourPet:name,children:/* @__PURE__ */jsx(PetDisc,{pet:shown,size:HEADER_AVATAR_SIZE,ringStroke:HEADER_RING_STROKE})})})]})}),
233
- /* @__PURE__ */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 StyleSheet.create({vetEntry:{minHeight:MIN_TOUCH_TARGET4,justifyContent:"center",paddingHorizontal:12,borderRadius:theme.radius.pill,backgroundColor:c.surfaceCream,borderWidth: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=useMemo(()=>makeStyles9(theme),[theme]),[reason,setReason]=useState(null),[note,setNote]=useState(""),[pending,setPending]=useState(false),[failed,setFailed]=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__ */
234
+ /* @__PURE__ */jsx(PetSwitcherSheet,{visible:switcherOpen,pets:pets.pets,activePetRef:shown?.petRef??null,onSelect:select,onAddPet:addPet,onClose:()=>setSwitcherOpen(false)})]}),textingEntry===null?null:/* @__PURE__ */jsx(TextingEntryRow,{entry:textingEntry,place:"header"})]})}function TextingEntryRow({entry:entry,place:place}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles8(theme),[theme]);/* @__PURE__ */
235
+ return jsx(View,{style:place==="header"?styles2.textingEntryRowHeader:styles2.textingEntryRowThread,children:/* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:entry.label,containerStyle:styles2.textingEntrySlot,style:styles2.vetEntry,onPress:entry.onOpen,testID:"everfur-texting-entry",children:/* @__PURE__ */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 StyleSheet.create({vetEntry:{minHeight:MIN_TOUCH_TARGET4,justifyContent:"center",paddingHorizontal:12,borderRadius:theme.radius.pill,backgroundColor:c.surfaceCream,borderWidth: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=useMemo(()=>makeStyles9(theme),[theme]),[reason,setReason]=useState(null),[note,setNote]=useState(""),[pending,setPending]=useState(false),[failed,setFailed]=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__ */
234
236
  return jsx(Modal,{visible:true,transparent:true,animationType:theme.motion.reducedMotion?"none":"slide",onRequestClose:skip,children:/* @__PURE__ */jsxs(KeyboardAvoidingView,{behavior:Platform.OS==="ios"?"padding":void 0,style:styles2.root,children:[
235
237
  /* @__PURE__ */jsx(Pressable,{style:styles2.scrim,onPress:skip,accessibilityRole:"button",accessibilityLabel:CHAT_COPY.feedbackSkipA11y}),
236
238
  /* @__PURE__ */jsxs(View,{style:styles2.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[
@@ -361,7 +363,7 @@ return jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(ScrollView,{hor
361
363
  /* @__PURE__ */jsx(Text,{style:[styles2.cardTitle,linked?styles2.cardTitleLink:null],numberOfLines:2,children:card.title}),linked?/* @__PURE__ */jsx(ArrowUpRightGlyph,{size:LINK_GLYPH,color:theme.color.linkInk,strokeWidth:1.5}):null]}),card.meta!==null?/* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.cardMeta,numberOfLines:1,children:card.meta}):null,card.excerpt!==null?/* @__PURE__ */jsx(Text,{style:styles2.cardExcerpt,numberOfLines:3,children:card.excerpt}):null]});if(card.url!==null&&open!==void 0){let url=card.url;/* @__PURE__ */
362
364
  return jsx(PressScale,{accessibilityRole:"link",accessibilityLabel:label,style:styles2.card,onPress:()=>open(url),children:inner})}/* @__PURE__ */
363
365
  return jsx(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 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=useMemo(()=>makeStyles19(theme),[theme]),motion=useChatMotion(),isUser=message.role==="user",timeLabel=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]=useState(false),resetTimer=useRef(null);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__ */jsxs(View,{style:styles2.wrap,children:[
364
- /* @__PURE__ */jsxs(View,{style:[styles2.row,isUser?styles2.rowUser:styles2.rowAssistant],children:[timeLabel!==null?/* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.timestamp,children:timeLabel}):null,canCopy?/* @__PURE__ */jsx(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__ */jsx(CheckGlyph,{size:ICON_SIZE,color:theme.color.success,strokeWidth:2}):/* @__PURE__ */jsx(CopyGlyph,{size:ICON_SIZE,color:theme.color.text.timestamp,strokeWidth:1.5})}):null,thumbs?SENTIMENT_OPTIONS.map(({sentiment:kind,label:label})=>/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{selected:sentiment===kind},hitSlop:THUMB_HIT_SLOP,onPress:()=>onSentiment?.(kind),style:styles2.iconHit,children:/* @__PURE__ */jsx(ThumbGlyph,{size:ICON_SIZE,color:theme.color.sentiment[kind],active:sentiment===kind,rotate:SENTIMENT_ROTATE[kind],strokeWidth:1.5})},kind)):null]}),thanks?/* @__PURE__ */jsx(Text,{style:styles2.thanks,accessibilityLiveRegion:"polite",children:CHAT_COPY.feedbackThanks}):null]})}function makeStyles19(theme){let t=theme.type;return 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([
366
+ /* @__PURE__ */jsxs(View,{style:[styles2.row,isUser?styles2.rowUser:styles2.rowAssistant],children:[timeLabel!==null?/* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.timestamp,children:timeLabel}):null,canCopy?/* @__PURE__ */jsx(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__ */jsx(CheckGlyph,{size:ICON_SIZE,color:theme.color.success,strokeWidth:2}):/* @__PURE__ */jsx(CopyGlyph,{size:ICON_SIZE,color:theme.color.text.timestamp,strokeWidth:1.5})}):null,thumbs?SENTIMENT_OPTIONS.map(({sentiment:kind,label:label})=>/* @__PURE__ */jsx(Pressable,{accessibilityRole:"button",accessibilityLabel:label,accessibilityState:{selected:sentiment===kind},hitSlop:THUMB_HIT_SLOP,onPress:()=>onSentiment?.(kind),style:styles2.iconHit,children:/* @__PURE__ */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__ */jsx(Text,{style:styles2.thanks,accessibilityLiveRegion:"polite",children:CHAT_COPY.feedbackThanks}):null]})}function makeStyles19(theme){let t=theme.type;return 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([
365
367
  /* @__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}),
366
368
  /* @__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}),
367
369
  /* @__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}),
@@ -372,8 +374,7 @@ return Object.freeze(PROMPTS.flatMap(template=>{let own=template.intent==="vet_r
372
374
  /* @__PURE__ */Object.freeze({tint:"#DDEFC4",ink:"#262523"}),
373
375
  /* @__PURE__ */Object.freeze({tint:"#FFD8D6",ink:"#262523"})]);function QuickPrompts({pet:pet,petRef:petRef,onSend:onSend,onVetPrep:onVetPrep,vet:vet,starterPrompts:starterPrompts,emptyState:emptyState,centered:centered=false}){let theme=useEverfurTheme(),styles2=useMemo(()=>makeStyles20(theme),[theme]),hostChips=useMemo(()=>resolveStarterPrompts(starterPrompts),[starterPrompts]),drawn=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=useMemo(()=>(emptyState?.chipTints??(theme.brightness==="light"?RAPH_CHIP_TINTS:[])).filter(t=>typeof t.tint=="string"&&t.tint.trim()!==""),[emptyState?.chipTints,theme.brightness]),chips=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=useMemo(()=>quickPromptThemePaint(isEverfurLightLook(theme),{fill:theme.color.highlight,ink:theme.color.onHighlight}),[theme]),hostChipThemed=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__ */jsx(homeTitle.Title,{text:title,style:[styles2.title,home.text(".serif",".ask-empty h2"),styles2.centerText],measureCh:homeTitle.titleCh}):/* @__PURE__ */jsx(Text,{tier:"heading",style:centered?[styles2.title,styles2.centerText]:styles2.title,accessibilityRole:"header",children:title});/* @__PURE__ */
374
376
  return jsxs(View,{style:home!==null?styles2.homeBlock:styles2.block,children:[titleNode,
375
- /* @__PURE__ */jsx(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__ */jsx(Chip,{prompt:prompt,send:send,themed:paint??(hostChips!==null?hostChipThemed:themed),index:index,petRef:petRef,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:petRef,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__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>{callHost(onVetPrep,pet)},children:/* @__PURE__ */jsx(Text,{tier:"compact",style:label,children:prompt.label})})}):petRef===null?null:/* @__PURE__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(VetVisitButton,{entry:"chat",petRef:petRef,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__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>onSend(send),children:/* @__PURE__ */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 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__ */
376
- return 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=useRef(null),following=useRef(true),wasStreaming=useRef(isStreaming),offset=useRef(0),viewport=useRef(0),content=useRef(0),tops=useRef(/* @__PURE__ */new Map),asideBottom=useRef(null),asideOwed=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=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]);useEffect(()=>{asideOwed.current=aside!==null,aside===null&&(asideBottom.current=null),follow()},[aside,follow]),useEffect(()=>{isStreaming&&!wasStreaming.current&&(following.current=true,asideOwed.current=false),wasStreaming.current=isStreaming,follow()},[rows,isStreaming,follow]);let onLayout=useCallback(event=>{viewport.current=event.nativeEvent.layout.height,follow()},[follow]),onContentSizeChange=useCallback((_width,height)=>{content.current=height,viewport.current>0&&(offset.current=Math.min(offset.current,Math.max(0,height-viewport.current))),follow()},[follow]),onScroll=useCallback(event=>{offset.current=event.nativeEvent.contentOffset.y},[]),onScrollBeginDrag=useCallback(()=>{following.current=false,asideOwed.current=false},[]),onScrollEnd=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=useCallback(id=>event=>{tops.current.set(id,event.nativeEvent.layout.y),(id===assistantId||id===userId)&&follow()},[assistantId,userId,follow]),asideLayout=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__ */jsx(HostRender,{render:extras.renderPending,fallback:/* @__PURE__ */jsx(LoadingState,{})}):/* @__PURE__ */jsx(LoadingState,{});case"empty":/* @__PURE__ */
377
+ /* @__PURE__ */jsx(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__ */jsx(Chip,{prompt:prompt,send:send,themed:paint??(hostChips!==null?hostChipThemed:themed),index:index,petRef:petRef,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:petRef,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__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>{callHost(onVetPrep,pet)},children:/* @__PURE__ */jsx(Text,{tier:"compact",style:label,children:prompt.label})})}):petRef===null?null:/* @__PURE__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(VetVisitButton,{entry:"chat",petRef:petRef,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__ */jsx(Animated.View,{style:fade,children:/* @__PURE__ */jsx(PressScale,{accessibilityRole:"button",accessibilityLabel:prompt.label,hitSlop:slop,style:[styles2.chip,edge,paint],onPress:()=>onSend(send),children:/* @__PURE__ */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 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=useRef(Array.from({length:DOT_COUNT},()=>new Animated.Value(0))).current;return useEffect(()=>{if(reducedMotion)return;let loops=values.map((value,index)=>Animated.loop(Animated.sequence([Animated.delay(index*STAGGER_MS),Animated.timing(value,{toValue:1,duration:LOOP_MS*.4,useNativeDriver:true}),Animated.timing(value,{toValue:0,duration:LOOP_MS*.6,useNativeDriver:true}),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__ */jsx(View,{style:styles2.readingBox,accessible:true,accessibilityRole:"text",accessibilityLabel:line,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:values.map((value,index)=>/* @__PURE__ */jsx(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=useRef(null),following=useRef(true),wasStreaming=useRef(isStreaming),offset=useRef(0),viewport=useRef(0),content=useRef(0),tops=useRef(/* @__PURE__ */new Map),asideBottom=useRef(null),asideOwed=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=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]);useEffect(()=>{asideOwed.current=aside!==null,aside===null&&(asideBottom.current=null),follow()},[aside,follow]),useEffect(()=>{isStreaming&&!wasStreaming.current&&(following.current=true,asideOwed.current=false),wasStreaming.current=isStreaming,follow()},[rows,isStreaming,follow]);let onLayout=useCallback(event=>{viewport.current=event.nativeEvent.layout.height,follow()},[follow]),onContentSizeChange=useCallback((_width,height)=>{content.current=height,viewport.current>0&&(offset.current=Math.min(offset.current,Math.max(0,height-viewport.current))),follow()},[follow]),onScroll=useCallback(event=>{offset.current=event.nativeEvent.contentOffset.y},[]),onScrollBeginDrag=useCallback(()=>{following.current=false,asideOwed.current=false},[]),onScrollEnd=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=useCallback(id=>event=>{tops.current.set(id,event.nativeEvent.layout.y),(id===assistantId||id===userId)&&follow()},[assistantId,userId,follow]),asideLayout=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__ */jsx(HostRender,{render:extras.renderPending,fallback:/* @__PURE__ */jsx(LoadingState,{})}):/* @__PURE__ */jsx(LoadingState,{});case"empty":/* @__PURE__ */
377
378
  return 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__ */
378
379
  return jsx(ErrorState,{error:chat.error,onRetry:chat.retryLast,onAddPet:extras.onAddPet});case"populated":/* @__PURE__ */
379
380
  return 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]=useState(false);return useEffect(()=>{let id=setTimeout(()=>setVisible(true),SPINNER_DELAY_MS);return()=>clearTimeout(id)},[]),/* @__PURE__ */jsx(View,{style:styles2.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:CHAT_COPY.loading,children:visible?/* @__PURE__ */jsx(ActivityIndicator,{color:theme.color.brandInk}):null})}function EmptyState({pet:pet,petRef:petRef,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__ */
@@ -396,17 +397,17 @@ return jsxs(View,{style:[styles2.turnNotice,error?styles2.turnNoticeError:null],
396
397
  /* @__PURE__ */jsx(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__ */jsxs(Animated.View,{style:[styles2.bubble,isUser?styles2.bubbleSideUser:null,enter],children:[senderLine,isVet?/* @__PURE__ */jsxs(View,{style:styles2.vetHeader,children:[
397
398
  /* @__PURE__ */jsx(Text,{tier:"control",style:styles2.vetSender,children:sender}),vetTime!==null?/* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.vetTime,children:vetTime}):null]}):null,
398
399
  /* @__PURE__ */jsxs(View,{style:[isUser?styles2.bubbleUser:isVet?styles2.bubbleVet:styles2.bubbleAssistant,message.pending?styles2.bubblePending:null],children:[isUser&&images.length>0?/* @__PURE__ */jsx(SentImages,{images:images,onPreview:image=>onPreview({uri:image.uri,label:image.filename})}):null,
399
- /* @__PURE__ */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__ */jsx(CitationCards,{citations:message.citations,onOpenUrl:onOpenUrl}):null,settled?/* @__PURE__ */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=useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT2:source.getSnapshot,snapshot2=useSyncExternalStore(subscribe2,read,read);return 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]=useState(null);if(!enabled)return NOTHING;let runner=/* @__PURE__ */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.textingAskLines(ask),line=/* @__PURE__ */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__ */jsx(texting.ChatTextingAskComposer,{ask:ask}):null;return{runner:runner,line:line,entry:entry,stage:ask.stage}}function AskRunner({ready:ready,onAsk:onAsk}){let{userRef:userRef}=useEverfurContext(),granted=useTextingGranted(),wanted=userRef!==null&&granted;return useEffect(()=>{wanted||onAsk(null)},[wanted,onAsk]),wanted?/* @__PURE__ */jsx(texting.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__ */jsx(AssistantSender,{avatarUrl:theme.meta.assistantAvatarUrl,named:named,styles:styles2}):named?/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.assistantName,children:CHAT_COPY.assistantName}):null;/* @__PURE__ */
400
+ /* @__PURE__ */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__ */jsx(CitationCards,{citations:message.citations,onOpenUrl:onOpenUrl}):null,settled?/* @__PURE__ */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=useCallback(listener=>source===null?()=>{}:source.subscribe(listener),[source]),read=source===null?NO_SNAPSHOT2:source.getSnapshot,snapshot2=useSyncExternalStore(subscribe2,read,read);return 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]=useState(null);if(!enabled)return NOTHING;let runner=/* @__PURE__ */jsx(AskRunner,{ready:textingAskThreadReady(chat),onAsk:setAsk,entry:headerEntry}),chip=headerEntry&&ask!==null&&ask.canOpen?{label:texting.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.textingAskLines(ask),line=/* @__PURE__ */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__ */jsx(texting.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:userRef}=useEverfurContext(),granted=useTextingGranted(),wanted=userRef!==null&&granted;return useEffect(()=>{wanted||onAsk(null)},[wanted,onAsk]),wanted?/* @__PURE__ */jsx(texting.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__ */jsx(AssistantSender,{avatarUrl:theme.meta.assistantAvatarUrl,named:named,styles:styles2}):named?/* @__PURE__ */jsx(Text,{tier:"control",style:styles2.assistantName,children:CHAT_COPY.assistantName}):null;/* @__PURE__ */
400
401
  return jsxs(View,{style:[styles2.rowBlock,styles2.rowBlockAssistant],testID:`everfur-texting-ask-${stage}`,children:[
401
402
  /* @__PURE__ */jsxs(View,{style:[styles2.row,styles2.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${sender}: ${text3}`,children:[senderLine,
402
403
  /* @__PURE__ */jsx(View,{style:[styles2.bubble,styles2.bubbleAssistant],children:/* @__PURE__ */jsx(Text,{style:styles2.bubbleTextAssistant,children:text3})})]}),stage==="offered"?/* @__PURE__ */jsx(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__ */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__ */jsx(Text,{tier:"control",style:styles2.followUpText,children:answer.label})},answer.testID))}):null]})}function EverfurChat(props){let{style:style,renderPending:renderPending}=props;/* @__PURE__ */
403
404
  return jsx(CapabilityGate,{capability:"chat",style:style,...renderPending?{renderPending:renderPending}:{},children:/* @__PURE__ */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__ */jsx(ChatBodyAlone,{...props}):/* @__PURE__ */jsx(ChatBodyInProvider,{...props,activePet:context.activePet})}function ChatBodyAlone(props){let client=hostPresentation(props),key=JSON.stringify(client),settings=useMemo(()=>({presentation:resolvePresentation({server:null,locked:null,client:client}),isLocked:()=>false,planPage:null,inProvider:false}),[key]);/* @__PURE__ */
404
405
  return jsx(ChatSurface,{...props,settings:settings})}function ChatBodyInProvider({activePet:activePet,...props}){let{presentation:presentation,isLocked:isLocked}=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=useMemo(()=>({presentation:presentation,isLocked:isLocked,planPage:planPage,inProvider:true}),[presentation,isLocked,planPage]);/* @__PURE__ */
405
- return jsx(ChatSurface,{...props,settings:settings})}function ChatSurface({settings:settings,petRef:petRef,conversationId:conversationId,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:isLocked,planPage:planPage}=settings,{theme:theme,styles:styles2}=useChatTheme(),askHomeFactory=useAskHomeFactory(),askHome=useMemo(()=>askHomeFactory===null?null:askHomeFactory(theme),[askHomeFactory,theme]),hostPoweredBy=useHostPoweredBy(),motion=useChatMotion(),chatOpts=useMemo(()=>buildChatOpts(petRef,conversationId),[petRef,conversationId]),chat=useEverfurChat(chatOpts),view=selectView(chat),pets=useChatPets(),history=useHistoryPanel(chat),insets=useSafeAreaInsets(),notice=turnNotice(chat),onCheckinFindVet=useMemo(()=>onFindVet===void 0?void 0:()=>{callHost(onFindVet,"emergency")},[onFindVet]),vet=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=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=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]=useState(null),closePreview=useCallback(()=>setPreview(null),[]),[feedbackTarget,setFeedbackTarget]=useState(null),[thanksFor,setThanksFor]=useState(null),thanksTimer=useRef(null);useEffect(()=>()=>{thanksTimer.current&&clearTimeout(thanksTimer.current)},[]);let showThanks=useCallback(responseId=>{setThanksFor(String(responseId)),thanksTimer.current&&clearTimeout(thanksTimer.current),thanksTimer.current=setTimeout(()=>{setThanksFor(null),thanksTimer.current=null},THANKS_VISIBLE_MS)},[]),onSentiment=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=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=useCallback(()=>setFeedbackTarget(null),[]),onSelectPrompt=useCallback(prompt=>{chat.send(prompt)},[chat.send]),openCitation=useMemo(()=>onOpenUrl===void 0?void 0:url=>{callHost(onOpenUrl,url,"citation")},[onOpenUrl]),avoidBehavior=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=useMemo(()=>hostTopCard===void 0?healthPlanTopCard(planPage,{onOpenPlan:onOpenHealthPlan}):void 0,[hostTopCard,planPage,onOpenHealthPlan]),card=presentation.chatTopCard==="focus"?hostTopCard??planCard:void 0,[cardOpen,setCardOpen]=useState(true),onCardAsk=useCallback(prompt=>{chat.send(prompt)},[chat.send]),followUpPolicy=useMemo(()=>followUpPolicyFor(void 0,presentation,isLocked("chatFollowUpCount")),[presentation,isLocked]),sheet=presentation.chatHistoryStyle==="sheet",threadEmpty=chat.messages.length===0,pill=card!==void 0?/* @__PURE__ */jsx(TopCardPill,{card:card,open:cardOpen,onOpenChange:setCardOpen}):null,barNode=historyBar!==void 0?/* @__PURE__ */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__ */jsxs(Fragment,{children:[
406
- /* @__PURE__ */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;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__ */jsx(Text,{tier:"compact",style:styles2.footnote,accessibilityRole:"text",children:CHAT_COPY.footnoteNative});
406
+ return jsx(ChatSurface,{...props,settings:settings})}function ChatSurface({settings:settings,petRef:petRef,conversationId:conversationId,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:isLocked,planPage:planPage}=settings,{theme:theme,styles:styles2}=useChatTheme(),askHomeFactory=useAskHomeFactory(),askHome=useMemo(()=>askHomeFactory===null?null:askHomeFactory(theme),[askHomeFactory,theme]),hostPoweredBy=useHostPoweredBy(),motion=useChatMotion(),chatOpts=useMemo(()=>buildChatOpts(petRef,conversationId),[petRef,conversationId]),chat=useEverfurChat(chatOpts),view=selectView(chat),pets=useChatPets(),history=useHistoryPanel(chat),insets=useSafeAreaInsets(),notice=turnNotice(chat),onCheckinFindVet=useMemo(()=>onFindVet===void 0?void 0:()=>{callHost(onFindVet,"emergency")},[onFindVet]),vet=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=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=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]=useState(null),closePreview=useCallback(()=>setPreview(null),[]),[feedbackTarget,setFeedbackTarget]=useState(null),[thanksFor,setThanksFor]=useState(null),thanksTimer=useRef(null);useEffect(()=>()=>{thanksTimer.current&&clearTimeout(thanksTimer.current)},[]);let showThanks=useCallback(responseId=>{setThanksFor(String(responseId)),thanksTimer.current&&clearTimeout(thanksTimer.current),thanksTimer.current=setTimeout(()=>{setThanksFor(null),thanksTimer.current=null},THANKS_VISIBLE_MS)},[]),onSentiment=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=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=useCallback(()=>setFeedbackTarget(null),[]),onSelectPrompt=useCallback(prompt=>{chat.send(prompt)},[chat.send]),openCitation=useMemo(()=>onOpenUrl===void 0?void 0:url=>{callHost(onOpenUrl,url,"citation")},[onOpenUrl]),avoidBehavior=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=useMemo(()=>hostTopCard===void 0?healthPlanTopCard(planPage,{onOpenPlan:onOpenHealthPlan}):void 0,[hostTopCard,planPage,onOpenHealthPlan]),card=presentation.chatTopCard==="focus"?hostTopCard??planCard:void 0,[cardOpen,setCardOpen]=useState(true),onCardAsk=useCallback(prompt=>{chat.send(prompt)},[chat.send]),followUpPolicy=useMemo(()=>followUpPolicyFor(void 0,presentation,isLocked("chatFollowUpCount")),[presentation,isLocked]),sheet=presentation.chatHistoryStyle==="sheet",threadEmpty=chat.messages.length===0,pill=card!==void 0?/* @__PURE__ */jsx(TopCardPill,{card:card,open:cardOpen,onOpenChange:setCardOpen}):null,barNode=historyBar!==void 0?/* @__PURE__ */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__ */jsxs(Fragment,{children:[
407
+ /* @__PURE__ */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;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__ */jsx(Text,{tier:"compact",style:styles2.footnote,accessibilityRole:"text",children:CHAT_COPY.footnoteNative});
407
408
  /* @__PURE__ */
408
409
  return jsx(AskHomeContext.Provider,{value:askHome,children:/* @__PURE__ */jsxs(KeyboardAvoidingView,{style:[styles2.container,{paddingTop:topInset},style],behavior:avoidBehavior,...keyboard.avoidingProps,children:[
409
- /* @__PURE__ */jsx(KeyboardOffsetProbe,{probeRef:keyboard.probeRef}),header?/* @__PURE__ */jsx(ChatHeader,{pets:pets,petRef:chat.petRef,historyUnread:historyUnread,onOpenHistory:history.show,onPetChange:onPetChange,onAddPet:onAddPet,vet:vet}):null,pet!==void 0?/* @__PURE__ */jsx(PetSetupNotice,{petRef:petRef??null,pet:pet,onRegistered:pets.refresh}):null,barInThread?null:barNode,bannerHidden?null:/* @__PURE__ */jsx(UrgencyBanner,{surface:urgency,petRef:chat.petRef,renderVetAction:renderVetAction,onFindVet:onFindVet,vet:vet,compact:keyboardOpen}),
410
+ /* @__PURE__ */jsx(KeyboardOffsetProbe,{probeRef:keyboard.probeRef}),header?/* @__PURE__ */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__ */jsx(PetSetupNotice,{petRef:petRef??null,pet:pet,onRegistered:pets.refresh}):null,!header&&textingAsk.headerEntry!==null?/* @__PURE__ */jsx(TextingEntryRow,{entry:textingAsk.headerEntry,place:"thread"}):null,barInThread?null:barNode,bannerHidden?null:/* @__PURE__ */jsx(UrgencyBanner,{surface:urgency,petRef:chat.petRef,renderVetAction:renderVetAction,onFindVet:onFindVet,vet:vet,compact:keyboardOpen}),
410
411
  /* @__PURE__ */jsx(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__ */jsx(View,{style:styles2.composerOuter,children:/* @__PURE__ */jsx(View,{style:styles2.askEntry,children:textingAsk.entry})}):uploadOn&&attachments!==void 0?/* @__PURE__ */jsx(ComposerWithAttachments,{...composerProps,attachments:attachments}):/* @__PURE__ */jsx(Composer,{...composerProps,attachments:null}),footnoteInThread?null:footnote,theme.meta.hidePoweredBy||hostPoweredBy?null:/* @__PURE__ */jsx(Text,{tier:"compact",style:styles2.poweredBy,accessibilityRole:"text",accessibilityLabel:CHAT_COPY.poweredBy,children:CHAT_COPY.poweredBy}),sheet?/* @__PURE__ */jsx(HistorySheet,{chat:chat,history:history,sheet:historySheet}):/* @__PURE__ */jsx(HistoryDrawer,{chat:chat,history:history}),
411
412
  /* @__PURE__ */jsx(FeedbackReasons,{visible:feedbackTarget!==null,onSubmit:submitReasons,onSkip:skipReasons}),
412
413
  /* @__PURE__ */jsx(AttachmentImageLightbox,{uri:preview?.uri??null,label:preview?.label??"",onClose:closePreview}),
@@ -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");var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
2
3
  /* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
3
4
  /* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
@@ -93,7 +94,7 @@
93
94
  /* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
94
95
  /* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}function contractDocUrl(entry){return entry.envelope==="sse_frame"?`/errors#sse-${entry.wireCode}`:entry.envelope==="oauth_error"?`/errors#oauth-${entry.wireCode}`:`/errors#${entry.wireCode}`}var DOC_SITE_ORIGIN=null;function publishedDocUrl(entry){return null}var EVERFUR_ERROR_CODES=/* @__PURE__ */Object.freeze(["authExpired","authRejected","sessionRequired","accessDenied","paymentRequired","quotaExceeded","rateLimited","validationFailed","sdkUpdateRequired","conflict","idempotencyConflict","idempotencyInFlight","conversationNotFound","petNotFound","resourceNotFound","streamTimeout","mediaUploadFailed","moderationBlocked","upstreamLlmTimeout","internalError","notImplemented","serviceUnavailable","streamIncomplete","identitySignatureRequired","runtimeDisposed","unknown"]),EVERFUR_ERROR_CATEGORIES=/* @__PURE__ */Object.freeze(["authentication","authorization","entitlement","rateLimit","invalidRequest","notFound","conflict","connection","server","media","policy","unknown"]),CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}function fromHttpStatus(status){return status===401?"authExpired":status===403?"accessDenied":status===404?"conversationNotFound":status===409?"idempotencyConflict":status===421?"unknown":status===429?"rateLimited":status===400||status===422?"unknown":status>=500?"internalError":"unknown"}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}function shouldRetry(code,frameRetryable=false){return frameRetryable||isAutoRetryable(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}function canRecreateOnNotFound(code){return code==="conversationNotFound"}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function isLinkedAccountReadOnly(error){return error!=null&&error.code==="conflict"&&error.reasonCode===LINKED_ACCOUNT_READ_ONLY}function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
95
96
  return Object.freeze(warning===void 0?{ok:true,value:value}:{ok:true,value:value,warning:warning})}function err(error){/* @__PURE__ */
96
- 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 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__ */
97
+ 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 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__ */
97
98
  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__ */
98
99
  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__ */
99
100
  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 resolveClientConfig(config,options){let outcome=tryResolveClientConfig(config,options);if(!outcome.ok)throw new EverfurConfigError("invalid-argument",outcome.failure.message);return outcome.config}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 resolveApiBaseUrl(apiBaseUrl){let outcome=tryResolveApiBaseUrl(apiBaseUrl);if(!outcome.ok)throw new EverfurConfigError("invalid-argument",outcome.failure.message);return outcome.value}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__ */
@@ -1,19 +1,20 @@
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
  import { b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
2
3
  export { A as AUTO_RETRYABLE_CODES, B as BACKOFF_BASE_MS, d as BACKOFF_CAP_MS, e as EVERFUR_ERROR_CATEGORIES, f as EVERFUR_ERROR_CODES, E as EverfurError, a as EverfurErrorCategory, L as LINKED_ACCOUNT_READ_ONLY, M as MAX_RETRY_ATTEMPTS, g as MakeEverfurErrorOptions, R as RETRYABLE_CONTRACT_CODES, h as backoffDelayMs, j as canRecreateOnNotFound, c as categoryFor, k as fromHttpStatus, l as fromWire, m as isAutoRetryable, n as isLinkedAccountReadOnly, i as isRetryableCode, o as makeEverfurError, s as shouldRetry, u as userFacingError } from '../EverfurError.d-8NHtlgzA.cjs';
3
4
  export { a as EverfurConfigError, E as EverfurResult, b as EverfurThrownError, e as err, i as isErr, c as isOk, o as ok, u as unwrap } from '../EverfurResult.d-BFH-3s6E.cjs';
4
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, B as ByteSource, C as ClientConfigFailure, k as ClientConfigFailureReason, l as ClientConfigOutcome, m as DEFAULT_CONTRACT_VERSION, D as DeltaFrame, c as DoneFrame, n as EMPTY_FRAME_ARRAYS, o as ENV_API_BASE_URL, E as ErrorFrame, p as EventSourceFactory, q as EventSourceInit, r as EventSourceLike, s as EventSourceMessage, t as EverfurConfig, d as EverfurRequest, e as EverfurRequestBase, u as FetchInit, j as FetchLike, v as FetchResponseLike, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, R as RawResponse, w as ReadableStreamLike, x as ResolveClientConfigOptions, y as ResolvedClientConfig, S as SDK_PLATFORM, z as SDK_VERSION, G as SdkPlatform, I as ServerRequestIdSource, J as TransportDeps, T as TransportPort, U as UnknownFrame, i as UrgencyLevel, K as acceptedFrame, L as analysisCompleteFrame, N as analysisStartedFrame, O as assertNever, P as bufferedTextByteSource, Q as buildBaseHeaders, V as checkPublishableKey, W as createHttpTransport, X as deltaFrame, Y as doneFrame, Z as errorFrame, _ as errorFromResponse, $ as eventSourceByteSource, a0 as eventSourceRequestId, a1 as fetchByteSource, a2 as getGlobalFetch, a3 as heartbeatFrame, a4 as networkError, a5 as parseSse, a6 as requestIdOf, a7 as requestJson, a8 as requestRaw, a9 as resolveApiBaseUrl, aa as resolveClientConfig, ab as tryResolveApiBaseUrl, ac as tryResolveClientConfig, ad as unknownFrame } from '../config.d-C0WgjutL.cjs';
5
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, B as ByteSource, C as ClientConfigFailure, k as ClientConfigFailureReason, l as ClientConfigOutcome, m as DEFAULT_CONTRACT_VERSION, D as DeltaFrame, c as DoneFrame, n as EMPTY_FRAME_ARRAYS, o as ENV_API_BASE_URL, E as ErrorFrame, p as EventSourceFactory, q as EventSourceInit, r as EventSourceLike, s as EventSourceMessage, t as EverfurConfig, d as EverfurRequest, e as EverfurRequestBase, u as FetchInit, j as FetchLike, v as FetchResponseLike, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, R as RawResponse, w as ReadableStreamLike, x as ResolveClientConfigOptions, y as ResolvedClientConfig, S as SDK_PLATFORM, z as SDK_VERSION, G as SdkPlatform, I as ServerRequestIdSource, J as TransportDeps, T as TransportPort, U as UnknownFrame, i as UrgencyLevel, K as acceptedFrame, L as analysisCompleteFrame, N as analysisStartedFrame, O as assertNever, P as bufferedTextByteSource, Q as buildBaseHeaders, V as checkPublishableKey, W as createHttpTransport, X as deltaFrame, Y as doneFrame, Z as errorFrame, _ as errorFromResponse, $ as eventSourceByteSource, a0 as eventSourceRequestId, a1 as fetchByteSource, a2 as getGlobalFetch, a3 as heartbeatFrame, a4 as networkError, a5 as parseSse, a6 as requestIdOf, a7 as requestJson, a8 as requestRaw, a9 as resolveApiBaseUrl, aa as resolveClientConfig, ab as tryResolveApiBaseUrl, ac as tryResolveClientConfig, ad as unknownFrame } from '../config.d-BQgrIDdu.cjs';
5
6
  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, d as unsafeClientId, e as unsafeConversationId, f as unsafeDocumentId, g as unsafeJobId, h as unsafePetRef, i as unsafeRecordsRequestId, j as unsafeResponseId, k as unsafeUserRef, u as userRef } from '../ids.d-B2GAAifq.cjs';
6
- export { A as AuthContext, D as DeviceAuth, I as IdentityProvider, M as MintedToken, T as TokenProvider, a as authHeaders, b as authedSend, c as createIdentityProvider, n as newSessionId, w as withAuthHeaders } from '../identity.d-CioQhZrq.cjs';
7
+ export { A as AuthContext, D as DeviceAuth, I as IdentityProvider, M as MintedToken, T as TokenProvider, a as authHeaders, b as authedSend, c as createIdentityProvider, n as newSessionId, w as withAuthHeaders } from '../identity.d-HbwYQ4-z.cjs';
7
8
  export { a as CapabilityDecision, b as CapabilityDisabled, C as CapabilityName, c as DecideOptions, D as DisabledLevel, E as EntitlementDecision, L as LevelGrant, R as ResolvedEntitlements, d as decideCapability, e as deniedDecisionsFor, r as requires, f as resolveEntitlements } from '../resolve.d-CoQWUy1Y.cjs';
8
- export { E as ENTITLEMENTS_PATH, a as EntitlementResolution, F as FetchEntitlementsArgs, f as fetchEntitlements } from '../entitlementRepository.d-C-stdRyA.cjs';
9
+ export { E as ENTITLEMENTS_PATH, a as EntitlementResolution, F as FetchEntitlementsArgs, f as fetchEntitlements } from '../entitlementRepository.d-B_kEPLhz.cjs';
9
10
  import { m as EverfurTheme } from '../tokens.d-BUVqme2D.cjs';
10
11
  export { D as DEFAULT_MAX_FONT_SCALE, y as EASING_CURVES, z as EVERFUR_DARK, A as EVERFUR_LIGHT, E as EverfurColorTokens, B as EverfurEasingCurve, 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, C as EverfurTextScaleTier, n as EverfurThemeMeta, o as EverfurThemeSlot, p as EverfurThemeSlotKey, q as EverfurThemeSlotName, r as EverfurThemeSlots, s as EverfurTypeSizeTokens, t as EverfurTypeTokens, u as EverfurWeightTokens, S as SLOT_MIN_BORDER_CONTRAST, F as SLOT_MIN_CONTRAST, G as SYSTEM_FONT_FAMILY, H as SYSTEM_MONO_FAMILY, I as SlotGrounds, J as SlotSurrounds, K as TEXT_SCALE_TIER_CAPS, T as THEME_SLOT_KEYS, v as THEME_SLOT_KEYS_BY_SLOT, w as THEME_SLOT_NAMES, L as cssCubicBezier, M as deepFreeze, N as guardSlotContrast, O as mergeThemeSlots, P as parseThemeSlots, x as themeSlotKeysFor } from '../tokens.d-BUVqme2D.cjs';
11
12
  export { E as EverfurFaceStyle, a as EverfurThemeAdjustment, R as ResolveThemeInput, T as TEXT_SCALE_FLOOR, f as face, h as headingFace, p as previewTheme, r as resolveTheme, t as themeAdjustments, w as withServerBranding } from '../typeStyle.d-DmlwyJq-.cjs';
12
13
  export { A as APPEARANCE_PRESETS, a as APPEARANCE_PRESET_NAMES, b as APPEARANCE_SIZE_RANGES, C as ClientBranding, c as EverfurAppearance, d as EverfurAppearanceFont, e as EverfurAppearancePreset, f as EverfurAppearanceRules, g as EverfurAppearanceVariables, h as EverfurThemeFontFaceKey, i as EverfurThemeFontUrlsInput, j as EverfurThemeFontsInput, E as EverfurThemeInput, k as EverfurThemeSlotInput, l as EverfurThemeSlotsInput, L as LOCKABLE_THEME_FIELDS, n as LockableThemeField, M as MAX_FONT_SCALE_CEILING, R as RadiusScale, o as SLOT_LOCK_PREFIX, p as SlotLockName, S as SurfaceStyle, T as THEME_SCHEMA_VERSIONS, q as ThemeLockName, m as expandAppearance, r as hardenBrandAssetUrl, s as hardenHttpsUrl, t as isEmptyBranding, u as isKnownBrandingSchema, v as lockedFieldsOf, w as parseClientBranding, x as parsePx } from '../branding.d-Bbc6p1XY.cjs';
13
14
  export { D as DEFAULT_PRESENTATION, 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, l as EverfurPresentationField, i as EverfurPresentationInput, j as EverfurSafetyDisclaimerPlacement, P as PRESENTATION_LOCK, k as PRESENTATION_LOCK_PREFIX, m as PRESENTATION_WIRE_NAMES, n as isPresentationFieldLocked, o as isPresentationLockName, p as parsePresentation, r as resolvePresentation } from '../presentation.d-vy8kTGfR.cjs';
14
- export { F as FunnelSendOptions, R as RequestFunnel, a as RequestFunnelDeps, c as createRequestFunnel } from '../requestFunnel.d-CR4akGCY.cjs';
15
- export { c as PET_AGE_YEARS_MAX, d as PET_BREED_MAX, e as PET_NAME_MAX, f as PET_SPECIES_MAX, g as PET_WEIGHT_KG_MAX, P as PetProfileInput, a as PetProfilePatch, h as PetsRepository, R as RegisteredPet, W as WidgetPet, i as createPetsRepository, w as widgetPetFromWire } from '../petsRepository.d-B5DWzU7C.cjs';
16
- export { b as CHECKIN_ANSWERS, c as CasesRepository, C as CheckinAnswer, a as CheckinOutcome, W as WatchCase, d as createCasesRepository } from '../casesRepository.d-CsUJ2Oyb.cjs';
15
+ export { F as FunnelSendOptions, R as RequestFunnel, a as RequestFunnelDeps, c as createRequestFunnel } from '../requestFunnel.d-JoqddYSx.cjs';
16
+ export { c as PET_AGE_YEARS_MAX, d as PET_BREED_MAX, e as PET_NAME_MAX, f as PET_SPECIES_MAX, g as PET_WEIGHT_KG_MAX, P as PetProfileInput, a as PetProfilePatch, h as PetsRepository, R as RegisteredPet, W as WidgetPet, i as createPetsRepository, w as widgetPetFromWire } from '../petsRepository.d-Bwfe8yuR.cjs';
17
+ export { b as CHECKIN_ANSWERS, c as CasesRepository, C as CheckinAnswer, a as CheckinOutcome, W as WatchCase, d as createCasesRepository } from '../casesRepository.d-BMOnT1fg.cjs';
17
18
  import '../ErrorPolicyPort.d-DirW9hgO.cjs';
18
19
  import '../profile.d-CSs1wlXT.cjs';
19
20
 
@@ -1,19 +1,20 @@
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
  import { b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
2
3
  export { A as AUTO_RETRYABLE_CODES, B as BACKOFF_BASE_MS, d as BACKOFF_CAP_MS, e as EVERFUR_ERROR_CATEGORIES, f as EVERFUR_ERROR_CODES, E as EverfurError, a as EverfurErrorCategory, L as LINKED_ACCOUNT_READ_ONLY, M as MAX_RETRY_ATTEMPTS, g as MakeEverfurErrorOptions, R as RETRYABLE_CONTRACT_CODES, h as backoffDelayMs, j as canRecreateOnNotFound, c as categoryFor, k as fromHttpStatus, l as fromWire, m as isAutoRetryable, n as isLinkedAccountReadOnly, i as isRetryableCode, o as makeEverfurError, s as shouldRetry, u as userFacingError } from '../EverfurError.d-8NHtlgzA.js';
3
4
  export { a as EverfurConfigError, E as EverfurResult, b as EverfurThrownError, e as err, i as isErr, c as isOk, o as ok, u as unwrap } from '../EverfurResult.d-D_-254ZY.js';
4
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, B as ByteSource, C as ClientConfigFailure, k as ClientConfigFailureReason, l as ClientConfigOutcome, m as DEFAULT_CONTRACT_VERSION, D as DeltaFrame, c as DoneFrame, n as EMPTY_FRAME_ARRAYS, o as ENV_API_BASE_URL, E as ErrorFrame, p as EventSourceFactory, q as EventSourceInit, r as EventSourceLike, s as EventSourceMessage, t as EverfurConfig, d as EverfurRequest, e as EverfurRequestBase, u as FetchInit, j as FetchLike, v as FetchResponseLike, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, R as RawResponse, w as ReadableStreamLike, x as ResolveClientConfigOptions, y as ResolvedClientConfig, S as SDK_PLATFORM, z as SDK_VERSION, G as SdkPlatform, I as ServerRequestIdSource, J as TransportDeps, T as TransportPort, U as UnknownFrame, i as UrgencyLevel, K as acceptedFrame, L as analysisCompleteFrame, N as analysisStartedFrame, O as assertNever, P as bufferedTextByteSource, Q as buildBaseHeaders, V as checkPublishableKey, W as createHttpTransport, X as deltaFrame, Y as doneFrame, Z as errorFrame, _ as errorFromResponse, $ as eventSourceByteSource, a0 as eventSourceRequestId, a1 as fetchByteSource, a2 as getGlobalFetch, a3 as heartbeatFrame, a4 as networkError, a5 as parseSse, a6 as requestIdOf, a7 as requestJson, a8 as requestRaw, a9 as resolveApiBaseUrl, aa as resolveClientConfig, ab as tryResolveApiBaseUrl, ac as tryResolveClientConfig, ad as unknownFrame } from '../config.d-zd2eTb2L.js';
5
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, B as ByteSource, C as ClientConfigFailure, k as ClientConfigFailureReason, l as ClientConfigOutcome, m as DEFAULT_CONTRACT_VERSION, D as DeltaFrame, c as DoneFrame, n as EMPTY_FRAME_ARRAYS, o as ENV_API_BASE_URL, E as ErrorFrame, p as EventSourceFactory, q as EventSourceInit, r as EventSourceLike, s as EventSourceMessage, t as EverfurConfig, d as EverfurRequest, e as EverfurRequestBase, u as FetchInit, j as FetchLike, v as FetchResponseLike, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, R as RawResponse, w as ReadableStreamLike, x as ResolveClientConfigOptions, y as ResolvedClientConfig, S as SDK_PLATFORM, z as SDK_VERSION, G as SdkPlatform, I as ServerRequestIdSource, J as TransportDeps, T as TransportPort, U as UnknownFrame, i as UrgencyLevel, K as acceptedFrame, L as analysisCompleteFrame, N as analysisStartedFrame, O as assertNever, P as bufferedTextByteSource, Q as buildBaseHeaders, V as checkPublishableKey, W as createHttpTransport, X as deltaFrame, Y as doneFrame, Z as errorFrame, _ as errorFromResponse, $ as eventSourceByteSource, a0 as eventSourceRequestId, a1 as fetchByteSource, a2 as getGlobalFetch, a3 as heartbeatFrame, a4 as networkError, a5 as parseSse, a6 as requestIdOf, a7 as requestJson, a8 as requestRaw, a9 as resolveApiBaseUrl, aa as resolveClientConfig, ab as tryResolveApiBaseUrl, ac as tryResolveClientConfig, ad as unknownFrame } from '../config.d-XSMThgVj.js';
5
6
  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, d as unsafeClientId, e as unsafeConversationId, f as unsafeDocumentId, g as unsafeJobId, h as unsafePetRef, i as unsafeRecordsRequestId, j as unsafeResponseId, k as unsafeUserRef, u as userRef } from '../ids.d-B2GAAifq.js';
6
- export { A as AuthContext, D as DeviceAuth, I as IdentityProvider, M as MintedToken, T as TokenProvider, a as authHeaders, b as authedSend, c as createIdentityProvider, n as newSessionId, w as withAuthHeaders } from '../identity.d-BksOEa6m.js';
7
+ export { A as AuthContext, D as DeviceAuth, I as IdentityProvider, M as MintedToken, T as TokenProvider, a as authHeaders, b as authedSend, c as createIdentityProvider, n as newSessionId, w as withAuthHeaders } from '../identity.d-Be2Es9Td.js';
7
8
  export { a as CapabilityDecision, b as CapabilityDisabled, C as CapabilityName, c as DecideOptions, D as DisabledLevel, E as EntitlementDecision, L as LevelGrant, R as ResolvedEntitlements, d as decideCapability, e as deniedDecisionsFor, r as requires, f as resolveEntitlements } from '../resolve.d-CoQWUy1Y.js';
8
- export { E as ENTITLEMENTS_PATH, a as EntitlementResolution, F as FetchEntitlementsArgs, f as fetchEntitlements } from '../entitlementRepository.d-BwThmh3V.js';
9
+ export { E as ENTITLEMENTS_PATH, a as EntitlementResolution, F as FetchEntitlementsArgs, f as fetchEntitlements } from '../entitlementRepository.d-DmnUZLl_.js';
9
10
  import { m as EverfurTheme } from '../tokens.d-BUVqme2D.js';
10
11
  export { D as DEFAULT_MAX_FONT_SCALE, y as EASING_CURVES, z as EVERFUR_DARK, A as EVERFUR_LIGHT, E as EverfurColorTokens, B as EverfurEasingCurve, 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, C as EverfurTextScaleTier, n as EverfurThemeMeta, o as EverfurThemeSlot, p as EverfurThemeSlotKey, q as EverfurThemeSlotName, r as EverfurThemeSlots, s as EverfurTypeSizeTokens, t as EverfurTypeTokens, u as EverfurWeightTokens, S as SLOT_MIN_BORDER_CONTRAST, F as SLOT_MIN_CONTRAST, G as SYSTEM_FONT_FAMILY, H as SYSTEM_MONO_FAMILY, I as SlotGrounds, J as SlotSurrounds, K as TEXT_SCALE_TIER_CAPS, T as THEME_SLOT_KEYS, v as THEME_SLOT_KEYS_BY_SLOT, w as THEME_SLOT_NAMES, L as cssCubicBezier, M as deepFreeze, N as guardSlotContrast, O as mergeThemeSlots, P as parseThemeSlots, x as themeSlotKeysFor } from '../tokens.d-BUVqme2D.js';
11
12
  export { E as EverfurFaceStyle, a as EverfurThemeAdjustment, R as ResolveThemeInput, T as TEXT_SCALE_FLOOR, f as face, h as headingFace, p as previewTheme, r as resolveTheme, t as themeAdjustments, w as withServerBranding } from '../typeStyle.d-B3Kdtjie.js';
12
13
  export { A as APPEARANCE_PRESETS, a as APPEARANCE_PRESET_NAMES, b as APPEARANCE_SIZE_RANGES, C as ClientBranding, c as EverfurAppearance, d as EverfurAppearanceFont, e as EverfurAppearancePreset, f as EverfurAppearanceRules, g as EverfurAppearanceVariables, h as EverfurThemeFontFaceKey, i as EverfurThemeFontUrlsInput, j as EverfurThemeFontsInput, E as EverfurThemeInput, k as EverfurThemeSlotInput, l as EverfurThemeSlotsInput, L as LOCKABLE_THEME_FIELDS, n as LockableThemeField, M as MAX_FONT_SCALE_CEILING, R as RadiusScale, o as SLOT_LOCK_PREFIX, p as SlotLockName, S as SurfaceStyle, T as THEME_SCHEMA_VERSIONS, q as ThemeLockName, m as expandAppearance, r as hardenBrandAssetUrl, s as hardenHttpsUrl, t as isEmptyBranding, u as isKnownBrandingSchema, v as lockedFieldsOf, w as parseClientBranding, x as parsePx } from '../branding.d-y6c0UwhE.js';
13
14
  export { D as DEFAULT_PRESENTATION, 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, l as EverfurPresentationField, i as EverfurPresentationInput, j as EverfurSafetyDisclaimerPlacement, P as PRESENTATION_LOCK, k as PRESENTATION_LOCK_PREFIX, m as PRESENTATION_WIRE_NAMES, n as isPresentationFieldLocked, o as isPresentationLockName, p as parsePresentation, r as resolvePresentation } from '../presentation.d-vy8kTGfR.js';
14
- export { F as FunnelSendOptions, R as RequestFunnel, a as RequestFunnelDeps, c as createRequestFunnel } from '../requestFunnel.d-DFf9C__p.js';
15
- export { c as PET_AGE_YEARS_MAX, d as PET_BREED_MAX, e as PET_NAME_MAX, f as PET_SPECIES_MAX, g as PET_WEIGHT_KG_MAX, P as PetProfileInput, a as PetProfilePatch, h as PetsRepository, R as RegisteredPet, W as WidgetPet, i as createPetsRepository, w as widgetPetFromWire } from '../petsRepository.d-Ba3xhJcj.js';
16
- export { b as CHECKIN_ANSWERS, c as CasesRepository, C as CheckinAnswer, a as CheckinOutcome, W as WatchCase, d as createCasesRepository } from '../casesRepository.d-DG83Ggbq.js';
15
+ export { F as FunnelSendOptions, R as RequestFunnel, a as RequestFunnelDeps, c as createRequestFunnel } from '../requestFunnel.d-YabU6G-Z.js';
16
+ export { c as PET_AGE_YEARS_MAX, d as PET_BREED_MAX, e as PET_NAME_MAX, f as PET_SPECIES_MAX, g as PET_WEIGHT_KG_MAX, P as PetProfileInput, a as PetProfilePatch, h as PetsRepository, R as RegisteredPet, W as WidgetPet, i as createPetsRepository, w as widgetPetFromWire } from '../petsRepository.d-DUaAWoTv.js';
17
+ export { b as CHECKIN_ANSWERS, c as CasesRepository, C as CheckinAnswer, a as CheckinOutcome, W as WatchCase, d as createCasesRepository } from '../casesRepository.d-C__BnffJ.js';
17
18
  import '../ErrorPolicyPort.d-68yrE3BE.js';
18
19
  import '../profile.d-CSs1wlXT.js';
19
20
 
@@ -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
  import{z}from"zod";var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
2
3
  /* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
3
4
  /* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
@@ -93,7 +94,7 @@ import{z}from"zod";var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
93
94
  /* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
94
95
  /* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}function contractDocUrl(entry){return entry.envelope==="sse_frame"?`/errors#sse-${entry.wireCode}`:entry.envelope==="oauth_error"?`/errors#oauth-${entry.wireCode}`:`/errors#${entry.wireCode}`}var DOC_SITE_ORIGIN=null;function publishedDocUrl(entry){return null}var EVERFUR_ERROR_CODES=/* @__PURE__ */Object.freeze(["authExpired","authRejected","sessionRequired","accessDenied","paymentRequired","quotaExceeded","rateLimited","validationFailed","sdkUpdateRequired","conflict","idempotencyConflict","idempotencyInFlight","conversationNotFound","petNotFound","resourceNotFound","streamTimeout","mediaUploadFailed","moderationBlocked","upstreamLlmTimeout","internalError","notImplemented","serviceUnavailable","streamIncomplete","identitySignatureRequired","runtimeDisposed","unknown"]),EVERFUR_ERROR_CATEGORIES=/* @__PURE__ */Object.freeze(["authentication","authorization","entitlement","rateLimit","invalidRequest","notFound","conflict","connection","server","media","policy","unknown"]),CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}function fromHttpStatus(status){return status===401?"authExpired":status===403?"accessDenied":status===404?"conversationNotFound":status===409?"idempotencyConflict":status===421?"unknown":status===429?"rateLimited":status===400||status===422?"unknown":status>=500?"internalError":"unknown"}var AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}function shouldRetry(code,frameRetryable=false){return frameRetryable||isAutoRetryable(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}function canRecreateOnNotFound(code){return code==="conversationNotFound"}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",VALIDATION_FAILED_COPY="Something in that request was not right. Check the details and try again.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:VALIDATION_FAILED_COPY,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,runtimeDisposed:VALIDATION_FAILED_COPY,unknown:"Something went wrong. Please try again."}),SESSION_REVOKED_COPY="This session has ended. Please sign in again.",LINKED_ACCOUNT_READ_ONLY="linked_account_read_only";function isLinkedAccountReadOnly(error){return error!=null&&error.code==="conflict"&&error.reasonCode===LINKED_ACCOUNT_READ_ONLY}function displayFor(code,wireCode,reasonCode){return code==="conflict"&&reasonCode===LINKED_ACCOUNT_READ_ONLY?ACCESS_DENIED_COPY:(code==="authRejected"||code==="authExpired")&&typeof wireCode=="string"&&wireCode.trim().toLowerCase()==="session_revoked"?SESSION_REVOKED_COPY:userFacingError(code)}function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),linkedReadOnly=code==="conflict"&&opts?.reasonCode===LINKED_ACCOUNT_READ_ONLY,error={code:code,category:categoryFor(code),retryable:opts?.retryable??(linkedReadOnly?false:isRetryableCode(code)),displayMessage:displayFor(code,opts?.wireCode,linkedReadOnly?LINKED_ACCOUNT_READ_ONLY:null)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
95
96
  return Object.freeze(warning===void 0?{ok:true,value:value}:{ok:true,value:value,warning:warning})}function err(error){/* @__PURE__ */
96
- 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 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__ */
97
+ 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 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__ */
97
98
  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__ */
98
99
  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__ */
99
100
  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 resolveClientConfig(config,options){let outcome=tryResolveClientConfig(config,options);if(!outcome.ok)throw new EverfurConfigError("invalid-argument",outcome.failure.message);return outcome.config}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 resolveApiBaseUrl(apiBaseUrl){let outcome=tryResolveApiBaseUrl(apiBaseUrl);if(!outcome.ok)throw new EverfurConfigError("invalid-argument",outcome.failure.message);return outcome.value}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__ */
@@ -1,8 +1,9 @@
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
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
2
3
  import { P as PetRef } from './ids.d-B2GAAifq.cjs';
3
4
  import { a as RecordsClinicTarget, b as RecordsAuthorizationSignature } from './clinicModels.d-BXgKZqDb.cjs';
4
- import { R as RequestFunnel } from './requestFunnel.d-CR4akGCY.cjs';
5
- import { A as AuthContext } from './identity.d-CioQhZrq.cjs';
5
+ import { R as RequestFunnel } from './requestFunnel.d-JoqddYSx.cjs';
6
+ import { A as AuthContext } from './identity.d-HbwYQ4-z.cjs';
6
7
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
7
8
  import { d as RecordsRequestView } from './models.d-BSqvbTE1.cjs';
8
9
 
@@ -1,8 +1,9 @@
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
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
2
3
  import { P as PetRef } from './ids.d-B2GAAifq.js';
3
4
  import { a as RecordsClinicTarget, b as RecordsAuthorizationSignature } from './clinicModels.d-CaS64-P-.js';
4
- import { R as RequestFunnel } from './requestFunnel.d-DFf9C__p.js';
5
- import { A as AuthContext } from './identity.d-BksOEa6m.js';
5
+ import { R as RequestFunnel } from './requestFunnel.d-YabU6G-Z.js';
6
+ import { A as AuthContext } from './identity.d-Be2Es9Td.js';
6
7
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
7
8
  import { d as RecordsRequestView } from './models.d-DOwnr8fi.js';
8
9
 
@@ -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
  import { P as PetRef } from './ids.d-B2GAAifq.cjs';
2
3
 
3
4
  /** Directory contact details only. The server intentionally does not expose clinic email addresses. */