@everfur/sdk 1.4.0 → 1.5.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.
- package/README.md +2 -2
- package/dist/{Chat.d-BXuEjJsg.d.ts → Chat.d-BCfyvzX8.d.ts} +1 -1
- package/dist/{Chat.d-D9n8tSDD.d.cts → Chat.d-Od44h51D.d.cts} +1 -1
- package/dist/{DepthViews.d-PmjccZLr.d.cts → DepthViews.d-BGspxovy.d.cts} +1 -1
- package/dist/{DepthViews.d-aOChkwU2.d.ts → DepthViews.d-BIHVrf9r.d.ts} +1 -1
- package/dist/{DepthViews.d-ktxIIsnb.d.cts → DepthViews.d-BaLh7Lsi.d.cts} +1 -1
- package/dist/{DepthViews.d-CpF_Y_z9.d.ts → DepthViews.d-CEVk9poG.d.ts} +1 -1
- package/dist/ErrorPolicyPort.d-BIdmYQnk.d.cts +43 -0
- package/dist/ErrorPolicyPort.d-BnI5qWg4.d.ts +43 -0
- package/dist/{RecordsPage.d-BfMSOsg_.d.ts → RecordsPage.d-D10RIgdc.d.ts} +1 -1
- package/dist/{RecordsPage.d-DWjFpZs1.d.cts → RecordsPage.d-DbhYNSbq.d.cts} +1 -1
- package/dist/animations/index.cjs +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/animations/index.js +1 -1
- package/dist/{attachments.d-DjWUR-h9.d.ts → attachments.d-BlukNfIf.d.ts} +2 -2
- package/dist/{attachments.d-Bsg6duaq.d.cts → attachments.d-CF4lLuGK.d.cts} +2 -2
- package/dist/{bookingCopy.d-ITpabqPr.d.ts → bookingCopy.d-BuDv16WP.d.ts} +12 -12
- package/dist/{bookingCopy.d-B39JAmIZ.d.cts → bookingCopy.d-rnBSqOSN.d.cts} +12 -12
- package/dist/{branding.d-Bzs4HJoN.d.cts → branding.d-CqDLKj1U.d.cts} +1 -1
- package/dist/{branding.d-CiC6xfGT.d.ts → branding.d-XrZYClN4.d.ts} +1 -1
- package/dist/{callCopy.d-Bw6oZT54.d.cts → callCopy.d-BQxpwXqT.d.cts} +3 -3
- package/dist/{callCopy.d-Bw6oZT54.d.ts → callCopy.d-BQxpwXqT.d.ts} +3 -3
- package/dist/{callRoom.d-B1DoYdJe.d.cts → callRoom.d-9Dm7XnUr.d.cts} +1 -1
- package/dist/{callRoom.d-Dqm1rUqT.d.ts → callRoom.d-t-khijDv.d.ts} +1 -1
- package/dist/{casesRepository.d-De4ZtgJ_.d.cts → casesRepository.d-CVuKTkJo.d.cts} +1 -1
- package/dist/{casesRepository.d-DsEeFd0F.d.ts → casesRepository.d-Dn1fK1b2.d.ts} +1 -1
- package/dist/chat/index.cjs +195 -195
- package/dist/chat/index.d.cts +14 -14
- package/dist/chat/index.d.ts +14 -14
- package/dist/chat/index.js +203 -203
- package/dist/chat/lite/index.cjs +206 -206
- package/dist/chat/lite/index.d.cts +14 -14
- package/dist/chat/lite/index.d.ts +14 -14
- package/dist/chat/lite/index.js +206 -206
- package/dist/{chatHandoffToken.d-sbumx0He.d.cts → chatHandoffToken.d-BjfmIxXk.d.cts} +7 -7
- package/dist/{chatHandoffToken.d-YJY6TZbj.d.ts → chatHandoffToken.d-CFiI6IMc.d.ts} +7 -7
- package/dist/{checkin.d-DxpoRutq.d.cts → checkin.d-BP3ZWBfX.d.cts} +19 -7
- package/dist/{checkin.d-C6vh9KVr.d.ts → checkin.d-CokpahFL.d.ts} +19 -7
- package/dist/{chunk-FZ6DAQFH.js → chunk-4KFFE42Z.js} +20 -20
- package/dist/{chunk-ZPIOCHKW.js → chunk-6IHY7HS7.js} +1 -1
- package/dist/{chunk-II4QDD6F.js → chunk-BMYNDBUR.js} +1 -1
- package/dist/{chunk-AJEELSFO.js → chunk-HHCGXQJR.js} +13 -13
- package/dist/client/index.cjs +31 -31
- package/dist/client/index.d.cts +24 -21
- package/dist/client/index.d.ts +24 -21
- package/dist/client/index.js +31 -31
- package/dist/{clinicBatch.d-B3YJc8IO.d.cts → clinicBatch.d-C0xx5L4j.d.cts} +3 -3
- package/dist/{clinicBatch.d-DhvQuPHV.d.ts → clinicBatch.d-DNi4UURs.d.ts} +3 -3
- package/dist/{config.d-DRoQ2lAx.d.ts → config.d-B7Z-KTGq.d.ts} +10 -2
- package/dist/{config.d-BiVy0fLx.d.cts → config.d-ClAI2RZ6.d.cts} +10 -2
- package/dist/consent/index.cjs +1 -1
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/consent/index.js +2 -2
- package/dist/{context.d-Cq2C4vdh.d.cts → context.d-Bj6-xYPA.d.cts} +13 -7
- package/dist/{context.d-D1l56nFr.d.ts → context.d-DS1GXUEY.d.ts} +13 -7
- package/dist/{copy.d-Ce_8KuZg.d.cts → copy.d--F5A9cXK.d.cts} +3 -3
- package/dist/{copy.d-BP36f_63.d.ts → copy.d-DmxuFJFe.d.ts} +3 -3
- package/dist/core/index.cjs +42 -41
- package/dist/core/index.d.cts +20 -20
- package/dist/core/index.d.ts +20 -20
- package/dist/core/index.js +42 -41
- package/dist/{depth.d-DzMMmRN4.d.ts → depth.d-CgzYE6_n.d.ts} +3 -3
- package/dist/{depth.d-BtlcIqPJ.d.cts → depth.d-DLaP0o8Y.d.cts} +3 -3
- package/dist/{entitlementRepository.d-x2YFdgYD.d.ts → entitlementRepository.d-CkUTlVAb.d.ts} +3 -3
- package/dist/{entitlementRepository.d-CEDU1gZE.d.cts → entitlementRepository.d-DVTp-BB9.d.cts} +3 -3
- package/dist/{focus.d-BX7oahFk.d.cts → focus.d-CLTjm6In.d.cts} +1 -1
- package/dist/{focus.d-armXecf0.d.ts → focus.d-u-HYvim0.d.ts} +1 -1
- package/dist/health-plan/index.cjs +1 -1
- package/dist/health-plan/index.d.cts +17 -17
- package/dist/health-plan/index.d.ts +17 -17
- package/dist/health-plan/index.js +1 -1
- package/dist/{healthPlanRepository.d-DBx7-NLE.d.cts → healthPlanRepository.d-B22kjrYa.d.cts} +3 -3
- package/dist/{healthPlanRepository.d-C7K9dJK5.d.ts → healthPlanRepository.d-CwRXeoM7.d.ts} +3 -3
- package/dist/{idempotency.d-Dak2-pON.d.cts → idempotency.d-CFVMhWcv.d.cts} +1 -1
- package/dist/{idempotency.d-symqJ8Tt.d.ts → idempotency.d-dOFfV91-.d.ts} +1 -1
- package/dist/{identity.d-DOKJFaiz.d.ts → identity.d-D4VtpqRr.d.ts} +1 -1
- package/dist/{identity.d-DIH9h3Le.d.cts → identity.d-DDpXOtas.d.cts} +1 -1
- package/dist/{inbox.d-AuGKeaZv.d.cts → inbox.d-CPcMMz-Y.d.cts} +2 -2
- package/dist/{inbox.d-B5b57OXc.d.ts → inbox.d-DJ9xgU1Z.d.ts} +2 -2
- package/dist/index.cjs +248 -247
- package/dist/index.d.cts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +247 -246
- package/dist/{introEvents.d-ehik7PEn.d.cts → introEvents.d-B7acmGwf.d.cts} +1 -1
- package/dist/{introEvents.d-S4Q4BOSt.d.ts → introEvents.d-DW3gLljE.d.ts} +1 -1
- package/dist/{layout.d-Bm2_1wa4.d.ts → layout.d-C8y_ki1V.d.ts} +1 -1
- package/dist/{layout.d-CFF-nBXf.d.cts → layout.d-DfaFM_lp.d.cts} +1 -1
- package/dist/{models.d-DOwpK1ZF.d.ts → models.d-BKmOfoqV.d.cts} +2 -2
- package/dist/{models.d-Su_BBBTW.d.cts → models.d-BULqCO2R.d.ts} +2 -2
- package/dist/notifications/inbox/index.cjs +9 -9
- package/dist/notifications/inbox/index.d.cts +7 -7
- package/dist/notifications/inbox/index.d.ts +7 -7
- package/dist/notifications/inbox/index.js +9 -9
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +8 -8
- package/dist/notifications/index.d.ts +8 -8
- package/dist/notifications/index.js +6 -6
- package/dist/{optInView.d-DbGx1A9R.d.cts → optInView.d-ByDJMrMv.d.cts} +13 -13
- package/dist/{optInView.d-xnIxCLlH.d.ts → optInView.d-DVshLxbD.d.ts} +13 -13
- package/dist/{parse.d-DtHmpAMT.d.cts → parse.d-BDZ7ffgj.d.cts} +4 -1
- package/dist/{parse.d-DtHmpAMT.d.ts → parse.d-BDZ7ffgj.d.ts} +4 -1
- package/dist/{pets.d-BEqKykpu.d.ts → pets.d-BpLObpfM.d.ts} +1 -1
- package/dist/{pets.d-BS6sLxY-.d.cts → pets.d-DXhzTNuI.d.cts} +1 -1
- package/dist/{petsRepository.d-iHrHkXM2.d.ts → petsRepository.d-_QfM7F6T.d.ts} +1 -1
- package/dist/{petsRepository.d-DB5CNKsK.d.cts → petsRepository.d-ai_tZ3lu.d.cts} +1 -1
- package/dist/photo/index.cjs +1 -1
- package/dist/photo/index.js +23 -23
- package/dist/{presentation.d-CWGjwq8Z.d.cts → presentation.d-BkIvMtIl.d.cts} +3 -3
- package/dist/{presentation.d-CWGjwq8Z.d.ts → presentation.d-BkIvMtIl.d.ts} +3 -3
- package/dist/records/depth/index.cjs +1 -1
- package/dist/records/depth/index.d.cts +10 -10
- package/dist/records/depth/index.d.ts +10 -10
- package/dist/records/depth/index.js +1 -1
- package/dist/records/index.cjs +2 -2
- package/dist/records/index.d.cts +13 -13
- package/dist/records/index.d.ts +13 -13
- package/dist/records/index.js +71 -71
- package/dist/{requestFunnel.d-SySe6xHp.d.cts → requestFunnel.d-BwZDfWVD.d.cts} +3 -3
- package/dist/{requestFunnel.d-CehftayS.d.ts → requestFunnel.d-DKBPTpsy.d.ts} +3 -3
- package/dist/{route.d-9wclfD-y.d.cts → route.d-DCzQh4ix.d.cts} +3 -3
- package/dist/{route.d-IP_gkOWL.d.ts → route.d-DSYEd2MR.d.ts} +3 -3
- package/dist/{runtimeTypes.d-BdUe3tYs.d.ts → runtimeTypes.d-BzUig75K.d.ts} +15 -11
- package/dist/{runtimeTypes.d-_UZ6rMUY.d.cts → runtimeTypes.d-CL4l7ta4.d.cts} +15 -11
- package/dist/{screenProps.d-Bd2yphad.d.cts → screenProps.d-6xmE1C-V.d.cts} +2 -2
- package/dist/{screenProps.d-D9Vi-Afl.d.ts → screenProps.d-fHBKArt_.d.ts} +2 -2
- package/dist/{sdkConfigStore.d-VPvsIL8E.d.ts → sdkConfigStore.d-BNCVVEWC.d.ts} +1 -1
- package/dist/{sdkConfigStore.d-BHrzkVpP.d.cts → sdkConfigStore.d-C2BAr9kI.d.cts} +1 -1
- package/dist/server/events/index.cjs +4 -4
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +4 -4
- package/dist/server/index.cjs +9 -9
- package/dist/server/index.d.cts +18 -4
- package/dist/server/index.d.ts +18 -4
- package/dist/server/index.js +9 -9
- package/dist/shop/index.d.cts +3 -3
- package/dist/shop/index.d.ts +3 -3
- package/dist/slots/index.cjs +1 -1
- package/dist/slots/index.d.cts +6 -6
- package/dist/slots/index.d.ts +6 -6
- package/dist/slots/index.js +1 -1
- package/dist/tabs/index.cjs +88 -85
- package/dist/tabs/index.d.cts +15 -15
- package/dist/tabs/index.d.ts +15 -15
- package/dist/tabs/index.js +87 -84
- package/dist/televet/booking/index.cjs +41 -41
- package/dist/televet/booking/index.d.cts +8 -8
- package/dist/televet/booking/index.d.ts +8 -8
- package/dist/televet/booking/index.js +4 -4
- package/dist/televet/call/index.d.cts +2 -2
- package/dist/televet/call/index.d.ts +2 -2
- package/dist/televet/index.cjs +1 -1
- package/dist/televet/index.js +1 -1
- package/dist/testing/index.cjs +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/rn/index.cjs +8 -8
- package/dist/testing/rn/index.d.cts +13 -13
- package/dist/testing/rn/index.d.ts +13 -13
- package/dist/testing/rn/index.js +9 -9
- package/dist/testing/web/index.cjs +3 -3
- package/dist/testing/web/index.d.cts +13 -13
- package/dist/testing/web/index.d.ts +13 -13
- package/dist/testing/web/index.js +1 -1
- package/dist/texting/index.cjs +1 -1
- package/dist/texting/index.d.cts +6 -6
- package/dist/texting/index.d.ts +6 -6
- package/dist/texting/index.js +26 -26
- package/dist/{threadOptions.d-bEAFkIsC.d.cts → threadOptions.d-Bqy5d5Fx.d.cts} +1 -1
- package/dist/{threadOptions.d-U5YBUKM-.d.ts → threadOptions.d-DOEIpk1t.d.ts} +1 -1
- package/dist/{threadOptions.d-BW0rePcs.d.cts → threadOptions.d-Dc57dm7h.d.cts} +7 -7
- package/dist/{threadOptions.d-CrAb71J2.d.ts → threadOptions.d-NSlFx-Lp.d.ts} +7 -7
- package/dist/{timelineRows.d-DXppCSCg.d.cts → timelineRows.d-7w8NsNi4.d.cts} +1 -1
- package/dist/{timelineRows.d-9Uhf4q5d.d.ts → timelineRows.d-CthNM5hV.d.ts} +1 -1
- package/dist/{typeStyle.d-rzVzCfLz.d.ts → typeStyle.d-8mcLhtbH.d.ts} +1 -1
- package/dist/{typeStyle.d-B-YgiWcS.d.cts → typeStyle.d-CLrQZW-r.d.cts} +1 -1
- package/dist/{unreadStore.d-gCsleb6l.d.ts → unreadStore.d-CLnChKca.d.ts} +17 -9
- package/dist/{unreadStore.d-w5x6lEpR.d.cts → unreadStore.d-Donv4bcF.d.cts} +17 -9
- package/dist/{useHealthPlanSubscription.d-CRBPMlsc.d.ts → useHealthPlanSubscription.d-CV7M21HS.d.ts} +3 -3
- package/dist/{useHealthPlanSubscription.d-DfjTYv1u.d.cts → useHealthPlanSubscription.d-SA9-SuKe.d.cts} +3 -3
- package/dist/{useInboxUnread.d-CP3KwSkn.d.ts → useInboxUnread.d-CXiaR3BZ.d.ts} +1 -1
- package/dist/{useInboxUnread.d-DiE_NbtS.d.cts → useInboxUnread.d-DERpMelw.d.cts} +1 -1
- package/dist/{usePresentation.d-DefUwatV.d.cts → usePresentation.d-BJzFicRQ.d.cts} +3 -3
- package/dist/{usePresentation.d-w5_oWKmh.d.ts → usePresentation.d-DgSGIWS-.d.ts} +3 -3
- package/dist/{useRecordsDepth.d-l6D0ZS4l.d.cts → useRecordsDepth.d-C9W45gwS.d.cts} +1 -1
- package/dist/{useRecordsDepth.d-DG2GiAyt.d.ts → useRecordsDepth.d-ZX2rhcUx.d.ts} +1 -1
- package/dist/{useUnread.d-xDOpYyqx.d.ts → useUnread.d-CedFK4k6.d.ts} +5 -5
- package/dist/{useUnread.d-DeRDFtTb.d.cts → useUnread.d-DST1GMmL.d.cts} +5 -5
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.js +1 -1
- package/dist/{view.d-ufGX_MKK.d.cts → view.d-3lxzyJlL.d.cts} +6 -6
- package/dist/{view.d-iTInze7B.d.ts → view.d-DRiYNQJ8.d.ts} +6 -6
- package/dist/web/consent/index.cjs +3 -3
- package/dist/web/consent/index.d.cts +6 -6
- package/dist/web/consent/index.d.ts +6 -6
- package/dist/web/consent/index.js +5 -5
- package/dist/web/health-plan/index.cjs +2 -2
- package/dist/web/health-plan/index.d.cts +17 -17
- package/dist/web/health-plan/index.d.ts +17 -17
- package/dist/web/health-plan/index.js +1 -1
- package/dist/web/inbox/index.cjs +5 -5
- package/dist/web/inbox/index.d.cts +9 -8
- package/dist/web/inbox/index.d.ts +9 -8
- package/dist/web/inbox/index.js +5 -5
- package/dist/web/index.cjs +196 -195
- package/dist/web/index.d.cts +34 -34
- package/dist/web/index.d.ts +34 -34
- package/dist/web/index.js +196 -195
- package/dist/web/intro/index.cjs +10 -10
- package/dist/web/intro/index.d.cts +8 -8
- package/dist/web/intro/index.d.ts +8 -8
- package/dist/web/intro/index.js +6 -6
- package/dist/web/notifications/index.cjs +5 -5
- package/dist/web/notifications/index.d.cts +7 -7
- package/dist/web/notifications/index.d.ts +7 -7
- package/dist/web/notifications/index.js +1 -1
- package/dist/web/records/depth/index.cjs +1 -1
- package/dist/web/records/depth/index.d.cts +10 -10
- package/dist/web/records/depth/index.d.ts +10 -10
- package/dist/web/records/depth/index.js +1 -1
- package/dist/web/records/index.cjs +1 -1
- package/dist/web/records/index.d.cts +13 -13
- package/dist/web/records/index.d.ts +13 -13
- package/dist/web/records/index.js +1 -1
- package/dist/web/records-sheet/index.cjs +2 -2
- package/dist/web/records-sheet/index.js +2 -2
- package/dist/web/shop/index.cjs +1 -1
- package/dist/web/shop/index.d.cts +3 -3
- package/dist/web/shop/index.d.ts +3 -3
- package/dist/web/shop/index.js +15 -15
- package/dist/web/televet/booking/index.cjs +7 -7
- package/dist/web/televet/booking/index.d.cts +9 -9
- package/dist/web/televet/booking/index.d.ts +9 -9
- package/dist/web/televet/booking/index.js +69 -69
- package/dist/web/televet/call/index.cjs +1 -1
- package/dist/web/televet/call/index.d.cts +2 -2
- package/dist/web/televet/call/index.d.ts +2 -2
- package/dist/web/televet/call/index.js +1 -1
- package/dist/web/televet/index.cjs +6 -6
- package/dist/web/televet/index.js +1 -1
- package/dist/web/texting/index.cjs +1 -1
- package/dist/web/texting/index.d.cts +6 -6
- package/dist/web/texting/index.d.ts +6 -6
- package/dist/web/texting/index.js +1 -1
- package/dist/web/ui/index.cjs +1 -1
- package/dist/web/ui/index.js +32 -32
- package/package.json +1 -32
- package/dist/ErrorPolicyPort.d-68yrE3BE.d.ts +0 -23
- package/dist/ErrorPolicyPort.d-DirW9hgO.d.cts +0 -23
package/dist/photo/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
|
|
2
|
-
import{createContext,forwardRef as e,createElement as t,useState as r,useEffect as n,useCallback as a,useSyncExternalStore as i,useMemo as o,useContext as l,useRef as s,Component as d}from"react";import{TextInput as u,View as c,Pressable as p,ScrollView as h,StyleSheet as f,Animated as b,Easing as y,Text as m}from"react-native";import{jsx as g,jsxs as v,Fragment as _}from"react/jsx-runtime";var w=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],C=/* @__PURE__ */Object.freeze(w.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(C.map(e=>e.wireCode));var S=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound"}),k=/* @__PURE__ */Object.freeze(C.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:S[e.wireCode]}))),F=new Map(k.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),E=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(k.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...E]){let t=F.get(e+r);if(t)return t}}var T=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return T[e]}function fromWire(e){let t=contractErrorFor(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":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var z=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return z.has(e)}var R=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||R.has(e)}var x=500,O=8e3,I=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(x*2**r,O);return Math.floor(t()*n)}var j="This feature isn't available on your account right now.",A="Something in that request was not right. Check the details and try again.",D=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:j,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:A,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:j,runtimeDisposed:A,unknown:"Something went wrong. Please try again."}),N="This session has ended. Please sign in again.",L="linked_account_read_only";function P(e,t,r){return e==="conflict"&&r===L?j:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?N:userFacingError(e)}function userFacingError(e){return D[e]}function B(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var M=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===L,a={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:P(e,t?.wireCode,n?L:null)};t?.httpStatus!==void 0&&(a.httpStatus=t.httpStatus),t?.requestId&&(a.requestId=t.requestId),typeof t?.reasonCode=="string"&&M.test(t.reasonCode)&&(a.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(a.retryAfterSeconds=Math.round(i)),r);return t?.wireMessage&&B(a,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&B(a,"raw",t.raw),/* @__PURE__ */Object.freeze(a)}function ok(e,t){/* @__PURE__ */
|
|
2
|
+
import{createContext,forwardRef as e,createElement as t,useState as r,useEffect as n,useCallback as i,useSyncExternalStore as a,useMemo as o,useContext as l,useRef as s,Component as d}from"react";import{TextInput as u,View as c,Pressable as p,ScrollView as h,StyleSheet as f,Animated as b,Easing as y,Text as m}from"react-native";import{jsx as g,jsxs as v,Fragment as _}from"react/jsx-runtime";var w=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],C=/* @__PURE__ */Object.freeze(w.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(C.map(e=>e.wireCode));var S=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),k=/* @__PURE__ */Object.freeze(C.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:S[e.wireCode]}))),F=new Map(k.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),E=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(k.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let e of[t??"http_envelope",...E]){let t=F.get(e+r);if(t)return t}}var T=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return T[e]}function fromWire(e){let t=contractErrorFor(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":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var z=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return z.has(e)}var R=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||R.has(e)}var x=500,O=8e3,I=4;function backoffDelayMs(e,t=Math.random){let r=Math.max(0,e),n=Math.min(x*2**r,O);return Math.floor(t()*n)}var j="This feature isn't available on your account right now.",A="Something in that request was not right. Check the details and try again.",D=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:j,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:A,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:j,runtimeDisposed:A,unknown:"Something went wrong. Please try again."}),N="This session has ended. Please sign in again.",L="linked_account_read_only";function P(e,t,r){return e==="conflict"&&r===L?j:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?N:userFacingError(e)}function userFacingError(e){return D[e]}function B(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false})}var M=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let r=contractErrorFor(t?.wireCode,t?.wireEnvelope),n=e==="conflict"&&t?.reasonCode===L,i={code:e,category:categoryFor(e),retryable:t?.retryable??(n?false:isRetryableCode(e)),displayMessage:P(e,t?.wireCode,n?L:null)};t?.httpStatus!==void 0&&(i.httpStatus=t.httpStatus),t?.requestId&&(i.requestId=t.requestId),typeof t?.reasonCode=="string"&&M.test(t.reasonCode)&&(i.reasonCode=t.reasonCode);let a=t?.retryAfterSeconds;if(typeof a=="number"&&Number.isFinite(a)&&a>=0&&(i.retryAfterSeconds=Math.round(a)),r);return t?.wireMessage&&B(i,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&B(i,"raw",t.raw),/* @__PURE__ */Object.freeze(i)}function ok(e,t){/* @__PURE__ */
|
|
3
3
|
return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
|
|
4
4
|
return Object.freeze({ok:false,error:e})}var q=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
|
|
5
|
-
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var H="x-everfur-anon-token",U="anonTokenInvalid";async function W(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function K(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[H]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...V(e.headers),...authHeaders(t)}}}function V(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===H||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await W(t),n=await t.transport.request(withAuthHeaders(e,G(t,r)));if(n.ok||$(n.error.raw)!==U||t.anonIdentity===void 0||t.userRef!==null)return n;let
|
|
5
|
+
return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var H="x-everfur-anon-token",U="anonTokenInvalid";async function W(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function K(e,t){let r=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...r?{wireMessage:r}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[H]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...V(e.headers),...authHeaders(t)}}}function V(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let e=r.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===H||(t[r]=n)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let r=await W(t),n=await t.transport.request(withAuthHeaders(e,G(t,r)));if(n.ok||$(n.error.raw)!==U||t.anonIdentity===void 0||t.userRef!==null)return n;let i=await t.anonIdentity.token({forceRefresh:true});return i===null||i===r?n:t.transport.request(withAuthHeaders(e,G(t,i)))}let r;try{r=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(K(e))}let n=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(K(e,{wireCode:$(n.error.raw),requestId:n.error.requestId}))}let a=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!a.ok&&a.error.httpStatus===401?(t.identity.reportRejected?.(),err(Y(a.error))):a}function G(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function Y(e){let t=e.raw,r=$(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...r?{wireCode:r}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function $(e){if(typeof e!="object"||e===null)return null;let t=e,r=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof r=="string"&&r.length>0?r:null}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Q(e)})}function Q(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var X=3e4,J=O*2,Z="idempotency-key",ee=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),te=/* @__PURE__ */Object.freeze({onEvent(){}}),re=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function ne(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??te,r=e.timers??re,n=e.rng??Math.random,i=e.sleep??((e,t)=>ve(e,r,t)),a=e.maxAttempts??I,o=e.unaryTimeoutMs??X,l=e.newIdempotencyKey??ae(),s=e=>{try{t.onEvent(e)}catch{}};async function d(t,d,u){let c=u?.maxAttempts,p=Math.max(1,c??a),h=u?.idempotent??ee.has(d.method),f=u?.idempotencyKey===void 0?null:ne(u.idempotencyKey),b=h?f??l():null,y=ie(d,b),m=0;for(;;){let a=e=>/* @__PURE__ */Object.freeze({call:t,method:d.method,path:d.path,attempt:m,...b?{idempotencyKey:b}:{},...e});s(a({phase:"attempt"}));let l=me(o,r),u=ge(l.signal,d.signal),h;try{h=await authedSend({...y,signal:u.signal},e.auth)}catch(e){h=err(networkError(e))}finally{u.dispose(),l.cancel()}if(h.ok)return s(a({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,g=le(f,m,{maxAttempts:p,rng:n,now:r.now(),aborted:d.signal?.aborted===true,...c!==void 0?{perCallMaxAttempts:c}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:f.code,reason:g.reason,...f.httpStatus!==void 0?{httpStatus:f.httpStatus}:{},...f.requestId!==void 0?{requestId:f.requestId}:{}};if(!g.retry)return s(a({phase:"settled",...v})),err(f);if(s(a({phase:"retry",...v,delayMs:g.delayMs})),await i(g.delayMs,d.signal),d.signal?.aborted===true)return s(a({phase:"settled",...v,reason:"aborted"})),err(f);m+=1}}async function u(t){return withAuthHeaders(t,await ye(e.auth))}async function*c(t,r,n){s(
|
|
6
6
|
/* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:r.method,path:r.path,attempt:0}));try{yield*e.auth.transport.stream(r,n)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
7
|
-
return Object.freeze({send:d,authorize:u,stream:c})}function
|
|
8
|
-
return Object.freeze({mode:e})}function ke(e){return e!=null&&e.isAvailable===true}var Fe=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function Ee(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let
|
|
9
|
-
return Object.freeze({metadata:/* @__PURE__ */Object.freeze(r),droppedOperatorKeys:n})}var Be=/* @__PURE__ */Symbol("drop");function Me(e,t){if(je.has(e))return typeof t=="boolean"?t:Be;if(Ae.has(e))return qe(t)?t:Be;if(e==="risk_tier")return typeof t=="string"&&De.has(t)?t:Be;if(e==="confidence_tier")return typeof t=="string"&&Ne.has(t)?t:Be;if(typeof t!="string")return Be;let r=Le[e]??256;return t.length>r?t.slice(0,r):t}function qe(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function He(e){if(!xe(e))return null;let t=Ke(e.summary),r=Ke(e.disclaimer),n=Ve(e.recommendations??e.recommendation);return t===null&&r===null&&n.length===0?null:/* @__PURE__ */Object.freeze({summary:t??"",recommendations:/* @__PURE__ */Object.freeze(n),disclaimer:r??""})}function Ue(e){if(!xe(e))return{};if(xe(e.metadata))return e.metadata;let t=e.detections;if(Array.isArray(t)&&t.length>0){let e=t[0];if(xe(e)&&xe(e.metadata))return e.metadata;if(xe(e))return e}return e}function We(e){return xe(e)?xe(e.interpretation)?e.interpretation:e:null}function Ke(e){return typeof e=="string"&&e.length>0?e:null}function Ve(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(e=>typeof e=="string"&&e.length>0):[]}function Ge(e){return qe(e)?e:null}function Ye(e){return typeof e=="number"&&Number.isFinite(e)?e:null}var $e=/* @__PURE__ */Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:e=>Re(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`});async function Qe(e,t){let r={purpose:t.purpose,content_type:t.contentType};t.byteSize!==null&&(r.byte_size=t.byteSize);let n={method:"POST",path:$e.initiate,body:r,...t.signal?{signal:t.signal}:{}},
|
|
10
|
-
return Object.freeze({url:t,fields:/* @__PURE__ */Object.freeze(
|
|
11
|
-
return Object.freeze({verdict:r,reasonCodes:/* @__PURE__ */Object.freeze(n),precheckToken:Ke(e.precheck_token)})}async function tt(e,t,r,n,a){let i={method:"POST",path:t,body:r,...a?{signal:a}:{}},o=await e.send("media.analyze",i);if(o.ok){let e=rt(o.value);return e!==null?{kind:"async",job:e}:{kind:"sync",body:o.value}}let l=n(o.error.httpStatus,o.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:o.error}}function rt(e){if(!xe(e))return null;let t=Ke(e.job_id);if(t===null)return null;let r=Ke(e.status);return r!==null&&isTerminalStatus(r)?null:/* @__PURE__ */Object.freeze({jobId:t,estimatedSeconds:Ye(e.estimated_completion_seconds)})}var nt=2e3,at=5e3,it=9e4;async function ot(e,t,r){let{timers:n,signal:a,alive:i}=r,o=n.now(),l=Math.max(it,(r.estimatedSeconds??0)*1e3),s=nt;for(;;){if(a.aborted||!i())return{kind:"aborted"};if(await Ee(s,a,n),a.aborted||!i())return{kind:"aborted"};if(n.now()-o>l)return{kind:"timeout"};let r=$e.job(t);if(r===null)return{kind:"notFound"};let d=await e.send("media.pollJob",{method:"GET",path:r,...a?{signal:a}:{}},{maxAttempts:1});if(a.aborted||!i())return{kind:"aborted"};if(!d.ok){if(d.error.httpStatus===404)return{kind:"notFound"};s=Math.min(at,s+1e3);continue}let u=lt(d.value);if(u==="COMPLETED")return{kind:"complete",body:d.value};if(u==="FAILED")return{kind:"failed",error:st(d.value)};s=Math.min(at,s+1e3)}}function lt(e){return xe(e)?(Ke(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}function isTerminalStatus(e){let t=e.toUpperCase();return t==="COMPLETED"||t==="FAILED"}function st(e){let t=xe(e)?Ke(e.error)??Ke(e.error_code):null;return makeEverfurError("internalError",{retryable:false,...t?{wireMessage:t}:{}})}function dt(e,t){return e===422?{kind:"species_unsupported",species:"cat"}:e===400?{kind:"pet_context_required"}:null}function ut(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}var ct=/* @__PURE__ */Object.freeze({kind:"accepted"});function pt(e){return new ht(e)}var ht=class extends ze{constructor(e){super({status:"idle",region:e.region??"skin",result:null,gate:ct,error:null,isCaptureAvailable:ke(e.camera)}),this.funnel=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),this.camera=e.camera,this.upload=e.upload,this.telemetry=e.telemetry??_e,this.timers=e.timers??Fe,this.makeIdempotencyKey=e.makeIdempotencyKey??gt()}async capture(e,t){if(!ke(this.camera))return err(makeEverfurError("unknown",{retryable:false}));let r;try{r=await this.camera.capture(Se("photo"))}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),err(makeEverfurError("unknown",{retryable:false}))}return this.analyze(r,e,t)}async analyze(e,t,r){let n=this.beginOperation(r.signal),a=this.makeIdempotencyKey(),i=this.timers.now();this.patch({status:"capturing",region:t,error:null,result:null,gate:ct});try{let o=await Qe(this.funnel,{purpose:"skin_scan",contentType:e.mimeType,byteSize:Ce(e),signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return mt();if(!o.ok)return this.fail(n,o.error);let l=await Je(this.upload,e,o.value,a,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return mt();if(!l.ok)return this.fail(n,l.error);let s=await Ze(this.funnel,{s3Key:o.value.s3Key,type:t,signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return mt();if(s.verdict!=="proceed")return this.gateRetake(n,t,s.reasonCodes);this.patch({status:"analyzing"});let d=await tt(this.funnel,$e.photoAnalyze,ut(o.value.s3Key,{type:t,petRef:r.petRef,precheckToken:s.precheckToken}),dt,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return mt();switch(d.kind){case"error":return this.fail(n,d.error);case"gate":return this.gateDomain(n,t,d.gate);case"sync":return this.complete(n,d.body,t,null,i);case"async":{let e=await ot(this.funnel,d.job.jobId,{timers:this.timers,signal:n.signal,alive:()=>this.alive(n.epoch),estimatedSeconds:d.job.estimatedSeconds});if(n.signal.aborted||!this.alive(n.epoch))return mt();switch(e.kind){case"aborted":return mt();case"complete":return this.complete(n,e.body,t,d.job.jobId,i);case"failed":return this.fail(n,e.error);case"timeout":return this.fail(n,makeEverfurError("streamTimeout",{retryable:!0}));case"notFound":return this.fail(n,makeEverfurError("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(n,makeEverfurError("internalError",{retryable:!1}))}}default:return this.fail(n,makeEverfurError("internalError",{retryable:!1}))}}finally{n.settle()}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:ct,error:null})}complete(e,t,r,n,a){if(!this.alive(e.epoch))return mt();let i=ft(t,r,n);return i.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:i.droppedOperatorKeys}),this.patch({status:"complete",result:i.result,gate:ct,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:r}),this.telemetry.track("analysis.result",{capability:"photo",region:r,riskTier:i.result.riskTier??"",confidenceTier:i.result.confidenceTier??"",modelVersion:i.result.modelVersion??"",timeToResultMs:this.timers.now()-a}),ok(i.result)}gateDomain(e,t,r){if(!this.alive(e.epoch))return mt();let n=r.kind==="species_unsupported"?/* @__PURE__ */Object.freeze({kind:"species_unsupported",species:"cat"}):/* @__PURE__ */Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:n,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:r.kind,region:t,...r.kind==="species_unsupported"?{species:"cat"}:{}}),err(makeEverfurError("unknown",{retryable:false}))}gateRetake(e,t,r){if(!this.alive(e.epoch))return mt();this.patch({status:"idle",gate:/* @__PURE__ */Object.freeze({kind:"retake",reasons:/* @__PURE__ */Object.freeze([...r])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:r});let n=r.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:n,region:t}),err(makeEverfurError("unknown",{retryable:false}))}fail(e,t){return this.alive(e.epoch)?(this.patch({status:"error",error:t,gate:ct}),this.telemetry.trackExpectedFailure("analysis.error",{code:t.code,...t.httpStatus!==void 0?{httpStatus:t.httpStatus}:{}}),err(t)):mt()}};function ft(e,t,r){let n=Pe(Ue(e)),a=n.metadata,i=He(We(e));return{result:/* @__PURE__ */Object.freeze({jobId:r,analysisType:t,primaryLabel:Ke(a.primary_label)??"Uncertain",riskTier:bt(a.risk_tier),confidence:Ge(a.primary_confidence),subtypeDisplay:Ke(a.subtype_display),confidenceTier:yt(a.confidence_tier),diseaseName:Ke(a.disease_name),diseaseFraming:Ke(a.disease_framing),copyShort:Ke(a.copy_short),interpretation:i,modelVersion:Ke(a.model_version)??(xe(e)?Ke(e.model_version):null)}),droppedOperatorKeys:n.droppedOperatorKeys}}function bt(e){return e==="low_risk"||e==="concern"||e==="uncertain"?e:null}function yt(e){return e==="possible"||e==="probable"?e:null}function mt(){return err(makeEverfurError("unknown",{retryable:false}))}function gt(){let e=0;return()=>`photo-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}var vt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),_t=globalThis,wt=_t[vt]??(_t[vt]=createContext(null));wt.displayName??="EverfurContext";function Ct(){let e=l(wt);if(e===null)throw new q("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var St=/* @__PURE__ */Object.freeze({status:"idle",region:"skin",result:null,gate:/* @__PURE__ */Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),NOOP_UNSUBSCRIBE=()=>{};function usePhotoCheckup(e){let{runtime:t,userRef:userRef,scopeEpoch:l}=Ct(),petRef=e.petRef,[s,d]=r(null);n(()=>{let{services:e}=t.registry,r=t.registry.acquire("photo",`${userRef??""}|${petRef}`,()=>pt({...e.errorPolicy?{errorPolicy:e.errorPolicy}:{},auth:e.authFor(userRef),camera:e.camera,upload:e.upload,telemetry:e.telemetry}),e=>e.dispose());return d(r),()=>{d(e=>e===r?null:e),t.registry.release(r)}},[t,userRef,petRef,l]);let u=a(e=>s?s.subscribe(e):NOOP_UNSUBSCRIBE,[s]),c=a(()=>s?s.getSnapshot():St,[s]),p=i(u,c,c),h=a((e,t)=>s?s.analyze(e,t,{petRef:petRef}):Promise.resolve(kt()),[s,petRef]),f=a(e=>s?s.capture(e,{petRef:petRef}):Promise.resolve(kt()),[s,petRef]),b=a(()=>{s?.reset()},[s]);return o(()=>({status:p.status,region:p.region,result:p.result,gate:p.gate,error:p.error,isCaptureAvailable:p.isCaptureAvailable,isBootstrapping:s===null,analyze:h,capture:f,reset:b}),[p,s,h,f,b])}function kt(){return err(makeEverfurError("internalError",{retryable:true}))}var Ft=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Ft[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[Ft[t]]};let a=face(e,t);return a.fontWeight===void 0||n===null?a:{fontFamily:a.fontFamily,fontWeight:n}}function Et(e){return e<=450?"regular":e<=650?"medium":"bold"}var Tt={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=zt.get(e);r===void 0&&(r=/* @__PURE__ */new Map,zt.set(e,r));let n=r.get(t);if(n!==void 0)return n;let a=Rt(e,t);return r.set(t,a),a}var zt=/* @__PURE__ */new WeakMap;function Rt(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,a=Et(Number(n)),i=r.face==="mono"?face(e,Tt[a]):r.face==="heading"?headingFace(e,a):face(e,a),o=r.face==="heading"?e.type.headingWeight??n:n,l=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=r.size,d={...l,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var xt=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var Ot=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Ot(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var It=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var jt={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},At={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Dt={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Nt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Lt={regular:"400",medium:"500",bold:"700"},Pt={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Bt=0,Mt="System",qt="monospace",Ht=["content","heading","control","compact","badge"];function Ut(e){let t={};for(let r of Ht)t[r]=e;return t}var Wt=[];function Kt(){return{family:Mt,mono:qt,fontUrl:null,families:{regular:Mt,medium:Mt,bold:Mt,mono:qt,monoMedium:qt,monoBold:qt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Dt,tierSizes:Ut(Dt),lineHeight:Nt,weight:Lt,letterSpacing:Pt,scale:1,maxScale:Bt,scaleCaps:It,headingFamily:null,headingWeight:null,fontSources:Wt,roles:xt,typeScale:1}}var Vt={},Gt=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var Yt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(Gt.standard),emphasized:cssCubicBezier(Gt.emphasized),exit:cssCubicBezier(Gt.exit)},reducedMotion:false},$t={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:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",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:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",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(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},Qt=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:$t,space:jt,radius:At,type:Kt(),motion:Yt,slots:Vt}),Xt={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:"#9A9A9A",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",onDanger:"#0E1F17",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",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Xt,space:jt,radius:At,type:Kt(),motion:Yt,slots:Vt});var Jt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Zt=globalThis,er=Zt[Jt]??(Zt[Jt]=createContext(Qt));er.displayName??="EverfurThemeContext";function useEverfurTheme(){return l(er)}function tr(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...n}){let a=useEverfurTheme(),i=r===void 0?void 0:a.type.roles[r],o=tr(a.type,e??i?.tier??"content"),l=r===void 0?n:{...n,style:[{...textRole(a,r),color:a.color.text.primary,flexShrink:1},n.style]};return t(m,o===void 0?l:{maxFontSizeMultiplier:o,...l})}e(function(e,r){return t(u,{...e,...r===null?{}:{ref:r}})});var rr=class extends d{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:e,fallback:r,resetKey:n}){return t(rr,{fallback:r,resetKey:n,children:t(RenderHost,{render:e})})}var nr=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return nr[e]}function decideCapability(e,t,r){let n=requires(e),a=/* @__PURE__ */new Map;for(let e of t)a.set(e.resource,e);if(r?.isPending===true&&n.some(e=>!a.has(e)))return or({name:e,enabled:false,isPending:true,limits:{}});let i=ar(n,a);return n.filter(e=>a.get(e)?.granted!==true).length===0?or({name:e,enabled:true,isPending:false,limits:i}):or({name:e,enabled:false,isPending:false,limits:i,disabled:ir(n,a)})}function ar(e,t){let r={};for(let n of e){let e=t.get(n)?.limits;if(e)for(let[t,n]of Object.entries(e)){let e=r[t];r[t]=e===void 0?n:Math.min(e,n)}}return r}function ir(e,t){for(let r of e){let e=t.get(r)?.disabled;if(e)/* @__PURE__ */
|
|
7
|
+
return Object.freeze({send:d,authorize:u,stream:c})}function ie(e,t){let r={};for(let[t,n]of Object.entries(e.headers??{}))t.toLowerCase()!==Z&&(r[t]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}function ae(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var oe=10;function le(e,t,r){if(r.aborted)return{retry:false,reason:"aborted"};let n=se(e);if(n==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if((()=>{if(r.policy===void 0)return false;try{return!r.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let a=()=>{if(r.policy===void 0)return null;let t;try{t=r.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(oe,Math.floor(t)))},o=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let l=de(e,r.now);return l!==null?l>J?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:l}:{retry:true,reason:i,delayMs:backoffDelayMs(t,r.rng)}}function se(e){let t=e.code==="unknown"?fromWire(fe(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function de(e,t){let r=ce(e.raw);if(r!==null){let e=r-t;return e>0?e:0}let n=ue(e.raw);return n===null?null:Math.round(n*1e3)}function ue(e){for(let t of pe(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function ce(e){for(let t of pe(e)){let e=t.resets_at,r=he(e);if(r!==null)return r}return null}function pe(e){if(!be(e))return[];let t=[e];for(let r of["error","detail"]){let n=e[r];be(n)&&t.push(n)}return t}function he(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}function fe(e){for(let t of pe(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function be(e){return typeof e=="object"&&e!==null}async function ye(e){if(e.mode==="anonymous"){let t=await W(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function me(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return{signal:r.signal,cancel:()=>t.clearTimeout(n)}}function ge(e,t){let r=()=>{};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 i=()=>n.abort();return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)}}}function ve(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",a),n()},e),a=()=>{t.clearTimeout(i),n()};r?.addEventListener("abort",a,{once:true})})}var _e=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function we(e){let t={uri:e.uri,mimeType:e.mimeType},r=Ce(e);return r!==null&&(t.sizeBytes=r),/* @__PURE__ */Object.freeze(t)}function Ce(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}function Se(e,t){/* @__PURE__ */
|
|
8
|
+
return Object.freeze({mode:e})}function ke(e){return e!=null&&e.isAvailable===true}var Fe=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function Ee(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let i={handle:void 0},a=()=>{r.clearTimeout(i.handle),t.removeEventListener("abort",a),n()};i.handle=r.setTimeout(a,e),t.addEventListener("abort",a,{once:true})})}function Te(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let n=()=>r.abort();return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),r.signal}var ze=class{constructor(e){this.listeners=/* @__PURE__ */new Set;this.epoch=0;this.inFlight=null;this.snapshot=/* @__PURE__ */Object.freeze({...e})}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.snapshot}patch(e){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,...e});for(let e of this.listeners)e()}beginOperation(e){this.inFlight?.abort();let t=new AbortController;this.inFlight=t;let r=this.epoch;return{signal:e?Te(t.signal,e):t.signal,epoch:r,settle:()=>{this.inFlight===t&&(this.inFlight=null)}}}alive(e){return e===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()}};function Re(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let r=e.charCodeAt(t+1);if(!(r>=56320&&r<=57343))return true;t+=1}else if(r>=56320&&r<=57343)return true}return false}function xe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Oe=/* @__PURE__ */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"]),Ie=/* @__PURE__ */Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),je=/* @__PURE__ */new Set(["skin_v2","eye_v2","llm_checkup"]),Ae=/* @__PURE__ */new Set(["primary_confidence","subtype_confidence"]),De=/* @__PURE__ */new Set(["low_risk","concern","uncertain"]),Ne=/* @__PURE__ */new Set(["possible","probable"]),Le=/* @__PURE__ */Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function Pe(e){let t=xe(e)?e:{},r={};for(let e of Oe){if(!(e in t))continue;let n=t[e],i=Me(e,n);i!==Be&&(r[e]=i)}let n=0;for(let e of Ie)e in t&&(n+=1);/* @__PURE__ */
|
|
9
|
+
return Object.freeze({metadata:/* @__PURE__ */Object.freeze(r),droppedOperatorKeys:n})}var Be=/* @__PURE__ */Symbol("drop");function Me(e,t){if(je.has(e))return typeof t=="boolean"?t:Be;if(Ae.has(e))return qe(t)?t:Be;if(e==="risk_tier")return typeof t=="string"&&De.has(t)?t:Be;if(e==="confidence_tier")return typeof t=="string"&&Ne.has(t)?t:Be;if(typeof t!="string")return Be;let r=Le[e]??256;return t.length>r?t.slice(0,r):t}function qe(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function He(e){if(!xe(e))return null;let t=Ke(e.summary),r=Ke(e.disclaimer),n=Ve(e.recommendations??e.recommendation);return t===null&&r===null&&n.length===0?null:/* @__PURE__ */Object.freeze({summary:t??"",recommendations:/* @__PURE__ */Object.freeze(n),disclaimer:r??""})}function Ue(e){if(!xe(e))return{};if(xe(e.metadata))return e.metadata;let t=e.detections;if(Array.isArray(t)&&t.length>0){let e=t[0];if(xe(e)&&xe(e.metadata))return e.metadata;if(xe(e))return e}return e}function We(e){return xe(e)?xe(e.interpretation)?e.interpretation:e:null}function Ke(e){return typeof e=="string"&&e.length>0?e:null}function Ve(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(e=>typeof e=="string"&&e.length>0):[]}function Ge(e){return qe(e)?e:null}function Ye(e){return typeof e=="number"&&Number.isFinite(e)?e:null}var $e=/* @__PURE__ */Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:e=>Re(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`});async function Qe(e,t){let r={purpose:t.purpose,content_type:t.contentType};t.byteSize!==null&&(r.byte_size=t.byteSize);let n={method:"POST",path:$e.initiate,body:r,...t.signal?{signal:t.signal}:{}},i=await e.send("media.initiateUpload",n);if(!i.ok)return err(i.error);let a=Xe(i.value);return a===null?err(makeEverfurError("mediaUploadFailed",{retryable:false})):ok(a)}function Xe(e){if(!xe(e))return null;let t=Ke(e.url),r=Ke(e.s3_key);if(t===null||r===null)return null;let n=e.fields,i={};if(xe(n))for(let[e,t]of Object.entries(n))typeof t=="string"&&(i[e]=t);/* @__PURE__ */
|
|
10
|
+
return Object.freeze({url:t,fields:/* @__PURE__ */Object.freeze(i),s3Key:r,expiresAt:Ye(e.expires_at)})}async function Je(e,t,r,n,i){try{return await e.presignedPut(we(t),{target:r,idempotencyKey:n,...i?{signal:i}:{}}),ok(void 0)}catch{return err(makeEverfurError("mediaUploadFailed",{retryable:false}))}}async function Ze(e,t){let r={method:"POST",path:$e.precheck,body:{s3_key:t.s3Key,type:t.type},...t.signal?{signal:t.signal}:{}},n=await e.send("media.precheck",r);return n.ok?et(n.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}function et(e){if(!xe(e))return{verdict:"proceed",reasonCodes:[],precheckToken:null};let t=Ke(e.verdict),r=t==="retake"||t==="reject"?t:"proceed",n=Array.isArray(e.reason_codes)?e.reason_codes.filter(e=>typeof e=="string"):[];/* @__PURE__ */
|
|
11
|
+
return Object.freeze({verdict:r,reasonCodes:/* @__PURE__ */Object.freeze(n),precheckToken:Ke(e.precheck_token)})}async function tt(e,t,r,n,i){let a={method:"POST",path:t,body:r,...i?{signal:i}:{}},o=await e.send("media.analyze",a);if(o.ok){let e=rt(o.value);return e!==null?{kind:"async",job:e}:{kind:"sync",body:o.value}}let l=n(o.error.httpStatus,o.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:o.error}}function rt(e){if(!xe(e))return null;let t=Ke(e.job_id);if(t===null)return null;let r=Ke(e.status);return r!==null&&isTerminalStatus(r)?null:/* @__PURE__ */Object.freeze({jobId:t,estimatedSeconds:Ye(e.estimated_completion_seconds)})}var nt=2e3,it=5e3,at=9e4;async function ot(e,t,r){let{timers:n,signal:i,alive:a}=r,o=n.now(),l=Math.max(at,(r.estimatedSeconds??0)*1e3),s=nt;for(;;){if(i.aborted||!a())return{kind:"aborted"};if(await Ee(s,i,n),i.aborted||!a())return{kind:"aborted"};if(n.now()-o>l)return{kind:"timeout"};let r=$e.job(t);if(r===null)return{kind:"notFound"};let d=await e.send("media.pollJob",{method:"GET",path:r,...i?{signal:i}:{}},{maxAttempts:1});if(i.aborted||!a())return{kind:"aborted"};if(!d.ok){if(d.error.httpStatus===404)return{kind:"notFound"};s=Math.min(it,s+1e3);continue}let u=lt(d.value);if(u==="COMPLETED")return{kind:"complete",body:d.value};if(u==="FAILED")return{kind:"failed",error:st(d.value)};s=Math.min(it,s+1e3)}}function lt(e){return xe(e)?(Ke(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}function isTerminalStatus(e){let t=e.toUpperCase();return t==="COMPLETED"||t==="FAILED"}function st(e){let t=xe(e)?Ke(e.error)??Ke(e.error_code):null;return makeEverfurError("internalError",{retryable:false,...t?{wireMessage:t}:{}})}function dt(e,t){return e===422?{kind:"species_unsupported",species:"cat"}:e===400?{kind:"pet_context_required"}:null}function ut(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}var ct=/* @__PURE__ */Object.freeze({kind:"accepted"});function pt(e){return new ht(e)}var ht=class extends ze{constructor(e){super({status:"idle",region:e.region??"skin",result:null,gate:ct,error:null,isCaptureAvailable:ke(e.camera)}),this.funnel=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),this.camera=e.camera,this.upload=e.upload,this.telemetry=e.telemetry??_e,this.timers=e.timers??Fe,this.makeIdempotencyKey=e.makeIdempotencyKey??gt()}async capture(e,t){if(!ke(this.camera))return err(makeEverfurError("unknown",{retryable:false}));let r;try{r=await this.camera.capture(Se("photo"))}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),err(makeEverfurError("unknown",{retryable:false}))}return this.analyze(r,e,t)}async analyze(e,t,r){let n=this.beginOperation(r.signal),i=this.makeIdempotencyKey(),a=this.timers.now();this.patch({status:"capturing",region:t,error:null,result:null,gate:ct});try{let o=await Qe(this.funnel,{purpose:"skin_scan",contentType:e.mimeType,byteSize:Ce(e),signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return mt();if(!o.ok)return this.fail(n,o.error);let l=await Je(this.upload,e,o.value,i,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return mt();if(!l.ok)return this.fail(n,l.error);let s=await Ze(this.funnel,{s3Key:o.value.s3Key,type:t,signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return mt();if(s.verdict!=="proceed")return this.gateRetake(n,t,s.reasonCodes);this.patch({status:"analyzing"});let d=await tt(this.funnel,$e.photoAnalyze,ut(o.value.s3Key,{type:t,petRef:r.petRef,precheckToken:s.precheckToken}),dt,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return mt();switch(d.kind){case"error":return this.fail(n,d.error);case"gate":return this.gateDomain(n,t,d.gate);case"sync":return this.complete(n,d.body,t,null,a);case"async":{let e=await ot(this.funnel,d.job.jobId,{timers:this.timers,signal:n.signal,alive:()=>this.alive(n.epoch),estimatedSeconds:d.job.estimatedSeconds});if(n.signal.aborted||!this.alive(n.epoch))return mt();switch(e.kind){case"aborted":return mt();case"complete":return this.complete(n,e.body,t,d.job.jobId,a);case"failed":return this.fail(n,e.error);case"timeout":return this.fail(n,makeEverfurError("streamTimeout",{retryable:!0}));case"notFound":return this.fail(n,makeEverfurError("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(n,makeEverfurError("internalError",{retryable:!1}))}}default:return this.fail(n,makeEverfurError("internalError",{retryable:!1}))}}finally{n.settle()}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:ct,error:null})}complete(e,t,r,n,i){if(!this.alive(e.epoch))return mt();let a=ft(t,r,n);return a.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:a.droppedOperatorKeys}),this.patch({status:"complete",result:a.result,gate:ct,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:r}),this.telemetry.track("analysis.result",{capability:"photo",region:r,riskTier:a.result.riskTier??"",confidenceTier:a.result.confidenceTier??"",modelVersion:a.result.modelVersion??"",timeToResultMs:this.timers.now()-i}),ok(a.result)}gateDomain(e,t,r){if(!this.alive(e.epoch))return mt();let n=r.kind==="species_unsupported"?/* @__PURE__ */Object.freeze({kind:"species_unsupported",species:"cat"}):/* @__PURE__ */Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:n,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:r.kind,region:t,...r.kind==="species_unsupported"?{species:"cat"}:{}}),err(makeEverfurError("unknown",{retryable:false}))}gateRetake(e,t,r){if(!this.alive(e.epoch))return mt();this.patch({status:"idle",gate:/* @__PURE__ */Object.freeze({kind:"retake",reasons:/* @__PURE__ */Object.freeze([...r])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:r});let n=r.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:n,region:t}),err(makeEverfurError("unknown",{retryable:false}))}fail(e,t){return this.alive(e.epoch)?(this.patch({status:"error",error:t,gate:ct}),this.telemetry.trackExpectedFailure("analysis.error",{code:t.code,...t.httpStatus!==void 0?{httpStatus:t.httpStatus}:{}}),err(t)):mt()}};function ft(e,t,r){let n=Pe(Ue(e)),i=n.metadata,a=He(We(e));return{result:/* @__PURE__ */Object.freeze({jobId:r,analysisType:t,primaryLabel:Ke(i.primary_label)??"Uncertain",riskTier:bt(i.risk_tier),confidence:Ge(i.primary_confidence),subtypeDisplay:Ke(i.subtype_display),confidenceTier:yt(i.confidence_tier),diseaseName:Ke(i.disease_name),diseaseFraming:Ke(i.disease_framing),copyShort:Ke(i.copy_short),interpretation:a,modelVersion:Ke(i.model_version)??(xe(e)?Ke(e.model_version):null)}),droppedOperatorKeys:n.droppedOperatorKeys}}function bt(e){return e==="low_risk"||e==="concern"||e==="uncertain"?e:null}function yt(e){return e==="possible"||e==="probable"?e:null}function mt(){return err(makeEverfurError("unknown",{retryable:false}))}function gt(){let e=0;return()=>`photo-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}var vt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),_t=globalThis,wt=_t[vt]??(_t[vt]=createContext(null));wt.displayName??="EverfurContext";function Ct(){let e=l(wt);if(e===null)throw new q("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}var St=/* @__PURE__ */Object.freeze({status:"idle",region:"skin",result:null,gate:/* @__PURE__ */Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),NOOP_UNSUBSCRIBE=()=>{};function usePhotoCheckup(e){let{runtime:t,userRef:userRef,scopeEpoch:l}=Ct(),petRef=e.petRef,[s,d]=r(null);n(()=>{let{services:e}=t.registry,r=t.registry.acquire("photo",`${userRef??""}|${petRef}`,()=>pt({...e.errorPolicy?{errorPolicy:e.errorPolicy}:{},auth:e.authFor(userRef),camera:e.camera,upload:e.upload,telemetry:e.telemetry}),e=>e.dispose());return d(r),()=>{d(e=>e===r?null:e),t.registry.release(r)}},[t,userRef,petRef,l]);let u=i(e=>s?s.subscribe(e):NOOP_UNSUBSCRIBE,[s]),c=i(()=>s?s.getSnapshot():St,[s]),p=a(u,c,c),h=i((e,t)=>s?s.analyze(e,t,{petRef:petRef}):Promise.resolve(kt()),[s,petRef]),f=i(e=>s?s.capture(e,{petRef:petRef}):Promise.resolve(kt()),[s,petRef]),b=i(()=>{s?.reset()},[s]);return o(()=>({status:p.status,region:p.region,result:p.result,gate:p.gate,error:p.error,isCaptureAvailable:p.isCaptureAvailable,isBootstrapping:s===null,analyze:h,capture:f,reset:b}),[p,s,h,f,b])}function kt(){return err(makeEverfurError("internalError",{retryable:true}))}var Ft=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Ft[t]]}}function headingFace(e,t="bold"){let{headingFamily:r,headingWeight:n}=e.type;if(r===null&&n===null)return face(e,t);if(r!==null)return{fontFamily:r,fontWeight:n??e.type.weight[Ft[t]]};let i=face(e,t);return i.fontWeight===void 0||n===null?i:{fontFamily:i.fontFamily,fontWeight:n}}function Et(e){return e<=450?"regular":e<=650?"medium":"bold"}var Tt={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let r=zt.get(e);r===void 0&&(r=/* @__PURE__ */new Map,zt.set(e,r));let n=r.get(t);if(n!==void 0)return n;let i=Rt(e,t);return r.set(t,i),i}var zt=/* @__PURE__ */new WeakMap;function Rt(e,t){let r=e.type.roles[t],n=r.weight==="400"&&r.face!=="mono"?e.type.weight.regular:r.weight,i=Et(Number(n)),a=r.face==="mono"?face(e,Tt[i]):r.face==="heading"?headingFace(e,i):face(e,i),o=r.face==="heading"?e.type.headingWeight??n:n,l=a.fontWeight===void 0?a:{fontFamily:a.fontFamily,fontWeight:o},s=r.size,d={...l,fontSize:s,lineHeight:Math.round(s*r.lineHeight*100)/100};return r.letterSpacing!==0&&(d.letterSpacing=Math.round(s*r.letterSpacing*100)/100),r.uppercase&&(d.textTransform="uppercase"),/* @__PURE__ */Object.freeze(d)}var xt=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var Ot=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Ot(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var It=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var jt={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},At={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Dt={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},Nt={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Lt={regular:"400",medium:"500",bold:"700"},Pt={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},Bt=0,Mt="System",qt="monospace",Ht=["content","heading","control","compact","badge"];function Ut(e){let t={};for(let r of Ht)t[r]=e;return t}var Wt=[];function Kt(){return{family:Mt,mono:qt,fontUrl:null,families:{regular:Mt,medium:Mt,bold:Mt,mono:qt,monoMedium:qt,monoBold:qt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Dt,tierSizes:Ut(Dt),lineHeight:Nt,weight:Lt,letterSpacing:Pt,scale:1,maxScale:Bt,scaleCaps:It,headingFamily:null,headingWeight:null,fontSources:Wt,roles:xt,typeScale:1}}var Vt={},Gt=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var Yt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(Gt.standard),emphasized:cssCubicBezier(Gt.emphasized),exit:cssCubicBezier(Gt.exit)},reducedMotion:false},$t={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:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",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:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",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(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},Qt=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:$t,space:jt,radius:At,type:Kt(),motion:Yt,slots:Vt}),Xt={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:"#9A9A9A",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",onDanger:"#0E1F17",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",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Xt,space:jt,radius:At,type:Kt(),motion:Yt,slots:Vt});var Jt=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Zt=globalThis,er=Zt[Jt]??(Zt[Jt]=createContext(Qt));er.displayName??="EverfurThemeContext";function useEverfurTheme(){return l(er)}function tr(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}function Text({tier:e,variant:r,...n}){let i=useEverfurTheme(),a=r===void 0?void 0:i.type.roles[r],o=tr(i.type,e??a?.tier??"content"),l=r===void 0?n:{...n,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},n.style]};return t(m,o===void 0?l:{maxFontSizeMultiplier:o,...l})}e(function(e,r){return t(u,{...e,...r===null?{}:{ref:r}})});var rr=class extends d{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:e,fallback:r,resetKey:n}){return t(rr,{fallback:r,resetKey:n,children:t(RenderHost,{render:e})})}var nr=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return nr[e]}function decideCapability(e,t,r){let n=requires(e),i=/* @__PURE__ */new Map;for(let e of t)i.set(e.resource,e);if(r?.isPending===true&&n.some(e=>!i.has(e)))return or({name:e,enabled:false,isPending:true,limits:{}});let a=ir(n,i);return n.filter(e=>i.get(e)?.granted!==true).length===0?or({name:e,enabled:true,isPending:false,limits:a}):or({name:e,enabled:false,isPending:false,limits:a,disabled:ar(n,i)})}function ir(e,t){let r={};for(let n of e){let e=t.get(n)?.limits;if(e)for(let[t,n]of Object.entries(e)){let e=r[t];r[t]=e===void 0?n:Math.min(e,n)}}return r}function ar(e,t){for(let r of e){let e=t.get(r)?.disabled;if(e)/* @__PURE__ */
|
|
12
12
|
return Object.freeze({reason:e.reason,level:e.level,recoverable:e.recoverable})}/* @__PURE__ */
|
|
13
|
-
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function or(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(e){let{runtime:t}=Ct(),r=t.entitlements,n=
|
|
14
|
-
return g(c,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:/* @__PURE__ */g(c,{style:n.skeletonBar})})}function OffState({decision:e,style:t}){let r=useEverfurTheme(),n=o(()=>dr(r),[r]),
|
|
15
|
-
return g(c,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:
|
|
13
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function or(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(e){let{runtime:t}=Ct(),r=t.entitlements,n=a(r.subscribe,r.getSnapshot,r.getSnapshot);return o(()=>decideCapability(e,n.decisions,{isPending:n.isPending}),[e,n])}var lr=48;function sr(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:a}=e,l=useCapability(t),s=o(()=>sr(l),[l]);switch(s){case"enabled":return r;case"pending":return i?/* @__PURE__ */g(HostRender,{render:i,fallback:/* @__PURE__ */g(PendingSkeleton,{capability:t,style:a})}):/* @__PURE__ */g(PendingSkeleton,{capability:t,style:a});case"disabled":return n?/* @__PURE__ */g(HostRender,{render:()=>n(l),fallback:/* @__PURE__ */g(OffState,{decision:l,style:a}),resetKey:l}):/* @__PURE__ */g(OffState,{decision:l,style:a});default:return assertNever(s)}}function PendingSkeleton({capability:e,style:t}){let r=useEverfurTheme(),n=o(()=>dr(r),[r]);/* @__PURE__ */
|
|
14
|
+
return g(c,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:/* @__PURE__ */g(c,{style:n.skeletonBar})})}function OffState({decision:e,style:t}){let r=useEverfurTheme(),n=o(()=>dr(r),[r]),i=e.disabled?.reason??"";/* @__PURE__ */
|
|
15
|
+
return g(c,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:i,children:i.length>0?/* @__PURE__ */g(Text,{style:n.offstateText,children:i}):null})}function dr(e){let{color:t,space:r,radius:n,type:i}=e;return f.create({offstate:{minHeight:lr,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:f.hairlineWidth,borderColor:t.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}var ur=/* @__PURE__ */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 ClinicalDisclaimer(e){let t=useEverfurTheme(),r=o(()=>cr(t),[t]);/* @__PURE__ */
|
|
16
16
|
return v(c,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${ur.title}. ${ur.body}`,children:[
|
|
17
17
|
/* @__PURE__ */g(Text,{style:r.title,children:ur.title}),
|
|
18
|
-
/* @__PURE__ */g(Text,{style:r.body,children:ur.body})]})}function cr(e){let{color:t,space:r,type:n}=e;return f.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:f.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...face(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...face(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}var pr=1400,hr=300;function AnalyzingIndicator(){let e=useEverfurTheme(),t=o(()=>fr(e),[e]),
|
|
19
|
-
return g(c,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:
|
|
18
|
+
/* @__PURE__ */g(Text,{style:r.body,children:ur.body})]})}function cr(e){let{color:t,space:r,type:n}=e;return f.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:f.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...face(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...face(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}var pr=1400,hr=300;function AnalyzingIndicator(){let e=useEverfurTheme(),t=o(()=>fr(e),[e]),i=e.motion.reducedMotion,[a,l]=r(false);n(()=>{let e=setTimeout(()=>l(true),hr);return()=>clearTimeout(e)},[]);let d=s(new b.Value(0)).current;n(()=>{if(i||!a)return;let e=b.loop(b.timing(d,{toValue:1,duration:pr,easing:y.linear,useNativeDriver:true}));return e.start(),()=>e.stop()},[i,a,d]);let u=i?null:{transform:[{rotate:d.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};/* @__PURE__ */
|
|
19
|
+
return g(c,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:a?/* @__PURE__ */v(_,{children:[
|
|
20
20
|
/* @__PURE__ */g(b.View,{style:[t.ring,u]}),
|
|
21
|
-
/* @__PURE__ */g(Text,{style:t.statusLine,children:"Analyzing"})]}):null})}function fr(e){let{color:t,space:r,radius:n,type:
|
|
22
|
-
/* @__PURE__ */v(c,{style:r.dotWrap,children:[l?/* @__PURE__ */g(b.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:
|
|
23
|
-
/* @__PURE__ */g(c,{style:[r.dot,{backgroundColor:
|
|
24
|
-
/* @__PURE__ */g(Text,{style:[r.label,{color:
|
|
25
|
-
return g(CapabilityGate,{capability:"photo",style:r,children:/* @__PURE__ */g(PhotoBody,{petRef:petRef,region:t,style:r})})}function Cr(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"}function PhotoBody({petRef:petRef,region:e,style:t}){let r=usePhotoCheckup({petRef:petRef}),n=e??"skin",
|
|
21
|
+
/* @__PURE__ */g(Text,{style:t.statusLine,children:"Analyzing"})]}):null})}function fr(e){let{color:t,space:r,radius:n,type:i}=e,a=i.weight.medium,o=r.xxl*2,l=r.xs;return f.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.md},ring:{width:o,height:o,borderRadius:n.pill,borderWidth:l,borderTopColor:t.success,borderRightColor:t.success,borderBottomColor:t.borderRingCream,borderLeftColor:t.borderRingCream},statusLine:{color:t.text.secondary,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.snug,fontWeight:a,letterSpacing:i.letterSpacing.tight,textAlign:"center"}})}var br=1100,yr=1.6,mr=.35;function gr(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}}}function SeverityBadge({riskTier:e}){let t=useEverfurTheme(),r=o(()=>vr(t),[t]),i=s(new b.Value(0)).current,a=e===null?null:gr(t,e),l=a!==null&&a.pulse&&!t.motion.reducedMotion;return n(()=>{if(!l)return;let e=b.loop(b.timing(i,{toValue:1,duration:br,easing:y.out(y.quad),useNativeDriver:true}));return e.start(),()=>e.stop()},[l,i]),a===null?null:/* @__PURE__ */v(c,{style:[r.pill,{backgroundColor:a.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:a.label,children:[
|
|
22
|
+
/* @__PURE__ */v(c,{style:r.dotWrap,children:[l?/* @__PURE__ */g(b.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:a.accent,opacity:i.interpolate({inputRange:[0,1],outputRange:[mr,0]}),transform:[{scale:i.interpolate({inputRange:[0,1],outputRange:[1,yr]})}]}]}):null,
|
|
23
|
+
/* @__PURE__ */g(c,{style:[r.dot,{backgroundColor:a.accent}]})]}),
|
|
24
|
+
/* @__PURE__ */g(Text,{style:[r.label,{color:a.accent}],children:a.label})]})}function vr(e){let{space:t,radius:r,type:n}=e,i=n.weight.bold,a=t.sm;return f.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:i,letterSpacing:n.letterSpacing.eyebrow}})}var _r=120,wr=44;function PhotoCheckup(e){let{petRef:petRef,region:t,style:r}=e;/* @__PURE__ */
|
|
25
|
+
return g(CapabilityGate,{capability:"photo",style:r,children:/* @__PURE__ */g(PhotoBody,{petRef:petRef,region:t,style:r})})}function Cr(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"}function PhotoBody({petRef:petRef,region:e,style:t}){let r=usePhotoCheckup({petRef:petRef}),n=e??"skin",i=Cr(r),a=o(()=>()=>{r.capture(n)},[r,n]),l=useEverfurTheme(),s=o(()=>Er(l),[l]);/* @__PURE__ */
|
|
26
26
|
return v(c,{style:[s.container,t],children:[
|
|
27
|
-
/* @__PURE__ */g(c,{style:s.body,children:Sr(
|
|
27
|
+
/* @__PURE__ */g(c,{style:s.body,children:Sr(i,r,a)}),
|
|
28
28
|
/* @__PURE__ */g(ClinicalDisclaimer,{})]})}function Sr(e,t,r){switch(e){case"loading":/* @__PURE__ */
|
|
29
29
|
return g(AnalyzingIndicator,{});case"native":/* @__PURE__ */
|
|
30
30
|
return g(NativeUnavailableState,{});case"empty":/* @__PURE__ */
|
|
@@ -35,11 +35,11 @@ return g(ResultState,{result:t.result});default:return assertNever(e)}}function
|
|
|
35
35
|
return g(c,{style:t.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:/* @__PURE__ */g(c,{style:t.emptyGlyph})})}function EmptyState({onCapture:e}){let t=useEverfurTheme(),r=o(()=>Er(t),[t]);/* @__PURE__ */
|
|
36
36
|
return g(c,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Take a photo to check",children:/* @__PURE__ */g(p,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Take photo",style:r.scanButton,children:/* @__PURE__ */g(Text,{style:r.scanLabel,children:"Take photo"})})})}function ErrorState({error:e,onRetry:t}){let r=useEverfurTheme(),n=o(()=>Er(r),[r]);/* @__PURE__ */
|
|
37
37
|
return v(c,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[
|
|
38
|
-
/* @__PURE__ */g(Text,{style:n.errorText,children:e.displayMessage}),e.retryable?/* @__PURE__ */g(p,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:/* @__PURE__ */g(Text,{style:n.primaryLabel,children:"Try again"})}):null]})}function GateState({gate:e,onRetry:t}){let r=useEverfurTheme(),n=o(()=>Er(r),[r]),
|
|
39
|
-
return v(c,{style:n.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:
|
|
40
|
-
/* @__PURE__ */g(Text,{style:n.guidanceText,children:
|
|
41
|
-
return v(h,{style:r.list,contentContainerStyle:[r.listContent,{backgroundColor:
|
|
38
|
+
/* @__PURE__ */g(Text,{style:n.errorText,children:e.displayMessage}),e.retryable?/* @__PURE__ */g(p,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:/* @__PURE__ */g(Text,{style:n.primaryLabel,children:"Try again"})}):null]})}function GateState({gate:e,onRetry:t}){let r=useEverfurTheme(),n=o(()=>Er(r),[r]),i=kr(e);/* @__PURE__ */
|
|
39
|
+
return v(c,{style:n.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:i,children:[
|
|
40
|
+
/* @__PURE__ */g(Text,{style:n.guidanceText,children:i}),e.kind!=="species_unsupported"?/* @__PURE__ */g(p,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:n.primaryButton,children:/* @__PURE__ */g(Text,{style:n.primaryLabel,children:"Try again"})}):null]})}function kr(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 assertNever(e)}}function ResultState({result:e}){let t=useEverfurTheme(),r=o(()=>Er(t),[t]),n=e.subtypeDisplay??e.diseaseName??e.primaryLabel,i=Fr(t,e.riskTier);/* @__PURE__ */
|
|
41
|
+
return v(h,{style:r.list,contentContainerStyle:[r.listContent,{backgroundColor:i}],accessibilityLabel:"Photo checkup result",children:[
|
|
42
42
|
/* @__PURE__ */g(Text,{style:r.resultHeadline,children:n}),
|
|
43
43
|
/* @__PURE__ */g(SeverityBadge,{riskTier:e.riskTier}),e.diseaseFraming?/* @__PURE__ */g(Text,{style:r.summaryText,children:e.diseaseFraming}):null,e.copyShort?/* @__PURE__ */g(Text,{style:r.summaryText,children:e.copyShort}):null,e.interpretation?/* @__PURE__ */v(c,{style:r.interpretationBlock,children:[
|
|
44
44
|
/* @__PURE__ */g(Text,{style:r.summaryText,children:e.interpretation.summary}),
|
|
45
|
-
/* @__PURE__ */g(Text,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]})}function Fr(e,t){switch(t){case"low_risk":return e.color.checkupCardLowRiskBg;case"concern":return e.color.checkupCardConcernBg;default:return e.color.surfaceCream}}function Er(e){let{color:t,space:r,radius:n,type:
|
|
45
|
+
/* @__PURE__ */g(Text,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]})}function Fr(e,t){switch(t){case"low_risk":return e.color.checkupCardLowRiskBg;case"concern":return e.color.checkupCardConcernBg;default:return e.color.surfaceCream}}function Er(e){let{color:t,space:r,radius:n,type:i}=e,a=i.weight.bold,o=i.weight.medium,l=i.weight.regular,s=e.brightness==="dark"?t.onAccent:t.brand;return f.create({container:{flex:1,minHeight:_r,backgroundColor:t.background},body:{flex:1},centered:{minHeight:_r,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},offstate:{minHeight:_r,alignItems:"center",justifyContent:"center",padding:r.xl},emptyGlyph:{width:r.xxl,height:r.xxl,borderRadius:n.pill,backgroundColor:t.surfaceSubtle,borderWidth:f.hairlineWidth,borderColor:t.brandBorder},scanButton:{minHeight:wr,minWidth:wr,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:s,fontFamily:i.family,fontSize:i.size.subtitle,lineHeight:i.size.subtitle*i.lineHeight.snug,fontWeight:a,letterSpacing:i.letterSpacing.tight},primaryButton:{minHeight:wr,minWidth:wr,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand},primaryLabel:{color:t.onPrimary,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.snug,fontWeight:o},errorText:{color:t.danger,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},guidanceText:{color:t.text.muted,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},list:{flex:1},listContent:{padding:r.lg,gap:r.sm,borderRadius:n.lg,borderWidth:f.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:i.family,fontSize:i.size.verdict,lineHeight:i.size.verdict*i.lineHeight.tight,fontWeight:a,letterSpacing:i.letterSpacing.tight},summaryText:{color:t.text.primary,fontFamily:i.family,fontSize:i.size.body,lineHeight:i.size.body*i.lineHeight.relaxed,fontWeight:l},interpretationBlock:{marginTop:r.sm,paddingTop:r.sm,gap:r.xs,borderTopWidth:f.hairlineWidth,borderTopColor:t.borderHairlineGreen},disclaimerText:{color:t.text.muted,fontFamily:i.family,fontSize:i.size.caption,lineHeight:i.size.caption*i.lineHeight.normal,fontWeight:l}})}export{PhotoCheckup,usePhotoCheckup};
|
|
@@ -6,9 +6,9 @@ type EverfurChatHistoryStyle = 'drawer' | 'sheet';
|
|
|
6
6
|
/** The card above the chat's empty state: none, or the focus card ("Her focus", default; drawn only when there is a focus). */
|
|
7
7
|
type EverfurChatTopCardSetting = 'none' | 'focus';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* falls back as if unset.
|
|
9
|
+
* No effect since the chat footnote was removed (16 Nov 2026); still parsed so existing configs keep working. It once
|
|
10
|
+
* placed the chat's safety footnote: under the composer (default), at the foot of the answers, or `none`. `none` is
|
|
11
|
+
* still taken from the host's `presentation` prop only; a server value of `none` falls back as if unset.
|
|
12
12
|
*/
|
|
13
13
|
type EverfurSafetyDisclaimerPlacement = 'composer' | 'answer_footer' | 'none';
|
|
14
14
|
/** The Health Plan tab layout: the standard list, or the focus plan (the v3 design, default). */
|
|
@@ -6,9 +6,9 @@ type EverfurChatHistoryStyle = 'drawer' | 'sheet';
|
|
|
6
6
|
/** The card above the chat's empty state: none, or the focus card ("Her focus", default; drawn only when there is a focus). */
|
|
7
7
|
type EverfurChatTopCardSetting = 'none' | 'focus';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* falls back as if unset.
|
|
9
|
+
* No effect since the chat footnote was removed (16 Nov 2026); still parsed so existing configs keep working. It once
|
|
10
|
+
* placed the chat's safety footnote: under the composer (default), at the foot of the answers, or `none`. `none` is
|
|
11
|
+
* still taken from the host's `presentation` prop only; a server value of `none` falls back as if unset.
|
|
12
12
|
*/
|
|
13
13
|
type EverfurSafetyDisclaimerPlacement = 'composer' | 'answer_footer' | 'none';
|
|
14
14
|
/** The Health Plan tab layout: the standard list, or the focus plan (the v3 design, default). */
|