@everfur/sdk 0.7.1 → 0.9.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/CHANGELOG.md +350 -0
- package/README.md +24 -16
- package/dist/{Chat-DQOsAumH.d.cts → Chat-Cb3Y8VwS.d.cts} +3 -3
- package/dist/{Chat-CFi5cNUF.d.ts → Chat-ClhB_8sp.d.ts} +3 -3
- package/dist/{DepthViews-D81c95Ra.d.cts → DepthViews-BSkuUGBB.d.ts} +1 -1
- package/dist/{DepthViews-C409ubw-.d.cts → DepthViews-CSCS-tZg.d.ts} +1 -1
- package/dist/{DepthViews-es8mIK0w.d.ts → DepthViews-CW1z8pnl.d.cts} +1 -1
- package/dist/{DepthViews-uilL1NJZ.d.ts → DepthViews-DDiPxyzg.d.cts} +1 -1
- package/dist/{ErrorPolicyPort-D22LUVrK.d.ts → ErrorPolicyPort-DwSnmGcX.d.ts} +1 -1
- package/dist/{ErrorPolicyPort-D6CybiqJ.d.cts → ErrorPolicyPort-NFDPe-5w.d.cts} +1 -1
- package/dist/{EverfurError-DmELDpXp.d.cts → EverfurError-pEXDbUJ1.d.cts} +9 -1
- package/dist/{EverfurError-DmELDpXp.d.ts → EverfurError-pEXDbUJ1.d.ts} +9 -1
- package/dist/{EverfurResult-ZtH-YV1h.d.cts → EverfurResult-dtl8ERAw.d.cts} +1 -1
- package/dist/{EverfurResult-SGvHKsCB.d.ts → EverfurResult-sKkoXew0.d.ts} +1 -1
- package/dist/IntakeMedia-BFZfBLjB.d.cts +116 -0
- package/dist/{IntakeMedia-BcjjUizr.d.ts → IntakeMedia-BH0fYDT2.d.cts} +19 -2
- package/dist/{IntakeMedia-CL_S2tZE.d.cts → IntakeMedia-Bavl7E4Z.d.ts} +19 -2
- package/dist/IntakeMedia-C8GlN_GK.d.ts +116 -0
- package/dist/animations/index.cjs +109 -1
- package/dist/animations/index.d.cts +6 -6
- package/dist/animations/index.d.ts +6 -6
- package/dist/animations/index.js +109 -1
- package/dist/{attachments-B2GjBgvF.d.cts → attachments-BD70jZZL.d.cts} +3 -3
- package/dist/{attachments-SF88N654.d.ts → attachments-CC7aHpwZ.d.ts} +7 -7
- package/dist/{attachments-DNaSbmA3.d.ts → attachments-DAUy3vPR.d.ts} +3 -3
- package/dist/{attachments-DI710no4.d.cts → attachments-DaOaIBNf.d.cts} +7 -7
- package/dist/{bookingCopy-D2N3RhsV.d.ts → bookingCopy-CUW9Gdzc.d.ts} +15 -7
- package/dist/{bookingCopy-xlXxORCA.d.cts → bookingCopy-oEjqkiNA.d.cts} +15 -7
- package/dist/{branding-Bio5MM6g.d.cts → branding-aGleD_ki.d.ts} +99 -6
- package/dist/{branding-ytH4jJq1.d.ts → branding-ctD0B2Th.d.cts} +99 -6
- package/dist/{callRoom-7wrE3RP2.d.ts → callRoom-B1qq_D-4.d.ts} +1 -1
- package/dist/{callRoom-B_EqaUzx.d.cts → callRoom-DfZTWFXh.d.cts} +1 -1
- package/dist/{casesRepository-B-md8h1S.d.cts → casesRepository-Bzs7aw4t.d.cts} +2 -2
- package/dist/{casesRepository-CC6951TK.d.ts → casesRepository-CywqL6mj.d.ts} +2 -2
- package/dist/chat/index.cjs +335 -1
- package/dist/chat/index.d.cts +12 -12
- package/dist/chat/index.d.ts +12 -12
- package/dist/chat/index.js +335 -1
- package/dist/client/index.cjs +115 -11
- package/dist/client/index.d.cts +14 -14
- package/dist/client/index.d.ts +14 -14
- package/dist/client/index.js +115 -11
- package/dist/{config-BM0sv5jx.d.ts → config-BysLVhku.d.ts} +3 -3
- package/dist/{config-Daa1plhQ.d.cts → config-EZzEyS-c.d.cts} +3 -3
- package/dist/consent/index.cjs +112 -1
- package/dist/consent/index.d.cts +9 -9
- package/dist/consent/index.d.ts +9 -9
- package/dist/consent/index.js +112 -1
- package/dist/{context-DQHtwcHN.d.cts → context-DUwYArkM.d.cts} +9 -9
- package/dist/{context-CDV2pwGI.d.ts → context-DpfgbnOU.d.ts} +9 -9
- package/dist/{copy-BEx5F71o.d.cts → copy-DK4r9oGz.d.cts} +5 -5
- package/dist/{copy-Cl1l-qmY.d.ts → copy-LxZGnFXJ.d.ts} +5 -5
- package/dist/core/index.cjs +140 -13
- package/dist/core/index.d.cts +19 -19
- package/dist/core/index.d.ts +19 -19
- package/dist/core/index.js +140 -13
- package/dist/{depth-CAAwiStc.d.cts → depth-DAd77kRe.d.cts} +7 -6
- package/dist/{depth-DfNRVtrV.d.ts → depth-Mk7quUNa.d.ts} +7 -6
- package/dist/{entitlementRepository-CVWvND1P.d.ts → entitlementRepository-CrD0O7VR.d.ts} +4 -4
- package/dist/{entitlementRepository-DPvWjV-N.d.cts → entitlementRepository-Dra_4FU_.d.cts} +4 -4
- package/dist/{identity-DUlshgow.d.cts → identity-75whJXyP.d.cts} +2 -2
- package/dist/{identity-BhT7oJDS.d.ts → identity-BiyMDMrR.d.ts} +2 -2
- package/dist/index.cjs +365 -12
- package/dist/index.d.cts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +365 -12
- package/dist/{models-DSqA5Ahs.d.ts → models-CrbUwbuS.d.ts} +1 -1
- package/dist/{models-Bn2z0NNo.d.cts → models-DzvqEjMm.d.cts} +1 -1
- package/dist/notifications/index.cjs +94 -2
- package/dist/notifications/index.d.cts +5 -5
- package/dist/notifications/index.d.ts +5 -5
- package/dist/notifications/index.js +94 -2
- package/dist/{pets-Bneph9m1.d.cts → pets-DoXxTw4x.d.cts} +2 -2
- package/dist/{pets-DjcLmRrW.d.ts → pets-W2BuLYko.d.ts} +2 -2
- package/dist/{petsRepository-BwxmfX_s.d.ts → petsRepository-ByMzq1Z9.d.ts} +2 -2
- package/dist/{petsRepository-BnVre3q7.d.cts → petsRepository-yyoo0k2I.d.cts} +2 -2
- package/dist/photo/index.cjs +131 -1
- package/dist/photo/index.d.cts +3 -3
- package/dist/photo/index.d.ts +3 -3
- package/dist/photo/index.js +131 -1
- package/dist/{ports-BPKxFOSe.d.cts → ports-BeVJYP0_.d.cts} +7 -7
- package/dist/{ports-Di9rdLO9.d.ts → ports-zYl8S_lI.d.ts} +7 -7
- package/dist/records/depth/index.cjs +200 -2
- package/dist/records/depth/index.d.cts +11 -11
- package/dist/records/depth/index.d.ts +11 -11
- package/dist/records/depth/index.js +200 -2
- package/dist/records/index.cjs +742 -4
- package/dist/records/index.d.cts +22 -14
- package/dist/records/index.d.ts +22 -14
- package/dist/records/index.js +742 -4
- package/dist/{requestFunnel-CiSX2pun.d.ts → requestFunnel-BPeBZdKp.d.ts} +5 -5
- package/dist/{requestFunnel-DMR_1T3O.d.cts → requestFunnel-DHeSzCT6.d.cts} +5 -5
- package/dist/{runtimeTypes-CkMFCbHW.d.ts → runtimeTypes-Cc207nbn.d.ts} +7 -7
- package/dist/{runtimeTypes-2gJ5hYoE.d.cts → runtimeTypes-DgMizQKz.d.cts} +7 -7
- package/dist/server/events/index.cjs +92 -2
- package/dist/server/events/index.d.cts +4 -4
- package/dist/server/events/index.d.ts +4 -4
- package/dist/server/events/index.js +92 -2
- package/dist/server/index.cjs +95 -2
- package/dist/server/index.d.cts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +95 -2
- package/dist/televet/booking/index.cjs +396 -4
- package/dist/televet/booking/index.d.cts +24 -127
- package/dist/televet/booking/index.d.ts +24 -127
- package/dist/televet/booking/index.js +396 -4
- package/dist/televet/call/index.cjs +71 -1
- package/dist/televet/call/index.d.cts +3 -3
- package/dist/televet/call/index.d.ts +3 -3
- package/dist/televet/call/index.js +71 -1
- package/dist/televet/index.cjs +101 -1
- package/dist/televet/index.d.cts +25 -8
- package/dist/televet/index.d.ts +25 -8
- package/dist/televet/index.js +101 -1
- package/dist/{bookingTypes-D4pD3tHs.d.ts → televetGlobal-C5dTUACe.d.cts} +34 -1
- package/dist/{bookingTypes-D4pD3tHs.d.cts → televetGlobal-CnjrfhT4.d.ts} +34 -1
- package/dist/testing/index.cjs +98 -7
- package/dist/testing/index.d.cts +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +98 -7
- package/dist/testing/rn/index.cjs +101 -1
- package/dist/testing/rn/index.d.cts +13 -13
- package/dist/testing/rn/index.d.ts +13 -13
- package/dist/testing/rn/index.js +101 -1
- package/dist/testing/web/index.cjs +95 -1
- package/dist/testing/web/index.d.cts +14 -14
- package/dist/testing/web/index.d.ts +14 -14
- package/dist/testing/web/index.js +95 -1
- package/dist/{timelineRows-D3171ksh.d.ts → timelineRows-D22vGN9t.d.ts} +1 -1
- package/dist/{timelineRows-DDnz4gx2.d.cts → timelineRows-DUQIWSjc.d.cts} +1 -1
- package/dist/{tokens-BYtbKwFh.d.cts → tokens-RAKZj7M8.d.cts} +89 -5
- package/dist/{tokens-BYtbKwFh.d.ts → tokens-RAKZj7M8.d.ts} +89 -5
- package/dist/{typeStyle-BqfwxZH4.d.cts → typeStyle-DVj8iCC1.d.ts} +30 -3
- package/dist/{typeStyle-DKz02DGU.d.ts → typeStyle-Nt7w0rhE.d.cts} +30 -3
- package/dist/{useRecordsDepth-Z9FF5X4E.d.ts → useRecordsDepth-C0Qfoghi.d.ts} +7 -6
- package/dist/{useRecordsDepth-COJ0wSYK.d.cts → useRecordsDepth-Mbysp548.d.cts} +7 -6
- package/dist/{useVetVisit-Ds8f1peV.d.cts → useVetVisit-BQX_aTJs.d.cts} +2 -2
- package/dist/{useVetVisit-BsjoDO-n.d.ts → useVetVisit-RPBOabl8.d.ts} +2 -2
- package/dist/video/index.cjs +122 -1
- package/dist/video/index.d.cts +3 -3
- package/dist/video/index.d.ts +3 -3
- package/dist/video/index.js +122 -1
- package/dist/{view-nRy6SitU.d.cts → view-CskIgOFV.d.cts} +5 -5
- package/dist/{view-DoQEHXJR.d.ts → view-DqKXtxEZ.d.ts} +5 -5
- package/dist/web/consent/index.cjs +111 -1
- package/dist/web/consent/index.d.cts +9 -9
- package/dist/web/consent/index.d.ts +9 -9
- package/dist/web/consent/index.js +111 -1
- package/dist/web/index.cjs +326 -14
- package/dist/web/index.d.cts +29 -23
- package/dist/web/index.d.ts +29 -23
- package/dist/web/index.js +326 -14
- package/dist/web/notifications/index.cjs +95 -2
- package/dist/web/notifications/index.d.cts +7 -7
- package/dist/web/notifications/index.d.ts +7 -7
- package/dist/web/notifications/index.js +95 -2
- package/dist/web/records/depth/index.cjs +170 -2
- package/dist/web/records/depth/index.d.cts +11 -11
- package/dist/web/records/depth/index.d.ts +11 -11
- package/dist/web/records/depth/index.js +170 -2
- package/dist/web/records/index.cjs +691 -4
- package/dist/web/records/index.d.cts +34 -37
- package/dist/web/records/index.d.ts +34 -37
- package/dist/web/records/index.js +691 -4
- package/dist/web/records/upload/index.cjs +3 -0
- package/dist/web/records/upload/index.d.cts +23 -0
- package/dist/web/records/upload/index.d.ts +23 -0
- package/dist/web/records/upload/index.js +3 -0
- package/dist/web/televet/booking/index.cjs +425 -4
- package/dist/web/televet/booking/index.d.cts +25 -39
- package/dist/web/televet/booking/index.d.ts +25 -39
- package/dist/web/televet/booking/index.js +425 -4
- package/dist/web/televet/call/index.cjs +28 -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 +28 -1
- package/dist/web/televet/index.cjs +102 -4
- package/dist/web/televet/index.d.cts +22 -11
- package/dist/web/televet/index.d.ts +22 -11
- package/dist/web/televet/index.js +102 -4
- package/package.json +20 -4
- package/web/records/upload/native-blocked.cjs +12 -0
- package/web/records/upload/package.json +8 -0
- package/dist/televetGlobal-CEk0_cW9.d.cts +0 -34
- package/dist/televetGlobal-Cs9Wbqsy.d.ts +0 -34
package/dist/photo/index.cjs
CHANGED
|
@@ -1 +1,131 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactNative=require('react-native'),jsxRuntime=require('react/jsx-runtime');var $t=Object.defineProperty;var i=(e,t)=>$t(e,"name",{value:t,configurable:true});var oe=Object.freeze([Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);Object.freeze(oe.map(e=>e.wireCode));var Jt=Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),De=Object.freeze(oe.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Jt[e.wireCode]}))),Qt=new Map(De.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Xt=Object.freeze(["http_envelope",...[...new Set(De.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function V(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let o of [t??"http_envelope",...Xt]){let n=Qt.get(o+r);if(n)return n}}i(V,"contractErrorFor");function Zt(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Zt,"contractDocUrl");function Ne(e){return null}i(Ne,"publishedDocUrl");var er=Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function Le(e){return er[e]}i(Le,"categoryFor");function Me(e){let t=V(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),o=r.replace(/[^A-Z0-9]/g,"");if(o==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(o){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 "NOTFOUND":case "CONVERSATIONNOTFOUND":return "conversationNotFound";case "PETNOTFOUND":return "petNotFound";case "TIMEOUT":case "STREAMTIMEOUT":return "streamTimeout";case "MEDIAUPLOADFAILED":case "UNRECOGNIZEDVIDEOFORMAT":case "FILETOOSMALL":return "mediaUploadFailed";case "MODERATIONBLOCKED":return "moderationBlocked";case "UPSTREAMLLMTIMEOUT":return "upstreamLlmTimeout";case "INTERNALERROR":case "INTERNALSERVERERROR":return "internalError";case "STREAMINCOMPLETE":case "CHATSTREAMINCOMPLETE":return "streamIncomplete";case "INVALIDANALYSISTYPE":case "INVALIDUPLOADPURPOSE":return "unknown";default:return "unknown"}}i(Me,"fromWire");var tr=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function ie(e){return tr.has(e)}i(ie,"isAutoRetryable");var rr=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ue(e){return ie(e)||rr.has(e)}i(Ue,"isRetryableCode");var nr=500,ae=8e3,Be=4;function qe(e,t=Math.random){let r=Math.max(0,e),o=Math.min(nr*2**r,ae);return Math.floor(t()*o)}i(qe,"backoffDelayMs");var or=Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:"This feature isn't available on your account right now.",paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",unknown:"Something went wrong. Please try again."});function se(e){return or[e]}i(se,"userFacingError");function He(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(He,"defineHidden");var ir=/^[a-z][a-z0-9_]{0,63}$/;function f(e,t){let r=V(t?.wireCode,t?.wireEnvelope),o={code:e,category:Le(e),retryable:t?.retryable??Ue(e),displayMessage:se(e)};if(t?.httpStatus!==void 0&&(o.httpStatus=t.httpStatus),t?.requestId&&(o.requestId=t.requestId),typeof t?.reasonCode=="string"&&ir.test(t.reasonCode)&&(o.reasonCode=t.reasonCode),r);return t?.wireMessage&&He(o,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&He(o,"raw",t.raw),Object.freeze(o)}i(f,"makeEverfurError");function z(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(z,"ok");function y(e){return Object.freeze({ok:false,error:e})}i(y,"err");var K=class K extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,K.prototype);}};i(K,"EverfurConfigError");var I=K;function j(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(j,"assertNever");function Ve(e){return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:e.serverRequestId??null})}i(Ve,"errorFrame");function lr(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:t["x-everfur-partner-key"]=e.publishableKey,e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}i(lr,"authHeaders");function D(e,t){return {...e,headers:{...dr(e.headers),...lr(t)}}}i(D,"withAuthHeaders");function dr(e){if(!e)return {};let t={};for(let[r,o]of Object.entries(e)){let n=r.toLowerCase();n==="authorization"||n==="x-everfur-partner-key"||(t[r]=o);}return t}i(dr,"stripAuthHeaders");async function Ke(e,t){if(t.mode==="anonymous")return t.transport.request(D(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return y(le())}let o=await t.transport.request(D(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(o.ok||o.error.httpStatus!==401)return o;let n;try{n=await t.identity.currentToken({forceRefresh:!0});}catch{return y(le())}let a=await t.transport.request(D(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !a.ok&&a.error.httpStatus===401?y(le(a.error.httpStatus)):a}i(Ke,"authedSend");function le(e){return f("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(le,"authRejectedError");function Ge(e){return f("internalError",{retryable:true,wireMessage:ur(e)})}i(Ge,"networkError");function ur(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(ur,"describeCause");var cr=3e4,pr=ae*2,yr="idempotency-key",fr=new Set(["POST","PUT","PATCH","DELETE"]),mr=Object.freeze({onEvent(){}}),br=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function gr(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(gr,"seededIdempotencyKey");function Ye(e){let t=e.observer??mr,r=e.timers??br,o=e.rng??Math.random,n=e.sleep??((E,u)=>Or(E,r,u)),a=e.maxAttempts??Be,s=e.unaryTimeoutMs??cr,l=e.newIdempotencyKey??vr(),d=i(E=>{try{t.onEvent(E);}catch{}},"emit");async function p(E,u,_){let k=_?.maxAttempts,Kt=Math.max(1,k??a),Gt=_?.idempotent??fr.has(u.method),Wt=_?.idempotencyKey===void 0?null:gr(_.idempotencyKey),ee=Gt?Wt??l():null,Yt=hr(u,ee),te=0;for(;;){let O=i(ne=>Object.freeze({call:E,method:u.method,path:u.path,attempt:te,...ee?{idempotencyKey:ee}:{},...ne}),"stamp");d(O({phase:"attempt"}));let Ie=Fr(s,r),ze=Pr(Ie.signal,u.signal),A;try{A=await Ke({...Yt,signal:ze.signal},e.auth);}catch(ne){A=y(Ge(ne));}finally{ze.dispose(),Ie.cancel();}if(A.ok)return d(O({phase:"settled",ok:true,reason:"ok"})),A;let S=A.error,H=_r(S,te,{maxAttempts:Kt,rng:o,now:r.now(),aborted:u.signal?.aborted===true,...k!==void 0?{perCallMaxAttempts:k}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),re={ok:false,code:S.code,reason:H.reason,...S.httpStatus!==void 0?{httpStatus:S.httpStatus}:{},...S.requestId!==void 0?{requestId:S.requestId}:{}};if(!H.retry)return d(O({phase:"settled",...re})),y(S);if(d(O({phase:"retry",...re,delayMs:H.delayMs})),await n(H.delayMs,u.signal),u.signal?.aborted===true)return d(O({phase:"settled",...re,reason:"aborted"})),y(S);te+=1;}}i(p,"send");async function h(E){return D(E,await wr(e.auth))}i(h,"authorize");async function*R(E,u,_){d(Object.freeze({call:E,phase:"stream.open",method:u.method,path:u.path,attempt:0}));try{yield*e.auth.transport.stream(u,_);}catch{yield Ve({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(R,"stream"),Object.freeze({send:p,authorize:h,stream:R})}i(Ye,"createRequestFunnel");function hr(e,t){let r={};for(let[o,n]of Object.entries(e.headers??{}))o.toLowerCase()!==yr&&(r[o]=n);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(hr,"assembleHeaders");function vr(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(vr,"defaultIdempotencyKeyFactory");var Er=10;function _r(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let o=Rr(e);if(o==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(o!=="burst"&&!ie(e.code))return {retry:false,reason:"terminal-code"};let n=o==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=i(()=>{if(r.policy===void 0)return null;let p;try{p=r.policy.maxAttempts(e.code);}catch{return null}return typeof p!="number"||!Number.isFinite(p)?null:Math.max(1,Math.min(Er,Math.floor(p)))},"policyCeiling"),l=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=l)return {retry:false,reason:"attempts-exhausted"};let d=Tr(e,r.now);return d!==null?d>pr?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:n,delayMs:d}:{retry:true,reason:n,delayMs:qe(t,r.rng)}}i(_r,"decideRetry");function Rr(e){let t=e.code==="unknown"?Me(xr(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(Rr,"throttleKind");function Tr(e,t){let r=kr(e.raw);if(r!==null){let n=r-t;return n>0?n:0}let o=Cr(e.raw);return o===null?null:Math.round(o*1e3)}i(Tr,"retryOverrideMs");function Cr(e){for(let t of de(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}i(Cr,"findRetryAfterSeconds");function kr(e){for(let t of de(e)){let r=t.resets_at,o=Sr(r);if(o!==null)return o}return null}i(kr,"findResetsAt");function de(e){if(!We(e))return [];let t=[e];for(let r of ["error","detail"]){let o=e[r];We(o)&&t.push(o);}return t}i(de,"candidateScopes");function Sr(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}i(Sr,"parseInstantMs");function xr(e){for(let t of de(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(xr,"rawWireCode");function We(e){return typeof e=="object"&&e!==null}i(We,"isRecord");async function wr(e){return e.mode==="anonymous"?{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}:{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}i(wr,"resolveDeviceAuth");function Fr(e,t){let r=new AbortController,o=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(o),"cancel")}}i(Fr,"boundedSignal");function Pr(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let o=new AbortController;if(e.aborted||t.aborted)return o.abort(),{signal:o.signal,dispose:r};let n=i(()=>o.abort(),"onAbort");return e.addEventListener("abort",n,{once:true}),t.addEventListener("abort",n,{once:true}),{signal:o.signal,dispose:i(()=>{e.removeEventListener("abort",n),t.removeEventListener("abort",n);},"dispose")}}i(Pr,"mergeSignals");function Or(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(o=>{let n=t.setTimeout(()=>{r?.removeEventListener("abort",a),o();},e),a=i(()=>{t.clearTimeout(n),o();},"onAbort");r?.addEventListener("abort",a,{once:true});})}i(Or,"delayAbortable");var $e=Object.freeze({track(){},trackExpectedFailure(){}});function Je(e){let t={uri:e.uri,mimeType:e.mimeType},r=ue(e);return r!==null&&(t.sizeBytes=r),Object.freeze(t)}i(Je,"fileHandleFromMedia");function ue(e){let t=e.byteSize??e.sizeBytes;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}i(ue,"mediaByteSize");function Qe(e,t){return Object.freeze(t===void 0?{mode:e}:{mode:e,maxDurationSeconds:t})}i(Qe,"captureOptionsFor");function ce(e){return e!=null&&e.isAvailable===true}i(ce,"isCaptureAvailable");var Xe=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Ze(e,t,r){return new Promise(o=>{if(t.aborted){o();return}let n={handle:void 0},a=i(()=>{r.clearTimeout(n.handle),t.removeEventListener("abort",a),o();},"done");n.handle=r.setTimeout(a,e),t.addEventListener("abort",a,{once:true});})}i(Ze,"delayAbortable");function Ar(e,t){if(!t)return e;let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),r.signal;let o=i(()=>r.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),r.signal}i(Ar,"mergeSignals");var pe=class pe{constructor(t){this.listeners=new Set;this.epoch=0;this.inFlight=null;this.snapshot=Object.freeze({...t});}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t);}}getSnapshot(){return this.snapshot}patch(t){this.snapshot=Object.freeze({...this.snapshot,...t});for(let r of this.listeners)r();}beginOperation(t){this.inFlight?.abort();let r=new AbortController;this.inFlight=r;let o=this.epoch;return {signal:t?Ar(r.signal,t):r.signal,epoch:o,settle:i(()=>{this.inFlight===r&&(this.inFlight=null);},"settle")}}alive(t){return t===this.epoch}rescope(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null;}dispose(){this.epoch+=1,this.inFlight?.abort(),this.inFlight=null,this.listeners.clear();}};i(pe,"MediaStore");var G=pe;function et(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let o=e.charCodeAt(t+1);if(!(o>=56320&&o<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(et,"hasLoneSurrogate");var Ir=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"]),zr=Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),jr=new Set(["skin_v2","eye_v2","llm_checkup"]),Dr=new Set(["primary_confidence","subtype_confidence"]),Nr=new Set(["low_risk","concern","uncertain"]),Lr=new Set(["possible","probable"]),Mr=Object.freeze({primary_label:64,subtype_label:64,subtype_display:128,copy_short:512,disease_name:128,disease_framing:512,model_version:64});function tt(e){let t=v(e)?e:{},r={};for(let n of Ir){if(!(n in t))continue;let a=t[n],s=Ur(n,a);s!==F&&(r[n]=s);}let o=0;for(let n of zr)n in t&&(o+=1);return Object.freeze({metadata:Object.freeze(r),droppedOperatorKeys:o})}i(tt,"projectDetectionMetadata");var F=Symbol("drop");function Ur(e,t){if(jr.has(e))return typeof t=="boolean"?t:F;if(Dr.has(e))return rt(t)?t:F;if(e==="risk_tier")return typeof t=="string"&&Nr.has(t)?t:F;if(e==="confidence_tier")return typeof t=="string"&&Lr.has(t)?t:F;if(typeof t!="string")return F;let r=Mr[e]??256;return t.length>r?t.slice(0,r):t}i(Ur,"acceptKey");function rt(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}i(rt,"isUnitConfidence");function nt(e){if(!v(e))return null;let t=m(e.summary),r=m(e.disclaimer),o=Br(e.recommendations??e.recommendation);return t===null&&r===null&&o.length===0?null:Object.freeze({summary:t??"",recommendations:Object.freeze(o),disclaimer:r??""})}i(nt,"parseInterpretation");function ot(e){if(!v(e))return {};if(v(e.metadata))return e.metadata;let t=e.detections;if(Array.isArray(t)&&t.length>0){let r=t[0];if(v(r)&&v(r.metadata))return r.metadata;if(v(r))return r}return e}i(ot,"locateDetectionMetadata");function it(e){return v(e)?v(e.interpretation)?e.interpretation:e:null}i(it,"locateInterpretation");function v(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}i(v,"isRecord");function m(e){return typeof e=="string"&&e.length>0?e:null}i(m,"asString");function Br(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}i(Br,"asStringList");function at(e){return rt(e)?e:null}i(at,"asUnitNumber");function ye(e){return typeof e=="number"&&Number.isFinite(e)?e:null}i(ye,"asFiniteNumber");var N=Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:i(e=>et(e)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(e)}`,"job")});async function lt(e,t){let r={purpose:t.purpose,content_type:t.contentType};t.byteSize!==null&&(r.byte_size=t.byteSize);let o={method:"POST",path:N.initiate,body:r,...t.signal?{signal:t.signal}:{}},n=await e.send("media.initiateUpload",o);if(!n.ok)return y(n.error);let a=qr(n.value);return a===null?y(f("mediaUploadFailed",{retryable:false})):z(a)}i(lt,"initiateUpload");function qr(e){if(!v(e))return null;let t=m(e.url),r=m(e.s3_key);if(t===null||r===null)return null;let o=e.fields,n={};if(v(o))for(let[a,s]of Object.entries(o))typeof s=="string"&&(n[a]=s);return Object.freeze({url:t,fields:Object.freeze(n),s3Key:r,expiresAt:ye(e.expires_at)})}i(qr,"parsePresigned");async function dt(e,t,r,o,n){try{return await e.presignedPut(Je(t),{target:r,idempotencyKey:o,...n?{signal:n}:{}}),z(void 0)}catch{return y(f("mediaUploadFailed",{retryable:false}))}}i(dt,"stageUpload");async function ut(e,t){let r={method:"POST",path:N.precheck,body:{s3_key:t.s3Key,type:t.type},...t.signal?{signal:t.signal}:{}},o=await e.send("media.precheck",r);return o.ok?Hr(o.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}i(ut,"runPrecheck");function Hr(e){if(!v(e))return {verdict:"proceed",reasonCodes:[],precheckToken:null};let t=m(e.verdict),r=t==="retake"||t==="reject"?t:"proceed",o=Array.isArray(e.reason_codes)?e.reason_codes.filter(n=>typeof n=="string"):[];return Object.freeze({verdict:r,reasonCodes:Object.freeze(o),precheckToken:m(e.precheck_token)})}i(Hr,"parsePrecheck");async function ct(e,t,r,o,n){let a={method:"POST",path:t,body:r,...n?{signal:n}:{}},s=await e.send("media.analyze",a);if(s.ok){let d=Vr(s.value);return d!==null?{kind:"async",job:d}:{kind:"sync",body:s.value}}let l=o(s.error.httpStatus,s.error);return l!==null?{kind:"gate",gate:l}:{kind:"error",error:s.error}}i(ct,"submitAnalyze");function Vr(e){if(!v(e))return null;let t=m(e.job_id);if(t===null)return null;let r=m(e.status);return r!==null&&Yr(r)?null:Object.freeze({jobId:t,estimatedSeconds:ye(e.estimated_completion_seconds)})}i(Vr,"parseAsyncJob");var Kr=2e3,st=5e3,Gr=9e4;async function pt(e,t,r){let{timers:o,signal:n,alive:a}=r,s=o.now(),l=Math.max(Gr,(r.estimatedSeconds??0)*1e3),d=Kr;for(;;){if(n.aborted||!a())return {kind:"aborted"};if(await Ze(d,n,o),n.aborted||!a())return {kind:"aborted"};if(o.now()-s>l)return {kind:"timeout"};let p=N.job(t);if(p===null)return {kind:"notFound"};let h=await e.send("media.pollJob",{method:"GET",path:p,...n?{signal:n}:{}},{maxAttempts:1});if(n.aborted||!a())return {kind:"aborted"};if(!h.ok){if(h.error.httpStatus===404)return {kind:"notFound"};d=Math.min(st,d+1e3);continue}let R=Wr(h.value);if(R==="COMPLETED")return {kind:"complete",body:h.value};if(R==="FAILED")return {kind:"failed",error:$r(h.value)};d=Math.min(st,d+1e3);}}i(pt,"pollJob");function Wr(e){return v(e)?(m(e.status)??"PROCESSING").toUpperCase():"PROCESSING"}i(Wr,"jobStatusOf");function Yr(e){let t=e.toUpperCase();return t==="COMPLETED"||t==="FAILED"}i(Yr,"isTerminalStatus");function $r(e){let t=v(e)?m(e.error)??m(e.error_code):null;return f("internalError",{retryable:false,...t?{wireMessage:t}:{}})}i($r,"jobFailureError");function yt(e,t){return e===422?{kind:"species_unsupported",species:"cat"}:e===400?{kind:"pet_context_required"}:null}i(yt,"detectPhotoGate");function ft(e,t){let r={s3_key:e};return t.type!==void 0&&(r.type=t.type),t.petRef!=null&&(r.pet_id=t.petRef),t.precheckToken!=null&&(r.precheck_token=t.precheckToken),r}i(ft,"analyzeBody");var L=Object.freeze({kind:"accepted"});function mt(e){return new fe(e)}i(mt,"createPhotoController");var me=class me extends G{constructor(t){super({status:"idle",region:t.region??"skin",result:null,gate:L,error:null,isCaptureAvailable:ce(t.camera)}),this.funnel=t.funnel??Ye({auth:t.auth,...t.errorPolicy?{errorPolicy:t.errorPolicy}:{}}),this.camera=t.camera,this.upload=t.upload,this.telemetry=t.telemetry??$e,this.timers=t.timers??Xe,this.makeIdempotencyKey=t.makeIdempotencyKey??Zr();}async capture(t,r){if(!ce(this.camera))return y(f("unknown",{retryable:false}));let o;try{o=await this.camera.capture(Qe("photo"));}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),y(f("unknown",{retryable:false}))}return this.analyze(o,t,r)}async analyze(t,r,o){let n=this.beginOperation(o.signal),a=this.makeIdempotencyKey(),s=this.timers.now();this.patch({status:"capturing",region:r,error:null,result:null,gate:L});try{let l=await lt(this.funnel,{purpose:"skin_scan",contentType:t.mimeType,byteSize:ue(t),signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return T();if(!l.ok)return this.fail(n,l.error);let d=await dt(this.upload,t,l.value,a,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return T();if(!d.ok)return this.fail(n,d.error);let p=await ut(this.funnel,{s3Key:l.value.s3Key,type:r,signal:n.signal});if(n.signal.aborted||!this.alive(n.epoch))return T();if(p.verdict!=="proceed")return this.gateRetake(n,r,p.reasonCodes);this.patch({status:"analyzing"});let h=await ct(this.funnel,N.photoAnalyze,ft(l.value.s3Key,{type:r,petRef:o.petRef,precheckToken:p.precheckToken}),yt,n.signal);if(n.signal.aborted||!this.alive(n.epoch))return T();switch(h.kind){case "error":return this.fail(n,h.error);case "gate":return this.gateDomain(n,r,h.gate);case "sync":return this.complete(n,h.body,r,null,s);case "async":{let R=await pt(this.funnel,h.job.jobId,{timers:this.timers,signal:n.signal,alive:i(()=>this.alive(n.epoch),"alive"),estimatedSeconds:h.job.estimatedSeconds});if(n.signal.aborted||!this.alive(n.epoch))return T();switch(R.kind){case "aborted":return T();case "complete":return this.complete(n,R.body,r,h.job.jobId,s);case "failed":return this.fail(n,R.error);case "timeout":return this.fail(n,f("streamTimeout",{retryable:!0}));case "notFound":return this.fail(n,f("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(n,f("internalError",{retryable:!1}))}}default:return this.fail(n,f("internalError",{retryable:!1}))}}finally{n.settle();}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:L,error:null});}complete(t,r,o,n,a){if(!this.alive(t.epoch))return T();let s=Jr(r,o,n);return s.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:s.droppedOperatorKeys}),this.patch({status:"complete",result:s.result,gate:L,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:o}),this.telemetry.track("analysis.result",{capability:"photo",region:o,riskTier:s.result.riskTier??"",confidenceTier:s.result.confidenceTier??"",modelVersion:s.result.modelVersion??"",timeToResultMs:this.timers.now()-a}),z(s.result)}gateDomain(t,r,o){if(!this.alive(t.epoch))return T();let n=o.kind==="species_unsupported"?Object.freeze({kind:"species_unsupported",species:"cat"}):Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:n,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:o.kind,region:r,...o.kind==="species_unsupported"?{species:"cat"}:{}}),y(f("unknown",{retryable:false}))}gateRetake(t,r,o){if(!this.alive(t.epoch))return T();this.patch({status:"idle",gate:Object.freeze({kind:"retake",reasons:Object.freeze([...o])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:o});let n=o.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:n,region:r}),y(f("unknown",{retryable:false}))}fail(t,r){return this.alive(t.epoch)?(this.patch({status:"error",error:r,gate:L}),this.telemetry.trackExpectedFailure("analysis.error",{code:r.code,...r.httpStatus!==void 0?{httpStatus:r.httpStatus}:{}}),y(r)):T()}};i(me,"PhotoController");var fe=me;function Jr(e,t,r){let o=tt(ot(e)),n=o.metadata,a=nt(it(e));return {result:Object.freeze({jobId:r,analysisType:t,primaryLabel:m(n.primary_label)??"Uncertain",riskTier:Qr(n.risk_tier),confidence:at(n.primary_confidence),subtypeDisplay:m(n.subtype_display),confidenceTier:Xr(n.confidence_tier),diseaseName:m(n.disease_name),diseaseFraming:m(n.disease_framing),copyShort:m(n.copy_short),interpretation:a,modelVersion:m(n.model_version)??(v(e)?m(e.model_version):null)}),droppedOperatorKeys:o.droppedOperatorKeys}}i(Jr,"mapPhotoResult");function Qr(e){return e==="low_risk"||e==="concern"||e==="uncertain"?e:null}i(Qr,"asRiskTier");function Xr(e){return e==="possible"||e==="probable"?e:null}i(Xr,"asConfidenceTier");function T(){return y(f("unknown",{retryable:false}))}i(T,"abortedResult");function Zr(){let e=0;return ()=>`photo-analyze-${Date.now().toString(36)}-${(e++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}i(Zr,"defaultIdempotencyFactory");var bt=Symbol.for("@everfur/sdk#EverfurContext@v1"),gt=globalThis,ht=gt[bt]??(gt[bt]=react.createContext(null));ht.displayName??="EverfurContext";function W(){let e=react.useContext(ht);if(e===null)throw new I("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(W,"useEverfurContext");var sn=Object.freeze({status:"idle",region:"skin",result:null,gate:Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),ln=i(()=>{},"NOOP_UNSUBSCRIBE");function be(e){let{runtime:t,userRef:r,scopeEpoch:o}=W(),n=e.petRef,[a,s]=react.useState(null);react.useEffect(()=>{let{services:u}=t.registry,_=t.registry.acquire("photo",`${r??""}|${n}`,()=>mt({...u.errorPolicy?{errorPolicy:u.errorPolicy}:{},auth:u.authFor(r),camera:u.camera,upload:u.upload,telemetry:u.telemetry}),k=>k.dispose());return s(_),()=>{s(k=>k===_?null:k),t.registry.release(_);}},[t,r,n,o]);let l=react.useCallback(u=>a?a.subscribe(u):ln,[a]),d=react.useCallback(()=>a?a.getSnapshot():sn,[a]),p=react.useSyncExternalStore(l,d,d),h=react.useCallback((u,_)=>a?a.analyze(u,_,{petRef:n}):Promise.resolve(vt()),[a,n]),R=react.useCallback(u=>a?a.capture(u,{petRef:n}):Promise.resolve(vt()),[a,n]),E=react.useCallback(()=>{a?.reset();},[a]);return react.useMemo(()=>({status:p.status,region:p.region,result:p.result,gate:p.gate,error:p.error,isCaptureAvailable:p.isCaptureAvailable,isBootstrapping:a===null,analyze:h,capture:R,reset:E}),[p,a,h,R,E])}i(be,"usePhotoCheckup");function vt(){return y(f("internalError",{retryable:true}))}i(vt,"notReadyError");function ve(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))ve(e[t]);}return e}i(ve,"deepFreeze");var dn=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),_t={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Rt={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Et={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},un={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},cn={regular:"400",medium:"500",bold:"700"},pn={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},yn=0,Y="System",$="monospace",fn=["content","heading","control","compact","badge"];function mn(e){let t={};for(let r of fn)t[r]=e;return t}i(mn,"authoredTierSizes");function Tt(){return {family:Y,mono:$,fontUrl:null,families:{regular:Y,medium:Y,bold:Y,mono:$,monoMedium:$,monoBold:$},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Et,tierSizes:mn(Et),lineHeight:un,weight:cn,letterSpacing:pn,scale:1,maxScale:yn,scaleCaps:dn}}i(Tt,"baseType");var Ct={},ge=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function he(e){return `cubic-bezier(${e.join(", ")})`}i(he,"cssCubicBezier");var kt={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:he(ge.standard),emphasized:he(ge.emphasized),exit:he(ge.exit)},reducedMotion:false},bn={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",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},St=ve({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:bn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct}),gn={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",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};ve({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:gn,space:_t,radius:Rt,type:Tt(),motion:kt,slots:Ct});var xt=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wt=globalThis,Ee=wt[xt]??(wt[xt]=react.createContext(St));Ee.displayName??="EverfurThemeContext";function g(){return react.useContext(Ee)}i(g,"useEverfurTheme");function Tn(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(Tn,"tierMultiplier");function b({tier:e="content",...t}){let{type:r}=g(),o=Tn(r,e);return react.createElement(reactNative.Text,o===void 0?t:{maxFontSizeMultiplier:o,...t})}i(b,"Text");react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));var Cn=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function U(e,t){let r=e.type,o=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:o}:{fontFamily:o,fontWeight:r.weight[Cn[t]]}}i(U,"face");var Te=class Te extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,o){return Object.is(r.resetKey,o.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(Te,"HostRenderBoundary");var _e=Te;function Sn({render:e}){return e()}i(Sn,"RenderHost");function Re({render:e,fallback:t,resetKey:r}){return react.createElement(_e,{fallback:t,resetKey:r,children:react.createElement(Sn,{render:e})})}i(Re,"HostRender");var xn=Object.freeze({chat:Object.freeze(["chat.message.create"]),records:Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:Object.freeze(["records.clinic.create"]),video:Object.freeze(["video.gait.execute"]),photo:Object.freeze(["photo.checkup.execute"]),animations:Object.freeze(["animations.state.read"]),televet:Object.freeze(["televet.visit.create"])});function wn(e){return xn[e]}i(wn,"requires");function Ot(e,t,r){let o=wn(e),n=new Map;for(let l of t)n.set(l.resource,l);if(r?.isPending===true&&o.some(l=>!n.has(l)))return Ce({name:e,enabled:false,isPending:true,limits:{}});let a=Fn(o,n);return o.filter(l=>n.get(l)?.granted!==true).length===0?Ce({name:e,enabled:true,isPending:false,limits:a}):Ce({name:e,enabled:false,isPending:false,limits:a,disabled:Pn(o,n)})}i(Ot,"decideCapability");function Fn(e,t){let r={};for(let o of e){let n=t.get(o)?.limits;if(n)for(let[a,s]of Object.entries(n)){let l=r[a];r[a]=l===void 0?s:Math.min(l,s);}}return r}i(Fn,"mergeLimits");function Pn(e,t){for(let r of e){let o=t.get(r)?.disabled;if(o)return Object.freeze({reason:o.reason,level:o.level,recoverable:o.recoverable})}return Object.freeze({reason:se("accessDenied"),level:"user_entitlement",recoverable:false})}i(Pn,"disabledFor");function Ce(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),Object.freeze(t)}i(Ce,"freezeDecision");function ke(e){let{runtime:t}=W(),r=t.entitlements,o=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>Ot(e,o.decisions,{isPending:o.isPending}),[e,o])}i(ke,"useCapability");var In=48;function zn(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(zn,"selectView");function jt(e){let{capability:t,children:r,renderDisabled:o,renderPending:n,style:a}=e,s=ke(t),l=react.useMemo(()=>zn(s),[s]);switch(l){case "enabled":return r;case "pending":return n?jsxRuntime.jsx(Re,{render:n,fallback:jsxRuntime.jsx(It,{capability:t,style:a})}):jsxRuntime.jsx(It,{capability:t,style:a});case "disabled":return o?jsxRuntime.jsx(Re,{render:()=>o(s),fallback:jsxRuntime.jsx(zt,{decision:s,style:a}),resetKey:s}):jsxRuntime.jsx(zt,{decision:s,style:a});default:return j(l)}}i(jt,"CapabilityGate");function It({capability:e,style:t}){let r=g(),o=react.useMemo(()=>Dt(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[o.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:o.skeletonBar})})}i(It,"PendingSkeleton");function zt({decision:e,style:t}){let r=g(),o=react.useMemo(()=>Dt(r),[r]),n=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[o.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:n,children:n.length>0?jsxRuntime.jsx(b,{style:o.offstateText,children:n}):null})}i(zt,"OffState");function Dt(e){let{color:t,space:r,radius:o,type:n}=e;return reactNative.StyleSheet.create({offstate:{minHeight:In,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:o.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...U(e,"regular"),fontSize:n.size.body,lineHeight:Math.round(n.size.body*n.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:o.xs,backgroundColor:t.brandSofter}})}i(Dt,"makeStyles");var B=Object.freeze({title:"For educational use only",body:"Everfur is for educational purposes only. It helps you track visible changes through AI checkups. It does not diagnose, treat, prescribe, or replace veterinary care. For urgent symptoms or emergencies, contact a veterinarian immediately."});function Mt(e){let t=g(),r=react.useMemo(()=>Nn(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${B.title}. ${B.body}`,children:[jsxRuntime.jsx(b,{style:r.title,children:B.title}),jsxRuntime.jsx(b,{style:r.body,children:B.body})]})}i(Mt,"ClinicalDisclaimer");function Nn(e){let{color:t,space:r,type:o}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...U(e,"bold"),fontSize:o.size.caption,lineHeight:Math.round(o.size.caption*o.lineHeight.snug),color:t.text.secondary,letterSpacing:o.letterSpacing.eyebrow},body:{...U(e,"regular"),fontSize:o.size.caption,lineHeight:Math.round(o.size.caption*o.lineHeight.snug),color:t.text.muted}})}i(Nn,"makeStyles");var Kn=1400,Gn=300;function Bt(){let e=g(),t=react.useMemo(()=>Wn(e),[e]),r=e.motion.reducedMotion,[o,n]=react.useState(false);react.useEffect(()=>{let l=setTimeout(()=>n(true),Gn);return ()=>clearTimeout(l)},[]);let a=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{if(r||!o)return;let l=reactNative.Animated.loop(reactNative.Animated.timing(a,{toValue:1,duration:Kn,easing:reactNative.Easing.linear,useNativeDriver:true}));return l.start(),()=>l.stop()},[r,o,a]);let s=r?null:{transform:[{rotate:a.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};return jsxRuntime.jsx(reactNative.View,{style:t.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Animated.View,{style:[t.ring,s]}),jsxRuntime.jsx(b,{style:t.statusLine,children:"Analyzing"})]}):null})}i(Bt,"AnalyzingIndicator");function Wn(e){let{color:t,space:r,radius:o,type:n}=e,a=n.weight.medium,s=r.xxl*2,l=r.xs;return reactNative.StyleSheet.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl,gap:r.md},ring:{width:s,height:s,borderRadius:o.pill,borderWidth:l,borderTopColor:t.success,borderRightColor:t.success,borderBottomColor:t.borderRingCream,borderLeftColor:t.borderRingCream},statusLine:{color:t.text.secondary,fontFamily:n.family,fontSize:n.size.subtitle,lineHeight:n.size.subtitle*n.lineHeight.snug,fontWeight:a,letterSpacing:n.letterSpacing.tight,textAlign:"center"}})}i(Wn,"makeStyles");var eo=1100,to=1.6,ro=.35;function no(e,t){let{color:r}=e;switch(t){case "low_risk":return {accent:r.success,wash:r.badgeBgPositive,label:"Low risk",pulse:false};case "concern":return {accent:r.cautionAccent,wash:r.badgeBgCaution,label:"Concern",pulse:true};case "uncertain":return {accent:r.text.muted,wash:r.badgeBgNeutral,label:"Uncertain",pulse:false}}}i(no,"toneSpec");function Vt({riskTier:e}){let t=g(),r=react.useMemo(()=>oo(t),[t]),o=react.useRef(new reactNative.Animated.Value(0)).current,n=e===null?null:no(t,e),a=n!==null&&n.pulse&&!t.motion.reducedMotion;return react.useEffect(()=>{if(!a)return;let s=reactNative.Animated.loop(reactNative.Animated.timing(o,{toValue:1,duration:eo,easing:reactNative.Easing.out(reactNative.Easing.quad),useNativeDriver:true}));return s.start(),()=>s.stop()},[a,o]),n===null?null:jsxRuntime.jsxs(reactNative.View,{style:[r.pill,{backgroundColor:n.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:n.label,children:[jsxRuntime.jsxs(reactNative.View,{style:r.dotWrap,children:[a?jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[r.dotRing,{backgroundColor:n.accent,opacity:o.interpolate({inputRange:[0,1],outputRange:[ro,0]}),transform:[{scale:o.interpolate({inputRange:[0,1],outputRange:[1,to]})}]}]}):null,jsxRuntime.jsx(reactNative.View,{style:[r.dot,{backgroundColor:n.accent}]})]}),jsxRuntime.jsx(b,{style:[r.label,{color:n.accent}],children:n.label})]})}i(Vt,"SeverityBadge");function oo(e){let{space:t,radius:r,type:o}=e,n=o.weight.bold,a=t.sm;return reactNative.StyleSheet.create({pill:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:t.sm,paddingHorizontal:t.md,paddingVertical:t.xs,borderRadius:r.pill},dotWrap:{width:a,height:a,alignItems:"center",justifyContent:"center"},dot:{width:a,height:a,borderRadius:r.pill},dotRing:{position:"absolute",width:a,height:a,borderRadius:r.pill},label:{fontFamily:o.family,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.snug,fontWeight:n,letterSpacing:o.letterSpacing.eyebrow}})}i(oo,"makeStyles");var Oe=120,Z=44;function ao(e){let{petRef:t,region:r,style:o}=e;return jsxRuntime.jsx(jt,{capability:"photo",style:o,children:jsxRuntime.jsx(lo,{petRef:t,region:r,style:o})})}i(ao,"PhotoCheckup");function so(e){return e.isBootstrapping||e.status==="capturing"||e.status==="analyzing"?"loading":e.status==="error"&&e.error?"error":e.status==="complete"&&e.result?"populated":e.gate.kind!=="accepted"?"gate":e.isCaptureAvailable?"empty":"native"}i(so,"selectView");function lo({petRef:e,region:t,style:r}){let o=be({petRef:e}),n=t??"skin",a=so(o),s=react.useMemo(()=>()=>{o.capture(n);},[o,n]),l=g(),d=react.useMemo(()=>P(l),[l]);return jsxRuntime.jsxs(reactNative.View,{style:[d.container,r],children:[jsxRuntime.jsx(reactNative.View,{style:d.body,children:uo(a,o,s)}),jsxRuntime.jsx(Mt,{})]})}i(lo,"PhotoBody");function uo(e,t,r){switch(e){case "loading":return jsxRuntime.jsx(Bt,{});case "native":return jsxRuntime.jsx(co,{});case "empty":return jsxRuntime.jsx(po,{onCapture:r});case "error":return jsxRuntime.jsx(yo,{error:t.error,onRetry:r});case "gate":return jsxRuntime.jsx(fo,{gate:t.gate,onRetry:t.reset});case "populated":return jsxRuntime.jsx(bo,{result:t.result});default:return j(e)}}i(uo,"renderView");function co(){let e=g(),t=react.useMemo(()=>P(e),[e]);return jsxRuntime.jsx(reactNative.View,{style:t.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:jsxRuntime.jsx(reactNative.View,{style:t.emptyGlyph})})}i(co,"NativeUnavailableState");function po({onCapture:e}){let t=g(),r=react.useMemo(()=>P(t),[t]);return jsxRuntime.jsx(reactNative.View,{style:r.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Take a photo to check",children:jsxRuntime.jsx(reactNative.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:"Take photo",style:r.scanButton,children:jsxRuntime.jsx(b,{style:r.scanLabel,children:"Take photo"})})})}i(po,"EmptyState");function yo({error:e,onRetry:t}){let r=g(),o=react.useMemo(()=>P(r),[r]);return jsxRuntime.jsxs(reactNative.View,{style:o.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(b,{style:o.errorText,children:e.displayMessage}),e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:o.primaryButton,children:jsxRuntime.jsx(b,{style:o.primaryLabel,children:"Try again"})}):null]})}i(yo,"ErrorState");function fo({gate:e,onRetry:t}){let r=g(),o=react.useMemo(()=>P(r),[r]),n=mo(e);return jsxRuntime.jsxs(reactNative.View,{style:o.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:n,children:[jsxRuntime.jsx(b,{style:o.guidanceText,children:n}),e.kind!=="species_unsupported"?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:"Try again",style:o.primaryButton,children:jsxRuntime.jsx(b,{style:o.primaryLabel,children:"Try again"})}):null]})}i(fo,"GateState");function mo(e){switch(e.kind){case "species_unsupported":return "Photo checks are coming soon for this pet.";case "pet_context_required":return "Choose a pet first, then take the photo.";case "retake":return "That photo was hard to read. Please take another.";case "accepted":return "";default:return j(e)}}i(mo,"gateMessage");function bo({result:e}){let t=g(),r=react.useMemo(()=>P(t),[t]),o=e.subtypeDisplay??e.diseaseName??e.primaryLabel,n=go(t,e.riskTier);return jsxRuntime.jsxs(reactNative.ScrollView,{style:r.list,contentContainerStyle:[r.listContent,{backgroundColor:n}],accessibilityLabel:"Photo checkup result",children:[jsxRuntime.jsx(b,{style:r.resultHeadline,children:o}),jsxRuntime.jsx(Vt,{riskTier:e.riskTier}),e.diseaseFraming?jsxRuntime.jsx(b,{style:r.summaryText,children:e.diseaseFraming}):null,e.copyShort?jsxRuntime.jsx(b,{style:r.summaryText,children:e.copyShort}):null,e.interpretation?jsxRuntime.jsxs(reactNative.View,{style:r.interpretationBlock,children:[jsxRuntime.jsx(b,{style:r.summaryText,children:e.interpretation.summary}),jsxRuntime.jsx(b,{style:r.disclaimerText,children:e.interpretation.disclaimer})]}):null]})}i(bo,"ResultState");function go(e,t){switch(t){case "low_risk":return e.color.checkupCardLowRiskBg;case "concern":return e.color.checkupCardConcernBg;default:return e.color.surfaceCream}}i(go,"resultCardTint");function P(e){let{color:t,space:r,radius:o,type:n}=e,a=n.weight.bold,s=n.weight.medium,l=n.weight.regular,d=e.brightness==="dark"?t.onAccent:t.brand;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Oe,backgroundColor:t.background},body:{flex:1},centered:{minHeight:Oe,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},offstate:{minHeight:Oe,alignItems:"center",justifyContent:"center",padding:r.xl},emptyGlyph:{width:r.xxl,height:r.xxl,borderRadius:o.pill,backgroundColor:t.surfaceSubtle,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},scanButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.md,borderRadius:o.pill,backgroundColor:t.scanButtonPink,shadowColor:t.brand,shadowOpacity:.18,shadowRadius:o.xs,shadowOffset:{width:0,height:r.xs},elevation:3},scanLabel:{color:d,fontFamily:n.family,fontSize:n.size.subtitle,lineHeight:n.size.subtitle*n.lineHeight.snug,fontWeight:a,letterSpacing:n.letterSpacing.tight},primaryButton:{minHeight:Z,minWidth:Z,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:o.pill,backgroundColor:t.brand},primaryLabel:{color:t.onPrimary,fontFamily:n.family,fontSize:n.size.body,lineHeight:n.size.body*n.lineHeight.snug,fontWeight:s},errorText:{color:t.danger,fontFamily:n.family,fontSize:n.size.body,lineHeight:n.size.body*n.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},guidanceText:{color:t.text.muted,fontFamily:n.family,fontSize:n.size.body,lineHeight:n.size.body*n.lineHeight.relaxed,textAlign:"center",marginBottom:r.md},list:{flex:1},listContent:{padding:r.lg,gap:r.sm,borderRadius:o.lg,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,shadowColor:t.brand,shadowOpacity:.08,shadowRadius:o.xs,shadowOffset:{width:0,height:r.xs},elevation:2},resultHeadline:{color:t.text.secondary,fontFamily:n.family,fontSize:n.size.verdict,lineHeight:n.size.verdict*n.lineHeight.tight,fontWeight:a,letterSpacing:n.letterSpacing.tight},summaryText:{color:t.text.primary,fontFamily:n.family,fontSize:n.size.body,lineHeight:n.size.body*n.lineHeight.relaxed,fontWeight:l},interpretationBlock:{marginTop:r.sm,paddingTop:r.sm,gap:r.xs,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen},disclaimerText:{color:t.text.muted,fontFamily:n.family,fontSize:n.size.caption,lineHeight:n.size.caption*n.lineHeight.normal,fontWeight:l}})}i(P,"makeStyles");exports.PhotoCheckup=ao;exports.usePhotoCheckup=be;
|
|
1
|
+
"use strict";var react=require("react"),reactNative=require("react-native"),jsxRuntime=require("react/jsx-runtime");var CONTRACT_RETRYABILITY=/* @__PURE__ */Object.freeze([
|
|
2
|
+
/* @__PURE__ */Object.freeze({wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
3
|
+
/* @__PURE__ */Object.freeze({wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
4
|
+
/* @__PURE__ */Object.freeze({wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true}),
|
|
5
|
+
/* @__PURE__ */Object.freeze({wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
6
|
+
/* @__PURE__ */Object.freeze({wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
7
|
+
/* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true}),
|
|
8
|
+
/* @__PURE__ */Object.freeze({wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
9
|
+
/* @__PURE__ */Object.freeze({wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
10
|
+
/* @__PURE__ */Object.freeze({wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true}),
|
|
11
|
+
/* @__PURE__ */Object.freeze({wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false}),
|
|
12
|
+
/* @__PURE__ */Object.freeze({wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false}),
|
|
13
|
+
/* @__PURE__ */Object.freeze({wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false}),
|
|
14
|
+
/* @__PURE__ */Object.freeze({wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
15
|
+
/* @__PURE__ */Object.freeze({wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
16
|
+
/* @__PURE__ */Object.freeze({wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false}),
|
|
17
|
+
/* @__PURE__ */Object.freeze({wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
18
|
+
/* @__PURE__ */Object.freeze({wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
19
|
+
/* @__PURE__ */Object.freeze({wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
20
|
+
/* @__PURE__ */Object.freeze({wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false}),
|
|
21
|
+
/* @__PURE__ */Object.freeze({wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
22
|
+
/* @__PURE__ */Object.freeze({wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true}),
|
|
23
|
+
/* @__PURE__ */Object.freeze({wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false}),
|
|
24
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
25
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
26
|
+
/* @__PURE__ */Object.freeze({wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
27
|
+
/* @__PURE__ */Object.freeze({wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
28
|
+
/* @__PURE__ */Object.freeze({wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
29
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
30
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
31
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
32
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
33
|
+
/* @__PURE__ */Object.freeze({wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
34
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
35
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
36
|
+
/* @__PURE__ */Object.freeze({wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
37
|
+
/* @__PURE__ */Object.freeze({wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
38
|
+
/* @__PURE__ */Object.freeze({wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
39
|
+
/* @__PURE__ */Object.freeze({wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false}),
|
|
40
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
41
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false}),
|
|
42
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
43
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
44
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
45
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
46
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
47
|
+
/* @__PURE__ */Object.freeze({wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
48
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
49
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
50
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false}),
|
|
51
|
+
/* @__PURE__ */Object.freeze({wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
52
|
+
/* @__PURE__ */Object.freeze({wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false}),
|
|
53
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
54
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
55
|
+
/* @__PURE__ */Object.freeze({wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
56
|
+
/* @__PURE__ */Object.freeze({wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false}),
|
|
57
|
+
/* @__PURE__ */Object.freeze({wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
58
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
59
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
60
|
+
/* @__PURE__ */Object.freeze({wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
61
|
+
/* @__PURE__ */Object.freeze({wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
62
|
+
/* @__PURE__ */Object.freeze({wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
63
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
64
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
65
|
+
/* @__PURE__ */Object.freeze({wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
66
|
+
/* @__PURE__ */Object.freeze({wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
67
|
+
/* @__PURE__ */Object.freeze({wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
68
|
+
/* @__PURE__ */Object.freeze({wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
69
|
+
/* @__PURE__ */Object.freeze({wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false}),
|
|
70
|
+
/* @__PURE__ */Object.freeze({wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true}),
|
|
71
|
+
/* @__PURE__ */Object.freeze({wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
72
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
73
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
74
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false}),
|
|
75
|
+
/* @__PURE__ */Object.freeze({wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false}),
|
|
76
|
+
/* @__PURE__ */Object.freeze({wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true}),
|
|
77
|
+
/* @__PURE__ */Object.freeze({wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
78
|
+
/* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true}),
|
|
79
|
+
/* @__PURE__ */Object.freeze({wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
80
|
+
/* @__PURE__ */Object.freeze({wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false}),
|
|
81
|
+
/* @__PURE__ */Object.freeze({wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false}),
|
|
82
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true}),
|
|
83
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false}),
|
|
84
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true}),
|
|
85
|
+
/* @__PURE__ */Object.freeze({wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false}),
|
|
86
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
87
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false}),
|
|
88
|
+
/* @__PURE__ */Object.freeze({wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false})]);/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(row=>row.wireCode));var NORMALIZED_FOLD=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict"}),CONTRACT_ERROR_ROWS=/* @__PURE__ */Object.freeze(CONTRACT_RETRYABILITY.map(generated=>/* @__PURE__ */Object.freeze({wireCode:generated.wireCode,envelope:generated.envelope,retryable:generated.retryable,normalized:NORMALIZED_FOLD[generated.wireCode]}))),BY_KEY=new Map(CONTRACT_ERROR_ROWS.map(r=>[r.envelope+r.wireCode.toUpperCase(),r])),ENVELOPE_LOOKUP_ORDER=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(CONTRACT_ERROR_ROWS.map(r=>r.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(wireCode,envelope){if(typeof wireCode!="string")return;let key=wireCode.trim().toUpperCase();if(key.length!==0)for(let candidate of[envelope??"http_envelope",...ENVELOPE_LOOKUP_ORDER]){let row=BY_KEY.get(candidate+key);if(row)return row}}var CATEGORY_OF=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(code){return CATEGORY_OF[code]}function fromWire(wire){let contractRow=contractErrorFor(wire);if(contractRow)return contractRow.normalized;let upper=(wire??"").trim().toUpperCase(),canonical=upper.replace(/[^A-Z0-9]/g,"");if(canonical==="AUTHREJECTED")return"authRejected";if(upper.startsWith("AUTH"))return"authExpired";switch(canonical){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"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 AUTO_RETRYABLE_CODES=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(code){return AUTO_RETRYABLE_CODES.has(code)}var RETRYABLE_CONTRACT_CODES=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(code){return isAutoRetryable(code)||RETRYABLE_CONTRACT_CODES.has(code)}var BACKOFF_BASE_MS=500,BACKOFF_CAP_MS=8e3,MAX_RETRY_ATTEMPTS=4;function backoffDelayMs(attempt,rng=Math.random){let bounded=Math.max(0,attempt),ceiling=Math.min(BACKOFF_BASE_MS*2**bounded,BACKOFF_CAP_MS);return Math.floor(rng()*ceiling)}var ACCESS_DENIED_COPY="This feature isn't available on your account right now.",USER_FACING_COPY=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:ACCESS_DENIED_COPY,paymentRequired:"This is part of a paid plan.",quotaExceeded:"You have used today's messages. This resets tomorrow.",rateLimited:"You are sending messages quickly. Try again in a few seconds.",validationFailed:"Something in that request was not right. Check the details and try again.",sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:ACCESS_DENIED_COPY,unknown:"Something went wrong. Please try again."});function userFacingError(code){return USER_FACING_COPY[code]}function defineHidden(target,key,value){Object.defineProperty(target,key,{value:value,enumerable:false,writable:false,configurable:false})}var REASON_CODE_SHAPE=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(code,opts){let row=contractErrorFor(opts?.wireCode,opts?.wireEnvelope),error={code:code,category:categoryFor(code),retryable:opts?.retryable??isRetryableCode(code),displayMessage:userFacingError(code)};opts?.httpStatus!==void 0&&(error.httpStatus=opts.httpStatus),opts?.requestId&&(error.requestId=opts.requestId),typeof opts?.reasonCode=="string"&&REASON_CODE_SHAPE.test(opts.reasonCode)&&(error.reasonCode=opts.reasonCode);let wait=opts?.retryAfterSeconds;if(typeof wait=="number"&&Number.isFinite(wait)&&wait>=0&&(error.retryAfterSeconds=Math.round(wait)),row);return opts?.wireMessage&&defineHidden(error,"wireMessage",opts.wireMessage),opts?.raw!==void 0&&opts.raw!==null&&defineHidden(error,"raw",opts.raw),/* @__PURE__ */Object.freeze(error)}function ok(value,warning){/* @__PURE__ */
|
|
89
|
+
return Object.freeze({ok:true,value:value})}function err(error){/* @__PURE__ */
|
|
90
|
+
return Object.freeze({ok:false,error:error})}var EverfurConfigError=class _EverfurConfigError extends Error{constructor(kind,message){super(message),this.name="EverfurConfigError",this.kind=kind,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};function assertNever(x){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(x)}`)}function errorFrame(fields){/* @__PURE__ */
|
|
91
|
+
return Object.freeze({kind:"error",terminal:true,code:fields.code,retryable:fields.retryable,wireMessage:fields.wireMessage,synthesized:fields.synthesized,lastEventId:fields.lastEventId,serverRequestId:null})}function authHeaders(auth){let headers={};return auth.mode==="personalized"?headers.authorization=`Bearer ${auth.token}`:headers["x-everfur-partner-key"]=auth.publishableKey,auth.userRef&&(headers["x-everfur-user-ref"]=auth.userRef),auth.sessionId&&(headers["x-everfur-session-id"]=auth.sessionId),headers}function withAuthHeaders(req,auth){return{...req,headers:{...stripAuthHeaders(req.headers),...authHeaders(auth)}}}function stripAuthHeaders(headers){if(!headers)return{};let out={};for(let[key,value]of Object.entries(headers)){let lower=key.toLowerCase();lower==="authorization"||lower==="x-everfur-partner-key"||(out[key]=value)}return out}async function authedSend(req,ctx){if(ctx.mode==="anonymous")return ctx.transport.request(withAuthHeaders(req,{mode:"anonymous",publishableKey:ctx.publishableKey,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));let token;try{token=await ctx.identity.currentToken()}catch{return err(authRejectedError())}let first=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:token,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));if(first.ok||first.error.httpStatus!==401)return first;let refreshed;try{refreshed=await ctx.identity.currentToken({forceRefresh:!0})}catch{return err(authRejectedError())}let retry=await ctx.transport.request(withAuthHeaders(req,{mode:"personalized",token:refreshed,userRef:ctx.userRef,...ctx.sessionId?{sessionId:ctx.sessionId}:{}}));return!retry.ok&&retry.error.httpStatus===401?err(authRejectedError(retry.error.httpStatus)):retry}function authRejectedError(httpStatus){return makeEverfurError("authRejected",{retryable:false,...httpStatus!==void 0?{httpStatus:httpStatus}:{}})}function networkError(cause){return makeEverfurError("internalError",{retryable:true,wireMessage:describeCause(cause)})}function describeCause(cause){return cause instanceof Error?cause.message:typeof cause=="string"?cause:"network request failed"}var FUNNEL_UNARY_TIMEOUT_MS=3e4,RETRY_OVERRIDE_MAX_MS=BACKOFF_CAP_MS*2,IDEMPOTENCY_HEADER="idempotency-key",MUTATING_METHODS=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),NOOP_OBSERVER=/* @__PURE__ */Object.freeze({onEvent(){}}),defaultFunnelTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function seededIdempotencyKey(seed){let safe=seed.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return safe.length===0?null:`efs_${safe}`.slice(0,128)}function createRequestFunnel(deps){let observer=deps.observer??NOOP_OBSERVER,timers=deps.timers??defaultFunnelTimers,rng=deps.rng??Math.random,sleep=deps.sleep??((ms,signal)=>delayAbortable(ms,timers,signal)),ceiling=deps.maxAttempts??MAX_RETRY_ATTEMPTS,timeoutMs=deps.unaryTimeoutMs??FUNNEL_UNARY_TIMEOUT_MS,mintKey=deps.newIdempotencyKey??defaultIdempotencyKeyFactory(),emit=event=>{try{observer.onEvent(event)}catch{}};async function send(call,req,opts){let perCallMaxAttempts=opts?.maxAttempts,maxAttempts=Math.max(1,perCallMaxAttempts??ceiling),idempotent=opts?.idempotent??MUTATING_METHODS.has(req.method),seeded=opts?.idempotencyKey===void 0?null:seededIdempotencyKey(opts.idempotencyKey),idempotencyKey=idempotent?seeded??mintKey():null,base=assembleHeaders(req,idempotencyKey),attempt=0;for(;;){let stamp=extra=>/* @__PURE__ */Object.freeze({call:call,method:req.method,path:req.path,attempt:attempt,...idempotencyKey?{idempotencyKey:idempotencyKey}:{},...extra});emit(stamp({phase:"attempt"}));let deadline=boundedSignal(timeoutMs,timers),merged=mergeSignals(deadline.signal,req.signal),settled;try{settled=await authedSend({...base,signal:merged.signal},deps.auth)}catch(cause){settled=err(networkError(cause))}finally{merged.dispose(),deadline.cancel()}if(settled.ok)return emit(stamp({phase:"settled",ok:true,reason:"ok"})),settled;let error=settled.error,decision=decideRetry(error,attempt,{maxAttempts:maxAttempts,rng:rng,now:timers.now(),aborted:req.signal?.aborted===true,...perCallMaxAttempts!==void 0?{perCallMaxAttempts:perCallMaxAttempts}:{},...deps.errorPolicy!==void 0?{policy:deps.errorPolicy}:{}}),settledEvent={ok:false,code:error.code,reason:decision.reason,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{},...error.requestId!==void 0?{requestId:error.requestId}:{}};if(!decision.retry)return emit(stamp({phase:"settled",...settledEvent})),err(error);if(emit(stamp({phase:"retry",...settledEvent,delayMs:decision.delayMs})),await sleep(decision.delayMs,req.signal),req.signal?.aborted===true)return emit(stamp({phase:"settled",...settledEvent,reason:"aborted"})),err(error);attempt+=1}}async function authorize(req){return withAuthHeaders(req,await resolveDeviceAuth(deps.auth))}async function*stream(call,req,signal){emit(
|
|
92
|
+
/* @__PURE__ */Object.freeze({call:call,phase:"stream.open",method:req.method,path:req.path,attempt:0}));try{yield*deps.auth.transport.stream(req,signal)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
|
|
93
|
+
return Object.freeze({send:send,authorize:authorize,stream:stream})}function assembleHeaders(req,idempotencyKey){let headers={};for(let[key,value]of Object.entries(req.headers??{}))key.toLowerCase()!==IDEMPOTENCY_HEADER&&(headers[key]=value);return idempotencyKey!==null&&(headers["Idempotency-Key"]=idempotencyKey),{...req,headers:headers}}function defaultIdempotencyKeyFactory(){let counter=0;return()=>`efk_${Date.now().toString(36)}_${(counter++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var POLICY_MAX_ATTEMPTS_CAP=10;function decideRetry(error,attempt,ctx){if(ctx.aborted)return{retry:false,reason:"aborted"};let throttle=throttleKind(error);if(throttle==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(throttle!=="burst"&&!isAutoRetryable(error.code))return{retry:false,reason:"terminal-code"};let reason=throttle==="burst"?"burst-throttle":"retryable-code";if((()=>{if(ctx.policy===void 0)return false;try{return!ctx.policy.shouldRetry(error.code,attempt)}catch{return false}})())return{retry:false,reason:"terminal-code"};let policyCeiling=()=>{if(ctx.policy===void 0)return null;let raw;try{raw=ctx.policy.maxAttempts(error.code)}catch{return null}return typeof raw!="number"||!Number.isFinite(raw)?null:Math.max(1,Math.min(POLICY_MAX_ATTEMPTS_CAP,Math.floor(raw)))},ceiling=ctx.perCallMaxAttempts??policyCeiling()??ctx.maxAttempts;if(attempt+1>=ceiling)return{retry:false,reason:"attempts-exhausted"};let override=retryOverrideMs(error,ctx.now);return override!==null?override>RETRY_OVERRIDE_MAX_MS?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:reason,delayMs:override}:{retry:true,reason:reason,delayMs:backoffDelayMs(attempt,ctx.rng)}}function throttleKind(error){let code=error.code==="unknown"?fromWire(rawWireCode(error.raw)):error.code;return code==="quotaExceeded"?"quota":code==="rateLimited"||error.httpStatus===429?"burst":null}function retryOverrideMs(error,now){let at=findResetsAt(error.raw);if(at!==null){let delta=at-now;return delta>0?delta:0}let wait=findRetryAfterSeconds(error.raw);return wait===null?null:Math.round(wait*1e3)}function findRetryAfterSeconds(raw){for(let scope of candidateScopes(raw)){let value=scope.retry_after_seconds;if(typeof value=="number"&&Number.isFinite(value)&&value>=0)return value}return null}function findResetsAt(raw){for(let scope of candidateScopes(raw)){let value=scope.resets_at,parsed=parseInstantMs(value);if(parsed!==null)return parsed}return null}function candidateScopes(raw){if(!isRecord(raw))return[];let out=[raw];for(let nested of["error","detail"]){let value=raw[nested];isRecord(value)&&out.push(value)}return out}function parseInstantMs(value){if(typeof value=="number"&&Number.isFinite(value))return value<1e11?Math.round(value*1e3):Math.round(value);if(typeof value=="string"&&value.trim().length>0){let parsed=Date.parse(value);return Number.isFinite(parsed)?parsed:null}return null}function rawWireCode(raw){for(let scope of candidateScopes(raw)){let code=scope.code;if(typeof code=="string"&&code.length>0)return code}return null}function isRecord(value){return typeof value=="object"&&value!==null}async function resolveDeviceAuth(auth){return auth.mode==="anonymous"?{mode:"anonymous",publishableKey:auth.publishableKey,userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}:{mode:"personalized",token:await auth.identity.currentToken(),userRef:auth.userRef,...auth.sessionId?{sessionId:auth.sessionId}:{}}}function boundedSignal(ms,timers){let ctrl=new AbortController,handle=timers.setTimeout(()=>ctrl.abort(),ms);return{signal:ctrl.signal,cancel:()=>timers.clearTimeout(handle)}}function mergeSignals(deadline,caller){let noop=()=>{};if(!caller)return{signal:deadline,dispose:noop};let ctrl=new AbortController;if(deadline.aborted||caller.aborted)return ctrl.abort(),{signal:ctrl.signal,dispose:noop};let onAbort=()=>ctrl.abort();return deadline.addEventListener("abort",onAbort,{once:true}),caller.addEventListener("abort",onAbort,{once:true}),{signal:ctrl.signal,dispose:()=>{deadline.removeEventListener("abort",onAbort),caller.removeEventListener("abort",onAbort)}}}function delayAbortable(ms,timers,signal){return ms<=0||signal?.aborted===true?Promise.resolve():new Promise(resolve=>{let handle=timers.setTimeout(()=>{signal?.removeEventListener("abort",onAbort),resolve()},ms),onAbort=()=>{timers.clearTimeout(handle),resolve()};signal?.addEventListener("abort",onAbort,{once:true})})}var noopTelemetry=/* @__PURE__ */Object.freeze({track(){},trackExpectedFailure(){}});function fileHandleFromMedia(source){let handle={uri:source.uri,mimeType:source.mimeType},size=mediaByteSize(source);return size!==null&&(handle.sizeBytes=size),/* @__PURE__ */Object.freeze(handle)}function mediaByteSize(source){let candidate=source.byteSize??source.sizeBytes;return typeof candidate=="number"&&Number.isFinite(candidate)&&candidate>=0?candidate:null}function captureOptionsFor(mode,maxDurationSeconds){/* @__PURE__ */
|
|
94
|
+
return Object.freeze({mode:mode})}function isCaptureAvailable(camera){return camera!=null&&camera.isAvailable===true}var defaultTimers=/* @__PURE__ */Object.freeze({setTimeout:(handler,ms)=>setTimeout(handler,ms),clearTimeout:handle=>clearTimeout(handle),now:()=>Date.now()});function delayAbortable2(ms,signal,timers){return new Promise(resolve=>{if(signal.aborted){resolve();return}let holder={handle:void 0},done=()=>{timers.clearTimeout(holder.handle),signal.removeEventListener("abort",done),resolve()};holder.handle=timers.setTimeout(done,ms),signal.addEventListener("abort",done,{once:true})})}function mergeSignals2(a,b){if(!b)return a;let ctrl=new AbortController;if(a.aborted||b.aborted)return ctrl.abort(),ctrl.signal;let onAbort=()=>ctrl.abort();return a.addEventListener("abort",onAbort,{once:true}),b.addEventListener("abort",onAbort,{once:true}),ctrl.signal}var MediaStore=class{constructor(initial){this.listeners=/* @__PURE__ */new Set;this.epoch=0;this.inFlight=null;this.snapshot=/* @__PURE__ */Object.freeze({...initial})}subscribe(listener){return this.listeners.add(listener),()=>{this.listeners.delete(listener)}}getSnapshot(){return this.snapshot}patch(partial){this.snapshot=/* @__PURE__ */Object.freeze({...this.snapshot,...partial});for(let listener of this.listeners)listener()}beginOperation(external){this.inFlight?.abort();let ctrl=new AbortController;this.inFlight=ctrl;let epoch=this.epoch;return{signal:external?mergeSignals2(ctrl.signal,external):ctrl.signal,epoch:epoch,settle:()=>{this.inFlight===ctrl&&(this.inFlight=null)}}}alive(epoch){return epoch===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 hasLoneSurrogate(value){for(let i=0;i<value.length;i+=1){let code=value.charCodeAt(i);if(code>=55296&&code<=56319){let low=value.charCodeAt(i+1);if(!(low>=56320&&low<=57343))return true;i+=1}else if(code>=56320&&code<=57343)return true}return false}var CONSUMER_SAFE_DETECTION_KEYS=/* @__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"]),OPERATOR_INTERNAL_KEYS=/* @__PURE__ */Object.freeze(["decision_audit","decision_thresholds","per_class_auroc","ood_layers","gate1_score","possible_conditions","top_class"]),BOOLEAN_KEYS=/* @__PURE__ */new Set(["skin_v2","eye_v2","llm_checkup"]),CONFIDENCE_KEYS=/* @__PURE__ */new Set(["primary_confidence","subtype_confidence"]),RISK_TIER_VALUES=/* @__PURE__ */new Set(["low_risk","concern","uncertain"]),CONFIDENCE_TIER_VALUES=/* @__PURE__ */new Set(["possible","probable"]),STRING_LIMITS=/* @__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 projectDetectionMetadata(raw){let source=isRecord2(raw)?raw:{},out={};for(let key of CONSUMER_SAFE_DETECTION_KEYS){if(!(key in source))continue;let value=source[key],accepted=acceptKey(key,value);accepted!==DROP&&(out[key]=accepted)}let dropped=0;for(let key of OPERATOR_INTERNAL_KEYS)key in source&&(dropped+=1);/* @__PURE__ */
|
|
95
|
+
return Object.freeze({metadata:/* @__PURE__ */Object.freeze(out),droppedOperatorKeys:dropped})}var DROP=/* @__PURE__ */Symbol("drop");function acceptKey(key,value){if(BOOLEAN_KEYS.has(key))return typeof value=="boolean"?value:DROP;if(CONFIDENCE_KEYS.has(key))return isUnitConfidence(value)?value:DROP;if(key==="risk_tier")return typeof value=="string"&&RISK_TIER_VALUES.has(value)?value:DROP;if(key==="confidence_tier")return typeof value=="string"&&CONFIDENCE_TIER_VALUES.has(value)?value:DROP;if(typeof value!="string")return DROP;let limit=STRING_LIMITS[key]??256;return value.length>limit?value.slice(0,limit):value}function isUnitConfidence(value){return typeof value=="number"&&Number.isFinite(value)&&value>=0&&value<=1}function parseInterpretation(raw){if(!isRecord2(raw))return null;let summary=asString(raw.summary),disclaimer=asString(raw.disclaimer),recommendations=asStringList(raw.recommendations??raw.recommendation);return summary===null&&disclaimer===null&&recommendations.length===0?null:/* @__PURE__ */Object.freeze({summary:summary??"",recommendations:/* @__PURE__ */Object.freeze(recommendations),disclaimer:disclaimer??""})}function locateDetectionMetadata(body){if(!isRecord2(body))return{};if(isRecord2(body.metadata))return body.metadata;let detections=body.detections;if(Array.isArray(detections)&&detections.length>0){let first=detections[0];if(isRecord2(first)&&isRecord2(first.metadata))return first.metadata;if(isRecord2(first))return first}return body}function locateInterpretation(body){return isRecord2(body)?isRecord2(body.interpretation)?body.interpretation:body:null}function isRecord2(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function asString(value){return typeof value=="string"&&value.length>0?value:null}function asStringList(value){return typeof value=="string"?value.length>0?[value]:[]:Array.isArray(value)?value.filter(entry=>typeof entry=="string"&&entry.length>0):[]}function asUnitNumber(value){return isUnitConfidence(value)?value:null}function asFiniteNumber(value){return typeof value=="number"&&Number.isFinite(value)?value:null}var ENDPOINTS=/* @__PURE__ */Object.freeze({initiate:"/widget/v1/uploads/initiate",precheck:"/widget/v1/photo/precheck",photoAnalyze:"/widget/v1/photo/analyze",videoAnalyze:"/widget/v1/video/analyze",job:jobId=>hasLoneSurrogate(jobId)?null:`/widget/v1/analysis/jobs/${encodeURIComponent(jobId)}`});async function initiateUpload(funnel,params){let body={purpose:params.purpose,content_type:params.contentType};params.byteSize!==null&&(body.byte_size=params.byteSize);let req={method:"POST",path:ENDPOINTS.initiate,body:body,...params.signal?{signal:params.signal}:{}},res=await funnel.send("media.initiateUpload",req);if(!res.ok)return err(res.error);let policy=parsePresigned(res.value);return policy===null?err(makeEverfurError("mediaUploadFailed",{retryable:false})):ok(policy)}function parsePresigned(raw){if(!isRecord2(raw))return null;let url=asString(raw.url),s3Key=asString(raw.s3_key);if(url===null||s3Key===null)return null;let fieldsRaw=raw.fields,fields={};if(isRecord2(fieldsRaw))for(let[key,value]of Object.entries(fieldsRaw))typeof value=="string"&&(fields[key]=value);/* @__PURE__ */
|
|
96
|
+
return Object.freeze({url:url,fields:/* @__PURE__ */Object.freeze(fields),s3Key:s3Key,expiresAt:asFiniteNumber(raw.expires_at)})}async function stageUpload(upload,source,policy,idempotencyKey,signal){try{return await upload.presignedPut(fileHandleFromMedia(source),{target:policy,idempotencyKey:idempotencyKey,...signal?{signal:signal}:{}}),ok(void 0)}catch{return err(makeEverfurError("mediaUploadFailed",{retryable:false}))}}async function runPrecheck(funnel,params){let req={method:"POST",path:ENDPOINTS.precheck,body:{s3_key:params.s3Key,type:params.type},...params.signal?{signal:params.signal}:{}},res=await funnel.send("media.precheck",req);return res.ok?parsePrecheck(res.value):{verdict:"proceed",reasonCodes:[],precheckToken:null}}function parsePrecheck(raw){if(!isRecord2(raw))return{verdict:"proceed",reasonCodes:[],precheckToken:null};let verdictRaw=asString(raw.verdict),verdict=verdictRaw==="retake"||verdictRaw==="reject"?verdictRaw:"proceed",reasonCodes=Array.isArray(raw.reason_codes)?raw.reason_codes.filter(c=>typeof c=="string"):[];/* @__PURE__ */
|
|
97
|
+
return Object.freeze({verdict:verdict,reasonCodes:/* @__PURE__ */Object.freeze(reasonCodes),precheckToken:asString(raw.precheck_token)})}async function submitAnalyze(funnel,path,body,detectGate,signal){let req={method:"POST",path:path,body:body,...signal?{signal:signal}:{}},res=await funnel.send("media.analyze",req);if(res.ok){let job=parseAsyncJob(res.value);return job!==null?{kind:"async",job:job}:{kind:"sync",body:res.value}}let gate=detectGate(res.error.httpStatus,res.error);return gate!==null?{kind:"gate",gate:gate}:{kind:"error",error:res.error}}function parseAsyncJob(raw){if(!isRecord2(raw))return null;let jobId=asString(raw.job_id);if(jobId===null)return null;let status=asString(raw.status);return status!==null&&isTerminalStatus(status)?null:/* @__PURE__ */Object.freeze({jobId:jobId,estimatedSeconds:asFiniteNumber(raw.estimated_completion_seconds)})}var POLL_FIRST_DELAY_MS=2e3,POLL_MAX_DELAY_MS=5e3,POLL_BUDGET_MS=9e4;async function pollJob(funnel,jobId,deps){let{timers:timers,signal:signal,alive:alive}=deps,start=timers.now(),budget=Math.max(POLL_BUDGET_MS,(deps.estimatedSeconds??0)*1e3),delay=POLL_FIRST_DELAY_MS;for(;;){if(signal.aborted||!alive())return{kind:"aborted"};if(await delayAbortable2(delay,signal,timers),signal.aborted||!alive())return{kind:"aborted"};if(timers.now()-start>budget)return{kind:"timeout"};let path=ENDPOINTS.job(jobId);if(path===null)return{kind:"notFound"};let res=await funnel.send("media.pollJob",{method:"GET",path:path,...signal?{signal:signal}:{}},{maxAttempts:1});if(signal.aborted||!alive())return{kind:"aborted"};if(!res.ok){if(res.error.httpStatus===404)return{kind:"notFound"};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3);continue}let status=jobStatusOf(res.value);if(status==="COMPLETED")return{kind:"complete",body:res.value};if(status==="FAILED")return{kind:"failed",error:jobFailureError(res.value)};delay=Math.min(POLL_MAX_DELAY_MS,delay+1e3)}}function jobStatusOf(body){return isRecord2(body)?(asString(body.status)??"PROCESSING").toUpperCase():"PROCESSING"}function isTerminalStatus(status){let upper=status.toUpperCase();return upper==="COMPLETED"||upper==="FAILED"}function jobFailureError(body){let wire=isRecord2(body)?asString(body.error)??asString(body.error_code):null;return makeEverfurError("internalError",{retryable:false,...wire?{wireMessage:wire}:{}})}function detectPhotoGate(httpStatus,_error){return httpStatus===422?{kind:"species_unsupported",species:"cat"}:httpStatus===400?{kind:"pet_context_required"}:null}function analyzeBody(s3Key,extra){let body={s3_key:s3Key};return extra.type!==void 0&&(body.type=extra.type),extra.petRef!=null&&(body.pet_id=extra.petRef),extra.precheckToken!=null&&(body.precheck_token=extra.precheckToken),body}var ACCEPTED=/* @__PURE__ */Object.freeze({kind:"accepted"});function createPhotoController(deps){return new PhotoController(deps)}var PhotoController=class extends MediaStore{constructor(deps){super({status:"idle",region:deps.region??"skin",result:null,gate:ACCEPTED,error:null,isCaptureAvailable:isCaptureAvailable(deps.camera)}),this.funnel=deps.funnel??createRequestFunnel({auth:deps.auth,...deps.errorPolicy?{errorPolicy:deps.errorPolicy}:{}}),this.camera=deps.camera,this.upload=deps.upload,this.telemetry=deps.telemetry??noopTelemetry,this.timers=deps.timers??defaultTimers,this.makeIdempotencyKey=deps.makeIdempotencyKey??defaultIdempotencyFactory()}async capture(region,opts){if(!isCaptureAvailable(this.camera))return err(makeEverfurError("unknown",{retryable:false}));let source;try{source=await this.camera.capture(captureOptionsFor("photo"))}catch{return this.snapshot.status!=="idle"&&this.patch({status:"idle"}),err(makeEverfurError("unknown",{retryable:false}))}return this.analyze(source,region,opts)}async analyze(source,region,opts){let op=this.beginOperation(opts.signal),idempotencyKey=this.makeIdempotencyKey(),startedAt=this.timers.now();this.patch({status:"capturing",region:region,error:null,result:null,gate:ACCEPTED});try{let initiated=await initiateUpload(this.funnel,{purpose:"skin_scan",contentType:source.mimeType,byteSize:mediaByteSize(source),signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!initiated.ok)return this.fail(op,initiated.error);let staged=await stageUpload(this.upload,source,initiated.value,idempotencyKey,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(!staged.ok)return this.fail(op,staged.error);let precheck=await runPrecheck(this.funnel,{s3Key:initiated.value.s3Key,type:region,signal:op.signal});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();if(precheck.verdict!=="proceed")return this.gateRetake(op,region,precheck.reasonCodes);this.patch({status:"analyzing"});let outcome=await submitAnalyze(this.funnel,ENDPOINTS.photoAnalyze,analyzeBody(initiated.value.s3Key,{type:region,petRef:opts.petRef,precheckToken:precheck.precheckToken}),detectPhotoGate,op.signal);if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(outcome.kind){case"error":return this.fail(op,outcome.error);case"gate":return this.gateDomain(op,region,outcome.gate);case"sync":return this.complete(op,outcome.body,region,null,startedAt);case"async":{let poll=await pollJob(this.funnel,outcome.job.jobId,{timers:this.timers,signal:op.signal,alive:()=>this.alive(op.epoch),estimatedSeconds:outcome.job.estimatedSeconds});if(op.signal.aborted||!this.alive(op.epoch))return abortedResult();switch(poll.kind){case"aborted":return abortedResult();case"complete":return this.complete(op,poll.body,region,outcome.job.jobId,startedAt);case"failed":return this.fail(op,poll.error);case"timeout":return this.fail(op,makeEverfurError("streamTimeout",{retryable:!0}));case"notFound":return this.fail(op,makeEverfurError("conversationNotFound",{retryable:!1,httpStatus:404}));default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}default:return this.fail(op,makeEverfurError("internalError",{retryable:!1}))}}finally{op.settle()}}reset(){this.inFlight?.abort(),this.inFlight=null,this.patch({status:"idle",result:null,gate:ACCEPTED,error:null})}complete(op,body,region,jobId,startedAt){if(!this.alive(op.epoch))return abortedResult();let mapped=mapPhotoResult(body,region,jobId);return mapped.droppedOperatorKeys>0&&this.telemetry.track("analysis.metadata_leak_guard",{droppedKeyCount:mapped.droppedOperatorKeys}),this.patch({status:"complete",result:mapped.result,gate:ACCEPTED,error:null}),this.telemetry.track("analysis.species_gate",{outcome:"accepted",region:region}),this.telemetry.track("analysis.result",{capability:"photo",region:region,riskTier:mapped.result.riskTier??"",confidenceTier:mapped.result.confidenceTier??"",modelVersion:mapped.result.modelVersion??"",timeToResultMs:this.timers.now()-startedAt}),ok(mapped.result)}gateDomain(op,region,gate){if(!this.alive(op.epoch))return abortedResult();let outcome=gate.kind==="species_unsupported"?/* @__PURE__ */Object.freeze({kind:"species_unsupported",species:"cat"}):/* @__PURE__ */Object.freeze({kind:"pet_context_required"});return this.patch({status:"idle",gate:outcome,error:null,result:null}),this.telemetry.track("analysis.species_gate",{outcome:gate.kind,region:region,...gate.kind==="species_unsupported"?{species:"cat"}:{}}),err(makeEverfurError("unknown",{retryable:false}))}gateRetake(op,region,reasons){if(!this.alive(op.epoch))return abortedResult();this.patch({status:"idle",gate:/* @__PURE__ */Object.freeze({kind:"retake",reasons:/* @__PURE__ */Object.freeze([...reasons])}),error:null,result:null}),this.telemetry.track("analysis.quality_gate",{usable:false,reasons:reasons});let outcome=reasons.includes("wrong_species")?"species_unsupported":"retake";return this.telemetry.track("analysis.species_gate",{outcome:outcome,region:region}),err(makeEverfurError("unknown",{retryable:false}))}fail(op,error){return this.alive(op.epoch)?(this.patch({status:"error",error:error,gate:ACCEPTED}),this.telemetry.trackExpectedFailure("analysis.error",{code:error.code,...error.httpStatus!==void 0?{httpStatus:error.httpStatus}:{}}),err(error)):abortedResult()}};function mapPhotoResult(body,region,jobId){let projection=projectDetectionMetadata(locateDetectionMetadata(body)),meta=projection.metadata,interpretation=parseInterpretation(locateInterpretation(body));return{result:/* @__PURE__ */Object.freeze({jobId:jobId,analysisType:region,primaryLabel:asString(meta.primary_label)??"Uncertain",riskTier:asRiskTier(meta.risk_tier),confidence:asUnitNumber(meta.primary_confidence),subtypeDisplay:asString(meta.subtype_display),confidenceTier:asConfidenceTier(meta.confidence_tier),diseaseName:asString(meta.disease_name),diseaseFraming:asString(meta.disease_framing),copyShort:asString(meta.copy_short),interpretation:interpretation,modelVersion:asString(meta.model_version)??(isRecord2(body)?asString(body.model_version):null)}),droppedOperatorKeys:projection.droppedOperatorKeys}}function asRiskTier(value){return value==="low_risk"||value==="concern"||value==="uncertain"?value:null}function asConfidenceTier(value){return value==="possible"||value==="probable"?value:null}function abortedResult(){return err(makeEverfurError("unknown",{retryable:false}))}function defaultIdempotencyFactory(){let counter=0;return()=>`photo-analyze-${Date.now().toString(36)}-${(counter++).toString(36)}-${Math.random().toString(36).slice(2,10)}`}var EVERFUR_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),globalContextHost=globalThis,EverfurContext=globalContextHost[EVERFUR_CONTEXT_SYMBOL]??(globalContextHost[EVERFUR_CONTEXT_SYMBOL]=react.createContext(null));EverfurContext.displayName??="EverfurContext";function useEverfurContext(){let ctx=react.useContext(EverfurContext);if(ctx===null)throw new EverfurConfigError("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return ctx}var BOOTSTRAP_SNAPSHOT=/* @__PURE__ */Object.freeze({status:"idle",region:"skin",result:null,gate:/* @__PURE__ */Object.freeze({kind:"accepted"}),error:null,isCaptureAvailable:false}),NOOP_UNSUBSCRIBE=()=>{};function usePhotoCheckup(opts){let{runtime:runtime,userRef:userRef,scopeEpoch:scopeEpoch}=useEverfurContext(),petRef=opts.petRef,[controller,setController]=react.useState(null);react.useEffect(()=>{let{services:services}=runtime.registry,acquired=runtime.registry.acquire("photo",`${userRef??""}|${petRef}`,()=>createPhotoController({...services.errorPolicy?{errorPolicy:services.errorPolicy}:{},auth:services.authFor(userRef),camera:services.camera,upload:services.upload,telemetry:services.telemetry}),controller2=>controller2.dispose());return setController(acquired),()=>{setController(current=>current===acquired?null:current),runtime.registry.release(acquired)}},[runtime,userRef,petRef,scopeEpoch]);let subscribe=react.useCallback(onChange=>controller?controller.subscribe(onChange):NOOP_UNSUBSCRIBE,[controller]),getSnapshot=react.useCallback(()=>controller?controller.getSnapshot():BOOTSTRAP_SNAPSHOT,[controller]),snapshot=react.useSyncExternalStore(subscribe,getSnapshot,getSnapshot),analyze=react.useCallback((source,region)=>controller?controller.analyze(source,region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),capture=react.useCallback(region=>controller?controller.capture(region,{petRef:petRef}):Promise.resolve(notReadyError()),[controller,petRef]),reset=react.useCallback(()=>{controller?.reset()},[controller]);return react.useMemo(()=>({status:snapshot.status,region:snapshot.region,result:snapshot.result,gate:snapshot.gate,error:snapshot.error,isCaptureAvailable:snapshot.isCaptureAvailable,isBootstrapping:controller===null,analyze:analyze,capture:capture,reset:reset}),[snapshot,controller,analyze,capture,reset])}function notReadyError(){return err(makeEverfurError("internalError",{retryable:true}))}var freezeInPlace=Object.freeze;function deepFreeze(value){if(value!==null&&typeof value=="object"&&!Object.isFrozen(value)){freezeInPlace(value);for(let key of Object.keys(value))deepFreeze(value[key])}return value}var TEXT_SCALE_TIER_CAPS=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),SPACE={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},RADIUS={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},TYPE_SIZE={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},LINE_HEIGHT={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},WEIGHT={regular:"400",medium:"500",bold:"700"},LETTER_SPACING={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},DEFAULT_MAX_FONT_SCALE=0,SYSTEM_FONT_FAMILY="System",SYSTEM_MONO_FAMILY="monospace",TIERS=["content","heading","control","compact","badge"];function authoredTierSizes(size){let out={};for(let tier of TIERS)out[tier]=size;return out}var NO_FONT_SOURCES=[];function baseType(){return{family:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,fontUrl:null,families:{regular:SYSTEM_FONT_FAMILY,medium:SYSTEM_FONT_FAMILY,bold:SYSTEM_FONT_FAMILY,mono:SYSTEM_MONO_FAMILY,monoMedium:SYSTEM_MONO_FAMILY,monoBold:SYSTEM_MONO_FAMILY},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:TYPE_SIZE,tierSizes:authoredTierSizes(TYPE_SIZE),lineHeight:LINE_HEIGHT,weight:WEIGHT,letterSpacing:LETTER_SPACING,scale:1,maxScale:DEFAULT_MAX_FONT_SCALE,scaleCaps:TEXT_SCALE_TIER_CAPS,headingFamily:null,headingWeight:null,fontSources:NO_FONT_SOURCES}}var NO_SLOTS={},EASING_CURVES=/* @__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(curve){return`cubic-bezier(${curve.join(", ")})`}var MOTION={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(EASING_CURVES.standard),emphasized:cssCubicBezier(EASING_CURVES.emphasized),exit:cssCubicBezier(EASING_CURVES.exit)},reducedMotion:false},LIGHT_COLOR={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)"},EVERFUR_LIGHT=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:LIGHT_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS}),DARK_COLOR={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:DARK_COLOR,space:SPACE,radius:RADIUS,type:baseType(),motion:MOTION,slots:NO_SLOTS});var EVERFUR_THEME_CONTEXT_SYMBOL=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),globalThemeHost=globalThis,EverfurThemeContext=globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]??(globalThemeHost[EVERFUR_THEME_CONTEXT_SYMBOL]=react.createContext(EVERFUR_LIGHT));EverfurThemeContext.displayName??="EverfurThemeContext";function useEverfurTheme(){return react.useContext(EverfurThemeContext)}function tierMultiplier(type,tier){let cap=type.scaleCaps[tier];return cap>0?cap:void 0}function Text({tier:tier="content",...props}){let{type:type}=useEverfurTheme(),cap=tierMultiplier(type,tier);return react.createElement(reactNative.Text,cap===void 0?props:{maxFontSizeMultiplier:cap,...props})}react.forwardRef(function(props,ref){return react.createElement(reactNative.TextInput,{...props,...ref===null?{}:{ref:ref}})});var FACE_WEIGHT=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(theme,weight){let type=theme.type,fontFamily=type.families[weight];return weight==="mono"||type.namedFaces[weight]?{fontFamily:fontFamily}:{fontFamily:fontFamily,fontWeight:type.weight[FACE_WEIGHT[weight]]}}var HostRenderBoundary=class extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(props,state){return Object.is(props.resetKey,state.key)?null:{failed:false,key:props.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:render}){return render()}function HostRender({render:render,fallback:fallback,resetKey:resetKey}){return react.createElement(HostRenderBoundary,{fallback:fallback,resetKey:resetKey,children:react.createElement(RenderHost,{render:render})})}var REQUIRES=/* @__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"])});function requires(name){return REQUIRES[name]}function decideCapability(name,decisions,opts){let keys=requires(name),byResource=/* @__PURE__ */new Map;for(let decision of decisions)byResource.set(decision.resource,decision);if(opts?.isPending===true&&keys.some(key=>!byResource.has(key)))return freezeDecision({name:name,enabled:false,isPending:true,limits:{}});let limits=mergeLimits(keys,byResource);return keys.filter(key=>byResource.get(key)?.granted!==true).length===0?freezeDecision({name:name,enabled:true,isPending:false,limits:limits}):freezeDecision({name:name,enabled:false,isPending:false,limits:limits,disabled:disabledFor(keys,byResource)})}function mergeLimits(keys,byResource){let out={};for(let key of keys){let decisionLimits=byResource.get(key)?.limits;if(decisionLimits)for(let[limitKey,limitValue]of Object.entries(decisionLimits)){let existing=out[limitKey];out[limitKey]=existing===void 0?limitValue:Math.min(existing,limitValue)}}return out}function disabledFor(keys,byResource){for(let key of keys){let explicit=byResource.get(key)?.disabled;if(explicit)/* @__PURE__ */
|
|
98
|
+
return Object.freeze({reason:explicit.reason,level:explicit.level,recoverable:explicit.recoverable})}/* @__PURE__ */
|
|
99
|
+
return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function freezeDecision(d){let base={name:d.name,enabled:d.enabled,isPending:d.isPending,limits:/* @__PURE__ */Object.freeze({...d.limits})};return d.disabled!==void 0&&(base.disabled=d.disabled),/* @__PURE__ */Object.freeze(base)}function useCapability(name){let{runtime:runtime}=useEverfurContext(),store=runtime.entitlements,snapshot=react.useSyncExternalStore(store.subscribe,store.getSnapshot,store.getSnapshot);return react.useMemo(()=>decideCapability(name,snapshot.decisions,{isPending:snapshot.isPending}),[name,snapshot])}var MIN_OFFSTATE_HEIGHT=48;function selectView(decision){return decision.isPending?"pending":decision.enabled?"enabled":"disabled"}function CapabilityGate(props){let{capability:capability,children:children,renderDisabled:renderDisabled,renderPending:renderPending,style:style}=props,decision=useCapability(capability),view=react.useMemo(()=>selectView(decision),[decision]);switch(view){case"enabled":return children;case"pending":return renderPending?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:renderPending,fallback:/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style})}):/* @__PURE__ */jsxRuntime.jsx(PendingSkeleton,{capability:capability,style:style});case"disabled":return renderDisabled?/* @__PURE__ */jsxRuntime.jsx(HostRender,{render:()=>renderDisabled(decision),fallback:/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style}),resetKey:decision}):/* @__PURE__ */jsxRuntime.jsx(OffState,{decision:decision,style:style});default:return assertNever(view)}}function PendingSkeleton({capability:capability,style:style}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]);/* @__PURE__ */
|
|
100
|
+
return jsxRuntime.jsx(reactNative.View,{style:[styles.offstate,style],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${capability}`,children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles.skeletonBar})})}function OffState({decision:decision,style:style}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles(theme),[theme]),message=decision.disabled?.reason??"";/* @__PURE__ */
|
|
101
|
+
return jsxRuntime.jsx(reactNative.View,{style:[styles.offstate,style],accessible:true,accessibilityRole:"text",accessibilityLabel:message,children:message.length>0?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.offstateText,children:message}):null})}function makeStyles(theme){let{color:color,space:space,radius:radius,type:type}=theme;return reactNative.StyleSheet.create({offstate:{minHeight:MIN_OFFSTATE_HEIGHT,justifyContent:"center",paddingHorizontal:space.lg,paddingVertical:space.md,backgroundColor:color.surfaceCream,borderRadius:radius.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:color.brandBorder},offstateText:{...face(theme,"regular"),fontSize:type.size.body,lineHeight:Math.round(type.size.body*type.lineHeight.normal),color:color.text.muted},skeletonBar:{height:space.md,borderRadius:radius.xs,backgroundColor:color.brandSofter}})}var CLINICAL_DISCLAIMER=/* @__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(props){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles2(theme),[theme]);/* @__PURE__ */
|
|
102
|
+
return jsxRuntime.jsxs(reactNative.View,{style:[styles.container,props.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${CLINICAL_DISCLAIMER.title}. ${CLINICAL_DISCLAIMER.body}`,children:[
|
|
103
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.title,children:CLINICAL_DISCLAIMER.title}),
|
|
104
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.body,children:CLINICAL_DISCLAIMER.body})]})}function makeStyles2(theme){let{color:color,space:space,type:type}=theme;return reactNative.StyleSheet.create({container:{paddingHorizontal:space.lg,paddingVertical:space.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:color.borderHairlineGreen,backgroundColor:color.surfaceCream,gap:space.xs},title:{...face(theme,"bold"),fontSize:type.size.caption,lineHeight:Math.round(type.size.caption*type.lineHeight.snug),color:color.text.secondary,letterSpacing:type.letterSpacing.eyebrow},body:{...face(theme,"regular"),fontSize:type.size.caption,lineHeight:Math.round(type.size.caption*type.lineHeight.snug),color:color.text.muted}})}var ROTATION_PERIOD_MS=1400,REVEAL_DELAY_MS=300;function AnalyzingIndicator(){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles3(theme),[theme]),reduced=theme.motion.reducedMotion,[visible,setVisible]=react.useState(false);react.useEffect(()=>{let id=setTimeout(()=>setVisible(true),REVEAL_DELAY_MS);return()=>clearTimeout(id)},[]);let spin=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{if(reduced||!visible)return;let loop=reactNative.Animated.loop(reactNative.Animated.timing(spin,{toValue:1,duration:ROTATION_PERIOD_MS,easing:reactNative.Easing.linear,useNativeDriver:true}));return loop.start(),()=>loop.stop()},[reduced,visible,spin]);let arcMotionStyle=reduced?null:{transform:[{rotate:spin.interpolate({inputRange:[0,1],outputRange:["0deg","360deg"]})}]};/* @__PURE__ */
|
|
105
|
+
return jsxRuntime.jsx(reactNative.View,{style:styles.wrap,accessible:true,accessibilityState:{busy:true},accessibilityLabel:"Analyzing photo",children:visible?/* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[
|
|
106
|
+
/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{style:[styles.ring,arcMotionStyle]}),
|
|
107
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.statusLine,children:"Analyzing"})]}):null})}function makeStyles3(theme){let{color:color,space:space,radius:radius,type:type}=theme,medium=type.weight.medium,ringSize=space.xxl*2,ringThickness=space.xs;return reactNative.StyleSheet.create({wrap:{flexGrow:1,alignItems:"center",justifyContent:"center",padding:space.xl,gap:space.md},ring:{width:ringSize,height:ringSize,borderRadius:radius.pill,borderWidth:ringThickness,borderTopColor:color.success,borderRightColor:color.success,borderBottomColor:color.borderRingCream,borderLeftColor:color.borderRingCream},statusLine:{color:color.text.secondary,fontFamily:type.family,fontSize:type.size.subtitle,lineHeight:type.size.subtitle*type.lineHeight.snug,fontWeight:medium,letterSpacing:type.letterSpacing.tight,textAlign:"center"}})}var PULSE_PERIOD_MS=1100,PULSE_MAX_SCALE=1.6,PULSE_START_OPACITY=.35;function toneSpec(theme,tier){let{color:color}=theme;switch(tier){case"low_risk":return{accent:color.success,wash:color.badgeBgPositive,label:"Low risk",pulse:false};case"concern":return{accent:color.cautionAccent,wash:color.badgeBgCaution,label:"Concern",pulse:true};case"uncertain":return{accent:color.text.muted,wash:color.badgeBgNeutral,label:"Uncertain",pulse:false}}}function SeverityBadge({riskTier:riskTier}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles4(theme),[theme]),pulse=react.useRef(new reactNative.Animated.Value(0)).current,spec=riskTier===null?null:toneSpec(theme,riskTier),shouldPulse=spec!==null&&spec.pulse&&!theme.motion.reducedMotion;return react.useEffect(()=>{if(!shouldPulse)return;let loop=reactNative.Animated.loop(reactNative.Animated.timing(pulse,{toValue:1,duration:PULSE_PERIOD_MS,easing:reactNative.Easing.out(reactNative.Easing.quad),useNativeDriver:true}));return loop.start(),()=>loop.stop()},[shouldPulse,pulse]),spec===null?null:/* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:[styles.pill,{backgroundColor:spec.wash}],accessible:true,accessibilityRole:"text",accessibilityLabel:spec.label,children:[
|
|
108
|
+
/* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles.dotWrap,children:[shouldPulse?/* @__PURE__ */jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[styles.dotRing,{backgroundColor:spec.accent,opacity:pulse.interpolate({inputRange:[0,1],outputRange:[PULSE_START_OPACITY,0]}),transform:[{scale:pulse.interpolate({inputRange:[0,1],outputRange:[1,PULSE_MAX_SCALE]})}]}]}):null,
|
|
109
|
+
/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:[styles.dot,{backgroundColor:spec.accent}]})]}),
|
|
110
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:[styles.label,{color:spec.accent}],children:spec.label})]})}function makeStyles4(theme){let{space:space,radius:radius,type:type}=theme,bold=type.weight.bold,dotSize=space.sm;return reactNative.StyleSheet.create({pill:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:space.sm,paddingHorizontal:space.md,paddingVertical:space.xs,borderRadius:radius.pill},dotWrap:{width:dotSize,height:dotSize,alignItems:"center",justifyContent:"center"},dot:{width:dotSize,height:dotSize,borderRadius:radius.pill},dotRing:{position:"absolute",width:dotSize,height:dotSize,borderRadius:radius.pill},label:{fontFamily:type.family,fontSize:type.size.caption,lineHeight:type.size.caption*type.lineHeight.snug,fontWeight:bold,letterSpacing:type.letterSpacing.eyebrow}})}var MIN_SURFACE_HEIGHT=120,MIN_TOUCH_TARGET=44;function PhotoCheckup(props){let{petRef:petRef,region:region,style:style}=props;/* @__PURE__ */
|
|
111
|
+
return jsxRuntime.jsx(CapabilityGate,{capability:"photo",style:style,children:/* @__PURE__ */jsxRuntime.jsx(PhotoBody,{petRef:petRef,region:region,style:style})})}function selectView2(state){return state.isBootstrapping||state.status==="capturing"||state.status==="analyzing"?"loading":state.status==="error"&&state.error?"error":state.status==="complete"&&state.result?"populated":state.gate.kind!=="accepted"?"gate":state.isCaptureAvailable?"empty":"native"}function PhotoBody({petRef:petRef,region:region,style:style}){let photo=usePhotoCheckup({petRef:petRef}),activeRegion=region??"skin",view=selectView2(photo),capture=react.useMemo(()=>()=>{photo.capture(activeRegion)},[photo,activeRegion]),theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]);/* @__PURE__ */
|
|
112
|
+
return jsxRuntime.jsxs(reactNative.View,{style:[styles.container,style],children:[
|
|
113
|
+
/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles.body,children:renderView(view,photo,capture)}),
|
|
114
|
+
/* @__PURE__ */jsxRuntime.jsx(ClinicalDisclaimer,{})]})}function renderView(view,photo,capture){switch(view){case"loading":/* @__PURE__ */
|
|
115
|
+
return jsxRuntime.jsx(AnalyzingIndicator,{});case"native":/* @__PURE__ */
|
|
116
|
+
return jsxRuntime.jsx(NativeUnavailableState,{});case"empty":/* @__PURE__ */
|
|
117
|
+
return jsxRuntime.jsx(EmptyState,{onCapture:capture});case"error":/* @__PURE__ */
|
|
118
|
+
return jsxRuntime.jsx(ErrorState,{error:photo.error,onRetry:capture});case"gate":/* @__PURE__ */
|
|
119
|
+
return jsxRuntime.jsx(GateState,{gate:photo.gate,onRetry:photo.reset});case"populated":/* @__PURE__ */
|
|
120
|
+
return jsxRuntime.jsx(ResultState,{result:photo.result});default:return assertNever(view)}}function NativeUnavailableState(){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]);/* @__PURE__ */
|
|
121
|
+
return jsxRuntime.jsx(reactNative.View,{style:styles.offstate,accessible:true,accessibilityRole:"text",accessibilityLabel:"Camera is unavailable",children:/* @__PURE__ */jsxRuntime.jsx(reactNative.View,{style:styles.emptyGlyph})})}function EmptyState({onCapture:onCapture}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]);/* @__PURE__ */
|
|
122
|
+
return jsxRuntime.jsx(reactNative.View,{style:styles.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:"Take a photo to check",children:/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{onPress:onCapture,accessibilityRole:"button",accessibilityLabel:"Take photo",style:styles.scanButton,children:/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.scanLabel,children:"Take photo"})})})}function ErrorState({error:error,onRetry:onRetry}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]);/* @__PURE__ */
|
|
123
|
+
return jsxRuntime.jsxs(reactNative.View,{style:styles.centered,accessible:true,accessibilityRole:"alert",children:[
|
|
124
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.errorText,children:error.displayMessage}),error.retryable?/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{onPress:onRetry,accessibilityRole:"button",accessibilityLabel:"Try again",style:styles.primaryButton,children:/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.primaryLabel,children:"Try again"})}):null]})}function GateState({gate:gate,onRetry:onRetry}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]),message=gateMessage(gate);/* @__PURE__ */
|
|
125
|
+
return jsxRuntime.jsxs(reactNative.View,{style:styles.centered,accessible:true,accessibilityRole:"summary",accessibilityLabel:message,children:[
|
|
126
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.guidanceText,children:message}),gate.kind!=="species_unsupported"?/* @__PURE__ */jsxRuntime.jsx(reactNative.Pressable,{onPress:onRetry,accessibilityRole:"button",accessibilityLabel:"Try again",style:styles.primaryButton,children:/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.primaryLabel,children:"Try again"})}):null]})}function gateMessage(gate){switch(gate.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(gate)}}function ResultState({result:result}){let theme=useEverfurTheme(),styles=react.useMemo(()=>makeStyles5(theme),[theme]),headline=result.subtypeDisplay??result.diseaseName??result.primaryLabel,cardTint=resultCardTint(theme,result.riskTier);/* @__PURE__ */
|
|
127
|
+
return jsxRuntime.jsxs(reactNative.ScrollView,{style:styles.list,contentContainerStyle:[styles.listContent,{backgroundColor:cardTint}],accessibilityLabel:"Photo checkup result",children:[
|
|
128
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.resultHeadline,children:headline}),
|
|
129
|
+
/* @__PURE__ */jsxRuntime.jsx(SeverityBadge,{riskTier:result.riskTier}),result.diseaseFraming?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.summaryText,children:result.diseaseFraming}):null,result.copyShort?/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.summaryText,children:result.copyShort}):null,result.interpretation?/* @__PURE__ */jsxRuntime.jsxs(reactNative.View,{style:styles.interpretationBlock,children:[
|
|
130
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.summaryText,children:result.interpretation.summary}),
|
|
131
|
+
/* @__PURE__ */jsxRuntime.jsx(Text,{style:styles.disclaimerText,children:result.interpretation.disclaimer})]}):null]})}function resultCardTint(theme,riskTier){switch(riskTier){case"low_risk":return theme.color.checkupCardLowRiskBg;case"concern":return theme.color.checkupCardConcernBg;default:return theme.color.surfaceCream}}function makeStyles5(theme){let{color:color,space:space,radius:radius,type:type}=theme,bold=type.weight.bold,medium=type.weight.medium,regular=type.weight.regular,scanInk=theme.brightness==="dark"?color.onAccent:color.brand;return reactNative.StyleSheet.create({container:{flex:1,minHeight:MIN_SURFACE_HEIGHT,backgroundColor:color.background},body:{flex:1},centered:{minHeight:MIN_SURFACE_HEIGHT,flexGrow:1,alignItems:"center",justifyContent:"center",padding:space.xl},offstate:{minHeight:MIN_SURFACE_HEIGHT,alignItems:"center",justifyContent:"center",padding:space.xl},emptyGlyph:{width:space.xxl,height:space.xxl,borderRadius:radius.pill,backgroundColor:color.surfaceSubtle,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:color.brandBorder},scanButton:{minHeight:MIN_TOUCH_TARGET,minWidth:MIN_TOUCH_TARGET,alignItems:"center",justifyContent:"center",paddingHorizontal:space.xl,paddingVertical:space.md,borderRadius:radius.pill,backgroundColor:color.scanButtonPink,shadowColor:color.brand,shadowOpacity:.18,shadowRadius:radius.xs,shadowOffset:{width:0,height:space.xs},elevation:3},scanLabel:{color:scanInk,fontFamily:type.family,fontSize:type.size.subtitle,lineHeight:type.size.subtitle*type.lineHeight.snug,fontWeight:bold,letterSpacing:type.letterSpacing.tight},primaryButton:{minHeight:MIN_TOUCH_TARGET,minWidth:MIN_TOUCH_TARGET,alignItems:"center",justifyContent:"center",paddingHorizontal:space.xl,paddingVertical:space.sm,borderRadius:radius.pill,backgroundColor:color.brand},primaryLabel:{color:color.onPrimary,fontFamily:type.family,fontSize:type.size.body,lineHeight:type.size.body*type.lineHeight.snug,fontWeight:medium},errorText:{color:color.danger,fontFamily:type.family,fontSize:type.size.body,lineHeight:type.size.body*type.lineHeight.relaxed,textAlign:"center",marginBottom:space.md},guidanceText:{color:color.text.muted,fontFamily:type.family,fontSize:type.size.body,lineHeight:type.size.body*type.lineHeight.relaxed,textAlign:"center",marginBottom:space.md},list:{flex:1},listContent:{padding:space.lg,gap:space.sm,borderRadius:radius.lg,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:color.brandBorder,shadowColor:color.brand,shadowOpacity:.08,shadowRadius:radius.xs,shadowOffset:{width:0,height:space.xs},elevation:2},resultHeadline:{color:color.text.secondary,fontFamily:type.family,fontSize:type.size.verdict,lineHeight:type.size.verdict*type.lineHeight.tight,fontWeight:bold,letterSpacing:type.letterSpacing.tight},summaryText:{color:color.text.primary,fontFamily:type.family,fontSize:type.size.body,lineHeight:type.size.body*type.lineHeight.relaxed,fontWeight:regular},interpretationBlock:{marginTop:space.sm,paddingTop:space.sm,gap:space.xs,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:color.borderHairlineGreen},disclaimerText:{color:color.text.muted,fontFamily:type.family,fontSize:type.size.caption,lineHeight:type.size.caption*type.lineHeight.normal,fontWeight:regular}})}exports.PhotoCheckup=PhotoCheckup;exports.usePhotoCheckup=usePhotoCheckup;
|
package/dist/photo/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EverfurError } from '../EverfurError-
|
|
2
|
-
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-
|
|
3
|
-
import { E as EverfurResult } from '../EverfurResult-
|
|
1
|
+
import { E as EverfurError } from '../EverfurError-pEXDbUJ1.cjs';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-pEXDbUJ1.cjs';
|
|
3
|
+
import { E as EverfurResult } from '../EverfurResult-dtl8ERAw.cjs';
|
|
4
4
|
import { P as PetRef } from '../ids-B2GAAifq.cjs';
|
|
5
5
|
export { B as Brand, J as JobId, _ as __brand } from '../ids-B2GAAifq.cjs';
|
|
6
6
|
import { M as MediaSource } from '../CameraPort-Cv31Pz7g.cjs';
|
package/dist/photo/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EverfurError } from '../EverfurError-
|
|
2
|
-
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-
|
|
3
|
-
import { E as EverfurResult } from '../EverfurResult-
|
|
1
|
+
import { E as EverfurError } from '../EverfurError-pEXDbUJ1.js';
|
|
2
|
+
export { a as EverfurErrorCategory, b as EverfurErrorCode } from '../EverfurError-pEXDbUJ1.js';
|
|
3
|
+
import { E as EverfurResult } from '../EverfurResult-sKkoXew0.js';
|
|
4
4
|
import { P as PetRef } from '../ids-B2GAAifq.js';
|
|
5
5
|
export { B as Brand, J as JobId, _ as __brand } from '../ids-B2GAAifq.js';
|
|
6
6
|
import { M as MediaSource } from '../CameraPort-Cv31Pz7g.js';
|