@everfur/sdk 0.18.2 → 0.18.3

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 (159) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -5
  3. package/dist/{Chat.d-B7iUVGmB.d.cts → Chat.d-BEbRI8FZ.d.cts} +1 -1
  4. package/dist/{Chat.d-BkLu9G00.d.ts → Chat.d-CKKuXVw5.d.ts} +1 -1
  5. package/dist/{DepthViews.d-BiS-GTEf.d.cts → DepthViews.d-BiePRa3Z.d.cts} +1 -1
  6. package/dist/{DepthViews.d-C-zs_BnZ.d.cts → DepthViews.d-Chn2xwZu.d.cts} +1 -1
  7. package/dist/{DepthViews.d-C0DVqywN.d.ts → DepthViews.d-CiU4f98J.d.ts} +1 -1
  8. package/dist/{DepthViews.d-hXV6Ef0y.d.ts → DepthViews.d-_WMIpymE.d.ts} +1 -1
  9. package/dist/{IntakeMedia.d-4a89XrP7.d.ts → IntakeMedia.d-B_ZVDxh3.d.ts} +1 -1
  10. package/dist/{IntakeMedia.d-JJCUvQu7.d.cts → IntakeMedia.d-CnGzpllr.d.cts} +1 -1
  11. package/dist/{IntakeMedia.d-DGxrhgIW.d.ts → IntakeMedia.d-DNUAks9E.d.ts} +1 -1
  12. package/dist/{IntakeMedia.d-DUPR4lVM.d.cts → IntakeMedia.d-Dqc5V_YH.d.cts} +1 -1
  13. package/dist/{RecordsPage.d-BG_RDR1V.d.ts → RecordsPage.d-CRRJM35Q.d.ts} +1 -1
  14. package/dist/{RecordsPage.d-5rHMTDyY.d.cts → RecordsPage.d-CtNzoxre.d.cts} +1 -1
  15. package/dist/animations/index.d.cts +3 -3
  16. package/dist/animations/index.d.ts +3 -3
  17. package/dist/{appStateLifecycle.d-_TM06yEk.d.cts → appStateLifecycle.d-BQcy4J5O.d.cts} +3 -3
  18. package/dist/{appStateLifecycle.d-7H_2a9it.d.ts → appStateLifecycle.d-JuPhh7Oy.d.ts} +3 -3
  19. package/dist/{attachments.d-DFbXLAYK.d.cts → attachments.d-BLEOCUU7.d.cts} +2 -2
  20. package/dist/{attachments.d-HmRqizDG.d.cts → attachments.d-CeXw6R7_.d.cts} +5 -5
  21. package/dist/{attachments.d-_mgNU-ur.d.ts → attachments.d-DRkqNR-o.d.ts} +2 -2
  22. package/dist/{attachments.d-D7f7OfPE.d.ts → attachments.d-d1rWAw9K.d.ts} +5 -5
  23. package/dist/{bookingCopy.d-0K1trjxx.d.cts → bookingCopy.d-CoiNXrY8.d.cts} +10 -3
  24. package/dist/{bookingCopy.d-RU8lNYJ4.d.ts → bookingCopy.d-CrUufdoE.d.ts} +10 -3
  25. package/dist/{casesRepository.d-D2SQFL27.d.ts → casesRepository.d-DhI69yuj.d.ts} +1 -1
  26. package/dist/{casesRepository.d-D7vIZ9oX.d.cts → casesRepository.d-OyZOSNNv.d.cts} +1 -1
  27. package/dist/chat/index.d.cts +10 -10
  28. package/dist/chat/index.d.ts +10 -10
  29. package/dist/chat/lite/index.d.cts +10 -10
  30. package/dist/chat/lite/index.d.ts +10 -10
  31. package/dist/client/index.cjs +1 -1
  32. package/dist/client/index.d.cts +6 -6
  33. package/dist/client/index.d.ts +6 -6
  34. package/dist/client/index.js +1 -1
  35. package/dist/{clinicBatch.d-BhaCdstU.d.ts → clinicBatch.d-CcqnQ7-d.d.ts} +2 -2
  36. package/dist/{clinicBatch.d-BN1jfVGo.d.cts → clinicBatch.d-DVahpaN3.d.cts} +2 -2
  37. package/dist/{config.d-D_k_rNZZ.d.ts → config.d-KX-EkQ9j.d.ts} +1 -1
  38. package/dist/{config.d-BFTqU7ft.d.cts → config.d-Z_fyOZke.d.cts} +1 -1
  39. package/dist/consent/index.d.cts +5 -5
  40. package/dist/consent/index.d.ts +5 -5
  41. package/dist/{context.d-D2fhrjAM.d.cts → context.d-DV5E_2Fs.d.cts} +5 -5
  42. package/dist/{context.d-B4LODPF1.d.ts → context.d-DY6d4qXG.d.ts} +5 -5
  43. package/dist/{copy.d-Bn9eIgkW.d.ts → copy.d-BPzpKGGc.d.ts} +2 -2
  44. package/dist/{copy.d-DjYhMxxS.d.cts → copy.d-CMY9OoCC.d.cts} +2 -2
  45. package/dist/core/index.cjs +1 -1
  46. package/dist/core/index.d.cts +13 -13
  47. package/dist/core/index.d.ts +13 -13
  48. package/dist/core/index.js +1 -1
  49. package/dist/{depth.d-DlaIV8TV.d.ts → depth.d-B_qNSgXr.d.ts} +2 -2
  50. package/dist/{depth.d-CsKZkLNi.d.cts → depth.d-qVYPByPb.d.cts} +2 -2
  51. package/dist/{entitlementRepository.d-C5d_6QMi.d.ts → entitlementRepository.d-BXDWPyP8.d.ts} +2 -2
  52. package/dist/{entitlementRepository.d-CpIRpfzy.d.cts → entitlementRepository.d-CwTVi7he.d.cts} +2 -2
  53. package/dist/{focus.d-DOlAaNIU.d.ts → focus.d-BPofD7ow.d.ts} +2 -2
  54. package/dist/{focus.d-DdBbwzjP.d.cts → focus.d-DJD4lWFB.d.cts} +2 -2
  55. package/dist/health-plan/index.d.cts +9 -9
  56. package/dist/health-plan/index.d.ts +9 -9
  57. package/dist/{idempotency.d-CmQc1OUv.d.ts → idempotency.d-BVO0mU2R.d.ts} +1 -1
  58. package/dist/{idempotency.d-P4O5lNBq.d.cts → idempotency.d-BmYuCb-n.d.cts} +1 -1
  59. package/dist/{identity.d-BmbAwQYx.d.cts → identity.d-3ROlHbnP.d.cts} +1 -1
  60. package/dist/{identity.d-BZXPu9Hi.d.ts → identity.d-CRVNfZzQ.d.ts} +1 -1
  61. package/dist/index.cjs +1 -1
  62. package/dist/index.d.cts +13 -13
  63. package/dist/index.d.ts +13 -13
  64. package/dist/index.js +1 -1
  65. package/dist/{introEvents.d-Bqw2Hcpt.d.cts → introEvents.d-DGQDEPJi.d.cts} +1 -1
  66. package/dist/{introEvents.d-Cy8yxOoe.d.ts → introEvents.d-cvMxJfYd.d.ts} +1 -1
  67. package/dist/notifications/index.d.cts +4 -4
  68. package/dist/notifications/index.d.ts +4 -4
  69. package/dist/{optInView.d-DXj2w4KU.d.cts → optInView.d-CU1U_K-B.d.cts} +2 -2
  70. package/dist/{optInView.d-wGSNOB86.d.ts → optInView.d-DIGu47Lz.d.ts} +2 -2
  71. package/dist/{parse.d-C9_UMXfA.d.cts → parse.d-GzZJYu__.d.cts} +1 -1
  72. package/dist/{parse.d-MQST1RP3.d.ts → parse.d-icynBIS-.d.ts} +1 -1
  73. package/dist/{pets.d-CP13kAFa.d.cts → pets.d-5SMtOAwB.d.cts} +1 -1
  74. package/dist/{pets.d-tqGZP3Co.d.ts → pets.d-BRsbR8QU.d.ts} +1 -1
  75. package/dist/{petsRepository.d-CyerzD5G.d.cts → petsRepository.d-DEnoZn92.d.cts} +1 -1
  76. package/dist/{petsRepository.d-CLyzuoo4.d.ts → petsRepository.d-DWsChqAS.d.ts} +1 -1
  77. package/dist/{ports.d-CB9YZT2L.d.cts → ports.d--OjPUqPb.d.cts} +4 -4
  78. package/dist/{ports.d-RKc2C07X.d.ts → ports.d-CIfa_XF6.d.ts} +4 -4
  79. package/dist/records/depth/index.d.cts +9 -9
  80. package/dist/records/depth/index.d.ts +9 -9
  81. package/dist/records/index.cjs +1 -1
  82. package/dist/records/index.d.cts +10 -10
  83. package/dist/records/index.d.ts +10 -10
  84. package/dist/records/index.js +1 -1
  85. package/dist/{requestFunnel.d-DocT7FXR.d.cts → requestFunnel.d-CQX_Z1Hi.d.cts} +2 -2
  86. package/dist/{requestFunnel.d-BPWf5SQf.d.ts → requestFunnel.d-DSvCGf4J.d.ts} +2 -2
  87. package/dist/{runtimeTypes.d-D4Cjjf_C.d.ts → runtimeTypes.d-Be_vhOER.d.ts} +4 -4
  88. package/dist/{runtimeTypes.d-CkwEMpy8.d.cts → runtimeTypes.d-sXpNYnJp.d.cts} +4 -4
  89. package/dist/{screenProps.d-Byla6nJL.d.cts → screenProps.d-BW6PZh5k.d.cts} +1 -1
  90. package/dist/{screenProps.d-DNTTp7hU.d.ts → screenProps.d-DpMK2_gi.d.ts} +1 -1
  91. package/dist/server/events/index.cjs +2 -2
  92. package/dist/server/events/index.d.cts +36 -5
  93. package/dist/server/events/index.d.ts +36 -5
  94. package/dist/server/events/index.js +2 -2
  95. package/dist/server/index.cjs +1 -1
  96. package/dist/server/index.d.cts +3 -3
  97. package/dist/server/index.d.ts +3 -3
  98. package/dist/server/index.js +1 -1
  99. package/dist/shop/index.d.cts +3 -3
  100. package/dist/shop/index.d.ts +3 -3
  101. package/dist/tabs/index.d.cts +6 -6
  102. package/dist/tabs/index.d.ts +6 -6
  103. package/dist/televet/booking/index.cjs +11 -10
  104. package/dist/televet/booking/index.d.cts +13 -11
  105. package/dist/televet/booking/index.d.ts +13 -11
  106. package/dist/televet/booking/index.js +11 -10
  107. package/dist/televet/index.d.cts +3 -3
  108. package/dist/televet/index.d.ts +3 -3
  109. package/dist/{televetGlobal.d-CC-DrqkQ.d.ts → televetGlobal.d-B0_jbCtC.d.ts} +7 -0
  110. package/dist/{televetGlobal.d-CKwDCbmN.d.cts → televetGlobal.d-BWYJR391.d.cts} +7 -0
  111. package/dist/testing/index.d.cts +1 -1
  112. package/dist/testing/index.d.ts +1 -1
  113. package/dist/testing/rn/index.d.cts +7 -7
  114. package/dist/testing/rn/index.d.ts +7 -7
  115. package/dist/testing/web/index.d.cts +7 -7
  116. package/dist/testing/web/index.d.ts +7 -7
  117. package/dist/texting/index.d.cts +5 -5
  118. package/dist/texting/index.d.ts +5 -5
  119. package/dist/{threadOptions.d-CIrevUL8.d.cts → threadOptions.d-Csmb-XgL.d.cts} +2 -2
  120. package/dist/{threadOptions.d-jgk_sHrj.d.ts → threadOptions.d-DMOn3mmj.d.ts} +2 -2
  121. package/dist/{timelineRows.d-BST14weg.d.ts → timelineRows.d-B0XZevKx.d.ts} +1 -1
  122. package/dist/{timelineRows.d-BEjiHpkP.d.cts → timelineRows.d-Kllr7Mcu.d.cts} +1 -1
  123. package/dist/{useHealthPlanSubscription.d-CYJi9ZNE.d.cts → useHealthPlanSubscription.d-C-c_mQ4u.d.cts} +2 -2
  124. package/dist/{useHealthPlanSubscription.d-C9kh4mvk.d.ts → useHealthPlanSubscription.d-bNRntgWe.d.ts} +2 -2
  125. package/dist/{usePresentation.d-COEh8Xa1.d.cts → usePresentation.d-BHKhBKQn.d.cts} +1 -1
  126. package/dist/{usePresentation.d-WA3sfMpz.d.ts → usePresentation.d-CmQgbrZr.d.ts} +1 -1
  127. package/dist/{useRecordsDepth.d-CAYnVYl1.d.ts → useRecordsDepth.d-BilHZaR4.d.ts} +1 -1
  128. package/dist/{useRecordsDepth.d-DZfdRdIU.d.cts → useRecordsDepth.d-WW_2cWwU.d.cts} +1 -1
  129. package/dist/{view.d-eM315KIZ.d.cts → view.d-BTnjZu2S.d.cts} +3 -3
  130. package/dist/{view.d-D8soknYh.d.ts → view.d-BtN_L_UF.d.ts} +3 -3
  131. package/dist/web/consent/index.d.cts +5 -5
  132. package/dist/web/consent/index.d.ts +5 -5
  133. package/dist/web/health-plan/index.d.cts +11 -11
  134. package/dist/web/health-plan/index.d.ts +11 -11
  135. package/dist/web/index.cjs +1 -1
  136. package/dist/web/index.d.cts +23 -23
  137. package/dist/web/index.d.ts +23 -23
  138. package/dist/web/index.js +1 -1
  139. package/dist/web/intro/index.d.cts +6 -6
  140. package/dist/web/intro/index.d.ts +6 -6
  141. package/dist/web/notifications/index.d.cts +3 -3
  142. package/dist/web/notifications/index.d.ts +3 -3
  143. package/dist/web/records/depth/index.d.cts +9 -9
  144. package/dist/web/records/depth/index.d.ts +9 -9
  145. package/dist/web/records/index.d.cts +11 -11
  146. package/dist/web/records/index.d.ts +11 -11
  147. package/dist/web/records-sheet/index.cjs +1 -1
  148. package/dist/web/records-sheet/index.js +1 -1
  149. package/dist/web/shop/index.d.cts +3 -3
  150. package/dist/web/shop/index.d.ts +3 -3
  151. package/dist/web/televet/booking/index.cjs +9 -9
  152. package/dist/web/televet/booking/index.d.cts +18 -11
  153. package/dist/web/televet/booking/index.d.ts +18 -11
  154. package/dist/web/televet/booking/index.js +9 -9
  155. package/dist/web/televet/index.d.cts +3 -3
  156. package/dist/web/televet/index.d.ts +3 -3
  157. package/dist/web/texting/index.d.cts +5 -5
  158. package/dist/web/texting/index.d.ts +5 -5
  159. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2,9 +2,9 @@
2
2
  export { B as Brand, a as ClientId, C as ConversationId, D as DocumentId, J as JobId, P as PetRef, R as RecordsRequestId, b as ResponseId, U as UserRef, _ as __brand, c as conversationId, p as petRef, u as userRef } from './ids.d-B2GAAifq.js';
3
3
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode, c as categoryFor, i as isRetryableCode, u as userFacingError } from './EverfurError.d-8NHtlgzA.js';
4
4
  export { a as EverfurConfigError, E as EverfurResult, b as EverfurThrownError, i as isErr, c as isOk, u as unwrap } from './EverfurResult.d-D_-254ZY.js';
5
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-D_k_rNZZ.js';
6
- export { M as MintedToken, T as TokenProvider } from './identity.d-BZXPu9Hi.js';
7
- export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-D4Cjjf_C.js';
5
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from './config.d-KX-EkQ9j.js';
6
+ export { M as MintedToken, T as TokenProvider } from './identity.d-CRVNfZzQ.js';
7
+ export { E as EverfurClientEvent, a as EverfurEventHandler, L as LogLevel, b as LogRecord, c as LogSink, P as PrepareOptions, d as PrepareResult, e as PrepareStatus, S as SecureStorePort } from './runtimeTypes.d-Be_vhOER.js';
8
8
  export { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
9
9
  export { E as EverfurFaceStyle, a as EverfurThemeAdjustment, f as face, h as headingFace, p as previewTheme, t as themeAdjustments } from './typeStyle.d-B9Jo5mDX.js';
10
10
  import { C as CapabilityName, a as CapabilityDecision } from './resolve.d-BTC3b6FW.js';
@@ -13,20 +13,20 @@ export { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.js';
13
13
  export { I as ImageCachePort, K as KvPort } from './cacheEpoch.d-DknKn3S0.js';
14
14
  export { C as CameraPort, a as CaptureOptions, M as MediaSource } from './CameraPort.d-Cv31Pz7g.js';
15
15
  export { F as FileHandle, b as FilePort, a as UploadPolicyWire, U as UploadTransport } from './ports.d-BX4f4UsB.js';
16
- export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-RKc2C07X.js';
16
+ export { C as ChatCheckin, a as ChatCheckinTarget, b as ChatConversation, c as ChatConversationListOptions, d as ChatConversationPage, e as ChatFeedbackReceipt, f as ChatFeedbackType, g as ChatHistoryOptions, i as ChatMessage, h as ChatMessagePage, j as ChatMessageRole, k as ChatMessageSender, l as ChatStatus, m as Citation, P as PresignedPolicy, S as SendOptions, U as UploadPort } from './ports.d-CIfa_XF6.js';
17
17
  export { R as RecordsDocumentPicker, a as RnRecordsUploadFetch, b as RnRecordsUploadTransportOptions, c as createRnRecordsUploadTransport } from './uploadTransport.d-EGoUl7gX.js';
18
- export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-D2SQFL27.js';
18
+ export { C as CheckinAnswer, a as CheckinOutcome, W as WatchCase } from './casesRepository.d-DhI69yuj.js';
19
19
  import { ReactNode } from 'react';
20
- import { E as EverfurProviderProps } from './context.d-B4LODPF1.js';
21
- export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-B4LODPF1.js';
20
+ import { E as EverfurProviderProps } from './context.d-DY6d4qXG.js';
21
+ export { a as EverfurConfig, b as EverfurHandle, c as EverfurUser, U as UseEverfurPetProfileState, u as useCapability, d as useEverfur, e as useEverfurPetProfile, f as useEverfurTheme } from './context.d-DY6d4qXG.js';
22
22
  import { StyleProp, ViewStyle } from 'react-native';
23
- export { E as EverfurChat } from './Chat.d-BkLu9G00.js';
24
- export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatFollowUpPolicy, c as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, d as UseChatAttachmentsOptions, e as UseChatAttachmentsState, f as UseEverfurChatState, g as UseEverfurPetsState, u as useChatAttachments, h as useEverfurChat, i as useEverfurPets } from './attachments.d-D7f7OfPE.js';
25
- export { E as EverfurChatAttachments, a as EverfurChatProps, b as EverfurDictationLoader, c as createAppStateLifecycle, r as registerEverfurDictation } from './appStateLifecycle.d-7H_2a9it.js';
23
+ export { E as EverfurChat } from './Chat.d-CKKuXVw5.js';
24
+ export { C as ChatFeedbackReason, a as ChatFeedbackReasonOption, b as ChatFollowUpPolicy, c as ChatSentiment, E as EverfurChatDraftStore, U as UrgencyDisplayLevel, d as UseChatAttachmentsOptions, e as UseChatAttachmentsState, f as UseEverfurChatState, g as UseEverfurPetsState, u as useChatAttachments, h as useEverfurChat, i as useEverfurPets } from './attachments.d-d1rWAw9K.js';
25
+ export { E as EverfurChatAttachments, a as EverfurChatProps, b as EverfurDictationLoader, c as createAppStateLifecycle, r as registerEverfurDictation } from './appStateLifecycle.d-JuPhh7Oy.js';
26
26
  export { E as EverfurChatAnswerCard, a as EverfurChatAnswerCards, b as EverfurChatAnswerContext, c as EverfurChatEmptyState, d as EverfurChatFollowUpAction, e as EverfurChatHistoryBar, f as EverfurChatHistorySheet, g as EverfurChatOpeningCard } from './threadOptions.d-U5YBUKM-.js';
27
27
  export { L as LifecyclePort } from './LifecyclePort.d-Cr1p33a7.js';
28
- export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-CLyzuoo4.js';
29
- export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-_mgNU-ur.js';
28
+ export { P as PetProfileInput, a as PetProfilePatch, R as RegisteredPet, W as WidgetPet, b as WidgetPetProfile } from './petsRepository.d-DWsChqAS.js';
29
+ export { A as AttachmentError, a as AttachmentErrorCode, b as AttachmentOutcome, c as AttachmentQueue, d as AttachmentState, e as AttachmentStatus } from './attachments.d-DRkqNR-o.js';
30
30
  export { E as EverfurChatAnswerStyle, a as EverfurChatComposerPlaceholder, b as EverfurChatComposerStyle, c as EverfurChatHistoryBarSetting, d as EverfurChatHistoryStyle, e as EverfurChatSendButtonSetting, f as EverfurChatTopCardSetting, g as EverfurHealthPlanLayout, h as EverfurPresentation, i as EverfurPresentationInput, j as EverfurSafetyDisclaimerPlacement } from './presentation.d-Bs8xQ4gD.js';
31
31
  export { E as EverfurStarterPrompt } from './quickPrompts.d-NM_81Jc1.js';
32
32
  export { b as PetActivityLevel, c as PetAllergy, d as PetAllergySeverity, e as PetBirthDatePrecision, f as PetCondition, a as PetHealthProfile, P as PetHealthProfileInput, g as PetIndoorOutdoor, h as PetMedication, i as PetSex } from './profile.d-CSs1wlXT.js';
@@ -35,7 +35,7 @@ import { E as EverfurThemeInput } from './branding.d-DpNGEdDL.js';
35
35
  export { A as APPEARANCE_PRESETS, a as APPEARANCE_PRESET_NAMES, b as APPEARANCE_SIZE_RANGES, c as EverfurAppearance, d as EverfurAppearanceFont, e as EverfurAppearancePreset, f as EverfurAppearanceRules, g as EverfurAppearanceVariables, h as EverfurThemeFontFaceKey, i as EverfurThemeFontUrlsInput, j as EverfurThemeFontsInput, k as EverfurThemeSlotInput, l as EverfurThemeSlotsInput, m as expandAppearance } from './branding.d-DpNGEdDL.js';
36
36
  export { E as EverfurColorTokens, a as EverfurFontFaceKey, b as EverfurFontFamilies, c as EverfurFontSource, d as EverfurFontWeight, e as EverfurLetterSpacingTokens, f as EverfurLineHeightTokens, g as EverfurMotionDurationTokens, h as EverfurMotionTokens, i as EverfurRadiusTokens, j as EverfurSpaceTokens, k as EverfurSpringToken, l as EverfurTextColorTokens, m as EverfurTheme, n as EverfurThemeMeta, o as EverfurThemeSlot, p as EverfurThemeSlotKey, q as EverfurThemeSlotName, r as EverfurThemeSlots, s as EverfurTypeSizeTokens, t as EverfurTypeTokens, u as EverfurWeightTokens, T as THEME_SLOT_KEYS, v as THEME_SLOT_KEYS_BY_SLOT, w as THEME_SLOT_NAMES, x as themeSlotKeysFor } from './tokens.d-BUVqme2D.js';
37
37
  export { E as EverfurChatEmptyHeaderContext, a as EverfurChatTopCard } from './threadOptions.d-CW51PyVd.js';
38
- import './requestFunnel.d-BPWf5SQf.js';
38
+ import './requestFunnel.d-DSvCGf4J.js';
39
39
 
40
40
  /**
41
41
  * Wrap the tree ONCE, high. Mounting constructs the runtime (transport, identity, registry,
package/dist/index.js CHANGED
@@ -104,7 +104,7 @@ return Object.freeze({kind:"done",terminal:true,conversationId:fields.conversati
104
104
  return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:fields.serverRequestId??null})}function analysisStartedFrame(requestId,lastEventId,serverRequestId=null){/* @__PURE__ */
105
105
  return Object.freeze({kind:"analysisStarted",requestId:requestId,lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}function analysisCompleteFrame(fields,serverRequestId=null){/* @__PURE__ */
106
106
  return Object.freeze({kind:"analysisComplete",terminal:false,resultId:fields.resultId,analysisType:fields.analysisType,modelVersion:fields.modelVersion,confidence:fields.confidence,detections:/* @__PURE__ */Object.freeze([...fields.detections]),interpretation:fields.interpretation,lastEventId:fields.lastEventId,serverRequestId:serverRequestId})}function unknownFrame(raw,lastEventId,serverRequestId=null){/* @__PURE__ */
107
- return Object.freeze({kind:"unknown",raw:{...raw},lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function createIdentityProvider(userRef2,getToken,onMinted,onRejected){let cached=null,rejectionReported=false,inFlight3=null,revoked=false,load=()=>inFlight3||(inFlight3=(async()=>{try{let minted=await getToken(),token=typeof minted=="string"?minted:minted?.token;if(typeof token!="string"||token.length===0)throw new EverfurConfigError("invalid-argument","TokenProvider returned an empty token");return cached=token,rejectionReported=!1,onMinted?.(typeof minted=="string"?null:expiryMs(minted.expiresAt)),token}finally{inFlight3=null}})(),inFlight3);return{userRef:userRef2,async currentToken(opts){if(revoked)throw new EverfurConfigError("not-initialized","This identity was cleared (sign-out); mint a new one.");return opts?.forceRefresh&&(cached=null),cached!==null?cached:load()},hasToken(){return!revoked&&cached!==null},clear(){revoked=true,cached=null},reportRejected(){revoked||rejectionReported||(rejectionReported=true,onRejected?.())}}}function expiryMs(value){if(value===void 0)return null;let ms=typeof value=="number"?value<1e11?value*1e3:value:new Date(value).getTime();return Number.isFinite(ms)?ms:null}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}var DAILY_QUOTA_WIRE_CODE="DAILY_QUOTA_EXCEEDED",THROTTLES=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function foldDailyQuotaWireCode(code,body){if(!THROTTLES.has(code.toUpperCase().replace(/[^A-Z0-9]/g,"")))return code;let b=body,limit=b?.daily_limit??b?.error?.daily_limit;return typeof limit=="number"&&Number.isFinite(limit)?DAILY_QUOTA_WIRE_CODE:code}function createFallbackUtf8Decoder(){let pending=[];return{decode(input,options){let stream=options?.stream===true,bytes=pending.length>0?pending.slice():[];if(input!==void 0)for(let i2=0;i2<input.length;i2+=1)bytes.push(input[i2]);pending=[];let out="",i=0;for(;i<bytes.length;){let b0=bytes[i];if(b0<128){out+=String.fromCharCode(b0),i+=1;continue}let need,lower=128,upper=191,cp;if(b0>=194&&b0<=223)need=1,cp=b0&31;else if(b0>=224&&b0<=239)need=2,cp=b0&15,b0===224&&(lower=160),b0===237&&(upper=159);else if(b0>=240&&b0<=244)need=3,cp=b0&7,b0===240&&(lower=144),b0===244&&(upper=143);else{out+="�",i+=1;continue}let j=1,valid=true;for(;j<=need&&!(i+j>=bytes.length);){let b=bytes[i+j],lo=j===1?lower:128,hi=j===1?upper:191;if(b<lo||b>hi){valid=false;break}cp=cp<<6|b&63,j+=1}if(!valid){out+="�",i+=j;continue}if(j<=need){stream?pending=bytes.slice(i):out+="�";break}out+=String.fromCodePoint(cp),i+=need+1}return out}}}function createUtf8Decoder(){let Native=globalThis.TextDecoder;return typeof Native=="function"?new Native("utf-8"):createFallbackUtf8Decoder()}var BLOCK_SEPARATOR=`\n\n`,MAX_PENDING_BLOCK_CHARS=1048576,wireObjectSchema=/* @__PURE__ */z.record(/* @__PURE__ */z.string(),/* @__PURE__ */z.unknown()),URGENCY_LEVELS=["emergency","schedule_soon","home_care"];async function*parseSse(bytes,serverRequestId=null){let resolvedRequestId=null,requestIdNow=()=>(resolvedRequestId!==null||(resolvedRequestId=typeof serverRequestId=="function"?serverRequestId():serverRequestId),resolvedRequestId),decoder=createUtf8Decoder(),buffer="",scanFrom=0,sawDelta=false;for await(let chunk of bytes){for(buffer+=decoder.decode(chunk,{stream:true});;){let sep=buffer.indexOf(BLOCK_SEPARATOR,scanFrom);if(sep===-1)break;let block=buffer.slice(0,sep);buffer=buffer.slice(sep+BLOCK_SEPARATOR.length),scanFrom=0;let frame=parseBlock(block,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}if(scanFrom=buffer.length>0?buffer.length-1:0,buffer.length>MAX_PENDING_BLOCK_CHARS){yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()});return}}if(buffer+=decoder.decode(),buffer.trim().length>0){let frame=parseBlock(buffer,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()})}function parseBlock(block,serverRequestId){let id=null,dataLines=[];for(let rawLine of block.split(`\n`)){let line=rawLine.replace(/\s+$/,"");line.length===0||line.startsWith(":")||(line.startsWith("id:")?id=line.slice(3).trim():line.startsWith("data:")&&dataLines.push(line.slice(5).replace(/^ /,"")))}if(dataLines.length===0)return null;let decoded;try{decoded=JSON.parse(dataLines.join(`\n`))}catch{return null}if(typeof decoded!="object"||decoded===null||Array.isArray(decoded))return null;let parsed=wireObjectSchema.safeParse(decoded);return parsed.success?frameFromWire(parsed.data,id,serverRequestId):null}function frameFromWire(json,lastEventId,serverRequestId){let type=json.type,event=json.event;if(type==="error"||"error"in json)return errorFrame({code:asString(json.code)??"unknown",retryable:json.retryable===true,wireMessage:asString(json.error),synthesized:false,lastEventId:lastEventId,serverRequestId:serverRequestId});if(type==="done"||json.done===true)return doneFrame({conversationId:asString(json.conversation_id)??"",messageId:asString(json.message_id),title:asString(json.title),followUpQuestions:asStringList(json.follow_up_questions),citations:asMapList(json.citations),citationStatus:asString(json.citation_status),urgencyLevel:asUrgency(json.urgency_level),urgencyReason:asString(json.urgency_reason),urgencyProvided:urgencySlotProvided(json),resultId:asString(json.result_id),lastEventId:lastEventId},serverRequestId);if(type==="accepted"||json.status==="reasoning")return acceptedFrame(asString(json.stream_id),lastEventId,serverRequestId);if(type==="heartbeat"||json.heartbeat===true)return heartbeatFrame(lastEventId,serverRequestId);if(type==="text.delta"||"delta"in json||"token"in json){let delta=asString(json.delta)??asString(json.token)??"";return deltaFrame(delta,lastEventId,serverRequestId)}return event==="analysis_started"?analysisStartedFrame(asString(json.request_id),lastEventId,serverRequestId):event==="analysis_complete"?analysisCompleteFrame({resultId:asString(json.result_id),analysisType:asString(json.analysis_type),modelVersion:asString(json.model_version),confidence:asNumber(json.confidence),detections:asMapList(json.detections),interpretation:asString(json.interpretation),lastEventId:lastEventId},serverRequestId):unknownFrame(json,lastEventId,serverRequestId)}function asString(v){return typeof v=="string"?v:null}function asNumber(v){return typeof v=="number"&&Number.isFinite(v)?v:null}function asUrgency(v){return typeof v=="string"&&URGENCY_LEVELS.includes(v)?v:null}function urgencySlotProvided(json){if(!Object.prototype.hasOwnProperty.call(json,"urgency_level"))return false;let raw=json.urgency_level;return raw===null||asUrgency(raw)!==null}function asStringList(v){return Array.isArray(v)?v.map(e=>typeof e=="string"?e:String(e)):[]}function isPlainObject(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function asMapList(v){return Array.isArray(v)?v.filter(isPlainObject):[]}var SDK_VERSION="0.18.2",SDK_PLATFORM="react-native",DEFAULT_CONTRACT_VERSION="2026-09-19",ENV_API_BASE_URL="EVERFUR_API_BASE_URL";function configFailure(reason,message){/* @__PURE__ */
107
+ return Object.freeze({kind:"unknown",raw:{...raw},lastEventId:lastEventId,serverRequestId:serverRequestId,terminal:false})}function mintFailedError(cause,refusal){let message=cause instanceof Error?cause.message:typeof cause=="string"?cause:null;return makeEverfurError("authRejected",{retryable:false,...refusal?.wireCode?{wireCode:refusal.wireCode}:{},...refusal?.requestId?{requestId:refusal.requestId}:{},...message?{wireMessage:message}:{},...cause!=null?{raw:cause}:{}})}function createIdentityProvider(userRef2,getToken,onMinted,onRejected){let cached=null,rejectionReported=false,inFlight3=null,revoked=false,load=()=>inFlight3||(inFlight3=(async()=>{try{let minted=await getToken(),token=typeof minted=="string"?minted:minted?.token;if(typeof token!="string"||token.length===0)throw new EverfurConfigError("invalid-argument","TokenProvider returned an empty token");return cached=token,rejectionReported=!1,onMinted?.(typeof minted=="string"?null:expiryMs(minted.expiresAt)),token}finally{inFlight3=null}})(),inFlight3);return{userRef:userRef2,async currentToken(opts){if(revoked)throw new EverfurConfigError("not-initialized","This identity was cleared (sign-out); mint a new one.");return opts?.forceRefresh&&(cached=null),cached!==null?cached:load()},hasToken(){return!revoked&&cached!==null},clear(){revoked=true,cached=null},reportRejected(){revoked||rejectionReported||(rejectionReported=true,onRejected?.())}}}function expiryMs(value){if(value===void 0)return null;let ms=typeof value=="number"?value<1e11?value*1e3:value:new Date(value).getTime();return Number.isFinite(ms)?ms:null}function newSessionId(){let bytes=new Uint8Array(16),cryptoObj=globalThis.crypto;if(typeof cryptoObj?.getRandomValues=="function")cryptoObj.getRandomValues(bytes);else for(let i=0;i<bytes.length;i+=1)bytes[i]=Math.floor(Math.random()*256);bytes[6]=bytes[6]&15|64,bytes[8]=bytes[8]&63|128;let hex=[];for(let i=0;i<bytes.length;i+=1)hex.push(bytes[i].toString(16).padStart(2,"0"));return hex.slice(0,4).join("")+"-"+hex.slice(4,6).join("")+"-"+hex.slice(6,8).join("")+"-"+hex.slice(8,10).join("")+"-"+hex.slice(10,16).join("")}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause))}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch(cause){return ctx.identity.reportRejected?.(),err(mintFailedError(cause,{wireCode:wireCodeOf(first.error.raw),requestId:first.error.requestId}))}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?(ctx.identity.reportRejected?.(),err(refusedAfterRemintError(retry.error))):retry}function refusedAfterRemintError(refusal){let raw=refusal.raw,wireCode=wireCodeOf(raw);return makeEverfurError("authRejected",{retryable:false,...refusal.httpStatus!==void 0?{httpStatus:refusal.httpStatus}:{},...refusal.requestId?{requestId:refusal.requestId}:{},...wireCode?{wireCode:wireCode}:{},...refusal.reasonCode?{reasonCode:refusal.reasonCode}:{},...refusal.wireMessage?{wireMessage:refusal.wireMessage}:{},...raw!=null?{raw:raw}:{}})}function wireCodeOf(body){if(typeof body!="object"||body===null)return null;let b=body,code=(typeof b.error=="object"&&b.error!==null?b.error.code:void 0)??b.code;return typeof code=="string"&&code.length>0?code:null}var DAILY_QUOTA_WIRE_CODE="DAILY_QUOTA_EXCEEDED",THROTTLES=/* @__PURE__ */new Set(["THROTTLINGEXCEPTION","RATELIMITED","TOOMANYREQUESTS"]);function foldDailyQuotaWireCode(code,body){if(!THROTTLES.has(code.toUpperCase().replace(/[^A-Z0-9]/g,"")))return code;let b=body,limit=b?.daily_limit??b?.error?.daily_limit;return typeof limit=="number"&&Number.isFinite(limit)?DAILY_QUOTA_WIRE_CODE:code}function createFallbackUtf8Decoder(){let pending=[];return{decode(input,options){let stream=options?.stream===true,bytes=pending.length>0?pending.slice():[];if(input!==void 0)for(let i2=0;i2<input.length;i2+=1)bytes.push(input[i2]);pending=[];let out="",i=0;for(;i<bytes.length;){let b0=bytes[i];if(b0<128){out+=String.fromCharCode(b0),i+=1;continue}let need,lower=128,upper=191,cp;if(b0>=194&&b0<=223)need=1,cp=b0&31;else if(b0>=224&&b0<=239)need=2,cp=b0&15,b0===224&&(lower=160),b0===237&&(upper=159);else if(b0>=240&&b0<=244)need=3,cp=b0&7,b0===240&&(lower=144),b0===244&&(upper=143);else{out+="�",i+=1;continue}let j=1,valid=true;for(;j<=need&&!(i+j>=bytes.length);){let b=bytes[i+j],lo=j===1?lower:128,hi=j===1?upper:191;if(b<lo||b>hi){valid=false;break}cp=cp<<6|b&63,j+=1}if(!valid){out+="�",i+=j;continue}if(j<=need){stream?pending=bytes.slice(i):out+="�";break}out+=String.fromCodePoint(cp),i+=need+1}return out}}}function createUtf8Decoder(){let Native=globalThis.TextDecoder;return typeof Native=="function"?new Native("utf-8"):createFallbackUtf8Decoder()}var BLOCK_SEPARATOR=`\n\n`,MAX_PENDING_BLOCK_CHARS=1048576,wireObjectSchema=/* @__PURE__ */z.record(/* @__PURE__ */z.string(),/* @__PURE__ */z.unknown()),URGENCY_LEVELS=["emergency","schedule_soon","home_care"];async function*parseSse(bytes,serverRequestId=null){let resolvedRequestId=null,requestIdNow=()=>(resolvedRequestId!==null||(resolvedRequestId=typeof serverRequestId=="function"?serverRequestId():serverRequestId),resolvedRequestId),decoder=createUtf8Decoder(),buffer="",scanFrom=0,sawDelta=false;for await(let chunk of bytes){for(buffer+=decoder.decode(chunk,{stream:true});;){let sep=buffer.indexOf(BLOCK_SEPARATOR,scanFrom);if(sep===-1)break;let block=buffer.slice(0,sep);buffer=buffer.slice(sep+BLOCK_SEPARATOR.length),scanFrom=0;let frame=parseBlock(block,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}if(scanFrom=buffer.length>0?buffer.length-1:0,buffer.length>MAX_PENDING_BLOCK_CHARS){yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()});return}}if(buffer+=decoder.decode(),buffer.trim().length>0){let frame=parseBlock(buffer,requestIdNow());if(frame!==null&&(frame.kind==="delta"&&(sawDelta=true),yield frame,frame.terminal))return}yield errorFrame({code:sawDelta?"CHAT_STREAM_INCOMPLETE":"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:requestIdNow()})}function parseBlock(block,serverRequestId){let id=null,dataLines=[];for(let rawLine of block.split(`\n`)){let line=rawLine.replace(/\s+$/,"");line.length===0||line.startsWith(":")||(line.startsWith("id:")?id=line.slice(3).trim():line.startsWith("data:")&&dataLines.push(line.slice(5).replace(/^ /,"")))}if(dataLines.length===0)return null;let decoded;try{decoded=JSON.parse(dataLines.join(`\n`))}catch{return null}if(typeof decoded!="object"||decoded===null||Array.isArray(decoded))return null;let parsed=wireObjectSchema.safeParse(decoded);return parsed.success?frameFromWire(parsed.data,id,serverRequestId):null}function frameFromWire(json,lastEventId,serverRequestId){let type=json.type,event=json.event;if(type==="error"||"error"in json)return errorFrame({code:asString(json.code)??"unknown",retryable:json.retryable===true,wireMessage:asString(json.error),synthesized:false,lastEventId:lastEventId,serverRequestId:serverRequestId});if(type==="done"||json.done===true)return doneFrame({conversationId:asString(json.conversation_id)??"",messageId:asString(json.message_id),title:asString(json.title),followUpQuestions:asStringList(json.follow_up_questions),citations:asMapList(json.citations),citationStatus:asString(json.citation_status),urgencyLevel:asUrgency(json.urgency_level),urgencyReason:asString(json.urgency_reason),urgencyProvided:urgencySlotProvided(json),resultId:asString(json.result_id),lastEventId:lastEventId},serverRequestId);if(type==="accepted"||json.status==="reasoning")return acceptedFrame(asString(json.stream_id),lastEventId,serverRequestId);if(type==="heartbeat"||json.heartbeat===true)return heartbeatFrame(lastEventId,serverRequestId);if(type==="text.delta"||"delta"in json||"token"in json){let delta=asString(json.delta)??asString(json.token)??"";return deltaFrame(delta,lastEventId,serverRequestId)}return event==="analysis_started"?analysisStartedFrame(asString(json.request_id),lastEventId,serverRequestId):event==="analysis_complete"?analysisCompleteFrame({resultId:asString(json.result_id),analysisType:asString(json.analysis_type),modelVersion:asString(json.model_version),confidence:asNumber(json.confidence),detections:asMapList(json.detections),interpretation:asString(json.interpretation),lastEventId:lastEventId},serverRequestId):unknownFrame(json,lastEventId,serverRequestId)}function asString(v){return typeof v=="string"?v:null}function asNumber(v){return typeof v=="number"&&Number.isFinite(v)?v:null}function asUrgency(v){return typeof v=="string"&&URGENCY_LEVELS.includes(v)?v:null}function urgencySlotProvided(json){if(!Object.prototype.hasOwnProperty.call(json,"urgency_level"))return false;let raw=json.urgency_level;return raw===null||asUrgency(raw)!==null}function asStringList(v){return Array.isArray(v)?v.map(e=>typeof e=="string"?e:String(e)):[]}function isPlainObject(v){return typeof v=="object"&&v!==null&&!Array.isArray(v)}function asMapList(v){return Array.isArray(v)?v.filter(isPlainObject):[]}var SDK_VERSION="0.18.3",SDK_PLATFORM="react-native",DEFAULT_CONTRACT_VERSION="2026-09-19",ENV_API_BASE_URL="EVERFUR_API_BASE_URL";function configFailure(reason,message){/* @__PURE__ */
108
108
  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__ */
109
109
  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__ */
110
110
  return Object.freeze({ok:true,config:/* @__PURE__ */Object.freeze({publishableKey:publishableKey,apiBaseUrl:baseUrl.value,contractVersion:contractVersion,sdkVersion:SDK_VERSION,platform:options?.platform??SDK_PLATFORM,debug:config.debug===true})})}function tryResolveApiBaseUrl(apiBaseUrl){let explicit=apiBaseUrl?.trim(),candidate=explicit&&explicit.length>0?explicit:readEnv(ENV_API_BASE_URL);return candidate?normalizeBaseUrl(candidate):configFailure("missing-api-base-url",`apiBaseUrl is required: pass config.apiBaseUrl or set ${ENV_API_BASE_URL}. The SDK never ships a hardcoded host.`)}function buildBaseHeaders(cfg){return{"X-Everfur-SDK-Version":cfg.sdkVersion,"X-Everfur-SDK-Platform":cfg.platform,"X-Everfur-Contract":cfg.contractVersion}}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,5 +1,5 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { a as HealthPlanPetWords, H as HealthPlanPage } from './focus.d-DdBbwzjP.cjs';
2
+ import { a as HealthPlanPetWords, H as HealthPlanPage } from './focus.d-DJD4lWFB.cjs';
3
3
  import { P as PetRef } from './ids.d-B2GAAifq.cjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { a as HealthPlanPetWords, H as HealthPlanPage } from './focus.d-DOlAaNIU.js';
2
+ import { a as HealthPlanPetWords, H as HealthPlanPage } from './focus.d-BPofD7ow.js';
3
3
  import { P as PetRef } from './ids.d-B2GAAifq.js';
4
4
 
5
5
  /**
@@ -1,9 +1,9 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { E as EverfurNotificationsOptions, a as EverfurNotificationsState } from '../parse.d-C9_UMXfA.cjs';
3
- export { D as DevicePlatform, b as EVERFUR_NOTIFICATION_EVENT_TYPES, c as EVERFUR_NOTIFICATION_TARGET_KINDS, d as EVERFUR_NOTIFICATION_VERSION, e as EverfurNotification, f as EverfurNotificationEventType, g as EverfurNotificationTarget, h as EverfurNotificationTargetKind, i as EverfurNotificationsStatus, N as NOTIFICATIONS_REASON_MESSAGES, j as NotificationPreferences, k as NotificationPreferencesInput, l as NotificationsClient, m as NotificationsReasonCode, n as NotificationsRuntime, P as PushProvider, R as RegisterDeviceInput, o as RegisteredDevice, p as createNotificationsClient, q as explainNotificationsReason, r as parseEverfurNotification, u as useEverfurNotificationsClient } from '../parse.d-C9_UMXfA.cjs';
2
+ import { E as EverfurNotificationsOptions, a as EverfurNotificationsState } from '../parse.d-GzZJYu__.cjs';
3
+ export { D as DevicePlatform, b as EVERFUR_NOTIFICATION_EVENT_TYPES, c as EVERFUR_NOTIFICATION_TARGET_KINDS, d as EVERFUR_NOTIFICATION_VERSION, e as EverfurNotification, f as EverfurNotificationEventType, g as EverfurNotificationTarget, h as EverfurNotificationTargetKind, i as EverfurNotificationsStatus, N as NOTIFICATIONS_REASON_MESSAGES, j as NotificationPreferences, k as NotificationPreferencesInput, l as NotificationsClient, m as NotificationsReasonCode, n as NotificationsRuntime, P as PushProvider, R as RegisterDeviceInput, o as RegisteredDevice, p as createNotificationsClient, q as explainNotificationsReason, r as parseEverfurNotification, u as useEverfurNotificationsClient } from '../parse.d-GzZJYu__.cjs';
4
4
  export { V as VetVisitIntent } from '../visitIntent.d-D7_yVp1I.cjs';
5
- export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-BmbAwQYx.cjs';
6
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-BFTqU7ft.cjs';
5
+ export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-3ROlHbnP.cjs';
6
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-Z_fyOZke.cjs';
7
7
  export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.cjs';
8
8
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
9
9
  export { E as EverfurResult } from '../EverfurResult.d-BFH-3s6E.cjs';
@@ -1,9 +1,9 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { E as EverfurNotificationsOptions, a as EverfurNotificationsState } from '../parse.d-MQST1RP3.js';
3
- export { D as DevicePlatform, b as EVERFUR_NOTIFICATION_EVENT_TYPES, c as EVERFUR_NOTIFICATION_TARGET_KINDS, d as EVERFUR_NOTIFICATION_VERSION, e as EverfurNotification, f as EverfurNotificationEventType, g as EverfurNotificationTarget, h as EverfurNotificationTargetKind, i as EverfurNotificationsStatus, N as NOTIFICATIONS_REASON_MESSAGES, j as NotificationPreferences, k as NotificationPreferencesInput, l as NotificationsClient, m as NotificationsReasonCode, n as NotificationsRuntime, P as PushProvider, R as RegisterDeviceInput, o as RegisteredDevice, p as createNotificationsClient, q as explainNotificationsReason, r as parseEverfurNotification, u as useEverfurNotificationsClient } from '../parse.d-MQST1RP3.js';
2
+ import { E as EverfurNotificationsOptions, a as EverfurNotificationsState } from '../parse.d-icynBIS-.js';
3
+ export { D as DevicePlatform, b as EVERFUR_NOTIFICATION_EVENT_TYPES, c as EVERFUR_NOTIFICATION_TARGET_KINDS, d as EVERFUR_NOTIFICATION_VERSION, e as EverfurNotification, f as EverfurNotificationEventType, g as EverfurNotificationTarget, h as EverfurNotificationTargetKind, i as EverfurNotificationsStatus, N as NOTIFICATIONS_REASON_MESSAGES, j as NotificationPreferences, k as NotificationPreferencesInput, l as NotificationsClient, m as NotificationsReasonCode, n as NotificationsRuntime, P as PushProvider, R as RegisterDeviceInput, o as RegisteredDevice, p as createNotificationsClient, q as explainNotificationsReason, r as parseEverfurNotification, u as useEverfurNotificationsClient } from '../parse.d-icynBIS-.js';
4
4
  export { V as VetVisitIntent } from '../visitIntent.d-D7_yVp1I.js';
5
- export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-BZXPu9Hi.js';
6
- export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-D_k_rNZZ.js';
5
+ export { A as AuthContext, I as IdentityProvider, M as MintedToken, T as TokenProvider } from '../identity.d-CRVNfZzQ.js';
6
+ export { A as AcceptedFrame, a as AnalysisCompleteFrame, b as AnalysisStartedFrame, D as DeltaFrame, c as DoneFrame, E as ErrorFrame, d as EverfurRequest, e as EverfurRequestBase, F as Frame, f as FrameBase, g as FrameKind, H as HeartbeatFrame, h as HttpMethod, M as MultipartBody, T as TransportPort, U as UnknownFrame, i as UrgencyLevel } from '../config.d-KX-EkQ9j.js';
7
7
  export { B as Brand, C as ConversationId, P as PetRef, R as RecordsRequestId, U as UserRef, _ as __brand } from '../ids.d-B2GAAifq.js';
8
8
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.js';
9
9
  export { E as EverfurResult } from '../EverfurResult.d-D_-254ZY.js';
@@ -1,8 +1,8 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
3
3
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
4
- import { R as RequestFunnel } from './requestFunnel.d-DocT7FXR.cjs';
5
- import { A as AuthContext } from './identity.d-BmbAwQYx.cjs';
4
+ import { R as RequestFunnel } from './requestFunnel.d-CQX_Z1Hi.cjs';
5
+ import { A as AuthContext } from './identity.d-3ROlHbnP.cjs';
6
6
  import { P as PetRef, U as UserRef } from './ids.d-B2GAAifq.cjs';
7
7
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
8
8
 
@@ -1,8 +1,8 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
3
3
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
4
- import { R as RequestFunnel } from './requestFunnel.d-BPWf5SQf.js';
5
- import { A as AuthContext } from './identity.d-BZXPu9Hi.js';
4
+ import { R as RequestFunnel } from './requestFunnel.d-DSvCGf4J.js';
5
+ import { A as AuthContext } from './identity.d-CRVNfZzQ.js';
6
6
  import { P as PetRef, U as UserRef } from './ids.d-B2GAAifq.js';
7
7
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
8
8
 
@@ -2,7 +2,7 @@
2
2
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
3
3
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
4
4
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
5
- import { A as AuthContext } from './identity.d-BmbAwQYx.cjs';
5
+ import { A as AuthContext } from './identity.d-3ROlHbnP.cjs';
6
6
  import { U as UserRef, R as RecordsRequestId, P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.cjs';
7
7
  import { V as VetVisitIntent } from './visitIntent.d-D7_yVp1I.cjs';
8
8
 
@@ -2,7 +2,7 @@
2
2
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
3
3
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
4
4
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
5
- import { A as AuthContext } from './identity.d-BZXPu9Hi.js';
5
+ import { A as AuthContext } from './identity.d-CRVNfZzQ.js';
6
6
  import { U as UserRef, R as RecordsRequestId, P as PetRef, C as ConversationId } from './ids.d-B2GAAifq.js';
7
7
  import { V as VetVisitIntent } from './visitIntent.d-D7_yVp1I.js';
8
8
 
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
3
- import { j as FetchLike } from './config.d-BFTqU7ft.cjs';
3
+ import { j as FetchLike } from './config.d-Z_fyOZke.cjs';
4
4
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
5
5
 
6
6
  /** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
3
- import { j as FetchLike } from './config.d-D_k_rNZZ.js';
3
+ import { j as FetchLike } from './config.d-KX-EkQ9j.js';
4
4
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
5
5
 
6
6
  /** How your backend reaches Everfur for pet writes. Build it once and reuse it. */
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
3
- import { A as AuthContext } from './identity.d-BmbAwQYx.cjs';
3
+ import { A as AuthContext } from './identity.d-3ROlHbnP.cjs';
4
4
  import { P as PetRef } from './ids.d-B2GAAifq.cjs';
5
5
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
2
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
3
- import { A as AuthContext } from './identity.d-BZXPu9Hi.js';
3
+ import { A as AuthContext } from './identity.d-CRVNfZzQ.js';
4
4
  import { P as PetRef } from './ids.d-B2GAAifq.js';
5
5
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile.d-CSs1wlXT.js';
6
6
 
@@ -1,11 +1,11 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-D7vIZ9oX.cjs';
3
- import { A as AuthContext } from './identity.d-BmbAwQYx.cjs';
2
+ import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-OyZOSNNv.cjs';
3
+ import { A as AuthContext } from './identity.d-3ROlHbnP.cjs';
4
4
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.cjs';
5
5
  import { E as EverfurResult } from './EverfurResult.d-BFH-3s6E.cjs';
6
- import { R as RequestFunnel } from './requestFunnel.d-DocT7FXR.cjs';
6
+ import { R as RequestFunnel } from './requestFunnel.d-CQX_Z1Hi.cjs';
7
7
  import { P as PetRef, C as ConversationId, b as ResponseId } from './ids.d-B2GAAifq.cjs';
8
- import { i as UrgencyLevel, F as Frame } from './config.d-BFTqU7ft.cjs';
8
+ import { i as UrgencyLevel, F as Frame } from './config.d-Z_fyOZke.cjs';
9
9
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-DirW9hgO.cjs';
10
10
  import { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.cjs';
11
11
  import { F as FileHandle } from './ports.d-BX4f4UsB.cjs';
@@ -1,11 +1,11 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-D2SQFL27.js';
3
- import { A as AuthContext } from './identity.d-BZXPu9Hi.js';
2
+ import { C as CheckinAnswer, a as CheckinOutcome } from './casesRepository.d-DhI69yuj.js';
3
+ import { A as AuthContext } from './identity.d-CRVNfZzQ.js';
4
4
  import { E as EverfurError } from './EverfurError.d-8NHtlgzA.js';
5
5
  import { E as EverfurResult } from './EverfurResult.d-D_-254ZY.js';
6
- import { R as RequestFunnel } from './requestFunnel.d-BPWf5SQf.js';
6
+ import { R as RequestFunnel } from './requestFunnel.d-DSvCGf4J.js';
7
7
  import { P as PetRef, C as ConversationId, b as ResponseId } from './ids.d-B2GAAifq.js';
8
- import { i as UrgencyLevel, F as Frame } from './config.d-D_k_rNZZ.js';
8
+ import { i as UrgencyLevel, F as Frame } from './config.d-KX-EkQ9j.js';
9
9
  import { E as ErrorPolicyPort } from './ErrorPolicyPort.d-68yrE3BE.js';
10
10
  import { T as TelemetryPort } from './TelemetryPort.d-BDNr00hu.js';
11
11
  import { F as FileHandle } from './ports.d-BX4f4UsB.js';
@@ -1,9 +1,9 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- export { E as EverfurDocumentContributions, a as EverfurDocumentContributionsProps, b as EverfurRecordDepth, c as EverfurRecordsDepthProps, d as EverfurRecordsTimeline } from '../../DepthViews.d-BiS-GTEf.cjs';
3
- export { R as RecordsDepthStatus, U as UseRecordsDepthState, u as useEverfurRecordsDepthClient, a as useRecordsDepthRead } from '../../useRecordsDepth.d-DZfdRdIU.cjs';
4
- export { T as TimelineRow, a as TimelineRowKind, b as buildTimelineRows } from '../../timelineRows.d-BEjiHpkP.cjs';
5
- export { R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, i as RecordLabMarker, j as RecordLabPoint, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight, s as mapDocumentContributions, t as mapRecordDepth, u as mapRecordsTimeline } from '../../depth.d-CsKZkLNi.cjs';
6
- export { C as ClinicDraft, a as ClinicLocation, R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, d as RecordsUrlKind } from '../../screenProps.d-Byla6nJL.cjs';
2
+ export { E as EverfurDocumentContributions, a as EverfurDocumentContributionsProps, b as EverfurRecordDepth, c as EverfurRecordsDepthProps, d as EverfurRecordsTimeline } from '../../DepthViews.d-BiePRa3Z.cjs';
3
+ export { R as RecordsDepthStatus, U as UseRecordsDepthState, u as useEverfurRecordsDepthClient, a as useRecordsDepthRead } from '../../useRecordsDepth.d-WW_2cWwU.cjs';
4
+ export { T as TimelineRow, a as TimelineRowKind, b as buildTimelineRows } from '../../timelineRows.d-Kllr7Mcu.cjs';
5
+ export { R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, i as RecordLabMarker, j as RecordLabPoint, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight, s as mapDocumentContributions, t as mapRecordDepth, u as mapRecordsTimeline } from '../../depth.d-qVYPByPb.cjs';
6
+ export { C as ClinicDraft, a as ClinicLocation, R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, d as RecordsUrlKind } from '../../screenProps.d-BW6PZh5k.cjs';
7
7
  export { R as RecordsAskEntityRef, a as RecordsAskHandler } from '../../recordsAsk.d-C5CGSi3j.cjs';
8
8
  export { R as RecordsClinic } from '../../clinicModels.d-BXgKZqDb.cjs';
9
9
  export { B as Brand, P as PetRef, R as RecordsRequestId, _ as __brand } from '../../ids.d-B2GAAifq.cjs';
@@ -14,8 +14,8 @@ export { R as RecordDocumentMeta, a as RecordEntity, b as RecordOrigin } from '.
14
14
  import 'react';
15
15
  import 'react-native';
16
16
  import '../../ErrorPolicyPort.d-DirW9hgO.cjs';
17
- import '../../requestFunnel.d-DocT7FXR.cjs';
18
- import '../../config.d-BFTqU7ft.cjs';
19
- import '../../identity.d-BmbAwQYx.cjs';
20
- import '../../clinicBatch.d-BN1jfVGo.cjs';
17
+ import '../../requestFunnel.d-CQX_Z1Hi.cjs';
18
+ import '../../config.d-Z_fyOZke.cjs';
19
+ import '../../identity.d-3ROlHbnP.cjs';
20
+ import '../../clinicBatch.d-DVahpaN3.cjs';
21
21
  import '../../clinicRequestProps.d-1dCtouGA.cjs';
@@ -1,9 +1,9 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- export { E as EverfurDocumentContributions, a as EverfurDocumentContributionsProps, b as EverfurRecordDepth, c as EverfurRecordsDepthProps, d as EverfurRecordsTimeline } from '../../DepthViews.d-hXV6Ef0y.js';
3
- export { R as RecordsDepthStatus, U as UseRecordsDepthState, u as useEverfurRecordsDepthClient, a as useRecordsDepthRead } from '../../useRecordsDepth.d-CAYnVYl1.js';
4
- export { T as TimelineRow, a as TimelineRowKind, b as buildTimelineRows } from '../../timelineRows.d-BST14weg.js';
5
- export { R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, i as RecordLabMarker, j as RecordLabPoint, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight, s as mapDocumentContributions, t as mapRecordDepth, u as mapRecordsTimeline } from '../../depth.d-DlaIV8TV.js';
6
- export { C as ClinicDraft, a as ClinicLocation, R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, d as RecordsUrlKind } from '../../screenProps.d-DNTTp7hU.js';
2
+ export { E as EverfurDocumentContributions, a as EverfurDocumentContributionsProps, b as EverfurRecordDepth, c as EverfurRecordsDepthProps, d as EverfurRecordsTimeline } from '../../DepthViews.d-_WMIpymE.js';
3
+ export { R as RecordsDepthStatus, U as UseRecordsDepthState, u as useEverfurRecordsDepthClient, a as useRecordsDepthRead } from '../../useRecordsDepth.d-BilHZaR4.js';
4
+ export { T as TimelineRow, a as TimelineRowKind, b as buildTimelineRows } from '../../timelineRows.d-B0XZevKx.js';
5
+ export { R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, i as RecordLabMarker, j as RecordLabPoint, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight, s as mapDocumentContributions, t as mapRecordDepth, u as mapRecordsTimeline } from '../../depth.d-B_qNSgXr.js';
6
+ export { C as ClinicDraft, a as ClinicLocation, R as RecordsHostSeams, b as RecordsScreen, c as RecordsScreenBaseProps, d as RecordsUrlKind } from '../../screenProps.d-DpMK2_gi.js';
7
7
  export { R as RecordsAskEntityRef, a as RecordsAskHandler } from '../../recordsAsk.d-C5CGSi3j.js';
8
8
  export { R as RecordsClinic } from '../../clinicModels.d-CaS64-P-.js';
9
9
  export { B as Brand, P as PetRef, R as RecordsRequestId, _ as __brand } from '../../ids.d-B2GAAifq.js';
@@ -14,8 +14,8 @@ export { R as RecordDocumentMeta, a as RecordEntity, b as RecordOrigin } from '.
14
14
  import 'react';
15
15
  import 'react-native';
16
16
  import '../../ErrorPolicyPort.d-68yrE3BE.js';
17
- import '../../requestFunnel.d-BPWf5SQf.js';
18
- import '../../config.d-D_k_rNZZ.js';
19
- import '../../identity.d-BZXPu9Hi.js';
20
- import '../../clinicBatch.d-BhaCdstU.js';
17
+ import '../../requestFunnel.d-DSvCGf4J.js';
18
+ import '../../config.d-KX-EkQ9j.js';
19
+ import '../../identity.d-CRVNfZzQ.js';
20
+ import '../../clinicBatch.d-CcqnQ7-d.js';
21
21
  import '../../clinicRequestProps.d-CjsMg_OD.js';
@@ -103,7 +103,7 @@ return Object.freeze({docId:d.doc_id,title:d.title??null,documentClass:d.documen
103
103
  return Object.freeze({petRef:pet,schemaVersion:schemaVersion,isEmpty:isEmpty,withheld:false,generatedAt:strOrNull(w.generated_at),identity:/* @__PURE__ */Object.freeze(identity),entities:/* @__PURE__ */Object.freeze(entities),entitySeries:/* @__PURE__ */Object.freeze(entitySeries),forwardLooking:/* @__PURE__ */Object.freeze(forwardLooking),documents:/* @__PURE__ */Object.freeze(documents),disclaimer:disclaimer})}function withheldView(petRef,schemaVersion,disclaimer){/* @__PURE__ */
104
104
  return Object.freeze({petRef:petRef,schemaVersion:schemaVersion,isEmpty:false,withheld:true,generatedAt:null,identity:/* @__PURE__ */Object.freeze([]),entities:/* @__PURE__ */Object.freeze([]),entitySeries:/* @__PURE__ */Object.freeze([]),forwardLooking:/* @__PURE__ */Object.freeze([]),documents:/* @__PURE__ */Object.freeze({}),disclaimer:disclaimer})}var consentSchema=/* @__PURE__ */zod.z.object({pet_ref:/* @__PURE__ */zod.z.string().optional(),granted:/* @__PURE__ */zod.z.boolean().optional(),version:/* @__PURE__ */zod.z.string().nullish(),granted_at:/* @__PURE__ */zod.z.string().nullish()});function mapConsent(petRef,wire){let parsed=consentSchema.safeParse(wire),data=parsed.success?parsed.data:{};/* @__PURE__ */
105
105
  return Object.freeze({petRef:typeof data.pet_ref=="string"&&data.pet_ref.length>0?data.pet_ref:petRef,granted:data.granted===true,version:data.version??null,grantedAt:data.granted_at??null})}function numberOr(v,fallback){return typeof v=="number"&&Number.isFinite(v)?v:fallback}function strOr(v,fallback){return typeof v=="string"&&v.length>0?v:fallback}function strOrNull(v){return typeof v=="string"&&v.length>0?v:null}var RECORDS_TERMINAL=/* @__PURE__ */Object.freeze(["published","failed","revoked"]);function isTerminalStatus(status){return RECORDS_TERMINAL.includes(status)}function recordsDenialReasonOf(error){if(error===null)return null;let reason=error.recordsReason;return reason==="consent_required"||reason==="session_required"||reason==="entitlement"||reason==="pet_not_found"?reason:null}var RECORDS_CONSENT_REQUIRED_WIRE_CODE="records_consent_required";function recordsWireCodeOf(error){let raw=error.raw;if(raw===null||typeof raw!="object")return null;let body=raw,code=typeof body.error=="object"&&body.error!==null?body.error.code:body.code;return typeof code=="string"&&code.length>0?code:null}function isRecordsConsentRequired(error){return error===null||error.httpStatus!==409?false:recordsWireCodeOf(error)===RECORDS_CONSENT_REQUIRED_WIRE_CODE}var unavailableUploadTransport=/* @__PURE__ */Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function isUploadTransportAvailable(transport){return transport!==unavailableUploadTransport}var noopRecordsTelemetry=/* @__PURE__ */Object.freeze({record(){}}),MAX_UPLOAD_BYTES=25*1024*1024,CONSENT_VERSION_MAX=64,IDEMPOTENCY_KEY_MAX=128,PET_REF_MAX=128;var UPLOAD_DEADLINE_MS=9e4;function createRecordsController(deps){return new RecordsControllerImpl(deps)}var RecordsControllerImpl=class{constructor(deps){this.recordCache=/* @__PURE__ */new Map;this.consentEpoch=/* @__PURE__ */new Map;this.reportedGaps=/* @__PURE__ */new Set;this.features=RECORDS_FEATURES_PDF_ONLY;this.repository=deps.repository,this.uploads=deps.uploads,this.telemetry=deps.telemetry??noopRecordsTelemetry,this.newIdempotencyKey=deps.newIdempotencyKey??defaultIdempotencyFactory(),this.timers=deps.timers??defaultTimers,this.uploadDeadlineMs=deps.uploadDeadlineMs??UPLOAD_DEADLINE_MS}async createUploadRequest(input){let res=await this.repository.createRequest({pet_ref:input.petRef,idempotency_key:input.idempotencyKey});if(!res.ok)return this.onRequestError(res.error);let view=mapRequestView(res.value);return view===null?err(internal()):(this.observeRequest(view),ok(view))}async getRequest(id){let res=await this.repository.getRequest(id);if(!res.ok)return this.onRequestError(res.error);let view=mapRequestView(res.value);return view===null?err(internal()):(this.observeRequest(view),ok(view))}async listRequests(){let res=await this.repository.listRequests();if(!res.ok)return this.onRequestError(res.error);let views=mapRequestList(res.value);for(let view of views)this.observeRequest(view);return ok(views)}async readFeatures(){let read=this.repository.getFeatures;if(read===void 0)return this.features=RECORDS_FEATURES_PDF_ONLY;let features=RECORDS_FEATURES_PDF_ONLY;try{let res=await read.call(this.repository);res.ok&&(features=mapRecordsFeatures(res.value))}catch{}return this.features=features,features}async uploadDocument(input){let{requestId:requestId2,file:file}=input,rejection=validateFile(file,this.features.uploadContentTypes);if(rejection!==null)return this.telemetry.record("records.upload.rejected",{reason:rejection}),err(uploadFailed(`upload rejected: ${rejection}`));let initiated=await this.repository.initiateUpload(requestId2,{content_type:file.mimeType,file_size:file.sizeBytes});if(!initiated.ok)return this.onRequestError(initiated.error);let s3=await this.postToS3(initiated.value,file,input);if(!s3.ok)return this.telemetry.record("records.upload.failed",{reason:s3.reason}),err(uploadFailed(s3.reason));let completed=await this.repository.completeUpload(requestId2,{upload_id:initiated.value.upload_id});if(!completed.ok)return completed.error.code==="mediaUploadFailed"&&this.telemetry.record("records.upload.rejected",{reason:reasonFromWire(completed.error)??"corrupt"}),this.onRequestError(completed.error);let doc=mapUploadedDocument(completed.value);return doc===null?err(internal()):ok(doc)}async postToS3(policy,file,input){let deadline=new AbortController,signal=mergeSignals(deadline.signal,input.signal),handle=this.timers.setTimeout(()=>deadline.abort(),this.uploadDeadlineMs);try{let opts={signal:signal};return input.onProgress&&(opts.onProgress=input.onProgress),await this.uploads.postMultipart(policy,file,opts),{ok:!0}}catch{return{ok:false,reason:deadline.signal.aborted&&input.signal?.aborted!==true?"timeout":"upload_error"}}finally{this.timers.clearTimeout(handle)}}async getRecord(pet){let epoch=this.consentEpoch.get(pet)??0,res=await this.repository.getRecord(pet);if(epoch!==(this.consentEpoch.get(pet)??0))return err(/* @__PURE__ */Object.freeze({...makeEverfurError("accessDenied",{retryable:false}),recordsReason:"consent_required"}));if(!res.ok){let reason=recordsDenialReasonOf(res.error);return reason==="consent_required"?(this.recordCache.delete(pet),this.telemetry.record("records.consent.denied",{pet_ref:pet})):reason==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:pet}),err(res.error)}let view=mapRecordView(pet,res.value);return view.petRef!==pet?err(internal()):view.withheld?(this.telemetry.record("records.redaction.withheld",{pet_ref:pet}),this.recordCache.delete(pet),ok(view)):(this.recordCache.set(pet,view),ok(view))}peekCachedRecord(pet){return this.recordCache.get(pet)??null}async getConsent(pet){let res=await this.repository.getConsent(pet);return res.ok?ok(mapConsent(pet,res.value)):err(res.error)}async grantConsent(input){let res=await this.repository.putConsent(input.petRef,{consent_version:input.consentVersion,idempotency_key:input.idempotencyKey});return res.ok?ok(mapConsent(input.petRef,res.value)):(recordsDenialReasonOf(res.error)==="entitlement"&&this.telemetry.record("records.capability.denied",{pet_ref:input.petRef}),err(res.error))}async revokeConsent(pet){let res=await this.repository.deleteConsent(pet);return res.ok?(this.consentEpoch.set(pet,(this.consentEpoch.get(pet)??0)+1),this.recordCache.delete(pet),ok(mapConsent(pet,res.value))):err(res.error)}reportCapabilityDenied(pet){this.telemetry.record("records.capability.denied",pet?{pet_ref:pet}:{})}observeRequest(view){view.reviewStartedAt!==null&&!this.reportedGaps.has(view.id)&&(this.reportedGaps.add(view.id),this.telemetry.record("records.parse.gap",{request_id:view.id}))}onRequestError(error){return recordsDenialReasonOf(error)==="entitlement"&&this.telemetry.record("records.capability.denied",{}),err(error)}};function validateFile(file,types){if(!isAcceptedUploadType(file.mimeType,types))return"unsupported_format";let size=file.sizeBytes;return typeof size!="number"||!Number.isFinite(size)||size<=0||size>MAX_UPLOAD_BYTES?"oversize":null}function reasonFromWire(error){let raw=error.wireMessage;return raw==="unsupported_format"||raw==="oversize"||raw==="corrupt"?raw:null}function uploadFailed(wireMessage){return makeEverfurError("mediaUploadFailed",{retryable:false,wireMessage:wireMessage})}function internal(){return makeEverfurError("internalError",{retryable:true})}var defaultTimers={setTimeout:(handler,ms2)=>setTimeout(handler,ms2),clearTimeout:handle=>clearTimeout(handle)};function mergeSignals(a,b){if(!b)return a;let ctrl=new AbortController;if(a.aborted||b.aborted)return ctrl.abort(),ctrl.signal;let onAbort=()=>ctrl.abort();return a.addEventListener("abort",onAbort,{once:true}),b.addEventListener("abort",onAbort,{once:true}),ctrl.signal}function defaultIdempotencyFactory(){let counter=0;return()=>`records-${Date.now().toString(36)}-${(counter++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
106
- 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}var SDK_VERSION="0.18.2";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,ms2)=>setTimeout(handler,ms2),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??((ms2,signal)=>delayAbortable(ms2,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 stamp2=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp2({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals2(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(stamp2({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(stamp2({phase:"settled",...settledEvent})),err(error);if(emit(stamp2({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp2({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
+ 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}var SDK_VERSION="0.18.3";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,ms2)=>setTimeout(handler,ms2),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??((ms2,signal)=>delayAbortable(ms2,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 stamp2=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp2({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals2(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(stamp2({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(stamp2({phase:"settled",...settledEvent})),err(error);if(emit(stamp2({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp2({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(
107
107
  /* @__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__ */
108
108
  return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord2(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord2(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord2(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms2,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms2);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals2(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms2,timers,signal){return ms2<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms2),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}function hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}function serverLength(value){return[...value].length}function isNotFoundError(error){return error!=null&&(error.httpStatus===404||error.category==="notFound")}function plainNotFound(error){return error.code!=="conversationNotFound"?error:makeEverfurError("resourceNotFound",{retryable:false,...error.httpStatus===void 0?{}:{httpStatus:error.httpStatus},...error.requestId===void 0?{}:{requestId:error.requestId},...error.reasonCode===void 0?{}:{reasonCode:error.reasonCode},...error.wireMessage===void 0?{}:{wireMessage:error.wireMessage},...error.raw===void 0?{}:{raw:error.raw}})}function plainResult(res){return res.ok?res:err(plainNotFound(res.error))}function withPlainNotFound(funnel){return{send:async(...args)=>plainResult(await funnel.send(...args)),authorize:req=>funnel.authorize(req),stream:(call,req,signal)=>funnel.stream(call,req,signal)}}var BASE="/widget/v1/records";function createHttpRecordsRepository(deps){let{auth:auth}=deps,mode=auth.mode,funnel=deps.funnel??createRequestFunnel({auth:auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),send=async(call,req,kind)=>{let res=await funnel.send(call,req);return res.ok?res:err(tagReason(plainNotFound(res.error),mode,kind))},segmentError=(field,value)=>typeof value!="string"||value.length===0?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${field} is required and must be a non-empty string`}):hasLoneSurrogate(value)?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${field} contains an unpaired surrogate and cannot be encoded`}):null,boundsError=(field,value,max)=>{let unusable=segmentError(field,value);if(unusable!==null)return unusable;let length=[...value].length;return length>max?makeEverfurError("validationFailed",{retryable:false,wireMessage:`${field} is ${length} characters; the server accepts at most ${max}`}):null},firstError=(...checks)=>checks.find(c=>c!==null)??null;return{createRequest:body=>{let invalid5=firstError(boundsError("idempotency_key",body.idempotency_key,IDEMPOTENCY_KEY_MAX),boundsError("pet_ref",body.pet_ref,PET_REF_MAX));return invalid5?Promise.resolve(err(invalid5)):send("records.createRequest",post(`${BASE}/requests`,body),"request")},initiateUpload:(requestId2,body)=>{let invalid5=segmentError("request_id",requestId2);return invalid5?Promise.resolve(err(invalid5)):send("records.initiateUpload",post(`${BASE}/requests/${encodeURIComponent(requestId2)}/uploads/initiate`,body),"request")},completeUpload:(requestId2,body)=>{let invalid5=segmentError("request_id",requestId2);return invalid5?Promise.resolve(err(invalid5)):send("records.completeUpload",post(`${BASE}/requests/${encodeURIComponent(requestId2)}/uploads/complete`,body),"request")},getRequest:requestId2=>{let invalid5=segmentError("request_id",requestId2);return invalid5?Promise.resolve(err(invalid5)):send("records.getRequest",get(`${BASE}/requests/${encodeURIComponent(requestId2)}`),"request")},listRequests:async()=>{let res=await send("records.listRequests",get(`${BASE}/requests`),"request");if(!res.ok)return res;let value=res.value;return{ok:true,value:Array.isArray(value)?value:value.items??[]}},getRecord:petRef=>{let invalid5=boundsError("pet_ref",petRef,PET_REF_MAX);return invalid5?Promise.resolve(err(invalid5)):send("records.getRecord",get(`${BASE}/pets/${encodeURIComponent(petRef)}/record`),"content")},getConsent:petRef=>{let invalid5=boundsError("pet_ref",petRef,PET_REF_MAX);return invalid5?Promise.resolve(err(invalid5)):send("records.getConsent",get(`${BASE}/pets/${encodeURIComponent(petRef)}/consent`),"consent")},putConsent:(petRef,body)=>{let invalid5=firstError(boundsError("consent_version",body.consent_version,CONSENT_VERSION_MAX),boundsError("idempotency_key",body.idempotency_key,IDEMPOTENCY_KEY_MAX),boundsError("pet_ref",petRef,PET_REF_MAX));return invalid5?Promise.resolve(err(invalid5)):send("records.putConsent",put(`${BASE}/pets/${encodeURIComponent(petRef)}/consent`,body),"consent")},getFeatures:()=>send("records.getFeatures",get(`${BASE}/features`),"request"),deleteConsent:petRef=>{let invalid5=boundsError("pet_ref",petRef,PET_REF_MAX);return invalid5?Promise.resolve(err(invalid5)):send("records.deleteConsent",del(`${BASE}/pets/${encodeURIComponent(petRef)}/consent`),"consent")}}}function withReason(error,reason){let tagged={...error,recordsReason:reason};for(let key of["wireMessage","raw"]){let descriptor=Object.getOwnPropertyDescriptor(error,key);descriptor!==void 0&&Object.defineProperty(tagged,key,descriptor)}/* @__PURE__ */
109
109
  return Object.freeze(tagged)}var PET_NOT_REGISTERED="pet_not_registered";function recordsErrorReasonFor(error){return error.httpStatus!==404?null:error.reasonCode===PET_NOT_REGISTERED?"pet_not_found":"entitlement"}function tagReason(error,mode,kind){let notFound=recordsErrorReasonFor(error);return notFound!==null?withReason(error,notFound):error.code!=="accessDenied"?error:withReason(error,mode==="anonymous"?"session_required":kind==="content"?"consent_required":"entitlement")}function get(path){return{method:"GET",path:path}}function post(path,body){return{method:"POST",path:path,body:body}}function put(path,body){return{method:"PUT",path:path,body:body}}function del(path){return{method:"DELETE",path:path}}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=react.createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=react.useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var epochs=/* @__PURE__ */new Map,listeners=/* @__PURE__ */new Set;function notifyRecordsConsentWithdrawn(petRef){epochs.set(petRef,(epochs.get(petRef)??0)+1);for(let listener of[...listeners])listener()}function recordsConsentEpochOf(petRef){return epochs.get(petRef)??0}function subscribe(onStoreChange){return listeners.add(onStoreChange),()=>{listeners.delete(onStoreChange)}}function useRecordsConsentEpoch(petRef){let snapshot=react.useCallback(()=>recordsConsentEpochOf(petRef),[petRef]);return react.useSyncExternalStore(subscribe,snapshot,snapshot)}var INITIAL={record:null,requests:[],consent:null,error:null,denialReason:null,withheld:false,loading:true,isUploading:false,uploadProgress:null,uploadQueue:[],uploadContentTypes:RECORDS_FEATURES_PDF_ONLY.uploadContentTypes},POLL_INTERVAL_MS=4e3,MAX_POLLS=30;function useEverfurRecords(opts){let{petRef:petRef}=opts,ownTransport=react.useRef(opts.uploadTransport);ownTransport.current=opts.uploadTransport;let hasOwnTransport=opts.uploadTransport!==void 0,{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),scope=react.useMemo(()=>({}),[runtime,userRef,petRef,scopeEpoch,opts.controller]),activeScope=react.useRef(scope),[binding,setBinding]=react.useState({scope:scope,controller:opts.controller??null}),controller=opts.controller??(binding.scope===scope?binding.controller:null),[snapshot,setSnapshot]=react.useState({scope:scope,value:INITIAL}),snap=snapshot.scope===scope?snapshot.value:INITIAL,setSnap=react.useCallback(update=>{setSnapshot(current=>current.scope===scope?{scope:scope,value:update(current.value)}:current)},[scope]),generation=react.useRef(0);react.useEffect(()=>(activeScope.current=scope,setSnapshot({scope:scope,value:INITIAL}),()=>{activeScope.current=null,generation.current+=1}),[scope]),react.useEffect(()=>{if(opts.controller)return;let{services:services}=runtime.registry,telemetry={record:(event,props)=>services.telemetry.track(event,props)},acquired=runtime.registry.acquire("records",`${userRef??""}|${petRef}${hasOwnTransport?"|own-upload":""}`,()=>createRecordsController({repository:createHttpRecordsRepository({auth:services.authFor(userRef),...services.errorPolicy?{errorPolicy:services.errorPolicy}:{}}),uploads:hasOwnTransport?{postMultipart:(policy,file,o)=>(ownTransport.current??services.uploadTransport).postMultipart(policy,file,o)}:services.uploadTransport,telemetry:telemetry}),()=>{});return setBinding({scope:scope,controller:acquired}),()=>{runtime.registry.release(acquired)}},[runtime,userRef,petRef,opts.controller,scopeEpoch,scope,hasOwnTransport]);let patch=react.useCallback(partial=>{setSnap(current=>({...current,...partial}))},[setSnap]),load=react.useCallback(async()=>{if(!controller||activeScope.current!==scope)return;let gen=generation.current+=1;pollsRef.current=0,rearmPolls(),patch({loading:true,error:null,denialReason:null,withheld:false});let[consentRes,listRes]=await Promise.all([controller.getConsent(petRef),controller.listRequests()]);if(gen!==generation.current)return;let consent=consentRes.ok?consentRes.value:null,requests=listRes.ok?listRes.value.filter(request=>request.petRef===petRef):[],listError=listRes.ok?null:listRes.error;if(consent&&consent.granted){let recordRes=await controller.getRecord(petRef);if(gen!==generation.current)return;if(recordRes.ok){patch({consent:consent,requests:requests,record:recordRes.value,withheld:recordRes.value.withheld,error:recordRes.value.withheld?withheldSentinel():listError,denialReason:null,loading:false});return}patch({consent:consent,requests:requests,record:null,error:recordRes.error,denialReason:recordsDenialReasonOf(recordRes.error),withheld:false,loading:false});return}patch({consent:consent,requests:requests,record:null,error:consentRes.ok?listError:consentRes.error,denialReason:consent?"consent_required":consentDenial(consentRes),withheld:false,loading:false})},[controller,petRef,patch,scope]);react.useEffect(()=>(load(),()=>{generation.current+=1}),[load]);let readUploadFeatures=opts.readUploadFeatures===true;react.useEffect(()=>{if(!readUploadFeatures||!controller?.readFeatures)return;let live=true;return controller.readFeatures().then(features=>{live&&activeScope.current===scope&&patch({uploadContentTypes:features.uploadContentTypes})}),()=>{live=false}},[controller,readUploadFeatures,patch,scope]);let activeRequest=react.useMemo(()=>newestRequest(snap.requests),[snap.requests]),activeId=activeRequest?.id??null,activeStatus=activeRequest?.status??null,pollsRef=react.useRef(0),polledIdRef=react.useRef(null),[pollEpoch,rearmPolls]=react.useReducer(n2=>n2+1,0);react.useEffect(()=>{if(!controller||activeId===null||activeStatus===null||isTerminalStatus(activeStatus)||activeStatus==="in_review")return;polledIdRef.current!==String(activeId)&&(polledIdRef.current=String(activeId),pollsRef.current=0);let cancelled=false,tick=async()=>{if(cancelled||pollsRef.current>=MAX_POLLS)return;pollsRef.current+=1;let res=await controller.getRequest(activeId);if(!cancelled){if(res.ok&&res.value.petRef===petRef){if(setSnap(current=>({...current,requests:replaceRequest(current.requests,res.value)})),isTerminalStatus(res.value.status)){res.value.status==="published"&&load();return}if(res.value.status==="in_review")return}handle=setTimeout(()=>{tick()},POLL_INTERVAL_MS)}},handle=setTimeout(()=>{tick()},POLL_INTERVAL_MS);return()=>{cancelled=true,clearTimeout(handle)}},[controller,activeId,activeStatus,load,pollEpoch,petRef,setSnap]);let createRequest=react.useCallback(async idempotencyKey=>{if(!controller||activeScope.current!==scope)return notReady();let res=await controller.createUploadRequest({petRef:petRef,idempotencyKey:idempotencyKey});return activeScope.current===scope&&res.ok&&res.value.petRef===petRef&&setSnap(c=>({...c,requests:replaceRequest(c.requests,res.value)})),res},[controller,petRef,scope,setSnap]),patchItem=react.useCallback((key,update)=>{setSnap(c=>({...c,uploadQueue:c.uploadQueue.map(item=>item.key===key?update(item):item)}))},[setSnap]),uploadDocuments=react.useCallback(async(requestId2,files)=>{let batch=Date.now().toString(36),queue=files.map((file,index)=>{let skipReason=skipReasonFor(file,snap.uploadContentTypes);return{key:`${batch}-${index}`,name:file.name??null,status:skipReason===null?"queued":"skipped",progress:0,skipReason:skipReason,error:null}}),settled=[...queue];if(!controller||activeScope.current!==scope)/* @__PURE__ */return Object.freeze(settled);setSnap(c=>({...c,uploadQueue:queue,isUploading:true,uploadProgress:0}));for(let[index,file]of files.entries()){let item=queue[index];if(item.status==="skipped")continue;if(activeScope.current!==scope)break;patchItem(item.key,current=>({...current,status:"uploading",progress:0})),patch({uploadProgress:0});let res=await controller.uploadDocument({requestId:requestId2,file:file,onProgress:fraction=>{if(activeScope.current!==scope)return;let bounded=Math.min(1,Math.max(0,fraction));patchItem(item.key,current=>({...current,progress:Math.max(current.progress,bounded)})),patch({uploadProgress:bounded})}});if(activeScope.current!==scope)break;let next=res.ok?{...item,status:"done",progress:1}:{...item,status:"failed",error:res.error};if(settled[index]=next,patchItem(item.key,()=>next),res.ok){let refreshed=await controller.getRequest(requestId2);activeScope.current===scope&&refreshed.ok&&refreshed.value.petRef===petRef&&setSnap(c=>({...c,requests:replaceRequest(c.requests,refreshed.value)}))}}return activeScope.current===scope&&patch({isUploading:false,uploadProgress:null}),/* @__PURE__ */Object.freeze(settled)},[controller,patch,patchItem,petRef,scope,setSnap,snap.uploadContentTypes]),uploadDocument=react.useCallback(async(requestId2,file)=>{if(!controller||activeScope.current!==scope)return notReady();let key=`${Date.now().toString(36)}-0`;setSnap(c=>({...c,isUploading:true,uploadProgress:0,uploadQueue:[{key:key,name:file.name??null,status:"uploading",progress:0,skipReason:null,error:null}]}));let res=await controller.uploadDocument({requestId:requestId2,file:file,onProgress:fraction=>{activeScope.current===scope&&(patch({uploadProgress:fraction}),patchItem(key,current=>({...current,progress:Math.max(current.progress,Math.min(1,fraction))})))}});if(activeScope.current!==scope)return res;if(patch({isUploading:false,uploadProgress:null}),patchItem(key,current=>res.ok?{...current,status:"done",progress:1}:{...current,status:"failed",error:res.error}),res.ok){let refreshed=await controller.getRequest(requestId2);activeScope.current===scope&&refreshed.ok&&refreshed.value.petRef===petRef&&setSnap(c=>({...c,requests:replaceRequest(c.requests,refreshed.value)}))}return res},[controller,patch,patchItem,petRef,scope,setSnap]),grantConsent=react.useCallback(async(consentVersion,idempotencyKey)=>{if(!controller||activeScope.current!==scope)return notReady();let res=await controller.grantConsent({petRef:petRef,consentVersion:consentVersion,idempotencyKey:idempotencyKey});return res.ok&&activeScope.current===scope&&load(),res},[controller,petRef,load,scope]),revokeConsent=react.useCallback(async()=>{if(!controller||activeScope.current!==scope)return notReady();let res=await controller.revokeConsent(petRef);return res.ok&&notifyRecordsConsentWithdrawn(petRef),res.ok&&activeScope.current===scope&&(generation.current+=1,patch({record:null,withheld:false,loading:false,denialReason:"consent_required",consent:res.value})),res},[controller,petRef,patch,scope]),refresh=react.useCallback(()=>load(),[load]),status=selectStatus(snap,controller!==null);return react.useMemo(()=>({status:status,record:snap.record,requests:snap.requests,activeRequest:activeRequest,consent:snap.consent,error:snap.error,denialReason:snap.denialReason,withheld:snap.withheld,isUploading:snap.isUploading,uploadProgress:snap.uploadProgress,uploadQueue:snap.uploadQueue,uploadContentTypes:snap.uploadContentTypes,createRequest:createRequest,uploadDocument:uploadDocument,uploadDocuments:uploadDocuments,grantConsent:grantConsent,revokeConsent:revokeConsent,refresh:refresh}),[status,snap,activeRequest,createRequest,uploadDocument,uploadDocuments,grantConsent,revokeConsent,refresh])}function skipReasonFor(file,types){if(!isAcceptedUploadType(file.mimeType,types))return"unsupported";let size=file.sizeBytes;return typeof size!="number"||!Number.isFinite(size)||size<=0||size>MAX_UPLOAD_BYTES?"too_large":null}function classifyPick(files,types){let uploadable=[],skipped=[];for(let file of files){let reason=skipReasonFor(file,types);reason===null?uploadable.push(file):skipped.push({name:file.name??null,reason:reason})}return{uploadable:uploadable,skipped:skipped}}function selectStatus(snap,hasController){return snap.loading||!hasController?"loading":snap.withheld||snap.denialReason!==null||snap.error!==null?"error":snap.record!==null&&!snap.record.isEmpty||snap.requests.length>0?"populated":"empty"}function newestRequest(requests){if(requests.length===0)return null;let newest=requests[0];for(let r of requests)r.updatedAt>newest.updatedAt&&(newest=r);return newest}function replaceRequest(requests,next){let filtered=requests.filter(r=>r.id!==next.id);return[next,...filtered]}function consentDenial(res){return res.ok?"consent_required":recordsDenialReasonOf(res.error)??"consent_required"}function withheldSentinel(){return makeEverfurError("internalError",{retryable:false})}function notReady(){return{ok:false,error:makeEverfurError("internalError",{retryable:true})}}function definedProps(props){let out={};if(props==null)return out;for(let key of Object.keys(props))props[key]!==void 0&&(out[key]=props[key]);return out}function reportHostFailure(error){let globalConsole=globalThis.console;try{globalConsole?.error?.("[everfur] A host callback threw; the SDK ignored it.",error)}catch{}}function isThenable(value){return(typeof value=="object"||typeof value=="function")&&value!==null&&typeof value.then=="function"}function callHost(fn,...args){if(typeof fn=="function")try{let result=fn(...args);return isThenable(result)&&Promise.resolve(result).then(void 0,reportHostFailure),result}catch(error){reportHostFailure(error);return}}var GUARDED=/* @__PURE__ */new WeakMap;function guardHost(fn){if(typeof fn!="function")return;let cached=GUARDED.get(fn);if(cached!==void 0)return cached;let guarded=(...args)=>{callHost(fn,...args)};return GUARDED.set(fn,guarded),guarded}function guardHostProps(props,names){let guarded=null;for(let name of names){let fn=props[name];typeof fn=="function"&&(guarded??={...props},guarded[name]=guardHost(fn))}return guarded??props}function callHostAsync(fn,...args){let started;try{started=fn(...args)}catch(error){return reportHostFailure(error),Promise.resolve({ok:false,error:error})}return Promise.resolve(started).then(value=>({ok:true,value:value}),error=>({ok:false,error:error}))}var RECORDS_DASHBOARD=/* @__PURE__ */Object.freeze({name:"dashboard"});function initialRecordsNav(initial=RECORDS_DASHBOARD){/* @__PURE__ */
@@ -9,8 +9,8 @@ import { R as RecordsClinicController, C as CaptureRecordsSignature, a as Clinic
9
9
  export { b as CapturedRecordsSignature, c as RecordsSignatureContext } from '../clinicRequestProps.d-1dCtouGA.cjs';
10
10
  import { U as UploadTransport } from '../ports.d-BX4f4UsB.cjs';
11
11
  export { F as FileHandle, a as UploadPolicyWire } from '../ports.d-BX4f4UsB.cjs';
12
- import { c as RecordsScreenBaseProps, R as RecordsHostSeams, b as RecordsScreen, C as ClinicDraft, e as ClinicBatchBaseProps } from '../screenProps.d-Byla6nJL.cjs';
13
- export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../screenProps.d-Byla6nJL.cjs';
12
+ import { c as RecordsScreenBaseProps, R as RecordsHostSeams, b as RecordsScreen, C as ClinicDraft, e as ClinicBatchBaseProps } from '../screenProps.d-BW6PZh5k.cjs';
13
+ export { a as ClinicLocation, f as RecordsNavAction, g as RecordsNavState, d as RecordsUrlKind, h as RegisterSignaturePng, i as currentRecordsScreen, j as initialRecordsNav, p as popRecordsNav, k as pushRecordsNav, r as recordsNavReducer, l as replaceRecordsNav, m as resetRecordsNav, t as transitionRecordsNav } from '../screenProps.d-BW6PZh5k.cjs';
14
14
  import { R as RecordsDocumentPicker } from '../uploadTransport.d-CWL7CdWP.cjs';
15
15
  import { i as EverfurPresentationInput } from '../presentation.d-Bs8xQ4gD.cjs';
16
16
  export { E as EverfurChatAnswerStyle, a as EverfurChatComposerPlaceholder, b as EverfurChatComposerStyle, c as EverfurChatHistoryBarSetting, d as EverfurChatHistoryStyle, e as EverfurChatSendButtonSetting, f as EverfurChatTopCardSetting, g as EverfurHealthPlanLayout, h as EverfurPresentation, j as EverfurSafetyDisclaimerPlacement } from '../presentation.d-Bs8xQ4gD.cjs';
@@ -20,19 +20,19 @@ import { R as RecordsSheetPronoun } from '../sheetCopy.d-CAhLOxjc.cjs';
20
20
  import { m as EverfurTheme } from '../tokens.d-BUVqme2D.cjs';
21
21
  import { a as RecordsAskHandler } from '../recordsAsk.d-C5CGSi3j.cjs';
22
22
  export { b as RecordsAsk, R as RecordsAskEntityRef } from '../recordsAsk.d-C5CGSi3j.cjs';
23
- export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../view.d-eM315KIZ.cjs';
24
- export { R as RecordsDepthStatus } from '../useRecordsDepth.d-DZfdRdIU.cjs';
25
- export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../depth.d-CsKZkLNi.cjs';
23
+ export { C as ClinicCall, F as FactOverlay, R as REQUEST_TIMELINE_TITLES, a as RecordSharesStatus, b as RecordsDashboardState, c as RecordsDashboardView, d as RecordsEmptyVariant, e as RequestTimelineEvent, f as RequestTimelineEventKey, g as RequestTimelineEventState, S as ShareRowView, U as UseRecordFactEditState, h as UseRecordPdfLinkState, i as UseRecordSharesState, j as UseRecordsMarkersState, k as applyFactOverlay, l as buildRequestTimeline, m as deriveRecordsDashboardState, n as isFactEditable, p as pickPetRecordsRequest, s as selectClinicCall, o as selectDashboardView, q as selectPrimaryLabel, r as selectRequestList, t as selectRequestTitle, u as useEverfurRecordsClinic, v as useEverfurRecordsClinicBatch, w as useRecordFactEdit, x as useRecordPdfLink, y as useRecordShares, z as useRecordsMarkers } from '../view.d-BTnjZu2S.cjs';
24
+ export { R as RecordsDepthStatus } from '../useRecordsDepth.d-WW_2cWwU.cjs';
25
+ export { w as FactFieldValue, R as RecordClinicianNote, a as RecordClinicianNoteSection, b as RecordCompleteness, c as RecordConflict, d as RecordConflictCandidate, e as RecordDepthView, f as RecordDocumentContributionsView, g as RecordEncounter, h as RecordExamSystem, y as RecordFactEditInput, z as RecordFactRemoveInput, i as RecordLabMarker, j as RecordLabPoint, A as RecordMarker, B as RecordMarkerLatest, C as RecordMarkerPoint, D as RecordMarkerSummary, E as RecordMarkersView, k as RecordPhysicalExam, l as RecordsDepthClient, m as RecordsRequestDocument, G as RecordsSignatureSuggestion, n as RecordsTimelineMedication, o as RecordsTimelineVaccine, p as RecordsTimelineView, q as RecordsTimelineVisit, r as RecordsTimelineWeight } from '../depth.d-qVYPByPb.cjs';
26
26
  export { g as RecordPdfLink, f as RecordShare, R as RecordShareAudience, i as RecordShareAudienceScope, d as RecordShareEmailInput, e as RecordShareEmailReceipt, c as RecordShareLink, j as RecordShareRecipientKind, a as RecordsFeatures, q as RecordsPhotoContentType, b as RecordsUploadContentType, s as acceptsPhotos } from '../features.d-DrQxTw3-.cjs';
27
- export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../DepthViews.d-BiS-GTEf.cjs';
28
- export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../clinicBatch.d-BN1jfVGo.cjs';
27
+ export { a as EverfurDocumentContributionsProps, c as EverfurRecordsDepthProps } from '../DepthViews.d-BiePRa3Z.cjs';
28
+ export { C as CreateClinicRequestBatchInput, b as RECORDS_CLINIC_BATCH_MAX, R as RecordsClinicBatch, a as RecordsClinicBatchClient, c as RecordsClinicBatchItem, d as RecordsClinicBatchResult } from '../clinicBatch.d-DVahpaN3.cjs';
29
29
  export { C as CreateClinicRequestInput, f as RecordsAuthorizationCopy, b as RecordsAuthorizationSignature, R as RecordsClinic, c as RecordsClinicSearchInput, d as RecordsClinicSearchPage, a as RecordsClinicTarget, e as RecordsRecentClinicsInput, g as RecordsSignatureUploadPolicy } from '../clinicModels.d-BXgKZqDb.cjs';
30
30
  export { E as EverfurError, a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError.d-8NHtlgzA.cjs';
31
31
  export { E as EverfurResult } from '../EverfurResult.d-BFH-3s6E.cjs';
32
32
  import '../ErrorPolicyPort.d-DirW9hgO.cjs';
33
- import '../requestFunnel.d-DocT7FXR.cjs';
34
- import '../config.d-BFTqU7ft.cjs';
35
- import '../identity.d-BmbAwQYx.cjs';
33
+ import '../requestFunnel.d-CQX_Z1Hi.cjs';
34
+ import '../config.d-Z_fyOZke.cjs';
35
+ import '../identity.d-3ROlHbnP.cjs';
36
36
 
37
37
  /** Your own art for the pet on grass, in place of ours: the grass the pet stands on and your drawing of this pet. */
38
38
  interface RecordsSheetStage {