@everfur/sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/CHANGELOG.md +69 -4
  2. package/README.md +6 -1
  3. package/dist/{Chat-DwAC2vhB.d.ts → Chat-BZZ-Py5l.d.ts} +3 -3
  4. package/dist/{Chat-DPUD6dnc.d.cts → Chat-Dq4fffIO.d.cts} +3 -3
  5. package/dist/{DepthViews-DNEM96Se.d.ts → DepthViews-BG3E25MD.d.ts} +1 -1
  6. package/dist/{DepthViews-DP0R-DhB.d.cts → DepthViews-B_hIypI6.d.cts} +1 -1
  7. package/dist/{DepthViews-DbFhR4Du.d.cts → DepthViews-CL75jyRA.d.cts} +1 -1
  8. package/dist/{DepthViews-D_3hl4xk.d.ts → DepthViews-CkYri51q.d.ts} +1 -1
  9. package/dist/animations/index.cjs +1 -1
  10. package/dist/animations/index.d.cts +3 -3
  11. package/dist/animations/index.d.ts +3 -3
  12. package/dist/animations/index.js +1 -1
  13. package/dist/{attachments-CQgFrEQ7.d.cts → attachments-BorG422I.d.cts} +2 -2
  14. package/dist/{attachments-5NeobOCd.d.ts → attachments-BrUWQYNK.d.ts} +5 -4
  15. package/dist/{attachments-D8T5re7e.d.cts → attachments-D_SECjr1.d.cts} +5 -4
  16. package/dist/{attachments-Bw3iMQgu.d.ts → attachments-DpldrvIW.d.ts} +2 -2
  17. package/dist/bookingCopy-CqtDYvCR.d.ts +732 -0
  18. package/dist/bookingCopy-SREvkG19.d.cts +732 -0
  19. package/dist/{entitlementRepository-DSbzuyAW.d.ts → branding-CsRdeNwK.d.cts} +1 -133
  20. package/dist/{entitlementRepository-DKdXFgTo.d.cts → branding-CsRdeNwK.d.ts} +1 -133
  21. package/dist/callCopy-DoQKG3-L.d.cts +40 -0
  22. package/dist/callCopy-DoQKG3-L.d.ts +40 -0
  23. package/dist/casesRepository-DwtZVsbj.d.cts +51 -0
  24. package/dist/casesRepository-v6QczS9N.d.ts +51 -0
  25. package/dist/chat/index.cjs +1 -1
  26. package/dist/chat/index.d.cts +9 -8
  27. package/dist/chat/index.d.ts +9 -8
  28. package/dist/chat/index.js +1 -1
  29. package/dist/client/index.cjs +5 -5
  30. package/dist/client/index.d.cts +10 -8
  31. package/dist/client/index.d.ts +10 -8
  32. package/dist/client/index.js +5 -5
  33. package/dist/{config-CzTZGlfF.d.cts → config--Wu1Umhd.d.cts} +2 -2
  34. package/dist/{config-DW60uRb9.d.ts → config-C7eb_IMD.d.ts} +2 -2
  35. package/dist/consent/index.cjs +1 -1
  36. package/dist/consent/index.d.cts +5 -5
  37. package/dist/consent/index.d.ts +5 -5
  38. package/dist/consent/index.js +1 -1
  39. package/dist/{context-XvTzq1tE.d.cts → context-CL3lyuy1.d.cts} +6 -6
  40. package/dist/{context-DXhqHlPU.d.ts → context-CahAEha8.d.ts} +6 -6
  41. package/dist/{copy-Mjoo91aS.d.ts → copy-DdVFDL01.d.ts} +2 -2
  42. package/dist/{copy-bKDNigLb.d.cts → copy-UeUJVk8X.d.cts} +2 -2
  43. package/dist/core/index.cjs +7 -7
  44. package/dist/core/index.d.cts +118 -29
  45. package/dist/core/index.d.ts +118 -29
  46. package/dist/core/index.js +7 -7
  47. package/dist/{depth-CErXCU8J.d.cts → depth-D5HwcvKC.d.cts} +34 -3
  48. package/dist/{depth-DjDcJ6kH.d.ts → depth-DvPwPuT_.d.ts} +34 -3
  49. package/dist/entitlementRepository-B7egEdW6.d.ts +43 -0
  50. package/dist/entitlementRepository-BpJ7tiwl.d.cts +43 -0
  51. package/dist/{identity-DI4eVx9S.d.cts → identity-C2-08BZW.d.cts} +2 -2
  52. package/dist/{identity-BMx2SUOM.d.ts → identity-CEi9GRFZ.d.ts} +2 -2
  53. package/dist/index.cjs +6 -6
  54. package/dist/index.d.cts +17 -16
  55. package/dist/index.d.ts +17 -16
  56. package/dist/index.js +6 -6
  57. package/dist/notifications/index.cjs +2 -2
  58. package/dist/notifications/index.d.cts +2 -2
  59. package/dist/notifications/index.d.ts +2 -2
  60. package/dist/notifications/index.js +2 -2
  61. package/dist/optionalModule-DbJmsq5f.d.cts +21 -0
  62. package/dist/optionalModule-DbJmsq5f.d.ts +21 -0
  63. package/dist/{pets-CtQdRpWo.d.ts → pets-DJv2sj2H.d.ts} +1 -1
  64. package/dist/{pets-aB8q0JyX.d.cts → pets-JVCXgRgR.d.cts} +1 -1
  65. package/dist/{casesRepository-DHwtGRYY.d.cts → petsRepository-B_gKbAzJ.d.cts} +2 -48
  66. package/dist/{casesRepository-ClLv6qMl.d.ts → petsRepository-Bk6GDwLs.d.ts} +2 -48
  67. package/dist/photo/index.cjs +1 -1
  68. package/dist/photo/index.js +1 -1
  69. package/dist/{ports-DEBzEhbp.d.cts → ports-BY2ph0_y.d.cts} +5 -15
  70. package/dist/{ports-DMolTRzU.d.ts → ports-D7YW8qz9.d.ts} +5 -15
  71. package/dist/records/depth/index.cjs +2 -2
  72. package/dist/records/depth/index.d.cts +7 -7
  73. package/dist/records/depth/index.d.ts +7 -7
  74. package/dist/records/depth/index.js +2 -2
  75. package/dist/records/index.cjs +3 -3
  76. package/dist/records/index.d.cts +9 -9
  77. package/dist/records/index.d.ts +9 -9
  78. package/dist/records/index.js +3 -3
  79. package/dist/{requestFunnel-L-BQfi0z.d.cts → requestFunnel-BjDpqqvm.d.cts} +25 -2
  80. package/dist/{requestFunnel-CjW7uDuA.d.ts → requestFunnel-DFMGcluw.d.ts} +25 -2
  81. package/dist/{runtime-B8s-_hv8.d.cts → runtimeTypes-gZEJu-da.d.cts} +9 -99
  82. package/dist/{runtime-BR9ysG0J.d.ts → runtimeTypes-w5KqBMcs.d.ts} +9 -99
  83. package/dist/server/events/index.cjs +1 -1
  84. package/dist/server/events/index.d.cts +2 -2
  85. package/dist/server/events/index.d.ts +2 -2
  86. package/dist/server/events/index.js +1 -1
  87. package/dist/server/index.cjs +1 -1
  88. package/dist/server/index.d.cts +3 -3
  89. package/dist/server/index.d.ts +3 -3
  90. package/dist/server/index.js +1 -1
  91. package/dist/televet/booking/index.cjs +1 -0
  92. package/dist/televet/booking/index.d.cts +294 -0
  93. package/dist/televet/booking/index.d.ts +294 -0
  94. package/dist/televet/booking/index.js +1 -0
  95. package/dist/televet/call/index.cjs +1 -0
  96. package/dist/televet/call/index.d.cts +141 -0
  97. package/dist/televet/call/index.d.ts +141 -0
  98. package/dist/televet/call/index.js +1 -0
  99. package/dist/televet/index.cjs +1 -1
  100. package/dist/televet/index.d.cts +87 -5
  101. package/dist/televet/index.d.ts +87 -5
  102. package/dist/televet/index.js +1 -1
  103. package/dist/testing/index.cjs +3 -3
  104. package/dist/testing/index.d.cts +2 -2
  105. package/dist/testing/index.d.ts +2 -2
  106. package/dist/testing/index.js +3 -3
  107. package/dist/testing/rn/index.cjs +1 -1
  108. package/dist/testing/rn/index.d.cts +9 -8
  109. package/dist/testing/rn/index.d.ts +9 -8
  110. package/dist/testing/rn/index.js +1 -1
  111. package/dist/testing/web/index.cjs +1 -1
  112. package/dist/testing/web/index.d.cts +9 -8
  113. package/dist/testing/web/index.d.ts +9 -8
  114. package/dist/testing/web/index.js +1 -1
  115. package/dist/{timelineRows-DZed6dAM.d.ts → timelineRows-C15jxFFH.d.ts} +1 -1
  116. package/dist/{timelineRows-CaohZzXS.d.cts → timelineRows-odO8g9r2.d.cts} +1 -1
  117. package/dist/typeStyle-CKqVYD6L.d.cts +111 -0
  118. package/dist/typeStyle-DmoyacDG.d.ts +111 -0
  119. package/dist/{useRecordsDepth-BHBzJ76R.d.cts → useRecordsDepth-C6rjEaLn.d.cts} +1 -1
  120. package/dist/{useRecordsDepth-BU-OhzH6.d.ts → useRecordsDepth-crhBllQK.d.ts} +1 -1
  121. package/dist/video/index.cjs +1 -1
  122. package/dist/video/index.js +1 -1
  123. package/dist/{view-DtSPYpKa.d.ts → view-Bxwxp4xD.d.ts} +2 -2
  124. package/dist/{view-C3qPIXGX.d.cts → view-DyitEO0m.d.cts} +2 -2
  125. package/dist/web/consent/index.cjs +1 -1
  126. package/dist/web/consent/index.d.cts +5 -5
  127. package/dist/web/consent/index.d.ts +5 -5
  128. package/dist/web/consent/index.js +1 -1
  129. package/dist/web/index.cjs +7 -7
  130. package/dist/web/index.d.cts +18 -17
  131. package/dist/web/index.d.ts +18 -17
  132. package/dist/web/index.js +7 -7
  133. package/dist/web/notifications/index.cjs +2 -2
  134. package/dist/web/notifications/index.d.cts +3 -3
  135. package/dist/web/notifications/index.d.ts +3 -3
  136. package/dist/web/notifications/index.js +2 -2
  137. package/dist/web/records/depth/index.cjs +2 -2
  138. package/dist/web/records/depth/index.d.cts +7 -7
  139. package/dist/web/records/depth/index.d.ts +7 -7
  140. package/dist/web/records/depth/index.js +2 -2
  141. package/dist/web/records/index.cjs +3 -3
  142. package/dist/web/records/index.d.cts +102 -11
  143. package/dist/web/records/index.d.ts +102 -11
  144. package/dist/web/records/index.js +3 -3
  145. package/dist/web/televet/booking/index.cjs +1 -0
  146. package/dist/web/televet/booking/index.d.cts +349 -0
  147. package/dist/web/televet/booking/index.d.ts +349 -0
  148. package/dist/web/televet/booking/index.js +1 -0
  149. package/dist/web/televet/call/index.cjs +1 -0
  150. package/dist/web/televet/call/index.d.cts +142 -0
  151. package/dist/web/televet/call/index.d.ts +142 -0
  152. package/dist/web/televet/call/index.js +1 -0
  153. package/dist/web/televet/index.cjs +1 -1
  154. package/dist/web/televet/index.d.cts +90 -4
  155. package/dist/web/televet/index.d.ts +90 -4
  156. package/dist/web/televet/index.js +1 -1
  157. package/package.json +72 -4
  158. package/televet/booking/package.json +8 -0
  159. package/televet/call/package.json +8 -0
  160. package/web/televet/booking/native-blocked.cjs +12 -0
  161. package/web/televet/booking/package.json +8 -0
  162. package/web/televet/call/native-blocked.cjs +12 -0
  163. package/web/televet/call/package.json +8 -0
  164. package/dist/typeStyle-0TydiZ1w.d.cts +0 -19
  165. package/dist/typeStyle-CWMsoe6b.d.ts +0 -19
@@ -1,5 +1,5 @@
1
1
  import { c as EverfurResult } from './EverfurResult-DN9pL2Ab.js';
2
- import { A as AuthContext } from './identity-BMx2SUOM.js';
2
+ import { A as AuthContext } from './identity-CEi9GRFZ.js';
3
3
  import { P as PetRef } from './ids-B2GAAifq.js';
4
4
  import { P as PetHealthProfileInput, a as PetHealthProfile } from './profile-CSs1wlXT.js';
5
5
 
@@ -139,50 +139,4 @@ declare function widgetPetFromWire(raw: unknown): WidgetPet | null;
139
139
  /** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
140
140
  declare function createPetsRepository(auth: AuthContext): PetsRepository;
141
141
 
142
- /** The owner's answer to a check-in, the wire values of the consumer `CheckinResponse` enum. */
143
- type CheckinAnswer = 'better' | 'same' | 'worse';
144
- /** The closed answer set, in the order the consumer surfaces offer it. */
145
- declare const CHECKIN_ANSWERS: readonly CheckinAnswer[];
146
- /**
147
- * The member-safe view of one watch case (consumer `WatchCaseView`). Case STATE only: the concern itself
148
- * never rides on this row. `status` is the server's vocabulary (`watching` while open, then `resolved`,
149
- * `escalated` or `lapsed`), carried as a string so a status added later never breaks a frozen client.
150
- */
151
- interface WatchCase {
152
- readonly caseId: string;
153
- readonly status: string;
154
- /** The body-region copy hint (`ears`, `eyes`, ..., `general`), never a diagnosis. */
155
- readonly bodyLocation: string | null;
156
- readonly lastResponse: CheckinAnswer | null;
157
- readonly checkInDueAt: string | null;
158
- readonly openedAt: string | null;
159
- readonly resolvedAt: string | null;
160
- /** The server's own non-diagnostic post-answer line, stamped only on a BETTER resolve. */
161
- readonly resolutionText: string | null;
162
- }
163
- /** The result of recording a check-in. `ctaDeepLink` is set only on a WORSE escalation (an `everfur://` pointer). */
164
- interface CheckinOutcome {
165
- readonly case: WatchCase;
166
- readonly ctaDeepLink: string | null;
167
- }
168
- interface CasesRepository {
169
- /**
170
- * `GET /widget/v1/pets/{pet_ref}/cases` - the pet's open (`watching`) cases. Settles `ok([])` when the pet
171
- * has none, which the server makes indistinguishable from a non-member or the feature being off.
172
- */
173
- list(petRef: PetRef, opts?: {
174
- signal?: AbortSignal;
175
- }): Promise<EverfurResult<readonly WatchCase[]>>;
176
- /**
177
- * `POST /widget/v1/pets/{pet_ref}/cases/{case_id}/checkin` - record the owner's answer. Settles
178
- * `ok(CheckinOutcome)` on 200; a case that is stale, closed, another member's or gated off is the ordinary
179
- * not-found error. A malformed case id or an answer outside the closed set is refused before the wire.
180
- */
181
- checkin(petRef: PetRef, caseId: string, answer: CheckinAnswer, opts?: {
182
- signal?: AbortSignal;
183
- }): Promise<EverfurResult<CheckinOutcome>>;
184
- }
185
- /** Build the repository over a device AuthContext (personalized bearer XOR anonymous pk). */
186
- declare function createCasesRepository(auth: AuthContext): CasesRepository;
187
-
188
- export { type CheckinAnswer as C, type PetProfileInput as P, type RegisteredPet as R, type WatchCase as W, type CheckinOutcome as a, type WidgetPet as b, type PetProfilePatch as c, type WidgetPetProfile as d, CHECKIN_ANSWERS as e, type CasesRepository as f, PET_AGE_YEARS_MAX as g, PET_BREED_MAX as h, PET_NAME_MAX as i, PET_SPECIES_MAX as j, PET_WEIGHT_KG_MAX as k, type PetsRepository as l, createCasesRepository as m, createPetsRepository as n, widgetPetFromWire as w };
142
+ export { type PetProfileInput as P, type RegisteredPet as R, type WidgetPet as W, type PetProfilePatch as a, type WidgetPetProfile as b, PET_AGE_YEARS_MAX as c, PET_BREED_MAX as d, PET_NAME_MAX as e, PET_SPECIES_MAX as f, PET_WEIGHT_KG_MAX as g, type PetsRepository as h, createPetsRepository as i, widgetPetFromWire as w };
@@ -1 +1 @@
1
- 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var Wt=Object.defineProperty;var i=(e,t)=>Wt(e,"name",{value:t,configurable:true});var oe=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(oe.map(e=>e.wireCode));var Yt=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),je=Object.freeze(oe.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Yt[e.wireCode]}))),$t=new Map(je.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Jt=Object.freeze(["http_envelope",...[...new Set(je.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function V(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Jt]){let o=$t.get(n+r);if(o)return o}}i(V,"contractErrorFor");function Qt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Qt,"contractDocUrl");function De(e){return null}i(De,"publishedDocUrl");var Xt=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Ne(e){return Xt[e]}i(Ne,"categoryFor");function Le(e){let t=V(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}i(Le,"fromWire");var Zt=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ie(e){return Zt.has(e)}i(ie,"isAutoRetryable");var er=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Me(e){return ie(e)||er.has(e)}i(Me,"isRetryableCode");var tr=500,ae=8e3,Ue=4;function Be(e,t=Math.random){let r=Math.max(0,e),n=Math.min(tr*2**r,ae);return Math.floor(t()*n)}i(Be,"backoffDelayMs");var rr=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function se(e){return rr[e]}i(se,"userFacingError");function qe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(qe,"defineHidden");var nr=/^[a-z][a-z0-9_]{0,63}$/;function f(e,t){let r=V(t?.wireCode,t?.wireEnvelope),n={code:e,category:Ne(e),retryable:t?.retryable??Me(e),displayMessage:se(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&nr.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&qe(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&qe(n,"raw",t.raw),Object.freeze(n)}i(f,"makeEverfurError");function z(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(z,"ok");function y(e){return Object.freeze({ok:false,error:e})}i(y,"err");var G=class G extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,G.prototype);}};i(G,"EverfurConfigError");var I=G;function j(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(j,"assertNever");function He(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(He,"errorFrame");function ar(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(ar,"authHeaders");function D(e,t){return {...e,headers:{...sr(e.headers),...ar(t)}}}i(D,"withAuthHeaders");function sr(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(sr,"stripAuthHeaders");async function Ve(e,t){if(t.mode==="anonymous")return t.transport.request(D(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return y(le())}let n=await t.transport.request(D(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return y(le())}let a=await t.transport.request(D(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?y(le(a.error.httpStatus)):a}i(Ve,"authedSend");function le(e){return f("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(le,"authRejectedError");function Ge(e){return f("internalError",{retryable:true,wireMessage:lr(e)})}i(Ge,"networkError");function lr(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(lr,"describeCause");var dr=3e4,ur=ae*2,cr="idempotency-key",pr=new Set(["POST","PUT","PATCH","DELETE"]),yr=Object.freeze({onEvent(){}}),fr=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function We(e){let t=e.observer??yr,r=e.timers??fr,n=e.rng??Math.random,o=e.sleep??((E,u)=>xr(E,r,u)),a=e.maxAttempts??Ue,s=e.unaryTimeoutMs??dr,l=e.newIdempotencyKey??br(),d=i(E=>{try{t.onEvent(E);}catch{}},"emit");async function p(E,u,R){let k=R?.maxAttempts,Gt=Math.max(1,k??a),ee=R?.idempotent??pr.has(u.method)?l():null,Kt=mr(u,ee),te=0;for(;;){let O=i(ne=>Object.freeze({call:E,method:u.method,path:u.path,attempt:te,...ee?{idempotencyKey:ee}:{},...ne}),"stamp");d(O({phase:"attempt"}));let Ae=kr(s,r),Ie=Sr(Ae.signal,u.signal),A;try{A=await Ve({...Kt,signal:Ie.signal},e.auth);}catch(ne){A=y(Ge(ne));}finally{Ie.dispose(),Ae.cancel();}if(A.ok)return d(O({phase:"settled",ok:true,reason:"ok"})),A;let S=A.error,H=hr(S,te,{maxAttempts:Gt,rng:n,now:r.now(),aborted:u.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),re={ok:false,code:S.code,reason:H.reason,...S.httpStatus!==void 0?{httpStatus:S.httpStatus}:{},...S.requestId!==void 0?{requestId:S.requestId}:{}};if(!H.retry)return d(O({phase:"settled",...re})),y(S);if(d(O({phase:"retry",...re,delayMs:H.delayMs})),await o(H.delayMs,u.signal),u.signal?.aborted===true)return d(O({phase:"settled",...re,reason:"aborted"})),y(S);te+=1;}}i(p,"send");async function h(E){return D(E,await Cr(e.auth))}i(h,"authorize");async function*_(E,u,R){d(Object.freeze({call:E,phase:"stream.open",method:u.method,path:u.path,attempt:0}));try{yield*e.auth.transport.stream(u,R);}catch{yield He({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(_,"stream"),Object.freeze({send:p,authorize:h,stream:_})}i(We,"createRequestFunnel");function mr(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==cr&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(mr,"assembleHeaders");function br(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(br,"defaultIdempotencyKeyFactory");var gr=10;function hr(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=vr(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!ie(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=i(()=>{if(r.policy===void 0)return null;let p;try{p=r.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(gr,Math.floor(p)))},"policyCeiling"),l=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=Er(e,r.now);return d!==null?d>ur?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:d}:{retry:true,reason:o,delayMs:Be(t,r.rng)}}i(hr,"decideRetry");function vr(e){let t=e.code==="unknown"?Le(Tr(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(vr,"throttleKind");function Er(e,t){let r=_r(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}i(Er,"retryOverrideMs");function _r(e){for(let t of Ye(e)){let r=t.resets_at,n=Rr(r);if(n!==null)return n}return null}i(_r,"findResetsAt");function Ye(e){if(!Ke(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Ke(n)&&t.push(n);}return t}i(Ye,"candidateScopes");function Rr(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}i(Rr,"parseInstantMs");function Tr(e){for(let t of Ye(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(Tr,"rawWireCode");function Ke(e){return typeof e=="object"&&e!==null}i(Ke,"isRecord");async function Cr(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(Cr,"resolveDeviceAuth");function kr(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(kr,"boundedSignal");function Sr(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Sr,"mergeSignals");function xr(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",a),n();},e),a=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",a,{once:true});})}i(xr,"delayAbortable");var $e=Object.freeze({track(){},trackExpectedFailure(){}});function Je(e){let t={uri:e.uri,mimeType:e.mimeType},r=de(e);return r!==null&&(t.sizeBytes=r),Object.freeze(t)}i(Je,"fileHandleFromMedia");function de(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}i(de,"mediaByteSize");function Qe(e,t){return Object.freeze(t===void 0?{mode:e}:{mode:e,maxDurationSeconds:t})}i(Qe,"captureOptionsFor");function ue(e){return e!=null&&e.isAvailable===true}i(ue,"isCaptureAvailable");var Xe=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Ze(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},a=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",a),n();},"done");o.handle=r.setTimeout(a,e),t.addEventListener("abort",a,{once:true});})}i(Ze,"delayAbortable");function wr(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=i(()=>r.abort(),"onAbort");return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}i(wr,"mergeSignals");var ce=class ce{constructor(t){this.listeners=new Set;this.epoch=0;this.inFlight=null;this.snapshot=Object.freeze({...t});}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}getSnapshot(){return this.snapshot}patch(t){this.snapshot=Object.freeze({...this.snapshot,...t});for(let r of this.listeners)r();}beginOperation(t){this.inFlight?.abort();let r=new AbortController;this.inFlight=r;let n=this.epoch;return {signal:t?wr(r.signal,t):r.signal,epoch:n,settle:i(()=>{this.inFlight===r&&(this.inFlight=null);},"settle")}}alive(t){return t===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null;}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear();}};i(ce,"MediaStore");var K=ce;function et(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(et,"hasLoneSurrogate");var Pr=Object.freeze(["primary_label","primary_confidence","subtype_label","subtype_display","subtype_confidence","risk_tier","confidence_tier","copy_short","disease_name","disease_framing","model_version","skin_v2","eye_v2","llm_checkup"]),Fr=Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),Or=new Set(["skin_v2","eye_v2","llm_checkup"]),Ar=new Set(["primary_confidence","subtype_confidence"]),Ir=new Set(["low_risk","concern","uncertain"]),zr=new Set(["possible","probable"]),jr=Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function tt(e){let t=v(e)?e:{},r={};for(let o of Pr){if(!(o in t))continue;let a=t[o],s=Dr(o,a);s!==P&&(r[o]=s);}let n=0;for(let o of Fr)o in t&&(n+=1);return Object.freeze({metadata:Object.freeze(r),droppedOperatorKeys:n})}i(tt,"projectDetectionMetadata");var P=Symbol("drop");function Dr(e,t){if(Or.has(e))return typeof t=="boolean"?t:P;if(Ar.has(e))return rt(t)?t:P;if(e==="risk_tier")return typeof t=="string"&&Ir.has(t)?t:P;if(e==="confidence_tier")return typeof t=="string"&&zr.has(t)?t:P;if(typeof t!="string")return P;let r=jr[e]??256;return t.length>r?t.slice(0,r):t}i(Dr,"acceptKey");function rt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}i(rt,"isUnitConfidence");function nt(e){if(!v(e))return null;let t=m(e.summary),r=m(e.disclaimer),n=Nr(e.recommendations??e.recommendation);return t===null&&r===null&&n.length===0?null:Object.freeze({summary:t??"",recommendations:Object.freeze(n),disclaimer:r??""})}i(nt,"parseInterpretation");function ot(e){if(!v(e))return {};if(v(e.metadata))return e.metadata;let t=e.detections;if(Array.isArray(t)&&t.length>0){let r=t[0];if(v(r)&&v(r.metadata))return r.metadata;if(v(r))return r}return e}i(ot,"locateDetectionMetadata");function it(e){return v(e)?v(e.interpretation)?e.interpretation:e:null}i(it,"locateInterpretation");function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(v,"isRecord");function m(e){return typeof e=="string"&&e.length>0?e:null}i(m,"asString");function Nr(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}i(Nr,"asStringList");function at(e){return rt(e)?e:null}i(at,"asUnitNumber");function pe(e){return typeof e=="number"&&Number.isFinite(e)?e:null}i(pe,"asFiniteNumber");var N=Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:i(e=>et(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`,"job")});async function lt(e,t){let r={purpose:t.purpose,content_type:t.contentType};t.byteSize!==null&&(r.byte_size=t.byteSize);let n={method:"POST",path:N.initiate,body:r,...t.signal?{signal:t.signal}:{}},o=await e.send("media.initiateUpload",n);if(!o.ok)return y(o.error);let a=Lr(o.value);return a===null?y(f("mediaUploadFailed",{retryable:false})):z(a)}i(lt,"initiateUpload");function Lr(e){if(!v(e))return null;let t=m(e.url),r=m(e.s3_key);if(t===null||r===null)return null;let n=e.fields,o={};if(v(n))for(let[a,s]of Object.entries(n))typeof s=="string"&&(o[a]=s);return Object.freeze({url:t,fields:Object.freeze(o),s3Key:r,expiresAt:pe(e.expires_at)})}i(Lr,"parsePresigned");async function dt(e,t,r,n,o){try{return await e.presignedPut(Je(t),{target:r,idempotencyKey:n,...o?{signal:o}:{}}),z(void 0)}catch{return y(f("mediaUploadFailed",{retryable:false}))}}i(dt,"stageUpload");async function ut(e,t){let r={method:"POST",path:N.precheck,body:{s3_key:t.s3Key,type:t.type},...t.signal?{signal:t.signal}:{}},n=await e.send("media.precheck",r);return n.ok?Mr(n.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}i(ut,"runPrecheck");function Mr(e){if(!v(e))return {verdict:"proceed",reasonCodes:[],precheckToken:null};let t=m(e.verdict),r=t==="retake"||t==="reject"?t:"proceed",n=Array.isArray(e.reason_codes)?e.reason_codes.filter(o=>typeof o=="string"):[];return Object.freeze({verdict:r,reasonCodes:Object.freeze(n),precheckToken:m(e.precheck_token)})}i(Mr,"parsePrecheck");async function ct(e,t,r,n,o){let a={method:"POST",path:t,body:r,...o?{signal:o}:{}},s=await e.send("media.analyze",a);if(s.ok){let d=Ur(s.value);return d!==null?{kind:"async",job:d}:{kind:"sync",body:s.value}}let l=n(s.error.httpStatus,s.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:s.error}}i(ct,"submitAnalyze");function Ur(e){if(!v(e))return null;let t=m(e.job_id);if(t===null)return null;let r=m(e.status);return r!==null&&Vr(r)?null:Object.freeze({jobId:t,estimatedSeconds:pe(e.estimated_completion_seconds)})}i(Ur,"parseAsyncJob");var Br=2e3,st=5e3,qr=9e4;async function pt(e,t,r){let{timers:n,signal:o,alive:a}=r,s=n.now(),l=Math.max(qr,(r.estimatedSeconds??0)*1e3),d=Br;for(;;){if(o.aborted||!a())return {kind:"aborted"};if(await Ze(d,o,n),o.aborted||!a())return {kind:"aborted"};if(n.now()-s>l)return {kind:"timeout"};let p=N.job(t);if(p===null)return {kind:"notFound"};let h=await e.send("media.pollJob",{method:"GET",path:p,...o?{signal:o}:{}},{maxAttempts:1});if(o.aborted||!a())return {kind:"aborted"};if(!h.ok){if(h.error.httpStatus===404)return {kind:"notFound"};d=Math.min(st,d+1e3);continue}let _=Hr(h.value);if(_==="COMPLETED")return {kind:"complete",body:h.value};if(_==="FAILED")return {kind:"failed",error:Gr(h.value)};d=Math.min(st,d+1e3);}}i(pt,"pollJob");function Hr(e){return v(e)?(m(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}i(Hr,"jobStatusOf");function Vr(e){let t=e.toUpperCase();return t==="COMPLETED"||t==="FAILED"}i(Vr,"isTerminalStatus");function Gr(e){let t=v(e)?m(e.error)??m(e.error_code):null;return f("internalError",{retryable:false,...t?{wireMessage:t}:{}})}i(Gr,"jobFailureError");function yt(e,t){return e===422?{kind:"species_unsupported",species:"cat"}:e===400?{kind:"pet_context_required"}:null}i(yt,"detectPhotoGate");function ft(e,t){let r={s3_key:e};return t.type!==void 0&&(r.type=t.type),t.petRef!=null&&(r.pet_id=t.petRef),t.precheckToken!=null&&(r.precheck_token=t.precheckToken),r}i(ft,"analyzeBody");var L=Object.freeze({kind:"accepted"});function mt(e){return new ye(e)}i(mt,"createPhotoController");var fe=class fe extends K{constructor(t){super({status:"idle",region:t.region??"skin",result:null,gate:L,error:null,isCaptureAvailable:ue(t.camera)}),this.funnel=t.funnel??We({auth:t.auth,...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}}),this.camera=t.camera,this.upload=t.upload,this.telemetry=t.telemetry??$e,this.timers=t.timers??Xe,this.makeIdempotencyKey=t.makeIdempotencyKey??$r();}async capture(t,r){if(!ue(this.camera))return y(f("unknown",{retryable:false}));let n;try{n=await this.camera.capture(Qe("photo"));}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),y(f("unknown",{retryable:false}))}return this.analyze(n,t,r)}async analyze(t,r,n){let o=this.beginOperation(n.signal),a=this.makeIdempotencyKey(),s=this.timers.now();this.patch({status:"capturing",region:r,error:null,result:null,gate:L});try{let l=await lt(this.funnel,{purpose:"skin_scan",contentType:t.mimeType,byteSize:de(t),signal:o.signal});if(o.signal.aborted||!this.alive(o.epoch))return T();if(!l.ok)return this.fail(o,l.error);let d=await dt(this.upload,t,l.value,a,o.signal);if(o.signal.aborted||!this.alive(o.epoch))return T();if(!d.ok)return this.fail(o,d.error);let p=await ut(this.funnel,{s3Key:l.value.s3Key,type:r,signal:o.signal});if(o.signal.aborted||!this.alive(o.epoch))return T();if(p.verdict!=="proceed")return this.gateRetake(o,r,p.reasonCodes);this.patch({status:"analyzing"});let h=await ct(this.funnel,N.photoAnalyze,ft(l.value.s3Key,{type:r,petRef:n.petRef,precheckToken:p.precheckToken}),yt,o.signal);if(o.signal.aborted||!this.alive(o.epoch))return T();switch(h.kind){case "error":return this.fail(o,h.error);case "gate":return this.gateDomain(o,r,h.gate);case "sync":return this.complete(o,h.body,r,null,s);case "async":{let _=await pt(this.funnel,h.job.jobId,{timers:this.timers,signal:o.signal,alive:i(()=>this.alive(o.epoch),"alive"),estimatedSeconds:h.job.estimatedSeconds});if(o.signal.aborted||!this.alive(o.epoch))return T();switch(_.kind){case "aborted":return T();case "complete":return this.complete(o,_.body,r,h.job.jobId,s);case "failed":return this.fail(o,_.error);case "timeout":return this.fail(o,f("streamTimeout",{retryable:!0}));case "notFound":return this.fail(o,f("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(o,f("internalError",{retryable:!1}))}}default:return this.fail(o,f("internalError",{retryable:!1}))}}finally{o.settle();}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:L,error:null});}complete(t,r,n,o,a){if(!this.alive(t.epoch))return T();let s=Kr(r,n,o);return s.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:s.droppedOperatorKeys}),this.patch({status:"complete",result:s.result,gate:L,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:n}),this.telemetry.track("analysis.result",{capability:"photo",region:n,riskTier:s.result.riskTier??"",confidenceTier:s.result.confidenceTier??"",modelVersion:s.result.modelVersion??"",timeToResultMs:this.timers.now()-a}),z(s.result)}gateDomain(t,r,n){if(!this.alive(t.epoch))return T();let o=n.kind==="species_unsupported"?Object.freeze({kind:"species_unsupported",species:"cat"}):Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:o,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:n.kind,region:r,...n.kind==="species_unsupported"?{species:"cat"}:{}}),y(f("unknown",{retryable:false}))}gateRetake(t,r,n){if(!this.alive(t.epoch))return T();this.patch({status:"idle",gate:Object.freeze({kind:"retake",reasons:Object.freeze([...n])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:n});let o=n.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:o,region:r}),y(f("unknown",{retryable:false}))}fail(t,r){return this.alive(t.epoch)?(this.patch({status:"error",error:r,gate:L}),this.telemetry.trackExpectedFailure("analysis.error",{code:r.code,...r.httpStatus!==void 0?{httpStatus:r.httpStatus}:{}}),y(r)):T()}};i(fe,"PhotoController");var ye=fe;function Kr(e,t,r){let n=tt(ot(e)),o=n.metadata,a=nt(it(e));return {result:Object.freeze({jobId:r,analysisType:t,primaryLabel:m(o.primary_label)??"Uncertain",riskTier:Wr(o.risk_tier),confidence:at(o.primary_confidence),subtypeDisplay:m(o.subtype_display),confidenceTier:Yr(o.confidence_tier),diseaseName:m(o.disease_name),diseaseFraming:m(o.disease_framing),copyShort:m(o.copy_short),interpretation:a,modelVersion:m(o.model_version)??(v(e)?m(e.model_version):null)}),droppedOperatorKeys:n.droppedOperatorKeys}}i(Kr,"mapPhotoResult");function Wr(e){return e==="low_risk"||e==="concern"||e==="uncertain"?e:null}i(Wr,"asRiskTier");function Yr(e){return e==="possible"||e==="probable"?e:null}i(Yr,"asConfidenceTier");function T(){return y(f("unknown",{retryable:false}))}i(T,"abortedResult");function $r(){let e=0;return ()=>`photo-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}i($r,"defaultIdempotencyFactory");var bt=Symbol.for("@everfur/sdk#EverfurContext@v1"),gt=globalThis,ht=gt[bt]??(gt[bt]=react.createContext(null));ht.displayName??="EverfurContext";function W(){let e=react.useContext(ht);if(e===null)throw new I("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(W,"useEverfurContext");var rn=Object.freeze({status:"idle",region:"skin",result:null,gate:Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),nn=i(()=>{},"NOOP_UNSUBSCRIBE");function me(e){let{runtime:t,userRef:r,scopeEpoch:n}=W(),o=e.petRef,[a,s]=react.useState(null);react.useEffect(()=>{let{services:u}=t.registry,R=t.registry.acquire("photo",`${r??""}|${o}`,()=>mt({...u.errorPolicy?{errorPolicy:u.errorPolicy}:{},auth:u.authFor(r),camera:u.camera,upload:u.upload,telemetry:u.telemetry}),k=>k.dispose());return s(R),()=>{s(k=>k===R?null:k),t.registry.release(R);}},[t,r,o,n]);let l=react.useCallback(u=>a?a.subscribe(u):nn,[a]),d=react.useCallback(()=>a?a.getSnapshot():rn,[a]),p=react.useSyncExternalStore(l,d,d),h=react.useCallback((u,R)=>a?a.analyze(u,R,{petRef:o}):Promise.resolve(vt()),[a,o]),_=react.useCallback(u=>a?a.capture(u,{petRef:o}):Promise.resolve(vt()),[a,o]),E=react.useCallback(()=>{a?.reset();},[a]);return react.useMemo(()=>({status:p.status,region:p.region,result:p.result,gate:p.gate,error:p.error,isCaptureAvailable:p.isCaptureAvailable,isBootstrapping:a===null,analyze:h,capture:_,reset:E}),[p,a,h,_,E])}i(me,"usePhotoCheckup");function vt(){return y(f("internalError",{retryable:true}))}i(vt,"notReadyError");function he(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))he(e[t]);}return e}i(he,"deepFreeze");var on=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),_t={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Rt={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Et={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},an={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},sn={regular:"400",medium:"500",bold:"700"},ln={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},dn=0,Y="System",$="monospace",un=["content","heading","control","compact","badge"];function cn(e){let t={};for(let r of un)t[r]=e;return t}i(cn,"authoredTierSizes");function Tt(){return {family:Y,mono:$,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:$,monoMedium:$,monoBold:$},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Et,tierSizes:cn(Et),lineHeight:an,weight:sn,letterSpacing:ln,scale:1,maxScale:dn,scaleCaps:on}}i(Tt,"baseType");var Ct={},be=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function ge(e){return `cubic-bezier(${e.join(", ")})`}i(ge,"cssCubicBezier");var kt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:ge(be.standard),emphasized:ge(be.emphasized),exit:ge(be.exit)},reducedMotion:false},pn={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},St=he({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:pn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct}),yn={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};he({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:yn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct});var xt=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wt=globalThis,ve=wt[xt]??(wt[xt]=react.createContext(St));ve.displayName??="EverfurThemeContext";function g(){return react.useContext(ve)}i(g,"useEverfurTheme");function vn(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(vn,"tierMultiplier");function b({tier:e="content",...t}){let{type:r}=g(),n=vn(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(b,"Text");react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var En=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function U(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[En[t]]}}i(U,"face");var Re=class Re extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(Re,"HostRenderBoundary");var Ee=Re;function Rn({render:e}){return e()}i(Rn,"RenderHost");function _e({render:e,fallback:t,resetKey:r}){return react.createElement(Ee,{fallback:t,resetKey:r,children:react.createElement(Rn,{render:e})})}i(_e,"HostRender");var Tn=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function Cn(e){return Tn[e]}i(Cn,"requires");function Ot(e,t,r){let n=Cn(e),o=new Map;for(let l of t)o.set(l.resource,l);if(r?.isPending===true&&n.some(l=>!o.has(l)))return Te({name:e,enabled:false,isPending:true,limits:{}});let a=kn(n,o);return n.filter(l=>o.get(l)?.granted!==true).length===0?Te({name:e,enabled:true,isPending:false,limits:a}):Te({name:e,enabled:false,isPending:false,limits:a,disabled:Sn(n,o)})}i(Ot,"decideCapability");function kn(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[a,s]of Object.entries(o)){let l=r[a];r[a]=l===void 0?s:Math.min(l,s);}}return r}i(kn,"mergeLimits");function Sn(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:se("accessDenied"),level:"user_entitlement",recoverable:false})}i(Sn,"disabledFor");function Te(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(Te,"freezeDecision");function Ce(e){let{runtime:t}=W(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>Ot(e,n.decisions,{isPending:n.isPending}),[e,n])}i(Ce,"useCapability");var Pn=48;function Fn(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(Fn,"selectView");function jt(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:a}=e,s=Ce(t),l=react.useMemo(()=>Fn(s),[s]);switch(l){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(_e,{render:o,fallback:jsxRuntime.jsx(It,{capability:t,style:a})}):jsxRuntime.jsx(It,{capability:t,style:a});case "disabled":return n?jsxRuntime.jsx(_e,{render:()=>n(s),fallback:jsxRuntime.jsx(zt,{decision:s,style:a}),resetKey:s}):jsxRuntime.jsx(zt,{decision:s,style:a});default:return j(l)}}i(jt,"CapabilityGate");function It({capability:e,style:t}){let r=g(),n=react.useMemo(()=>Dt(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(It,"PendingSkeleton");function zt({decision:e,style:t}){let r=g(),n=react.useMemo(()=>Dt(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(b,{style:n.offstateText,children:o}):null})}i(zt,"OffState");function Dt(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:Pn,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...U(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(Dt,"makeStyles");var B=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Mt(e){let t=g(),r=react.useMemo(()=>In(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${B.title}. ${B.body}`,children:[jsxRuntime.jsx(b,{style:r.title,children:B.title}),jsxRuntime.jsx(b,{style:r.body,children:B.body})]})}i(Mt,"ClinicalDisclaimer");function In(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...U(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...U(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(In,"makeStyles");var Bn=1400,qn=300;function Bt(){let e=g(),t=react.useMemo(()=>Hn(e),[e]),r=e.motion.reducedMotion,[n,o]=react.useState(false);react.useEffect(()=>{let l=setTimeout(()=>o(true),qn);return ()=>clearTimeout(l)},[]);let a=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{if(r||!n)return;let l=reactNative.Animated.loop(reactNative.Animated.timing(a,{toValue:1,duration:Bn,easing:reactNative.Easing.linear,useNativeDriver:true}));return l.start(),()=>l.stop()},[r,n,a]);let s=r?null:{transform:[{rotate:a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};return jsxRuntime.jsx(reactNative.View,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[t.ring,s]}),jsxRuntime.jsx(b,{style:t.statusLine,children:"Analyzing"})]}):null})}i(Bt,"AnalyzingIndicator");function Hn(e){let{color:t,space:r,radius:n,type:o}=e,a=o.weight.medium,s=r.xxl*2,l=r.xs;return reactNative.StyleSheet.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.md},ring:{width:s,height:s,borderRadius:n.pill,borderWidth:l,borderTopColor:t.success,borderRightColor:t.success,borderBottomColor:t.borderRingCream,borderLeftColor:t.borderRingCream},statusLine:{color:t.text.secondary,fontFamily:o.family,fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,fontWeight:a,letterSpacing:o.letterSpacing.tight,textAlign:"center"}})}i(Hn,"makeStyles");var Jn=1100,Qn=1.6,Xn=.35;function Zn(e,t){let{color:r}=e;switch(t){case "low_risk":return {accent:r.success,wash:r.badgeBgPositive,label:"Low risk",pulse:false};case "concern":return {accent:r.cautionAccent,wash:r.badgeBgCaution,label:"Concern",pulse:true};case "uncertain":return {accent:r.text.muted,wash:r.badgeBgNeutral,label:"Uncertain",pulse:false}}}i(Zn,"toneSpec");function Vt({riskTier:e}){let t=g(),r=react.useMemo(()=>eo(t),[t]),n=react.useRef(new reactNative.Animated.Value(0)).current,o=e===null?null:Zn(t,e),a=o!==null&&o.pulse&&!t.motion.reducedMotion;return react.useEffect(()=>{if(!a)return;let s=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:Jn,easing:reactNative.Easing.out(reactNative.Easing.quad),useNativeDriver:true}));return s.start(),()=>s.stop()},[a,n]),o===null?null:jsxRuntime.jsxs(reactNative.View,{style:[r.pill,{backgroundColor:o.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:o.label,children:[jsxRuntime.jsxs(reactNative.View,{style:r.dotWrap,children:[a?jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:o.accent,opacity:n.interpolate({inputRange:[0,1],outputRange:[Xn,0]}),transform:[{scale:n.interpolate({inputRange:[0,1],outputRange:[1,Qn]})}]}]}):null,jsxRuntime.jsx(reactNative.View,{style:[r.dot,{backgroundColor:o.accent}]})]}),jsxRuntime.jsx(b,{style:[r.label,{color:o.accent}],children:o.label})]})}i(Vt,"SeverityBadge");function eo(e){let{space:t,radius:r,type:n}=e,o=n.weight.bold,a=t.sm;return reactNative.StyleSheet.create({pill:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:t.sm,paddingHorizontal:t.md,paddingVertical:t.xs,borderRadius:r.pill},dotWrap:{width:a,height:a,alignItems:"center",justifyContent:"center"},dot:{width:a,height:a,borderRadius:r.pill},dotRing:{position:"absolute",width:a,height:a,borderRadius:r.pill},label:{fontFamily:n.family,fontSize:n.size.caption,lineHeight:n.size.caption*n.lineHeight.snug,fontWeight:o,letterSpacing:n.letterSpacing.eyebrow}})}i(eo,"makeStyles");var Fe=120,Z=44;function ro(e){let{petRef:t,region:r,style:n}=e;return jsxRuntime.jsx(jt,{capability:"photo",style:n,children:jsxRuntime.jsx(oo,{petRef:t,region:r,style:n})})}i(ro,"PhotoCheckup");function no(e){return e.isBootstrapping||e.status==="capturing"||e.status==="analyzing"?"loading":e.status==="error"&&e.error?"error":e.status==="complete"&&e.result?"populated":e.gate.kind!=="accepted"?"gate":e.isCaptureAvailable?"empty":"native"}i(no,"selectView");function oo({petRef:e,region:t,style:r}){let n=me({petRef:e}),o=t??"skin",a=no(n),s=react.useMemo(()=>()=>{n.capture(o);},[n,o]),l=g(),d=react.useMemo(()=>F(l),[l]);return jsxRuntime.jsxs(reactNative.View,{style:[d.container,r],children:[jsxRuntime.jsx(reactNative.View,{style:d.body,children:io(a,n,s)}),jsxRuntime.jsx(Mt,{})]})}i(oo,"PhotoBody");function io(e,t,r){switch(e){case "loading":return jsxRuntime.jsx(Bt,{});case "native":return jsxRuntime.jsx(ao,{});case "empty":return jsxRuntime.jsx(so,{onCapture:r});case "error":return jsxRuntime.jsx(lo,{error:t.error,onRetry:r});case "gate":return jsxRuntime.jsx(uo,{gate:t.gate,onRetry:t.reset});case "populated":return jsxRuntime.jsx(po,{result:t.result});default:return j(e)}}i(io,"renderView");function ao(){let e=g(),t=react.useMemo(()=>F(e),[e]);return jsxRuntime.jsx(reactNative.View,{style:t.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:jsxRuntime.jsx(reactNative.View,{style:t.emptyGlyph})})}i(ao,"NativeUnavailableState");function so({onCapture:e}){let t=g(),r=react.useMemo(()=>F(t),[t]);return jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Take a photo to check",children:jsxRuntime.jsx(reactNative.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Take photo",style:r.scanButton,children:jsxRuntime.jsx(b,{style:r.scanLabel,children:"Take photo"})})})}i(so,"EmptyState");function lo({error:e,onRetry:t}){let r=g(),n=react.useMemo(()=>F(r),[r]);return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(b,{style:n.errorText,children:e.displayMessage}),e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:jsxRuntime.jsx(b,{style:n.primaryLabel,children:"Try again"})}):null]})}i(lo,"ErrorState");function uo({gate:e,onRetry:t}){let r=g(),n=react.useMemo(()=>F(r),[r]),o=co(e);return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:o,children:[jsxRuntime.jsx(b,{style:n.guidanceText,children:o}),e.kind!=="species_unsupported"?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:jsxRuntime.jsx(b,{style:n.primaryLabel,children:"Try again"})}):null]})}i(uo,"GateState");function co(e){switch(e.kind){case "species_unsupported":return "Photo checks are coming soon for this pet.";case "pet_context_required":return "Choose a pet first, then take the photo.";case "retake":return "That photo was hard to read. Please take another.";case "accepted":return "";default:return j(e)}}i(co,"gateMessage");function po({result:e}){let t=g(),r=react.useMemo(()=>F(t),[t]),n=e.subtypeDisplay??e.diseaseName??e.primaryLabel,o=yo(t,e.riskTier);return jsxRuntime.jsxs(reactNative.ScrollView,{style:r.list,contentContainerStyle:[r.listContent,{backgroundColor:o}],accessibilityLabel:"Photo checkup result",children:[jsxRuntime.jsx(b,{style:r.resultHeadline,children:n}),jsxRuntime.jsx(Vt,{riskTier:e.riskTier}),e.diseaseFraming?jsxRuntime.jsx(b,{style:r.summaryText,children:e.diseaseFraming}):null,e.copyShort?jsxRuntime.jsx(b,{style:r.summaryText,children:e.copyShort}):null,e.interpretation?jsxRuntime.jsxs(reactNative.View,{style:r.interpretationBlock,children:[jsxRuntime.jsx(b,{style:r.summaryText,children:e.interpretation.summary}),jsxRuntime.jsx(b,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]})}i(po,"ResultState");function yo(e,t){switch(t){case "low_risk":return e.color.checkupCardLowRiskBg;case "concern":return e.color.checkupCardConcernBg;default:return e.color.surfaceCream}}i(yo,"resultCardTint");function F(e){let{color:t,space:r,radius:n,type:o}=e,a=o.weight.bold,s=o.weight.medium,l=o.weight.regular,d=e.brightness==="dark"?t.onAccent:t.brand;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Fe,backgroundColor:t.background},body:{flex:1},centered:{minHeight:Fe,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},offstate:{minHeight:Fe,alignItems:"center",justifyContent:"center",padding:r.xl},emptyGlyph:{width:r.xxl,height:r.xxl,borderRadius:n.pill,backgroundColor:t.surfaceSubtle,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},scanButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.md,borderRadius:n.pill,backgroundColor:t.scanButtonPink,shadowColor:t.brand,shadowOpacity:.18,shadowRadius:n.xs,shadowOffset:{width:0,height:r.xs},elevation:3},scanLabel:{color:d,fontFamily:o.family,fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,fontWeight:a,letterSpacing:o.letterSpacing.tight},primaryButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand},primaryLabel:{color:t.onPrimary,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,fontWeight:s},errorText:{color:t.danger,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},guidanceText:{color:t.text.muted,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},list:{flex:1},listContent:{padding:r.lg,gap:r.sm,borderRadius:n.lg,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,shadowColor:t.brand,shadowOpacity:.08,shadowRadius:n.xs,shadowOffset:{width:0,height:r.xs},elevation:2},resultHeadline:{color:t.text.secondary,fontFamily:o.family,fontSize:o.size.verdict,lineHeight:o.size.verdict*o.lineHeight.tight,fontWeight:a,letterSpacing:o.letterSpacing.tight},summaryText:{color:t.text.primary,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,fontWeight:l},interpretationBlock:{marginTop:r.sm,paddingTop:r.sm,gap:r.xs,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen},disclaimerText:{color:t.text.muted,fontFamily:o.family,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,fontWeight:l}})}i(F,"makeStyles");exports.PhotoCheckup=ro;exports.usePhotoCheckup=me;
1
+ 'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var $t=Object.defineProperty;var i=(e,t)=>$t(e,"name",{value:t,configurable:true});var oe=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(oe.map(e=>e.wireCode));var Jt=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),je=Object.freeze(oe.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Jt[e.wireCode]}))),Qt=new Map(je.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Xt=Object.freeze(["http_envelope",...[...new Set(je.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function V(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Xt]){let o=Qt.get(n+r);if(o)return o}}i(V,"contractErrorFor");function Zt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Zt,"contractDocUrl");function De(e){return null}i(De,"publishedDocUrl");var er=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Ne(e){return er[e]}i(Ne,"categoryFor");function Le(e){let t=V(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}i(Le,"fromWire");var tr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ie(e){return tr.has(e)}i(ie,"isAutoRetryable");var rr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Me(e){return ie(e)||rr.has(e)}i(Me,"isRetryableCode");var nr=500,ae=8e3,Ue=4;function Be(e,t=Math.random){let r=Math.max(0,e),n=Math.min(nr*2**r,ae);return Math.floor(t()*n)}i(Be,"backoffDelayMs");var or=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function se(e){return or[e]}i(se,"userFacingError");function qe(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(qe,"defineHidden");var ir=/^[a-z][a-z0-9_]{0,63}$/;function f(e,t){let r=V(t?.wireCode,t?.wireEnvelope),n={code:e,category:Ne(e),retryable:t?.retryable??Me(e),displayMessage:se(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&ir.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&qe(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&qe(n,"raw",t.raw),Object.freeze(n)}i(f,"makeEverfurError");function z(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(z,"ok");function y(e){return Object.freeze({ok:false,error:e})}i(y,"err");var K=class K extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,K.prototype);}};i(K,"EverfurConfigError");var I=K;function j(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(j,"assertNever");function He(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(He,"errorFrame");function lr(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(lr,"authHeaders");function D(e,t){return {...e,headers:{...dr(e.headers),...lr(t)}}}i(D,"withAuthHeaders");function dr(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(dr,"stripAuthHeaders");async function Ve(e,t){if(t.mode==="anonymous")return t.transport.request(D(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return y(le())}let n=await t.transport.request(D(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return y(le())}let a=await t.transport.request(D(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?y(le(a.error.httpStatus)):a}i(Ve,"authedSend");function le(e){return f("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(le,"authRejectedError");function Ke(e){return f("internalError",{retryable:true,wireMessage:ur(e)})}i(Ke,"networkError");function ur(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(ur,"describeCause");var cr=3e4,pr=ae*2,yr="idempotency-key",fr=new Set(["POST","PUT","PATCH","DELETE"]),mr=Object.freeze({onEvent(){}}),br=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function gr(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(gr,"seededIdempotencyKey");function We(e){let t=e.observer??mr,r=e.timers??br,n=e.rng??Math.random,o=e.sleep??((E,u)=>Fr(E,r,u)),a=e.maxAttempts??Ue,s=e.unaryTimeoutMs??cr,l=e.newIdempotencyKey??vr(),d=i(E=>{try{t.onEvent(E);}catch{}},"emit");async function p(E,u,_){let k=_?.maxAttempts,Kt=Math.max(1,k??a),Gt=_?.idempotent??fr.has(u.method),Wt=_?.idempotencyKey===void 0?null:gr(_.idempotencyKey),ee=Gt?Wt??l():null,Yt=hr(u,ee),te=0;for(;;){let O=i(ne=>Object.freeze({call:E,method:u.method,path:u.path,attempt:te,...ee?{idempotencyKey:ee}:{},...ne}),"stamp");d(O({phase:"attempt"}));let Ae=wr(s,r),Ie=Pr(Ae.signal,u.signal),A;try{A=await Ve({...Yt,signal:Ie.signal},e.auth);}catch(ne){A=y(Ke(ne));}finally{Ie.dispose(),Ae.cancel();}if(A.ok)return d(O({phase:"settled",ok:true,reason:"ok"})),A;let S=A.error,H=_r(S,te,{maxAttempts:Kt,rng:n,now:r.now(),aborted:u.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),re={ok:false,code:S.code,reason:H.reason,...S.httpStatus!==void 0?{httpStatus:S.httpStatus}:{},...S.requestId!==void 0?{requestId:S.requestId}:{}};if(!H.retry)return d(O({phase:"settled",...re})),y(S);if(d(O({phase:"retry",...re,delayMs:H.delayMs})),await o(H.delayMs,u.signal),u.signal?.aborted===true)return d(O({phase:"settled",...re,reason:"aborted"})),y(S);te+=1;}}i(p,"send");async function h(E){return D(E,await xr(e.auth))}i(h,"authorize");async function*R(E,u,_){d(Object.freeze({call:E,phase:"stream.open",method:u.method,path:u.path,attempt:0}));try{yield*e.auth.transport.stream(u,_);}catch{yield He({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(R,"stream"),Object.freeze({send:p,authorize:h,stream:R})}i(We,"createRequestFunnel");function hr(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==yr&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(hr,"assembleHeaders");function vr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(vr,"defaultIdempotencyKeyFactory");var Er=10;function _r(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Rr(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!ie(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=i(()=>{if(r.policy===void 0)return null;let p;try{p=r.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(Er,Math.floor(p)))},"policyCeiling"),l=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=Tr(e,r.now);return d!==null?d>pr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:d}:{retry:true,reason:o,delayMs:Be(t,r.rng)}}i(_r,"decideRetry");function Rr(e){let t=e.code==="unknown"?Le(Sr(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(Rr,"throttleKind");function Tr(e,t){let r=Cr(e.raw);if(r===null)return null;let n=r-t;return n>0?n:0}i(Tr,"retryOverrideMs");function Cr(e){for(let t of Ye(e)){let r=t.resets_at,n=kr(r);if(n!==null)return n}return null}i(Cr,"findResetsAt");function Ye(e){if(!Ge(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Ge(n)&&t.push(n);}return t}i(Ye,"candidateScopes");function kr(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}i(kr,"parseInstantMs");function Sr(e){for(let t of Ye(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(Sr,"rawWireCode");function Ge(e){return typeof e=="object"&&e!==null}i(Ge,"isRecord");async function xr(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(xr,"resolveDeviceAuth");function wr(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(wr,"boundedSignal");function Pr(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Pr,"mergeSignals");function Fr(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",a),n();},e),a=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",a,{once:true});})}i(Fr,"delayAbortable");var $e=Object.freeze({track(){},trackExpectedFailure(){}});function Je(e){let t={uri:e.uri,mimeType:e.mimeType},r=de(e);return r!==null&&(t.sizeBytes=r),Object.freeze(t)}i(Je,"fileHandleFromMedia");function de(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}i(de,"mediaByteSize");function Qe(e,t){return Object.freeze(t===void 0?{mode:e}:{mode:e,maxDurationSeconds:t})}i(Qe,"captureOptionsFor");function ue(e){return e!=null&&e.isAvailable===true}i(ue,"isCaptureAvailable");var Xe=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Ze(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},a=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",a),n();},"done");o.handle=r.setTimeout(a,e),t.addEventListener("abort",a,{once:true});})}i(Ze,"delayAbortable");function Or(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=i(()=>r.abort(),"onAbort");return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}i(Or,"mergeSignals");var ce=class ce{constructor(t){this.listeners=new Set;this.epoch=0;this.inFlight=null;this.snapshot=Object.freeze({...t});}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}getSnapshot(){return this.snapshot}patch(t){this.snapshot=Object.freeze({...this.snapshot,...t});for(let r of this.listeners)r();}beginOperation(t){this.inFlight?.abort();let r=new AbortController;this.inFlight=r;let n=this.epoch;return {signal:t?Or(r.signal,t):r.signal,epoch:n,settle:i(()=>{this.inFlight===r&&(this.inFlight=null);},"settle")}}alive(t){return t===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null;}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear();}};i(ce,"MediaStore");var G=ce;function et(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(et,"hasLoneSurrogate");var Ar=Object.freeze(["primary_label","primary_confidence","subtype_label","subtype_display","subtype_confidence","risk_tier","confidence_tier","copy_short","disease_name","disease_framing","model_version","skin_v2","eye_v2","llm_checkup"]),Ir=Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),zr=new Set(["skin_v2","eye_v2","llm_checkup"]),jr=new Set(["primary_confidence","subtype_confidence"]),Dr=new Set(["low_risk","concern","uncertain"]),Nr=new Set(["possible","probable"]),Lr=Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function tt(e){let t=v(e)?e:{},r={};for(let o of Ar){if(!(o in t))continue;let a=t[o],s=Mr(o,a);s!==P&&(r[o]=s);}let n=0;for(let o of Ir)o in t&&(n+=1);return Object.freeze({metadata:Object.freeze(r),droppedOperatorKeys:n})}i(tt,"projectDetectionMetadata");var P=Symbol("drop");function Mr(e,t){if(zr.has(e))return typeof t=="boolean"?t:P;if(jr.has(e))return rt(t)?t:P;if(e==="risk_tier")return typeof t=="string"&&Dr.has(t)?t:P;if(e==="confidence_tier")return typeof t=="string"&&Nr.has(t)?t:P;if(typeof t!="string")return P;let r=Lr[e]??256;return t.length>r?t.slice(0,r):t}i(Mr,"acceptKey");function rt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}i(rt,"isUnitConfidence");function nt(e){if(!v(e))return null;let t=m(e.summary),r=m(e.disclaimer),n=Ur(e.recommendations??e.recommendation);return t===null&&r===null&&n.length===0?null:Object.freeze({summary:t??"",recommendations:Object.freeze(n),disclaimer:r??""})}i(nt,"parseInterpretation");function ot(e){if(!v(e))return {};if(v(e.metadata))return e.metadata;let t=e.detections;if(Array.isArray(t)&&t.length>0){let r=t[0];if(v(r)&&v(r.metadata))return r.metadata;if(v(r))return r}return e}i(ot,"locateDetectionMetadata");function it(e){return v(e)?v(e.interpretation)?e.interpretation:e:null}i(it,"locateInterpretation");function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(v,"isRecord");function m(e){return typeof e=="string"&&e.length>0?e:null}i(m,"asString");function Ur(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}i(Ur,"asStringList");function at(e){return rt(e)?e:null}i(at,"asUnitNumber");function pe(e){return typeof e=="number"&&Number.isFinite(e)?e:null}i(pe,"asFiniteNumber");var N=Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:i(e=>et(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`,"job")});async function lt(e,t){let r={purpose:t.purpose,content_type:t.contentType};t.byteSize!==null&&(r.byte_size=t.byteSize);let n={method:"POST",path:N.initiate,body:r,...t.signal?{signal:t.signal}:{}},o=await e.send("media.initiateUpload",n);if(!o.ok)return y(o.error);let a=Br(o.value);return a===null?y(f("mediaUploadFailed",{retryable:false})):z(a)}i(lt,"initiateUpload");function Br(e){if(!v(e))return null;let t=m(e.url),r=m(e.s3_key);if(t===null||r===null)return null;let n=e.fields,o={};if(v(n))for(let[a,s]of Object.entries(n))typeof s=="string"&&(o[a]=s);return Object.freeze({url:t,fields:Object.freeze(o),s3Key:r,expiresAt:pe(e.expires_at)})}i(Br,"parsePresigned");async function dt(e,t,r,n,o){try{return await e.presignedPut(Je(t),{target:r,idempotencyKey:n,...o?{signal:o}:{}}),z(void 0)}catch{return y(f("mediaUploadFailed",{retryable:false}))}}i(dt,"stageUpload");async function ut(e,t){let r={method:"POST",path:N.precheck,body:{s3_key:t.s3Key,type:t.type},...t.signal?{signal:t.signal}:{}},n=await e.send("media.precheck",r);return n.ok?qr(n.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}i(ut,"runPrecheck");function qr(e){if(!v(e))return {verdict:"proceed",reasonCodes:[],precheckToken:null};let t=m(e.verdict),r=t==="retake"||t==="reject"?t:"proceed",n=Array.isArray(e.reason_codes)?e.reason_codes.filter(o=>typeof o=="string"):[];return Object.freeze({verdict:r,reasonCodes:Object.freeze(n),precheckToken:m(e.precheck_token)})}i(qr,"parsePrecheck");async function ct(e,t,r,n,o){let a={method:"POST",path:t,body:r,...o?{signal:o}:{}},s=await e.send("media.analyze",a);if(s.ok){let d=Hr(s.value);return d!==null?{kind:"async",job:d}:{kind:"sync",body:s.value}}let l=n(s.error.httpStatus,s.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:s.error}}i(ct,"submitAnalyze");function Hr(e){if(!v(e))return null;let t=m(e.job_id);if(t===null)return null;let r=m(e.status);return r!==null&&Wr(r)?null:Object.freeze({jobId:t,estimatedSeconds:pe(e.estimated_completion_seconds)})}i(Hr,"parseAsyncJob");var Vr=2e3,st=5e3,Kr=9e4;async function pt(e,t,r){let{timers:n,signal:o,alive:a}=r,s=n.now(),l=Math.max(Kr,(r.estimatedSeconds??0)*1e3),d=Vr;for(;;){if(o.aborted||!a())return {kind:"aborted"};if(await Ze(d,o,n),o.aborted||!a())return {kind:"aborted"};if(n.now()-s>l)return {kind:"timeout"};let p=N.job(t);if(p===null)return {kind:"notFound"};let h=await e.send("media.pollJob",{method:"GET",path:p,...o?{signal:o}:{}},{maxAttempts:1});if(o.aborted||!a())return {kind:"aborted"};if(!h.ok){if(h.error.httpStatus===404)return {kind:"notFound"};d=Math.min(st,d+1e3);continue}let R=Gr(h.value);if(R==="COMPLETED")return {kind:"complete",body:h.value};if(R==="FAILED")return {kind:"failed",error:Yr(h.value)};d=Math.min(st,d+1e3);}}i(pt,"pollJob");function Gr(e){return v(e)?(m(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}i(Gr,"jobStatusOf");function Wr(e){let t=e.toUpperCase();return t==="COMPLETED"||t==="FAILED"}i(Wr,"isTerminalStatus");function Yr(e){let t=v(e)?m(e.error)??m(e.error_code):null;return f("internalError",{retryable:false,...t?{wireMessage:t}:{}})}i(Yr,"jobFailureError");function yt(e,t){return e===422?{kind:"species_unsupported",species:"cat"}:e===400?{kind:"pet_context_required"}:null}i(yt,"detectPhotoGate");function ft(e,t){let r={s3_key:e};return t.type!==void 0&&(r.type=t.type),t.petRef!=null&&(r.pet_id=t.petRef),t.precheckToken!=null&&(r.precheck_token=t.precheckToken),r}i(ft,"analyzeBody");var L=Object.freeze({kind:"accepted"});function mt(e){return new ye(e)}i(mt,"createPhotoController");var fe=class fe extends G{constructor(t){super({status:"idle",region:t.region??"skin",result:null,gate:L,error:null,isCaptureAvailable:ue(t.camera)}),this.funnel=t.funnel??We({auth:t.auth,...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}}),this.camera=t.camera,this.upload=t.upload,this.telemetry=t.telemetry??$e,this.timers=t.timers??Xe,this.makeIdempotencyKey=t.makeIdempotencyKey??Xr();}async capture(t,r){if(!ue(this.camera))return y(f("unknown",{retryable:false}));let n;try{n=await this.camera.capture(Qe("photo"));}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),y(f("unknown",{retryable:false}))}return this.analyze(n,t,r)}async analyze(t,r,n){let o=this.beginOperation(n.signal),a=this.makeIdempotencyKey(),s=this.timers.now();this.patch({status:"capturing",region:r,error:null,result:null,gate:L});try{let l=await lt(this.funnel,{purpose:"skin_scan",contentType:t.mimeType,byteSize:de(t),signal:o.signal});if(o.signal.aborted||!this.alive(o.epoch))return T();if(!l.ok)return this.fail(o,l.error);let d=await dt(this.upload,t,l.value,a,o.signal);if(o.signal.aborted||!this.alive(o.epoch))return T();if(!d.ok)return this.fail(o,d.error);let p=await ut(this.funnel,{s3Key:l.value.s3Key,type:r,signal:o.signal});if(o.signal.aborted||!this.alive(o.epoch))return T();if(p.verdict!=="proceed")return this.gateRetake(o,r,p.reasonCodes);this.patch({status:"analyzing"});let h=await ct(this.funnel,N.photoAnalyze,ft(l.value.s3Key,{type:r,petRef:n.petRef,precheckToken:p.precheckToken}),yt,o.signal);if(o.signal.aborted||!this.alive(o.epoch))return T();switch(h.kind){case "error":return this.fail(o,h.error);case "gate":return this.gateDomain(o,r,h.gate);case "sync":return this.complete(o,h.body,r,null,s);case "async":{let R=await pt(this.funnel,h.job.jobId,{timers:this.timers,signal:o.signal,alive:i(()=>this.alive(o.epoch),"alive"),estimatedSeconds:h.job.estimatedSeconds});if(o.signal.aborted||!this.alive(o.epoch))return T();switch(R.kind){case "aborted":return T();case "complete":return this.complete(o,R.body,r,h.job.jobId,s);case "failed":return this.fail(o,R.error);case "timeout":return this.fail(o,f("streamTimeout",{retryable:!0}));case "notFound":return this.fail(o,f("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(o,f("internalError",{retryable:!1}))}}default:return this.fail(o,f("internalError",{retryable:!1}))}}finally{o.settle();}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:L,error:null});}complete(t,r,n,o,a){if(!this.alive(t.epoch))return T();let s=$r(r,n,o);return s.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:s.droppedOperatorKeys}),this.patch({status:"complete",result:s.result,gate:L,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:n}),this.telemetry.track("analysis.result",{capability:"photo",region:n,riskTier:s.result.riskTier??"",confidenceTier:s.result.confidenceTier??"",modelVersion:s.result.modelVersion??"",timeToResultMs:this.timers.now()-a}),z(s.result)}gateDomain(t,r,n){if(!this.alive(t.epoch))return T();let o=n.kind==="species_unsupported"?Object.freeze({kind:"species_unsupported",species:"cat"}):Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:o,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:n.kind,region:r,...n.kind==="species_unsupported"?{species:"cat"}:{}}),y(f("unknown",{retryable:false}))}gateRetake(t,r,n){if(!this.alive(t.epoch))return T();this.patch({status:"idle",gate:Object.freeze({kind:"retake",reasons:Object.freeze([...n])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:n});let o=n.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:o,region:r}),y(f("unknown",{retryable:false}))}fail(t,r){return this.alive(t.epoch)?(this.patch({status:"error",error:r,gate:L}),this.telemetry.trackExpectedFailure("analysis.error",{code:r.code,...r.httpStatus!==void 0?{httpStatus:r.httpStatus}:{}}),y(r)):T()}};i(fe,"PhotoController");var ye=fe;function $r(e,t,r){let n=tt(ot(e)),o=n.metadata,a=nt(it(e));return {result:Object.freeze({jobId:r,analysisType:t,primaryLabel:m(o.primary_label)??"Uncertain",riskTier:Jr(o.risk_tier),confidence:at(o.primary_confidence),subtypeDisplay:m(o.subtype_display),confidenceTier:Qr(o.confidence_tier),diseaseName:m(o.disease_name),diseaseFraming:m(o.disease_framing),copyShort:m(o.copy_short),interpretation:a,modelVersion:m(o.model_version)??(v(e)?m(e.model_version):null)}),droppedOperatorKeys:n.droppedOperatorKeys}}i($r,"mapPhotoResult");function Jr(e){return e==="low_risk"||e==="concern"||e==="uncertain"?e:null}i(Jr,"asRiskTier");function Qr(e){return e==="possible"||e==="probable"?e:null}i(Qr,"asConfidenceTier");function T(){return y(f("unknown",{retryable:false}))}i(T,"abortedResult");function Xr(){let e=0;return ()=>`photo-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}i(Xr,"defaultIdempotencyFactory");var bt=Symbol.for("@everfur/sdk#EverfurContext@v1"),gt=globalThis,ht=gt[bt]??(gt[bt]=react.createContext(null));ht.displayName??="EverfurContext";function W(){let e=react.useContext(ht);if(e===null)throw new I("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(W,"useEverfurContext");var an=Object.freeze({status:"idle",region:"skin",result:null,gate:Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),sn=i(()=>{},"NOOP_UNSUBSCRIBE");function me(e){let{runtime:t,userRef:r,scopeEpoch:n}=W(),o=e.petRef,[a,s]=react.useState(null);react.useEffect(()=>{let{services:u}=t.registry,_=t.registry.acquire("photo",`${r??""}|${o}`,()=>mt({...u.errorPolicy?{errorPolicy:u.errorPolicy}:{},auth:u.authFor(r),camera:u.camera,upload:u.upload,telemetry:u.telemetry}),k=>k.dispose());return s(_),()=>{s(k=>k===_?null:k),t.registry.release(_);}},[t,r,o,n]);let l=react.useCallback(u=>a?a.subscribe(u):sn,[a]),d=react.useCallback(()=>a?a.getSnapshot():an,[a]),p=react.useSyncExternalStore(l,d,d),h=react.useCallback((u,_)=>a?a.analyze(u,_,{petRef:o}):Promise.resolve(vt()),[a,o]),R=react.useCallback(u=>a?a.capture(u,{petRef:o}):Promise.resolve(vt()),[a,o]),E=react.useCallback(()=>{a?.reset();},[a]);return react.useMemo(()=>({status:p.status,region:p.region,result:p.result,gate:p.gate,error:p.error,isCaptureAvailable:p.isCaptureAvailable,isBootstrapping:a===null,analyze:h,capture:R,reset:E}),[p,a,h,R,E])}i(me,"usePhotoCheckup");function vt(){return y(f("internalError",{retryable:true}))}i(vt,"notReadyError");function he(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))he(e[t]);}return e}i(he,"deepFreeze");var ln=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),_t={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Rt={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Et={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},dn={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},un={regular:"400",medium:"500",bold:"700"},cn={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},pn=0,Y="System",$="monospace",yn=["content","heading","control","compact","badge"];function fn(e){let t={};for(let r of yn)t[r]=e;return t}i(fn,"authoredTierSizes");function Tt(){return {family:Y,mono:$,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:$,monoMedium:$,monoBold:$},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Et,tierSizes:fn(Et),lineHeight:dn,weight:un,letterSpacing:cn,scale:1,maxScale:pn,scaleCaps:ln}}i(Tt,"baseType");var Ct={},be=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function ge(e){return `cubic-bezier(${e.join(", ")})`}i(ge,"cssCubicBezier");var kt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:ge(be.standard),emphasized:ge(be.emphasized),exit:ge(be.exit)},reducedMotion:false},mn={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},St=he({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:mn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct}),bn={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};he({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:bn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct});var xt=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wt=globalThis,ve=wt[xt]??(wt[xt]=react.createContext(St));ve.displayName??="EverfurThemeContext";function g(){return react.useContext(ve)}i(g,"useEverfurTheme");function Rn(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(Rn,"tierMultiplier");function b({tier:e="content",...t}){let{type:r}=g(),n=Rn(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(b,"Text");react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var Tn=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function U(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Tn[t]]}}i(U,"face");var Re=class Re extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(Re,"HostRenderBoundary");var Ee=Re;function kn({render:e}){return e()}i(kn,"RenderHost");function _e({render:e,fallback:t,resetKey:r}){return react.createElement(Ee,{fallback:t,resetKey:r,children:react.createElement(kn,{render:e})})}i(_e,"HostRender");var Sn=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function xn(e){return Sn[e]}i(xn,"requires");function Ot(e,t,r){let n=xn(e),o=new Map;for(let l of t)o.set(l.resource,l);if(r?.isPending===true&&n.some(l=>!o.has(l)))return Te({name:e,enabled:false,isPending:true,limits:{}});let a=wn(n,o);return n.filter(l=>o.get(l)?.granted!==true).length===0?Te({name:e,enabled:true,isPending:false,limits:a}):Te({name:e,enabled:false,isPending:false,limits:a,disabled:Pn(n,o)})}i(Ot,"decideCapability");function wn(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[a,s]of Object.entries(o)){let l=r[a];r[a]=l===void 0?s:Math.min(l,s);}}return r}i(wn,"mergeLimits");function Pn(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:se("accessDenied"),level:"user_entitlement",recoverable:false})}i(Pn,"disabledFor");function Te(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(Te,"freezeDecision");function Ce(e){let{runtime:t}=W(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>Ot(e,n.decisions,{isPending:n.isPending}),[e,n])}i(Ce,"useCapability");var An=48;function In(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(In,"selectView");function jt(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:a}=e,s=Ce(t),l=react.useMemo(()=>In(s),[s]);switch(l){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(_e,{render:o,fallback:jsxRuntime.jsx(It,{capability:t,style:a})}):jsxRuntime.jsx(It,{capability:t,style:a});case "disabled":return n?jsxRuntime.jsx(_e,{render:()=>n(s),fallback:jsxRuntime.jsx(zt,{decision:s,style:a}),resetKey:s}):jsxRuntime.jsx(zt,{decision:s,style:a});default:return j(l)}}i(jt,"CapabilityGate");function It({capability:e,style:t}){let r=g(),n=react.useMemo(()=>Dt(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(It,"PendingSkeleton");function zt({decision:e,style:t}){let r=g(),n=react.useMemo(()=>Dt(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(b,{style:n.offstateText,children:o}):null})}i(zt,"OffState");function Dt(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:An,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...U(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(Dt,"makeStyles");var B=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Mt(e){let t=g(),r=react.useMemo(()=>Dn(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${B.title}. ${B.body}`,children:[jsxRuntime.jsx(b,{style:r.title,children:B.title}),jsxRuntime.jsx(b,{style:r.body,children:B.body})]})}i(Mt,"ClinicalDisclaimer");function Dn(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...U(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...U(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(Dn,"makeStyles");var Vn=1400,Kn=300;function Bt(){let e=g(),t=react.useMemo(()=>Gn(e),[e]),r=e.motion.reducedMotion,[n,o]=react.useState(false);react.useEffect(()=>{let l=setTimeout(()=>o(true),Kn);return ()=>clearTimeout(l)},[]);let a=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{if(r||!n)return;let l=reactNative.Animated.loop(reactNative.Animated.timing(a,{toValue:1,duration:Vn,easing:reactNative.Easing.linear,useNativeDriver:true}));return l.start(),()=>l.stop()},[r,n,a]);let s=r?null:{transform:[{rotate:a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};return jsxRuntime.jsx(reactNative.View,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[t.ring,s]}),jsxRuntime.jsx(b,{style:t.statusLine,children:"Analyzing"})]}):null})}i(Bt,"AnalyzingIndicator");function Gn(e){let{color:t,space:r,radius:n,type:o}=e,a=o.weight.medium,s=r.xxl*2,l=r.xs;return reactNative.StyleSheet.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.md},ring:{width:s,height:s,borderRadius:n.pill,borderWidth:l,borderTopColor:t.success,borderRightColor:t.success,borderBottomColor:t.borderRingCream,borderLeftColor:t.borderRingCream},statusLine:{color:t.text.secondary,fontFamily:o.family,fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,fontWeight:a,letterSpacing:o.letterSpacing.tight,textAlign:"center"}})}i(Gn,"makeStyles");var Zn=1100,eo=1.6,to=.35;function ro(e,t){let{color:r}=e;switch(t){case "low_risk":return {accent:r.success,wash:r.badgeBgPositive,label:"Low risk",pulse:false};case "concern":return {accent:r.cautionAccent,wash:r.badgeBgCaution,label:"Concern",pulse:true};case "uncertain":return {accent:r.text.muted,wash:r.badgeBgNeutral,label:"Uncertain",pulse:false}}}i(ro,"toneSpec");function Vt({riskTier:e}){let t=g(),r=react.useMemo(()=>no(t),[t]),n=react.useRef(new reactNative.Animated.Value(0)).current,o=e===null?null:ro(t,e),a=o!==null&&o.pulse&&!t.motion.reducedMotion;return react.useEffect(()=>{if(!a)return;let s=reactNative.Animated.loop(reactNative.Animated.timing(n,{toValue:1,duration:Zn,easing:reactNative.Easing.out(reactNative.Easing.quad),useNativeDriver:true}));return s.start(),()=>s.stop()},[a,n]),o===null?null:jsxRuntime.jsxs(reactNative.View,{style:[r.pill,{backgroundColor:o.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:o.label,children:[jsxRuntime.jsxs(reactNative.View,{style:r.dotWrap,children:[a?jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:o.accent,opacity:n.interpolate({inputRange:[0,1],outputRange:[to,0]}),transform:[{scale:n.interpolate({inputRange:[0,1],outputRange:[1,eo]})}]}]}):null,jsxRuntime.jsx(reactNative.View,{style:[r.dot,{backgroundColor:o.accent}]})]}),jsxRuntime.jsx(b,{style:[r.label,{color:o.accent}],children:o.label})]})}i(Vt,"SeverityBadge");function no(e){let{space:t,radius:r,type:n}=e,o=n.weight.bold,a=t.sm;return reactNative.StyleSheet.create({pill:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:t.sm,paddingHorizontal:t.md,paddingVertical:t.xs,borderRadius:r.pill},dotWrap:{width:a,height:a,alignItems:"center",justifyContent:"center"},dot:{width:a,height:a,borderRadius:r.pill},dotRing:{position:"absolute",width:a,height:a,borderRadius:r.pill},label:{fontFamily:n.family,fontSize:n.size.caption,lineHeight:n.size.caption*n.lineHeight.snug,fontWeight:o,letterSpacing:n.letterSpacing.eyebrow}})}i(no,"makeStyles");var Fe=120,Z=44;function io(e){let{petRef:t,region:r,style:n}=e;return jsxRuntime.jsx(jt,{capability:"photo",style:n,children:jsxRuntime.jsx(so,{petRef:t,region:r,style:n})})}i(io,"PhotoCheckup");function ao(e){return e.isBootstrapping||e.status==="capturing"||e.status==="analyzing"?"loading":e.status==="error"&&e.error?"error":e.status==="complete"&&e.result?"populated":e.gate.kind!=="accepted"?"gate":e.isCaptureAvailable?"empty":"native"}i(ao,"selectView");function so({petRef:e,region:t,style:r}){let n=me({petRef:e}),o=t??"skin",a=ao(n),s=react.useMemo(()=>()=>{n.capture(o);},[n,o]),l=g(),d=react.useMemo(()=>F(l),[l]);return jsxRuntime.jsxs(reactNative.View,{style:[d.container,r],children:[jsxRuntime.jsx(reactNative.View,{style:d.body,children:lo(a,n,s)}),jsxRuntime.jsx(Mt,{})]})}i(so,"PhotoBody");function lo(e,t,r){switch(e){case "loading":return jsxRuntime.jsx(Bt,{});case "native":return jsxRuntime.jsx(uo,{});case "empty":return jsxRuntime.jsx(co,{onCapture:r});case "error":return jsxRuntime.jsx(po,{error:t.error,onRetry:r});case "gate":return jsxRuntime.jsx(yo,{gate:t.gate,onRetry:t.reset});case "populated":return jsxRuntime.jsx(mo,{result:t.result});default:return j(e)}}i(lo,"renderView");function uo(){let e=g(),t=react.useMemo(()=>F(e),[e]);return jsxRuntime.jsx(reactNative.View,{style:t.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:jsxRuntime.jsx(reactNative.View,{style:t.emptyGlyph})})}i(uo,"NativeUnavailableState");function co({onCapture:e}){let t=g(),r=react.useMemo(()=>F(t),[t]);return jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Take a photo to check",children:jsxRuntime.jsx(reactNative.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Take photo",style:r.scanButton,children:jsxRuntime.jsx(b,{style:r.scanLabel,children:"Take photo"})})})}i(co,"EmptyState");function po({error:e,onRetry:t}){let r=g(),n=react.useMemo(()=>F(r),[r]);return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(b,{style:n.errorText,children:e.displayMessage}),e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:jsxRuntime.jsx(b,{style:n.primaryLabel,children:"Try again"})}):null]})}i(po,"ErrorState");function yo({gate:e,onRetry:t}){let r=g(),n=react.useMemo(()=>F(r),[r]),o=fo(e);return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:o,children:[jsxRuntime.jsx(b,{style:n.guidanceText,children:o}),e.kind!=="species_unsupported"?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:jsxRuntime.jsx(b,{style:n.primaryLabel,children:"Try again"})}):null]})}i(yo,"GateState");function fo(e){switch(e.kind){case "species_unsupported":return "Photo checks are coming soon for this pet.";case "pet_context_required":return "Choose a pet first, then take the photo.";case "retake":return "That photo was hard to read. Please take another.";case "accepted":return "";default:return j(e)}}i(fo,"gateMessage");function mo({result:e}){let t=g(),r=react.useMemo(()=>F(t),[t]),n=e.subtypeDisplay??e.diseaseName??e.primaryLabel,o=bo(t,e.riskTier);return jsxRuntime.jsxs(reactNative.ScrollView,{style:r.list,contentContainerStyle:[r.listContent,{backgroundColor:o}],accessibilityLabel:"Photo checkup result",children:[jsxRuntime.jsx(b,{style:r.resultHeadline,children:n}),jsxRuntime.jsx(Vt,{riskTier:e.riskTier}),e.diseaseFraming?jsxRuntime.jsx(b,{style:r.summaryText,children:e.diseaseFraming}):null,e.copyShort?jsxRuntime.jsx(b,{style:r.summaryText,children:e.copyShort}):null,e.interpretation?jsxRuntime.jsxs(reactNative.View,{style:r.interpretationBlock,children:[jsxRuntime.jsx(b,{style:r.summaryText,children:e.interpretation.summary}),jsxRuntime.jsx(b,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]})}i(mo,"ResultState");function bo(e,t){switch(t){case "low_risk":return e.color.checkupCardLowRiskBg;case "concern":return e.color.checkupCardConcernBg;default:return e.color.surfaceCream}}i(bo,"resultCardTint");function F(e){let{color:t,space:r,radius:n,type:o}=e,a=o.weight.bold,s=o.weight.medium,l=o.weight.regular,d=e.brightness==="dark"?t.onAccent:t.brand;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Fe,backgroundColor:t.background},body:{flex:1},centered:{minHeight:Fe,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},offstate:{minHeight:Fe,alignItems:"center",justifyContent:"center",padding:r.xl},emptyGlyph:{width:r.xxl,height:r.xxl,borderRadius:n.pill,backgroundColor:t.surfaceSubtle,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},scanButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.md,borderRadius:n.pill,backgroundColor:t.scanButtonPink,shadowColor:t.brand,shadowOpacity:.18,shadowRadius:n.xs,shadowOffset:{width:0,height:r.xs},elevation:3},scanLabel:{color:d,fontFamily:o.family,fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,fontWeight:a,letterSpacing:o.letterSpacing.tight},primaryButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand},primaryLabel:{color:t.onPrimary,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,fontWeight:s},errorText:{color:t.danger,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},guidanceText:{color:t.text.muted,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},list:{flex:1},listContent:{padding:r.lg,gap:r.sm,borderRadius:n.lg,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,shadowColor:t.brand,shadowOpacity:.08,shadowRadius:n.xs,shadowOffset:{width:0,height:r.xs},elevation:2},resultHeadline:{color:t.text.secondary,fontFamily:o.family,fontSize:o.size.verdict,lineHeight:o.size.verdict*o.lineHeight.tight,fontWeight:a,letterSpacing:o.letterSpacing.tight},summaryText:{color:t.text.primary,fontFamily:o.family,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.relaxed,fontWeight:l},interpretationBlock:{marginTop:r.sm,paddingTop:r.sm,gap:r.xs,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen},disclaimerText:{color:t.text.muted,fontFamily:o.family,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,fontWeight:l}})}i(F,"makeStyles");exports.PhotoCheckup=io;exports.usePhotoCheckup=me;