@everfur/sdk 0.5.3 → 0.5.5
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 +109 -0
- package/README.md +8 -8
- package/dist/{Chat-a6If51cF.d.cts → Chat-BBnXSZQG.d.cts} +20 -3
- package/dist/{Chat-CNRZEu92.d.ts → Chat-BzvoUe9L.d.ts} +20 -3
- package/dist/{DepthViews-zhn3Rk5Z.d.ts → DepthViews-BYEgUxDQ.d.ts} +1 -1
- package/dist/{DepthViews-Bfv2DTUl.d.ts → DepthViews-CsVphyQL.d.ts} +1 -1
- package/dist/{DepthViews-Cl4AoL3X.d.cts → DepthViews-D-pleytA.d.cts} +1 -1
- package/dist/{DepthViews-kURiusNd.d.cts → DepthViews-DKbfq4bX.d.cts} +1 -1
- package/dist/animations/index.d.cts +3 -3
- package/dist/animations/index.d.ts +3 -3
- package/dist/{attachments-CHgc11hT.d.cts → attachments-BcD6K0IF.d.cts} +5 -5
- package/dist/{attachments-TXOhN36S.d.ts → attachments-CFK3WPF4.d.ts} +5 -5
- package/dist/{attachments-affGN_Uv.d.cts → attachments-CieUG7nB.d.cts} +2 -2
- package/dist/{attachments-5_p7kE38.d.ts → attachments-DorefS77.d.ts} +2 -2
- package/dist/{bookingCopy-BQ7Pg7qg.d.ts → bookingCopy-BUTs_nKf.d.ts} +2 -2
- package/dist/{bookingCopy-BpZvZO1S.d.cts → bookingCopy-Cl3RZ_k2.d.cts} +2 -2
- package/dist/{casesRepository-YCI0OVwl.d.ts → casesRepository-C29WolRA.d.ts} +1 -1
- package/dist/{casesRepository-z2JAFlKA.d.cts → casesRepository-Ct5MO1mM.d.cts} +1 -1
- package/dist/chat/index.cjs +1 -1
- package/dist/chat/index.d.cts +9 -9
- package/dist/chat/index.d.ts +9 -9
- package/dist/chat/index.js +1 -1
- package/dist/client/index.cjs +2 -2
- package/dist/client/index.d.cts +6 -6
- package/dist/client/index.d.ts +6 -6
- package/dist/client/index.js +2 -2
- package/dist/{config-Bkbqkjb0.d.cts → config-BBeF3kv5.d.cts} +1 -1
- package/dist/{config-BXVgTLCh.d.ts → config-Dl8Iqs1i.d.ts} +1 -1
- package/dist/consent/index.d.cts +5 -5
- package/dist/consent/index.d.ts +5 -5
- package/dist/{context-ChPrlKhy.d.cts → context-DGZrfVkE.d.cts} +5 -5
- package/dist/{context-BVpOBDMe.d.ts → context-DXj75_Lo.d.ts} +5 -5
- package/dist/{copy-Be2H2i-D.d.cts → copy-CQHEQwW7.d.cts} +2 -2
- package/dist/{copy-SxmZ-Eps.d.ts → copy-CSbMmuCV.d.ts} +2 -2
- package/dist/core/index.cjs +7 -7
- package/dist/core/index.d.cts +15 -13
- package/dist/core/index.d.ts +15 -13
- package/dist/core/index.js +7 -7
- package/dist/{depth-Dne8Qoss.d.cts → depth-Bb2yphTT.d.cts} +2 -2
- package/dist/{depth-By8dFpLA.d.ts → depth-DRzDoKeE.d.ts} +2 -2
- package/dist/{entitlementRepository-Big-K_In.d.ts → entitlementRepository-S4bU03Ld.d.ts} +9 -2
- package/dist/{entitlementRepository-BmghvtGT.d.cts → entitlementRepository-lwXYn-lq.d.cts} +9 -2
- package/dist/{identity-AuoeDRTh.d.ts → identity-C0r18khM.d.ts} +1 -1
- package/dist/{identity-Z0yj-fC_.d.cts → identity-d2lu16uc.d.cts} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +6 -6
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/{pets-DfXGYmMk.d.cts → pets-BZ0384Do.d.cts} +1 -1
- package/dist/{pets-FD-5nMXr.d.ts → pets-CJdq4rRX.d.ts} +1 -1
- package/dist/{petsRepository-CsvreWlY.d.cts → petsRepository-BHooDwb1.d.cts} +1 -1
- package/dist/{petsRepository-BaTOwJ5L.d.ts → petsRepository-DE8scL1O.d.ts} +1 -1
- package/dist/{ports-Dof7AQjk.d.cts → ports-CcUYur16.d.cts} +4 -4
- package/dist/{ports-DNIvfzBP.d.ts → ports-DWL3Nl3j.d.ts} +4 -4
- package/dist/records/depth/index.d.cts +7 -7
- package/dist/records/depth/index.d.ts +7 -7
- package/dist/records/index.d.cts +9 -9
- package/dist/records/index.d.ts +9 -9
- package/dist/{requestFunnel-CJC_q4BZ.d.ts → requestFunnel-C5LPty-S.d.ts} +2 -2
- package/dist/{requestFunnel-DrigK6q_.d.cts → requestFunnel-TtUvlQS1.d.cts} +2 -2
- package/dist/{runtimeTypes-Doj95Gll.d.cts → runtimeTypes-BbLoCs-9.d.cts} +12 -4
- package/dist/{runtimeTypes-BiqMY6pC.d.ts → runtimeTypes-CiJ6Y_wP.d.ts} +12 -4
- package/dist/server/events/index.cjs +1 -1
- package/dist/server/events/index.d.cts +2 -2
- package/dist/server/events/index.d.ts +2 -2
- package/dist/server/events/index.js +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.d.cts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +2 -2
- package/dist/televet/booking/index.cjs +1 -1
- package/dist/televet/booking/index.d.cts +6 -6
- package/dist/televet/booking/index.d.ts +6 -6
- package/dist/televet/booking/index.js +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/rn/index.d.cts +7 -7
- package/dist/testing/rn/index.d.ts +7 -7
- package/dist/testing/web/index.d.cts +7 -7
- package/dist/testing/web/index.d.ts +7 -7
- package/dist/{timelineRows-CHeqZRpM.d.cts → timelineRows-BZ4YqN5G.d.cts} +1 -1
- package/dist/{timelineRows-BHA0gIKH.d.ts → timelineRows-Bv7nr5Oz.d.ts} +1 -1
- package/dist/{useRecordsDepth-ChhS4c6r.d.cts → useRecordsDepth-BYVOh123.d.cts} +1 -1
- package/dist/{useRecordsDepth-CG63cXFZ.d.ts → useRecordsDepth-DuylsLXR.d.ts} +1 -1
- package/dist/{view-2pXv8ex7.d.cts → view-Cqtik97G.d.cts} +2 -2
- package/dist/{view-BKy44Q-3.d.ts → view-Uv0dWIQH.d.ts} +2 -2
- package/dist/web/consent/index.d.cts +5 -5
- package/dist/web/consent/index.d.ts +5 -5
- package/dist/web/index.cjs +10 -10
- package/dist/web/index.d.cts +14 -14
- package/dist/web/index.d.ts +14 -14
- package/dist/web/index.js +10 -10
- package/dist/web/notifications/index.d.cts +3 -3
- package/dist/web/notifications/index.d.ts +3 -3
- package/dist/web/records/depth/index.d.cts +7 -7
- package/dist/web/records/depth/index.d.ts +7 -7
- package/dist/web/records/index.cjs +3 -3
- package/dist/web/records/index.d.cts +9 -9
- package/dist/web/records/index.d.ts +9 -9
- package/dist/web/records/index.js +3 -3
- package/dist/web/televet/booking/index.cjs +2 -2
- package/dist/web/televet/booking/index.d.cts +9 -8
- package/dist/web/televet/booking/index.d.ts +9 -8
- package/dist/web/televet/booking/index.js +2 -2
- package/package.json +5 -4
package/dist/chat/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var react=require('react'),reactNative=require('react-native'),reactNativeSafeAreaContext=require('react-native-safe-area-context'),jsxRuntime=require('react/jsx-runtime');var bd=Object.defineProperty;var i=(e,t)=>bd(e,"name",{value:t,configurable:true});var Fr=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(Fr.map(e=>e.wireCode));var vd=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"}),mo=Object.freeze(Fr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:vd[e.wireCode]}))),Cd=new Map(mo.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),Ed=Object.freeze(["http_envelope",...[...new Set(mo.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Nt(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...Ed]){let o=Cd.get(n+r);if(o)return o}}i(Nt,"contractErrorFor");function Rd(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Rd,"contractDocUrl");function ho(e){return null}i(ho,"publishedDocUrl");var Sd=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 go(e){return Sd[e]}i(go,"categoryFor");function bo(e){let t=Nt(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "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(bo,"fromWire");var Td=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Mr(e){return Td.has(e)}i(Mr,"isAutoRetryable");var Pd=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function vo(e){return Mr(e)||Pd.has(e)}i(vo,"isRetryableCode");var wd=500,Lr=8e3,Co=4;function Eo(e,t=Math.random){let r=Math.max(0,e),n=Math.min(wd*2**r,Lr);return Math.floor(t()*n)}i(Eo,"backoffDelayMs");var kd=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 Dr(e){return kd[e]}i(Dr,"userFacingError");function Ro(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(Ro,"defineHidden");var _d=/^[a-z][a-z0-9_]{0,63}$/;function q(e,t){let r=Nt(t?.wireCode,t?.wireEnvelope),n={code:e,category:go(e),retryable:t?.retryable??vo(e),displayMessage:Dr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&_d.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Ro(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Ro(n,"raw",t.raw),Object.freeze(n)}i(q,"makeEverfurError");function de(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(de,"ok");function V(e){return Object.freeze({ok:false,error:e})}i(V,"err");var Ht=class Ht extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Ht.prototype);}};i(Ht,"EverfurConfigError");var gt=Ht;var f=Object.freeze({placeholder:"Ask me anything!",send:"Send",stop:"Stop",retry:"Try again",followUps:"Helpful follow-ups",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function j(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(j,"fillCopy");var Vr=Object.freeze([Object.freeze({key:"inaccurate",label:f.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:f.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:f.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:f.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:f.feedbackReasonOther,feedbackType:"not_helpful"})]),So=Object.freeze([Object.freeze({sentiment:"up",label:f.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:f.feedbackNeutral}),Object.freeze({sentiment:"down",label:f.feedbackNotHelpful})]);function xd(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(xd,"sentimentToFeedbackType");function To(e,t){if(e==="down"&&t!==null){let r=Vr.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return xd(e)}i(To,"feedbackTypeFor");var Po=Symbol.for("@everfur/sdk#EverfurContext@v1"),wo=globalThis,ko=wo[Po]??(wo[Po]=react.createContext(null));ko.displayName??="EverfurContext";function se(){let e=react.useContext(ko);if(e===null)throw new gt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(se,"useEverfurContext");var Ld=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function Ut(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=se(),s=e?.petRef??n??null,a=e?.conversationId??null,d=react.useMemo(()=>({runtime:t,userRef:r,petRef:s,conversationId:a,scopeEpoch:o}),[t,r,s,a,o]),[l,u]=react.useState(null),c=l?.scope===d?l.controller:t.registry.peekChat({userRef:r,petRef:s,conversationId:a}),p=react.useRef(null);react.useEffect(()=>{let g=t.registry.acquireChat({userRef:r,petRef:s,conversationId:a});return p.current=g,u({scope:d,controller:g}),()=>{p.current=null,u(E=>E?.controller===g?null:E),t.registry.releaseChat(g);}},[t,r,s,a,o,d]);let m=react.useCallback(g=>c?c.subscribe(g):Dd,[c]),b=react.useCallback(()=>c?c.getSnapshot():Ld,[c]),h=react.useSyncExternalStore(m,b,b),_=react.useCallback((g,E)=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Hr(c,c.send(g,E?.imageS3Keys===void 0?{}:{imageS3Keys:E.imageS3Keys}),()=>p.current===c):Promise.resolve(Ur()),[c]),S=react.useCallback(g=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Hr(c,c.askEverfur(g),()=>p.current===c):Promise.resolve(Ur()),[c]),T=react.useCallback(()=>c&&p.current===c?Hr(c,c.retryLast(),()=>p.current===c):Promise.resolve(Ur()),[c]),A=react.useCallback(()=>{c&&p.current===c&&c.stop();},[c]),P=react.useCallback(()=>{c&&p.current===c&&c.newConversation();},[c]),[x,y]=react.useState({controller:null,byMessage:{}}),R=x.controller===c?x.byMessage:Vd,O=react.useCallback(async(g,E,w,D)=>{if(!c||p.current!==c)return V(q("accessDenied"));let U=String(g),B=x.controller===c?x.byMessage[U]:void 0;if(B===E&&w==null)return y(re=>{let ge={...re.controller===c?re.byMessage:{}};return delete ge[U],{controller:c,byMessage:ge}}),de(Object.freeze({feedbackId:""}));y(re=>({controller:c,byMessage:{...re.controller===c?re.byMessage:{},[U]:E}}));let Z=await c.submitFeedback(g,To(E,w??null),D??null);return p.current!==c?V(q("accessDenied")):(Z.ok||y(re=>{let ge={...re.controller===c?re.byMessage:{}};return B===void 0?delete ge[U]:ge[U]=B,{controller:c,byMessage:ge}}),Z)},[c,x]),F=react.useMemo(()=>{let g=i(async E=>{if(!c||p.current!==c)return V(q("accessDenied"));let w=await E(c);return p.current===c?w:V(q("accessDenied"))},"run");return {listConversations:i(E=>g(w=>w.listConversations({...s?{petRef:s}:{},...E})),"listConversations"),getMessages:i((E,w)=>g(D=>D.getMessages(E,w)),"getMessages"),resumeConversation:i(E=>g(w=>w.resumeConversation(E)),"resumeConversation"),loadOlderMessages:i(()=>g(E=>E.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>g(E=>E.markRead()),"markRead"),refreshActiveThread:i(()=>g(E=>E.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((E,w)=>g(D=>D.answerCheckin(E,w)),"answerCheckin"),openCheckin:i(E=>g(w=>w.openCheckin(E)),"openCheckin")}},[c,s]);return react.useMemo(()=>({status:h.status,messages:h.messages,conversationId:h.conversationId,petRef:s,error:h.error,isStreaming:h.isStreaming,isBootstrapping:h.isBootstrapping,historyCursor:h.historyCursor??null,isLoadingHistory:h.isLoadingHistory??false,stopped:h.stopped??false,reconnecting:h.reconnecting??false,...F,suggestedPrompts:h.suggestedPrompts,unreadCount:h.unreadCount,hasUnreadThreads:h.hasUnreadThreads??false,newConversation:P,sentimentByMessage:R,feedback:O,send:_,askEverfur:S,retryLast:T,stop:A}),[h,s,_,S,T,A,F,P,R,O])}i(Ut,"useEverfurChat");var Dd=i(()=>{},"NOOP_UNSUBSCRIBE"),Vd=Object.freeze({});async function Hr(e,t,r){for await(let o of t);if(!r())return V(q("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?V(n.error):de(Nd(n.messages))}i(Hr,"driveToResult");function Nd(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(Nd,"lastAssistantResponseId");function Ur(){return V(q("internalError",{retryable:true}))}i(Ur,"notReadyError");function zr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))zr(e[t]);}return e}i(zr,"deepFreeze");var Hd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Io={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Ao={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},xo={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Ud={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},zd={regular:"400",medium:"500",bold:"700"},Bd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},jd=0,zt="System",Bt="monospace",Wd=["content","heading","control","compact","badge"];function Gd(e){let t={};for(let r of Wd)t[r]=e;return t}i(Gd,"authoredTierSizes");function Oo(){return {family:zt,mono:Bt,fontUrl:null,families:{regular:zt,medium:zt,bold:zt,mono:Bt,monoMedium:Bt,monoBold:Bt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:xo,tierSizes:Gd(xo),lineHeight:Ud,weight:zd,letterSpacing:Bd,scale:1,maxScale:jd,scaleCaps:Hd}}i(Oo,"baseType");var Fo={},Ne=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function jt(e){return `cubic-bezier(${e.join(", ")})`}i(jt,"cssCubicBezier");var Mo={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:jt(Ne.standard),emphasized:jt(Ne.emphasized),exit:jt(Ne.exit)},reducedMotion:false},qd={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Lo=zr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:qd,space:Io,radius:Ao,type:Oo(),motion:Mo,slots:Fo}),Yd={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};zr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:Yd,space:Io,radius:Ao,type:Oo(),motion:Mo,slots:Fo});var Do=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Vo=globalThis,Br=Vo[Do]??(Vo[Do]=react.createContext(Lo));Br.displayName??="EverfurThemeContext";function I(){return react.useContext(Br)}i(I,"useEverfurTheme");function Jd(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(Jd,"tierMultiplier");function v({tier:e="content",...t}){let{type:r}=I(),n=Jd(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(v,"Text");var rt=react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function Wt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(Wt,"assertNever");function Ho(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(Ho,"errorFrame");function ru(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(ru,"authHeaders");function bt(e,t){return {...e,headers:{...nu(e.headers),...ru(t)}}}i(bt,"withAuthHeaders");function nu(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(nu,"stripAuthHeaders");async function Uo(e,t){if(t.mode==="anonymous")return t.transport.request(bt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return V(jr())}let n=await t.transport.request(bt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return V(jr())}let s=await t.transport.request(bt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?V(jr(s.error.httpStatus)):s}i(Uo,"authedSend");function jr(e){return q("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(jr,"authRejectedError");function zo(e){return q("internalError",{retryable:true,wireMessage:ou(e)})}i(zo,"networkError");function ou(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(ou,"describeCause");var iu=3e4,su=Lr*2,au="idempotency-key",lu=new Set(["POST","PUT","PATCH","DELETE"]),du=Object.freeze({onEvent(){}}),uu=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function cu(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(cu,"seededIdempotencyKey");function He(e){let t=e.observer??du,r=e.timers??uu,n=e.rng??Math.random,o=e.sleep??((m,b)=>Pu(m,r,b)),s=e.maxAttempts??Co,a=e.unaryTimeoutMs??iu,d=e.newIdempotencyKey??fu(),l=i(m=>{try{t.onEvent(m);}catch{}},"emit");async function u(m,b,h){let _=h?.maxAttempts,S=Math.max(1,_??s),T=h?.idempotent??lu.has(b.method),A=h?.idempotencyKey===void 0?null:cu(h.idempotencyKey),P=T?A??d():null,x=pu(b,P),y=0;for(;;){let R=i(U=>Object.freeze({call:m,method:b.method,path:b.path,attempt:y,...P?{idempotencyKey:P}:{},...U}),"stamp");l(R({phase:"attempt"}));let O=Su(a,r),F=Tu(O.signal,b.signal),g;try{g=await Uo({...x,signal:F.signal},e.auth);}catch(U){g=V(zo(U));}finally{F.dispose(),O.cancel();}if(g.ok)return l(R({phase:"settled",ok:true,reason:"ok"})),g;let E=g.error,w=mu(E,y,{maxAttempts:S,rng:n,now:r.now(),aborted:b.signal?.aborted===true,..._!==void 0?{perCallMaxAttempts:_}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),D={ok:false,code:E.code,reason:w.reason,...E.httpStatus!==void 0?{httpStatus:E.httpStatus}:{},...E.requestId!==void 0?{requestId:E.requestId}:{}};if(!w.retry)return l(R({phase:"settled",...D})),V(E);if(l(R({phase:"retry",...D,delayMs:w.delayMs})),await o(w.delayMs,b.signal),b.signal?.aborted===true)return l(R({phase:"settled",...D,reason:"aborted"})),V(E);y+=1;}}i(u,"send");async function c(m){return bt(m,await Ru(e.auth))}i(c,"authorize");async function*p(m,b,h){l(Object.freeze({call:m,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,h);}catch{yield Ho({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(p,"stream"),Object.freeze({send:u,authorize:c,stream:p})}i(He,"createRequestFunnel");function pu(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==au&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(pu,"assembleHeaders");function fu(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(fu,"defaultIdempotencyKeyFactory");var yu=10;function mu(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=hu(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Mr(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=i(()=>{if(r.policy===void 0)return null;let u;try{u=r.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(yu,Math.floor(u)))},"policyCeiling"),d=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let l=gu(e,r.now);return l!==null?l>su?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:l}:{retry:true,reason:o,delayMs:Eo(t,r.rng)}}i(mu,"decideRetry");function hu(e){let t=e.code==="unknown"?bo(Eu(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(hu,"throttleKind");function gu(e,t){let r=vu(e.raw);if(r!==null){let o=r-t;return o>0?o:0}let n=bu(e.raw);return n===null?null:Math.round(n*1e3)}i(gu,"retryOverrideMs");function bu(e){for(let t of Wr(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}i(bu,"findRetryAfterSeconds");function vu(e){for(let t of Wr(e)){let r=t.resets_at,n=Cu(r);if(n!==null)return n}return null}i(vu,"findResetsAt");function Wr(e){if(!Bo(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Bo(n)&&t.push(n);}return t}i(Wr,"candidateScopes");function Cu(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(Cu,"parseInstantMs");function Eu(e){for(let t of Wr(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(Eu,"rawWireCode");function Bo(e){return typeof e=="object"&&e!==null}i(Bo,"isRecord");async function Ru(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(Ru,"resolveDeviceAuth");function Su(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(Su,"boundedSignal");function Tu(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Tu,"mergeSignals");function Pu(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}i(Pu,"delayAbortable");function Gt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(Gt,"hasLoneSurrogate");function qt(e){return [...e].length}i(qt,"serverLength");var jo=Object.freeze(["better","same","worse"]),Wo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Go=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function qo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},s=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",s),n();},"done");o.handle=r.setTimeout(s,e),t.addEventListener("abort",s,{once:true});})}i(qo,"delayAbortable");var wu="checkin",ku=/^\d{4}-\d{2}-\d{2}$/,_u="watching";function Yo(e){return e.status!=null&&e.status!==_u}i(Yo,"isCheckinSettled");function Ko(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,o]=t;return r!==wu||n===void 0||o===void 0||!Wo.test(n)||!ku.test(o)?null:{caseId:n,dueDay:o}}i(Ko,"parseCheckinOrigin");var Yt=4e3;var Kt=4e3;var Au=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function $o(e){return e!==Au}i($o,"isUploadTransportAvailable");var Ou=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var $t=10*1024*1024,Xt=5,vt=120,Fu="/widget/v1/uploads/initiate";function Mu(e){return typeof e=="string"&&Ou.includes(e.trim().toLowerCase())}i(Mu,"isAttachmentMime");function Gr(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=vt)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,vt);let n=t.slice(r);return n.length>=vt?t.slice(0,vt):`${t.slice(0,r).slice(0,vt-n.length)}${n}`}i(Gr,"sanitizeFilename");function qr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i(qr,"formatBytes");var Ct=i(e=>Object.freeze({ok:true,value:e}),"ok"),be=i(e=>Object.freeze({ok:false,error:e}),"err");function J(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(J,"failure");function Lu(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(Lu,"attachmentSize");function Du(e){let t=Gr(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!Mu(r))return be(J("unsupported_type",false,t));let n=Lu(e);return n===null?be(J("unknown",false,t)):n>$t?be(J("too_large",false,t,{sizeBytes:n})):Ct(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i(Du,"validateAttachment");function Vu(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(u=>typeof u=="string"&&u.length>0?u:null,"str"),n=i(u=>typeof u=="number"&&Number.isFinite(u)?u:null,"num"),o=r(t.upload_id),s=r(t.upload_url),a=r(t.s3_key);if(o===null||s===null||a===null)return null;let d={},l=t.upload_fields;if(typeof l=="object"&&l!==null)for(let[u,c]of Object.entries(l))typeof c=="string"&&(d[u]=c);return Object.freeze({upload_id:o,upload_url:s,upload_fields:Object.freeze(d),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??$t,s3_key:a,purpose:r(t.purpose)})}i(Vu,"parsePolicy");function Nu(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return J("quota_exceeded",false,t,{cause:e});case "rateLimited":return J("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return J("idempotency_conflict",true,t,{cause:e});case "validationFailed":return J("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return J("network",true,t,{cause:e});default:return r===429?J("rate_limited",true,t,{cause:e}):r===503?J("network",true,t,{cause:e}):r===void 0?J("network",true,t,{cause:e}):J("server",e.retryable,t,{httpStatus:r,cause:e})}}i(Nu,"initiateFailure");async function Hu(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:Fu,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return be(Nu(n.error,t.filename));let o=Vu(n.value);return o===null?be(J("server",false,t.filename)):Ct(o)}i(Hu,"initiateAttachmentUpload");async function Uu(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return be(J("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),Ct(void 0)}catch{return o()?be(J("cancelled",true,r.filename)):be(J("server",true,r.filename))}}i(Uu,"uploadAttachmentBytes");var zu=2,Bu=3,ju=Object.freeze([1e3,2e3,4e3]),Xo=0;function Wu(){return Xo+=1,`attachment-${Xo}`}i(Wu,"defaultNewId");function Qo(e){let t=Math.max(1,e.concurrency??zu),r=Math.max(1,e.maxAttempts??Bu),n=e.backoffMs??ju,o=Math.max(1,e.maxPerMessage??Xt),s=e.timers??Go,a=e.newId??Wu,d=$o(e.transport),l=new Map,u=[],c=[],p=new Set,m=new Set,b=Object.freeze({attachments:Object.freeze([])}),h=false,_=i(()=>{b=Object.freeze({attachments:Object.freeze(u.flatMap(y=>{let R=l.get(y);return R===void 0?[]:[R.state]}))});for(let y of m)y();},"publish"),S=i((y,R)=>{y.state=Object.freeze({...y.state,...R}),_();},"patch"),T=i(()=>{for(;!h&&p.size<t&&c.length>0;){let y=c.shift(),R=l.get(y);R!==void 0&&(p.add(y),A(R).finally(()=>{p.delete(y),T();}));}},"pump"),A=i(async y=>{let{attachment:R}=y;for(;y.attempts<r;){if(h||y.controller.signal.aborted)return;y.attempts+=1;let O=y.controller.signal;S(y,{status:"uploading",error:null,progress:0});let F=await Hu(e.funnel,R,{signal:O});if(h||O.aborted)return;let g;if(!F.ok)g=be(F.error);else {let U=await Uu(e.transport,F.value,R,{signal:O,onProgress:i(B=>{!O.aborted&&y.state.status==="uploading"&&S(y,{progress:Gu(B)});},"onProgress")});if(h||O.aborted)return;g=U.ok?Ct(F.value.s3_key):be(U.error);}if(g.ok){S(y,{status:"uploaded",s3Key:g.value,error:null,progress:1});return}let E=g.error,w=E.retryable&&y.attempts<r;if(S(y,{status:w?"uploading":"failed",error:E,progress:0}),!w)return;let D=n[Math.min(y.attempts-1,n.length-1)]??0;await qo(D,O,s);}},"run"),P=i(y=>{c.push(y.state.id),T();},"enqueue"),x={available:d,subscribe(y){return m.add(y),()=>{m.delete(y);}},getSnapshot:i(()=>b,"getSnapshot"),get uploading(){return b.attachments.some(y=>y.status==="uploading")},get s3Keys(){return b.attachments.flatMap(y=>y.status==="uploaded"&&y.s3Key!==null?[y.s3Key]:[])},add(y){let R=Du(y);if(!R.ok)return R;if(h||u.length>=o)return be(J("too_many",false,R.value.filename));let O=a(),F={attachment:R.value,controller:new AbortController,attempts:0,state:Object.freeze({id:O,filename:R.value.filename,previewUri:y.uri,contentType:R.value.contentType,sizeBytes:R.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return l.set(O,F),u.push(O),_(),P(F),Ct(F.state)},retry(y){let R=l.get(y);R===void 0||h||R.state.status!=="failed"||(R.controller=new AbortController,R.attempts=0,S(R,{status:"uploading",error:null,progress:0,s3Key:null}),P(R));},remove(y){let R=l.get(y);if(R===void 0)return;R.controller.abort(),l.delete(y);let O=u.indexOf(y);O>=0&&u.splice(O,1);let F=c.indexOf(y);F>=0&&c.splice(F,1),_();},clear(){for(let y of [...u])x.remove(y);},dispose(){h=true;for(let y of l.values())y.controller.abort();l.clear(),u.length=0,c.length=0,m.clear(),b=Object.freeze({attachments:Object.freeze([])});}};return x}i(Qo,"createAttachmentQueue");function Gu(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(Gu,"clamp");function ei(e){switch(e.code){case "too_large":return j(f.attachmentTooLarge,{max:qr($t),filename:e.filename,size:qr(e.sizeBytes??0)});case "too_many":return j(f.attachmentTooMany,{max:Xt});case "unsupported_type":return j(f.attachmentUnsupported,{filename:e.filename});case "network":return f.attachmentNetwork;case "server":return j(f.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return f.attachmentCancelled;case "rate_limited":return f.attachmentRateLimited;case "quota_exceeded":return f.attachmentQuota;case "idempotency_conflict":return f.attachmentConflict;case "unknown":return f.attachmentUnknown}}i(ei,"attachmentErrorMessage");function ti(e,t){return j(e>=t?f.attachmentsFull:f.addAttachment,{used:e,total:t})}i(ti,"attachControlLabel");var $u=Object.freeze({attachments:Object.freeze([])});function Yr(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=se(),o=e.maxPerMessage??Xt,s=react.useCallback(()=>{let{services:y}=t.registry;return Qo({funnel:He({auth:y.authFor(r),...y.errorPolicy?{errorPolicy:y.errorPolicy}:{}}),transport:e.transport??y.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.transport]),a=react.useMemo(()=>e.queue??s(),[e.queue,s]),d=react.useRef(new WeakSet),[l,u]=react.useState(null),c=l!==null&&l.of===a?l.queue:a;react.useEffect(()=>{if(c!==e.queue){if(d.current.has(c)){u({of:a,queue:s()});return}return ()=>{c.dispose(),d.current.add(c);}}},[c,a,s,e.queue]);let p=react.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>$u),[m,b]=react.useState(null),h=react.useCallback(y=>{let O=(Array.isArray(y)?y:[y]).map(g=>c.add(g)),F=O.find(g=>!g.ok);return F!==void 0&&!F.ok&&b(F.error),O},[c,b]),_=react.useCallback(y=>c.retry(y),[c]),S=react.useCallback(y=>c.remove(y),[c]),T=react.useCallback(()=>c.clear(),[c]),A=react.useCallback(()=>b(null),[b]),P=p.attachments.some(y=>y.status==="uploading"),x=p.attachments.some(y=>y.status==="failed");return react.useMemo(()=>({available:c.available,attachments:p.attachments,maxPerMessage:o,uploading:P,failed:x,blocked:P||x,s3Keys:p.attachments.flatMap(y=>y.status==="uploaded"&&y.s3Key!==null?[y.s3Key]:[]),rejected:m,add:h,retry:_,remove:S,clear:T,dismissRejected:A}),[c.available,p,o,P,x,m,h,_,S,T,A])}i(Yr,"useChatAttachments");var ri=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Qt(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ri,t)?ri[t]:null}i(Qt,"canonicalPetSpecies");var ni=50,Xu=128,Kr=120,oi=120,Qu=2e3,ii=120,Zu=80,li=new Set(["male","female","unknown"]),di=new Set(["day","month","year"]),ui=new Set(["low","medium","high","athletic"]),ci=new Set(["indoor","outdoor","both"]),pi=new Set(["mild","moderate","severe"]),Ju=/^(\d{4})-(\d{2})-(\d{2})$/,fi=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],yi=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...fi,...yi].map(([e])=>e));function ec(e){let t=Ju.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],s=new Date(Date.UTC(r,n-1,o));return s.getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===o}i(ec,"isRealDate");var Rt=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),tc=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),Jt=i((e,t)=>typeof t=="string"&&ec(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),Ee=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Gt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let s=qt(o);return s<=e?null:`${r} is ${s} characters; the server accepts at most ${e}`},"text"),rc={sex:Rt(li),spayedNeutered:tc,birthDate:Jt,birthDatePrecision:Rt(di),activityLevel:Rt(ui),indoorOutdoor:Rt(ci),foodBrand:Ee(ii),foodType:Ee(ii),microchipId:Ee(Zu)},$r=["ref","ref",false,Ee(Xu,{required:true,trimmed:true})],Xr=["notes","notes",false,Ee(Qu,{trimmed:true})],si=[$r,["name","name",true,Ee(Kr,{required:true,trimmed:true})],["dose","dose",false,Ee(oi,{trimmed:true})],["frequency","frequency",false,Ee(oi,{trimmed:true})],["startDate","start_date",false,Jt],["endDate","end_date",false,Jt],Xr],nc={allergies:[$r,["allergen","allergen",true,Ee(Kr,{required:true,trimmed:true})],["severity","severity",false,Rt(pi)],Xr],medications:si,supplements:si,conditions:[$r,["conditionName","condition_name",true,Ee(Kr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Jt],Xr]};function oc(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,s={};for(let[l,u,c,p]of nc[e]){let m=o[l];if(m==null){if(c)return {error:`${n}.${l} is required`};m===null&&(s[u]=null);continue}let b=p(`${n}.${l}`,m);if(b!==null)return {error:b};s[u]=m;}let a=s.start_date,d=s.end_date;return typeof a=="string"&&typeof d=="string"&&d<a?{error:`${n}.endDate must not be before startDate`}:{item:s}}i(oc,"itemToWire");function ic(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>ni)return {error:`${e} has ${t.length} items; the server accepts at most ${ni}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let s=oc(e,o,t[o]);if("error"in s)return s;let a=s.item.ref;if(typeof a=="string"){let d=a.trim();if(n.has(d))return {error:`${e}: ref ${JSON.stringify(d)} is used twice; a ref names one item`};n.add(d);}r.push(s.item);}return {items:r}}i(ic,"listToWire");function mi(e,t){let r=e,n={};for(let[a,d]of fi){let l=r[a];if(l!==void 0){if(l!==null){let u=rc[a](a,l);if(u!==null)return {error:u}}n[d]=l;}}let o=r.birthDate!==void 0,s=r.birthDatePrecision!==void 0;if(o!==s||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,d]of yi){let l=r[a];if(l===void 0)continue;let u=ic(a,l);if("error"in u)return u;n[d]=u.items;}return Object.keys(n).length>0&&t!==void 0&&Qt(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}i(mi,"petHealthToWire");var $=i(e=>typeof e=="string"?e:null,"str"),Et=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),sc=i(e=>typeof e=="boolean"?e:null,"bool");function Zt(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(Zt,"itemsFromWire");function ai(e){let t=$(e.name);return t===null||t.length===0?null:Object.freeze({ref:$(e.ref),name:t,dose:$(e.dose),frequency:$(e.frequency),startDate:$(e.start_date),endDate:$(e.end_date),notes:$(e.notes)})}i(ai,"medicationFromWire");function hi(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Et(li,e.sex),spayedNeutered:sc(e.spayed_neutered),birthDate:$(e.birth_date),birthDatePrecision:Et(di,e.birth_date_precision),activityLevel:Et(ui,e.activity_level),indoorOutdoor:Et(ci,e.indoor_outdoor),foodBrand:$(e.food_brand),foodType:$(e.food_type),microchipId:$(e.microchip_id),allergies:Zt(e.allergies,r=>{let n=$(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),allergen:n,severity:Et(pi,r.severity),notes:$(r.notes)})}),medications:Zt(e.medications,ai),supplements:Zt(e.supplements,ai),conditions:Zt(e.conditions,r=>{let n=$(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),conditionName:n,diagnosedDate:$(r.diagnosed_date),notes:$(r.notes)})})})}i(hi,"petHealthFromWire");var vi=100,Ci=50,Ei=100,Ri=50,Si=500,ac=128,lc=6e4;function Se(e){return q("validationFailed",{retryable:false,wireMessage:e})}i(Se,"invalid");function Ue(e,t,r){if(typeof t!="string")return Se(`${e} must be a string`);let n=qt(t);return n<=r?null:Se(`${e} is ${n} characters; the server accepts at most ${r}`)}i(Ue,"checkString");function er(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Se(`${e} must be a finite number between 0 and ${r}`)}i(er,"outOfRange");function gi(e,t){if(typeof e!="string")return Se("pet_ref must be a string");if(e.trim().length===0)return Se("pet_ref must not be blank");if(Gt(e))return Se("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Se("profile must be an object");let r=[Ue("pet_ref",e,ac)];return t?.name!==void 0&&r.push(Ue("name",t.name,vi)),t?.species!==void 0&&r.push(Ue("species",t.species,Ci)),t?.breed!==void 0&&r.push(Ue("breed",t.breed,Ei)),t?.ageYears!==void 0&&r.push(er("age_years",t.ageYears,Ri)),t?.weightKg!==void 0&&r.push(er("weight_kg",t.weightKg,Si)),r.find(n=>n!==null)??null}i(gi,"validate");function Ti(e,t){let r=mi(e,t);return "error"in r?{error:Se(r.error)}:r}i(Ti,"healthToWire");function dc(e){if(typeof e!="object"||e===null)return {error:Se("patch must be an object")};let t=e,r=[["name","name",s=>Ue("name",s,vi)],["species","species",s=>Ue("species",s,Ci)],["breed","breed",s=>Ue("breed",s,Ei)],["ageYears","age_years",s=>er("age_years",s,Ri)],["weightKg","weight_kg",s=>er("weight_kg",s,Si)]],n={};for(let[s,a,d]of r){let l=t[s];if(l!==void 0){if(l!==null){let u=d(l);if(u!==null)return {error:u}}n[a]=l;}}let o=Ti(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Se("patch must change at least one field")}:{body:n})}i(dc,"patchToWire");function uc(e){if(e==null)return {body:{}};let t=Ti(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}i(uc,"toWire");var Re=i(e=>typeof e=="string"?e:null,"str"),tr=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function bi(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Re(r.pet_ref)??t,name:Re(r.name),species:Re(r.species),breed:Re(r.breed),ageYears:tr(r.age_years),weightKg:tr(r.weight_kg)})}i(bi,"fromWire");function Pi(e){if(typeof e!="object"||e===null)return null;let t=e,r=Re(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Re(t.pet_id),petRef:r,name:Re(t.name),species:Re(t.species),breed:Re(t.breed),ageYears:tr(t.age_years),weightKg:tr(t.weight_kg),updatedAt:Re(t.updated_at)})}i(Pi,"widgetPetFromWire");function cc(e){let t=Pi(e);return t===null?null:Object.freeze({...t,...hi(e)})}i(cc,"widgetPetProfileFromWire");function pc(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Pi(r);return n===null?[]:[n]}))}i(pc,"petListFromWire");function rr(e){return fc(He({auth:e}),He({auth:e,unaryTimeoutMs:lc}))}i(rr,"createPetsRepository");function fc(e,t=e){let r=i((o,s)=>s?{...o,signal:s}:o,"withSignal"),n=i(o=>gi(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let s=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return s.ok?de(pc(s.value)):V(s.error)},async registerPet(o,s,a){let d=gi(o,s);if(d!==null)return V(d);let l=uc(s);if("error"in l)return V(l.error);let c={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:l.body},p=await e.send("pets.registerPet",a?.signal?{...c,signal:a.signal}:c);return p.ok?de(bi(p.value,o)):V(p.error)},async updatePet(o,s,a){let d=n(o);if(typeof d!="string")return V(d);let l=dc(s);if("error"in l)return V(l.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:d,body:l.body},a?.signal));return u.ok?de(bi(u.value,o)):V(u.error)},async getPetProfile(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},s?.signal));if(!d.ok)return V(d.error);let l=cc(d.value);return l===null?V(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):de(l)},async deletePet(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.deletePet",r({method:"DELETE",path:a},s?.signal));return d.ok?de(void 0):V(d.error)},async eraseUserData(o){let s=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return s.ok?de(void 0):V(s.error)}}}i(fc,"createPetsRepositoryOver");var hc="pet_not_registered";function _i(e){return e!=null&&e.reasonCode===hc}i(_i,"isPetNotRegistered");var gc=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function xi(e,t,r){let{runtime:n,userRef:o,scopeEpoch:s}=se(),a=react.useCallback(()=>rr(n.registry.services.authFor(o)),[n,o,s]),d=react.useMemo(()=>t===void 0?null:Zr(t),[t]),[l,u]=react.useState({key:null,status:"idle",error:null,registered:null}),c=react.useRef(0),p=react.useRef(r);p.current=r;let m=e===null||d===null?null:`${String(o)}|${s}|${e}|${d}`,b=react.useCallback(()=>{if(e===null||t===void 0||m===null)return;let _=++c.current;u({key:m,status:"registering",error:null,registered:null}),a().registerPet(e,t).then(S=>{_===c.current&&(S.ok?(u({key:m,status:"registered",error:null,registered:S.value}),p.current?.()):u({key:m,status:"failed",error:S.error,registered:null}));});},[a,e,m]);react.useEffect(()=>{if(m===null){c.current+=1;return}return b(),()=>{c.current+=1;}},[m,b]);let h=react.useCallback(()=>{l.status==="failed"&&b();},[l.status,b]);return react.useMemo(()=>m===null?gc:l.key!==m?{status:"registering",error:null,registered:null,retry:h}:{status:l.status,error:l.error,registered:l.registered,retry:h},[m,l,h])}i(xi,"useChatPetRegistration");function Zr(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(Zr).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${Zr(n)}`).join(",")}}`}i(Zr,"stableKey");var Jr=Object.freeze({});function Ai(e){let[t,r]=react.useState(Jr),n=react.useRef(null),o=react.useRef([]);o.current=e.map(a=>a.id),react.useEffect(()=>{if(e.length===0){n.current=null,r(l=>l===Jr?l:Jr);return}let a=n.current;if(a===null)return;let d=e.find(l=>l.role==="user"&&!a.known.has(l.id));d!==void 0&&(n.current=null,r(l=>({...l,[d.id]:a.images})));},[e]);let s=react.useCallback(a=>{n.current=a.length===0?null:{images:a,known:new Set(o.current)};},[]);return react.useMemo(()=>({byMessage:t,stage:s}),[t,s])}i(Ai,"useSentImages");var Sc=500;function en(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,Sc):null}i(en,"sanitizeSeedPrompt");function Fi(e,t,r){let n=en(r),o=react.useRef(e);o.current=e;let s=react.useRef(null);react.useEffect(()=>{if(n===null||t||s.current===n)return;let a=o.current;a!==void 0&&(s.current=n,Promise.resolve(a(n)).catch(()=>{}));},[n,t]);}i(Fi,"useInitialAsk");function Tc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(Tc,"isCoalesced");function Mi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:Tc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(Mi,"decideChatRefresh");function tn(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(tn,"reportHostFailure");function Pc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(Pc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return Pc(r)&&Promise.resolve(r).then(void 0,tn),r}catch(r){tn(r);return}}i(W,"callHost");var Li=new WeakMap;function Di(e){if(typeof e!="function")return;let t=Li.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return Li.set(e,r),r}i(Di,"guardHost");function ot(e,...t){let r;try{r=e(...t);}catch(n){return tn(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(ot,"callHostAsync");function Ni(e,t){let r=react.useRef(t);r.current=t;let n=react.useRef(null),o=react.useRef(null),s=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,a=react.useRef(()=>{});a.current=d=>{let{conversationId:l,isTurnInFlight:u,refresh:c}=r.current,p=Mi(d,{activeConversationId:l,isTurnInFlight:u,isOffline:s,lastRefresh:n.current,now:Date.now()});if(p.action!=="skip"){if(p.action==="defer"){o.current!=="announced"&&(o.current=d);return}o.current=null,n.current={conversationId:p.conversationId,at:Date.now()},c!==void 0&&Promise.resolve(c()).catch(()=>{});}},react.useEffect(()=>{if(t.isTurnInFlight||s)return;let d=o.current;d!==null&&a.current(d);},[t.isTurnInFlight,s]),react.useEffect(()=>{if(e===void 0)return;let d=[],l=i((u,c)=>{if(u===void 0)return;let p=W(()=>u(()=>{a.current(c);}));typeof p=="function"&&d.push(p);},"subscribe");return l(e.onForeground?.bind(e),"foreground"),l(e.onOnline?.bind(e),"foreground"),l(e.onAnnounced?.bind(e),"announced"),()=>{for(let u of d)W(u);}},[e]);}i(Ni,"useChatLifecycle");function kc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(kc,"targetKey");function Ui(e,t){let r=kc(t),n=react.useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=react.useRef(null);react.useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:s,target:a}=n.current;s===void 0||a===void 0||Promise.resolve(s(a)).catch(()=>{});},[r]);}i(Ui,"useCheckinTarget");function ji(e,t,r){let[n,o]=react.useState({send:e,conversationId:t,text:r??"",seeded:r??null}),s=n.send===e&&(n.conversationId===null||n.conversationId===t);react.useEffect(()=>{o(d=>{let l=d.send===e&&(d.conversationId===null||d.conversationId===t),u=l?d.text:"",c=l?d.seeded:null,p=r!=null&&r!==c&&u.length===0;return {send:e,conversationId:t,text:p?r:u,seeded:p?r:c}});},[e,t,r]);let a=react.useCallback(d=>o(l=>({send:e,conversationId:t,text:d,seeded:l.seeded})),[e,t]);return [s?n.text:"",a]}i(ji,"useChatDraft");function Wi(e,t,r,n){let o=react.useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let s=react.useRef(null),[a,d]=react.useState(null);react.useEffect(()=>{if(e===void 0)return;let l=`${t??""}`;if(s.current===l)return;s.current=l;let u=true;return (async()=>{let c=await ot(()=>e.read(t));if(!u)return;let p=c.ok&&typeof c.value=="string"?c.value:"";p.length>0&&o.current.draft.length===0&&o.current.setDraft(p),d(l);})(),()=>{u=false;}},[e,t]),react.useEffect(()=>{e===void 0||a!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,a]);}i(Wi,"usePersistedDraft");var Y=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",newChat:"New chat",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function or(e){let t=e?.replace(/\s+/g," ").trim();return t||Y.untitled}i(or,"conversationTitle");function qi(e){return `${e.unreadCount!==null&&e.unreadCount>0?Y.unreadPrefix:""}${Y.openConversation} ${or(e.title)}`}i(qi,"openConversationLabel");function Gi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(Gi,"normalizeForSearch");function Fc(e,t){let r=Gi(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let s=Gi(or(o.title)),a=s.indexOf(r);if(a<0)continue;let d=a===0?0:s.charAt(a-1)===" "?1:2;n[d]?.push(o);}return n.flat()}i(Fc,"filterConversations");function on(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(on,"fresh");function Yi(e){let[t,r]=react.useState(false),[n,o]=react.useState(""),s=e.listConversations,a=react.useRef(0),[d,l]=react.useState(()=>on(s)),u=d.scope===s?d:on(s);react.useEffect(()=>(a.current+=1,r(false),o(""),l(on(s)),()=>{a.current+=1;}),[s]);let c=react.useCallback(async P=>{let x=++a.current,y=P!==void 0;l(O=>({...O,scope:s,loading:!y,loadingMore:y,error:null}));let R=await e.listConversations(P?{cursor:P}:void 0);if(x===a.current){if(!R.ok){l(O=>({...O,loading:false,loadingMore:false,error:R.error.displayMessage}));return}l(O=>{let F=P&&O.scope===s?O.rows:[],g=new Set(F.map(E=>E.id));return {scope:s,loading:false,loadingMore:false,error:null,rows:[...F,...R.value.conversations.filter(E=>!g.has(E.id))],cursor:R.value.nextCursor===P?null:R.value.nextCursor}});}},[e.listConversations,s]),p=i(()=>{r(true),o(""),c();},"show"),m=i(()=>{a.current+=1,r(false);},"close"),b=i(async P=>{let x=++a.current;l(R=>({...R,loading:true,error:null}));let y=await e.resumeConversation(P);x===a.current&&(l(R=>({...R,loading:false,error:y.ok?null:y.error.displayMessage})),y.ok&&r(false));},"resume"),h=i(async()=>{let P=a.current,x=await e.loadOlderMessages();P===a.current&&!x.ok&&l(y=>({...y,error:x.error.displayMessage}));},"earlier"),_=i(()=>{e.newConversation(),a.current+=1,r(false);},"newConversation"),S=i(()=>{u.cursor===null||u.loading||u.loadingMore||n.trim().length>0||c(u.cursor);},"loadMore"),T=react.useMemo(()=>Fc(u.rows,n),[u.rows,n]),A=n.trim().length>0;return {...u,open:t,show:p,close:m,load:c,resume:b,earlier:h,newConversation:_,loadMore:S,query:n,setQuery:o,searching:A,filtered:T,emptyKind:u.rows.length===0?"empty":"noMatch"}}i(Yi,"useHistoryPanel");var ir="#111111",sr="#FFFFFF",Dc=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:ir,pillColor:sr,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:ir,pillColor:sr,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:ir,pillColor:sr,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:ir,pillColor:sr,showsVetAction:false})});function Vc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(Vc,"urgencySignature");function Nc(e){return j(f.urgencyGeneralReason,{petName:e?.trim()||f.emptyTitlePetFallback})}i(Nc,"generalUrgencyReason");function Xi(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:n.urgencyReason??null}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:Nc(t)}:null}return null}i(Xi,"latestUrgencySource");function Qi(e){let t=e===null?null:Vc(e),[r,n]=react.useState(null),[o,s]=react.useState(false);react.useEffect(()=>s(false),[t]);let d=e!==null&&(o||!(r!==null&&r===t)),l=e===null?null:Dc[e.level],u=e!==null&&!d&&e.level!=="general",c=react.useCallback(()=>{t!==null&&n(t),s(false);},[t]),p=react.useCallback(()=>s(true),[]);return react.useMemo(()=>({source:e,tier:l,signature:t,showBanner:d,showCompactIcon:u,showVetAction:d&&l!==null&&l.showsVetAction,dismissLabel:l===null?null:j(f.dismissBanner,{label:l.label}),dismiss:c,expand:p}),[e,l,t,d,u,c,p])}i(Qi,"useUrgencySurface");function Zi(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(Zi,"selectView");function Hc(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i(Hc,"needsNewConversation");function Ji(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=Hc(t);return {tone:"error",title:r?f.turnUnreachableTitle:f.turnFailedTitle,body:t.displayMessage,actionLabel:r?f.turnStartNewChat:f.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:f.turnStoppedTitle,body:f.turnStoppedBody,actionLabel:f.turnRetry,action:"retry"}:null}i(Ji,"turnNotice");function es(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(es,"awaitingAssistant");function ts(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(ts,"buildChatOpts");var Uc=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function C(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[Uc[t]]}}i(C,"face");var an=class an extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(an,"HostRenderBoundary");var sn=an;function Bc({render:e}){return e()}i(Bc,"RenderHost");function ze({render:e,fallback:t,resetKey:r}){return react.createElement(sn,{fallback:t,resetKey:r,children:react.createElement(Bc,{render:e})})}i(ze,"HostRender");var jc=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 Wc(e){return jc[e]}i(Wc,"requires");function ns(e,t,r){let n=Wc(e),o=new Map;for(let d of t)o.set(d.resource,d);if(r?.isPending===true&&n.some(d=>!o.has(d)))return ln({name:e,enabled:false,isPending:true,limits:{}});let s=Gc(n,o);return n.filter(d=>o.get(d)?.granted!==true).length===0?ln({name:e,enabled:true,isPending:false,limits:s}):ln({name:e,enabled:false,isPending:false,limits:s,disabled:qc(n,o)})}i(ns,"decideCapability");function Gc(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[s,a]of Object.entries(o)){let d=r[s];r[s]=d===void 0?a:Math.min(d,a);}}return r}i(Gc,"mergeLimits");function qc(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Dr("accessDenied"),level:"user_entitlement",recoverable:false})}i(qc,"disabledFor");function ln(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(ln,"freezeDecision");function St(e){let{runtime:t}=se(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>ns(e,n.decisions,{isPending:n.isPending}),[e,n])}i(St,"useCapability");var $c=48;function Xc(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(Xc,"selectView");function as(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:s}=e,a=St(t),d=react.useMemo(()=>Xc(a),[a]);switch(d){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(ze,{render:o,fallback:jsxRuntime.jsx(is,{capability:t,style:s})}):jsxRuntime.jsx(is,{capability:t,style:s});case "disabled":return n?jsxRuntime.jsx(ze,{render:()=>n(a),fallback:jsxRuntime.jsx(ss,{decision:a,style:s}),resetKey:a}):jsxRuntime.jsx(ss,{decision:a,style:s});default:return Wt(d)}}i(as,"CapabilityGate");function is({capability:e,style:t}){let r=I(),n=react.useMemo(()=>ls(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(is,"PendingSkeleton");function ss({decision:e,style:t}){let r=I(),n=react.useMemo(()=>ls(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(v,{style:n.offstateText,children:o}):null})}i(ss,"OffState");function ls(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:$c,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...C(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(ls,"makeStyles");var Tt=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 cs(e){let t=I(),r=react.useMemo(()=>Jc(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${Tt.title}. ${Tt.body}`,children:[jsxRuntime.jsx(v,{style:r.title,children:Tt.title}),jsxRuntime.jsx(v,{style:r.body,children:Tt.body})]})}i(cs,"ClinicalDisclaimer");function Jc(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...C(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...C(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(Jc,"makeStyles");var ee={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function X(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i(X,"box");function oe(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(oe,"stroke");function ps({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{gap:e*.22}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o})]})}i(ps,"MenuGlyph");function fs({size:e,color:t,strokeWidth:r,rotate:n}){let o=oe(e,r),s=e*.78;return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:n}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:s,height:o,borderRadius:o,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:o,height:s,borderRadius:o,backgroundColor:t}})]})}i(fs,"Cross");function ys(e){return jsxRuntime.jsx(fs,{...e,rotate:"0deg"})}i(ys,"PlusGlyph");function Be(e){return jsxRuntime.jsx(fs,{...e,rotate:"45deg"})}i(Be,"CloseGlyph");function Me({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Me,"CheckGlyph");var rp={down:{rotate:"45deg",marginTop:-0.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-0.4}};function ar({size:e,color:t,strokeWidth:r,direction:n}){let o=oe(e,r),s=e*.46,a=rp[n];return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:s,height:s,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:s*a.marginTop,marginLeft:s*a.marginLeft,transform:[{rotate:a.rotate}]}})})}i(ar,"ChevronGlyph");function ms({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{flexDirection:"row",gap:1}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(ms,"BookGlyph");function hs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.5;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i(hs,"ArrowUpRightGlyph");function gs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.6,s={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[s,{top:0,left:0}]}),jsxRuntime.jsx(reactNative.View,{style:[s,{bottom:0,right:0}]})]})}i(gs,"CopyGlyph");function lr({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let s=oe(e,r),a=n?t:"transparent";return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:o}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.05}})]})}i(lr,"ThumbGlyph");function bs({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsxRuntime.jsx(reactNative.View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(bs,"InfoGlyph");function vs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.34;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(vs,"UploadGlyph");function Cs({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Cs,"PhotoGlyph");function Es({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(Es,"CameraGlyph");function Rs({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.66;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(Rs,"SearchGlyph");function Ss({size:e,color:t,strokeWidth:r}){let n=oe(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(Ss,"EditGlyph");function Ts({size:e,color:t,strokeWidth:r}){let n=oe(e,r),o=e*.62;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Ts,"MapPinGlyph");function Ps({size:e,color:t,testID:r}){let n=e*.36;return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(Ps,"SendGlyph");function ws({size:e,color:t,testID:r}){return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(ws,"StopGlyph");function dr({size:e,strokeWidth:t,color:r,children:n}){return jsxRuntime.jsx(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:t??reactNative.StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(dr,"Ring");var Pt=Object.freeze({standard:Ne.standard,emphasized:Ne.emphasized,exit:Ne.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var ks=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),np=Object.freeze({...ks,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function _s(e){return e.motion.reducedMotion?np:ks}i(_s,"chatMotion");function ur(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(ur,"followUpDelayMs");function xs(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(xs,"nextRevealLength");function G(){let e=I();return _s(e)}i(G,"useChatMotion");var dp=8;function As(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(As,"bezierComponent");function up(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(up,"bezierSlope");function cr(e){let[t,r,n,o]=e;return s=>{if(s<=0)return 0;if(s>=1)return 1;let a=s;for(let d=0;d<dp;d+=1){let l=up(a,t,n);if(l===0)break;a-=(As(a,t,n)-s)/l;}return As(Math.min(1,Math.max(0,a)),r,o)}}i(cr,"bezierEasing");var cn=cr(Pt.standard),cp=cr(Pt.outQuad);function mn(e){let t=react.useRef(null);return t.current===null&&(t.current=new reactNative.Animated.Value(e)),t.current}i(mn,"useAnimatedValue");function je(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=mn(e>0?0:1);return react.useEffect(()=>{if(e<=0)return;let s=reactNative.Animated.timing(o,{toValue:1,duration:e,easing:cp,useNativeDriver:true}),a=n>0?reactNative.Animated.sequence([reactNative.Animated.delay(n),s]):s;return a.start(),()=>a.stop()},[o,e,n]),react.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(je,"useFadeIn");function hn({visible:e,inMs:t,outMs:r,style:n,children:o}){let[s,a]=react.useState(e),d=mn(e&&t<=0?1:0);return react.useEffect(()=>{if(e){a(true);let u=reactNative.Animated.timing(d,{toValue:1,duration:Math.max(0,t),easing:cn,useNativeDriver:true});return u.start(),()=>u.stop()}if(!s)return;if(r<=0){a(false);return}let l=reactNative.Animated.timing(d,{toValue:0,duration:r,easing:cn,useNativeDriver:true});return l.start(({finished:u})=>{u&&a(false);}),()=>l.stop()},[e,s,t,r,d]),!s&&!e?null:jsxRuntime.jsx(reactNative.Animated.View,{style:[n,{opacity:d}],children:o})}i(hn,"FadePresence");var pp=12;function N({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,hitSlop:s,...a}){let d=G(),l=mn(1),u=react.useCallback(c=>{d.pressMs<=0||d.pressScale===1||reactNative.Animated.timing(l,{toValue:c,duration:d.pressMs,easing:cn,useNativeDriver:true}).start();},[l,d.pressMs,d.pressScale]);return jsxRuntime.jsx(reactNative.Pressable,{...a,hitSlop:s??pp,style:t,onPressIn:c=>{u(d.pressScale),n?.(c);},onPressOut:c=>{u(1),o?.(c);},children:jsxRuntime.jsx(reactNative.Animated.View,{style:[e,{transform:[{scale:l}]}],children:r})})}i(N,"PressScale");function Ms(e,t,r){let n=t&&r.revealTickMs>0,[o,s]=react.useState(0),a=react.useRef(e);return a.current=e,react.useEffect(()=>{if(!n)return;let d=setInterval(()=>{s(l=>xs(r,l,a.current.length));},r.revealTickMs);return ()=>clearInterval(d)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(Ms,"useRevealedText");var Os=false;function fp(e){e.layoutMs<=0||(Os||(Os=true,reactNative.Platform.OS==="android"&&typeof reactNative.UIManager.setLayoutAnimationEnabledExperimental=="function"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true)),reactNative.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(fp,"animateLayout");function wt(e,t){let r=react.useRef(e);r.current!==e&&(r.current=e,fp(t));}i(wt,"useAnimateLayoutOn");var gn=36,Cp=22,Ep=12,Rp=12,Sp=16,Tp="#000",Pp="rgba(0,0,0,0.45)";function Ls({uri:e,label:t,onClose:r}){let n=I(),o=reactNativeSafeAreaContext.useSafeAreaInsets();return e===null?null:jsxRuntime.jsxs(reactNative.Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.closePreview,style:pr.backdrop,onPress:r,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:pr.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsxRuntime.jsx(reactNative.View,{pointerEvents:"box-none",style:[pr.closeWrap,{top:o.top+Rp}],children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.closePreview,hitSlop:Ep,style:pr.closeButton,onPress:r,children:jsxRuntime.jsx(Be,{size:Cp,color:n.color.surface,strokeWidth:2})})})]})}i(Ls,"AttachmentImageLightbox");var pr=reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:Tp,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:Sp},closeButton:{width:gn,height:gn,borderRadius:gn/2,backgroundColor:Pp,alignItems:"center",justifyContent:"center"}});var fr=12,Ip=80,bn=44,Ds=22,Ap=.14,Op=18,Fp=8,Vs=Object.freeze({photo:f.attachmentPhoto,camera:f.attachmentCamera});function Ns({sources:e,full:t,onPick:r,onClose:n}){let o=I(),s=react.useMemo(()=>Mp(o),[o]);return jsxRuntime.jsxs(reactNative.View,{style:s.anchor,pointerEvents:"box-none",children:[jsxRuntime.jsx(reactNative.Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:f.closeAttachmentPicker,onPress:n}),jsxRuntime.jsxs(reactNative.View,{style:s.bubble,children:[jsxRuntime.jsx(reactNative.View,{style:s.tilesRow,children:e.map(a=>jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:Vs[a],accessibilityState:{disabled:t},disabled:t,containerStyle:s.tile,style:s.tileInner,onPress:()=>r(a),children:[jsxRuntime.jsx(reactNative.View,{style:s.tileIconWrap,children:a==="photo"?jsxRuntime.jsx(Cs,{size:Ds,color:o.color.brandInk,strokeWidth:1.5}):jsxRuntime.jsx(Es,{size:Ds,color:o.color.brandInk,strokeWidth:1.5})}),jsxRuntime.jsx(v,{tier:"control",style:s.tileLabel,children:Vs[a]})]},a))}),jsxRuntime.jsx(reactNative.View,{style:s.tail}),jsxRuntime.jsx(reactNative.View,{style:s.tailFill})]})]})}i(Ns,"AttachmentPickerPopover");function Mp(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:Ap,shadowRadius:Op,shadowOffset:{width:0,height:Fp},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:Ip,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:bn,height:bn,borderRadius:bn/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...C(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-fr/2,width:fr,height:fr,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:fr+4,height:2,backgroundColor:t.surfaceCream}})}i(Mp,"makeStyles");function Lp(e){if(typeof e=="number")return Hs(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Cn(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Cn(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return Dp(t);if(/^[0-9a-fA-F]+$/.test(t)){let r=Cn(t);if(r!==null)return r}return /^\d+$/.test(t)?Hs(Number.parseInt(t,10)):null}i(Lp,"toRgba");function Cn(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return {r:En(t[0]),g:En(t[1]),b:En(t[2]),a:1};if(t.length===6)return {r:We(t,0),g:We(t,2),b:We(t,4),a:1};if(t.length===8){let r=We(t,0);return {r:We(t,2),g:We(t,4),b:We(t,6),a:r/255}}return null}i(Cn,"fromHex");function Dp(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(l=>l.trim());if(n.length<3)return null;let o=Rn(Number(n[0])),s=Rn(Number(n[1])),a=Rn(Number(n[2]));if(o===null||s===null||a===null)return null;let d=1;if(n.length>=4){let l=Number(n[3]);if(!Number.isFinite(l))return null;d=Math.min(1,Math.max(0,l));}return {r:o,g:s,b:a,a:d}}i(Dp,"fromRgbFunc");function Hs(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return {r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}i(Hs,"argbIntToRgba");function We(e,t){return Number.parseInt(e.slice(t,t+2),16)}i(We,"byte");function En(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}i(En,"dup");function Rn(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}i(Rn,"clampByte");function Us(e,t){let r=Lp(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return `rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}i(Us,"withAlpha");var ye=Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var Bs=56,js=12,Hp=14,Up=10,zp=.45,Bp="rgba(7,193,104,0.55)",jp="rgba(185,28,28,0.55)",Wp=200,Gp=300,Qs=20,Sn=22,qp=12,Yp="rgba(0,0,0,0.78)",Ws=220,Gs=100,qs="rgba(255,255,255,0.15)";function Zs({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:s}){let a=I(),d=react.useMemo(()=>ea(a),[a]);return e.length===0&&t===null?null:jsxRuntime.jsxs(reactNative.View,{style:d.strip,children:[e.length>0?jsxRuntime.jsx(reactNative.View,{style:d.cards,children:e.map(l=>jsxRuntime.jsx(Kp,{row:l,styles:d,onRetry:n,onRemove:o,onPreview:s},l.id))}):null,r?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:f.attachmentsFailedBlocked}):null,t!==null?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:ei(t)}):null]})}i(Zs,"AttachmentStrip");function Kp({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let s=I(),a=e.status==="uploading",d=e.status==="failed",l=e.status==="uploaded",u=react.useRef(e.status),[c,p]=react.useState(false);return react.useEffect(()=>{let m=u.current;u.current=e.status,e.status==="uploaded"&&m==="uploading"&&p(true);},[e.status]),jsxRuntime.jsxs(reactNative.View,{style:t.card,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:l?"button":"image",accessibilityLabel:l?j(f.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:a,disabled:!l},disabled:!l,style:t.thumbHit,onPress:()=>o(e),children:jsxRuntime.jsxs(reactNative.View,{style:t.thumb,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),a?jsxRuntime.jsx(reactNative.View,{style:t.uploadingOverlay,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.color.surface})}):null,c?jsxRuntime.jsx($p,{styles:t,onDone:()=>p(false)}):null]})}),d?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsxRuntime.jsx(reactNative.View,{style:t.failedInner,children:jsxRuntime.jsx(Be,{size:Qs,color:s.color.surface,strokeWidth:2})})}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:j(f.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsxRuntime.jsx(Be,{size:qp,color:s.color.surface,strokeWidth:1.5})})]})}i(Kp,"PreviewCard");function $p({styles:e,onDone:t}){let r=I(),n=G(),o=react.useRef(null);o.current===null&&(o.current=new reactNative.Animated.Value(0));let s=o.current;return react.useEffect(()=>{let a=reactNative.Animated.sequence([reactNative.Animated.timing(s,{toValue:1,duration:Wp,useNativeDriver:true}),reactNative.Animated.delay(n.uploadFlashMs),reactNative.Animated.timing(s,{toValue:0,duration:Gp,useNativeDriver:true})]);return a.start(({finished:d})=>{d&&t();}),()=>a.stop()},[s,n.uploadFlashMs,t]),jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:s}],children:jsxRuntime.jsx(Me,{size:Qs,color:r.color.surface,strokeWidth:2})})}i($p,"SuccessFlash");function Js({images:e,onPreview:t}){let r=I(),n=react.useMemo(()=>ea(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsxRuntime.jsx(reactNative.View,{style:o?n.sentSingle:n.sentGrid,children:e.map((s,a)=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.attachedImage,{filename:s.filename}),onPress:()=>t(s),children:jsxRuntime.jsx(reactNative.Image,{source:{uri:s.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${s.uri}-${a}`))})}i(Js,"SentImages");function ea(e){let t=e.color,r=e.type;return reactNative.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Bs,height:Bs,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:js,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...ye,alignItems:"center",justifyContent:"center",backgroundColor:Us(e.color.brandInk,zp)??e.color.brandSofter},successOverlay:{...ye,alignItems:"center",justifyContent:"center",backgroundColor:Bp},failedOverlay:{...ye,borderRadius:js,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:jp},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:Sn,height:Sn,borderRadius:Sn/2,backgroundColor:Yp,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:Ws,height:Ws,borderRadius:Hp,backgroundColor:qs},gridImage:{width:Gs,height:Gs,borderRadius:Up,backgroundColor:qs}})}i(ea,"makeStyles");var Xp="file",wn="multipart upload failed";function ta(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(Xp,e.file);}catch{return Promise.reject(new Error(wn))}return e.fetch!==void 0?Jp(e.fetch,e.url,t,e.signal):Zp(e.url,t,e.signal)}i(ta,"postRnMultipart");function Qp(e){return e>=200&&e<300}i(Qp,"stored");function Zp(e,t,r){return new Promise((n,o)=>{let s=globalThis.XMLHttpRequest;if(typeof s!="function"||r?.aborted===true){o(new Error(wn));return}let a=null,d=i(()=>{a!==null&&r?.removeEventListener("abort",a);},"release"),l=i(()=>{d(),o(new Error(wn));},"fail");try{let u=new s;u.open("POST",e),u.withCredentials=!1,u.onload=()=>{d(),n(Qp(u.status));},u.onerror=l,u.ontimeout=l,u.onabort=l,r!==void 0&&(a=i(()=>{try{u.abort();}finally{l();}},"onAbort"),r.addEventListener("abort",a,{once:!0})),u.send(t);}catch{l();}})}i(Zp,"postWithXhr");function Jp(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(o=>o.ok)}i(Jp,"postWithFetch");var ef="chat attachment upload: the file handle has no uri",tf="chat attachment upload failed";function rf(e){return {uri:e.uri,name:Gr(e.name),type:e.mimeType}}i(rf,"filePartOf");function kn(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(ef));let{signal:o,onProgress:s}=n,a=i(()=>Promise.reject(new Error(tf)),"failed");return o?.aborted===true?a():ta({url:t.upload_url,fields:t.upload_fields,file:rf(r),signal:o,fetch:e.fetch}).then(d=>{if(!d)return a();s?.(1);},a)}})}i(kn,"createRnChatAttachmentTransport");function xn(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=se(),o=react.useMemo(()=>rr(e.registry.services.authFor(t)),[e,t,n]),[s,a]=react.useState({repository:o,pets:[],loading:true,error:null}),d=s.repository===o?s:{pets:[],loading:true,error:null},l=react.useRef(0),u=react.useCallback(async()=>{let p=++l.current;a(b=>({...b,repository:o,loading:true,error:null,pets:b.repository===o?b.pets:[]}));let m=await o.list();p===l.current&&a(m.ok?{repository:o,pets:m.value,loading:false,error:null}:b=>({repository:o,pets:b.repository===o?b.pets:[],loading:false,error:m.error}));},[o]);react.useEffect(()=>(u(),()=>{l.current+=1;}),[u]);let c=react.useMemo(()=>r===null?null:d.pets.find(p=>p.petRef===r)??null,[r,d.pets]);return react.useMemo(()=>({pets:d.pets,activePet:c,loading:d.loading,error:d.error,refresh:u}),[d.pets,d.loading,d.error,c,u])}i(xn,"useEverfurPets");function ra(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(ra,"headerPetOf");function ie(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}i(ie,"slotBox");function In(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(In,"ownGroundSlot");function ve(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(ve,"slotText");var na=Object.freeze({visitButton:"Talk to a vet"});var oa=Symbol.for("@everfur/sdk/televet");function _e(){let e=globalThis,t=e[oa];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[oa]=r,r}i(_e,"televetGlobal");function yr(e){let t=_e();t.snapshot=Object.freeze({...t.snapshot,...e});for(let r of [...t.listeners])try{r();}catch{}}i(yr,"publish");function ia(e){let t=_e().presenter;if(t===null)return "absent";try{return t(e)===!1?"declined":"presented"}catch(r){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",r),"threw"}}i(ia,"callTelevetPresenter");function sa(e){let t=_e();return t.listeners.add(e),()=>{t.listeners.delete(e);}}i(sa,"subscribeTelevetExperience");function An(){return _e().snapshot}i(An,"televetExperienceSnapshot");function lf(){return _e().hosts.length>0}i(lf,"hasTelevetHost");function aa(e){if(!lf())return false;let t=Object.freeze({...e});return yr({request:t,serial:_e().snapshot.serial+1}),true}i(aa,"presentTelevetExperience");function On(){_e().snapshot.request!==null&&yr({request:null});}i(On,"dismissTelevetExperience");function la(){let e=_e(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],yr({activeHost:e.hosts[0]??null}),t}i(la,"claimTelevetHost");function da(e){let t=_e();t.hosts=t.hosts.filter(n=>n!==e);let r=t.hosts[0]??null;yr(r===null?{activeHost:r,request:null}:{activeHost:r});}i(da,"releaseTelevetHost");var ua=false;function mr(e,t){return t!==void 0?(W(t,e),"onStartInApp"):ia(e)==="presented"?"presenter":aa(e)?"experience":(ua||(ua=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}i(mr,"openVetVisitInApp");function fa(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}i(fa,"memoizeTelevetLoader");function ya(e){let[t,r]=react.useState(null);react.useEffect(()=>{let u=la();return r(u),()=>{da(u);}},[]);let n=react.useSyncExternalStore(sa,An,An),s=t!==null&&n.activeHost===t?n.request:null,[a,d]=react.useState(null),l=s!==null&&a===null;return react.useEffect(()=>{if(!l)return;let u=true;return e().then(c=>{u&&d(()=>c);},c=>{u&&(console.warn("[everfur] The in-app vet visit could not load its screens.",c),On());}),()=>{u=false;}},[l,e]),s===null||a===null?null:{module:a,request:s,serial:n.serial,dismiss:On}}i(ya,"useTelevetExperienceHost");var uf=fa(()=>import('@everfur/sdk/televet/booking'));function _t(){let e=ya(uf);if(e===null)return null;let{EverfurTelevetModal:t}=e.module;return jsxRuntime.jsx(t,{request:e.request,onClose:e.dismiss},e.serial)}i(_t,"EverfurTelevetHost");var Fn=Object.freeze(["visit","join","summary","messages"]);function Mn(e){return typeof e=="string"&&Fn.includes(e)}i(Mn,"isVetVisitIntent");var pf="/widget/v1/televet/handoffs",ff="/widget/v1/televet/availability",yf="/widget/v1/televet/chat-entry",mf=/^[a-z0-9][a-z0-9_-]{0,39}$/,hf=/^[A-Za-z0-9_-]{22}$/;var ma=32,ha=128,ga=64;function Dn(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(Dn,"vetVisitErrorReasonOf");function ba(e){return V(q("validationFailed",{retryable:false,wireMessage:e}))}i(ba,"invalid");function Ln(e){return V(q("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(Ln,"unusable");function gf(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!mf.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let s=t?.visitRef,a=t?.intent,d=s!=null;if(d){let l=typeof s=="string"?s.trim():"";if(l.length<1||[...l].length>ga)return {ok:false,message:`visitRef must be 1..${ga} characters`};r.visit_ref=l;}if(a!=null){if(!d)return {ok:false,message:"intent needs the visitRef it opens"};if(!Mn(a))return {ok:false,message:`intent must be one of ${Fn.join(", ")}`};r.intent=a;}return {ok:true,body:r}}i(gf,"handoffBody");function bf(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!Mn(r)?null:Object.freeze({visitRef:t,intent:r})}i(bf,"parseVisitEcho");function Ca(e){let t=e.funnel??He({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(va(r,"televet.visit.handoff_failed",{reason:Dn(o)}),V(o)),"failed");return {async createHandoff(o,s){let a;if(o!=null){let S=typeof o=="string"?[...o].length:0;if(S<1||S>ha)return n(q("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${ha} characters`}));a=o;}let d=gf(a,s);if(!d.ok){let S=ba(d.message);return S.ok?S:n(S.error)}let l=d.body,u=await t.send("televet.visit.handoff",{method:"POST",path:pf,body:l},{idempotent:false,maxAttempts:1});if(!u.ok)return n(u.error);let c=vf(u.value),p=l.return_to!==void 0,m=p?u.value?.flow_id:void 0;if(p&&(typeof m!="string"||!hf.test(m))){let S=Ln("the handoff response carried no usable return flow id");return S.ok?S:n(S.error)}let b=l.visit_ref!==void 0,h=b?bf(u.value?.visit):null;if(b&&h===null){let S=Ln("the handoff response did not confirm the visit it opens");return S.ok?S:n(S.error)}let _=c===null?null:Object.freeze({...c,...p?{flowId:m}:{},...h!==null?{visit:h}:{}});return _===null?n(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(va(r,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),de(_))},async checkAvailability(o){if(typeof o!="string"||o.length>ma)return ba(`state must be at most ${ma} characters`);let s=await t.send("televet.visit.availability",{method:"POST",path:ff,body:{state:o}},{idempotent:false,maxAttempts:1});if(!s.ok)return V(s.error);let a=s.value?.available;return typeof a!="boolean"?Ln("the availability response carried no usable answer"):de(Object.freeze({available:a}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:yf},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(Ca,"createVetVisitController");function vf(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Sf(t)?null:Object.freeze({url:t,expiresAt:r})}i(vf,"parseHandoff");var Cf=new Set(["localhost","127.0.0.1","[::1]"]),Ef=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Rf=/[\s\u0000-\u001f\u007f]/;function Sf(e){if(Rf.test(e))return false;let t=Ef.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),s=r==="https",a=r==="http"&&Cf.has(o);if(!s&&!a)return false;let d=e.indexOf("#");if(d<0)return false;let l=e.slice(d);return l.startsWith("#h=")&&l.length>3}i(Sf,"isOpenableVisitUrl");function va(e,t,r){if(e)try{e.track(t,r);}catch{}}i(va,"safeTrack");var Vn=Object.freeze({status:"idle",error:null,errorReason:null});function Pf(e,t,r){let{usState:n,chat:o,scope:s}=r,a=t&&(n!==null||o),d=`${n??""}|${o?"chat":""}`,[l,u]=react.useState(null);if(react.useEffect(()=>{if(!a)return;let p=true,m=e.current;return u(null),i(async()=>{try{if(o&&!(m.chatEntryOpen&&await m.chatEntryOpen()))return !1;if(n===null)return !0;if(!m.checkAvailability)return !1;let h=await m.checkAvailability(n);return h.ok&&h.value.available}catch{return false}},"ask")().then(h=>{p&&u({key:d,open:h});}),()=>{p=false;}},[a,d,n,o,s,e]),!a)return null;let c=l!==null&&l.key===d;return {open:c&&l.open,pending:!c}}i(Pf,"usePreflight");var wf=Object.freeze({status:"opening",error:null,errorReason:null});function Sa(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=se(),s=St("televet"),a=s.enabled&&n!==null,d=t.usState??null,l=t.entry==="chat",u=t.petRef??null,c=t.prefer==="redirect",p=react.useMemo(()=>{if(t.controller)return t.controller;let{services:w}=r.registry;return Ca({auth:w.authFor(n),telemetry:w.telemetry,...w.errorPolicy?{errorPolicy:w.errorPolicy}:{}})},[r,n,o,t.controller]),m=react.useRef(p);m.current=p;let b=react.useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),h=Pf(m,a,{usState:d,chat:l,scope:b}),_=a&&(h===null||h.open)&&(!l||u!==null),S=t.returnTo??null,[T,A]=react.useState(Vn),P=react.useRef(null),x=react.useRef({runtime:r,userRef:n,scopeEpoch:o});x.current={runtime:r,userRef:n,scopeEpoch:o};let y=react.useRef(p);y.current=p;let R=react.useRef(_);R.current=_;let O=react.useCallback((w,D)=>{if(P.current)return P.current;let U=i((ne,Ve)=>(A({status:ne==="cancelled"?"idle":"error",error:Ve,errorReason:ne==="cancelled"?null:ne}),Object.freeze({opened:false,reason:ne,error:Ve})),"fail");if(!R.current)return Promise.resolve(U("unavailable",null));let B=e.prepare();if(!B.ok)return Promise.resolve(U(B.reason,null));let Z=x.current,re=y.current;A(wf);let ft=(async()=>{let ne,Ve={...S!==null?{returnTo:S}:{},...l?{entry:"chat"}:{},...D!==null?{visitRef:D.visitRef}:{},...D!==null&&D.intent!==null&&D.intent!==void 0?{intent:D.intent}:{}},Dt=Object.keys(Ve).length===0?void 0:Ve,yt=w===void 0?u:w;try{ne=await(Dt===void 0?re.createHandoff(yt):re.createHandoff(yt,Dt));}catch{return e.abandon(B.value),U("unknown",null)}let Je=x.current;if(Je.runtime!==Z.runtime||Je.userRef!==Z.userRef||Je.scopeEpoch!==Z.scopeEpoch)return e.abandon(B.value),U("cancelled",null);if(!ne.ok)return e.abandon(B.value),U(Dn(ne.error),ne.error);let et=await e.finish(B.value,ne.value);return et!==null?U(et,null):(A(Vn),Object.freeze(ne.value.flowId===void 0?{opened:true}:{opened:true,flowId:ne.value.flowId}))})().finally(()=>{P.current===ft&&(P.current=null);});return P.current=ft,ft},[e,u,S,l]),F=react.useCallback((w,D)=>{if(!R.current)return A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let U=w===void 0?u:w,B={...U!==null?{petRef:U}:{},...d!==null?{usState:d}:{},...D!==null?{visitRef:D.visitRef,intent:D.intent}:{}};return mr(B)===null?(A({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(A(Vn),Promise.resolve(Object.freeze({opened:true})))},[u,d]),g=react.useCallback(w=>c?O(w,null):F(w,null),[c,O,F]),E=react.useCallback((w,D)=>c?O(void 0,{visitRef:w,intent:D??null}):F(void 0,{visitRef:w,intent:D??null}),[c,O,F]);return {available:_,isPending:s.isPending||(h?.pending??false),status:T.status,error:T.error,errorReason:T.errorReason,open:g,openVisit:E}}i(Sa,"useVetVisitWith");var xf=i(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function gr(e={}){let{openUrl:t,...r}=e,n=react.useMemo(()=>{let o=t??xf;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(s,a){try{return await o(a.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return Sa(n,r)}i(gr,"useVetVisit");var Ta=44,Mf=.6;function at(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:s,style:a,labelStyle:d,controller:l,returnTo:u,usState:c,entry:p,visitRef:m,intent:b,onStartInApp:h,prefer:_}=e,S=_==="redirect",T=gr({...u!==void 0?{returnTo:u}:{},...c!==void 0?{usState:c}:{},...p!==void 0?{entry:p}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...l!==void 0?{controller:l}:{},prefer:S?"redirect":"in-app"}),A=I(),P=react.useMemo(()=>Lf(A),[A]),x=react.useRef(false);if(!T.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(_t,{})]});let y=T.status==="opening",R=r??na.visitButton;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{onPress:i(()=>{if(!(y||x.current)){if(!S){let F={...t!==void 0?{petRef:t}:{},...c!==void 0?{usState:c}:{},...m!=null?{visitRef:m,intent:b??null}:{}};mr(F,h)===null&&W(s,"unavailable",null);return}x.current=true,(m==null?T.open():T.openVisit(m,b??null)).then(F=>{F.opened?W(o,F.flowId??null):F.reason!=="cancelled"&&W(s,F.reason,F.error);}).finally(()=>{x.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{busy:y,disabled:y},style:[P.button,y?P.busy:null,a],children:jsxRuntime.jsx(v,{style:[P.label,d],children:R})}),jsxRuntime.jsx(_t,{})]})}i(at,"VetVisitButton");function Lf(e){let{color:t,space:r,radius:n,type:o,slots:s}=e;return reactNative.StyleSheet.create({button:{minHeight:Ta,minWidth:Ta,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...ie(s.vetVisitButton)},busy:{opacity:Mf},label:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...ve(s.vetVisitButton)}})}i(Lf,"makeStyles");function Nn(e){return Qt(e)==="cat"?"cat":"dog"}i(Nn,"speciesOf");function Hn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(Hn,"petAgeYears");function _a(e){let t=Hn(e.ageYears),r=Nn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(_a,"formatPetMeta");var ka=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function Df(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return ka[t%ka.length]}i(Df,"pickInitialsPalette");function Un(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(Un,"getInitial");function xa(e){return {...Df(e.petRef),initial:Un(e.name)}}i(xa,"petInitials");function Uf(e){return Math.max(12,Math.round(e*.42))}i(Uf,"letterSize");function It({pet:e,size:t,ringStroke:r}){let n=I(),o=react.useMemo(()=>zf(n),[n]),s=t-r*2,a=e===null?null:xa(e),d=Uf(s);return jsxRuntime.jsx(dr,{size:t,strokeWidth:r,color:n.color.success,children:jsxRuntime.jsx(reactNative.View,{style:[o.disc,{width:s,height:s,borderRadius:s/2},a===null?o.discEmpty:{backgroundColor:a.background}],children:jsxRuntime.jsx(v,{tier:"badge",style:[o.letter,{fontSize:d,lineHeight:Math.round(d*1.2),color:a===null?n.color.text.muted:a.foreground}],children:a===null?Un(null):a.initial})})})}i(It,"PetDisc");function zf(e){return reactNative.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...C(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(zf,"makeStyles");var Bn=48,Oa=2,Yf=320,Kf="80%",$f="rgba(17,17,17,0.45)",Xf=18,Ia=22,Qf=12,Aa=.4,Zf=44;function jn(e){return e?.name?.trim()||f.yourPet}i(jn,"petDisplayName");function Fa({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:s}){let a=I(),d=react.useMemo(()=>Jf(a),[a]);return e?jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:a.motion.reducedMotion?"none":"fade",onRequestClose:s,children:jsxRuntime.jsxs(reactNative.View,{style:d.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:ye,onPress:s,accessibilityRole:"button",accessibilityLabel:f.close,children:jsxRuntime.jsx(reactNative.View,{style:d.backdrop})}),jsxRuntime.jsxs(reactNative.View,{style:d.panel,accessibilityViewIsModal:true,children:[jsxRuntime.jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:f.yourPets}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.list,contentContainerStyle:d.listContent,showsVerticalScrollIndicator:true,children:t.map(l=>{let u=l.petRef===r,c=jn(l),p=_a(l);return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(u?f.petCurrentlyActive:f.switchToPet,{name:c}),accessibilityState:{selected:u},style:[d.row,u?d.rowActive:null],onPress:()=>n(l.petRef),children:[jsxRuntime.jsx(It,{pet:l,size:Bn,ringStroke:Oa}),jsxRuntime.jsxs(reactNative.View,{style:d.copy,children:[jsxRuntime.jsx(v,{style:d.name,numberOfLines:1,children:c}),jsxRuntime.jsx(v,{tier:"compact",style:d.meta,numberOfLines:1,children:u?`${f.activePrefix}${p}`:p})]}),u?jsxRuntime.jsx(Me,{size:Xf,color:a.color.brandInk}):null]},l.petRef)})}),o!==null?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.addAnotherPet,style:d.addRow,onPress:o,children:[jsxRuntime.jsx(reactNative.View,{style:d.addDisc,children:jsxRuntime.jsx(v,{tier:"control",style:d.addPlus,children:"+"})}),jsxRuntime.jsx(v,{style:d.addLabel,children:f.addAnotherPet})]}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.close,containerStyle:d.closeSlot,style:d.closeButton,onPress:s,children:jsxRuntime.jsx(v,{tier:"control",style:d.closeText,children:f.close})})]})]})}):null}i(Fa,"PetSwitcherSheet");function Jf(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:$f},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:Ia,borderTopRightRadius:Ia,gap:14,maxHeight:Kf},title:{...C(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:Yf,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:Zf,paddingHorizontal:8},addDisc:{width:Bn,height:Bn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:Oa,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...C(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...C(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...C(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...C(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Aa},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:Qf,backgroundColor:t.brandSoft},closeText:{...C(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Aa}})}i(Jf,"makeStyles");var ry=44,vr=36,ny=22,Wn=9,oy=1.5,La=6,qe=35,Cr=1.75,Gn=12.4,iy=.5,sy=8,ay=28,ly=160;function Yn(e,t){return ra(e,t)}i(Yn,"headerPet");function Va({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:s,vet:a}){let d=I(),l=react.useMemo(()=>uy(d),[d]),[u,c]=react.useState(false),p=Yn(e.pets,t),m=e.pets.length>=2,b=t??p?.petRef??null,h=jn(p),_=i(T=>{c(false),e.setActivePet(T),W(o,T);},"select"),S=s===void 0?null:()=>{c(false),W(s);};return jsxRuntime.jsxs(reactNative.View,{style:l.row,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:r?f.openMenuUnread:f.openMenu,containerStyle:l.iconSlot,style:l.iconButton,onPress:n,children:[jsxRuntime.jsx(ps,{size:ny,color:d.color.text.primary,strokeWidth:2}),r?jsxRuntime.jsx(reactNative.View,{style:l.unreadDot,pointerEvents:"none"}):null]}),jsxRuntime.jsx(reactNative.View,{style:l.center,pointerEvents:"box-none",children:jsxRuntime.jsx(dy,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,styles:l})}),b===null?null:jsxRuntime.jsx(at,{entry:"chat",petRef:b,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:l.vetEntry,labelStyle:l.vetEntryLabel}),jsxRuntime.jsx(reactNative.View,{style:l.right,children:m?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(f.switchActivePet,{name:h}),containerStyle:l.avatarSlot,style:l.avatarWrap,onPress:()=>c(true),children:[jsxRuntime.jsx(It,{pet:p,size:qe,ringStroke:Cr}),jsxRuntime.jsx(reactNative.View,{style:l.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsxRuntime.jsx(ys,{size:sy,color:d.color.brandInk,strokeWidth:2})})]}):e.loading&&p===null?jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityLabel:f.yourPet,children:jsxRuntime.jsx(dr,{size:qe,strokeWidth:Cr,color:d.color.success,children:jsxRuntime.jsx(reactNative.View,{style:l.placeholderDisc})})}):jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:p===null?f.yourPet:h,children:jsxRuntime.jsx(It,{pet:p,size:qe,ringStroke:Cr})})}),jsxRuntime.jsx(Fa,{visible:u,pets:e.pets,activePetRef:p?.petRef??null,onSelect:_,onAddPet:S,onClose:()=>c(false)})]})}i(Va,"ChatHeader");function dy({logoUrl:e,name:t,styles:r}){let[n,o]=react.useState(null);return e===null||n===e?null:jsxRuntime.jsx(reactNative.View,{style:r.logoBar,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i(dy,"BrandLogo");function uy(e){let t=e.color,r=qe-Cr*2;return reactNative.StyleSheet.create({vetEntry:{minHeight:ry,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...C(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:vr/2},iconButton:{width:vr,height:vr,borderRadius:vr/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:La,right:La,width:Wn,height:Wn,borderRadius:Wn,backgroundColor:t.danger,borderWidth:oy,borderColor:t.surface},center:{...ye,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:ay,width:ly},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:qe/2},avatarWrap:{width:qe,height:qe,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Gn,height:Gn,borderRadius:Gn/2,borderWidth:iy,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(uy,"makeStyles");var Ua=44,my="rgba(17,17,17,0.55)",za=26,hy=36,Ba=4,Kn=20,$n=38,gy=18,by=12;function ja({visible:e,onSubmit:t,onSkip:r}){let n=I(),o=react.useMemo(()=>vy(n),[n]),[s,a]=react.useState(null),[d,l]=react.useState(""),[u,c]=react.useState(false),[p,m]=react.useState(false),b=i(()=>{a(null),l(""),c(false),m(false);},"reset"),h=i(()=>{u||(b(),r());},"skip"),_=i(async()=>{if(u)return;c(true),m(false);let T=d.trim();await t(s,T.length>0?T:null)?b():(c(false),m(true));},"submit");if(!e)return null;let S=[...d].length>Yt;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:h,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:o.scrim,onPress:h,accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y}),jsxRuntime.jsxs(reactNative.View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsxRuntime.jsx(reactNative.View,{style:o.handle}),jsxRuntime.jsxs(reactNative.View,{style:o.header,children:[jsxRuntime.jsx(reactNative.View,{style:o.iconBadge,children:jsxRuntime.jsx(lr,{size:gy,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxRuntime.jsxs(reactNative.View,{style:o.headerText,children:[jsxRuntime.jsx(v,{tier:"heading",style:o.title,accessibilityRole:"header",children:f.feedbackTitle}),jsxRuntime.jsx(v,{style:o.subtitle,children:f.feedbackSubtitle})]})]}),jsxRuntime.jsx(reactNative.View,{style:o.options,children:Vr.map(T=>{let A=s===T.key;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:T.label,accessibilityState:{selected:A},style:[o.option,A?o.optionSelected:null],onPress:()=>a(P=>P===T.key?null:T.key),children:[jsxRuntime.jsx(v,{style:[o.optionLabel,A?o.optionLabelSelected:null],children:T.label}),jsxRuntime.jsx(reactNative.View,{style:[o.radio,A?o.radioSelected:null],children:A?jsxRuntime.jsx(Me,{size:by,color:n.color.surface,strokeWidth:2}):null})]},T.key)})}),jsxRuntime.jsxs(reactNative.View,{style:o.inputWrap,children:[jsxRuntime.jsx(rt,{style:o.input,placeholder:f.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:f.feedbackNotesPlaceholder,value:d,onChangeText:l,multiline:true,editable:!u}),d.length>0?jsxRuntime.jsx(v,{tier:"compact",style:[o.counter,S?o.counterOver:null],children:`${[...d].length}/${Yt}`}):null]}),p?jsxRuntime.jsx(v,{style:o.failed,accessibilityRole:"alert",children:f.feedbackFailed}):null,jsxRuntime.jsxs(reactNative.View,{style:o.actions,children:[jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.feedbackSubmit,accessibilityState:{busy:u,disabled:u||S},disabled:u||S,style:[o.submit,u||S?o.submitDisabled:null],onPress:()=>{_();},children:jsxRuntime.jsx(v,{tier:"control",style:o.submitLabel,children:f.feedbackSubmit})}),jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y,hitSlop:8,onPress:h,style:o.skip,children:jsxRuntime.jsx(v,{tier:"control",style:o.skipLabel,children:f.feedbackSkip})})]})]})]})})}i(ja,"FeedbackReasons");function vy(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...ye,backgroundColor:my},sheet:{backgroundColor:t.surface,borderTopLeftRadius:za,borderTopRightRadius:za,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:hy,height:Ba,borderRadius:Ba/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:$n,height:$n,borderRadius:$n/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...C(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...C(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:Kn,height:Kn,borderRadius:Kn/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...C(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...C(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:Ua,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...ie(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...ve(o.primaryButton)},skip:{minHeight:Ua,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(vy,"makeStyles");var My=.88,Ly=420,Dy=58,Vy="rgba(17,17,17,0.28)",Ny=.08,Hy=.1,Uy=.08,zy=.18,By=.78,jy=.7,Xn=36,Wy=10,Gy=14,qy=12,Yy=16,Ky=14,Qn=8,$y=1.5,Xy=.5,Qy=cr(Pt.standard);function Zy(e){return Math.min(Math.round(e*My),Ly)}i(Zy,"drawerPanelWidth");function Wa({chat:e,history:t}){let[r,n]=react.useState(t.open),o=react.useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsxRuntime.jsx(Jy,{chat:e,history:t,onHidden:o}):null}i(Wa,"HistoryDrawer");function Jy({chat:e,history:t,onHidden:r}){let n=I(),o=react.useMemo(()=>tm(n),[n]),s=G(),a=reactNativeSafeAreaContext.useSafeAreaInsets(),{width:d}=reactNative.useWindowDimensions(),l=Zy(d),u=t.open,c=react.useRef(null);c.current===null&&(c.current=new reactNative.Animated.Value(s.drawerMs<=0&&u?1:0));let p=c.current;react.useEffect(()=>{if(!u&&s.drawerMs<=0){r();return}let T=reactNative.Animated.timing(p,{toValue:u?1:0,duration:s.drawerMs,easing:Qy,useNativeDriver:true});return T.start(({finished:A})=>{A&&!u&&r();}),()=>T.stop()},[u,p,s.drawerMs,r]);let m=p.interpolate({inputRange:[0,1],outputRange:[-l,0]}),b=t.filtered,h=t.rows.length===0,_=h&&t.loading?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,accessibilityLabel:Y.loading,accessibilityState:{busy:true},children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{color:n.color.onPrimary}),jsxRuntime.jsx(v,{style:o.emptyBody,children:Y.loading})]}):h&&t.error!==null?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,accessibilityRole:"alert",children:Y.loadFailed}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.error}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsxRuntime.jsx(v,{tier:"control",style:o.retryText,children:Y.retry})})]}):jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,children:t.emptyKind==="empty"?Y.empty:Y.noMatch}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.emptyKind==="empty"?Y.emptyBody:Y.noMatchBody})]}),S=!t.searching&&t.loadingMore?jsxRuntime.jsx(reactNative.View,{style:o.loadMoreFooter,children:jsxRuntime.jsx(v,{style:o.loadMoreLabel,children:Y.loadingMore})}):null;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxRuntime.jsxs(reactNative.View,{style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:ye,onPress:t.close,accessibilityRole:"button",accessibilityLabel:Y.closeA11y,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[o.backdrop,{opacity:p}]})}),jsxRuntime.jsx(reactNative.Animated.View,{style:[o.panel,{width:l,paddingTop:Math.max(Dy,a.top+n.space.md),transform:[{translateX:m}]}],accessibilityViewIsModal:true,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:reactNative.Platform.OS==="ios"?"padding":"height",children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchRow,children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchPill,children:[jsxRuntime.jsx(Rs,{size:Ky,color:n.color.text.muted,strokeWidth:1.5}),jsxRuntime.jsx(rt,{value:t.query,onChangeText:T=>t.setQuery(T.replace(/^\s+/,"")),style:o.searchInput,placeholder:Y.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:Y.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.newConversation,style:o.newButton,onPress:t.newConversation,children:jsxRuntime.jsx(Ss,{size:Yy,color:n.color.text.primary,strokeWidth:1.5})})]}),jsxRuntime.jsx(v,{tier:"heading",style:o.heading,accessibilityRole:"header",children:Y.heading}),t.error!==null&&!h?jsxRuntime.jsx(reactNative.View,{style:o.errorCard,children:jsxRuntime.jsx(v,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsxRuntime.jsx(reactNative.FlatList,{data:b,keyExtractor:T=>T.id,renderItem:({item:T})=>jsxRuntime.jsx(em,{row:T,active:T.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(T.id);}}),contentContainerStyle:b.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:_,ListFooterComponent:S,onEndReached:t.loadMore,onEndReachedThreshold:Xy})]})})]})})}i(Jy,"DrawerModal");function em({row:e,active:t,disabled:r,styles:n,onPress:o}){let s=e.unreadCount!==null&&e.unreadCount>0;return jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:qi(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxRuntime.jsxs(reactNative.View,{style:n.itemRow,children:[jsxRuntime.jsx(v,{style:[n.itemTitle,s?n.itemTitleUnread:null],numberOfLines:1,children:or(e.title)}),s?jsxRuntime.jsx(reactNative.View,{style:n.unreadDot}):null]})})}i(em,"Row");function Sr(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(Sr,"inkWash");function tm(e){let t=e.color,r=e.slots,n=t.onPrimary;return reactNative.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:Vy},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.brand,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:Sr(n,Hy)},searchInput:{...C(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:Xn,height:Xn,borderRadius:Xn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...C(e,"bold"),fontSize:14,lineHeight:17,color:n,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:Wy},itemActive:{backgroundColor:Sr(n,Ny)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...C(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:n},itemTitleUnread:C(e,"bold"),unreadDot:{width:Qn,height:Qn,borderRadius:Qn/2,backgroundColor:t.danger,borderWidth:$y,borderColor:n},errorCard:{borderRadius:qy,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...C(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:Gy,padding:14,gap:6,backgroundColor:Sr(n,Uy),borderWidth:.5,borderColor:Sr(n,zy)},emptyTitle:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n},emptyBody:{...C(e,"regular"),fontSize:11,lineHeight:17,color:n,opacity:By},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:n,...ie(r.primaryButton)},retryText:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n,...ve(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...C(e,"regular"),fontSize:11,lineHeight:14,color:n,opacity:jy}})}i(tm,"makeStyles");function Ga(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),t?.prefer!==void 0&&(r.prefer=t.prefer),r}i(Ga,"chatVetVisitOptions");var im=16,sm=.75,Zn=12,qa=15,am=18,Tr=22,lm=14,dm=8,um=20,cm=10,pm=13;function Ka({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let s=I(),a=react.useMemo(()=>fm(s),[s]),d=G(),l=e.tier,u=e.source;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hn,{visible:e.showBanner&&l!==null,inMs:d.bannerInMs,outMs:d.bannerOutMs,style:a.pinned,children:l!==null&&u!==null?jsxRuntime.jsxs(reactNative.View,{accessibilityRole:"alert",style:[a.card,{borderColor:l.borderColor,backgroundColor:l.backgroundColor}],children:[jsxRuntime.jsx(v,{tier:"compact",style:[a.label,{color:l.textColor}],children:l.label}),u.reason!==null?jsxRuntime.jsx(v,{style:[a.reason,{color:l.reasonColor}],children:u.reason}):null,e.showVetAction?r!==void 0?jsxRuntime.jsx(ze,{render:()=>r(l.level),fallback:jsxRuntime.jsx(Ya,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}),resetKey:l.level}):jsxRuntime.jsx(Ya,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}):null,e.dismissLabel!==null?jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:dm,containerStyle:a.closeSlot,style:a.closeButton,onPress:e.dismiss,children:jsxRuntime.jsx(Be,{size:lm,color:l.textColor,strokeWidth:1.5})}):null]}):null}),jsxRuntime.jsx(hn,{visible:e.showCompactIcon,inMs:d.iconInMs,outMs:d.iconOutMs,style:a.indicatorRow,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.showLatestVetAlert,hitSlop:cm,onPress:e.expand,children:jsxRuntime.jsx(bs,{size:um,color:s.color.text.muted,strokeWidth:2})})})]})}i(Ka,"UrgencyBanner");function Ya({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let s=I(),a=gr(Ga(t,n)),d=a.status==="opening",l=a.available?()=>{a.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(l===null)return null;let u=In(s.slots.vetVisitButton)?.textColor??e.textColor;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.findVetA11y,accessibilityState:{busy:d},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,d?o.findVetBusy:null],onPress:l,children:[jsxRuntime.jsx(Ts,{size:pm,color:u,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"control",style:[o.findVetLabel,{color:u}],children:f.findVet})]})}i(Ya,"VetAction");function fm(e){let t=In(e.slots.vetVisitButton);return reactNative.StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:im,borderWidth:sm,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...C(e,"monoBold"),fontSize:Zn,lineHeight:qa},reason:{...C(e,"regular"),fontSize:Zn,lineHeight:am,paddingRight:Tr},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...ie(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...C(e,"monoBold"),fontSize:Zn,lineHeight:qa},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:Tr,height:Tr,borderRadius:Tr/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(fm,"makeStyles");function $a(){let e=xn(),{handle:t}=se(),r=react.useCallback(n=>t.setActivePet(n),[t]);return react.useMemo(()=>({...e,setActivePet:r}),[e,r])}i($a,"useChatPets");var nl=300,ol=3e3,Qa=120,dt=44,bm=120,vm="86%",Za=15,Ja=22,Pr=.5,Cm=.04,Em=8,Rm=2,Sm=1,Tm=.6,Pm=22,wm=48,el=1.25,km=14,_m=18,xm=6,Im=14,Am=.04,Om=12,Fm=2,Mm=2,tl=36,Lm=20,lt=36,ut=(dt-lt)/2,il=24,sl=22,Dm=.4,wr=30,al=20,Vm=.4,Nm=480,Hm=8,rl=14,Um=10,zm=14,Bm=12,jm=13,Wm=18,Gm="12%";function pe(){let e=I(),t=react.useMemo(()=>qm(e),[e]);return {theme:e,styles:t}}i(pe,"useChatTheme");function qm(e){let t=e.color,r=e.space,n=e.radius,o=e.type,s=e.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:Qa,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:Qa,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:Gm,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:Nm,gap:18},errorText:{...C(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:dt,minWidth:dt,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...ie(s.primaryButton)},retryLabel:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...ve(s.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:dt,justifyContent:"center"},turnNoticeActionLabel:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:vm},bubbleUser:{padding:Za,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:Pr,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:Cm,shadowRadius:Em,shadowOffset:{width:0,height:Rm},elevation:Sm,...ie(s.userBubble,Pr)},bubbleAssistant:s.assistantBubble?.backgroundColor===void 0?{...ie(s.assistantBubble,Pr)}:{padding:Za,borderRadius:n.xl,...ie(s.assistantBubble,Pr)},bubblePending:{opacity:Tm},bubbleTextUser:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:Ja,...ve(s.userBubble)},bubbleTextAssistant:{...C(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:Ja,...ve(s.assistantBubble)},bubbleBold:C(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:C(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,gap:Hm},followUpSlot:{alignSelf:"stretch",borderRadius:rl},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:Bm,paddingVertical:Um,paddingHorizontal:zm,borderRadius:rl,backgroundColor:t.brandSoft},followUpText:{...C(e,"medium"),flex:1,color:t.text.primary,fontSize:jm,lineHeight:Wm},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:wm,justifyContent:"center",paddingLeft:km,paddingRight:_m,paddingVertical:xm,backgroundColor:t.composerFill,borderWidth:el,borderColor:t.composerBorder,borderRadius:Pm,shadowColor:t.shadow,shadowOpacity:Am,shadowRadius:Om,shadowOffset:{width:0,height:Fm},elevation:Mm,...ie(s.composerInput,el)},composerRow:{flexDirection:"row",alignItems:"center",gap:Im,minHeight:tl},attachControl:{width:wr,height:wr,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:Vm},input:{flex:1,minHeight:tl,maxHeight:bm,paddingHorizontal:0,paddingVertical:0,...C(e,"regular"),fontSize:o.size.body,lineHeight:Lm,color:t.text.primary,...ve(s.composerInput)},sendControl:{minHeight:lt,minWidth:lt,alignItems:"center",justifyContent:"center"},sendDisc:{width:lt,height:lt,borderRadius:lt/2,alignItems:"center",justifyContent:"center",...ie(s.sendButton)},sendControlDisabled:{opacity:Dm},poweredBy:{...C(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(qm,"makeStyles");var Ym=Object.freeze({kind:"live"}),Km=Object.freeze({kind:"folded"});function eo(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=Ko(e.proactiveOriginRef);return {caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}i(eo,"askOf");function dl(e){let t=new Map,r=new Map;for(let o of e){let s=eo(o);if(s===null)continue;let a=r.get(s.caseId);(a===void 0||s.dueDay>=a.dueDay)&&r.set(s.caseId,{messageId:o.id,dueDay:s.dueDay});}if(r.size===0)return t;let n=null;for(let o of e){let s=eo(o);if(s===null){n=null;continue}if(r.get(s.caseId)?.messageId===o.id){t.set(o.id,Ym),n=null;continue}if(n!==null&&n.caseId===s.caseId){n.days.push(s.dueDay),t.set(o.id,Km);continue}let a=[s.dueDay];n={id:o.id,caseId:s.caseId,days:a},t.set(o.id,{kind:"past",runDueDays:a});}return t}i(dl,"placeCheckins");var ll=864e5,$m=365;function kr(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let o=Math.floor(n/ll)-Math.floor(r/ll);return o<1||o>$m?null:o}i(kr,"checkinDayNumber");function ul(e){return eo(e)?.dueDay||null}i(ul,"checkinDueDay");var me=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" \xB7 ",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),cl=Object.freeze(jo.map(e=>Object.freeze({answer:e,label:me.answers[e]})));function pl(e,t){let[r,n]=react.useState(null),[o,s]=react.useState(null),[a,d]=react.useState(null),l=react.useCallback(c=>{t!==null&&(n(c),s(null),t(e.caseId,c).then(p=>{n(null),p.ok?d(c):s(p.error);}));},[t,e.caseId]),u=a??e.answer;return {answer:u,answerable:!Yo(e),escalated:u==="worse",pending:r,error:o,choose:l}}i(pl,"useCheckinCard");var ml=44,Zm=.6;function gl({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:s,onLayout:a}){let d=I(),l=react.useMemo(()=>Jm(d),[d]),u=pl(t,r),c=u.answer!==null||u.pending!==null,p=r!==null&&u.answerable,m=kr(t.openedAt,ul(e));return jsxRuntime.jsxs(reactNative.View,{style:l.card,accessibilityLabel:me.eyebrow,onLayout:a,children:[jsxRuntime.jsxs(reactNative.View,{style:l.head,children:[jsxRuntime.jsx(v,{tier:"compact",style:l.eyebrow,children:me.eyebrow}),m!==null?jsxRuntime.jsx(v,{tier:"compact",style:l.headDay,children:j(me.day,{day:m})}):null]}),jsxRuntime.jsx(v,{style:l.question,accessibilityRole:"text",children:e.text}),p?jsxRuntime.jsx(reactNative.View,{style:[l.row,u.pending?l.rowPending:null],children:cl.map(({answer:b,label:h})=>{let _=(u.pending??u.answer)===b;return jsxRuntime.jsx(reactNative.Pressable,{onPress:()=>u.choose(b),disabled:c,accessibilityRole:"button",accessibilityLabel:h,accessibilityState:{selected:_,disabled:c,busy:u.pending===b},style:[l.pill,_?l.pillSelected:null],children:jsxRuntime.jsx(v,{tier:"control",style:[l.pillLabel,_?l.pillLabelSelected:null],children:h})},b)})}):null,u.answer!==null?jsxRuntime.jsx(v,{style:l.logged,children:me.logged}):null,u.escalated?o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:me.findVet,style:l.findVet,children:jsxRuntime.jsx(v,{tier:"control",style:l.findVetLabel,children:me.findVet})}):n?jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:me.findVet,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},...s?.prefer!==void 0?{prefer:s.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):null:null,t.resolutionText?jsxRuntime.jsx(v,{style:l.resolution,children:t.resolutionText}):null,u.error?jsxRuntime.jsx(v,{style:l.error,accessibilityRole:"alert",children:u.error.displayMessage}):null]})}i(gl,"CheckinCard");function Jm(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return reactNative.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},headDay:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:Zm},pill:{flex:1,minHeight:ml,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brand},pillLabel:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:ml,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...C(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(Jm,"makeStyles");var rh=1.5,nh=3;function vl({text:e,runDueDays:t,openedAt:r,onLayout:n}){let o=I(),s=react.useMemo(()=>oh(o),[o]),a=t.map(l=>kr(r,l)).filter(l=>l!==null),d=t.length>1;return d&&a.length===0?null:jsxRuntime.jsxs(reactNative.View,{style:s.row,onLayout:n,children:[jsxRuntime.jsx(reactNative.View,{style:s.rule,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}),jsxRuntime.jsxs(reactNative.View,{style:s.body,children:[a.length>0?jsxRuntime.jsx(v,{tier:"compact",style:s.days,children:a.map(l=>j(me.day,{day:l})).join(me.daySeparator)}):null,d?null:jsxRuntime.jsx(v,{style:s.question,accessibilityRole:"text",children:e})]})]})}i(vl,"CheckinPastAsk");function oh(e){let t=e.color,r=e.space,n=e.type;return reactNative.StyleSheet.create({row:{flexDirection:"row",paddingVertical:r.xs},rule:{width:rh,borderRadius:1,backgroundColor:t.borderHairlineGreen,marginRight:r.md},body:{flex:1,gap:nh},days:{...C(e,"monoMedium"),fontSize:n.size.nano,letterSpacing:n.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},question:{...C(e,"regular"),fontSize:n.size.bodyTight,lineHeight:n.size.bodyTight*n.lineHeight.normal,color:t.text.muted}})}i(oh,"makeStyles");var ih=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),Cl="#C8BEB4";function sh(e){return e?ih[e.toUpperCase()]??Cl:Cl}i(sh,"tierColor");function ah(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(ah,"tierLabel");function we(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(we,"text");function lh(e){let t=we(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(lh,"httpsUrl");function dh(e,t){let r=we(e.source_name)??we(e.sourceName),n=we(e.section),o=we(e.authority_tier)??we(e.authorityTier),s=ah(o),a=r??we(e.title)??`Source ${t+1}`,d=we(e.monograph_chunk_id)??we(e.chunkId),l=[n,s].filter(u=>u!==null).join(" \xB7 ");return Object.freeze({title:a,sourceName:r,section:n,authorityTier:o,tierLabel:s,meta:l.length===0?null:l,url:lh(e.url),excerpt:we(e.excerpt),tierColor:sh(o),key:`${a}-${d??"none"}-${t}`})}i(dh,"toCitationCard");function El(e){return e===void 0||e.length===0?uh:Object.freeze(e.map((t,r)=>dh(t,r)))}i(El,"toCitationCards");var uh=Object.freeze([]);function io(e){return e===1?`1 ${f.sourceSingular}`:`${e} ${f.sourcePlural}`}i(io,"sourcesLabel");function Rl(e,t){return `${t?f.hideSources:f.showSources} ${io(e)}`}i(Rl,"sourcesToggleLabel");function Sl(e){return [e.url!==null?`${f.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(Sl,"citationA11yLabel");var mh=244,Pl=8,wl=13,hh=14,gh=.3,bh=-0.24,vh=22,Ch=10,Eh=15;function kl({citations:e,onOpenUrl:t}){let r=I(),n=react.useMemo(()=>Th(r),[r]),o=react.useMemo(()=>El(e),[e]),[s,a]=react.useState(false);if(o.length===0)return null;let d=o.length;return jsxRuntime.jsxs(reactNative.View,{style:n.block,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:Rl(d,s),accessibilityState:{expanded:s},containerStyle:n.toggleSlot,style:n.togglePill,onPress:()=>a(l=>!l),children:[jsxRuntime.jsx(ms,{size:wl,color:r.color.brandInk,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"compact",style:n.toggleLabel,children:io(d)}),jsxRuntime.jsx(ar,{size:wl,color:r.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?jsxRuntime.jsx(Rh,{cards:o,styles:n,open:t}):null]})}i(kl,"CitationCards");function Rh({cards:e,styles:t,open:r}){let n=G(),o=je(n.citationsInMs,{risePx:n.citationsRisePx});return jsxRuntime.jsx(reactNative.Animated.View,{style:o,children:jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(s=>jsxRuntime.jsx(Sh,{card:s,styles:t,open:r},s.key))})})}i(Rh,"Deck");function Sh({card:e,styles:t,open:r}){let n=I(),o=e.url!==null&&r!==void 0,s=Sl(o?e:{...e,url:null}),a=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:t.cardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsxRuntime.jsx(v,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsxRuntime.jsx(hs,{size:hh,color:n.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsxRuntime.jsx(v,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsxRuntime.jsx(v,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&r!==void 0){let d=e.url;return jsxRuntime.jsx(N,{accessibilityRole:"link",accessibilityLabel:s,style:t.card,onPress:()=>r(d),children:a})}return jsxRuntime.jsx(reactNative.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:s,style:t.card,children:a})}i(Sh,"Card");function Th(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return reactNative.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...C(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:gh,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:mh,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:Pl,height:Pl,borderRadius:n.pill},cardTitle:{...C(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:vh,color:t.text.primary,letterSpacing:bh},cardTitleLink:{color:t.linkInk},cardMeta:{...C(e,"monoMedium"),fontSize:o.nano,lineHeight:Ch,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...C(e,"regular"),fontSize:o.tiny,lineHeight:Eh,color:t.text.muted}})}i(Th,"makeStyles");function _l(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(_l,"formatMessageTime");var Ft=15,Ih=15,Ah=6,Oh=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function Fl({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let s=I(),a=react.useMemo(()=>Fh(s),[s]),d=G(),l=e.role==="user",u=react.useMemo(()=>_l(e.createdAt),[e.createdAt]),c=t!==void 0&&e.text.length>0,p=!l&&n!==void 0&&e.responseId!==void 0,[m,b]=react.useState(false),h=react.useRef(null);react.useEffect(()=>()=>{h.current&&clearTimeout(h.current);},[]);let _=i(()=>{t!==void 0&&(ot(t,e.text),b(true),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{b(false),h.current=null;},d.copiedMs));},"copy");return u===null&&!c&&!p?null:jsxRuntime.jsxs(reactNative.View,{style:a.wrap,children:[jsxRuntime.jsxs(reactNative.View,{style:[a.row,l?a.rowUser:a.rowAssistant],children:[u!==null?jsxRuntime.jsx(v,{tier:"compact",style:a.timestamp,children:u}):null,c?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:m?f.copied:l?f.copyUserMessage:f.copyAssistantMessage,hitSlop:Ih,onPress:_,style:a.iconHit,children:m?jsxRuntime.jsx(Me,{size:Ft,color:s.color.success,strokeWidth:2}):jsxRuntime.jsx(gs,{size:Ft,color:s.color.text.timestamp,strokeWidth:1.5})}):null,p?So.map(({sentiment:S,label:T})=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:T,accessibilityState:{selected:r===S},hitSlop:Ah,onPress:()=>n?.(S),style:a.iconHit,children:jsxRuntime.jsx(lr,{size:Ft,color:s.color.sentiment[S],active:r===S,rotate:Oh[S],strokeWidth:1.5})},S)):null]}),o?jsxRuntime.jsx(v,{style:a.thanks,accessibilityLiveRegion:"polite",children:f.feedbackThanks}):null]})}i(Fl,"MessageFooter");function Fh(e){let t=e.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...C(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Ft,height:Ft,alignItems:"center",justifyContent:"center"},thanks:{...C(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(Fh,"makeStyles");var Ml="#10462E",Ll="#000000",Mh="#83E0B4",Lh=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:Mh,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:Ml,brandEdge:true,borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),Dh=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function Vh(e){return e==null?e:e.replace(Dh,"").trim()}i(Vh,"formatBreedForPrompt");var Nh=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function Hh(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return Nh.has(t)}i(Hh,"isUninformativeBreed");function Uh(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(Uh,"unspecifiedBreedLabel");function zh(e,t){return Hh(e)?Uh(t):String(e).replace(/\s+/gu," ").trim()}i(zh,"resolveBreedLabel");function Dl(e){let t=e?.name?.trim()||f.emptyTitlePetFallback;return j(f.emptyTitle,{petName:t})}i(Dl,"emptyStateTitle");function Vl(e,t=Ml){let r=Nn(e?.species),n=r==="cat"?"my cat":"my dog",o=e?.name?.trim()||null,s=o||n,a=zh(Vh(e?.breed),r)||null,d=Hn(e?.ageYears),l=d===null?null:String(d);return Object.freeze(Lh.map(u=>{let c=u.label.includes("{breed}"),p=u.label.includes("{ageYears}"),b=u.fallbackLabel!==void 0&&(c&&!a||p&&!l)&&u.fallbackLabel?u.fallbackLabel:u.label,h=j(b,{petName:s,breed:a??n,species:r,ageYears:l??""}),_=!o&&b.startsWith("{petName}")?h.charAt(0).toUpperCase()+h.slice(1):h;return Object.freeze({id:u.id,intent:u.intent,label:_,background:u.background,borderColor:u.brandEdge===true?t:u.borderColor,borderWidth:u.borderWidth})}))}i(Vl,"resolveQuickPrompts");var jh=36,Ul=4,Wh=340;function zl({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let s=I(),a=react.useMemo(()=>qh(s),[s]),d=react.useMemo(()=>Vl(e,s.color.brandInk),[e,s.color.brandInk]),l=Dl(e);return jsxRuntime.jsxs(reactNative.View,{style:a.block,children:[jsxRuntime.jsx(v,{tier:"heading",style:a.title,accessibilityRole:"header",children:l}),jsxRuntime.jsx(reactNative.View,{style:a.list,children:d.map((u,c)=>jsxRuntime.jsx(Gh,{prompt:u,index:c,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:a},u.id))})]})}i(zl,"QuickPrompts");function Gh({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:s,vet:a,styles:d}){let l=G(),u=je(l.followUpInMs,{delayMs:ur(l,t)}),c={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?s!==void 0?jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Ul,style:[d.chip,c],onPress:()=>{W(s,r);},children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})}):n===null?null:jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:e.label,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:[d.chip,c],labelStyle:d.chipLabel})}):jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Ul,style:[d.chip,c],onPress:()=>o(e.label),children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})})}i(Gh,"Chip");function qh(e){let t=e.color;return reactNative.StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...C(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:Wh},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:jh,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...C(e,"bold"),fontSize:12,lineHeight:14,color:Ll,textAlign:"center"}})}i(qh,"makeStyles");var ao=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function Bl(e){return e.includes("*")||e.includes("`")}i(Bl,"hasInlineMarkup");function jl(e){let t=[],r=0;ao.lastIndex=0;for(let n=ao.exec(e);n!==null;n=ao.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],s=n[2],a=n[3];o!==void 0?t.push({kind:"bold",text:o}):s!==void 0?t.push({kind:"italic",text:s}):a!==void 0&&t.push({kind:"code",text:a}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(jl,"tokenizeInlineMarkdown");function Wl(e,t){return Bl(e)?jl(e).map((r,n)=>{switch(r.kind){case "bold":return jsxRuntime.jsx(v,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsxRuntime.jsx(v,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsxRuntime.jsx(v,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(Wl,"renderInlineMarkdown");var Yl=6,Xl=520,Zh=Math.round(Xl*.18),Kl=.44,Jh=.5,$l=[0,.5,1],eg=[0,1,2];function Ql(){let e=I(),t=react.useMemo(()=>rg(e),[e]),r=!e.motion.reducedMotion;return jsxRuntime.jsx(reactNative.View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:f.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:eg.map(n=>r?jsxRuntime.jsx(tg,{index:n,style:t.dot},n):jsxRuntime.jsx(reactNative.View,{style:[t.dot,t.dotStatic]},n))})}i(Ql,"TypingIndicator");function tg({index:e,style:t}){let r=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{let s=reactNative.Animated.sequence([reactNative.Animated.delay(e*Zh),reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:Xl,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:$l,outputRange:[Kl,1,Kl]}),o=r.interpolate({inputRange:$l,outputRange:[0,-3.5,0]});return jsxRuntime.jsx(reactNative.Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(tg,"AnimatedDot");function rg(e){let t=e.color,r=e.space,n=e.radius;return reactNative.StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:Yl,height:Yl,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:Jh}})}i(rg,"makeStyles");function Zl(e,t,r){let n=e-r,o=t!=null?Math.min(n,t):n;return Math.max(0,o)}i(Zl,"resolveTurnScrollTarget");function Jl(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return {assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}i(Jl,"latestTurn");function ed(e,t,r){let n=Math.max(0,r),o=e===null?n:Math.min(Math.max(0,e),n);return o>t+1?o:null}i(ed,"nextFollowOffset");function td(e,t){let r=react.useRef(null),n=react.useRef(true),o=react.useRef(t),s=react.useRef(0),a=react.useRef(0),d=react.useRef(0),l=react.useRef(new Map),u=Jl(e),c=u===null?null:e[u.assistantIndex]?.id??null,p=u===null||u.userIndex===null?null:e[u.userIndex]?.id??null,m=react.useCallback(()=>{let P=r.current;if(P===null||!n.current||a.current===0)return;let x=null;if(c!==null){let R=l.current.get(c);if(R===void 0)return;let O=p===null?null:l.current.get(p)??null;x=Zl(R,O,96);}let y=ed(x,s.current,d.current-a.current);y!==null&&(s.current=y,P.scrollTo({y,animated:false}));},[c,p]);react.useEffect(()=>{t&&!o.current&&(n.current=true),o.current=t,m();},[e,t,m]);let b=react.useCallback(P=>{a.current=P.nativeEvent.layout.height,m();},[m]),h=react.useCallback((P,x)=>{d.current=x,a.current>0&&(s.current=Math.min(s.current,Math.max(0,x-a.current))),m();},[m]),_=react.useCallback(P=>{s.current=P.nativeEvent.contentOffset.y;},[]),S=react.useCallback(()=>{n.current=false;},[]),T=react.useCallback(P=>{let{contentOffset:x,contentSize:y,layoutMeasurement:R}=P.nativeEvent;s.current=x.y,n.current=y.height-x.y-R.height<=24;},[]),A=react.useCallback(P=>x=>{l.current.set(P,x.nativeEvent.layout.y),(P===c||P===p)&&m();},[c,p,m]);return {ref:r,onLayout:b,onContentSizeChange:h,onScroll:_,onScrollBeginDrag:S,onScrollEnd:T,rowLayout:A}}i(td,"useThreadFollow");function sd(e,t,r){switch(e){case "loading":return r.renderPending?jsxRuntime.jsx(ze,{render:r.renderPending,fallback:jsxRuntime.jsx(nd,{})}):jsxRuntime.jsx(nd,{});case "empty":return jsxRuntime.jsx(ug,{pet:r.shownPet,petRef:t.petRef,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsxRuntime.jsx(pg,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsxRuntime.jsx(fg,{messages:t.messages,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet,onOpenUrl:r.onOpenUrl});default:return Wt(e)}}i(sd,"renderView");function nd(){let{theme:e,styles:t}=pe(),[r,n]=react.useState(false);return react.useEffect(()=>{let o=setTimeout(()=>n(true),nl);return ()=>clearTimeout(o)},[]),jsxRuntime.jsx(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:f.loading,children:r?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:e.color.brandInk}):null})}i(nd,"LoadingState");function ug({pet:e,petRef:t,prompts:r,onSelectPrompt:n,onVetPrep:o,vet:s}){let{styles:a}=pe();return jsxRuntime.jsxs(reactNative.ScrollView,{contentContainerStyle:a.emptyContent,keyboardShouldPersistTaps:"handled",accessibilityLabel:f.empty,children:[jsxRuntime.jsx(zl,{pet:e,petRef:t,onSend:n,onVetPrep:o,vet:s}),jsxRuntime.jsx(ad,{prompts:r,onSelectPrompt:n})]})}i(ug,"EmptyState");function ad({prompts:e,onSelectPrompt:t}){let{styles:r}=pe();return e.length===0?null:jsxRuntime.jsx(reactNative.View,{style:r.followUps,children:e.map((n,o)=>jsxRuntime.jsx(cg,{prompt:n,index:o,onSelectPrompt:t},n))})}i(ad,"FollowUps");function cg({prompt:e,index:t,onSelectPrompt:r}){let{theme:n,styles:o}=pe(),s=G(),a=je(s.followUpInMs,{delayMs:ur(s,t)});return jsxRuntime.jsx(reactNative.Animated.View,{style:a,children:jsxRuntime.jsxs(N,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:o.followUpSlot,style:o.followUpRow,children:[jsxRuntime.jsx(v,{style:o.followUpText,children:e}),jsxRuntime.jsx(ar,{size:gg,color:n.color.brandInk,direction:"right"})]})})}i(cg,"FollowUpRow");function pg({error:e,onRetry:t,onAddPet:r}){let{styles:n}=pe(),o=_i(e)?Di(r):void 0;return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:f.addPet,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.addPet})}):null,e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:f.retry,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.retry})}):null]})}i(pg,"ErrorState");function fg({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:s,sentimentByMessage:a,onSentiment:d,thanksFor:l,imagesByMessage:u,onPreview:c,notice:p,reconnecting:m,onRetry:b,onStartNew:h,petRef:_,onFindVet:S,vet:T,onOpenUrl:A}){let{styles:P}=pe(),x=G();wt(e.length,x);let y=react.useMemo(()=>dl(e),[e]),R=es(e,n),O=e[e.length-1],F=react.useMemo(()=>e.filter(E=>!(E.checkin&&y.get(E.id)?.kind==="folded")),[e,y]),g=td(F,n);return jsxRuntime.jsxs(reactNative.ScrollView,{ref:g.ref,style:P.list,contentContainerStyle:P.listContent,accessibilityLabel:f.transcript,keyboardShouldPersistTaps:"handled",onLayout:g.onLayout,onContentSizeChange:g.onContentSizeChange,onScroll:g.onScroll,scrollEventThrottle:hg,onScrollBeginDrag:g.onScrollBeginDrag,onScrollEndDrag:g.onScrollEnd,onMomentumScrollEnd:g.onScrollEnd,children:[e.map(E=>{let w=E.checkin?y.get(E.id):void 0;return w?.kind==="folded"?null:w?.kind==="past"?jsxRuntime.jsx(vl,{text:E.text,runDueDays:w.runDueDays,openedAt:E.checkin?.openedAt,onLayout:g.rowLayout(E.id)},E.id):E.checkin&&w!==void 0?jsxRuntime.jsx(gl,{message:E,checkin:E.checkin,onAnswer:o,petRef:_,onFindVet:S,vet:T,onLayout:g.rowLayout(E.id)},E.id):jsxRuntime.jsx(bg,{onLayout:g.rowLayout(E.id),message:E,revealing:n&&E===O&&E.role==="assistant",onCopy:s,sentiment:E.responseId===void 0?null:a[String(E.responseId)]??null,onSentiment:d,thanks:l!==null&&E.responseId!==void 0&&String(E.responseId)===l,images:u[E.id]??mg,onPreview:c,onOpenUrl:A},E.id)}),m?jsxRuntime.jsx(v,{tier:"compact",style:P.reconnectingCaption,accessibilityRole:"text",children:f.reconnecting}):null,R?jsxRuntime.jsx(Ql,{}):null,p!==null?jsxRuntime.jsx(yg,{notice:p,onRetry:b,onStartNew:h}):null,n?null:jsxRuntime.jsx(ad,{prompts:t,onSelectPrompt:r})]})}i(fg,"PopulatedState");function yg({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=pe(),o=e.tone==="error";return jsxRuntime.jsxs(reactNative.View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsxRuntime.jsx(v,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsxRuntime.jsx(reactNative.Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:ut,style:n.turnNoticeAction,children:jsxRuntime.jsx(v,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(yg,"TurnNoticeCard");var mg=Object.freeze([]),hg=16,gg=14;function bg({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:s,images:a,onPreview:d,onOpenUrl:l,onLayout:u}){let{styles:c}=pe(),p=G(),m=je(p.messageInMs),b=Ms(e.text,t,p),h=e.role==="user",_=h?f.senderUser:f.senderAssistant,S=react.useCallback(A=>o(e,A),[o,e]),T=e.pending!==true;return jsxRuntime.jsxs(reactNative.Animated.View,{style:[c.rowBlock,h?c.rowBlockUser:c.rowBlockAssistant,m],onLayout:u,children:[jsxRuntime.jsx(reactNative.View,{style:[c.row,h?c.rowUser:c.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${_}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxRuntime.jsxs(reactNative.View,{style:[c.bubble,h?c.bubbleUser:c.bubbleAssistant,e.pending?c.bubblePending:null],children:[h&&a.length>0?jsxRuntime.jsx(Js,{images:a,onPreview:A=>d({uri:A.uri,label:A.filename})}):null,jsxRuntime.jsx(v,{style:h?c.bubbleTextUser:c.bubbleTextAssistant,children:h?e.text:Wl(b,{bold:c.bubbleBold,italic:c.bubbleItalic,code:c.bubbleCode})})]})}),!h&&!t?jsxRuntime.jsx(kl,{citations:e.citations,onOpenUrl:l}):null,T?jsxRuntime.jsx(Fl,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:S,thanks:s}):null]})}i(bg,"MessageRow");var Sg=Object.freeze(["photo"]),Tg=1;function Pg(e){let{style:t,renderPending:r}=e;return jsxRuntime.jsx(as,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsxRuntime.jsx(wg,{...e})})}i(Pg,"EverfurChat");function wg({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:s,onVetPrep:a,onFindVet:d,renderVetAction:l,attachments:u,pet:c,onAddPet:p,checkinTarget:m,initialAsk:b,composerSeed:h,lifecycle:_,draftStore:S,vetReturnTo:T,vetUsState:A,vetPrefer:P,onOpenUrl:x}){let{theme:y,styles:R}=pe(),O=G(),F=react.useMemo(()=>ts(e,t),[e,t]),g=Ut(F),E=Zi(g),w=$a(),D=Yi(g),U=reactNativeSafeAreaContext.useSafeAreaInsets(),B=Ji(g),Z=react.useMemo(()=>d===void 0?void 0:()=>{W(d,"emergency");},[d]),re=react.useMemo(()=>T===void 0&&A===void 0&&P===void 0?void 0:{returnTo:T,usState:A,prefer:P},[T,A,P]),ge=Yn(w.pets,g.petRef),ft=react.useMemo(()=>Xi(g.messages,ge?.name??null),[g.messages,ge?.name]),ne=Qi(ft);wt(ne.showBanner,O),Ui(g.openCheckin,m),Fi(g.askEverfur,g.isBootstrapping,b);let Ve=react.useMemo(()=>en(h),[h]);Ni(_,{conversationId:g.conversationId===null?null:String(g.conversationId),isTurnInFlight:g.isStreaming,refresh:g.refreshActiveThread});let Dt=(g.hasUnreadThreads??false)||D.rows.some(fe=>fe.unreadCount!==null&&fe.unreadCount>0)||(g.unreadCount??0)>0,yt=Ai(g.messages),[Je,et]=react.useState(null),ud=react.useCallback(()=>et(null),[]),[mt,Or]=react.useState(null),[cd,co]=react.useState(null),tt=react.useRef(null);react.useEffect(()=>()=>{tt.current&&clearTimeout(tt.current);},[]);let po=react.useCallback(fe=>{co(String(fe)),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{co(null),tt.current=null;},ol);},[]),pd=react.useCallback((fe,Vt)=>{let ht=fe.responseId;if(ht===void 0)return;let gd=g.sentimentByMessage[String(ht)];g.feedback(ht,Vt),Vt==="down"&&gd!=="down"&&Or(ht);},[g]),fd=react.useCallback(async(fe,Vt)=>mt===null||!(await g.feedback(mt,"down",fe??"other",Vt)).ok?false:(Or(null),po(mt),true),[g,mt,po]),yd=react.useCallback(()=>Or(null),[]),md=react.useCallback(fe=>{g.send(fe);},[g.send]),hd=react.useMemo(()=>x===void 0?void 0:fe=>{W(x,fe,"citation");},[x]),fo={send:g.send,stop:g.stop,isStreaming:g.isStreaming,conversationId:g.conversationId,seed:Ve,draftStore:S,onStage:yt.stage,onPreview:et};return jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:[R.container,{paddingTop:U.top},r],behavior:reactNative.Platform.OS==="ios"?"padding":void 0,children:[jsxRuntime.jsx(Va,{pets:w,petRef:g.petRef,historyUnread:Dt,onOpenHistory:D.show,onPetChange:s,onAddPet:p,vet:re}),c!==void 0?jsxRuntime.jsx(kg,{petRef:e??null,pet:c,onRegistered:w.refresh}):null,jsxRuntime.jsx(Ka,{surface:ne,petRef:g.petRef,renderVetAction:l,onFindVet:d,vet:re}),jsxRuntime.jsx(reactNative.View,{style:R.body,children:sd(E,g,{notice:B,vet:re,onCheckinFindVet:Z,onSelectPrompt:md,renderPending:n,shownPet:ge,onVetPrep:a,onCopy:o,onSentiment:pd,thanksFor:cd,imagesByMessage:yt.byMessage,onPreview:et,onAddPet:p,onOpenUrl:hd})}),u!==void 0?jsxRuntime.jsx(_g,{...fo,attachments:u}):jsxRuntime.jsx(dd,{...fo,attachments:null}),jsxRuntime.jsx(cs,{}),y.meta.hidePoweredBy?null:jsxRuntime.jsx(v,{tier:"compact",style:R.poweredBy,accessibilityRole:"text",accessibilityLabel:f.poweredBy,children:f.poweredBy}),jsxRuntime.jsx(Wa,{chat:g,history:D}),jsxRuntime.jsx(ja,{visible:mt!==null,onSubmit:fd,onSkip:yd}),jsxRuntime.jsx(Ls,{uri:Je?.uri??null,label:Je?.label??"",onClose:ud}),jsxRuntime.jsx(_t,{})]})}i(wg,"ChatBody");function kg({petRef:e,pet:t,onRegistered:r}){let{styles:n}=pe(),o=xi(e,t,r);return o.status!=="failed"||o.error===null?null:jsxRuntime.jsxs(reactNative.View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsxRuntime.jsx(reactNative.Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:f.retry,hitSlop:ut,children:jsxRuntime.jsx(v,{tier:"control",style:n.setupNoticeAction,children:f.retry})})]})}i(kg,"PetSetupNotice");function _g({attachments:e,...t}){let r=react.useMemo(()=>kn(),[]),n=Yr({maxPerMessage:e.maxPerMessage??Tg,transport:r}),o=react.useMemo(()=>({state:n,sources:e.sources??Sg,pick:e.pick}),[n,e.sources,e.pick]);return jsxRuntime.jsx(dd,{...t,attachments:o})}i(_g,"ComposerWithAttachments");function dd({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:s,draftStore:a,onStage:d,onPreview:l}){let{theme:u,styles:c}=pe(),p=G(),[m,b]=ji(e,n,s);Wi(a,n===null?null:String(n),m,b);let[h,_]=react.useState(false),[S,T]=react.useState(false);react.useEffect(()=>{T(false);},[n]);let A=u.meta.placeholder??f.placeholder,P=o?.state.uploading??false,x=o?.state.failed??false,y=P||x,R=o?.state.attachments??xg;wt(R.length,p);let O=react.useCallback(()=>{if(m.trim().length===0||y||[...m].length>Kt)return;let B=o?.state.s3Keys??Ig;o!==null&&B.length>0?(d(o.state.attachments.filter(Z=>Z.status==="uploaded").map(Z=>({uri:Z.previewUri,filename:Z.filename}))),e(m,{imageS3Keys:B}),o.state.clear()):e(m),b(""),T(false);},[m,e,y,o,d]),F=react.useCallback(()=>{t();},[t]),g=react.useCallback(B=>{_(false),o!==null&&(T(false),o.state.dismissRejected(),ot(o.pick,B).then(Z=>{if(!Z.ok){T(true);return}Z.value!==null&&o.state.add(Z.value);}));},[o]),w=react.useMemo(()=>[...m].length>Kt,[m])||y,D=o!==null&&R.length>=o.state.maxPerMessage,U=u.slots.sendButton?.textColor??u.color.brandInk;return jsxRuntime.jsxs(reactNative.View,{style:c.composerOuter,children:[o!==null&&h?jsxRuntime.jsx(Ns,{sources:o.sources,full:D,onPick:g,onClose:()=>_(false)}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composer,children:[o!==null?jsxRuntime.jsx(Zs,{attachments:R,rejected:S?Ag:o.state.rejected,uploadFailed:x,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:B=>l({uri:B.previewUri,label:B.filename})}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composerRow,children:[o!==null?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:ti(R.length,o.state.maxPerMessage),accessibilityState:{disabled:D,expanded:h},disabled:D,hitSlop:(dt-wr)/2,style:[c.attachControl,D?c.attachControlDisabled:null],onPress:()=>_(B=>!B),children:jsxRuntime.jsx(vs,{size:al,color:D?u.color.text.muted:u.color.brandInk,strokeWidth:1.75})}):null,jsxRuntime.jsx(rt,{style:c.input,value:m,onChangeText:b,placeholder:A,placeholderTextColor:u.slots.composerInput?.textColor??u.color.text.placeholder,accessibilityLabel:A,onSubmitEditing:O,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsxRuntime.jsx(reactNative.Pressable,{onPress:F,accessibilityRole:"button",accessibilityLabel:f.stop,hitSlop:ut,style:c.sendControl,children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-stop-disc",children:jsxRuntime.jsx(ws,{size:sl,color:U,testID:"everfur-stop-glyph"})})}):jsxRuntime.jsx(reactNative.Pressable,{onPress:O,disabled:w,accessibilityRole:"button",accessibilityLabel:f.send,accessibilityState:{disabled:w,busy:P},hitSlop:ut,style:[c.sendControl,w?c.sendControlDisabled:null],children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-send-disc",children:jsxRuntime.jsx(Ps,{size:il,color:U,testID:"everfur-send-glyph"})})})]})]})]})}i(dd,"Composer");var xg=Object.freeze([]),Ig=Object.freeze([]),Ag=Object.freeze({code:"unknown",retryable:true,filename:""});exports.EverfurChat=Pg;exports.createRnChatAttachmentTransport=kn;exports.useChatAttachments=Yr;exports.useEverfurChat=Ut;exports.useEverfurPets=xn;
|
|
1
|
+
'use strict';var react=require('react'),reactNative=require('react-native'),reactNativeSafeAreaContext=require('react-native-safe-area-context'),jsxRuntime=require('react/jsx-runtime');var wd=Object.defineProperty;var i=(e,t)=>wd(e,"name",{value:t,configurable:true});var Dr=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(Dr.map(e=>e.wireCode));var kd=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"}),Co=Object.freeze(Dr.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:kd[e.wireCode]}))),xd=new Map(Co.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),_d=Object.freeze(["http_envelope",...[...new Set(Co.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function Ht(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",..._d]){let o=xd.get(n+r);if(o)return o}}i(Ht,"contractErrorFor");function Id(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}i(Id,"contractDocUrl");function Eo(e){return null}i(Eo,"publishedDocUrl");var Ad=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 Ro(e){return Ad[e]}i(Ro,"categoryFor");function So(e){let t=Ht(e);if(t)return t.normalized;let r=(e??"").trim().toUpperCase(),n=r.replace(/[^A-Z0-9]/g,"");if(n==="AUTHREJECTED")return "authRejected";if(r.startsWith("AUTH"))return "authExpired";switch(n){case "DAILYQUOTAEXCEEDED":case "QUOTAEXCEEDED":return "quotaExceeded";case "RATELIMITED":case "TOOMANYREQUESTS":case "TELEVETRATELIMITED":return "rateLimited";case "IDEMPOTENCYKEYCONFLICT":case "IDEMPOTENCYCONFLICT":return "idempotencyConflict";case "ACCESSDENIED":case "FORBIDDEN":return "accessDenied";case "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(So,"fromWire");var Od=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function Vr(e){return Od.has(e)}i(Vr,"isAutoRetryable");var Fd=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function To(e){return Vr(e)||Fd.has(e)}i(To,"isRetryableCode");var Md=500,Nr=8e3,Po=4;function wo(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Md*2**r,Nr);return Math.floor(t()*n)}i(wo,"backoffDelayMs");var Ld=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 Hr(e){return Ld[e]}i(Hr,"userFacingError");function ko(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}i(ko,"defineHidden");var Dd=/^[a-z][a-z0-9_]{0,63}$/;function q(e,t){let r=Ht(t?.wireCode,t?.wireEnvelope),n={code:e,category:Ro(e),retryable:t?.retryable??To(e),displayMessage:Hr(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Dd.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&ko(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&ko(n,"raw",t.raw),Object.freeze(n)}i(q,"makeEverfurError");function de(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}i(de,"ok");function V(e){return Object.freeze({ok:false,error:e})}i(V,"err");var Ut=class Ut extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,Ut.prototype);}};i(Ut,"EverfurConfigError");var ht=Ut;var f=Object.freeze({placeholder:"Ask me anything!",send:"Send",stop:"Stop",retry:"Try again",followUps:"Helpful follow-ups",poweredBy:"powered by everfur",senderUser:"You",senderAssistant:"Assistant",typing:"Assistant is typing",loading:"Loading",empty:"No messages yet",transcript:"Conversation",emptyTitle:"What can we help {petName} with today?",emptyTitlePetFallback:"your pet",copied:"Copied",copyUserMessage:"Copy your message",copyAssistantMessage:"Copy assistant message",feedbackHelpful:"Helpful",feedbackNeutral:"Neutral",feedbackNotHelpful:"Not helpful",feedbackTitle:"What went wrong?",feedbackSubtitle:"Your feedback helps make answers more reliable.",feedbackReasonInaccurate:"Inaccurate",feedbackReasonOutdated:"Out of date",feedbackReasonUnsafe:"Unsafe advice",feedbackReasonUnclear:"Confusing or unclear",feedbackReasonOther:"Something else",feedbackNotesPlaceholder:"Add details (optional)",feedbackSubmit:"Submit feedback",feedbackSkip:"Skip",feedbackSkipA11y:"Skip feedback",feedbackThanks:"Thanks for the feedback",feedbackFailed:"Couldn't send feedback. Please try again.",turnFailedTitle:"Message failed",turnRetry:"Retry",turnUnreachableTitle:"Couldn't reach this chat",turnStartNewChat:"Start a new chat",reconnecting:"Reconnecting\u2026",turnStoppedTitle:"Response stopped",turnStoppedBody:"You stopped this response before it finished. Tap retry to try again.",sourceSingular:"source",sourcePlural:"sources",showSources:"Show",hideSources:"Hide",openSource:"Open source",urgencyGeneralReason:"Just general info about {petName}. Nothing here needs action right now.",findVet:"Find a vet",findVetA11y:"Find a vet near you",showLatestVetAlert:"Show latest vet alert",dismissBanner:"Dismiss {label} banner",openMenu:"Open menu",openMenuUnread:"Open menu, unread chats",yourPets:"Your Pets",yourPet:"Your pet",switchActivePet:"Switch active pet, {name}",petCurrentlyActive:"{name}, currently active",switchToPet:"Switch to {name}",activePrefix:"Active \xB7 ",close:"Close",addAnotherPet:"Add another pet",addPet:"Add a pet",attachmentPhoto:"Photo",attachmentCamera:"Camera",closeAttachmentPicker:"Close attachment picker",addAttachment:"Add attachment, {used} of {total} used",attachmentsFull:"Attachments full, {used} of {total} used",retryUpload:"Retry uploading {filename}",removeAttachment:"Remove {filename}",previewAttachment:"Preview {filename}",closePreview:"Close preview",attachedImage:"Attached image: {filename}, opens a full-screen preview",attachmentTooLarge:"Files must be under {max}. {filename} is {size}.",attachmentTooMany:"You can attach up to {max} files per message.",attachmentUnsupported:"{filename} isn't a supported file type yet.",attachmentNetwork:"Couldn't reach the server. Check your connection and try again.",attachmentServer:"Upload failed{status}. Please try again.",attachmentCancelled:"Upload cancelled.",attachmentRateLimited:"Slow down. Please wait a moment and try again.",attachmentQuota:"Daily image limit reached. Try again tomorrow.",attachmentConflict:"Something went wrong. Tap to retry.",attachmentUnknown:"Something went wrong. Please try again.",attachmentsFailedBlocked:"Some attachments failed to upload. Remove or retry them before sending.",dictate:"Dictate a message",stopDictation:"Stop dictation",listening:"Listening",micBlocked:"Microphone access is blocked. Allow it in your browser settings to dictate.",noSpeech:"We didn't catch that. Tap the mic and try again.",dictationUnavailable:"Voice typing isn't available right now."});function j(e,t){return e.replace(/\{(\w+)\}/g,(r,n)=>{let o=t[n];return o===void 0?r:String(o)})}i(j,"fillCopy");var Ur=Object.freeze([Object.freeze({key:"inaccurate",label:f.feedbackReasonInaccurate,feedbackType:"wrong"}),Object.freeze({key:"outdated",label:f.feedbackReasonOutdated,feedbackType:"outdated"}),Object.freeze({key:"unsafe",label:f.feedbackReasonUnsafe,feedbackType:"dangerous"}),Object.freeze({key:"unclear",label:f.feedbackReasonUnclear,feedbackType:"unclear"}),Object.freeze({key:"other",label:f.feedbackReasonOther,feedbackType:"not_helpful"})]),xo=Object.freeze([Object.freeze({sentiment:"up",label:f.feedbackHelpful}),Object.freeze({sentiment:"neutral",label:f.feedbackNeutral}),Object.freeze({sentiment:"down",label:f.feedbackNotHelpful})]);function Vd(e){switch(e){case "up":return "helpful";case "neutral":return "neutral";case "down":return "not_helpful"}}i(Vd,"sentimentToFeedbackType");function _o(e,t){if(e==="down"&&t!==null){let r=Ur.find(n=>n.key===t);if(r!==void 0)return r.feedbackType}return Vd(e)}i(_o,"feedbackTypeFor");var Io=Symbol.for("@everfur/sdk#EverfurContext@v1"),Ao=globalThis,Oo=Ao[Io]??(Ao[Io]=react.createContext(null));Oo.displayName??="EverfurContext";function ie(){let e=react.useContext(Oo);if(e===null)throw new ht("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}i(ie,"useEverfurContext");var jd=Object.freeze({status:"idle",messages:Object.freeze([]),conversationId:null,error:null,isStreaming:false,isBootstrapping:true,suggestedPrompts:Object.freeze([]),unreadCount:null});function zt(e){let{runtime:t,userRef:r,activePet:n,scopeEpoch:o}=ie(),s=e?.petRef??n??null,a=e?.conversationId??null,d=react.useMemo(()=>({runtime:t,userRef:r,petRef:s,conversationId:a,scopeEpoch:o}),[t,r,s,a,o]),[l,u]=react.useState(null),c=l?.scope===d?l.controller:t.registry.peekChat({userRef:r,petRef:s,conversationId:a}),p=react.useRef(null);react.useEffect(()=>{let P=t.registry.acquireChat({userRef:r,petRef:s,conversationId:a});return p.current=P,u({scope:d,controller:P}),()=>{p.current=null,u(h=>h?.controller===P?null:h),t.registry.releaseChat(P);}},[t,r,s,a,o,d]);let y=react.useCallback(P=>c?c.subscribe(P):Wd,[c]),b=react.useCallback(()=>c?c.getSnapshot():jd,[c]),g=react.useSyncExternalStore(y,b,b),w=react.useCallback((P,h)=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Br(c,c.send(P,h?.imageS3Keys===void 0?{}:{imageS3Keys:h.imageS3Keys}),()=>p.current===c):Promise.resolve(jr()),[c]),E=react.useCallback(P=>c&&p.current===c&&!c.getSnapshot().isBootstrapping?Br(c,c.askEverfur(P),()=>p.current===c):Promise.resolve(jr()),[c]),S=react.useCallback(()=>c&&p.current===c?Br(c,c.retryLast(),()=>p.current===c):Promise.resolve(jr()),[c]),_=react.useCallback(()=>{c&&p.current===c&&c.stop();},[c]),T=react.useCallback(()=>{c&&p.current===c&&c.newConversation();},[c]),[I,m]=react.useState({controller:null,byMessage:{}}),R=I.controller===c?I.byMessage:Gd,O=react.useCallback(async(P,h,x,D)=>{if(!c||p.current!==c)return V(q("accessDenied"));let U=String(P),z=I.controller===c?I.byMessage[U]:void 0;if(z===h&&x==null)return m(le=>{let ge={...le.controller===c?le.byMessage:{}};return delete ge[U],{controller:c,byMessage:ge}}),de(Object.freeze({feedbackId:""}));m(le=>({controller:c,byMessage:{...le.controller===c?le.byMessage:{},[U]:h}}));let Z=await c.submitFeedback(P,_o(h,x??null),D??null);return p.current!==c?V(q("accessDenied")):(Z.ok||m(le=>{let ge={...le.controller===c?le.byMessage:{}};return z===void 0?delete ge[U]:ge[U]=z,{controller:c,byMessage:ge}}),Z)},[c,I]),F=react.useMemo(()=>{let P=i(async h=>{if(!c||p.current!==c)return V(q("accessDenied"));let x=await h(c);return p.current===c?x:V(q("accessDenied"))},"run");return {listConversations:i(h=>P(x=>x.listConversations({...s?{petRef:s}:{},...h})),"listConversations"),getMessages:i((h,x)=>P(D=>D.getMessages(h,x)),"getMessages"),resumeConversation:i(h=>P(x=>x.resumeConversation(h)),"resumeConversation"),loadOlderMessages:i(()=>P(h=>h.loadOlderMessages()),"loadOlderMessages"),markRead:i(()=>P(h=>h.markRead()),"markRead"),refreshActiveThread:i(()=>P(h=>h.refreshActiveThread()),"refreshActiveThread"),answerCheckin:i((h,x)=>P(D=>D.answerCheckin(h,x)),"answerCheckin"),openCheckin:i(h=>P(x=>x.openCheckin(h)),"openCheckin")}},[c,s]);return react.useMemo(()=>({status:g.status,messages:g.messages,conversationId:g.conversationId,petRef:s,error:g.error,isStreaming:g.isStreaming,isBootstrapping:g.isBootstrapping,historyCursor:g.historyCursor??null,isLoadingHistory:g.isLoadingHistory??false,stopped:g.stopped??false,reconnecting:g.reconnecting??false,...F,suggestedPrompts:g.suggestedPrompts,unreadCount:g.unreadCount,hasUnreadThreads:g.hasUnreadThreads??false,newConversation:T,sentimentByMessage:R,feedback:O,send:w,askEverfur:E,retryLast:S,stop:_}),[g,s,w,E,S,_,F,T,R,O])}i(zt,"useEverfurChat");var Wd=i(()=>{},"NOOP_UNSUBSCRIBE"),Gd=Object.freeze({});async function Br(e,t,r){for await(let o of t);if(!r())return V(q("accessDenied"));let n=e.getSnapshot();return n.status==="error"&&n.error!==null?V(n.error):de(qd(n.messages))}i(Br,"driveToResult");function qd(e){for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r&&r.role==="assistant"&&r.responseId!==void 0)return r.responseId}return null}i(qd,"lastAssistantResponseId");function jr(){return V(q("internalError",{retryable:true}))}i(jr,"notReadyError");function Wr(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Wr(e[t]);}return e}i(Wr,"deepFreeze");var Yd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),Lo={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},Do={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},Mo={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Kd={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},$d={regular:"400",medium:"500",bold:"700"},Xd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Qd=0,Bt="System",jt="monospace",Zd=["content","heading","control","compact","badge"];function Jd(e){let t={};for(let r of Zd)t[r]=e;return t}i(Jd,"authoredTierSizes");function Vo(){return {family:Bt,mono:jt,fontUrl:null,families:{regular:Bt,medium:Bt,bold:Bt,mono:jt,monoMedium:jt,monoBold:jt},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:Mo,tierSizes:Jd(Mo),lineHeight:Kd,weight:$d,letterSpacing:Xd,scale:1,maxScale:Qd,scaleCaps:Yd}}i(Vo,"baseType");var No={},He=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function Wt(e){return `cubic-bezier(${e.join(", ")})`}i(Wt,"cssCubicBezier");var Ho={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:Wt(He.standard),emphasized:Wt(He.emphasized),exit:Wt(He.exit)},reducedMotion:false},eu={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FDFBF8",surfaceSubtle:"#EFE9E3",background:"#FFFFFF",borderRingCream:"#D8D2C8",chatGround:"#FFFFFF",composerFill:"#FDFBF8",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#111111",secondary:"#0E462E",muted:"#6E6660",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#B91C1C",errorRed:"#FF1B00",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(185,28,28,0.12)",badgeBgNeutral:"rgba(110,102,96,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},Uo=Wr({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:eu,space:Lo,radius:Do,type:Vo(),motion:Ho,slots:No}),tu={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A938C",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Wr({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tu,space:Lo,radius:Do,type:Vo(),motion:Ho,slots:No});var zo=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Bo=globalThis,Gr=Bo[zo]??(Bo[zo]=react.createContext(Uo));Gr.displayName??="EverfurThemeContext";function A(){return react.useContext(Gr)}i(A,"useEverfurTheme");function au(e,t){let r=e.scaleCaps[t];return r>0?r:void 0}i(au,"tierMultiplier");function v({tier:e="content",...t}){let{type:r}=A(),n=au(r,e);return react.createElement(reactNative.Text,n===void 0?t:{maxFontSizeMultiplier:n,...t})}i(v,"Text");var rt=react.forwardRef(i(function(t,r){return react.createElement(reactNative.TextInput,{...t,...r===null?{}:{ref:r}})},"TextInput"));function Gt(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}i(Gt,"assertNever");function Wo(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(Wo,"errorFrame");function uu(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(uu,"authHeaders");function gt(e,t){return {...e,headers:{...cu(e.headers),...uu(t)}}}i(gt,"withAuthHeaders");function cu(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let o=r.toLowerCase();o==="authorization"||o==="x-everfur-partner-key"||(t[r]=n);}return t}i(cu,"stripAuthHeaders");async function Go(e,t){if(t.mode==="anonymous")return t.transport.request(gt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return V(qr())}let n=await t.transport.request(gt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let o;try{o=await t.identity.currentToken({forceRefresh:!0});}catch{return V(qr())}let s=await t.transport.request(gt(e,{mode:"personalized",token:o,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !s.ok&&s.error.httpStatus===401?V(qr(s.error.httpStatus)):s}i(Go,"authedSend");function qr(e){return q("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}i(qr,"authRejectedError");function qo(e){return q("internalError",{retryable:true,wireMessage:pu(e)})}i(qo,"networkError");function pu(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}i(pu,"describeCause");var fu=3e4,yu=Nr*2,mu="idempotency-key",hu=new Set(["POST","PUT","PATCH","DELETE"]),gu=Object.freeze({onEvent(){}}),bu=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function vu(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}i(vu,"seededIdempotencyKey");function Ue(e){let t=e.observer??gu,r=e.timers??bu,n=e.rng??Math.random,o=e.sleep??((y,b)=>Fu(y,r,b)),s=e.maxAttempts??Po,a=e.unaryTimeoutMs??fu,d=e.newIdempotencyKey??Eu(),l=i(y=>{try{t.onEvent(y);}catch{}},"emit");async function u(y,b,g){let w=g?.maxAttempts,E=Math.max(1,w??s),S=g?.idempotent??hu.has(b.method),_=g?.idempotencyKey===void 0?null:vu(g.idempotencyKey),T=S?_??d():null,I=Cu(b,T),m=0;for(;;){let R=i(U=>Object.freeze({call:y,method:b.method,path:b.path,attempt:m,...T?{idempotencyKey:T}:{},...U}),"stamp");l(R({phase:"attempt"}));let O=Au(a,r),F=Ou(O.signal,b.signal),P;try{P=await Go({...I,signal:F.signal},e.auth);}catch(U){P=V(qo(U));}finally{F.dispose(),O.cancel();}if(P.ok)return l(R({phase:"settled",ok:true,reason:"ok"})),P;let h=P.error,x=Su(h,m,{maxAttempts:E,rng:n,now:r.now(),aborted:b.signal?.aborted===true,...w!==void 0?{perCallMaxAttempts:w}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),D={ok:false,code:h.code,reason:x.reason,...h.httpStatus!==void 0?{httpStatus:h.httpStatus}:{},...h.requestId!==void 0?{requestId:h.requestId}:{}};if(!x.retry)return l(R({phase:"settled",...D})),V(h);if(l(R({phase:"retry",...D,delayMs:x.delayMs})),await o(x.delayMs,b.signal),b.signal?.aborted===true)return l(R({phase:"settled",...D,reason:"aborted"})),V(h);m+=1;}}i(u,"send");async function c(y){return gt(y,await Iu(e.auth))}i(c,"authorize");async function*p(y,b,g){l(Object.freeze({call:y,phase:"stream.open",method:b.method,path:b.path,attempt:0}));try{yield*e.auth.transport.stream(b,g);}catch{yield Wo({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return i(p,"stream"),Object.freeze({send:u,authorize:c,stream:p})}i(Ue,"createRequestFunnel");function Cu(e,t){let r={};for(let[n,o]of Object.entries(e.headers??{}))n.toLowerCase()!==mu&&(r[n]=o);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}i(Cu,"assembleHeaders");function Eu(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}i(Eu,"defaultIdempotencyKeyFactory");var Ru=10;function Su(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=Tu(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!Vr(e.code))return {retry:false,reason:"terminal-code"};let o=n==="burst"?"burst-throttle":"retryable-code";if(i(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let a=i(()=>{if(r.policy===void 0)return null;let u;try{u=r.policy.maxAttempts(e.code);}catch{return null}return typeof u!="number"||!Number.isFinite(u)?null:Math.max(1,Math.min(Ru,Math.floor(u)))},"policyCeiling"),d=r.perCallMaxAttempts??a()??r.maxAttempts;if(t+1>=d)return {retry:false,reason:"attempts-exhausted"};let l=Pu(e,r.now);return l!==null?l>yu?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:o,delayMs:l}:{retry:true,reason:o,delayMs:wo(t,r.rng)}}i(Su,"decideRetry");function Tu(e){let t=e.code==="unknown"?So(_u(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}i(Tu,"throttleKind");function Pu(e,t){let r=ku(e.raw);if(r!==null){let o=r-t;return o>0?o:0}let n=wu(e.raw);return n===null?null:Math.round(n*1e3)}i(Pu,"retryOverrideMs");function wu(e){for(let t of Yr(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}i(wu,"findRetryAfterSeconds");function ku(e){for(let t of Yr(e)){let r=t.resets_at,n=xu(r);if(n!==null)return n}return null}i(ku,"findResetsAt");function Yr(e){if(!Yo(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];Yo(n)&&t.push(n);}return t}i(Yr,"candidateScopes");function xu(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(xu,"parseInstantMs");function _u(e){for(let t of Yr(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}i(_u,"rawWireCode");function Yo(e){return typeof e=="object"&&e!==null}i(Yo,"isRecord");async function Iu(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(Iu,"resolveDeviceAuth");function Au(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:i(()=>t.clearTimeout(n),"cancel")}}i(Au,"boundedSignal");function Ou(e,t){let r=i(()=>{},"noop");if(!t)return {signal:e,dispose:r};let n=new AbortController;if(e.aborted||t.aborted)return n.abort(),{signal:n.signal,dispose:r};let o=i(()=>n.abort(),"onAbort");return e.addEventListener("abort",o,{once:true}),t.addEventListener("abort",o,{once:true}),{signal:n.signal,dispose:i(()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o);},"dispose")}}i(Ou,"mergeSignals");function Fu(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let o=t.setTimeout(()=>{r?.removeEventListener("abort",s),n();},e),s=i(()=>{t.clearTimeout(o),n();},"onAbort");r?.addEventListener("abort",s,{once:true});})}i(Fu,"delayAbortable");function qt(e){for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r>=55296&&r<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1;}else if(r>=56320&&r<=57343)return true}return false}i(qt,"hasLoneSurrogate");function Yt(e){return [...e].length}i(Yt,"serverLength");var Ko=Object.freeze(["better","same","worse"]),$o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var Xo=Object.freeze({setTimeout:i((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:i(e=>clearTimeout(e),"clearTimeout"),now:i(()=>Date.now(),"now")});function Qo(e,t,r){return new Promise(n=>{if(t.aborted){n();return}let o={handle:void 0},s=i(()=>{r.clearTimeout(o.handle),t.removeEventListener("abort",s),n();},"done");o.handle=r.setTimeout(s,e),t.addEventListener("abort",s,{once:true});})}i(Qo,"delayAbortable");var Mu="checkin",Lu=/^\d{4}-\d{2}-\d{2}$/,Du="watching";function Zo(e){return e.status!=null&&e.status!==Du}i(Zo,"isCheckinSettled");function Jo(e){if(typeof e!="string")return null;let t=e.split(":");if(t.length!==3)return null;let[r,n,o]=t;return r!==Mu||n===void 0||o===void 0||!$o.test(n)||!Lu.test(o)?null:{caseId:n,dueDay:o}}i(Jo,"parseCheckinOrigin");var Kt=4e3;var $t=4e3;var Hu=Object.freeze({postMultipart(){return Promise.reject(new Error("UploadTransport is unavailable; no records upload adapter was injected"))}});function ei(e){return e!==Hu}i(ei,"isUploadTransportAvailable");var Uu=Object.freeze(["image/jpeg","image/jpg","image/png","image/heic","image/heif","image/webp"]);var Xt=10*1024*1024,Qt=5,bt=120,zu="/widget/v1/uploads/initiate";function Bu(e){return typeof e=="string"&&Uu.includes(e.trim().toLowerCase())}i(Bu,"isAttachmentMime");function Kr(e){if(!e)return "attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return "attachment";if(t.length<=bt)return t;let r=t.lastIndexOf(".");if(r===-1||r===t.length-1)return t.slice(0,bt);let n=t.slice(r);return n.length>=bt?t.slice(0,bt):`${t.slice(0,r).slice(0,bt-n.length)}${n}`}i(Kr,"sanitizeFilename");function $r(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}i($r,"formatBytes");var vt=i(e=>Object.freeze({ok:true,value:e}),"ok"),be=i(e=>Object.freeze({ok:false,error:e}),"err");function J(e,t,r,n){return Object.freeze({code:e,retryable:t,filename:r,...n??{}})}i(J,"failure");function ju(e){if(typeof e.sizeBytes=="number"&&Number.isFinite(e.sizeBytes)&&e.sizeBytes>=0)return e.sizeBytes;let t=e.blob;return t!==void 0&&typeof t.size=="number"&&Number.isFinite(t.size)?t.size:null}i(ju,"attachmentSize");function Wu(e){let t=Kr(e.name),r=typeof e.mimeType=="string"?e.mimeType.trim().toLowerCase():"";if(!Bu(r))return be(J("unsupported_type",false,t));let n=ju(e);return n===null?be(J("unknown",false,t)):n>Xt?be(J("too_large",false,t,{sizeBytes:n})):vt(Object.freeze({file:e,filename:t,contentType:r,sizeBytes:n}))}i(Wu,"validateAttachment");function Gu(e){if(typeof e!="object"||e===null)return null;let t=e,r=i(u=>typeof u=="string"&&u.length>0?u:null,"str"),n=i(u=>typeof u=="number"&&Number.isFinite(u)?u:null,"num"),o=r(t.upload_id),s=r(t.upload_url),a=r(t.s3_key);if(o===null||s===null||a===null)return null;let d={},l=t.upload_fields;if(typeof l=="object"&&l!==null)for(let[u,c]of Object.entries(l))typeof c=="string"&&(d[u]=c);return Object.freeze({upload_id:o,upload_url:s,upload_fields:Object.freeze(d),expires_in_seconds:n(t.expires_in_seconds)??0,max_content_length:n(t.max_content_length)??Xt,s3_key:a,purpose:r(t.purpose)})}i(Gu,"parsePolicy");function qu(e,t){let r=e.httpStatus;switch(e.code){case "quotaExceeded":return J("quota_exceeded",false,t,{cause:e});case "rateLimited":return J("rate_limited",true,t,{cause:e});case "idempotencyConflict":case "idempotencyInFlight":return J("idempotency_conflict",true,t,{cause:e});case "validationFailed":return J("unsupported_type",false,t,{cause:e});case "serviceUnavailable":case "streamTimeout":return J("network",true,t,{cause:e});default:return r===429?J("rate_limited",true,t,{cause:e}):r===503?J("network",true,t,{cause:e}):r===void 0?J("network",true,t,{cause:e}):J("server",e.retryable,t,{httpStatus:r,cause:e})}}i(qu,"initiateFailure");async function Yu(e,t,r){let n=await e.send("chat.attachments.initiate",{method:"POST",path:zu,body:{filename:t.filename,content_type:t.contentType,file_size:t.sizeBytes},...r?.signal?{signal:r.signal}:{}});if(!n.ok)return be(qu(n.error,t.filename));let o=Gu(n.value);return o===null?be(J("server",false,t.filename)):vt(o)}i(Yu,"initiateAttachmentUpload");async function Ku(e,t,r,n){let o=i(()=>n?.signal?.aborted===true,"cancelled");if(o())return be(J("cancelled",true,r.filename));try{return await e.postMultipart(t,r.file,{...n?.signal?{signal:n.signal}:{},...n?.onProgress?{onProgress:n.onProgress}:{}}),vt(void 0)}catch{return o()?be(J("cancelled",true,r.filename)):be(J("server",true,r.filename))}}i(Ku,"uploadAttachmentBytes");var $u=2,Xu=3,Qu=Object.freeze([1e3,2e3,4e3]),ti=0;function Zu(){return ti+=1,`attachment-${ti}`}i(Zu,"defaultNewId");function ri(e){let t=Math.max(1,e.concurrency??$u),r=Math.max(1,e.maxAttempts??Xu),n=e.backoffMs??Qu,o=Math.max(1,e.maxPerMessage??Qt),s=e.timers??Xo,a=e.newId??Zu,d=ei(e.transport),l=new Map,u=[],c=[],p=new Set,y=new Set,b=Object.freeze({attachments:Object.freeze([])}),g=false,w=i(()=>{b=Object.freeze({attachments:Object.freeze(u.flatMap(m=>{let R=l.get(m);return R===void 0?[]:[R.state]}))});for(let m of y)m();},"publish"),E=i((m,R)=>{m.state=Object.freeze({...m.state,...R}),w();},"patch"),S=i(()=>{for(;!g&&p.size<t&&c.length>0;){let m=c.shift(),R=l.get(m);R!==void 0&&(p.add(m),_(R).finally(()=>{p.delete(m),S();}));}},"pump"),_=i(async m=>{let{attachment:R}=m;for(;m.attempts<r;){if(g||m.controller.signal.aborted)return;m.attempts+=1;let O=m.controller.signal;E(m,{status:"uploading",error:null,progress:0});let F=await Yu(e.funnel,R,{signal:O});if(g||O.aborted)return;let P;if(!F.ok)P=be(F.error);else {let U=await Ku(e.transport,F.value,R,{signal:O,onProgress:i(z=>{!O.aborted&&m.state.status==="uploading"&&E(m,{progress:Ju(z)});},"onProgress")});if(g||O.aborted)return;P=U.ok?vt(F.value.s3_key):be(U.error);}if(P.ok){E(m,{status:"uploaded",s3Key:P.value,error:null,progress:1});return}let h=P.error,x=h.retryable&&m.attempts<r;if(E(m,{status:x?"uploading":"failed",error:h,progress:0}),!x)return;let D=n[Math.min(m.attempts-1,n.length-1)]??0;await Qo(D,O,s);}},"run"),T=i(m=>{c.push(m.state.id),S();},"enqueue"),I={available:d,subscribe(m){return y.add(m),()=>{y.delete(m);}},getSnapshot:i(()=>b,"getSnapshot"),get uploading(){return b.attachments.some(m=>m.status==="uploading")},get s3Keys(){return b.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[])},add(m){let R=Wu(m);if(!R.ok)return R;if(g||u.length>=o)return be(J("too_many",false,R.value.filename));let O=a(),F={attachment:R.value,controller:new AbortController,attempts:0,state:Object.freeze({id:O,filename:R.value.filename,previewUri:m.uri,contentType:R.value.contentType,sizeBytes:R.value.sizeBytes,status:"uploading",s3Key:null,error:null,progress:0})};return l.set(O,F),u.push(O),w(),T(F),vt(F.state)},retry(m){let R=l.get(m);R===void 0||g||R.state.status!=="failed"||(R.controller=new AbortController,R.attempts=0,E(R,{status:"uploading",error:null,progress:0,s3Key:null}),T(R));},remove(m){let R=l.get(m);if(R===void 0)return;R.controller.abort(),l.delete(m);let O=u.indexOf(m);O>=0&&u.splice(O,1);let F=c.indexOf(m);F>=0&&c.splice(F,1),w();},clear(){for(let m of [...u])I.remove(m);},dispose(){g=true;for(let m of l.values())m.controller.abort();l.clear(),u.length=0,c.length=0,y.clear(),b=Object.freeze({attachments:Object.freeze([])});}};return I}i(ri,"createAttachmentQueue");function Ju(e){return Number.isNaN(e)||e<0?0:e>1?1:e}i(Ju,"clamp");function ii(e){switch(e.code){case "too_large":return j(f.attachmentTooLarge,{max:$r(Xt),filename:e.filename,size:$r(e.sizeBytes??0)});case "too_many":return j(f.attachmentTooMany,{max:Qt});case "unsupported_type":return j(f.attachmentUnsupported,{filename:e.filename});case "network":return f.attachmentNetwork;case "server":return j(f.attachmentServer,{status:e.httpStatus?` (${e.httpStatus})`:""});case "cancelled":return f.attachmentCancelled;case "rate_limited":return f.attachmentRateLimited;case "quota_exceeded":return f.attachmentQuota;case "idempotency_conflict":return f.attachmentConflict;case "unknown":return f.attachmentUnknown}}i(ii,"attachmentErrorMessage");function si(e,t){return j(e>=t?f.attachmentsFull:f.addAttachment,{used:e,total:t})}i(si,"attachControlLabel");var nc=Object.freeze({attachments:Object.freeze([])});function Xr(e={}){let{runtime:t,userRef:r,scopeEpoch:n}=ie(),o=e.maxPerMessage??Qt,s=react.useCallback(()=>{let{services:m}=t.registry;return ri({funnel:Ue({auth:m.authFor(r),...m.errorPolicy?{errorPolicy:m.errorPolicy}:{}}),transport:e.transport??m.uploadTransport,maxPerMessage:o})},[t,r,n,o,e.transport]),a=react.useMemo(()=>e.queue??s(),[e.queue,s]),d=react.useRef(new WeakSet),[l,u]=react.useState(null),c=l!==null&&l.of===a?l.queue:a;react.useEffect(()=>{if(c!==e.queue){if(d.current.has(c)){u({of:a,queue:s()});return}return ()=>{c.dispose(),d.current.add(c);}}},[c,a,s,e.queue]);let p=react.useSyncExternalStore(c.subscribe,c.getSnapshot,()=>nc),[y,b]=react.useState(null),g=react.useCallback(m=>{let O=(Array.isArray(m)?m:[m]).map(P=>c.add(P)),F=O.find(P=>!P.ok);return F!==void 0&&!F.ok&&b(F.error),O},[c,b]),w=react.useCallback(m=>c.retry(m),[c]),E=react.useCallback(m=>c.remove(m),[c]),S=react.useCallback(()=>c.clear(),[c]),_=react.useCallback(()=>b(null),[b]),T=p.attachments.some(m=>m.status==="uploading"),I=p.attachments.some(m=>m.status==="failed");return react.useMemo(()=>({available:c.available,attachments:p.attachments,maxPerMessage:o,uploading:T,failed:I,blocked:T||I,s3Keys:p.attachments.flatMap(m=>m.status==="uploaded"&&m.s3Key!==null?[m.s3Key]:[]),rejected:y,add:g,retry:w,remove:E,clear:S,dismissRejected:_}),[c.available,p,o,T,I,y,g,w,E,S,_])}i(Xr,"useChatAttachments");var ai=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function Zt(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(ai,t)?ai[t]:null}i(Zt,"canonicalPetSpecies");var li=50,oc=128,Qr=120,di=120,ic=2e3,ui=120,sc=80,fi=new Set(["male","female","unknown"]),yi=new Set(["day","month","year"]),mi=new Set(["low","medium","high","athletic"]),hi=new Set(["indoor","outdoor","both"]),gi=new Set(["mild","moderate","severe"]),ac=/^(\d{4})-(\d{2})-(\d{2})$/,bi=[["sex","sex"],["spayedNeutered","spayed_neutered"],["birthDate","birth_date"],["birthDatePrecision","birth_date_precision"],["activityLevel","activity_level"],["indoorOutdoor","indoor_outdoor"],["foodBrand","food_brand"],["foodType","food_type"],["microchipId","microchip_id"]],vi=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...bi,...vi].map(([e])=>e));function lc(e){let t=ac.exec(e);if(t===null)return false;let[r,n,o]=[Number(t[1]),Number(t[2]),Number(t[3])],s=new Date(Date.UTC(r,n-1,o));return s.getUTCFullYear()===r&&s.getUTCMonth()===n-1&&s.getUTCDate()===o}i(lc,"isRealDate");var Et=i(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),dc=i((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),er=i((e,t)=>typeof t=="string"&&lc(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),Ee=i((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(qt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let o=t.trimmed?n.trim():n;if(t.required&&o.length===0)return `${r} is required and must not be blank`;let s=Yt(o);return s<=e?null:`${r} is ${s} characters; the server accepts at most ${e}`},"text"),uc={sex:Et(fi),spayedNeutered:dc,birthDate:er,birthDatePrecision:Et(yi),activityLevel:Et(mi),indoorOutdoor:Et(hi),foodBrand:Ee(ui),foodType:Ee(ui),microchipId:Ee(sc)},Zr=["ref","ref",false,Ee(oc,{required:true,trimmed:true})],Jr=["notes","notes",false,Ee(ic,{trimmed:true})],ci=[Zr,["name","name",true,Ee(Qr,{required:true,trimmed:true})],["dose","dose",false,Ee(di,{trimmed:true})],["frequency","frequency",false,Ee(di,{trimmed:true})],["startDate","start_date",false,er],["endDate","end_date",false,er],Jr],cc={allergies:[Zr,["allergen","allergen",true,Ee(Qr,{required:true,trimmed:true})],["severity","severity",false,Et(gi)],Jr],medications:ci,supplements:ci,conditions:[Zr,["conditionName","condition_name",true,Ee(Qr,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,er],Jr]};function pc(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let o=r,s={};for(let[l,u,c,p]of cc[e]){let y=o[l];if(y==null){if(c)return {error:`${n}.${l} is required`};y===null&&(s[u]=null);continue}let b=p(`${n}.${l}`,y);if(b!==null)return {error:b};s[u]=y;}let a=s.start_date,d=s.end_date;return typeof a=="string"&&typeof d=="string"&&d<a?{error:`${n}.endDate must not be before startDate`}:{item:s}}i(pc,"itemToWire");function fc(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>li)return {error:`${e} has ${t.length} items; the server accepts at most ${li}`};let r=[],n=new Set;for(let o=0;o<t.length;o+=1){let s=pc(e,o,t[o]);if("error"in s)return s;let a=s.item.ref;if(typeof a=="string"){let d=a.trim();if(n.has(d))return {error:`${e}: ref ${JSON.stringify(d)} is used twice; a ref names one item`};n.add(d);}r.push(s.item);}return {items:r}}i(fc,"listToWire");function Ci(e,t){let r=e,n={};for(let[a,d]of bi){let l=r[a];if(l!==void 0){if(l!==null){let u=uc[a](a,l);if(u!==null)return {error:u}}n[d]=l;}}let o=r.birthDate!==void 0,s=r.birthDatePrecision!==void 0;if(o!==s||o&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[a,d]of vi){let l=r[a];if(l===void 0)continue;let u=fc(a,l);if("error"in u)return u;n[d]=u.items;}return Object.keys(n).length>0&&t!==void 0&&Zt(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:n}}i(Ci,"petHealthToWire");var $=i(e=>typeof e=="string"?e:null,"str"),Ct=i((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),yc=i(e=>typeof e=="boolean"?e:null,"bool");function Jt(e,t){return Array.isArray(e)?Object.freeze(e.flatMap(r=>{if(typeof r!="object"||r===null||Array.isArray(r))return [];let n=t(r);return n===null?[]:[n]})):Object.freeze([])}i(Jt,"itemsFromWire");function pi(e){let t=$(e.name);return t===null||t.length===0?null:Object.freeze({ref:$(e.ref),name:t,dose:$(e.dose),frequency:$(e.frequency),startDate:$(e.start_date),endDate:$(e.end_date),notes:$(e.notes)})}i(pi,"medicationFromWire");function Ei(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Ct(fi,e.sex),spayedNeutered:yc(e.spayed_neutered),birthDate:$(e.birth_date),birthDatePrecision:Ct(yi,e.birth_date_precision),activityLevel:Ct(mi,e.activity_level),indoorOutdoor:Ct(hi,e.indoor_outdoor),foodBrand:$(e.food_brand),foodType:$(e.food_type),microchipId:$(e.microchip_id),allergies:Jt(e.allergies,r=>{let n=$(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),allergen:n,severity:Ct(gi,r.severity),notes:$(r.notes)})}),medications:Jt(e.medications,pi),supplements:Jt(e.supplements,pi),conditions:Jt(e.conditions,r=>{let n=$(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:$(r.ref),conditionName:n,diagnosedDate:$(r.diagnosed_date),notes:$(r.notes)})})})}i(Ei,"petHealthFromWire");var Ti=100,Pi=50,wi=100,ki=50,xi=500,mc=128,hc=6e4;function Se(e){return q("validationFailed",{retryable:false,wireMessage:e})}i(Se,"invalid");function ze(e,t,r){if(typeof t!="string")return Se(`${e} must be a string`);let n=Yt(t);return n<=r?null:Se(`${e} is ${n} characters; the server accepts at most ${r}`)}i(ze,"checkString");function tr(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Se(`${e} must be a finite number between 0 and ${r}`)}i(tr,"outOfRange");function Ri(e,t){if(typeof e!="string")return Se("pet_ref must be a string");if(e.trim().length===0)return Se("pet_ref must not be blank");if(qt(e))return Se("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Se("profile must be an object");let r=[ze("pet_ref",e,mc)];return t?.name!==void 0&&r.push(ze("name",t.name,Ti)),t?.species!==void 0&&r.push(ze("species",t.species,Pi)),t?.breed!==void 0&&r.push(ze("breed",t.breed,wi)),t?.ageYears!==void 0&&r.push(tr("age_years",t.ageYears,ki)),t?.weightKg!==void 0&&r.push(tr("weight_kg",t.weightKg,xi)),r.find(n=>n!==null)??null}i(Ri,"validate");function _i(e,t){let r=Ci(e,t);return "error"in r?{error:Se(r.error)}:r}i(_i,"healthToWire");function gc(e){if(typeof e!="object"||e===null)return {error:Se("patch must be an object")};let t=e,r=[["name","name",s=>ze("name",s,Ti)],["species","species",s=>ze("species",s,Pi)],["breed","breed",s=>ze("breed",s,wi)],["ageYears","age_years",s=>tr("age_years",s,ki)],["weightKg","weight_kg",s=>tr("weight_kg",s,xi)]],n={};for(let[s,a,d]of r){let l=t[s];if(l!==void 0){if(l!==null){let u=d(l);if(u!==null)return {error:u}}n[a]=l;}}let o=_i(t,t.species);return "error"in o?o:(Object.assign(n,o.body),Object.keys(n).length===0?{error:Se("patch must change at least one field")}:{body:n})}i(gc,"patchToWire");function bc(e){if(e==null)return {body:{}};let t=_i(e,e.species);return "error"in t?t:{body:{...e.name!==void 0?{name:e.name}:{},...e.species!==void 0?{species:e.species}:{},...e.breed!==void 0?{breed:e.breed}:{},...e.ageYears!==void 0?{age_years:e.ageYears}:{},...e.weightKg!==void 0?{weight_kg:e.weightKg}:{},...t.body}}}i(bc,"toWire");var Re=i(e=>typeof e=="string"?e:null,"str"),rr=i(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Si(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Re(r.pet_ref)??t,name:Re(r.name),species:Re(r.species),breed:Re(r.breed),ageYears:rr(r.age_years),weightKg:rr(r.weight_kg)})}i(Si,"fromWire");function Ii(e){if(typeof e!="object"||e===null)return null;let t=e,r=Re(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Re(t.pet_id),petRef:r,name:Re(t.name),species:Re(t.species),breed:Re(t.breed),ageYears:rr(t.age_years),weightKg:rr(t.weight_kg),updatedAt:Re(t.updated_at)})}i(Ii,"widgetPetFromWire");function vc(e){let t=Ii(e);return t===null?null:Object.freeze({...t,...Ei(e)})}i(vc,"widgetPetProfileFromWire");function Cc(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];return Object.freeze(t.flatMap(r=>{let n=Ii(r);return n===null?[]:[n]}))}i(Cc,"petListFromWire");function nr(e){return Ec(Ue({auth:e}),Ue({auth:e,unaryTimeoutMs:hc}))}i(nr,"createPetsRepository");function Ec(e,t=e){let r=i((o,s)=>s?{...o,signal:s}:o,"withSignal"),n=i(o=>Ri(o,void 0)??`/widget/v1/pets/${encodeURIComponent(o)}`,"petPath");return {async list(o){let s=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},o?.signal));return s.ok?de(Cc(s.value)):V(s.error)},async registerPet(o,s,a){let d=Ri(o,s);if(d!==null)return V(d);let l=bc(s);if("error"in l)return V(l.error);let c={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(o)}`,body:l.body},p=await e.send("pets.registerPet",a?.signal?{...c,signal:a.signal}:c);return p.ok?de(Si(p.value,o)):V(p.error)},async updatePet(o,s,a){let d=n(o);if(typeof d!="string")return V(d);let l=gc(s);if("error"in l)return V(l.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:d,body:l.body},a?.signal));return u.ok?de(Si(u.value,o)):V(u.error)},async getPetProfile(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.getPetProfile",r({method:"GET",path:`${a}/profile`},s?.signal));if(!d.ok)return V(d.error);let l=vc(d.value);return l===null?V(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):de(l)},async deletePet(o,s){let a=n(o);if(typeof a!="string")return V(a);let d=await e.send("pets.deletePet",r({method:"DELETE",path:a},s?.signal));return d.ok?de(void 0):V(d.error)},async eraseUserData(o){let s=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},o?.signal),{maxAttempts:1});return s.ok?de(void 0):V(s.error)}}}i(Ec,"createPetsRepositoryOver");var Tc="pet_not_registered";function Fi(e){return e!=null&&e.reasonCode===Tc}i(Fi,"isPetNotRegistered");var Pc=Object.freeze({status:"idle",error:null,registered:null,retry:i(()=>{},"retry")});function Mi(e,t,r){let{runtime:n,userRef:o,scopeEpoch:s}=ie(),a=react.useCallback(()=>nr(n.registry.services.authFor(o)),[n,o,s]),d=react.useMemo(()=>t===void 0?null:tn(t),[t]),[l,u]=react.useState({key:null,status:"idle",error:null,registered:null}),c=react.useRef(0),p=react.useRef(r);p.current=r;let y=e===null||d===null?null:`${String(o)}|${s}|${e}|${d}`,b=react.useCallback(()=>{if(e===null||t===void 0||y===null)return;let w=++c.current;u({key:y,status:"registering",error:null,registered:null}),a().registerPet(e,t).then(E=>{w===c.current&&(E.ok?(u({key:y,status:"registered",error:null,registered:E.value}),p.current?.()):u({key:y,status:"failed",error:E.error,registered:null}));});},[a,e,y]);react.useEffect(()=>{if(y===null){c.current+=1;return}return b(),()=>{c.current+=1;}},[y,b]);let g=react.useCallback(()=>{l.status==="failed"&&b();},[l.status,b]);return react.useMemo(()=>y===null?Pc:l.key!==y?{status:"registering",error:null,registered:null,retry:g}:{status:l.status,error:l.error,registered:l.registered,retry:g},[y,l,g])}i(Mi,"useChatPetRegistration");function tn(e){return e===null||typeof e!="object"?JSON.stringify(e)??"undefined":Array.isArray(e)?`[${e.map(tn).join(",")}]`:`{${Object.entries(e).filter(([,r])=>r!==void 0).sort(([r],[n])=>r<n?-1:r>n?1:0).map(([r,n])=>`${JSON.stringify(r)}:${tn(n)}`).join(",")}}`}i(tn,"stableKey");var rn=Object.freeze({});function Di(e){let[t,r]=react.useState(rn),n=react.useRef(null),o=react.useRef([]);o.current=e.map(a=>a.id),react.useEffect(()=>{if(e.length===0){n.current=null,r(l=>l===rn?l:rn);return}let a=n.current;if(a===null)return;let d=e.find(l=>l.role==="user"&&!a.known.has(l.id));d!==void 0&&(n.current=null,r(l=>({...l,[d.id]:a.images})));},[e]);let s=react.useCallback(a=>{n.current=a.length===0?null:{images:a,known:new Set(o.current)};},[]);return react.useMemo(()=>({byMessage:t,stage:s}),[t,s])}i(Di,"useSentImages");var Ac=500;function nn(e){if(!e)return null;let t=e.replace(/[\u0000-\u001F\u007F-\u009F\u200E\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g," ").replace(/\s+/g," ").trim();return t?t.slice(0,Ac):null}i(nn,"sanitizeSeedPrompt");function Ni(e,t,r){let n=nn(r),o=react.useRef(e);o.current=e;let s=react.useRef(null);react.useEffect(()=>{if(n===null||t||s.current===n)return;let a=o.current;a!==void 0&&(s.current=n,Promise.resolve(a(n)).catch(()=>{}));},[n,t]);}i(Ni,"useInitialAsk");function Oc(e,t,r){if(e==="announced")return false;let n=r.lastRefresh;return n===null||n.conversationId!==t?false:r.now-n.at<15e3}i(Oc,"isCoalesced");function Hi(e,t){let r=t.activeConversationId;return r===null||r.length===0?{action:"skip",reason:"no_thread"}:t.isTurnInFlight?{action:"defer",reason:"turn_in_flight"}:t.isOffline?{action:"defer",reason:"offline"}:Oc(e,r,t)?{action:"skip",reason:"coalesced"}:{action:"refresh",conversationId:r}}i(Hi,"decideChatRefresh");function on(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}i(on,"reportHostFailure");function Fc(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}i(Fc,"isThenable");function W(e,...t){if(typeof e=="function")try{let r=e(...t);return Fc(r)&&Promise.resolve(r).then(void 0,on),r}catch(r){on(r);return}}i(W,"callHost");var Ui=new WeakMap;function zi(e){if(typeof e!="function")return;let t=Ui.get(e);if(t!==void 0)return t;let r=i((...n)=>{W(e,...n);},"guarded");return Ui.set(e,r),r}i(zi,"guardHost");function ot(e,...t){let r;try{r=e(...t);}catch(n){return on(n),Promise.resolve({ok:false,error:n})}return Promise.resolve(r).then(n=>({ok:true,value:n}),n=>({ok:false,error:n}))}i(ot,"callHostAsync");function ji(e,t){let r=react.useRef(t);r.current=t;let n=react.useRef(null),o=react.useRef(null),s=e?.isOffline===void 0?false:W(()=>e.isOffline?.()===!0)===true,a=react.useRef(()=>{});a.current=d=>{let{conversationId:l,isTurnInFlight:u,refresh:c}=r.current,p=Hi(d,{activeConversationId:l,isTurnInFlight:u,isOffline:s,lastRefresh:n.current,now:Date.now()});if(p.action!=="skip"){if(p.action==="defer"){o.current!=="announced"&&(o.current=d);return}o.current=null,n.current={conversationId:p.conversationId,at:Date.now()},c!==void 0&&Promise.resolve(c()).catch(()=>{});}},react.useEffect(()=>{if(t.isTurnInFlight||s)return;let d=o.current;d!==null&&a.current(d);},[t.isTurnInFlight,s]),react.useEffect(()=>{if(e===void 0)return;let d=[],l=i((u,c)=>{if(u===void 0)return;let p=W(()=>u(()=>{a.current(c);}));typeof p=="function"&&d.push(p);},"subscribe");return l(e.onForeground?.bind(e),"foreground"),l(e.onOnline?.bind(e),"foreground"),l(e.onAnnounced?.bind(e),"announced"),()=>{for(let u of d)W(u);}},[e]);}i(ji,"useChatLifecycle");function Lc(e){if(e===void 0)return null;let t=e.conversationId??"",r=e.petRef??"";return t===""&&r===""?null:`${String(t)}|${String(r)}`}i(Lc,"targetKey");function Gi(e,t){let r=Lc(t),n=react.useRef({openCheckin:e,target:t});n.current={openCheckin:e,target:t};let o=react.useRef(null);react.useEffect(()=>{if(r===null||o.current===r)return;o.current=r;let{openCheckin:s,target:a}=n.current;s===void 0||a===void 0||Promise.resolve(s(a)).catch(()=>{});},[r]);}i(Gi,"useCheckinTarget");function Ki(e,t,r){let[n,o]=react.useState({send:e,conversationId:t,text:r??"",seeded:r??null}),s=n.send===e&&(n.conversationId===null||n.conversationId===t);react.useEffect(()=>{o(d=>{let l=d.send===e&&(d.conversationId===null||d.conversationId===t),u=l?d.text:"",c=l?d.seeded:null,p=r!=null&&r!==c&&u.length===0;return {send:e,conversationId:t,text:p?r:u,seeded:p?r:c}});},[e,t,r]);let a=react.useCallback(d=>o(l=>({send:e,conversationId:t,text:d,seeded:l.seeded})),[e,t]);return [s?n.text:"",a]}i(Ki,"useChatDraft");function $i(e,t,r,n){let o=react.useRef({draft:r,setDraft:n});o.current={draft:r,setDraft:n};let s=react.useRef(null),[a,d]=react.useState(null);react.useEffect(()=>{if(e===void 0)return;let l=`${t??""}`;if(s.current===l)return;s.current=l;let u=true;return (async()=>{let c=await ot(()=>e.read(t));if(!u)return;let p=c.ok&&typeof c.value=="string"?c.value:"";p.length>0&&o.current.draft.length===0&&o.current.setDraft(p),d(l);})(),()=>{u=false;}},[e,t]),react.useEffect(()=>{e===void 0||a!==`${t??""}`||W(()=>e.write(t,r));},[e,t,r,a]);}i($i,"usePersistedDraft");var Y=Object.freeze({heading:"Chat History",empty:"No chats yet",emptyBody:"Start a new conversation to see it here.",noMatch:"No matching chats",noMatchBody:"Try a different title or start a new conversation.",loading:"Loading your chats\u2026",loadFailed:"Couldn\u2019t load your chats",loadingMore:"Loading more\u2026",untitled:"New conversation",newConversation:"New conversation",newChat:"New chat",search:"Search",retry:"Try again",retryA11y:"Retry loading chats",close:"Close",closeA11y:"Close history",more:"Load more",earlier:"Load earlier messages",loadingEarlier:"Loading earlier messages\u2026",openConversation:"Open conversation",unreadPrefix:"Unread. "});function ir(e){let t=e?.replace(/\s+/g," ").trim();return t||Y.untitled}i(ir,"conversationTitle");function Qi(e){return `${e.unreadCount!==null&&e.unreadCount>0?Y.unreadPrefix:""}${Y.openConversation} ${ir(e.title)}`}i(Qi,"openConversationLabel");function Xi(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').toLowerCase().trim().replace(/\s+/g," ")}i(Xi,"normalizeForSearch");function zc(e,t){let r=Xi(t);if(r.length===0)return e;let n=[[],[],[]];for(let o of e){let s=Xi(ir(o.title)),a=s.indexOf(r);if(a<0)continue;let d=a===0?0:s.charAt(a-1)===" "?1:2;n[d]?.push(o);}return n.flat()}i(zc,"filterConversations");function ln(e){return {scope:e,rows:[],cursor:null,loading:false,loadingMore:false,error:null}}i(ln,"fresh");function Zi(e){let[t,r]=react.useState(false),[n,o]=react.useState(""),s=e.listConversations,a=react.useRef(0),[d,l]=react.useState(()=>ln(s)),u=d.scope===s?d:ln(s);react.useEffect(()=>(a.current+=1,r(false),o(""),l(ln(s)),()=>{a.current+=1;}),[s]);let c=react.useCallback(async T=>{let I=++a.current,m=T!==void 0;l(O=>({...O,scope:s,loading:!m,loadingMore:m,error:null}));let R=await e.listConversations(T?{cursor:T}:void 0);if(I===a.current){if(!R.ok){l(O=>({...O,loading:false,loadingMore:false,error:R.error.displayMessage}));return}l(O=>{let F=T&&O.scope===s?O.rows:[],P=new Set(F.map(h=>h.id));return {scope:s,loading:false,loadingMore:false,error:null,rows:[...F,...R.value.conversations.filter(h=>!P.has(h.id))],cursor:R.value.nextCursor===T?null:R.value.nextCursor}});}},[e.listConversations,s]),p=i(()=>{r(true),o(""),c();},"show"),y=i(()=>{a.current+=1,r(false);},"close"),b=i(async T=>{let I=++a.current;l(R=>({...R,loading:true,error:null}));let m=await e.resumeConversation(T);I===a.current&&(l(R=>({...R,loading:false,error:m.ok?null:m.error.displayMessage})),m.ok&&r(false));},"resume"),g=i(async()=>{let T=a.current,I=await e.loadOlderMessages();T===a.current&&!I.ok&&l(m=>({...m,error:I.error.displayMessage}));},"earlier"),w=i(()=>{e.newConversation(),a.current+=1,r(false);},"newConversation"),E=i(()=>{u.cursor===null||u.loading||u.loadingMore||n.trim().length>0||c(u.cursor);},"loadMore"),S=react.useMemo(()=>zc(u.rows,n),[u.rows,n]),_=n.trim().length>0;return {...u,open:t,show:p,close:y,load:c,resume:b,earlier:g,newConversation:w,loadMore:E,query:n,setQuery:o,searching:_,filtered:S,emptyKind:u.rows.length===0?"empty":"noMatch"}}i(Zi,"useHistoryPanel");var sr="#111111",ar="#FFFFFF",Wc=Object.freeze({emergency:Object.freeze({level:"emergency",label:"Vet care now",borderColor:"#FCA5A5",backgroundColor:"#FEF2F2",textColor:"#991B1B",reasonColor:sr,pillColor:ar,showsVetAction:true}),schedule_soon:Object.freeze({level:"schedule_soon",label:"Vet care suggested soon",borderColor:"#FCD34D",backgroundColor:"#FFFBEB",textColor:"#92400E",reasonColor:sr,pillColor:ar,showsVetAction:true}),home_care:Object.freeze({level:"home_care",label:"Monitor at home",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:sr,pillColor:ar,showsVetAction:false}),general:Object.freeze({level:"general",label:"Good to know",borderColor:"#86EFAC",backgroundColor:"#F0FDF4",textColor:"#166534",reasonColor:sr,pillColor:ar,showsVetAction:false})});function Gc(e){return `${e.messageId}:${e.level}:${e.reason??""}`}i(Gc,"urgencySignature");function qc(e){return j(f.urgencyGeneralReason,{petName:e?.trim()||f.emptyTitlePetFallback})}i(qc,"generalUrgencyReason");function ts(e,t){for(let r=e.length-1;r>=0;r-=1){let n=e[r];if(n?.role!=="assistant"||n.responseId===void 0)continue;let o=n.urgencyLevel;return o?{messageId:n.id,level:o,reason:Yc(n.urgencyReason)}:n.urgencyProvided===true?{messageId:n.id,level:"general",reason:qc(t)}:null}return null}i(ts,"latestUrgencySource");function Yc(e){return typeof e=="string"&&e.trim().length>0?e:null}i(Yc,"shownReason");function rs(e){let t=e===null?null:Gc(e),[r,n]=react.useState(null),[o,s]=react.useState(false);react.useEffect(()=>s(false),[t]);let d=e!==null&&(o||!(r!==null&&r===t)),l=e===null?null:Wc[e.level],u=e!==null&&!d&&e.level!=="general",c=react.useCallback(()=>{t!==null&&n(t),s(false);},[t]),p=react.useCallback(()=>s(true),[]);return react.useMemo(()=>({source:e,tier:l,signature:t,showBanner:d,showCompactIcon:u,showVetAction:d&&l!==null&&l.showsVetAction,dismissLabel:l===null?null:j(f.dismissBanner,{label:l.label}),dismiss:c,expand:p}),[e,l,t,d,u,c,p])}i(rs,"useUrgencySurface");function ns(e){return e.isBootstrapping?"loading":e.status==="error"&&e.error&&e.messages.length===0?"error":e.messages.length===0?"empty":"populated"}i(ns,"selectView");function Kc(e){return e.code==="accessDenied"||e.code==="conversationNotFound"}i(Kc,"needsNewConversation");function os(e){if(e.messages.length===0)return null;let t=e.status==="error"?e.error:null;if(t!==null){let r=Kc(t);return {tone:"error",title:r?f.turnUnreachableTitle:f.turnFailedTitle,body:t.displayMessage,actionLabel:r?f.turnStartNewChat:f.turnRetry,action:r?"startNew":"retry"}}return e.stopped===true?{tone:"neutral",title:f.turnStoppedTitle,body:f.turnStoppedBody,actionLabel:f.turnRetry,action:"retry"}:null}i(os,"turnNotice");function is(e,t){let r=e[e.length-1];return t&&(r===void 0||r.role==="user")}i(is,"awaitingAssistant");function ss(e,t){let r={};return e!==void 0&&(r.petRef=e),t!==void 0&&(r.conversationId=t),r}i(ss,"buildChatOpts");var $c=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function C(e,t){let r=e.type,n=r.families[t];return t==="mono"||r.namedFaces[t]?{fontFamily:n}:{fontFamily:n,fontWeight:r.weight[$c[t]]}}i(C,"face");var un=class un extends react.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey};}static getDerivedStateFromError(){return {failed:true}}static getDerivedStateFromProps(r,n){return Object.is(r.resetKey,n.key)?null:{failed:false,key:r.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};i(un,"HostRenderBoundary");var dn=un;function Qc({render:e}){return e()}i(Qc,"RenderHost");function Be({render:e,fallback:t,resetKey:r}){return react.createElement(dn,{fallback:t,resetKey:r,children:react.createElement(Qc,{render:e})})}i(Be,"HostRender");var Zc=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 Jc(e){return Zc[e]}i(Jc,"requires");function ls(e,t,r){let n=Jc(e),o=new Map;for(let d of t)o.set(d.resource,d);if(r?.isPending===true&&n.some(d=>!o.has(d)))return cn({name:e,enabled:false,isPending:true,limits:{}});let s=ep(n,o);return n.filter(d=>o.get(d)?.granted!==true).length===0?cn({name:e,enabled:true,isPending:false,limits:s}):cn({name:e,enabled:false,isPending:false,limits:s,disabled:tp(n,o)})}i(ls,"decideCapability");function ep(e,t){let r={};for(let n of e){let o=t.get(n)?.limits;if(o)for(let[s,a]of Object.entries(o)){let d=r[s];r[s]=d===void 0?a:Math.min(d,a);}}return r}i(ep,"mergeLimits");function tp(e,t){for(let r of e){let n=t.get(r)?.disabled;if(n)return Object.freeze({reason:n.reason,level:n.level,recoverable:n.recoverable})}return Object.freeze({reason:Hr("accessDenied"),level:"user_entitlement",recoverable:false})}i(tp,"disabledFor");function cn(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(cn,"freezeDecision");function Rt(e){let{runtime:t}=ie(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>ls(e,n.decisions,{isPending:n.isPending}),[e,n])}i(Rt,"useCapability");var op=48;function ip(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}i(ip,"selectView");function ps(e){let{capability:t,children:r,renderDisabled:n,renderPending:o,style:s}=e,a=Rt(t),d=react.useMemo(()=>ip(a),[a]);switch(d){case "enabled":return r;case "pending":return o?jsxRuntime.jsx(Be,{render:o,fallback:jsxRuntime.jsx(us,{capability:t,style:s})}):jsxRuntime.jsx(us,{capability:t,style:s});case "disabled":return n?jsxRuntime.jsx(Be,{render:()=>n(a),fallback:jsxRuntime.jsx(cs,{decision:a,style:s}),resetKey:a}):jsxRuntime.jsx(cs,{decision:a,style:s});default:return Gt(d)}}i(ps,"CapabilityGate");function us({capability:e,style:t}){let r=A(),n=react.useMemo(()=>fs(r),[r]);return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${e}`,children:jsxRuntime.jsx(reactNative.View,{style:n.skeletonBar})})}i(us,"PendingSkeleton");function cs({decision:e,style:t}){let r=A(),n=react.useMemo(()=>fs(r),[r]),o=e.disabled?.reason??"";return jsxRuntime.jsx(reactNative.View,{style:[n.offstate,t],accessible:true,accessibilityRole:"text",accessibilityLabel:o,children:o.length>0?jsxRuntime.jsx(v,{style:n.offstateText,children:o}):null})}i(cs,"OffState");function fs(e){let{color:t,space:r,radius:n,type:o}=e;return reactNative.StyleSheet.create({offstate:{minHeight:op,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},offstateText:{...C(e,"regular"),fontSize:o.size.body,lineHeight:Math.round(o.size.body*o.lineHeight.normal),color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}})}i(fs,"makeStyles");var St=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 hs(e){let t=A(),r=react.useMemo(()=>lp(t),[t]);return jsxRuntime.jsxs(reactNative.View,{style:[r.container,e.style],accessible:true,accessibilityRole:"text",accessibilityLabel:`${St.title}. ${St.body}`,children:[jsxRuntime.jsx(v,{style:r.title,children:St.title}),jsxRuntime.jsx(v,{style:r.body,children:St.body})]})}i(hs,"ClinicalDisclaimer");function lp(e){let{color:t,space:r,type:n}=e;return reactNative.StyleSheet.create({container:{paddingHorizontal:r.lg,paddingVertical:r.md,borderTopWidth:reactNative.StyleSheet.hairlineWidth,borderTopColor:t.borderHairlineGreen,backgroundColor:t.surfaceCream,gap:r.xs},title:{...C(e,"bold"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.secondary,letterSpacing:n.letterSpacing.eyebrow},body:{...C(e,"regular"),fontSize:n.size.caption,lineHeight:Math.round(n.size.caption*n.lineHeight.snug),color:t.text.muted}})}i(lp,"makeStyles");var ee={pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"};function X(e){return {width:e,height:e,alignItems:"center",justifyContent:"center"}}i(X,"box");function re(e,t){return t??Math.max(1.5,Math.round(e/11*10)/10)}i(re,"stroke");function gs({size:e,color:t,strokeWidth:r}){let n=re(e,r),o={width:e*.82,height:n,borderRadius:n,backgroundColor:t};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{gap:e*.22}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o}),jsxRuntime.jsx(reactNative.View,{style:o})]})}i(gs,"MenuGlyph");function bs({size:e,color:t,strokeWidth:r,rotate:n}){let o=re(e,r),s=e*.78;return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:n}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:s,height:o,borderRadius:o,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:o,height:s,borderRadius:o,backgroundColor:t}})]})}i(bs,"Cross");function vs(e){return jsxRuntime.jsx(bs,{...e,rotate:"0deg"})}i(vs,"PlusGlyph");function je(e){return jsxRuntime.jsx(bs,{...e,rotate:"45deg"})}i(je,"CloseGlyph");function Le({size:e,color:t,strokeWidth:r}){let n=re(e,r);return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.36,height:e*.66,marginTop:-e*.14,borderBottomWidth:n,borderRightWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})})}i(Le,"CheckGlyph");var cp={down:{rotate:"45deg",marginTop:-0.4,marginLeft:0},up:{rotate:"225deg",marginTop:.4,marginLeft:0},right:{rotate:"-45deg",marginTop:0,marginLeft:-0.4}};function lr({size:e,color:t,strokeWidth:r,direction:n}){let o=re(e,r),s=e*.46,a=cp[n];return jsxRuntime.jsx(reactNative.View,{style:X(e),...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:s,height:s,borderRightWidth:o,borderBottomWidth:o,borderColor:t,marginTop:s*a.marginTop,marginLeft:s*a.marginLeft,transform:[{rotate:a.rotate}]}})})}i(lr,"ChevronGlyph");function Cs({size:e,color:t,strokeWidth:r}){let n=re(e,r),o={width:e*.42,height:e*.7,borderWidth:n,borderColor:t,borderRadius:n};return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{flexDirection:"row",gap:1}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopLeftRadius:e*.2}]}),jsxRuntime.jsx(reactNative.View,{style:[o,{borderTopRightRadius:e*.2}]})]})}i(Cs,"BookGlyph");function Es({size:e,color:t,strokeWidth:r}){let n=re(e,r),o=e*.5;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.78,height:n,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,right:e*.16,width:o,height:o,borderTopWidth:n,borderRightWidth:n,borderColor:t}})]})}i(Es,"ArrowUpRightGlyph");function Rs({size:e,color:t,strokeWidth:r}){let n=re(e,r),o=e*.6,s={position:"absolute",width:o,height:o,borderWidth:n,borderColor:t,borderRadius:e*.14};return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:[s,{top:0,left:0}]}),jsxRuntime.jsx(reactNative.View,{style:[s,{bottom:0,right:0}]})]})}i(Rs,"CopyGlyph");function dr({size:e,color:t,strokeWidth:r,active:n,rotate:o}){let s=re(e,r),a=n?t:"transparent";return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{transform:[{rotate:o}]}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:e*.12,width:e*.62,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.12,borderTopLeftRadius:e*.04}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.04,left:e*.4,width:e*.3,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.15,transform:[{rotate:"-20deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.08,left:0,width:e*.2,height:e*.5,borderWidth:s,borderColor:t,backgroundColor:a,borderRadius:e*.05}})]})}i(dr,"ThumbGlyph");function Ss({size:e,color:t,strokeWidth:r}){let n=re(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:n,borderColor:t}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{width:n,height:n,borderRadius:n,backgroundColor:t,marginBottom:e*.1}}),jsxRuntime.jsx(reactNative.View,{style:{width:n,height:e*.34,borderRadius:n,backgroundColor:t}})]})}i(Ss,"InfoGlyph");function Ts({size:e,color:t,strokeWidth:r}){let n=re(e,r),o=e*.34;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.06,width:o,height:o,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.1,width:n,height:e*.56,borderRadius:n,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,width:e*.84,height:e*.3,borderBottomWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderBottomLeftRadius:n,borderBottomRightRadius:n}})]})}i(Ts,"UploadGlyph");function Ps({size:e,color:t,strokeWidth:r}){let n=re(e,r);return jsxRuntime.jsxs(reactNative.View,{style:[X(e),{borderWidth:n,borderColor:t,borderRadius:e*.14,overflow:"hidden"}],...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.16,left:e*.18,width:e*.16,height:e*.16,borderRadius:e,backgroundColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:-e*.3,right:-e*.1,width:e*.7,height:e*.7,borderTopWidth:n,borderLeftWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(Ps,"PhotoGlyph");function ws({size:e,color:t,strokeWidth:r}){let n=re(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.08,width:e*.34,height:e*.2,borderTopWidth:n,borderLeftWidth:n,borderRightWidth:n,borderColor:t,borderTopLeftRadius:n,borderTopRightRadius:n}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:e*.22,width:e*.92,height:e*.66,borderWidth:n,borderColor:t,borderRadius:e*.16,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.3,height:e*.3,borderRadius:e,borderWidth:n,borderColor:t}})})]})}i(ws,"CameraGlyph");function ks({size:e,color:t,strokeWidth:r}){let n=re(e,r),o=e*.66;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,left:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.02,right:e*.02,width:n,height:e*.4,borderRadius:n,backgroundColor:t,transform:[{rotate:"-45deg"}]}})]})}i(ks,"SearchGlyph");function xs({size:e,color:t,strokeWidth:r}){let n=re(e,r);return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",width:e*.3,height:e*.82,borderWidth:n,borderColor:t,borderRadius:n,transform:[{rotate:"45deg"}]}}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:0,left:0,width:e*.4,height:n,borderRadius:n,backgroundColor:t}})]})}i(xs,"EditGlyph");function _s({size:e,color:t,strokeWidth:r}){let n=re(e,r),o=e*.62;return jsxRuntime.jsxs(reactNative.View,{style:X(e),...ee,children:[jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",top:0,width:o,height:o,borderRadius:o,borderWidth:n,borderColor:t,alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx(reactNative.View,{style:{width:n*1.4,height:n*1.4,borderRadius:n,backgroundColor:t}})}),jsxRuntime.jsx(reactNative.View,{style:{position:"absolute",bottom:e*.04,width:o*.5,height:o*.5,borderRightWidth:n,borderBottomWidth:n,borderColor:t,transform:[{rotate:"45deg"}]}})]})}i(_s,"MapPinGlyph");function Is({size:e,color:t,testID:r}){let n=e*.36;return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:0,height:0,marginLeft:e*.12,borderLeftWidth:e*.78,borderTopWidth:n,borderBottomWidth:n,borderLeftColor:t,borderTopColor:"transparent",borderBottomColor:"transparent",transform:[{rotate:"-45deg"}]}})})}i(Is,"SendGlyph");function As({size:e,color:t,testID:r}){return jsxRuntime.jsx(reactNative.View,{style:X(e),testID:r,...ee,children:jsxRuntime.jsx(reactNative.View,{style:{width:e*.5,height:e*.5,backgroundColor:t}})})}i(As,"StopGlyph");function ur({size:e,strokeWidth:t,color:r,children:n}){return jsxRuntime.jsx(reactNative.View,{style:[X(e),{borderRadius:e/2,borderWidth:t??reactNative.StyleSheet.hairlineWidth,borderColor:r}],children:n})}i(ur,"Ring");var Tt=Object.freeze({standard:He.standard,emphasized:He.emphasized,exit:He.exit,outQuad:Object.freeze([.25,.46,.45,.94])});var Os=Object.freeze({layoutMs:220,messageInMs:200,bannerInMs:220,bannerOutMs:160,iconInMs:180,iconOutMs:120,followUpInMs:180,followUpStaggerMs:70,citationsInMs:220,citationsRisePx:6,drawerMs:220,pressScale:.97,pressMs:140,revealTickMs:24,revealDivisor:12,dotsCycleMs:520,dotsMinOpacity:.44,dotsLiftPx:3.5,dotsStagger:Object.freeze([0,.18,.36]),copiedMs:1500,uploadFlashMs:600,reduced:false}),pp=Object.freeze({...Os,layoutMs:0,messageInMs:0,bannerInMs:0,bannerOutMs:0,iconInMs:0,iconOutMs:0,followUpInMs:0,followUpStaggerMs:0,citationsInMs:0,citationsRisePx:0,drawerMs:0,pressScale:1,pressMs:0,revealTickMs:0,dotsCycleMs:0,dotsMinOpacity:1,dotsLiftPx:0,reduced:true});function Fs(e){return e.motion.reducedMotion?pp:Os}i(Fs,"chatMotion");function cr(e,t){return Math.max(0,t)*e.followUpStaggerMs}i(cr,"followUpDelayMs");function Ms(e,t,r){if(e.reduced||t>=r)return r;let n=Math.max(1,Math.ceil((r-t)/e.revealDivisor));return Math.min(r,t+n)}i(Ms,"nextRevealLength");function G(){let e=A();return Fs(e)}i(G,"useChatMotion");var bp=8;function Ds(e,t,r){return ((1-3*r+3*t)*e+(3*r-6*t))*e*e+3*t*e}i(Ds,"bezierComponent");function vp(e,t,r){return 3*(1-3*r+3*t)*e*e+2*(3*r-6*t)*e+3*t}i(vp,"bezierSlope");function pr(e){let[t,r,n,o]=e;return s=>{if(s<=0)return 0;if(s>=1)return 1;let a=s;for(let d=0;d<bp;d+=1){let l=vp(a,t,n);if(l===0)break;a-=(Ds(a,t,n)-s)/l;}return Ds(Math.min(1,Math.max(0,a)),r,o)}}i(pr,"bezierEasing");var yn=pr(Tt.standard),Cp=pr(Tt.outQuad);function bn(e){let t=react.useRef(null);return t.current===null&&(t.current=new reactNative.Animated.Value(e)),t.current}i(bn,"useAnimatedValue");function We(e,t={}){let r=t.risePx??0,n=t.delayMs??0,o=bn(e>0?0:1);return react.useEffect(()=>{if(e<=0)return;let s=reactNative.Animated.timing(o,{toValue:1,duration:e,easing:Cp,useNativeDriver:true}),a=n>0?reactNative.Animated.sequence([reactNative.Animated.delay(n),s]):s;return a.start(),()=>a.stop()},[o,e,n]),react.useMemo(()=>({opacity:o,transform:[{translateY:o.interpolate({inputRange:[0,1],outputRange:[r,0]})}]}),[o,r])}i(We,"useFadeIn");function vn({visible:e,inMs:t,outMs:r,style:n,children:o}){let[s,a]=react.useState(e),d=bn(e&&t<=0?1:0);return react.useEffect(()=>{if(e){a(true);let u=reactNative.Animated.timing(d,{toValue:1,duration:Math.max(0,t),easing:yn,useNativeDriver:true});return u.start(),()=>u.stop()}if(!s)return;if(r<=0){a(false);return}let l=reactNative.Animated.timing(d,{toValue:0,duration:r,easing:yn,useNativeDriver:true});return l.start(({finished:u})=>{u&&a(false);}),()=>l.stop()},[e,s,t,r,d]),!s&&!e?null:jsxRuntime.jsx(reactNative.Animated.View,{style:[n,{opacity:d}],children:o})}i(vn,"FadePresence");var Ep=12;function N({style:e,containerStyle:t,children:r,onPressIn:n,onPressOut:o,hitSlop:s,...a}){let d=G(),l=bn(1),u=react.useCallback(c=>{d.pressMs<=0||d.pressScale===1||reactNative.Animated.timing(l,{toValue:c,duration:d.pressMs,easing:yn,useNativeDriver:true}).start();},[l,d.pressMs,d.pressScale]);return jsxRuntime.jsx(reactNative.Pressable,{...a,hitSlop:s??Ep,style:t,onPressIn:c=>{u(d.pressScale),n?.(c);},onPressOut:c=>{u(1),o?.(c);},children:jsxRuntime.jsx(reactNative.Animated.View,{style:[e,{transform:[{scale:l}]}],children:r})})}i(N,"PressScale");function Hs(e,t,r){let n=t&&r.revealTickMs>0,[o,s]=react.useState(0),a=react.useRef(e);return a.current=e,react.useEffect(()=>{if(!n)return;let d=setInterval(()=>{s(l=>Ms(r,l,a.current.length));},r.revealTickMs);return ()=>clearInterval(d)},[n,r]),n?e.slice(0,Math.min(o,e.length)):e}i(Hs,"useRevealedText");var Vs=false;function Rp(e){e.layoutMs<=0||(Vs||(Vs=true,reactNative.Platform.OS==="android"&&typeof reactNative.UIManager.setLayoutAnimationEnabledExperimental=="function"&&reactNative.UIManager.setLayoutAnimationEnabledExperimental(true)),reactNative.LayoutAnimation.configureNext({duration:e.layoutMs,create:{type:"easeInEaseOut",property:"opacity"},update:{type:"easeInEaseOut"},delete:{type:"easeInEaseOut",property:"opacity"}}));}i(Rp,"animateLayout");function Pt(e,t){let r=react.useRef(e);r.current!==e&&(r.current=e,Rp(t));}i(Pt,"useAnimateLayoutOn");var Cn=36,_p=22,Ip=12,Ap=12,Op=16,Fp="#000",Mp="rgba(0,0,0,0.45)";function Us({uri:e,label:t,onClose:r}){let n=A(),o=reactNativeSafeAreaContext.useSafeAreaInsets();return e===null?null:jsxRuntime.jsxs(reactNative.Modal,{visible:true,animationType:n.motion.reducedMotion?"none":"fade",transparent:false,statusBarTranslucent:true,onRequestClose:r,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.closePreview,style:fr.backdrop,onPress:r,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:fr.image,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,accessibilityIgnoresInvertColors:true})}),jsxRuntime.jsx(reactNative.View,{pointerEvents:"box-none",style:[fr.closeWrap,{top:o.top+Ap}],children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.closePreview,hitSlop:Ip,style:fr.closeButton,onPress:r,children:jsxRuntime.jsx(je,{size:_p,color:n.color.surface,strokeWidth:2})})})]})}i(Us,"AttachmentImageLightbox");var fr=reactNative.StyleSheet.create({backdrop:{flex:1,backgroundColor:Fp,alignItems:"center",justifyContent:"center"},image:{width:"100%",height:"100%"},closeWrap:{position:"absolute",right:Op},closeButton:{width:Cn,height:Cn,borderRadius:Cn/2,backgroundColor:Mp,alignItems:"center",justifyContent:"center"}});var yr=12,Hp=80,En=44,zs=22,Up=.14,zp=18,Bp=8,Bs=Object.freeze({photo:f.attachmentPhoto,camera:f.attachmentCamera});function js({sources:e,full:t,onPick:r,onClose:n}){let o=A(),s=react.useMemo(()=>jp(o),[o]);return jsxRuntime.jsxs(reactNative.View,{style:s.anchor,pointerEvents:"box-none",children:[jsxRuntime.jsx(reactNative.Pressable,{style:s.dismissLayer,accessibilityRole:"button",accessibilityLabel:f.closeAttachmentPicker,onPress:n}),jsxRuntime.jsxs(reactNative.View,{style:s.bubble,children:[jsxRuntime.jsx(reactNative.View,{style:s.tilesRow,children:e.map(a=>jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:Bs[a],accessibilityState:{disabled:t},disabled:t,containerStyle:s.tile,style:s.tileInner,onPress:()=>r(a),children:[jsxRuntime.jsx(reactNative.View,{style:s.tileIconWrap,children:a==="photo"?jsxRuntime.jsx(Ps,{size:zs,color:o.color.brandInk,strokeWidth:1.5}):jsxRuntime.jsx(ws,{size:zs,color:o.color.brandInk,strokeWidth:1.5})}),jsxRuntime.jsx(v,{tier:"control",style:s.tileLabel,children:Bs[a]})]},a))}),jsxRuntime.jsx(reactNative.View,{style:s.tail}),jsxRuntime.jsx(reactNative.View,{style:s.tailFill})]})]})}i(js,"AttachmentPickerPopover");function jp(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({anchor:{position:"absolute",left:0,right:0,bottom:"100%",paddingHorizontal:8,paddingBottom:10,alignItems:"flex-start"},dismissLayer:{position:"absolute",left:-1e3,right:-1e3,top:-2e3,bottom:0},bubble:{backgroundColor:t.surfaceCream,borderRadius:r.lg,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:6,paddingVertical:8,shadowColor:t.shadow,shadowOpacity:Up,shadowRadius:zp,shadowOffset:{width:0,height:Bp},elevation:8},tilesRow:{flexDirection:"row",alignItems:"stretch"},tile:{minWidth:Hp,borderRadius:r.md},tileInner:{flex:1,alignItems:"center",justifyContent:"center",paddingHorizontal:10,paddingVertical:8,gap:6},tileIconWrap:{width:En,height:En,borderRadius:En/2,backgroundColor:t.brandSoft,alignItems:"center",justifyContent:"center"},tileLabel:{...C(e,"medium"),fontSize:12,lineHeight:14,color:t.text.primary},tail:{position:"absolute",left:24,bottom:-yr/2,width:yr,height:yr,backgroundColor:t.surfaceCream,borderRightWidth:1,borderBottomWidth:1,borderColor:t.brandBorderStrong,transform:[{rotate:"45deg"}]},tailFill:{position:"absolute",left:22,bottom:0,width:yr+4,height:2,backgroundColor:t.surfaceCream}})}i(jp,"makeStyles");function Wp(e){if(typeof e=="number")return Ws(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return Sn(t.slice(1));if(t.toLowerCase().startsWith("0x"))return Sn(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return Gp(t);if(/^[0-9a-fA-F]+$/.test(t)){let r=Sn(t);if(r!==null)return r}return /^\d+$/.test(t)?Ws(Number.parseInt(t,10)):null}i(Wp,"toRgba");function Sn(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return {r:Tn(t[0]),g:Tn(t[1]),b:Tn(t[2]),a:1};if(t.length===6)return {r:Ge(t,0),g:Ge(t,2),b:Ge(t,4),a:1};if(t.length===8){let r=Ge(t,0);return {r:Ge(t,2),g:Ge(t,4),b:Ge(t,6),a:r/255}}return null}i(Sn,"fromHex");function Gp(e){let t=e.indexOf("("),r=e.indexOf(")");if(t<0||r<0||r<t)return null;let n=e.slice(t+1,r).split(",").map(l=>l.trim());if(n.length<3)return null;let o=Pn(Number(n[0])),s=Pn(Number(n[1])),a=Pn(Number(n[2]));if(o===null||s===null||a===null)return null;let d=1;if(n.length>=4){let l=Number(n[3]);if(!Number.isFinite(l))return null;d=Math.min(1,Math.max(0,l));}return {r:o,g:s,b:a,a:d}}i(Gp,"fromRgbFunc");function Ws(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,r=t>>>24&255;return {r:t>>>16&255,g:t>>>8&255,b:t&255,a:r===0?1:r/255}}i(Ws,"argbIntToRgba");function Ge(e,t){return Number.parseInt(e.slice(t,t+2),16)}i(Ge,"byte");function Tn(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}i(Tn,"dup");function Pn(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}i(Pn,"clampByte");function Gs(e,t){let r=Wp(e);if(r===null)return null;let n=Math.min(1,Math.max(0,t));return `rgba(${r.r}, ${r.g}, ${r.b}, ${n})`}i(Gs,"withAlpha");var ye=Object.freeze({position:"absolute",top:0,right:0,bottom:0,left:0});var Ys=56,Ks=12,Kp=14,$p=10,Xp=.45,Qp="rgba(7,193,104,0.55)",Zp="rgba(185,28,28,0.55)",Jp=200,ef=300,ra=20,wn=22,tf=12,rf="rgba(0,0,0,0.78)",$s=220,Xs=100,Qs="rgba(255,255,255,0.15)";function na({attachments:e,rejected:t,uploadFailed:r=false,onRetry:n,onRemove:o,onPreview:s}){let a=A(),d=react.useMemo(()=>ia(a),[a]);return e.length===0&&t===null?null:jsxRuntime.jsxs(reactNative.View,{style:d.strip,children:[e.length>0?jsxRuntime.jsx(reactNative.View,{style:d.cards,children:e.map(l=>jsxRuntime.jsx(nf,{row:l,styles:d,onRetry:n,onRemove:o,onPreview:s},l.id))}):null,r?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:f.attachmentsFailedBlocked}):null,t!==null?jsxRuntime.jsx(v,{style:d.rejected,accessibilityRole:"alert",children:ii(t)}):null]})}i(na,"AttachmentStrip");function nf({row:e,styles:t,onRetry:r,onRemove:n,onPreview:o}){let s=A(),a=e.status==="uploading",d=e.status==="failed",l=e.status==="uploaded",u=react.useRef(e.status),[c,p]=react.useState(false);return react.useEffect(()=>{let y=u.current;u.current=e.status,e.status==="uploaded"&&y==="uploading"&&p(true);},[e.status]),jsxRuntime.jsxs(reactNative.View,{style:t.card,children:[jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:l?"button":"image",accessibilityLabel:l?j(f.previewAttachment,{filename:e.filename}):e.filename,accessibilityState:{busy:a,disabled:!l},disabled:!l,style:t.thumbHit,onPress:()=>o(e),children:jsxRuntime.jsxs(reactNative.View,{style:t.thumb,children:[jsxRuntime.jsx(reactNative.Image,{source:{uri:e.previewUri},style:t.thumbImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true}),a?jsxRuntime.jsx(reactNative.View,{style:t.uploadingOverlay,children:jsxRuntime.jsx(reactNative.ActivityIndicator,{size:"small",color:s.color.surface})}):null,c?jsxRuntime.jsx(of,{styles:t,onDone:()=>p(false)}):null]})}),d?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.retryUpload,{filename:e.filename}),style:t.failedOverlay,onPress:()=>r(e.id),children:jsxRuntime.jsx(reactNative.View,{style:t.failedInner,children:jsxRuntime.jsx(je,{size:ra,color:s.color.surface,strokeWidth:2})})}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:j(f.removeAttachment,{filename:e.filename}),hitSlop:6,containerStyle:t.removeSlot,style:t.removeButton,onPress:()=>n(e.id),children:jsxRuntime.jsx(je,{size:tf,color:s.color.surface,strokeWidth:1.5})})]})}i(nf,"PreviewCard");function of({styles:e,onDone:t}){let r=A(),n=G(),o=react.useRef(null);o.current===null&&(o.current=new reactNative.Animated.Value(0));let s=o.current;return react.useEffect(()=>{let a=reactNative.Animated.sequence([reactNative.Animated.timing(s,{toValue:1,duration:Jp,useNativeDriver:true}),reactNative.Animated.delay(n.uploadFlashMs),reactNative.Animated.timing(s,{toValue:0,duration:ef,useNativeDriver:true})]);return a.start(({finished:d})=>{d&&t();}),()=>a.stop()},[s,n.uploadFlashMs,t]),jsxRuntime.jsx(reactNative.Animated.View,{pointerEvents:"none",style:[e.successOverlay,{opacity:s}],children:jsxRuntime.jsx(Le,{size:ra,color:r.color.surface,strokeWidth:2})})}i(of,"SuccessFlash");function oa({images:e,onPreview:t}){let r=A(),n=react.useMemo(()=>ia(r),[r]);if(e.length===0)return null;let o=e.length===1;return jsxRuntime.jsx(reactNative.View,{style:o?n.sentSingle:n.sentGrid,children:e.map((s,a)=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:j(f.attachedImage,{filename:s.filename}),onPress:()=>t(s),children:jsxRuntime.jsx(reactNative.Image,{source:{uri:s.uri},style:o?n.singleImage:n.gridImage,resizeMode:"cover",accessibilityIgnoresInvertColors:true})},`${s.uri}-${a}`))})}i(oa,"SentImages");function ia(e){let t=e.color,r=e.type;return reactNative.StyleSheet.create({strip:{gap:6,paddingBottom:8},cards:{flexDirection:"row",flexWrap:"wrap",gap:8},card:{width:Ys,height:Ys,overflow:"visible"},thumbHit:{width:"100%",height:"100%"},thumb:{width:"100%",height:"100%",borderRadius:Ks,overflow:"hidden",backgroundColor:t.composerFill,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},thumbImage:{width:"100%",height:"100%"},uploadingOverlay:{...ye,alignItems:"center",justifyContent:"center",backgroundColor:Gs(e.color.brandInk,Xp)??e.color.brandSofter},successOverlay:{...ye,alignItems:"center",justifyContent:"center",backgroundColor:Qp},failedOverlay:{...ye,borderRadius:Ks,overflow:"hidden"},failedInner:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:Zp},removeSlot:{position:"absolute",top:4,right:4},removeButton:{width:wn,height:wn,borderRadius:wn/2,backgroundColor:rf,borderWidth:1.5,borderColor:t.surface,alignItems:"center",justifyContent:"center"},rejected:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},sentSingle:{marginBottom:6},sentGrid:{flexDirection:"row",flexWrap:"wrap",gap:6,marginBottom:6},singleImage:{width:$s,height:$s,borderRadius:Kp,backgroundColor:Qs},gridImage:{width:Xs,height:Xs,borderRadius:$p,backgroundColor:Qs}})}i(ia,"makeStyles");var sf="file",_n="multipart upload failed";function sa(e){let t;try{t=new FormData;for(let[r,n]of Object.entries(e.fields))t.append(r,n);t.append(sf,e.file);}catch{return Promise.reject(new Error(_n))}return e.fetch!==void 0?df(e.fetch,e.url,t,e.signal):lf(e.url,t,e.signal)}i(sa,"postRnMultipart");function af(e){return e>=200&&e<300}i(af,"stored");function lf(e,t,r){return new Promise((n,o)=>{let s=globalThis.XMLHttpRequest;if(typeof s!="function"||r?.aborted===true){o(new Error(_n));return}let a=null,d=i(()=>{a!==null&&r?.removeEventListener("abort",a);},"release"),l=i(()=>{d(),o(new Error(_n));},"fail");try{let u=new s;u.open("POST",e),u.withCredentials=!1,u.onload=()=>{d(),n(af(u.status));},u.onerror=l,u.ontimeout=l,u.onabort=l,r!==void 0&&(a=i(()=>{try{u.abort();}finally{l();}},"onAbort"),r.addEventListener("abort",a,{once:!0})),u.send(t);}catch{l();}})}i(lf,"postWithXhr");function df(e,t,r,n){return Promise.resolve().then(()=>e(t,{method:"POST",body:r,credentials:"omit",...n?{signal:n}:{}})).then(o=>o.ok)}i(df,"postWithFetch");var uf="chat attachment upload: the file handle has no uri",cf="chat attachment upload failed";function pf(e){return {uri:e.uri,name:Kr(e.name),type:e.mimeType}}i(pf,"filePartOf");function In(e={}){return Object.freeze({postMultipart(t,r,n){if(typeof r.uri!="string"||r.uri.length===0)return Promise.reject(new Error(uf));let{signal:o,onProgress:s}=n,a=i(()=>Promise.reject(new Error(cf)),"failed");return o?.aborted===true?a():sa({url:t.upload_url,fields:t.upload_fields,file:pf(r),signal:o,fetch:e.fetch}).then(d=>{if(!d)return a();s?.(1);},a)}})}i(In,"createRnChatAttachmentTransport");function On(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=ie(),o=react.useMemo(()=>nr(e.registry.services.authFor(t)),[e,t,n]),[s,a]=react.useState({repository:o,pets:[],loading:true,error:null}),d=s.repository===o?s:{pets:[],loading:true,error:null},l=react.useRef(0),u=react.useCallback(async()=>{let p=++l.current;a(b=>({...b,repository:o,loading:true,error:null,pets:b.repository===o?b.pets:[]}));let y=await o.list();p===l.current&&a(y.ok?{repository:o,pets:y.value,loading:false,error:null}:b=>({repository:o,pets:b.repository===o?b.pets:[],loading:false,error:y.error}));},[o]);react.useEffect(()=>(u(),()=>{l.current+=1;}),[u]);let c=react.useMemo(()=>r===null?null:d.pets.find(p=>p.petRef===r)??null,[r,d.pets]);return react.useMemo(()=>({pets:d.pets,activePet:c,loading:d.loading,error:d.error,refresh:u}),[d.pets,d.loading,d.error,c,u])}i(On,"useEverfurPets");function aa(e,t){if(t!==null){let r=e.find(n=>n.petRef===t);if(r!==void 0)return r}return e[0]??null}i(aa,"headerPetOf");function ne(e,t){if(e===void 0)return {};let r={};return e.backgroundColor!==void 0&&(r.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(r.borderColor=e.borderColor,r.borderWidth=t??1),e.borderRadius!==void 0&&(r.borderRadius=e.borderRadius),r}i(ne,"slotBox");function Fn(e){return e===void 0||e.backgroundColor!==void 0?e:e.borderRadius===void 0?void 0:{borderRadius:e.borderRadius}}i(Fn,"ownGroundSlot");function ve(e){return e?.textColor===void 0?{}:{color:e.textColor}}i(ve,"slotText");var la=Object.freeze({visitButton:"Talk to a vet"});var da=Symbol.for("@everfur/sdk/televet");function xe(){let e=globalThis,t=e[da];if(t!==void 0)return t;let r={presenter:null,snapshot:Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:new Set,dailyRegistered:false};return e[da]=r,r}i(xe,"televetGlobal");function mr(e){let t=xe();t.snapshot=Object.freeze({...t.snapshot,...e});for(let r of [...t.listeners])try{r();}catch{}}i(mr,"publish");function ua(e){let t=xe().presenter;if(t===null)return "absent";try{return t(e)===!1?"declined":"presented"}catch(r){return console.warn("[everfur] Your registerEverfurTelevetFlow presenter threw; the in-app visit opened instead.",r),"threw"}}i(ua,"callTelevetPresenter");function ca(e){let t=xe();return t.listeners.add(e),()=>{t.listeners.delete(e);}}i(ca,"subscribeTelevetExperience");function Mn(){return xe().snapshot}i(Mn,"televetExperienceSnapshot");function gf(){return xe().hosts.length>0}i(gf,"hasTelevetHost");function pa(e){if(!gf())return false;let t=Object.freeze({...e});return mr({request:t,serial:xe().snapshot.serial+1}),true}i(pa,"presentTelevetExperience");function Ln(){xe().snapshot.request!==null&&mr({request:null});}i(Ln,"dismissTelevetExperience");function fa(){let e=xe(),t=e.nextHost;return e.nextHost+=1,e.hosts=[...e.hosts,t],mr({activeHost:e.hosts[0]??null}),t}i(fa,"claimTelevetHost");function ya(e){let t=xe();t.hosts=t.hosts.filter(n=>n!==e);let r=t.hosts[0]??null;mr(r===null?{activeHost:r,request:null}:{activeHost:r});}i(ya,"releaseTelevetHost");var ma=false;function hr(e,t){return t!==void 0?(W(t,e),"onStartInApp"):ua(e)==="presented"?"presenter":pa(e)?"experience":(ma||(ma=true,console.warn("[everfur] A vet visit had nowhere to open: mount <EverfurTelevetHost /> in your EverfurProvider, or pass prefer: 'redirect'.")),null)}i(hr,"openVetVisitInApp");function ba(e){let t=null;return ()=>{if(t!==null)return t;let r=e();return t=r,r.then(void 0,()=>{t===r&&(t=null);}),r}}i(ba,"memoizeTelevetLoader");function va(e){let[t,r]=react.useState(null);react.useEffect(()=>{let u=fa();return r(u),()=>{ya(u);}},[]);let n=react.useSyncExternalStore(ca,Mn,Mn),s=t!==null&&n.activeHost===t?n.request:null,[a,d]=react.useState(null),l=s!==null&&a===null;return react.useEffect(()=>{if(!l)return;let u=true;return e().then(c=>{u&&d(()=>c);},c=>{u&&(console.warn("[everfur] The in-app vet visit could not load its screens.",c),Ln());}),()=>{u=false;}},[l,e]),s===null||a===null?null:{module:a,request:s,serial:n.serial,dismiss:Ln}}i(va,"useTelevetExperienceHost");var vf=ba(()=>import('@everfur/sdk/televet/booking'));function kt(){let e=va(vf);if(e===null)return null;let{EverfurTelevetModal:t}=e.module;return jsxRuntime.jsx(t,{request:e.request,onClose:e.dismiss},e.serial)}i(kt,"EverfurTelevetHost");var Dn=Object.freeze(["visit","join","summary","messages"]);function Vn(e){return typeof e=="string"&&Dn.includes(e)}i(Vn,"isVetVisitIntent");var Ef="/widget/v1/televet/handoffs",Rf="/widget/v1/televet/availability",Sf="/widget/v1/televet/chat-entry",Tf=/^[a-z0-9][a-z0-9_-]{0,39}$/,Pf=/^[A-Za-z0-9_-]{22}$/;var Ca=32,Ea=128,Ra=64;function Hn(e){let t=e.httpStatus;switch(e.code){case "sessionRequired":return "sessionRequired";case "authExpired":case "authRejected":return "authRejected";case "sdkUpdateRequired":return "sdkUpdateRequired";case "validationFailed":return "invalidRequest";case "rateLimited":case "quotaExceeded":return "rateLimited";}return t===void 0?e.code==="internalError"?"network":"unknown":t===429?"rateLimited":t===404?"unavailable":t===403?"accessDenied":t===401?"authRejected":t===400||t===422?"invalidRequest":t>=500?"serverError":"unknown"}i(Hn,"vetVisitErrorReasonOf");function Sa(e){return V(q("validationFailed",{retryable:false,wireMessage:e}))}i(Sa,"invalid");function Nn(e){return V(q("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}i(Nn,"unusable");function wf(e,t){let r={};e!==void 0&&(r.pet_ref=e);let n=t?.returnTo;if(n!=null){if(typeof n!="string"||!Tf.test(n))return {ok:false,message:"returnTo must be a registered return destination key"};r.return_to=n;}let o=t?.entry;if(o!=null){if(o!=="chat"||e===void 0)return {ok:false,message:"entry 'chat' needs the pet the chat is about"};r.entry=o;}let s=t?.visitRef,a=t?.intent,d=s!=null;if(d){let l=typeof s=="string"?s.trim():"";if(l.length<1||[...l].length>Ra)return {ok:false,message:`visitRef must be 1..${Ra} characters`};r.visit_ref=l;}if(a!=null){if(!d)return {ok:false,message:"intent needs the visitRef it opens"};if(!Vn(a))return {ok:false,message:`intent must be one of ${Dn.join(", ")}`};r.intent=a;}return {ok:true,body:r}}i(wf,"handoffBody");function kf(e){if(typeof e!="object"||e===null)return null;let{visit_ref:t,intent:r}=e;return typeof t!="string"||t.length===0||!Vn(r)?null:Object.freeze({visitRef:t,intent:r})}i(kf,"parseVisitEcho");function Pa(e){let t=e.funnel??Ue({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry,n=i(o=>(Ta(r,"televet.visit.handoff_failed",{reason:Hn(o)}),V(o)),"failed");return {async createHandoff(o,s){let a;if(o!=null){let E=typeof o=="string"?[...o].length:0;if(E<1||E>Ea)return n(q("validationFailed",{retryable:false,wireMessage:`pet_ref must be 1..${Ea} characters`}));a=o;}let d=wf(a,s);if(!d.ok){let E=Sa(d.message);return E.ok?E:n(E.error)}let l=d.body,u=await t.send("televet.visit.handoff",{method:"POST",path:Ef,body:l},{idempotent:false,maxAttempts:1});if(!u.ok)return n(u.error);let c=xf(u.value),p=l.return_to!==void 0,y=p?u.value?.flow_id:void 0;if(p&&(typeof y!="string"||!Pf.test(y))){let E=Nn("the handoff response carried no usable return flow id");return E.ok?E:n(E.error)}let b=l.visit_ref!==void 0,g=b?kf(u.value?.visit):null;if(b&&g===null){let E=Nn("the handoff response did not confirm the visit it opens");return E.ok?E:n(E.error)}let w=c===null?null:Object.freeze({...c,...p?{flowId:y}:{},...g!==null?{visit:g}:{}});return w===null?n(q("internalError",{retryable:false,httpStatus:502,wireMessage:"the handoff response carried no usable visit url"})):(Ta(r,"televet.visit.handoff_created",{pet_scoped:l.pet_ref!==void 0}),de(w))},async checkAvailability(o){if(typeof o!="string"||o.length>Ca)return Sa(`state must be at most ${Ca} characters`);let s=await t.send("televet.visit.availability",{method:"POST",path:Rf,body:{state:o}},{idempotent:false,maxAttempts:1});if(!s.ok)return V(s.error);let a=s.value?.available;return typeof a!="boolean"?Nn("the availability response carried no usable answer"):de(Object.freeze({available:a}))},async chatEntryOpen(){try{let o=await t.send("televet.visit.chat_entry",{method:"GET",path:Sf},{maxAttempts:1});return o.ok&&o.value?.open===!0}catch{return false}}}}i(Pa,"createVetVisitController");function xf(e){if(typeof e!="object"||e===null)return null;let{url:t,expires_at:r}=e;return typeof t!="string"||typeof r!="string"||r.length===0||!Of(t)?null:Object.freeze({url:t,expiresAt:r})}i(xf,"parseHandoff");var _f=new Set(["localhost","127.0.0.1","[::1]"]),If=/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^/?#]*)/,Af=/[\s\u0000-\u001f\u007f]/;function Of(e){if(Af.test(e))return false;let t=If.exec(e);if(t===null)return false;let r=(t[1]??"").toLowerCase(),n=t[2]??"";if(n.length===0||n.includes("@"))return false;let o=n.replace(/:\d+$/,"").toLowerCase(),s=r==="https",a=r==="http"&&_f.has(o);if(!s&&!a)return false;let d=e.indexOf("#");if(d<0)return false;let l=e.slice(d);return l.startsWith("#h=")&&l.length>3}i(Of,"isOpenableVisitUrl");function Ta(e,t,r){if(e)try{e.track(t,r);}catch{}}i(Ta,"safeTrack");var Un=Object.freeze({status:"idle",error:null,errorReason:null});function Mf(e,t,r){let{usState:n,chat:o,scope:s}=r,a=t&&(n!==null||o),d=`${n??""}|${o?"chat":""}`,[l,u]=react.useState(null);if(react.useEffect(()=>{if(!a)return;let p=true,y=e.current;return u(null),i(async()=>{try{if(o&&!(y.chatEntryOpen&&await y.chatEntryOpen()))return !1;if(n===null)return !0;if(!y.checkAvailability)return !1;let g=await y.checkAvailability(n);return g.ok&&g.value.available}catch{return false}},"ask")().then(g=>{p&&u({key:d,open:g});}),()=>{p=false;}},[a,d,n,o,s,e]),!a)return null;let c=l!==null&&l.key===d;return {open:c&&l.open,pending:!c}}i(Mf,"usePreflight");var Lf=Object.freeze({status:"opening",error:null,errorReason:null});function xa(e,t={}){let{runtime:r,userRef:n,scopeEpoch:o}=ie(),s=Rt("televet"),a=s.enabled&&n!==null,d=t.usState??null,l=t.entry==="chat",u=t.petRef??null,c=t.prefer==="redirect",p=react.useMemo(()=>{if(t.controller)return t.controller;let{services:x}=r.registry;return Pa({auth:x.authFor(n),telemetry:x.telemetry,...x.errorPolicy?{errorPolicy:x.errorPolicy}:{}})},[r,n,o,t.controller]),y=react.useRef(p);y.current=p;let b=react.useMemo(()=>({runtime:r,userRef:n,scopeEpoch:o}),[r,n,o]),g=Mf(y,a,{usState:d,chat:l,scope:b}),w=a&&(g===null||g.open)&&(!l||u!==null),E=t.returnTo??null,[S,_]=react.useState(Un),T=react.useRef(null),I=react.useRef({runtime:r,userRef:n,scopeEpoch:o});I.current={runtime:r,userRef:n,scopeEpoch:o};let m=react.useRef(p);m.current=p;let R=react.useRef(w);R.current=w;let O=react.useCallback((x,D)=>{if(T.current)return T.current;let U=i((oe,Fe)=>(_({status:oe==="cancelled"?"idle":"error",error:Fe,errorReason:oe==="cancelled"?null:oe}),Object.freeze({opened:false,reason:oe,error:Fe})),"fail");if(!R.current)return Promise.resolve(U("unavailable",null));let z=e.prepare();if(!z.ok)return Promise.resolve(U(z.reason,null));let Z=I.current,le=m.current;_(Lf);let Ne=(async()=>{let oe,Fe={...E!==null?{returnTo:E}:{},...l?{entry:"chat"}:{},...D!==null?{visitRef:D.visitRef}:{},...D!==null&&D.intent!==null&&D.intent!==void 0?{intent:D.intent}:{}},Lt=Object.keys(Fe).length===0?void 0:Fe,Dt=x===void 0?u:x;try{oe=await(Lt===void 0?le.createHandoff(Dt):le.createHandoff(Dt,Lt));}catch{return e.abandon(z.value),U("unknown",null)}let et=I.current;if(et.runtime!==Z.runtime||et.userRef!==Z.userRef||et.scopeEpoch!==Z.scopeEpoch)return e.abandon(z.value),U("cancelled",null);if(!oe.ok)return e.abandon(z.value),U(Hn(oe.error),oe.error);let ft=await e.finish(z.value,oe.value);return ft!==null?U(ft,null):(_(Un),Object.freeze(oe.value.flowId===void 0?{opened:true}:{opened:true,flowId:oe.value.flowId}))})().finally(()=>{T.current===Ne&&(T.current=null);});return T.current=Ne,Ne},[e,u,E,l]),F=react.useCallback((x,D)=>{if(!R.current)return _({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}));let U=x===void 0?u:x,z={...U!==null?{petRef:U}:{},...d!==null?{usState:d}:{},...D!==null?{visitRef:D.visitRef,intent:D.intent}:{}};return hr(z)===null?(_({status:"error",error:null,errorReason:"unavailable"}),Promise.resolve(Object.freeze({opened:false,reason:"unavailable",error:null}))):(_(Un),Promise.resolve(Object.freeze({opened:true})))},[u,d]),P=react.useCallback(x=>c?O(x,null):F(x,null),[c,O,F]),h=react.useCallback((x,D)=>c?O(void 0,{visitRef:x,intent:D??null}):F(void 0,{visitRef:x,intent:D??null}),[c,O,F]);return {available:w,isPending:s.isPending||(g?.pending??false),status:S.status,error:S.error,errorReason:S.errorReason,open:P,openVisit:h}}i(xa,"useVetVisitWith");var Nf=i(e=>reactNative.Linking.openURL(e),"defaultOpenUrl");function br(e={}){let{openUrl:t,...r}=e,n=react.useMemo(()=>{let o=t??Nf;return {prepare:i(()=>({ok:true,value:null}),"prepare"),async finish(s,a){try{return await o(a.url),null}catch{return "openFailed"}},abandon:i(()=>{},"abandon")}},[t]);return xa(n,r)}i(br,"useVetVisit");var _a=44,jf=.6;function at(e){let{petRef:t,label:r,openUrl:n,onOpened:o,onError:s,style:a,labelStyle:d,controller:l,returnTo:u,usState:c,entry:p,visitRef:y,intent:b,onStartInApp:g,prefer:w}=e,E=w==="redirect",S=br({...u!==void 0?{returnTo:u}:{},...c!==void 0?{usState:c}:{},...p!==void 0?{entry:p}:{},...t!==void 0?{petRef:t}:{},...n!==void 0?{openUrl:n}:{},...l!==void 0?{controller:l}:{},prefer:E?"redirect":"in-app"}),_=A(),T=react.useMemo(()=>Wf(_),[_]),I=react.useRef(false);if(!S.available)return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[null,jsxRuntime.jsx(kt,{})]});let m=S.status==="opening",R=r??la.visitButton;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(reactNative.Pressable,{onPress:i(()=>{if(!(m||I.current)){if(!E){let F={...t!==void 0?{petRef:t}:{},...c!==void 0?{usState:c}:{},...y!=null?{visitRef:y,intent:b??null}:{}};hr(F,g)===null&&W(s,"unavailable",null);return}I.current=true,(y==null?S.open():S.openVisit(y,b??null)).then(F=>{F.opened?W(o,F.flowId??null):F.reason!=="cancelled"&&W(s,F.reason,F.error);}).finally(()=>{I.current=false;});}},"onPress"),accessibilityRole:"button",accessibilityLabel:R,accessibilityState:{busy:m,disabled:m},style:[T.button,m?T.busy:null,a],children:jsxRuntime.jsx(v,{style:[T.label,d],children:R})}),jsxRuntime.jsx(kt,{})]})}i(at,"VetVisitButton");function Wf(e){let{color:t,space:r,radius:n,type:o,slots:s}=e;return reactNative.StyleSheet.create({button:{minHeight:_a,minWidth:_a,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.primary,...ne(s.vetVisitButton)},busy:{opacity:jf},label:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.snug,...ve(s.vetVisitButton)}})}i(Wf,"makeStyles");function zn(e){return Zt(e)==="cat"?"cat":"dog"}i(zn,"speciesOf");function Bn(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:Math.floor(e)}i(Bn,"petAgeYears");function Fa(e){let t=Bn(e.ageYears),r=zn(e.species)==="cat"?"Cat":"Dog";if(t==null)return r;let n=t===1?"1 yr":`${t} yrs`;return `${r} \xB7 ${n}`}i(Fa,"formatPetMeta");var Oa=Object.freeze([Object.freeze({background:"#ffbdbd",foreground:"#6d1d14"}),Object.freeze({background:"#a0c4f6",foreground:"#0b3a73"}),Object.freeze({background:"#fbc558",foreground:"#10462e"}),Object.freeze({background:"#bde7c5",foreground:"#0e3b22"}),Object.freeze({background:"#dcc7f4",foreground:"#3a1d6a"}),Object.freeze({background:"#ffd8a8",foreground:"#5a2a04"})]);function Gf(e){let t=0;for(let r=0;r<e.length;r+=1)t=t*31+e.charCodeAt(r)>>>0;return Oa[t%Oa.length]}i(Gf,"pickInitialsPalette");function jn(e){let t=(e??"").trim();return (Array.from(t)[0]??"?").toUpperCase()}i(jn,"getInitial");function Ma(e){return {...Gf(e.petRef),initial:jn(e.name)}}i(Ma,"petInitials");function $f(e){return Math.max(12,Math.round(e*.42))}i($f,"letterSize");function _t({pet:e,size:t,ringStroke:r}){let n=A(),o=react.useMemo(()=>Xf(n),[n]),s=t-r*2,a=e===null?null:Ma(e),d=$f(s);return jsxRuntime.jsx(ur,{size:t,strokeWidth:r,color:n.color.success,children:jsxRuntime.jsx(reactNative.View,{style:[o.disc,{width:s,height:s,borderRadius:s/2},a===null?o.discEmpty:{backgroundColor:a.background}],children:jsxRuntime.jsx(v,{tier:"badge",style:[o.letter,{fontSize:d,lineHeight:Math.round(d*1.2),color:a===null?n.color.text.muted:a.foreground}],children:a===null?jn(null):a.initial})})})}i(_t,"PetDisc");function Xf(e){return reactNative.StyleSheet.create({disc:{alignItems:"center",justifyContent:"center",overflow:"hidden"},discEmpty:{backgroundColor:e.color.brandSoft},letter:{...C(e,"bold"),textAlign:"center",includeFontPadding:false}})}i(Xf,"makeStyles");var Gn=48,Va=2,ry=320,ny="80%",oy="rgba(17,17,17,0.45)",iy=18,La=22,sy=12,Da=.4,ay=44;function qn(e){return e?.name?.trim()||f.yourPet}i(qn,"petDisplayName");function Na({visible:e,pets:t,activePetRef:r,onSelect:n,onAddPet:o=null,onClose:s}){let a=A(),d=react.useMemo(()=>ly(a),[a]);return e?jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:a.motion.reducedMotion?"none":"fade",onRequestClose:s,children:jsxRuntime.jsxs(reactNative.View,{style:d.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:ye,onPress:s,accessibilityRole:"button",accessibilityLabel:f.close,children:jsxRuntime.jsx(reactNative.View,{style:d.backdrop})}),jsxRuntime.jsxs(reactNative.View,{style:d.panel,accessibilityViewIsModal:true,children:[jsxRuntime.jsx(v,{tier:"heading",style:d.title,accessibilityRole:"header",children:f.yourPets}),jsxRuntime.jsx(reactNative.ScrollView,{style:d.list,contentContainerStyle:d.listContent,showsVerticalScrollIndicator:true,children:t.map(l=>{let u=l.petRef===r,c=qn(l),p=Fa(l);return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(u?f.petCurrentlyActive:f.switchToPet,{name:c}),accessibilityState:{selected:u},style:[d.row,u?d.rowActive:null],onPress:()=>n(l.petRef),children:[jsxRuntime.jsx(_t,{pet:l,size:Gn,ringStroke:Va}),jsxRuntime.jsxs(reactNative.View,{style:d.copy,children:[jsxRuntime.jsx(v,{style:d.name,numberOfLines:1,children:c}),jsxRuntime.jsx(v,{tier:"compact",style:d.meta,numberOfLines:1,children:u?`${f.activePrefix}${p}`:p})]}),u?jsxRuntime.jsx(Le,{size:iy,color:a.color.brandInk}):null]},l.petRef)})}),o!==null?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.addAnotherPet,style:d.addRow,onPress:o,children:[jsxRuntime.jsx(reactNative.View,{style:d.addDisc,children:jsxRuntime.jsx(v,{tier:"control",style:d.addPlus,children:"+"})}),jsxRuntime.jsx(v,{style:d.addLabel,children:f.addAnotherPet})]}):null,jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.close,containerStyle:d.closeSlot,style:d.closeButton,onPress:s,children:jsxRuntime.jsx(v,{tier:"control",style:d.closeText,children:f.close})})]})]})}):null}i(Na,"PetSwitcherSheet");function ly(e){let t=e.color,r=e.radius;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},backdrop:{flex:1,backgroundColor:oy},panel:{backgroundColor:t.surface,paddingHorizontal:20,paddingTop:20,paddingBottom:32,borderTopLeftRadius:La,borderTopRightRadius:La,gap:14,maxHeight:ny},title:{...C(e,"bold"),fontSize:18,lineHeight:22,color:t.brandInk},list:{maxHeight:ry,flexShrink:1},listContent:{gap:10},addRow:{flexDirection:"row",alignItems:"center",gap:12,minHeight:ay,paddingHorizontal:8},addDisc:{width:Gn,height:Gn,borderRadius:r.pill,alignItems:"center",justifyContent:"center",borderWidth:Va,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:t.surfaceCream},addPlus:{...C(e,"bold"),fontSize:20,lineHeight:22,color:t.brandInk},addLabel:{...C(e,"bold"),fontSize:15,lineHeight:20,color:t.text.primary},row:{flexDirection:"row",alignItems:"center",gap:12,padding:12,borderRadius:r.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},rowActive:{borderColor:t.brandInk,backgroundColor:t.brandSoft},copy:{flex:1,gap:2},name:{...C(e,"bold"),fontSize:15,lineHeight:18,color:t.text.primary},meta:{...C(e,"monoBold"),fontSize:11,lineHeight:13,color:t.text.muted,textTransform:"uppercase",letterSpacing:Da},closeSlot:{alignSelf:"flex-end"},closeButton:{paddingHorizontal:18,paddingVertical:10,borderRadius:sy,backgroundColor:t.brandSoft},closeText:{...C(e,"bold"),color:t.brandInk,fontSize:13,lineHeight:16,letterSpacing:Da}})}i(ly,"makeStyles");var cy=44,Cr=36,py=22,Yn=9,fy=1.5,Ua=6,Ye=35,Er=1.75,Kn=12.4,yy=.5,my=8,hy=28,gy=160;function Xn(e,t){return aa(e,t)}i(Xn,"headerPet");function Ba({pets:e,petRef:t,historyUnread:r,onOpenHistory:n,onPetChange:o,onAddPet:s,vet:a}){let d=A(),l=react.useMemo(()=>vy(d),[d]),[u,c]=react.useState(false),p=Xn(e.pets,t),y=e.pets.length>=2,b=t??p?.petRef??null,g=qn(p),w=i(S=>{c(false),e.setActivePet(S),W(o,S);},"select"),E=s===void 0?null:()=>{c(false),W(s);};return jsxRuntime.jsxs(reactNative.View,{style:l.row,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:r?f.openMenuUnread:f.openMenu,containerStyle:l.iconSlot,style:l.iconButton,onPress:n,children:[jsxRuntime.jsx(gs,{size:py,color:d.color.text.primary,strokeWidth:2}),r?jsxRuntime.jsx(reactNative.View,{style:l.unreadDot,pointerEvents:"none"}):null]}),jsxRuntime.jsx(reactNative.View,{style:l.center,pointerEvents:"box-none",children:jsxRuntime.jsx(by,{logoUrl:d.meta.logoUrl,name:d.meta.displayName,styles:l})}),b===null?null:jsxRuntime.jsx(at,{entry:"chat",petRef:b,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:l.vetEntry,labelStyle:l.vetEntryLabel}),jsxRuntime.jsx(reactNative.View,{style:l.right,children:y?jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:j(f.switchActivePet,{name:g}),containerStyle:l.avatarSlot,style:l.avatarWrap,onPress:()=>c(true),children:[jsxRuntime.jsx(_t,{pet:p,size:Ye,ringStroke:Er}),jsxRuntime.jsx(reactNative.View,{style:l.addBadge,pointerEvents:"none",accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:jsxRuntime.jsx(vs,{size:my,color:d.color.brandInk,strokeWidth:2})})]}):e.loading&&p===null?jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityLabel:f.yourPet,children:jsxRuntime.jsx(ur,{size:Ye,strokeWidth:Er,color:d.color.success,children:jsxRuntime.jsx(reactNative.View,{style:l.placeholderDisc})})}):jsxRuntime.jsx(reactNative.View,{style:l.avatarWrap,accessible:true,accessibilityRole:"image",accessibilityLabel:p===null?f.yourPet:g,children:jsxRuntime.jsx(_t,{pet:p,size:Ye,ringStroke:Er})})}),jsxRuntime.jsx(Na,{visible:u,pets:e.pets,activePetRef:p?.petRef??null,onSelect:w,onAddPet:E,onClose:()=>c(false)})]})}i(Ba,"ChatHeader");function by({logoUrl:e,name:t,styles:r}){let[n,o]=react.useState(null);return e===null||n===e?null:jsxRuntime.jsx(reactNative.View,{style:r.logoBar,children:jsxRuntime.jsx(reactNative.Image,{source:{uri:e},style:r.logo,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:t,onError:()=>o(e)})})}i(by,"BrandLogo");function vy(e){let t=e.color,r=Ye-Er*2;return reactNative.StyleSheet.create({vetEntry:{minHeight:cy,justifyContent:"center",paddingHorizontal:12,borderRadius:e.radius.pill,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},vetEntryLabel:{...C(e,"bold"),color:t.brandInk,fontSize:e.type.size.caption},row:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:16,paddingVertical:10,backgroundColor:t.surface},iconSlot:{borderRadius:Cr/2},iconButton:{width:Cr,height:Cr,borderRadius:Cr/2,alignItems:"center",justifyContent:"center"},unreadDot:{position:"absolute",top:Ua,right:Ua,width:Yn,height:Yn,borderRadius:Yn,backgroundColor:t.danger,borderWidth:fy,borderColor:t.surface},center:{...ye,alignItems:"center",justifyContent:"center"},logoBar:{alignItems:"center",paddingHorizontal:e.space.lg},logo:{height:hy,width:gy},right:{alignItems:"flex-end"},avatarSlot:{borderRadius:Ye/2},avatarWrap:{width:Ye,height:Ye,position:"relative"},placeholderDisc:{width:r,height:r,borderRadius:r/2,backgroundColor:t.brandSoft},addBadge:{position:"absolute",bottom:0,right:0,width:Kn,height:Kn,borderRadius:Kn/2,borderWidth:yy,borderColor:t.success,backgroundColor:t.surface,alignItems:"center",justifyContent:"center"}})}i(vy,"makeStyles");var Ga=44,Ty="rgba(17,17,17,0.55)",qa=26,Py=36,Ya=4,Qn=20,Zn=38,wy=18,ky=12;function Ka({visible:e,onSubmit:t,onSkip:r}){let n=A(),o=react.useMemo(()=>xy(n),[n]),[s,a]=react.useState(null),[d,l]=react.useState(""),[u,c]=react.useState(false),[p,y]=react.useState(false),b=i(()=>{a(null),l(""),c(false),y(false);},"reset"),g=i(()=>{u||(b(),r());},"skip"),w=i(async()=>{if(u)return;c(true),y(false);let S=d.trim();await t(s,S.length>0?S:null)?b():(c(false),y(true));},"submit");if(!e)return null;let E=[...d].length>Kt;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:n.motion.reducedMotion?"none":"slide",onRequestClose:g,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{behavior:reactNative.Platform.OS==="ios"?"padding":void 0,style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:o.scrim,onPress:g,accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y}),jsxRuntime.jsxs(reactNative.View,{style:o.sheet,accessibilityViewIsModal:true,accessibilityLiveRegion:"polite",children:[jsxRuntime.jsx(reactNative.View,{style:o.handle}),jsxRuntime.jsxs(reactNative.View,{style:o.header,children:[jsxRuntime.jsx(reactNative.View,{style:o.iconBadge,children:jsxRuntime.jsx(dr,{size:wy,color:n.color.brandInk,active:false,rotate:"180deg"})}),jsxRuntime.jsxs(reactNative.View,{style:o.headerText,children:[jsxRuntime.jsx(v,{tier:"heading",style:o.title,accessibilityRole:"header",children:f.feedbackTitle}),jsxRuntime.jsx(v,{style:o.subtitle,children:f.feedbackSubtitle})]})]}),jsxRuntime.jsx(reactNative.View,{style:o.options,children:Ur.map(S=>{let _=s===S.key;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:S.label,accessibilityState:{selected:_},style:[o.option,_?o.optionSelected:null],onPress:()=>a(T=>T===S.key?null:S.key),children:[jsxRuntime.jsx(v,{style:[o.optionLabel,_?o.optionLabelSelected:null],children:S.label}),jsxRuntime.jsx(reactNative.View,{style:[o.radio,_?o.radioSelected:null],children:_?jsxRuntime.jsx(Le,{size:ky,color:n.color.surface,strokeWidth:2}):null})]},S.key)})}),jsxRuntime.jsxs(reactNative.View,{style:o.inputWrap,children:[jsxRuntime.jsx(rt,{style:o.input,placeholder:f.feedbackNotesPlaceholder,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:f.feedbackNotesPlaceholder,value:d,onChangeText:l,multiline:true,editable:!u}),d.length>0?jsxRuntime.jsx(v,{tier:"compact",style:[o.counter,E?o.counterOver:null],children:`${[...d].length}/${Kt}`}):null]}),p?jsxRuntime.jsx(v,{style:o.failed,accessibilityRole:"alert",children:f.feedbackFailed}):null,jsxRuntime.jsxs(reactNative.View,{style:o.actions,children:[jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.feedbackSubmit,accessibilityState:{busy:u,disabled:u||E},disabled:u||E,style:[o.submit,u||E?o.submitDisabled:null],onPress:()=>{w();},children:jsxRuntime.jsx(v,{tier:"control",style:o.submitLabel,children:f.feedbackSubmit})}),jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:f.feedbackSkipA11y,hitSlop:8,onPress:g,style:o.skip,children:jsxRuntime.jsx(v,{tier:"control",style:o.skipLabel,children:f.feedbackSkip})})]})]})]})})}i(Ka,"FeedbackReasons");function xy(e){let t=e.color,r=e.type,n=e.radius,o=e.slots;return reactNative.StyleSheet.create({root:{flex:1,justifyContent:"flex-end"},scrim:{...ye,backgroundColor:Ty},sheet:{backgroundColor:t.surface,borderTopLeftRadius:qa,borderTopRightRadius:qa,paddingHorizontal:22,paddingTop:12,paddingBottom:34,gap:14},handle:{alignSelf:"center",width:Py,height:Ya,borderRadius:Ya/2,backgroundColor:t.brandBorder,marginBottom:2},header:{flexDirection:"row",alignItems:"center",gap:12},iconBadge:{width:Zn,height:Zn,borderRadius:Zn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.brandSoft},headerText:{flex:1,gap:2},title:{...C(e,"bold"),fontSize:20,lineHeight:28,color:t.text.primary,letterSpacing:r.letterSpacing.tight},subtitle:{...C(e,"regular"),fontSize:r.size.body,lineHeight:r.size.body*r.lineHeight.relaxed,color:t.text.muted},options:{gap:8},option:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingHorizontal:14,paddingVertical:13,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,backgroundColor:t.surface},optionSelected:{borderColor:t.brandInk,backgroundColor:t.brandSoft},optionLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.primary},optionLabelSelected:{color:t.brandInk},radio:{width:Qn,height:Qn,borderRadius:Qn/2,borderWidth:2,borderColor:t.brandBorderStrong,alignItems:"center",justifyContent:"center"},radioSelected:{borderColor:t.brandInk,backgroundColor:t.brandInk},inputWrap:{gap:4},input:{minHeight:72,maxHeight:132,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorderStrong,paddingHorizontal:14,paddingTop:12,paddingBottom:12,...C(e,"regular"),fontSize:r.size.body,color:t.text.primary,textAlignVertical:"top"},counter:{...C(e,"mono"),alignSelf:"flex-end",fontSize:r.size.caption,letterSpacing:.3,color:t.text.placeholder},counterOver:{color:t.danger},failed:{...C(e,"regular"),fontSize:r.size.caption,lineHeight:r.size.caption*r.lineHeight.normal,color:t.danger},actions:{gap:10,alignItems:"center"},submit:{alignSelf:"stretch",minHeight:Ga,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.xl,borderRadius:n.pill,backgroundColor:t.brand,...ne(o.primaryButton)},submitDisabled:{opacity:.6},submitLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.onPrimary,...ve(o.primaryButton)},skip:{minHeight:Ga,alignItems:"center",justifyContent:"center",paddingHorizontal:e.space.lg},skipLabel:{...C(e,"medium"),fontSize:r.size.body,color:t.text.muted}})}i(xy,"makeStyles");var jy=.88,Wy=420,Gy=58,qy="rgba(17,17,17,0.28)",Yy=.08,Ky=.1,$y=.08,Xy=.18,Qy=.78,Zy=.7,Jn=36,Jy=10,em=14,tm=12,rm=16,nm=14,eo=8,om=1.5,im=.5,sm=pr(Tt.standard);function am(e){return Math.min(Math.round(e*jy),Wy)}i(am,"drawerPanelWidth");function $a({chat:e,history:t}){let[r,n]=react.useState(t.open),o=react.useCallback(()=>n(false),[]);return t.open&&!r&&n(true),r?jsxRuntime.jsx(lm,{chat:e,history:t,onHidden:o}):null}i($a,"HistoryDrawer");function lm({chat:e,history:t,onHidden:r}){let n=A(),o=react.useMemo(()=>um(n),[n]),s=G(),a=reactNativeSafeAreaContext.useSafeAreaInsets(),{width:d}=reactNative.useWindowDimensions(),l=am(d),u=t.open,c=react.useRef(null);c.current===null&&(c.current=new reactNative.Animated.Value(s.drawerMs<=0&&u?1:0));let p=c.current;react.useEffect(()=>{if(!u&&s.drawerMs<=0){r();return}let S=reactNative.Animated.timing(p,{toValue:u?1:0,duration:s.drawerMs,easing:sm,useNativeDriver:true});return S.start(({finished:_})=>{_&&!u&&r();}),()=>S.stop()},[u,p,s.drawerMs,r]);let y=p.interpolate({inputRange:[0,1],outputRange:[-l,0]}),b=t.filtered,g=t.rows.length===0,w=g&&t.loading?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,accessibilityLabel:Y.loading,accessibilityState:{busy:true},children:[jsxRuntime.jsx(reactNative.ActivityIndicator,{color:n.color.onPrimary}),jsxRuntime.jsx(v,{style:o.emptyBody,children:Y.loading})]}):g&&t.error!==null?jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,accessibilityRole:"alert",children:Y.loadFailed}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.error}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.retryA11y,containerStyle:o.retrySlot,style:o.retryButton,onPress:()=>{t.load();},children:jsxRuntime.jsx(v,{tier:"control",style:o.retryText,children:Y.retry})})]}):jsxRuntime.jsxs(reactNative.View,{style:o.emptyCard,children:[jsxRuntime.jsx(v,{style:o.emptyTitle,children:t.emptyKind==="empty"?Y.empty:Y.noMatch}),jsxRuntime.jsx(v,{style:o.emptyBody,children:t.emptyKind==="empty"?Y.emptyBody:Y.noMatchBody})]}),E=!t.searching&&t.loadingMore?jsxRuntime.jsx(reactNative.View,{style:o.loadMoreFooter,children:jsxRuntime.jsx(v,{style:o.loadMoreLabel,children:Y.loadingMore})}):null;return jsxRuntime.jsx(reactNative.Modal,{visible:true,transparent:true,animationType:"none",onRequestClose:t.close,children:jsxRuntime.jsxs(reactNative.View,{style:o.root,children:[jsxRuntime.jsx(reactNative.Pressable,{style:ye,onPress:t.close,accessibilityRole:"button",accessibilityLabel:Y.closeA11y,children:jsxRuntime.jsx(reactNative.Animated.View,{style:[o.backdrop,{opacity:p}]})}),jsxRuntime.jsx(reactNative.Animated.View,{style:[o.panel,{width:l,paddingTop:Math.max(Gy,a.top+n.space.md),transform:[{translateX:y}]}],accessibilityViewIsModal:true,children:jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:o.keyboardAvoider,behavior:reactNative.Platform.OS==="ios"?"padding":"height",children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchRow,children:[jsxRuntime.jsxs(reactNative.View,{style:o.searchPill,children:[jsxRuntime.jsx(ks,{size:nm,color:n.color.text.muted,strokeWidth:1.5}),jsxRuntime.jsx(rt,{value:t.query,onChangeText:S=>t.setQuery(S.replace(/^\s+/,"")),style:o.searchInput,placeholder:Y.search,placeholderTextColor:n.color.text.placeholder,accessibilityLabel:Y.search,autoCorrect:false,autoCapitalize:"none",returnKeyType:"search"})]}),jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Y.newConversation,style:o.newButton,onPress:t.newConversation,children:jsxRuntime.jsx(xs,{size:rm,color:n.color.text.primary,strokeWidth:1.5})})]}),jsxRuntime.jsx(v,{tier:"heading",style:o.heading,accessibilityRole:"header",children:Y.heading}),t.error!==null&&!g?jsxRuntime.jsx(reactNative.View,{style:o.errorCard,children:jsxRuntime.jsx(v,{style:o.errorText,accessibilityRole:"alert",children:t.error})}):null,jsxRuntime.jsx(reactNative.FlatList,{data:b,keyExtractor:S=>S.id,renderItem:({item:S})=>jsxRuntime.jsx(dm,{row:S,active:S.id===e.conversationId,disabled:t.loading,styles:o,onPress:()=>{t.resume(S.id);}}),contentContainerStyle:b.length===0?o.listEmpty:o.list,keyboardShouldPersistTaps:"handled",ListEmptyComponent:w,ListFooterComponent:E,onEndReached:t.loadMore,onEndReachedThreshold:im})]})})]})})}i(lm,"DrawerModal");function dm({row:e,active:t,disabled:r,styles:n,onPress:o}){let s=e.unreadCount!==null&&e.unreadCount>0;return jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:Qi(e),accessibilityState:{selected:t,disabled:r},disabled:r,style:[n.item,t?n.itemActive:null],onPress:o,children:jsxRuntime.jsxs(reactNative.View,{style:n.itemRow,children:[jsxRuntime.jsx(v,{style:[n.itemTitle,s?n.itemTitleUnread:null],numberOfLines:1,children:ir(e.title)}),s?jsxRuntime.jsx(reactNative.View,{style:n.unreadDot}):null]})})}i(dm,"Row");function Tr(e,t){if(!/^#[0-9a-f]{6}$/i.test(e))return "transparent";let r=Math.round(Math.min(1,Math.max(0,t))*255);return `${e}${r.toString(16).padStart(2,"0").toUpperCase()}`}i(Tr,"inkWash");function um(e){let t=e.color,r=e.slots,n=t.onPrimary;return reactNative.StyleSheet.create({root:{flex:1},backdrop:{flex:1,backgroundColor:qy},panel:{position:"absolute",left:0,top:0,bottom:0,backgroundColor:t.brand,paddingHorizontal:16,borderRightWidth:.5,borderRightColor:t.brandBorder,gap:12},keyboardAvoider:{flex:1,gap:12},searchRow:{flexDirection:"row",alignItems:"center",gap:10},searchPill:{flex:1,flexDirection:"row",alignItems:"center",gap:8,borderRadius:e.radius.pill,backgroundColor:t.surface,paddingHorizontal:14,paddingVertical:10,borderWidth:1,borderColor:Tr(n,Ky)},searchInput:{...C(e,"regular"),flex:1,fontSize:13,lineHeight:16,color:t.text.primary,padding:0},newButton:{width:Jn,height:Jn,borderRadius:Jn/2,alignItems:"center",justifyContent:"center",backgroundColor:t.surface},heading:{...C(e,"bold"),fontSize:14,lineHeight:17,color:n,marginTop:4},list:{gap:10,paddingBottom:28},listEmpty:{flexGrow:1},item:{paddingVertical:12,paddingHorizontal:4,borderRadius:Jy},itemActive:{backgroundColor:Tr(n,Yy)},itemRow:{flexDirection:"row",alignItems:"center",gap:8},itemTitle:{...C(e,"regular"),flex:1,fontSize:14,lineHeight:18,color:n},itemTitleUnread:C(e,"bold"),unreadDot:{width:eo,height:eo,borderRadius:eo/2,backgroundColor:t.danger,borderWidth:om,borderColor:n},errorCard:{borderRadius:tm,borderWidth:.5,borderColor:t.danger,backgroundColor:t.surface,padding:12},errorText:{...C(e,"regular"),fontSize:11,lineHeight:16,color:t.danger},emptyCard:{borderRadius:em,padding:14,gap:6,backgroundColor:Tr(n,$y),borderWidth:.5,borderColor:Tr(n,Xy)},emptyTitle:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n},emptyBody:{...C(e,"regular"),fontSize:11,lineHeight:17,color:n,opacity:Qy},retrySlot:{marginTop:8,alignSelf:"flex-start"},retryButton:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:7,borderWidth:1,borderColor:n,...ne(r.primaryButton)},retryText:{...C(e,"bold"),fontSize:12,lineHeight:15,color:n,...ve(r.primaryButton)},loadMoreFooter:{paddingVertical:14,alignItems:"center"},loadMoreLabel:{...C(e,"regular"),fontSize:11,lineHeight:14,color:n,opacity:Zy}})}i(um,"makeStyles");var hm=Object.freeze({}),gm=100,bm=20;function vm(e,t,r,n){return ![e,t,r,n].every(Number.isFinite)||e+r>n+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}i(vm,"readWindowTops");function Xa(e,t){let r=typeof e=="number"&&Number.isFinite(e),n=react.useRef(null),[o,s]=react.useState(null),a=react.useRef(null),d=react.useRef(null),l=react.useRef(true),u=react.useCallback(()=>{d.current!==null&&clearTimeout(d.current),d.current=null;},[]);react.useEffect(()=>(l.current=true,()=>{l.current=false,u();}),[u]);let c=react.useCallback(i(function y(b){n.current?.measureInWindow((g,w)=>{let E=a.current;if(!l.current||E===null)return;let S=vm(w,E.y,E.height,reactNative.Dimensions.get("window").height);if(S!==null){s(_=>_!==null&&_.chatTop===S.chatTop&&_.parentTop===S.parentTop?_:S);return}b>=bm||(d.current=setTimeout(()=>{d.current=null,y(b+1);},gm));});},"measureAt"),[]),p=react.useCallback(y=>{let{y:b,height:g}=y.nativeEvent.layout;a.current={y:b,height:g},u(),c(0);},[c,u]);return react.useMemo(()=>{if(!t)return {avoidingProps:r?{keyboardVerticalOffset:e}:hm,probeRef:null,topInWindow:null};let y=o?.parentTop??0;return {avoidingProps:r?{keyboardVerticalOffset:e,onLayout:p}:y>0?{keyboardVerticalOffset:y,onLayout:p}:{onLayout:p},probeRef:n,topInWindow:o?.chatTop??null}},[t,r,e,o,p])}i(Xa,"useChatKeyboardOffset");function Qa({probeRef:e}){return e===null?null:jsxRuntime.jsx(reactNative.View,{ref:e,collapsable:false,pointerEvents:"none",style:Cm})}i(Qa,"KeyboardOffsetProbe");var Cm=Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function Za(e,t){let r={entry:"chat",petRef:e};return t?.returnTo!==void 0&&(r.returnTo=t.returnTo),t?.usState!==void 0&&(r.usState=t.usState),t?.prefer!==void 0&&(r.prefer=t.prefer),r}i(Za,"chatVetVisitOptions");var Pm=16,wm=.75,ro=12,Ja=15,km=18,wr=22,xm=14,_m=8,Im=20,Am=10,Om=13;function tl({surface:e,petRef:t,renderVetAction:r,onFindVet:n,vet:o}){let s=A(),a=react.useMemo(()=>Fm(s),[s]),d=G(),l=e.tier,u=e.source;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(vn,{visible:e.showBanner&&l!==null,inMs:d.bannerInMs,outMs:d.bannerOutMs,style:a.pinned,children:l!==null&&u!==null?jsxRuntime.jsxs(reactNative.View,{accessibilityRole:"alert",style:[a.card,{borderColor:l.borderColor,backgroundColor:l.backgroundColor}],children:[jsxRuntime.jsx(v,{tier:"compact",style:[a.label,{color:l.textColor}],children:l.label}),u.reason!==null?jsxRuntime.jsx(v,{style:[a.reason,{color:l.reasonColor}],children:u.reason}):null,e.showVetAction?r!==void 0?jsxRuntime.jsx(Be,{render:()=>r(l.level),fallback:jsxRuntime.jsx(el,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}),resetKey:l.level}):jsxRuntime.jsx(el,{tier:l,petRef:t,onFindVet:n,vet:o,styles:a}):null,e.dismissLabel!==null?jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.dismissLabel,hitSlop:_m,containerStyle:a.closeSlot,style:a.closeButton,onPress:e.dismiss,children:jsxRuntime.jsx(je,{size:xm,color:l.textColor,strokeWidth:1.5})}):null]}):null}),jsxRuntime.jsx(vn,{visible:e.showCompactIcon,inMs:d.iconInMs,outMs:d.iconOutMs,style:a.indicatorRow,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:f.showLatestVetAlert,hitSlop:Am,onPress:e.expand,children:jsxRuntime.jsx(Ss,{size:Im,color:s.color.text.muted,strokeWidth:2})})})]})}i(tl,"UrgencyBanner");function el({tier:e,petRef:t,onFindVet:r,vet:n,styles:o}){let s=A(),a=br(Za(t,n)),d=a.status==="opening",l=a.available?()=>{a.open();}:r!==void 0?()=>{W(r,e.level);}:null;if(l===null)return null;let u=Fn(s.slots.vetVisitButton)?.textColor??e.textColor;return jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:f.findVetA11y,accessibilityState:{busy:d},containerStyle:o.findVetSlot,style:[o.findVetButton,{borderColor:e.borderColor,backgroundColor:e.pillColor},o.findVetSlotBox,d?o.findVetBusy:null],onPress:l,children:[jsxRuntime.jsx(_s,{size:Om,color:u,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"control",style:[o.findVetLabel,{color:u}],children:f.findVet})]})}i(el,"VetAction");function Fm(e){let t=Fn(e.slots.vetVisitButton);return reactNative.StyleSheet.create({pinned:{marginTop:0,marginBottom:4,paddingHorizontal:e.space.lg},card:{borderRadius:Pm,borderWidth:wm,paddingHorizontal:14,paddingVertical:8,gap:2},label:{...C(e,"monoBold"),fontSize:ro,lineHeight:Ja},reason:{...C(e,"regular"),fontSize:ro,lineHeight:km,paddingRight:wr},findVetSlot:{alignSelf:"flex-start",marginTop:6},findVetButton:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:e.radius.pill,borderWidth:1},findVetSlotBox:{...ne(t,1)},findVetBusy:{opacity:.6},findVetLabel:{...C(e,"monoBold"),fontSize:ro,lineHeight:Ja},closeSlot:{position:"absolute",top:6,right:6},closeButton:{width:wr,height:wr,borderRadius:wr/2,alignItems:"center",justifyContent:"center"},indicatorRow:{alignItems:"flex-end",paddingHorizontal:16,paddingTop:2,paddingBottom:4}})}i(Fm,"makeStyles");function rl(){let e=On(),{handle:t}=ie(),r=react.useCallback(n=>t.setActivePet(n),[t]);return react.useMemo(()=>({...e,setActivePet:r}),[e,r])}i(rl,"useChatPets");var ul=300,cl=3e3,ol=120,dt=44,Nm=120,Hm="86%",il=15,sl=22,kr=.5,Um=.04,zm=8,Bm=2,jm=1,Wm=.6,Gm=22,qm=48,al=1.25,Ym=14,Km=18,$m=6,Xm=14,Qm=.04,Zm=12,Jm=2,eh=2,ll=36,th=20,lt=36,ut=(dt-lt)/2,pl=24,fl=22,rh=.4,xr=30,yl=20,nh=.4,oh=480,ih=8,dl=14,sh=10,ah=14,lh=12,dh=13,uh=18,ch="12%";function pe(){let e=A(),t=react.useMemo(()=>ph(e),[e]);return {theme:e,styles:t}}i(pe,"useChatTheme");function ph(e){let t=e.color,r=e.space,n=e.radius,o=e.type,s=e.slots;return reactNative.StyleSheet.create({container:{flex:1,minHeight:ol,backgroundColor:t.chatGround},body:{flex:1},centered:{minHeight:ol,flexGrow:1,alignItems:"center",justifyContent:"center",padding:r.xl},emptyContent:{flexGrow:1,alignItems:"center",justifyContent:"flex-start",paddingTop:ch,paddingHorizontal:r.lg,paddingBottom:r.lg,minHeight:oh,gap:18},errorText:{...C(e,"regular"),fontSize:o.size.subtitle,lineHeight:o.size.subtitle*o.lineHeight.snug,color:t.danger,textAlign:"center",marginBottom:r.md},retryButton:{minHeight:dt,minWidth:dt,alignItems:"center",justifyContent:"center",paddingHorizontal:r.xl,paddingVertical:r.sm,borderRadius:n.pill,backgroundColor:t.brand,...ne(s.primaryButton)},retryLabel:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,...ve(s.primaryButton)},setupNotice:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingHorizontal:r.lg,paddingVertical:r.sm,backgroundColor:t.surfaceCream},setupNoticeText:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption,flexShrink:1},turnNotice:{gap:r.xs,padding:r.md,borderRadius:n.lg,backgroundColor:t.surfaceCream,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder,alignItems:"flex-start"},turnNoticeError:{borderColor:t.danger},turnNoticeTitle:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.body},turnNoticeTitleError:{color:t.danger},turnNoticeBody:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal},turnNoticeAction:{minHeight:dt,justifyContent:"center"},turnNoticeActionLabel:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.body},setupNoticeAction:{...C(e,"medium"),color:t.brandInk,fontSize:o.size.caption},reconnectingCaption:{...C(e,"medium"),color:t.text.secondary,fontSize:o.size.caption,lineHeight:o.size.caption*o.lineHeight.normal,textTransform:"uppercase",letterSpacing:.5},list:{flex:1},listContent:{padding:r.lg,gap:r.md},rowBlock:{gap:r.sm},rowBlockUser:{},rowBlockAssistant:{paddingRight:r.xl},row:{flexDirection:"row"},rowUser:{justifyContent:"flex-end"},rowAssistant:{justifyContent:"flex-start"},bubble:{maxWidth:Hm},bubbleUser:{padding:il,backgroundColor:t.bubbleUser,borderRadius:n.xl,borderBottomRightRadius:n.sm,borderWidth:kr,borderColor:t.accentEdge,shadowColor:t.brand,shadowOpacity:Um,shadowRadius:zm,shadowOffset:{width:0,height:Bm},elevation:jm,...ne(s.userBubble,kr)},bubbleAssistant:s.assistantBubble?.backgroundColor===void 0?{...ne(s.assistantBubble,kr)}:{padding:il,borderRadius:n.xl,...ne(s.assistantBubble,kr)},bubblePending:{opacity:Wm},bubbleTextUser:{...C(e,"medium"),color:t.onPrimary,fontSize:o.size.body,lineHeight:sl,...ve(s.userBubble)},bubbleTextAssistant:{...C(e,"medium"),color:t.text.primary,fontSize:o.size.body,lineHeight:sl,...ve(s.assistantBubble)},bubbleBold:C(e,"bold"),bubbleItalic:{fontStyle:"italic"},bubbleCode:C(e,"mono"),followUps:{alignSelf:"stretch",marginTop:r.sm,gap:ih},followUpSlot:{alignSelf:"stretch",borderRadius:dl},followUpRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:lh,paddingVertical:sh,paddingHorizontal:ah,borderRadius:dl,backgroundColor:t.brandSoft},followUpText:{...C(e,"medium"),flex:1,color:t.text.primary,fontSize:dh,lineHeight:uh},composerOuter:{position:"relative"},composer:{marginHorizontal:r.md,marginTop:r.xs,marginBottom:r.sm,minHeight:qm,justifyContent:"center",paddingLeft:Ym,paddingRight:Km,paddingVertical:$m,backgroundColor:t.composerFill,borderWidth:al,borderColor:t.composerBorder,borderRadius:Gm,shadowColor:t.shadow,shadowOpacity:Qm,shadowRadius:Zm,shadowOffset:{width:0,height:Jm},elevation:eh,...ne(s.composerInput,al)},composerRow:{flexDirection:"row",alignItems:"center",gap:Xm,minHeight:ll},attachControl:{width:xr,height:xr,alignItems:"center",justifyContent:"center"},attachControlDisabled:{opacity:nh},input:{flex:1,minHeight:ll,maxHeight:Nm,paddingHorizontal:0,paddingVertical:0,...C(e,"regular"),fontSize:o.size.body,lineHeight:th,color:t.text.primary,...ve(s.composerInput)},sendControl:{minHeight:lt,minWidth:lt,alignItems:"center",justifyContent:"center"},sendDisc:{width:lt,height:lt,borderRadius:lt/2,alignItems:"center",justifyContent:"center",...ne(s.sendButton)},sendControlDisabled:{opacity:rh},poweredBy:{...C(e,"regular"),color:t.text.muted,fontSize:o.size.micro,textAlign:"center",paddingBottom:r.xs}})}i(ph,"makeStyles");var fh=Object.freeze({kind:"live"}),yh=Object.freeze({kind:"folded"});function oo(e){if(e.role!=="assistant"||e.checkin===void 0)return null;let t=e.checkin.caseId,r=Jo(e.proactiveOriginRef);return {caseId:t,dueDay:r!==null&&r.caseId===t?r.dueDay:""}}i(oo,"askOf");function hl(e){let t=new Map,r=new Map;for(let o of e){let s=oo(o);if(s===null)continue;let a=r.get(s.caseId);(a===void 0||s.dueDay>=a.dueDay)&&r.set(s.caseId,{messageId:o.id,dueDay:s.dueDay});}if(r.size===0)return t;let n=null;for(let o of e){let s=oo(o);if(s===null){n=null;continue}if(r.get(s.caseId)?.messageId===o.id){t.set(o.id,fh),n=null;continue}if(n!==null&&n.caseId===s.caseId){n.days.push(s.dueDay),t.set(o.id,yh);continue}let a=[s.dueDay];n={id:o.id,caseId:s.caseId,days:a},t.set(o.id,{kind:"past",runDueDays:a});}return t}i(hl,"placeCheckins");var ml=864e5,mh=365;function _r(e,t){if(typeof e!="string"||typeof t!="string")return null;let r=Date.parse(e),n=Date.parse(t);if(Number.isNaN(r)||Number.isNaN(n))return null;let o=Math.floor(n/ml)-Math.floor(r/ml);return o<1||o>mh?null:o}i(_r,"checkinDayNumber");function gl(e){return oo(e)?.dueDay||null}i(gl,"checkinDueDay");var me=Object.freeze({eyebrow:"Checking in",logged:"Logged",findVet:"Find a vet now",day:"Day {day}",daySeparator:" \xB7 ",answers:Object.freeze({better:"Better",same:"Same",worse:"Worse"})}),bl=Object.freeze(Ko.map(e=>Object.freeze({answer:e,label:me.answers[e]})));function vl(e,t){let[r,n]=react.useState(null),[o,s]=react.useState(null),[a,d]=react.useState(null),l=react.useCallback(c=>{t!==null&&(n(c),s(null),t(e.caseId,c).then(p=>{n(null),p.ok?d(c):s(p.error);}));},[t,e.caseId]),u=a??e.answer;return {answer:u,answerable:!Zo(e),escalated:u==="worse",pending:r,error:o,choose:l}}i(vl,"useCheckinCard");var Rl=44,bh=.6;function Tl({message:e,checkin:t,onAnswer:r,petRef:n,onFindVet:o,vet:s,onLayout:a}){let d=A(),l=react.useMemo(()=>vh(d),[d]),u=vl(t,r),c=u.answer!==null||u.pending!==null,p=r!==null&&u.answerable,y=_r(t.openedAt,gl(e));return jsxRuntime.jsxs(reactNative.View,{style:l.card,accessibilityLabel:me.eyebrow,onLayout:a,children:[jsxRuntime.jsxs(reactNative.View,{style:l.head,children:[jsxRuntime.jsx(v,{tier:"compact",style:l.eyebrow,children:me.eyebrow}),y!==null?jsxRuntime.jsx(v,{tier:"compact",style:l.headDay,children:j(me.day,{day:y})}):null]}),jsxRuntime.jsx(v,{style:l.question,accessibilityRole:"text",children:e.text}),p?jsxRuntime.jsx(reactNative.View,{style:[l.row,u.pending?l.rowPending:null],children:bl.map(({answer:b,label:g})=>{let w=(u.pending??u.answer)===b;return jsxRuntime.jsx(reactNative.Pressable,{onPress:()=>u.choose(b),disabled:c,accessibilityRole:"button",accessibilityLabel:g,accessibilityState:{selected:w,disabled:c,busy:u.pending===b},style:[l.pill,w?l.pillSelected:null],children:jsxRuntime.jsx(v,{tier:"control",style:[l.pillLabel,w?l.pillLabelSelected:null],children:g})},b)})}):null,u.answer!==null?jsxRuntime.jsx(v,{style:l.logged,children:me.logged}):null,u.escalated?o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:me.findVet,style:l.findVet,children:jsxRuntime.jsx(v,{tier:"control",style:l.findVetLabel,children:me.findVet})}):n?jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:me.findVet,...s?.returnTo!==void 0?{returnTo:s.returnTo}:{},...s?.usState!==void 0?{usState:s.usState}:{},...s?.prefer!==void 0?{prefer:s.prefer}:{},style:l.findVet,labelStyle:l.findVetLabel}):null:null,t.resolutionText?jsxRuntime.jsx(v,{style:l.resolution,children:t.resolutionText}):null,u.error?jsxRuntime.jsx(v,{style:l.error,accessibilityRole:"alert",children:u.error.displayMessage}):null]})}i(Tl,"CheckinCard");function vh(e){let t=e.color,r=e.space,n=e.radius,o=e.type;return reactNative.StyleSheet.create({card:{maxWidth:"92%",padding:r.md,gap:r.sm,borderRadius:n.lg,backgroundColor:t.brandSoft,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},head:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},eyebrow:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},headDay:{...C(e,"bold"),color:t.text.primary,fontSize:o.size.caption,letterSpacing:o.letterSpacing.eyebrow,textTransform:"uppercase"},question:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},row:{flexDirection:"row",gap:r.sm,marginTop:r.xs},rowPending:{opacity:bh},pill:{flex:1,minHeight:Rl,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,borderRadius:n.pill,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface},pillSelected:{backgroundColor:t.brand,borderColor:t.brand},pillLabel:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body},pillLabelSelected:{color:t.onPrimary},logged:{...C(e,"regular"),color:t.text.secondary,fontSize:o.size.caption},resolution:{...C(e,"regular"),color:t.text.primary,fontSize:o.size.body,lineHeight:o.size.body*o.lineHeight.normal},error:{...C(e,"regular"),color:t.danger,fontSize:o.size.caption},findVet:{alignSelf:"stretch",minHeight:Rl,alignItems:"center",justifyContent:"center",borderRadius:n.pill,borderWidth:1.5,borderColor:t.brandBorder,backgroundColor:t.surface},findVetLabel:{...C(e,"bold"),color:t.brandInk,fontSize:o.size.body}})}i(vh,"makeStyles");var Rh=1.5,Sh=3;function wl({text:e,runDueDays:t,openedAt:r,onLayout:n}){let o=A(),s=react.useMemo(()=>Th(o),[o]),a=t.map(l=>_r(r,l)).filter(l=>l!==null),d=t.length>1;return d&&a.length===0?null:jsxRuntime.jsxs(reactNative.View,{style:s.row,onLayout:n,children:[jsxRuntime.jsx(reactNative.View,{style:s.rule,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants"}),jsxRuntime.jsxs(reactNative.View,{style:s.body,children:[a.length>0?jsxRuntime.jsx(v,{tier:"compact",style:s.days,children:a.map(l=>j(me.day,{day:l})).join(me.daySeparator)}):null,d?null:jsxRuntime.jsx(v,{style:s.question,accessibilityRole:"text",children:e})]})]})}i(wl,"CheckinPastAsk");function Th(e){let t=e.color,r=e.space,n=e.type;return reactNative.StyleSheet.create({row:{flexDirection:"row",paddingVertical:r.xs},rule:{width:Rh,borderRadius:1,backgroundColor:t.borderHairlineGreen,marginRight:r.md},body:{flex:1,gap:Sh},days:{...C(e,"monoMedium"),fontSize:n.size.nano,letterSpacing:n.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},question:{...C(e,"regular"),fontSize:n.size.bodyTight,lineHeight:n.size.bodyTight*n.lineHeight.normal,color:t.text.muted}})}i(Th,"makeStyles");var Ph=Object.freeze({TIER_1:"#07C168",TIER_2:"#27A9FF",TIER_3:"#FBC558"}),kl="#C8BEB4";function wh(e){return e?Ph[e.toUpperCase()]??kl:kl}i(wh,"tierColor");function kh(e){if(!e)return null;let t=/^tier[_\s-]?(\d+)$/i.exec(e.trim());return t?`Tier ${t[1]}`:e}i(kh,"tierLabel");function we(e){if(typeof e!="string")return null;let t=e.trim();return t.length===0?null:t}i(we,"text");function xh(e){let t=we(e);return t!==null&&/^https:\/\/\S+$/i.test(t)?t:null}i(xh,"httpsUrl");function _h(e,t){let r=we(e.source_name)??we(e.sourceName),n=we(e.section),o=we(e.authority_tier)??we(e.authorityTier),s=kh(o),a=r??we(e.title)??`Source ${t+1}`,d=we(e.monograph_chunk_id)??we(e.chunkId),l=[n,s].filter(u=>u!==null).join(" \xB7 ");return Object.freeze({title:a,sourceName:r,section:n,authorityTier:o,tierLabel:s,meta:l.length===0?null:l,url:xh(e.url),excerpt:we(e.excerpt),tierColor:wh(o),key:`${a}-${d??"none"}-${t}`})}i(_h,"toCitationCard");function xl(e){return e===void 0||e.length===0?Ih:Object.freeze(e.map((t,r)=>_h(t,r)))}i(xl,"toCitationCards");var Ih=Object.freeze([]);function uo(e){return e===1?`1 ${f.sourceSingular}`:`${e} ${f.sourcePlural}`}i(uo,"sourcesLabel");function _l(e,t){return `${t?f.hideSources:f.showSources} ${uo(e)}`}i(_l,"sourcesToggleLabel");function Il(e){return [e.url!==null?`${f.openSource}: ${e.title}`:e.title,e.meta,e.excerpt].filter(t=>t!==null&&t.length>0).join(". ")}i(Il,"citationA11yLabel");var Lh=244,Ol=8,Fl=13,Dh=14,Vh=.3,Nh=-0.24,Hh=22,Uh=10,zh=15;function Ml({citations:e,onOpenUrl:t}){let r=A(),n=react.useMemo(()=>Wh(r),[r]),o=react.useMemo(()=>xl(e),[e]),[s,a]=react.useState(false);if(o.length===0)return null;let d=o.length;return jsxRuntime.jsxs(reactNative.View,{style:n.block,children:[jsxRuntime.jsxs(N,{accessibilityRole:"button",accessibilityLabel:_l(d,s),accessibilityState:{expanded:s},containerStyle:n.toggleSlot,style:n.togglePill,onPress:()=>a(l=>!l),children:[jsxRuntime.jsx(Cs,{size:Fl,color:r.color.brandInk,strokeWidth:1.5}),jsxRuntime.jsx(v,{tier:"compact",style:n.toggleLabel,children:uo(d)}),jsxRuntime.jsx(lr,{size:Fl,color:r.color.brandInk,strokeWidth:1.5,direction:s?"up":"down"})]}),s?jsxRuntime.jsx(Bh,{cards:o,styles:n,open:t}):null]})}i(Ml,"CitationCards");function Bh({cards:e,styles:t,open:r}){let n=G(),o=We(n.citationsInMs,{risePx:n.citationsRisePx});return jsxRuntime.jsx(reactNative.Animated.View,{style:o,children:jsxRuntime.jsx(reactNative.ScrollView,{horizontal:true,nestedScrollEnabled:true,showsHorizontalScrollIndicator:false,contentContainerStyle:t.row,children:e.map(s=>jsxRuntime.jsx(jh,{card:s,styles:t,open:r},s.key))})})}i(Bh,"Deck");function jh({card:e,styles:t,open:r}){let n=A(),o=e.url!==null&&r!==void 0,s=Il(o?e:{...e,url:null}),a=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(reactNative.View,{style:t.cardHeader,children:[jsxRuntime.jsx(reactNative.View,{style:[t.tierDot,{backgroundColor:e.tierColor}]}),jsxRuntime.jsx(v,{style:[t.cardTitle,o?t.cardTitleLink:null],numberOfLines:2,children:e.title}),o?jsxRuntime.jsx(Es,{size:Dh,color:n.color.linkInk,strokeWidth:1.5}):null]}),e.meta!==null?jsxRuntime.jsx(v,{tier:"compact",style:t.cardMeta,numberOfLines:1,children:e.meta}):null,e.excerpt!==null?jsxRuntime.jsx(v,{style:t.cardExcerpt,numberOfLines:3,children:e.excerpt}):null]});if(e.url!==null&&r!==void 0){let d=e.url;return jsxRuntime.jsx(N,{accessibilityRole:"link",accessibilityLabel:s,style:t.card,onPress:()=>r(d),children:a})}return jsxRuntime.jsx(reactNative.View,{accessible:true,accessibilityRole:"text",accessibilityLabel:s,style:t.card,children:a})}i(jh,"Card");function Wh(e){let t=e.color,r=e.space,n=e.radius,o=e.type.size;return reactNative.StyleSheet.create({block:{gap:r.sm},toggleSlot:{alignSelf:"flex-start",borderRadius:n.pill},togglePill:{flexDirection:"row",alignItems:"center",gap:r.xs+2,paddingHorizontal:r.md,paddingVertical:r.xs+2,borderRadius:n.pill,backgroundColor:t.brandSoft},toggleLabel:{...C(e,"monoBold"),fontSize:o.micro,lineHeight:o.micro,letterSpacing:Vh,color:t.brandInk,textTransform:"uppercase"},row:{gap:r.sm,paddingRight:r.xl,paddingTop:r.xs},card:{width:Lh,borderRadius:n.md,borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,padding:r.md,gap:r.xs+2},cardHeader:{flexDirection:"row",alignItems:"center",gap:r.sm},tierDot:{width:Ol,height:Ol,borderRadius:n.pill},cardTitle:{...C(e,"bold"),flex:1,fontSize:o.bodyTight,lineHeight:Hh,color:t.text.primary,letterSpacing:Nh},cardTitleLink:{color:t.linkInk},cardMeta:{...C(e,"monoMedium"),fontSize:o.nano,lineHeight:Uh,letterSpacing:e.type.letterSpacing.monoWide,color:t.text.metaCool,textTransform:"uppercase"},cardExcerpt:{...C(e,"regular"),fontSize:o.tiny,lineHeight:zh,color:t.text.muted}})}i(Wh,"makeStyles");function Ll(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}i(Ll,"formatMessageTime");var Ot=15,Xh=15,Qh=6,Zh=Object.freeze({up:"0deg",neutral:"270deg",down:"180deg"});function Ul({message:e,onCopy:t,sentiment:r=null,onSentiment:n,thanks:o=false}){let s=A(),a=react.useMemo(()=>Jh(s),[s]),d=G(),l=e.role==="user",u=react.useMemo(()=>Ll(e.createdAt),[e.createdAt]),c=t!==void 0&&e.text.length>0,p=!l&&n!==void 0&&e.responseId!==void 0,[y,b]=react.useState(false),g=react.useRef(null);react.useEffect(()=>()=>{g.current&&clearTimeout(g.current);},[]);let w=i(()=>{t!==void 0&&(ot(t,e.text),b(true),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{b(false),g.current=null;},d.copiedMs));},"copy");return u===null&&!c&&!p?null:jsxRuntime.jsxs(reactNative.View,{style:a.wrap,children:[jsxRuntime.jsxs(reactNative.View,{style:[a.row,l?a.rowUser:a.rowAssistant],children:[u!==null?jsxRuntime.jsx(v,{tier:"compact",style:a.timestamp,children:u}):null,c?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:y?f.copied:l?f.copyUserMessage:f.copyAssistantMessage,hitSlop:Xh,onPress:w,style:a.iconHit,children:y?jsxRuntime.jsx(Le,{size:Ot,color:s.color.success,strokeWidth:2}):jsxRuntime.jsx(Rs,{size:Ot,color:s.color.text.timestamp,strokeWidth:1.5})}):null,p?xo.map(({sentiment:E,label:S})=>jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:S,accessibilityState:{selected:r===E},hitSlop:Qh,onPress:()=>n?.(E),style:a.iconHit,children:jsxRuntime.jsx(dr,{size:Ot,color:s.color.sentiment[E],active:r===E,rotate:Zh[E],strokeWidth:1.5})},E)):null]}),o?jsxRuntime.jsx(v,{style:a.thanks,accessibilityLiveRegion:"polite",children:f.feedbackThanks}):null]})}i(Ul,"MessageFooter");function Jh(e){let t=e.type;return reactNative.StyleSheet.create({wrap:{gap:4},row:{flexDirection:"row",alignItems:"center",gap:10,paddingTop:6},rowAssistant:{alignSelf:"flex-start"},rowUser:{alignSelf:"flex-end"},timestamp:{...C(e,"monoMedium"),fontSize:t.size.nano,lineHeight:t.size.nano+2,color:e.color.text.timestamp,textAlign:"center"},iconHit:{width:Ot,height:Ot,alignItems:"center",justifyContent:"center"},thanks:{...C(e,"regular"),fontSize:t.size.caption,lineHeight:t.size.caption*t.lineHeight.normal,color:e.color.text.secondary}})}i(Jh,"makeStyles");var zl="#10462E",Bl="#000000",eg="#83E0B4",tg=Object.freeze([Object.freeze({id:"breed-health-miss",intent:"send",label:"What {breed} health issue do owners miss most?",fallbackLabel:"What {species} health issue do owners miss most?",background:"#A0C4F6",borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"attention-at-age",intent:"send",label:"What changes should I expect at {ageYears} years old?",fallbackLabel:"What changes should I expect as my {species} ages?",background:eg,borderColor:"rgba(0,0,0,0.5)",borderWidth:1.25}),Object.freeze({id:"early-pain-signs",intent:"send",label:"What are early signs of pain?",background:"#FBC558",borderColor:zl,brandEdge:true,borderWidth:1}),Object.freeze({id:"vet-prep",intent:"vet_report",label:"Help me prep for {petName}\u2019s vet visit.",background:"#FFBDBD",borderColor:"#6D1D14",borderWidth:1.25})]),rg=/\s*-\s*(?:small|medium|large|giant|toy)\s*$/i;function ng(e){return e==null?e:e.replace(rg,"").trim()}i(ng,"formatBreedForPrompt");var og=new Set(["","?","-","--",".","n/a","na","none","null","nil","unknown","unspecified","unsure","not sure","not specified","not applicable","no idea","dunno","idk","tbd","other","i dont know","i don't know","dont know","don't know","do not know","i do not know","not known","no clue"]);function ig(e){let t=String(e??"").replace(/\s+/gu," ").trim().toLowerCase().replace(/\u2019/g,"'");return og.has(t)}i(ig,"isUninformativeBreed");function sg(e){return e==="cat"?"Domestic Short Hair Mix":"Mixed Breed"}i(sg,"unspecifiedBreedLabel");function ag(e,t){return ig(e)?sg(t):String(e).replace(/\s+/gu," ").trim()}i(ag,"resolveBreedLabel");function jl(e){let t=e?.name?.trim()||f.emptyTitlePetFallback;return j(f.emptyTitle,{petName:t})}i(jl,"emptyStateTitle");function Wl(e,t=zl){let r=zn(e?.species),n=r==="cat"?"my cat":"my dog",o=e?.name?.trim()||null,s=o||n,a=ag(ng(e?.breed),r)||null,d=Bn(e?.ageYears),l=d===null?null:String(d);return Object.freeze(tg.map(u=>{let c=u.label.includes("{breed}"),p=u.label.includes("{ageYears}"),b=u.fallbackLabel!==void 0&&(c&&!a||p&&!l)&&u.fallbackLabel?u.fallbackLabel:u.label,g=j(b,{petName:s,breed:a??n,species:r,ageYears:l??""}),w=!o&&b.startsWith("{petName}")?g.charAt(0).toUpperCase()+g.slice(1):g;return Object.freeze({id:u.id,intent:u.intent,label:w,background:u.background,borderColor:u.brandEdge===true?t:u.borderColor,borderWidth:u.borderWidth})}))}i(Wl,"resolveQuickPrompts");var dg=36,Yl=4,ug=340;function Kl({pet:e,petRef:t,onSend:r,onVetPrep:n,vet:o}){let s=A(),a=react.useMemo(()=>pg(s),[s]),d=react.useMemo(()=>Wl(e,s.color.brandInk),[e,s.color.brandInk]),l=jl(e);return jsxRuntime.jsxs(reactNative.View,{style:a.block,children:[jsxRuntime.jsx(v,{tier:"heading",style:a.title,accessibilityRole:"header",children:l}),jsxRuntime.jsx(reactNative.View,{style:a.list,children:d.map((u,c)=>jsxRuntime.jsx(cg,{prompt:u,index:c,petRef:t,onSend:r,onVetPrep:n,vet:o,pet:e,styles:a},u.id))})]})}i(Kl,"QuickPrompts");function cg({prompt:e,index:t,pet:r,petRef:n,onSend:o,onVetPrep:s,vet:a,styles:d}){let l=G(),u=We(l.followUpInMs,{delayMs:cr(l,t)}),c={backgroundColor:e.background,borderColor:e.borderColor,borderWidth:e.borderWidth};return e.intent==="vet_report"?s!==void 0?jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Yl,style:[d.chip,c],onPress:()=>{W(s,r);},children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})}):n===null?null:jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(at,{entry:"chat",petRef:n,label:e.label,...a?.returnTo!==void 0?{returnTo:a.returnTo}:{},...a?.usState!==void 0?{usState:a.usState}:{},...a?.prefer!==void 0?{prefer:a.prefer}:{},style:[d.chip,c],labelStyle:d.chipLabel})}):jsxRuntime.jsx(reactNative.Animated.View,{style:u,children:jsxRuntime.jsx(N,{accessibilityRole:"button",accessibilityLabel:e.label,hitSlop:Yl,style:[d.chip,c],onPress:()=>o(e.label),children:jsxRuntime.jsx(v,{tier:"compact",style:d.chipLabel,children:e.label})})})}i(cg,"Chip");function pg(e){let t=e.color;return reactNative.StyleSheet.create({block:{gap:18,alignItems:"center",width:"100%"},title:{...C(e,"bold"),fontSize:28,lineHeight:34,color:t.text.primary,letterSpacing:-0.8,textAlign:"center",maxWidth:ug},list:{width:"100%",gap:12,alignItems:"center"},chip:{borderRadius:e.radius.pill,paddingHorizontal:14,paddingVertical:9,minHeight:dg,minWidth:0,alignItems:"center",justifyContent:"center",maxWidth:"100%"},chipLabel:{...C(e,"bold"),fontSize:12,lineHeight:14,color:Bl,textAlign:"center"}})}i(pg,"makeStyles");var po=/\*\*([^*]+?)\*\*|\*([^*]+?)\*|`([^`]+?)`/g;function $l(e){return e.includes("*")||e.includes("`")}i($l,"hasInlineMarkup");function Xl(e){let t=[],r=0;po.lastIndex=0;for(let n=po.exec(e);n!==null;n=po.exec(e)){n.index>r&&t.push({kind:"text",text:e.slice(r,n.index)});let o=n[1],s=n[2],a=n[3];o!==void 0?t.push({kind:"bold",text:o}):s!==void 0?t.push({kind:"italic",text:s}):a!==void 0&&t.push({kind:"code",text:a}),r=n.index+n[0].length;}return r<e.length&&t.push({kind:"text",text:e.slice(r)}),t}i(Xl,"tokenizeInlineMarkdown");function Ql(e,t){return $l(e)?Xl(e).map((r,n)=>{switch(r.kind){case "bold":return jsxRuntime.jsx(v,{style:t.bold,children:r.text},n);case "italic":return t.italic?jsxRuntime.jsx(v,{style:t.italic,children:r.text},n):r.text;case "code":return t.code?jsxRuntime.jsx(v,{style:t.code,children:r.text},n):r.text;default:return r.text}}):e}i(Ql,"renderInlineMarkdown");var ed=6,nd=520,bg=Math.round(nd*.18),td=.44,vg=.5,rd=[0,.5,1],Cg=[0,1,2];function od(){let e=A(),t=react.useMemo(()=>Rg(e),[e]),r=!e.motion.reducedMotion;return jsxRuntime.jsx(reactNative.View,{style:t.card,accessible:true,accessibilityRole:"text",accessibilityLabel:f.typing,accessibilityLiveRegion:"polite",accessibilityState:{busy:true},children:Cg.map(n=>r?jsxRuntime.jsx(Eg,{index:n,style:t.dot},n):jsxRuntime.jsx(reactNative.View,{style:[t.dot,t.dotStatic]},n))})}i(od,"TypingIndicator");function Eg({index:e,style:t}){let r=react.useRef(new reactNative.Animated.Value(0)).current;react.useEffect(()=>{let s=reactNative.Animated.sequence([reactNative.Animated.delay(e*bg),reactNative.Animated.loop(reactNative.Animated.timing(r,{toValue:1,duration:nd,useNativeDriver:true}))]);return s.start(),()=>s.stop()},[r,e]);let n=r.interpolate({inputRange:rd,outputRange:[td,1,td]}),o=r.interpolate({inputRange:rd,outputRange:[0,-3.5,0]});return jsxRuntime.jsx(reactNative.Animated.View,{style:[t,{opacity:n,transform:[{translateY:o}]}]})}i(Eg,"AnimatedDot");function Rg(e){let t=e.color,r=e.space,n=e.radius;return reactNative.StyleSheet.create({card:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:r.xs,paddingHorizontal:r.md,paddingVertical:r.sm,backgroundColor:t.surfaceCream,borderRadius:n.md,borderWidth:reactNative.StyleSheet.hairlineWidth,borderColor:t.brandBorder},dot:{width:ed,height:ed,borderRadius:n.pill,backgroundColor:t.brand},dotStatic:{opacity:vg}})}i(Rg,"makeStyles");function id(e,t,r){let n=e-r,o=t!=null?Math.min(n,t):n;return Math.max(0,o)}i(id,"resolveTurnScrollTarget");function sd(e){let t=e.length-1,r=e[t];if(r===void 0||r.role!=="assistant")return null;let n=e[t-1];return {assistantIndex:t,userIndex:n!==void 0&&n.role==="user"?t-1:null}}i(sd,"latestTurn");function ad(e,t,r){let n=Math.max(0,r),o=e===null?n:Math.min(Math.max(0,e),n);return o>t+1?o:null}i(ad,"nextFollowOffset");function ld(e,t){let r=react.useRef(null),n=react.useRef(true),o=react.useRef(t),s=react.useRef(0),a=react.useRef(0),d=react.useRef(0),l=react.useRef(new Map),u=sd(e),c=u===null?null:e[u.assistantIndex]?.id??null,p=u===null||u.userIndex===null?null:e[u.userIndex]?.id??null,y=react.useCallback(()=>{let T=r.current;if(T===null||!n.current||a.current===0)return;let I=null;if(c!==null){let R=l.current.get(c);if(R===void 0)return;let O=p===null?null:l.current.get(p)??null;I=id(R,O,96);}let m=ad(I,s.current,d.current-a.current);m!==null&&(s.current=m,T.scrollTo({y:m,animated:false}));},[c,p]);react.useEffect(()=>{t&&!o.current&&(n.current=true),o.current=t,y();},[e,t,y]);let b=react.useCallback(T=>{a.current=T.nativeEvent.layout.height,y();},[y]),g=react.useCallback((T,I)=>{d.current=I,a.current>0&&(s.current=Math.min(s.current,Math.max(0,I-a.current))),y();},[y]),w=react.useCallback(T=>{s.current=T.nativeEvent.contentOffset.y;},[]),E=react.useCallback(()=>{n.current=false;},[]),S=react.useCallback(T=>{let{contentOffset:I,contentSize:m,layoutMeasurement:R}=T.nativeEvent;s.current=I.y,n.current=m.height-I.y-R.height<=24;},[]),_=react.useCallback(T=>I=>{l.current.set(T,I.nativeEvent.layout.y),(T===c||T===p)&&y();},[c,p,y]);return {ref:r,onLayout:b,onContentSizeChange:g,onScroll:w,onScrollBeginDrag:E,onScrollEnd:S,rowLayout:_}}i(ld,"useThreadFollow");function fd(e,t,r){switch(e){case "loading":return r.renderPending?jsxRuntime.jsx(Be,{render:r.renderPending,fallback:jsxRuntime.jsx(ud,{})}):jsxRuntime.jsx(ud,{});case "empty":return jsxRuntime.jsx(Ig,{pet:r.shownPet,petRef:t.petRef,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,onVetPrep:r.onVetPrep,vet:r.vet});case "error":return jsxRuntime.jsx(Og,{error:t.error,onRetry:t.retryLast,onAddPet:r.onAddPet});case "populated":return jsxRuntime.jsx(Fg,{messages:t.messages,prompts:t.suggestedPrompts,onSelectPrompt:r.onSelectPrompt,isStreaming:t.isStreaming,onAnswerCheckin:t.petRef?t.answerCheckin:null,onCopy:r.onCopy,sentimentByMessage:t.sentimentByMessage,onSentiment:r.onSentiment,thanksFor:r.thanksFor,imagesByMessage:r.imagesByMessage,onPreview:r.onPreview,notice:r.notice,reconnecting:t.reconnecting===true,onRetry:t.retryLast,onStartNew:t.newConversation,petRef:t.petRef,onFindVet:r.onCheckinFindVet,vet:r.vet,onOpenUrl:r.onOpenUrl});default:return Gt(e)}}i(fd,"renderView");function ud(){let{theme:e,styles:t}=pe(),[r,n]=react.useState(false);return react.useEffect(()=>{let o=setTimeout(()=>n(true),ul);return ()=>clearTimeout(o)},[]),jsxRuntime.jsx(reactNative.View,{style:t.centered,accessible:true,accessibilityState:{busy:true},accessibilityLabel:f.loading,children:r?jsxRuntime.jsx(reactNative.ActivityIndicator,{color:e.color.brandInk}):null})}i(ud,"LoadingState");function Ig({pet:e,petRef:t,prompts:r,onSelectPrompt:n,onVetPrep:o,vet:s}){let{styles:a}=pe();return jsxRuntime.jsxs(reactNative.ScrollView,{contentContainerStyle:a.emptyContent,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,accessibilityLabel:f.empty,children:[jsxRuntime.jsx(Kl,{pet:e,petRef:t,onSend:n,onVetPrep:o,vet:s}),jsxRuntime.jsx(yd,{prompts:r,onSelectPrompt:n})]})}i(Ig,"EmptyState");function yd({prompts:e,onSelectPrompt:t}){let{styles:r}=pe();return e.length===0?null:jsxRuntime.jsx(reactNative.View,{style:r.followUps,children:e.map((n,o)=>jsxRuntime.jsx(Ag,{prompt:n,index:o,onSelectPrompt:t},n))})}i(yd,"FollowUps");function Ag({prompt:e,index:t,onSelectPrompt:r}){let{theme:n,styles:o}=pe(),s=G(),a=We(s.followUpInMs,{delayMs:cr(s,t)});return jsxRuntime.jsx(reactNative.Animated.View,{style:a,children:jsxRuntime.jsxs(N,{onPress:()=>r(e),accessibilityRole:"button",accessibilityLabel:e,containerStyle:o.followUpSlot,style:o.followUpRow,children:[jsxRuntime.jsx(v,{style:o.followUpText,children:e}),jsxRuntime.jsx(lr,{size:Vg,color:n.color.brandInk,direction:"right"})]})})}i(Ag,"FollowUpRow");function Og({error:e,onRetry:t,onAddPet:r}){let{styles:n}=pe(),o=Fi(e)?zi(r):void 0;return jsxRuntime.jsxs(reactNative.View,{style:n.centered,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{style:n.errorText,children:e.displayMessage}),o!==void 0?jsxRuntime.jsx(reactNative.Pressable,{onPress:o,accessibilityRole:"button",accessibilityLabel:f.addPet,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.addPet})}):null,e.retryable?jsxRuntime.jsx(reactNative.Pressable,{onPress:t,accessibilityRole:"button",accessibilityLabel:f.retry,style:n.retryButton,children:jsxRuntime.jsx(v,{tier:"control",style:n.retryLabel,children:f.retry})}):null]})}i(Og,"ErrorState");function Fg({messages:e,prompts:t,onSelectPrompt:r,isStreaming:n,onAnswerCheckin:o,onCopy:s,sentimentByMessage:a,onSentiment:d,thanksFor:l,imagesByMessage:u,onPreview:c,notice:p,reconnecting:y,onRetry:b,onStartNew:g,petRef:w,onFindVet:E,vet:S,onOpenUrl:_}){let{styles:T}=pe(),I=G();Pt(e.length,I);let m=react.useMemo(()=>hl(e),[e]),R=is(e,n),O=e[e.length-1],F=react.useMemo(()=>e.filter(h=>!(h.checkin&&m.get(h.id)?.kind==="folded")),[e,m]),P=ld(F,n);return jsxRuntime.jsxs(reactNative.ScrollView,{ref:P.ref,style:T.list,contentContainerStyle:T.listContent,accessibilityLabel:f.transcript,keyboardShouldPersistTaps:"handled",nestedScrollEnabled:true,onLayout:P.onLayout,onContentSizeChange:P.onContentSizeChange,onScroll:P.onScroll,scrollEventThrottle:Dg,onScrollBeginDrag:P.onScrollBeginDrag,onScrollEndDrag:P.onScrollEnd,onMomentumScrollEnd:P.onScrollEnd,children:[e.map(h=>{let x=h.checkin?m.get(h.id):void 0;return x?.kind==="folded"?null:x?.kind==="past"?jsxRuntime.jsx(wl,{text:h.text,runDueDays:x.runDueDays,openedAt:h.checkin?.openedAt,onLayout:P.rowLayout(h.id)},h.id):h.checkin&&x!==void 0?jsxRuntime.jsx(Tl,{message:h,checkin:h.checkin,onAnswer:o,petRef:w,onFindVet:E,vet:S,onLayout:P.rowLayout(h.id)},h.id):jsxRuntime.jsx(Ng,{onLayout:P.rowLayout(h.id),message:h,revealing:n&&h===O&&h.role==="assistant",onCopy:s,sentiment:h.responseId===void 0?null:a[String(h.responseId)]??null,onSentiment:d,thanks:l!==null&&h.responseId!==void 0&&String(h.responseId)===l,images:u[h.id]??Lg,onPreview:c,onOpenUrl:_},h.id)}),y?jsxRuntime.jsx(v,{tier:"compact",style:T.reconnectingCaption,accessibilityRole:"text",children:f.reconnecting}):null,R?jsxRuntime.jsx(od,{}):null,p!==null?jsxRuntime.jsx(Mg,{notice:p,onRetry:b,onStartNew:g}):null,n?null:jsxRuntime.jsx(yd,{prompts:t,onSelectPrompt:r})]})}i(Fg,"PopulatedState");function Mg({notice:e,onRetry:t,onStartNew:r}){let{styles:n}=pe(),o=e.tone==="error";return jsxRuntime.jsxs(reactNative.View,{style:[n.turnNotice,o?n.turnNoticeError:null],accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"control",style:[n.turnNoticeTitle,o?n.turnNoticeTitleError:null],children:e.title}),jsxRuntime.jsx(v,{tier:"compact",style:n.turnNoticeBody,children:e.body}),jsxRuntime.jsx(reactNative.Pressable,{onPress:e.action==="startNew"?r:t,accessibilityRole:"button",accessibilityLabel:e.actionLabel,hitSlop:ut,style:n.turnNoticeAction,children:jsxRuntime.jsx(v,{tier:"control",style:n.turnNoticeActionLabel,children:e.actionLabel})})]})}i(Mg,"TurnNoticeCard");var Lg=Object.freeze([]),Dg=16,Vg=14;function Ng({message:e,revealing:t,onCopy:r,sentiment:n,onSentiment:o,thanks:s,images:a,onPreview:d,onOpenUrl:l,onLayout:u}){let{styles:c}=pe(),p=G(),y=We(p.messageInMs),b=Hs(e.text,t,p),g=e.role==="user",w=g?f.senderUser:f.senderAssistant,E=react.useCallback(_=>o(e,_),[o,e]),S=e.pending!==true;return jsxRuntime.jsxs(reactNative.Animated.View,{style:[c.rowBlock,g?c.rowBlockUser:c.rowBlockAssistant,y],onLayout:u,children:[jsxRuntime.jsx(reactNative.View,{style:[c.row,g?c.rowUser:c.rowAssistant],accessible:true,accessibilityRole:"text",accessibilityLabel:`${w}: ${e.text}`,accessibilityState:e.pending===true?{busy:true}:void 0,children:jsxRuntime.jsxs(reactNative.View,{style:[c.bubble,g?c.bubbleUser:c.bubbleAssistant,e.pending?c.bubblePending:null],children:[g&&a.length>0?jsxRuntime.jsx(oa,{images:a,onPreview:_=>d({uri:_.uri,label:_.filename})}):null,jsxRuntime.jsx(v,{style:g?c.bubbleTextUser:c.bubbleTextAssistant,children:g?e.text:Ql(b,{bold:c.bubbleBold,italic:c.bubbleItalic,code:c.bubbleCode})})]})}),!g&&!t?jsxRuntime.jsx(Ml,{citations:e.citations,onOpenUrl:l}):null,S?jsxRuntime.jsx(Ul,{message:e,onCopy:r,sentiment:n,onSentiment:e.responseId===void 0?void 0:E,thanks:s}):null]})}i(Ng,"MessageRow");var jg=Object.freeze(["photo"]),Wg=1;function Gg(e){let{style:t,renderPending:r}=e;return jsxRuntime.jsx(ps,{capability:"chat",style:t,...r?{renderPending:r}:{},children:jsxRuntime.jsx(qg,{...e})})}i(Gg,"EverfurChat");function qg({petRef:e,conversationId:t,style:r,renderPending:n,onCopy:o,onPetChange:s,onVetPrep:a,onFindVet:d,renderVetAction:l,attachments:u,pet:c,onAddPet:p,checkinTarget:y,initialAsk:b,composerSeed:g,lifecycle:w,draftStore:E,vetReturnTo:S,vetUsState:_,vetPrefer:T,onOpenUrl:I,keyboardVerticalOffset:m}){let{theme:R,styles:O}=pe(),F=G(),P=react.useMemo(()=>ss(e,t),[e,t]),h=zt(P),x=ns(h),D=rl(),U=Zi(h),z=reactNativeSafeAreaContext.useSafeAreaInsets(),Z=os(h),le=react.useMemo(()=>d===void 0?void 0:()=>{W(d,"emergency");},[d]),ge=react.useMemo(()=>S===void 0&&_===void 0&&T===void 0?void 0:{returnTo:S,usState:_,prefer:T},[S,_,T]),Ne=Xn(D.pets,h.petRef),oe=react.useMemo(()=>ts(h.messages,Ne?.name??null),[h.messages,Ne?.name]),Fe=rs(oe);Pt(Fe.showBanner,F),Gi(h.openCheckin,y),Ni(h.askEverfur,h.isBootstrapping,b);let Lt=react.useMemo(()=>nn(g),[g]);ji(w,{conversationId:h.conversationId===null?null:String(h.conversationId),isTurnInFlight:h.isStreaming,refresh:h.refreshActiveThread});let Dt=(h.hasUnreadThreads??false)||U.rows.some(fe=>fe.unreadCount!==null&&fe.unreadCount>0)||(h.unreadCount??0)>0,et=Di(h.messages),[ft,Mr]=react.useState(null),gd=react.useCallback(()=>Mr(null),[]),[yt,Lr]=react.useState(null),[bd,mo]=react.useState(null),tt=react.useRef(null);react.useEffect(()=>()=>{tt.current&&clearTimeout(tt.current);},[]);let ho=react.useCallback(fe=>{mo(String(fe)),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{mo(null),tt.current=null;},cl);},[]),vd=react.useCallback((fe,Nt)=>{let mt=fe.responseId;if(mt===void 0)return;let Pd=h.sentimentByMessage[String(mt)];h.feedback(mt,Nt),Nt==="down"&&Pd!=="down"&&Lr(mt);},[h]),Cd=react.useCallback(async(fe,Nt)=>yt===null||!(await h.feedback(yt,"down",fe??"other",Nt)).ok?false:(Lr(null),ho(yt),true),[h,yt,ho]),Ed=react.useCallback(()=>Lr(null),[]),Rd=react.useCallback(fe=>{h.send(fe);},[h.send]),Sd=react.useMemo(()=>I===void 0?void 0:fe=>{W(I,fe,"citation");},[I]),go=reactNative.Platform.OS==="ios"?"padding":void 0,Vt=Xa(m,go!==void 0),Td=Vt.topInWindow===null?z.top:Math.max(0,z.top-Vt.topInWindow),bo={send:h.send,stop:h.stop,isStreaming:h.isStreaming,conversationId:h.conversationId,seed:Lt,draftStore:E,onStage:et.stage,onPreview:Mr};return jsxRuntime.jsxs(reactNative.KeyboardAvoidingView,{style:[O.container,{paddingTop:Td},r],behavior:go,...Vt.avoidingProps,children:[jsxRuntime.jsx(Qa,{probeRef:Vt.probeRef}),jsxRuntime.jsx(Ba,{pets:D,petRef:h.petRef,historyUnread:Dt,onOpenHistory:U.show,onPetChange:s,onAddPet:p,vet:ge}),c!==void 0?jsxRuntime.jsx(Yg,{petRef:e??null,pet:c,onRegistered:D.refresh}):null,jsxRuntime.jsx(tl,{surface:Fe,petRef:h.petRef,renderVetAction:l,onFindVet:d,vet:ge}),jsxRuntime.jsx(reactNative.View,{style:O.body,children:fd(x,h,{notice:Z,vet:ge,onCheckinFindVet:le,onSelectPrompt:Rd,renderPending:n,shownPet:Ne,onVetPrep:a,onCopy:o,onSentiment:vd,thanksFor:bd,imagesByMessage:et.byMessage,onPreview:Mr,onAddPet:p,onOpenUrl:Sd})}),u!==void 0?jsxRuntime.jsx(Kg,{...bo,attachments:u}):jsxRuntime.jsx(hd,{...bo,attachments:null}),jsxRuntime.jsx(hs,{}),R.meta.hidePoweredBy?null:jsxRuntime.jsx(v,{tier:"compact",style:O.poweredBy,accessibilityRole:"text",accessibilityLabel:f.poweredBy,children:f.poweredBy}),jsxRuntime.jsx($a,{chat:h,history:U}),jsxRuntime.jsx(Ka,{visible:yt!==null,onSubmit:Cd,onSkip:Ed}),jsxRuntime.jsx(Us,{uri:ft?.uri??null,label:ft?.label??"",onClose:gd}),jsxRuntime.jsx(kt,{})]})}i(qg,"ChatBody");function Yg({petRef:e,pet:t,onRegistered:r}){let{styles:n}=pe(),o=Mi(e,t,r);return o.status!=="failed"||o.error===null?null:jsxRuntime.jsxs(reactNative.View,{style:n.setupNotice,accessible:true,accessibilityRole:"alert",children:[jsxRuntime.jsx(v,{tier:"compact",style:n.setupNoticeText,children:o.error.displayMessage}),jsxRuntime.jsx(reactNative.Pressable,{onPress:o.retry,accessibilityRole:"button",accessibilityLabel:f.retry,hitSlop:ut,children:jsxRuntime.jsx(v,{tier:"control",style:n.setupNoticeAction,children:f.retry})})]})}i(Yg,"PetSetupNotice");function Kg({attachments:e,...t}){let r=react.useMemo(()=>In(),[]),n=Xr({maxPerMessage:e.maxPerMessage??Wg,transport:r}),o=react.useMemo(()=>({state:n,sources:e.sources??jg,pick:e.pick}),[n,e.sources,e.pick]);return jsxRuntime.jsx(hd,{...t,attachments:o})}i(Kg,"ComposerWithAttachments");function hd({send:e,stop:t,isStreaming:r,conversationId:n,attachments:o,seed:s,draftStore:a,onStage:d,onPreview:l}){let{theme:u,styles:c}=pe(),p=G(),[y,b]=Ki(e,n,s);$i(a,n===null?null:String(n),y,b);let[g,w]=react.useState(false),[E,S]=react.useState(false);react.useEffect(()=>{S(false);},[n]);let _=u.meta.placeholder??f.placeholder,T=o?.state.uploading??false,I=o?.state.failed??false,m=T||I,R=o?.state.attachments??$g;Pt(R.length,p);let O=react.useCallback(()=>{if(y.trim().length===0||m||[...y].length>$t)return;let z=o?.state.s3Keys??Xg;o!==null&&z.length>0?(d(o.state.attachments.filter(Z=>Z.status==="uploaded").map(Z=>({uri:Z.previewUri,filename:Z.filename}))),e(y,{imageS3Keys:z}),o.state.clear()):e(y),b(""),S(false);},[y,e,m,o,d]),F=react.useCallback(()=>{t();},[t]),P=react.useCallback(z=>{w(false),o!==null&&(S(false),o.state.dismissRejected(),ot(o.pick,z).then(Z=>{if(!Z.ok){S(true);return}Z.value!==null&&o.state.add(Z.value);}));},[o]),x=react.useMemo(()=>[...y].length>$t,[y])||m,D=o!==null&&R.length>=o.state.maxPerMessage,U=u.slots.sendButton?.textColor??u.color.brandInk;return jsxRuntime.jsxs(reactNative.View,{style:c.composerOuter,children:[o!==null&&g?jsxRuntime.jsx(js,{sources:o.sources,full:D,onPick:P,onClose:()=>w(false)}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composer,children:[o!==null?jsxRuntime.jsx(na,{attachments:R,rejected:E?Qg:o.state.rejected,uploadFailed:I,onRetry:o.state.retry,onRemove:o.state.remove,onPreview:z=>l({uri:z.previewUri,label:z.filename})}):null,jsxRuntime.jsxs(reactNative.View,{style:c.composerRow,children:[o!==null?jsxRuntime.jsx(reactNative.Pressable,{accessibilityRole:"button",accessibilityLabel:si(R.length,o.state.maxPerMessage),accessibilityState:{disabled:D,expanded:g},disabled:D,hitSlop:(dt-xr)/2,style:[c.attachControl,D?c.attachControlDisabled:null],onPress:()=>w(z=>!z),children:jsxRuntime.jsx(Ts,{size:yl,color:D?u.color.text.muted:u.color.brandInk,strokeWidth:1.75})}):null,jsxRuntime.jsx(rt,{style:c.input,value:y,onChangeText:b,placeholder:_,placeholderTextColor:u.slots.composerInput?.textColor??u.color.text.placeholder,onSubmitEditing:O,returnKeyType:"send",blurOnSubmit:false,multiline:true,editable:true}),r?jsxRuntime.jsx(reactNative.Pressable,{onPress:F,accessibilityRole:"button",accessibilityLabel:f.stop,hitSlop:ut,style:c.sendControl,children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-stop-disc",children:jsxRuntime.jsx(As,{size:fl,color:U,testID:"everfur-stop-glyph"})})}):jsxRuntime.jsx(reactNative.Pressable,{onPress:O,disabled:x,accessibilityRole:"button",accessibilityLabel:f.send,accessibilityState:{disabled:x,busy:T},hitSlop:ut,style:[c.sendControl,x?c.sendControlDisabled:null],children:jsxRuntime.jsx(reactNative.View,{style:c.sendDisc,testID:"everfur-send-disc",children:jsxRuntime.jsx(Is,{size:pl,color:U,testID:"everfur-send-glyph"})})})]})]})]})}i(hd,"Composer");var $g=Object.freeze([]),Xg=Object.freeze([]),Qg=Object.freeze({code:"unknown",retryable:true,filename:""});exports.EverfurChat=Gg;exports.createRnChatAttachmentTransport=In;exports.useChatAttachments=Xr;exports.useEverfurChat=zt;exports.useEverfurPets=On;
|