@everfur/sdk 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/{Chat-C8OR_AI2.d.ts → Chat-C9dVhnyt.d.ts} +3 -3
  3. package/dist/{Chat-GrVxqwYw.d.cts → Chat-WmdRwC3b.d.cts} +3 -3
  4. package/dist/{DepthViews-CUjaiKlo.d.ts → DepthViews-CBoI9EYy.d.ts} +1 -1
  5. package/dist/{DepthViews-CKO66Myd.d.ts → DepthViews-CmxhM8iP.d.ts} +1 -1
  6. package/dist/{DepthViews-DGH2wGj_.d.cts → DepthViews-DoODlUnQ.d.cts} +1 -1
  7. package/dist/{DepthViews-D37_RviC.d.cts → DepthViews-NPFtO5Kz.d.cts} +1 -1
  8. package/dist/animations/index.cjs +1 -1
  9. package/dist/animations/index.d.cts +3 -3
  10. package/dist/animations/index.d.ts +3 -3
  11. package/dist/animations/index.js +1 -1
  12. package/dist/{attachments-BB1UJWnE.d.ts → attachments-CuFT1o5q.d.ts} +5 -5
  13. package/dist/{attachments-whGKD6W3.d.cts → attachments-OaW36D0H.d.cts} +2 -2
  14. package/dist/{attachments-CGwqUqKv.d.ts → attachments-R2oajKPT.d.ts} +2 -2
  15. package/dist/{attachments-BoAvTNhc.d.cts → attachments-c4mJcIWU.d.cts} +5 -5
  16. package/dist/{bookingCopy-CR1OG51t.d.cts → bookingCopy-DGQPrisa.d.cts} +2 -2
  17. package/dist/{bookingCopy-fV30DkIz.d.ts → bookingCopy-EtPJ4nME.d.ts} +2 -2
  18. package/dist/{branding-xpQ056sM.d.ts → branding-DiaCIJZL.d.cts} +2 -2
  19. package/dist/{branding-Xb_wL8N1.d.cts → branding-Ry0em51L.d.ts} +2 -2
  20. package/dist/{casesRepository-C8Lbu2hu.d.ts → casesRepository-Cu8h8gQK.d.ts} +1 -1
  21. package/dist/{casesRepository-DQd1BzeU.d.cts → casesRepository-DB5c8AAo.d.cts} +1 -1
  22. package/dist/chat/index.cjs +1 -1
  23. package/dist/chat/index.d.cts +9 -9
  24. package/dist/chat/index.d.ts +9 -9
  25. package/dist/chat/index.js +1 -1
  26. package/dist/client/index.cjs +4 -4
  27. package/dist/client/index.d.cts +10 -10
  28. package/dist/client/index.d.ts +10 -10
  29. package/dist/client/index.js +4 -4
  30. package/dist/{config-1sjsfSqw.d.cts → config-DQFMkaTU.d.cts} +1 -1
  31. package/dist/{config-CRqlaRdm.d.ts → config-DlR_I-0S.d.ts} +1 -1
  32. package/dist/consent/index.cjs +1 -1
  33. package/dist/consent/index.d.cts +5 -5
  34. package/dist/consent/index.d.ts +5 -5
  35. package/dist/consent/index.js +1 -1
  36. package/dist/{context-CptFbEl3.d.ts → context-CLuquPRB.d.ts} +7 -7
  37. package/dist/{context-6TkTwYWz.d.cts → context-DZEieVJ5.d.cts} +7 -7
  38. package/dist/{copy-Cbh62Ahp.d.cts → copy-B2DOzSSy.d.cts} +2 -2
  39. package/dist/{copy-fyJWwXLB.d.ts → copy-ptTCT5-J.d.ts} +2 -2
  40. package/dist/core/index.cjs +7 -7
  41. package/dist/core/index.d.cts +15 -15
  42. package/dist/core/index.d.ts +15 -15
  43. package/dist/core/index.js +7 -7
  44. package/dist/{depth-CFvkrm5i.d.ts → depth-CtyC7HOF.d.ts} +2 -2
  45. package/dist/{depth-A0lzfsHw.d.cts → depth-DuOyvthD.d.cts} +2 -2
  46. package/dist/{entitlementRepository-B9Nrivmd.d.ts → entitlementRepository-CAtyh8Xt.d.ts} +3 -3
  47. package/dist/{entitlementRepository-CCY6wtld.d.cts → entitlementRepository-DlGwxZ1k.d.cts} +3 -3
  48. package/dist/{identity-CQ_S12DE.d.cts → identity-BC9AF3y4.d.cts} +1 -1
  49. package/dist/{identity-sKp5WoCR.d.ts → identity-D_NR9ucT.d.ts} +1 -1
  50. package/dist/index.cjs +6 -6
  51. package/dist/index.d.cts +16 -16
  52. package/dist/index.d.ts +16 -16
  53. package/dist/index.js +6 -6
  54. package/dist/notifications/index.d.cts +2 -2
  55. package/dist/notifications/index.d.ts +2 -2
  56. package/dist/{pets-CO8D9-_Q.d.cts → pets-D7UjvR1A.d.cts} +1 -1
  57. package/dist/{pets-u62Gt8RO.d.ts → pets-DuuNvKTK.d.ts} +1 -1
  58. package/dist/{petsRepository-3anNlfb7.d.ts → petsRepository-C28NKFwy.d.ts} +1 -1
  59. package/dist/{petsRepository-BXOEFjRd.d.cts → petsRepository-llMvpMkp.d.cts} +1 -1
  60. package/dist/photo/index.cjs +1 -1
  61. package/dist/photo/index.js +1 -1
  62. package/dist/{ports-DoJgREyr.d.cts → ports-Dbw2h_M1.d.cts} +25 -6
  63. package/dist/{ports-BlKQDOwZ.d.ts → ports-s45HNNyc.d.ts} +25 -6
  64. package/dist/records/depth/index.cjs +1 -1
  65. package/dist/records/depth/index.d.cts +7 -7
  66. package/dist/records/depth/index.d.ts +7 -7
  67. package/dist/records/depth/index.js +1 -1
  68. package/dist/records/index.cjs +3 -3
  69. package/dist/records/index.d.cts +9 -9
  70. package/dist/records/index.d.ts +9 -9
  71. package/dist/records/index.js +3 -3
  72. package/dist/{requestFunnel-Cz3zOMJo.d.ts → requestFunnel-CqwOiZNJ.d.ts} +2 -2
  73. package/dist/{requestFunnel-iJJcNuWp.d.cts → requestFunnel-D_o7se38.d.cts} +2 -2
  74. package/dist/{runtimeTypes-CrAbk27V.d.cts → runtimeTypes-BNBENMkz.d.cts} +5 -5
  75. package/dist/{runtimeTypes-L-KYBPq-.d.ts → runtimeTypes-DS0RLoKN.d.ts} +5 -5
  76. package/dist/server/events/index.cjs +1 -1
  77. package/dist/server/events/index.d.cts +2 -2
  78. package/dist/server/events/index.d.ts +2 -2
  79. package/dist/server/events/index.js +1 -1
  80. package/dist/server/index.cjs +1 -1
  81. package/dist/server/index.d.cts +3 -3
  82. package/dist/server/index.d.ts +3 -3
  83. package/dist/server/index.js +1 -1
  84. package/dist/televet/booking/index.cjs +1 -1
  85. package/dist/televet/booking/index.d.cts +6 -6
  86. package/dist/televet/booking/index.d.ts +6 -6
  87. package/dist/televet/booking/index.js +1 -1
  88. package/dist/televet/call/index.cjs +1 -1
  89. package/dist/televet/call/index.js +1 -1
  90. package/dist/televet/index.cjs +1 -1
  91. package/dist/televet/index.js +1 -1
  92. package/dist/testing/index.d.cts +1 -1
  93. package/dist/testing/index.d.ts +1 -1
  94. package/dist/testing/rn/index.cjs +1 -1
  95. package/dist/testing/rn/index.d.cts +9 -9
  96. package/dist/testing/rn/index.d.ts +9 -9
  97. package/dist/testing/rn/index.js +1 -1
  98. package/dist/testing/web/index.d.cts +9 -9
  99. package/dist/testing/web/index.d.ts +9 -9
  100. package/dist/{timelineRows-CtCZFBTj.d.cts → timelineRows-B6nCq30k.d.cts} +1 -1
  101. package/dist/{timelineRows-BORU0Ybg.d.ts → timelineRows-DacfDpDU.d.ts} +1 -1
  102. package/dist/{tokens-CIngRkvt.d.cts → tokens-DOTIxrws.d.cts} +8 -1
  103. package/dist/{tokens-CIngRkvt.d.ts → tokens-DOTIxrws.d.ts} +8 -1
  104. package/dist/{typeStyle-YPS_MXeI.d.ts → typeStyle-DROhJNkh.d.ts} +2 -2
  105. package/dist/{typeStyle-DHJzDaUo.d.cts → typeStyle-achxqQ-h.d.cts} +2 -2
  106. package/dist/{useRecordsDepth-C9jITKwj.d.cts → useRecordsDepth-BLK8W646.d.cts} +1 -1
  107. package/dist/{useRecordsDepth-CLtpeQHl.d.ts → useRecordsDepth-C7guUoLc.d.ts} +1 -1
  108. package/dist/video/index.cjs +1 -1
  109. package/dist/video/index.js +1 -1
  110. package/dist/{view-BDSk7WW0.d.ts → view-B6JsD22K.d.ts} +2 -2
  111. package/dist/{view-B7Mz1TyH.d.cts → view-BF9oW2GJ.d.cts} +2 -2
  112. package/dist/web/consent/index.cjs +1 -1
  113. package/dist/web/consent/index.d.cts +5 -5
  114. package/dist/web/consent/index.d.ts +5 -5
  115. package/dist/web/consent/index.js +1 -1
  116. package/dist/web/index.cjs +7 -7
  117. package/dist/web/index.d.cts +19 -19
  118. package/dist/web/index.d.ts +19 -19
  119. package/dist/web/index.js +7 -7
  120. package/dist/web/notifications/index.d.cts +3 -3
  121. package/dist/web/notifications/index.d.ts +3 -3
  122. package/dist/web/records/depth/index.cjs +1 -1
  123. package/dist/web/records/depth/index.d.cts +7 -7
  124. package/dist/web/records/depth/index.d.ts +7 -7
  125. package/dist/web/records/depth/index.js +1 -1
  126. package/dist/web/records/index.cjs +1 -1
  127. package/dist/web/records/index.d.cts +9 -9
  128. package/dist/web/records/index.d.ts +9 -9
  129. package/dist/web/records/index.js +1 -1
  130. package/dist/web/televet/booking/index.cjs +1 -1
  131. package/dist/web/televet/booking/index.d.cts +7 -7
  132. package/dist/web/televet/booking/index.d.ts +7 -7
  133. package/dist/web/televet/booking/index.js +1 -1
  134. package/dist/web/televet/call/index.cjs +1 -1
  135. package/dist/web/televet/call/index.js +1 -1
  136. package/dist/web/televet/index.cjs +1 -1
  137. package/dist/web/televet/index.js +1 -1
  138. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ns=Object.defineProperty;var o=(e,t)=>Ns(e,"name",{value:t,configurable:true});function dr(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(dr,"assertNever");function mi(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})}o(mi,"errorFrame");function tn(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(tn,"reportHostFailure");function Ms(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Ms,"isThenable");function ur(e,...t){if(typeof e=="function")try{let r=e(...t);return Ms(r)&&Promise.resolve(r).then(void 0,tn),r}catch(r){tn(r);return}}o(ur,"callHost");var gi=new WeakMap;function js(e){if(typeof e!="function")return;let t=gi.get(e);if(t!==void 0)return t;let r=o((...n)=>{ur(e,...n);},"guarded");return gi.set(e,r),r}o(js,"guardHost");function yt(e,t){let r=null;for(let n of t){let i=e[n];typeof i=="function"&&(r??={...e},r[n]=js(i));}return r??e}o(yt,"guardHostProps");function cr(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}))}o(cr,"callHostAsync");var g=o(e=>e,"DRAFT"),zs=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Hs(e){return zs.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Hs,"isPlaceholderCopy");function W(e,t){let r=e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(i);return r}o(W,"fill");var le=Object.freeze({stateBlockedTitle:g("Not available in this state yet"),noCliniciansTitle:g("No vets available right now"),noCliniciansBody:g("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:g("Check again"),noCliniciansRegionBody:g("Video visits have to be with a vet licensed in your state, and we don\u2019t have one there yet."),yourVetTitle:g("Your Vet"),reviewsLabel:g("reviews"),rescheduleFromTemplate:g("Moving your visit on {when}"),rescheduleFailed:g("That did not move. Your original time is unchanged."),keepExistingCta:g("Keep my current time"),bookingPausedTitle:g("Booking is not available right now."),slotsErrorTitle:g("Could not load times"),noSlotsTitle:g("No times available"),nextOpeningTemplate:g("Next opening across our vets: {when}"),seeOtherVetsCta:g("See other vets"),retryCta:g("Try again"),holdExpired:g("That time is no longer held. Pick another."),slotTaken:g("That time was just taken. Pick another."),reasonPlaceholder:g("What is going on with your pet?"),reasonTooLong:g("That is too long. Please shorten it."),shareRecordsOff:g("Share health records with this vet"),confirmNotEntitled:g("A Pro membership is needed to book a video visit."),confirmFailed:g("That did not book. Try again."),checkAvailabilityCta:g("Check availability"),stateInterest:Object.freeze({cta:g("Add me to the list"),submitting:g("Adding you to the list\u2026"),joinedTitle:g("You are on the list"),joinedBody:g("We will let you know when this changes."),failed:g("That did not save. Try again.")}),media:Object.freeze({droppedTemplate:g("{n} attachment did not upload."),droppedPluralTemplate:g("{n} attachments did not upload."),refusedSizeTemplate:g("{n} attachment was too large to send."),refusedSizePluralTemplate:g("{n} attachments were too large to send."),refusedTypeTemplate:g("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:g("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:g("{n} attachment could not be read."),refusedUnreadablePluralTemplate:g("{n} attachments could not be read.")}),navTitle:g("Book a visit"),rescheduleNavTitle:g("Change your visit"),close:g("Close"),continueCta:g("Continue"),petSelectTitle:g("Who is this visit for?"),addPetCta:g("Add a pet"),locationUnknownTitle:g("We need your location to find a vet"),locationUnknownBody:g("Turn on location for Everfur, then try again."),locationUnknownCta:g("Allow location"),locationBlockedTitle:g("Location is turned off"),locationBlockedBody:g("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:g("Open Settings"),locationUnavailableTitle:g("We could not read your location"),locationUnavailableBody:g("Try again in a moment."),stateAttestTemplate:g("I confirm my pet and I are in {state} right now."),describeHeading:g("Tell the vet what you are seeing"),describeHelpLong:g("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:g("ADD PHOTO OR VIDEO"),removePhotoLabel:g("Remove photo"),summaryPet:g("Pet"),summaryVet:g("Vet"),summaryWhen:g("When"),summaryLength:g("Length"),summaryReason:g("Reason"),summaryLengthTemplate:g("{n} minutes"),confirmCta:g("Confirm visit"),bookedTitle:g("You are booked."),addToCalendarCta:g("Add to calendar"),doneCta:g("Done"),booked:Object.freeze({remindPromise:g("We will notify you 30 minutes before."),summaryPromise:g("{pet}'s summary goes to the vet ahead of the call."),joinPromise:g("Join right here in the app. No links to hunt for."),backToPet:g("Back to {pet}"),calendarAdded:g("Added to your calendar"),calendarFailedBody:g("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:g("Closes without saving"),discardTitle:g("Leave without booking?"),discardBody:g("Your answers will not be saved."),discardConfirmCta:g("Leave"),discardKeepCta:g("Keep going"),noPetsTitle:g("No pets on this account"),loadFailedTitle:g("Could not load"),retryCta:g("Try again")}),emergency:Object.freeze({bannerTitle:g("This cannot wait for a scheduled call."),keepBookingCta:g("I have handled this, keep booking"),lede:g("What you are describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:g("Call {petName}'s primary vet"),exitFindErTitle:g("Find an emergency vet near you"),startCallHint:g("Starts a phone call")}),visit:Object.freeze({title:g("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function vi(e=le){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>vi(t))}o(vi,"televetBookingCopyValues");function Ne(){return vi().every(e=>e.trim().length>0&&!Hs(e))}o(Ne,"isTelevetBookingCopyReady");var mt=Object.freeze({findEmergencyVet:"Find an emergency vet near you",poisonControl:"ASPCA Animal Poison Control",poisonControlDetail:"(888) 426-4435 \xB7 a fee may apply",poisonControlTel:"tel:+18884264435"}),y=Object.freeze({...le,petSelectTitle:"Who is this visit for?",describeHeading:"Type to the vet what you're seeing",describeHelpLong:"Describe the issues your pet is experiencing",reasonPlaceholder:"She's been scratching her left ear a lot this week...",yourVetTitle:"Which vet would you like to see?",timeHeading:"Pick a date and time",reviewHeading:"Does this look right?",issuesHeadingTemplate:"Select {pet}\u2019s main issues",issuesHint:"Can select more than 1",otherIssue:"Other",bookedHeadingTemplate:"You're booked with {vet}",addToCalendarCta:"Add to Calendar",backLabel:"Back",emergency:Object.freeze({...le.emergency,bannerTitle:"This can't wait for a scheduled call.",lede:"What you're describing is the kind of thing vets want to see in person, now. Please call one of these first.",ledeWithoutExits:le.emergency.lede,keepBookingCta:"I've handled this, continue with booking",exitPrimaryVetTitle:"Call {petName}'s primary vet"})});var rn=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(rn.map(e=>e.wireCode));var Us=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"}),hi=Object.freeze(rn.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Us[e.wireCode]}))),Ws=new Map(hi.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),$s=Object.freeze(["http_envelope",...[...new Set(hi.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function pr(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...$s]){let i=Ws.get(n+r);if(i)return i}}o(pr,"contractErrorFor");function Ks(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Ks,"contractDocUrl");function Ti(e){return null}o(Ti,"publishedDocUrl");var qs=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 Si(e){return qs[e]}o(Si,"categoryFor");function Ei(e){let t=pr(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"}}o(Ei,"fromWire");var Ys=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function nn(e){return Ys.has(e)}o(nn,"isAutoRetryable");var Gs=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ci(e){return nn(e)||Gs.has(e)}o(Ci,"isRetryableCode");var Js=500,on=8e3,ki=4;function xi(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Js*2**r,on);return Math.floor(t()*n)}o(xi,"backoffDelayMs");var Xs=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 ln(e){return Xs[e]}o(ln,"userFacingError");function Ri(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Ri,"defineHidden");var Qs=/^[a-z][a-z0-9_]{0,63}$/;function te(e,t){let r=pr(t?.wireCode,t?.wireEnvelope),n={code:e,category:Si(e),retryable:t?.retryable??Ci(e),displayMessage:ln(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Qs.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Ri(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Ri(n,"raw",t.raw),Object.freeze(n)}o(te,"makeEverfurError");function F(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(F,"ok");function R(e){return Object.freeze({ok:false,error:e})}o(R,"err");var fr=class fr extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,fr.prototype);}};o(fr,"EverfurConfigError");var Bt=fr;function Zs(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}o(Zs,"authHeaders");function Lt(e,t){return {...e,headers:{...ed(e.headers),...Zs(t)}}}o(Lt,"withAuthHeaders");function ed(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=n);}return t}o(ed,"stripAuthHeaders");async function _i(e,t){if(t.mode==="anonymous")return t.transport.request(Lt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return R(an())}let n=await t.transport.request(Lt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return R(an())}let l=await t.transport.request(Lt(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?R(an(l.error.httpStatus)):l}o(_i,"authedSend");function an(e){return te("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(an,"authRejectedError");function Pi(e){return te("internalError",{retryable:true,wireMessage:td(e)})}o(Pi,"networkError");function td(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(td,"describeCause");var sn=3e4,rd=on*2,nd="idempotency-key",od=new Set(["POST","PUT","PATCH","DELETE"]),id=Object.freeze({onEvent(){}}),ld=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function ad(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o(ad,"seededIdempotencyKey");function et(e){let t=e.observer??id,r=e.timers??ld,n=e.rng??Math.random,i=e.sleep??((m,c)=>Td(m,r,c)),l=e.maxAttempts??ki,s=e.unaryTimeoutMs??sn,a=e.newIdempotencyKey??dn(),d=o(m=>{try{t.onEvent(m);}catch{}},"emit");async function u(m,c,v){let b=v?.maxAttempts,h=Math.max(1,b??l),S=v?.idempotent??od.has(c.method),E=v?.idempotencyKey===void 0?null:ad(v.idempotencyKey),k=S?E??a():null,L=sd(c,k),x=0;for(;;){let A=o(ee=>Object.freeze({call:m,method:c.method,path:c.path,attempt:x,...k?{idempotencyKey:k}:{},...ee}),"stamp");d(A({phase:"attempt"}));let z=bd(s,r),H=hd(z.signal,c.signal),X;try{X=await _i({...L,signal:H.signal},e.auth);}catch(ee){X=R(Pi(ee));}finally{H.dispose(),z.cancel();}if(X.ok)return d(A({phase:"settled",ok:true,reason:"ok"})),X;let D=X.error,G=ud(D,x,{maxAttempts:h,rng:n,now:r.now(),aborted:c.signal?.aborted===true,...b!==void 0?{perCallMaxAttempts:b}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),q={ok:false,code:D.code,reason:G.reason,...D.httpStatus!==void 0?{httpStatus:D.httpStatus}:{},...D.requestId!==void 0?{requestId:D.requestId}:{}};if(!G.retry)return d(A({phase:"settled",...q})),R(D);if(d(A({phase:"retry",...q,delayMs:G.delayMs})),await i(G.delayMs,c.signal),c.signal?.aborted===true)return d(A({phase:"settled",...q,reason:"aborted"})),R(D);x+=1;}}o(u,"send");async function p(m){return Lt(m,await vd(e.auth))}o(p,"authorize");async function*f(m,c,v){d(Object.freeze({call:m,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,v);}catch{yield mi({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(f,"stream"),Object.freeze({send:u,authorize:p,stream:f})}o(et,"createRequestFunnel");function sd(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==nd&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(sd,"assembleHeaders");function dn(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(dn,"defaultIdempotencyKeyFactory");var dd=10;function ud(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=cd(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!nn(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=o(()=>{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(dd,Math.floor(u)))},"policyCeiling"),a=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=a)return {retry:false,reason:"attempts-exhausted"};let d=pd(e,r.now);return d!==null?d>rd?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:xi(t,r.rng)}}o(ud,"decideRetry");function cd(e){let t=e.code==="unknown"?Ei(gd(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(cd,"throttleKind");function pd(e,t){let r=yd(e.raw);if(r!==null){let i=r-t;return i>0?i:0}let n=fd(e.raw);return n===null?null:Math.round(n*1e3)}o(pd,"retryOverrideMs");function fd(e){for(let t of un(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}o(fd,"findRetryAfterSeconds");function yd(e){for(let t of un(e)){let r=t.resets_at,n=md(r);if(n!==null)return n}return null}o(yd,"findResetsAt");function un(e){if(!wi(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];wi(n)&&t.push(n);}return t}o(un,"candidateScopes");function md(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}o(md,"parseInstantMs");function gd(e){for(let t of un(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(gd,"rawWireCode");function wi(e){return typeof e=="object"&&e!==null}o(wi,"isRecord");async function vd(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}:{}}}o(vd,"resolveDeviceAuth");function bd(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(bd,"boundedSignal");function hd(e,t){let r=o(()=>{},"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 i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(hd,"mergeSignals");function Td(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n();},e),l=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",l,{once:true});})}o(Td,"delayAbortable");var Bi="televet_booking_not_live";function yr(e){return te("conflict",{retryable:false,reasonCode:Bi,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}o(yr,"televetBookingNotLiveError");var cn="televet_booking_key_reused",Ii="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function mr(e){return e.httpStatus!==409||e.reasonCode===cn||Nt(e)?.code!==Ii?e:te(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:Ii,reasonCode:cn,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}o(mr,"foldTelevetBookingKeyReused");function Nt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(Nt,"details");function Sd(e){let t=Nt(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(Sd,"categoriesOf");function Oi(e){let t=Nt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Oi,"retryAfterOf");function Ai(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=Nt(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o(Ai,"messageOf");function Ed(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=Nt(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(Ed,"codeOf");function Ue(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Oi(e),message:Ai(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(Ed(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Oi(e),message:Ai(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:Sd(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case Bi:return Object.freeze({kind:"slot_taken"});case cn:return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Ue,"televetBookingRefusal");function Cd(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}o(Cd,"isSafeRoomUrl");function kd(e,t){return Cd(e)&&t.trim().length>0}o(kd,"isUsableRoomCredential");function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(gr,"isRecord");function pn(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}o(pn,"wholeNumber");function xd(e){if(!gr(e))return null;let t=pn(e.consult_minutes,1),r=pn(e.auto_end_minutes,0),n=pn(e.warn_before_seconds,0);return t===null||r===null||n===null?null:Object.freeze({consultMinutes:t,autoEndMinutes:r,warnBeforeSeconds:n})}o(xd,"parseCallLimits");function fn(e){if(!gr(e))return null;let t=e.room_url??e.url,r=e.token;if(typeof t!="string"||typeof r!="string"||!kd(t,r))return null;let n=e.recording_notice;return Object.freeze({roomUrl:t.trim(),token:r,recordingNotice:typeof n=="boolean"?n:true,callLimits:xd(e.call_limits)})}o(fn,"parseVetCallCredential");function yn(e){let t=Li(e.raw);return t!==null&&t.length>0?t:null}o(yn,"vetCallJoinReason");function Li(e){if(!gr(e))return null;let t=e.detail??e.error,n=(gr(t)?t:e).reason;return typeof n=="string"?n:null}o(Li,"reasonOf");function mn(e){if(e.httpStatus===404)return "unavailable";let t=Li(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}o(mn,"vetCallJoinRefusal");var Di=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],vr=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),Rd=new Set(["scheduled","in_progress","awaiting_summary"]);function br(e){return Rd.has(e.status)}o(br,"isLiveConsult");var Fi=["wellness","prescription"],_d=60;function vn(e){let t=Date.parse(e.startsAt),r=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(r))return null;let n=Math.round((r-t)/6e4);return n>0?Math.min(n,_d):null}o(vn,"televetSlotMinutes");var hr=64,$e=2e3,Tr=10;function _e(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(_e,"isWellFormedStateCode");function De(e){return typeof e=="object"&&e!==null?e:null}o(De,"row");function Q(e){return typeof e=="string"&&e.length>0?e:null}o(Q,"str");function We(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(We,"trimmedOrNull");function gt(e,t){return typeof e=="boolean"?e:t}o(gt,"bool");function gn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(gn,"num");function Ni(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(Ni,"closed");function vt(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let i=t(n);i!==null&&r.push(i);}return Object.freeze(r)}o(vt,"parseList");function Mi(e,t){let r=De(e);return r===null?null:Object.freeze({state:Q(r.state)??t,wellnessAvailable:gt(r.wellness_available,false),prescriptionsAvailable:gt(r.prescriptions_available,false),cancellationPolicyText:We(r.cancellation_policy_text)})}o(Mi,"parseStatePolicy");function ji(e){let t=De(e);if(t===null)return null;let r=We(t.summary),n=We(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(ji,"parseCancellationPolicy");function zi(e){let t=De(e);if(t===null)return null;let r=Q(t.clinician_id),n=Q(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:We(t.credentials_text),rating:gn(t.rating),ratingCount:gn(t.rating_count),bio:We(t.bio),photoRef:Q(t.photo_ref),licensedStates:vt(t.licensed_states,i=>{let l=De(i),s=l===null?null:Q(l.state);return s===null?null:Object.freeze({state:s,canPrescribe:gt(l?.can_prescribe,false)})})})}o(zi,"parseClinician");function bn(e){let t=De(e);if(t===null)return null;let r=Q(t.slot_id),n=Q(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:Q(t.ends_at)??n})}o(bn,"parseSlot");function Hi(e){let t=De(e);if(t===null)return null;let r=Q(t.slot_id),n=Q(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(Hi,"parseSlotHold");function Dt(e){let t=De(e);if(t===null)return null;let r=Q(t.consult_id),n=Q(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:Q(t.pet_id)??"",clinicianId:Q(t.clinician_id)??"",clinicianName:We(t.display_name),reasonText:We(t.reason_text),mediaRefs:vt(t.media_refs,i=>Q(i)),status:Ni(Di,t.status),kind:Ni(Fi,t.kind),scheduledAt:n,emergencyFlagged:gt(t.emergency_flagged,false),hasRoom:Q(t.meeting_url)!==null})}o(Dt,"parseConsult");function Vi(e){let t=De(e);return Object.freeze({active:gt(t?.active,false)})}o(Vi,"parseBookingEntitlement");var Ke=240;function Ui(e){let t=De(e);if(t===null)return null;let r=gn(t.fee_cents);return r===null||r<0?null:Object.freeze({feeCents:r,currency:Q(t.currency)??"usd",feeRecorded:gt(t.fee_recorded,r>0),summary:We(t.summary)})}o(Ui,"parseCancelReceipt");var qe="/widget/v1/televet",Pd=`${qe}/state-policy`,wd=`${qe}/vets`,Wi=`${qe}/slots`,Id=`${qe}/slots/next`,Sr=`${qe}/consults`,Od=`${qe}/entitlement`,Ad=`${qe}/cancellation-policy`;function $i(e){return `${Wi}/${encodeURIComponent(e)}/hold`}o($i,"televetHoldCall");function Ki(e){return `${Sr}/${encodeURIComponent(e)}/reschedule`}o(Ki,"televetRescheduleCall");function Er(e){return `${Sr}/${encodeURIComponent(e)}`}o(Er,"televetConsultCall");function qi(e){return `${Er(e)}/join`}o(qi,"televetJoinCall");function Yi(e){return `${Er(e)}/cancel`}o(Yi,"televetCancelCall");var Gi=100;function ce(e){return R(te("validationFailed",{retryable:false,wireMessage:e}))}o(ce,"invalid");function tt(e){return R(te("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(tt,"unusable");function hn(e){return e.httpStatus===404}o(hn,"isDark");function bt(e,t,r){try{e?.track(t,r);}catch{}}o(bt,"safeTrack");function Ji(e){if(e.pet_id.trim().length===0)return "pet_id is required";if(e.clinician_id.trim().length===0)return "clinician_id is required";if(e.slot_id.trim().length===0)return "slot_id is required";if(!_e(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>$e?`reason_text must be at most ${$e} characters`:Bd(e)}o(Ji,"validateBookingBody");function Bd(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>hr?`cancellation_policy_version must be at most ${hr} characters`:null}o(Bd,"attestationRefusal");function Sn(e){let t=e.funnel??et({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,i){let l=n.trim();if(!_e(l))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.state_policy",{method:"GET",path:`${Pd}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!s.ok)return R(s.error);let a=Mi(s.value,l);return a===null?tt("the state policy response was unreadable"):F(a)},async entitlement(n){let i=await t.send("televet.booking.entitlement",{method:"GET",path:Od,...n?{signal:n}:{}});return i.ok?F(Vi(i.value)):R(i.error)},async cancellationPolicy(n){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:Ad,...n?{signal:n}:{}});return i.ok?F(ji(i.value)):F(null)},async clinicians(n,i){let l=n.trim();if(!_e(l))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.clinicians",{method:"GET",path:wd,query:{state:l},...i?{signal:i}:{}});return s.ok?F(vt(Tn(s.value,"vets"),zi)):hn(s.error)?F(Object.freeze([])):R(s.error)},async slots(n,i){let l=n.trim();if(l.length===0)return ce("clinicianId is required");let s=await t.send("televet.booking.slots",{method:"GET",path:Wi,query:{clinician_id:l},...i?{signal:i}:{}});return s.ok?F(vt(Tn(s.value,"slots"),bn)):hn(s.error)?F(Object.freeze([])):R(s.error)},async nextSlot(n){let i=await t.send("televet.booking.next_slot",{method:"GET",path:Id,...n?{signal:n}:{}});return i.ok?F(bn(Nd(i.value,"slot"))):F(null)},async holdSlot(n){let i=n.trim();if(i.length===0)return ce("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:$i(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return bt(r,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),R(l.error);let s=Hi(l.value);return s===null?tt("the hold response carried no usable expiry"):F(s)},async book(n,i){let l=Ji(n);if(l!==null)return ce(l);let s=i.trim();if(s.length===0)return ce("idempotencyKey is required");let a=await t.send("televet.booking.book",{method:"POST",path:Sr,body:Ld(n)},{idempotent:true,idempotencyKey:s,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.book_failed",{status:a.error.httpStatus??null}),R(mr(a.error));let d=Dt(a.value);return d===null?tt("the booking response was unreadable"):br(d)?F(d):(bt(r,"televet.booking.book_failed",{status:null,consult_status:d.status}),R(yr(d.status)))},async reschedule(n,i){let l=n.trim(),s=i.trim();if(l.length===0)return ce("consultId is required");if(s.length===0)return ce("slotId is required");let a=await t.send("televet.booking.reschedule",{method:"POST",path:Ki(l),body:{new_slot_id:s}},{idempotent:false,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.reschedule_failed",{status:a.error.httpStatus??null}),R(a.error);let d=Dt(a.value);return d===null?tt("the reschedule response was unreadable"):F(d)},async listConsults(n){let i=await t.send("televet.booking.consults",{method:"GET",path:Sr,query:{limit:String(Gi)},...n?{signal:n}:{}});return i.ok?F(vt(Tn(i.value,"consults"),Dt)):hn(i.error)?F(Object.freeze([])):R(i.error)},async getConsult(n,i){let l=n.trim();if(l.length===0)return ce("consultId is required");let s=await t.send("televet.booking.consult",{method:"GET",path:Er(l),...i?{signal:i}:{}});if(!s.ok)return R(s.error);let a=Dt(s.value);return a===null?tt("the consult response was unreadable"):F(a)},async joinConsult(n){let i=n.trim();if(i.length===0)return ce("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:qi(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return bt(r,"televet.booking.join_failed",{status:l.error.httpStatus??null}),R(l.error);let s=fn(l.value);return s===null?tt("the join response carried no usable room credential"):F(s)},async cancelConsult(n,i){let l=n.trim(),s=i.trim();if(l.length===0)return ce("consultId is required");if(s.length===0)return ce("reason is required");if(s.length>Ke)return ce(`reason must be at most ${Ke} characters`);let a=await t.send("televet.booking.cancel",{method:"POST",path:Yi(l),body:{reason:s}},{idempotent:false,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.cancel_failed",{status:a.error.httpStatus??null}),R(a.error);let d=Ui(a.value);return d===null?tt("the cancel response was unreadable"):F(d)}}}o(Sn,"createTelevetBookingController");function Ld(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(Ld,"bookingWireBody");function Tn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(Tn,"rows");function Nd(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(Nd,"unwrap");var Xi=Symbol.for("@everfur/sdk#EverfurContext@v1"),Qi=globalThis,Zi=Qi[Xi]??(Qi[Xi]=react.createContext(null));Zi.displayName??="EverfurContext";function Te(){let e=react.useContext(Zi);if(e===null)throw new Bt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(Te,"useEverfurContext");var Md=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 jd(e){return Md[e]}o(jd,"requires");function el(e,t,r){let n=jd(e),i=new Map;for(let a of t)i.set(a.resource,a);if(r?.isPending===true&&n.some(a=>!i.has(a)))return En({name:e,enabled:false,isPending:true,limits:{}});let l=zd(n,i);return n.filter(a=>i.get(a)?.granted!==true).length===0?En({name:e,enabled:true,isPending:false,limits:l}):En({name:e,enabled:false,isPending:false,limits:l,disabled:Hd(n,i)})}o(el,"decideCapability");function zd(e,t){let r={};for(let n of e){let i=t.get(n)?.limits;if(i)for(let[l,s]of Object.entries(i)){let a=r[l];r[l]=a===void 0?s:Math.min(a,s);}}return r}o(zd,"mergeLimits");function Hd(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:ln("accessDenied"),level:"user_entitlement",recoverable:false})}o(Hd,"disabledFor");function En(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)}o(En,"freezeDecision");function Ft(e){let{runtime:t}=Te(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>el(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ft,"useCapability");function Se(e){let{runtime:t,userRef:r,scopeEpoch:n}=Te();return react.useMemo(()=>{if(e)return e;if(r===null)return null;let{services:i}=t.registry;return Sn({auth:i.authFor(r),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,r,n,e])}o(Se,"useTelevetBookingController");function Wd(){let{userRef:e}=Te(),t=Ft("televet");return react.useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(Wd,"useTelevetBookingAvailable");function rt(e,t,r){let[n,i]=react.useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[l,s]=react.useState(0),a=react.useRef(r);a.current=r,react.useEffect(()=>{let p=a.current;if(!t||p===null){i({key:e,data:null,isPending:false,error:null});return}let f=new AbortController,m=true;return i(c=>c.key===e?{...c,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let c;try{c=await p(f.signal);}catch{m&&i({key:e,data:null,isPending:false,error:null});return}m&&(c.ok?i({key:e,data:c.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:c.error}));})(),()=>{m=false,f.abort();}},[e,t,l]);let d=react.useCallback(()=>s(p=>p+1),[]),u=n.key===e;return react.useMemo(()=>({enabled:t,data:u?n.data:null,isPending:t&&(!u||n.isPending),isError:u&&n.error!==null,error:u?n.error:null,refetch:d}),[t,u,n.data,n.isPending,n.error,d])}o(rt,"useTelevetRead");function kn(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&_e(r),i=t?.statePolicy;return rt(`state-policy:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(kn,"useTelevetStatePolicy");function xn(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return rt("entitlement",t,t&&r?n=>r.call(e,n):null)}o(xn,"useTelevetBookingEntitlement");function Mt(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return rt("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(Mt,"useTelevetCancellationPolicy");function Rn(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&_e(r),i=t?.clinicians;return rt(`clinicians:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Rn,"useTelevetClinicians");function jt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return rt(`slots:${r}`,n,n&&t?i=>t.slots(r,i):null)}o(jt,"useTelevetSlots");function _n(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return rt("next-slot",t,t&&r?n=>r.call(e,n):null)}o(_n,"useTelevetNextSlot");function Pn(e){let[t,r]=react.useState(null),n=react.useRef(true),i=react.useRef(false),l=react.useRef(e);l.current=e,react.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=react.useCallback((...a)=>{let d=l.current;if(d===null||i.current)return;let u=a[a.length-1],p=typeof u=="object"&&u!==null&&("onSuccess"in u||"onError"in u),f=p?u:void 0,m=p?a.slice(0,-1):a;i.current=true,r({variables:m[0]??null}),(async()=>{let c=null;try{c=await d(...m);}catch{c=null;}i.current=false,n.current&&r(null),c!==null&&(c.ok?f?.onSuccess?.(c.value):f?.onError?.(c.error));})();},[]);return react.useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:s}),[t,s])}o(Pn,"useTelevetWrite");function zt(e){return Pn(e?t=>e.holdSlot(t):null)}o(zt,"useTelevetHoldSlot");function wn(e){return Pn(e?(t,r)=>e.book(t,r):null)}o(wn,"useTelevetBookConsult");function In(e,t){return Pn(t&&e?r=>t.reschedule(e,r):null)}o(In,"useTelevetRescheduleConsult");function xr(e,t=0){let r=e?.listConsults!==void 0,n=e?.listConsults;return rt(`consults:${t}`,r,r&&n?i=>n.call(e,i):null)}o(xr,"useTelevetConsults");function Ht(e){return e.error!==null&&e.error.httpStatus===404}o(Ht,"televetReadIsDark");var On=15,An=250,nl=new Set(["scheduled","in_progress"]);function nt(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}o(nt,"startsAtMs");function Bn(e){let t=nt(e);return t===null?null:t-On*6e4}o(Bn,"televetJoinOpensAtMs");function Ln(e,t){if(!nl.has(e.status))return {joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return {joinable:false,reason:"room_not_ready"};let r=nt(e);return r===null||t<r-On*6e4?{joinable:false,reason:"too_early"}:t>r+An*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}o(Ln,"televetJoinDecision");function Vt(e,t){let r=[],n=[];for(let i of e){let l=nt(i);(nl.has(i.status)&&l!==null&&l+An*6e4>t?r:n).push(i);}return r.sort((i,l)=>(nt(i)??0)-(nt(l)??0)),n.sort((i,l)=>(nt(l)??0)-(nt(i)??0)),Object.freeze({upcoming:Object.freeze(r),past:Object.freeze(n)})}o(Vt,"splitTelevetVisits");function Nn(e){return e==="scheduled"}o(Nn,"canManageTelevetVisit");function ol(e){let t=xr(e);return t.enabled?t.isPending?"pending":t.isError||Vt(t.data??[],Date.now()).upcoming.length>0?"visits":"booking":"booking"}o(ol,"useTelevetLanding");var I=Object.freeze({bookCardTitle:"Book a video visit",bookCardCta:"Find a time",upcomingTitle:"Upcoming visits",pastTitle:"Past visits",emptyTitle:"No visits yet",emptyBody:"When you book a video visit, it will appear here.",loading:"Loading your visits\u2026",loadErrorTitle:"Could not load your visits",loadErrorBody:"Check your connection and try again.",retry:"Try again",joinCta:"Join visit",joining:"Joining\u2026",rescheduleCta:"Reschedule",cancelCta:"Cancel visit",cancelConfirmTitle:"Cancel this visit?",cancellationReasonLabel:"Why are you cancelling?",cancelConfirmCta:"Cancel visit",cancellingVisit:"Cancelling visit\u2026",cancelDismissCta:"Keep visit",cancelledTitle:"Visit cancelled",cancellationFeeRecorded:"A late cancellation fee was recorded for this visit.",cancellationFeeNotRecorded:"No late cancellation fee was recorded for this visit.",loadingCancellationTerms:"Loading cancellation terms\u2026",cancellationTermsUnavailable:"We could not confirm the current cancellation terms. Try again before continuing.",cancellationReasonMissing:"Tell us why you are cancelling.",cancellationReasonTooLong:o(e=>`Keep the reason to ${String(e)} characters or fewer.`,"cancellationReasonTooLong"),cancelTermsFirst:"We could not confirm the cancellation terms. Please try again before cancelling.",cancelFailed:"We could not cancel this visit. Refresh your visits to confirm its status before trying again."});function il(e){switch(e){case "scheduled":return "Scheduled";case "in_progress":return "In progress";case "awaiting_summary":return "Summary on its way";case "completed":return "Completed";case "cancelled_owner":return "Cancelled by you";case "cancelled_ops":return "Cancelled by Everfur";case "no_show_owner":return "Missed";case "no_show_vet":return "Vet couldn't attend";default:return null}}o(il,"televetVisitStatusWeb");function ll(e,t){if(e==="too_early")return t?`This visit opens at ${t}. You can join from then.`:"This visit has not opened yet.";if(e==="too_late")return "This visit has ended.";if(e==="room_not_ready")return "We are still setting up the video room. Try again in a moment.";switch(e){case "status_cancelled_owner":return "You cancelled this visit.";case "status_cancelled_ops":return "This visit was cancelled. Please book another time.";case "status_no_show_owner":return "This visit was missed.";case "status_no_show_vet":return "The vet could not make this visit. Please book another time.";case "status_awaiting_summary":return "This visit has ended. Your summary is on its way.";case "status_completed":return "This visit has ended.";default:return "This visit cannot be joined right now."}}o(ll,"televetJoinBlockWeb");var Mn=class Mn 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}};o(Mn,"HostRenderBoundary");var Dn=Mn;function Kd({render:e}){return e()}o(Kd,"RenderHost");function Fn({render:e,fallback:t,resetKey:r}){return react.createElement(Dn,{fallback:t,resetKey:r,children:react.createElement(Kd,{render:e})})}o(Fn,"HostRender");function Hn(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Hn(e[t]);}return e}o(Hn,"deepFreeze");var qd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),dl={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ul={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},sl={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Yd={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Gd={regular:"400",medium:"500",bold:"700"},Jd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Xd=0,Rr="System",_r="monospace",Qd=["content","heading","control","compact","badge"];function Zd(e){let t={};for(let r of Qd)t[r]=e;return t}o(Zd,"authoredTierSizes");function cl(){return {family:Rr,mono:_r,fontUrl:null,families:{regular:Rr,medium:Rr,bold:Rr,mono:_r,monoMedium:_r,monoBold:_r},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:sl,tierSizes:Zd(sl),lineHeight:Yd,weight:Gd,letterSpacing:Jd,scale:1,maxScale:Xd,scaleCaps:qd}}o(cl,"baseType");var pl={},jn=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function zn(e){return `cubic-bezier(${e.join(", ")})`}o(zn,"cssCubicBezier");var fl={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:zn(jn.standard),emphasized:zn(jn.emphasized),exit:zn(jn.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)"},yl=Hn({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:eu,space:dl,radius:ul,type:cl(),motion:fl,slots:pl}),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)"};Hn({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tu,space:dl,radius:ul,type:cl(),motion:fl,slots:pl});var ml=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),gl=globalThis,Vn=gl[ml]??(gl[ml]=react.createContext(yl));Vn.displayName??="EverfurThemeContext";function w(){return react.useContext(Vn)}o(w,"useEverfurTheme");var vl=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var bl='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ou="System";function iu(e){let t=e.trim();return t.length===0||t===ou?bl:`${hl(t)}, ${bl}`}o(iu,"cssFontFamily");function lu(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${hl(t)}, ui-monospace, Menlo, Consolas, monospace`}o(lu,"cssMonoFamily");function hl(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(hl,"quote");function T(e,t){let r=e.type,n=r.families[t];return {fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?lu(n):iu(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[vl[t]]}}o(T,"faceCss");var ht=Object.freeze({textAlign:"start"});var au=48;function su(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(su,"selectView");function El(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:l,className:s}=e,a=Ft(t),d=react.useMemo(()=>su(a),[a]);switch(d){case "enabled":return r;case "pending":return i?jsxRuntime.jsx(Fn,{render:i,fallback:jsxRuntime.jsx(Tl,{capability:t,style:l,className:s})}):jsxRuntime.jsx(Tl,{capability:t,style:l,className:s});case "disabled":return n?jsxRuntime.jsx(Fn,{render:()=>n(a),fallback:jsxRuntime.jsx(Sl,{decision:a,style:l,className:s}),resetKey:a}):jsxRuntime.jsx(Sl,{decision:a,style:l,className:s});default:return dr(d)}}o(El,"CapabilityGate");function Tl({capability:e,style:t,className:r}){let n=w(),i=react.useMemo(()=>Cl(n),[n]);return jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:r,style:{...i.offstate,...t},children:jsxRuntime.jsx("div",{style:i.skeletonBar})})}o(Tl,"PendingSkeleton");function Sl({decision:e,style:t,className:r}){let n=w(),i=react.useMemo(()=>Cl(n),[n]),l=e.disabled?.reason??"";return jsxRuntime.jsx("div",{className:r,style:{...i.offstate,...t},children:l.length>0?jsxRuntime.jsx("p",{style:i.offstateText,children:l}):null})}o(Sl,"OffState");function Cl(e){let{color:t,space:r,radius:n,type:i}=e;return {offstate:{...ht,boxSizing:"border-box",minHeight:au,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${r.md}px ${r.lg}px`,backgroundColor:t.surfaceCream,borderRadius:n.md,border:`1px solid ${t.brandBorder}`},offstateText:{margin:0,...T(e,"regular"),fontSize:i.size.body,lineHeight:`${Math.round(i.size.body*i.lineHeight.normal)}px`,color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}}}o(Cl,"makeStyles");function Tt(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}o(Tt,"hasLoneSurrogate");function St(e){return [...e].length}o(St,"serverLength");var kl=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function xl(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(kl,t)?kl[t]:null}o(xl,"canonicalPetSpecies");var Rl=50,du=128,Wn=120,_l=120,uu=2e3,Pl=120,cu=80,Ol=new Set(["male","female","unknown"]),Al=new Set(["day","month","year"]),Bl=new Set(["low","medium","high","athletic"]),Ll=new Set(["indoor","outdoor","both"]),Nl=new Set(["mild","moderate","severe"]),pu=/^(\d{4})-(\d{2})-(\d{2})$/,Dl=[["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"]],Fl=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Dl,...Fl].map(([e])=>e));function fu(e){let t=pu.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}o(fu,"isRealDate");var Wt=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),yu=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),wr=o((e,t)=>typeof t=="string"&&fu(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),we=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Tt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return `${r} is required and must not be blank`;let l=St(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},"text"),mu={sex:Wt(Ol),spayedNeutered:yu,birthDate:wr,birthDatePrecision:Wt(Al),activityLevel:Wt(Bl),indoorOutdoor:Wt(Ll),foodBrand:we(Pl),foodType:we(Pl),microchipId:we(cu)},$n=["ref","ref",false,we(du,{required:true,trimmed:true})],Kn=["notes","notes",false,we(uu,{trimmed:true})],wl=[$n,["name","name",true,we(Wn,{required:true,trimmed:true})],["dose","dose",false,we(_l,{trimmed:true})],["frequency","frequency",false,we(_l,{trimmed:true})],["startDate","start_date",false,wr],["endDate","end_date",false,wr],Kn],gu={allergies:[$n,["allergen","allergen",true,we(Wn,{required:true,trimmed:true})],["severity","severity",false,Wt(Nl)],Kn],medications:wl,supplements:wl,conditions:[$n,["conditionName","condition_name",true,we(Wn,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,wr],Kn]};function vu(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let i=r,l={};for(let[d,u,p,f]of gu[e]){let m=i[d];if(m==null){if(p)return {error:`${n}.${d} is required`};m===null&&(l[u]=null);continue}let c=f(`${n}.${d}`,m);if(c!==null)return {error:c};l[u]=m;}let s=l.start_date,a=l.end_date;return typeof s=="string"&&typeof a=="string"&&a<s?{error:`${n}.endDate must not be before startDate`}:{item:l}}o(vu,"itemToWire");function bu(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Rl)return {error:`${e} has ${t.length} items; the server accepts at most ${Rl}`};let r=[],n=new Set;for(let i=0;i<t.length;i+=1){let l=vu(e,i,t[i]);if("error"in l)return l;let s=l.item.ref;if(typeof s=="string"){let a=s.trim();if(n.has(a))return {error:`${e}: ref ${JSON.stringify(a)} is used twice; a ref names one item`};n.add(a);}r.push(l.item);}return {items:r}}o(bu,"listToWire");function Ml(e,t){let r=e,n={};for(let[s,a]of Dl){let d=r[s];if(d!==void 0){if(d!==null){let u=mu[s](s,d);if(u!==null)return {error:u}}n[a]=d;}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[s,a]of Fl){let d=r[s];if(d===void 0)continue;let u=bu(s,d);if("error"in u)return u;n[a]=u.items;}return Object.keys(n).length>0&&t!==void 0&&xl(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}}o(Ml,"petHealthToWire");var J=o(e=>typeof e=="string"?e:null,"str"),Ut=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),hu=o(e=>typeof e=="boolean"?e:null,"bool");function Pr(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([])}o(Pr,"itemsFromWire");function Il(e){let t=J(e.name);return t===null||t.length===0?null:Object.freeze({ref:J(e.ref),name:t,dose:J(e.dose),frequency:J(e.frequency),startDate:J(e.start_date),endDate:J(e.end_date),notes:J(e.notes)})}o(Il,"medicationFromWire");function jl(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Ut(Ol,e.sex),spayedNeutered:hu(e.spayed_neutered),birthDate:J(e.birth_date),birthDatePrecision:Ut(Al,e.birth_date_precision),activityLevel:Ut(Bl,e.activity_level),indoorOutdoor:Ut(Ll,e.indoor_outdoor),foodBrand:J(e.food_brand),foodType:J(e.food_type),microchipId:J(e.microchip_id),allergies:Pr(e.allergies,r=>{let n=J(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),allergen:n,severity:Ut(Nl,r.severity),notes:J(r.notes)})}),medications:Pr(e.medications,Il),supplements:Pr(e.supplements,Il),conditions:Pr(e.conditions,r=>{let n=J(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),conditionName:n,diagnosedDate:J(r.diagnosed_date),notes:J(r.notes)})})})}o(jl,"petHealthFromWire");var Vl=100,Ul=50,Wl=100,$l=50,Kl=500,Tu=128,Su=6e4;function Oe(e){return te("validationFailed",{retryable:false,wireMessage:e})}o(Oe,"invalid");function ot(e,t,r){if(typeof t!="string")return Oe(`${e} must be a string`);let n=St(t);return n<=r?null:Oe(`${e} is ${n} characters; the server accepts at most ${r}`)}o(ot,"checkString");function Ir(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Oe(`${e} must be a finite number between 0 and ${r}`)}o(Ir,"outOfRange");function zl(e,t){if(typeof e!="string")return Oe("pet_ref must be a string");if(e.trim().length===0)return Oe("pet_ref must not be blank");if(Tt(e))return Oe("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Oe("profile must be an object");let r=[ot("pet_ref",e,Tu)];return t?.name!==void 0&&r.push(ot("name",t.name,Vl)),t?.species!==void 0&&r.push(ot("species",t.species,Ul)),t?.breed!==void 0&&r.push(ot("breed",t.breed,Wl)),t?.ageYears!==void 0&&r.push(Ir("age_years",t.ageYears,$l)),t?.weightKg!==void 0&&r.push(Ir("weight_kg",t.weightKg,Kl)),r.find(n=>n!==null)??null}o(zl,"validate");function ql(e,t){let r=Ml(e,t);return "error"in r?{error:Oe(r.error)}:r}o(ql,"healthToWire");function Eu(e){if(typeof e!="object"||e===null)return {error:Oe("patch must be an object")};let t=e,r=[["name","name",l=>ot("name",l,Vl)],["species","species",l=>ot("species",l,Ul)],["breed","breed",l=>ot("breed",l,Wl)],["ageYears","age_years",l=>Ir("age_years",l,$l)],["weightKg","weight_kg",l=>Ir("weight_kg",l,Kl)]],n={};for(let[l,s,a]of r){let d=t[l];if(d!==void 0){if(d!==null){let u=a(d);if(u!==null)return {error:u}}n[s]=d;}}let i=ql(t,t.species);return "error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:Oe("patch must change at least one field")}:{body:n})}o(Eu,"patchToWire");function Cu(e){if(e==null)return {body:{}};let t=ql(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}}}o(Cu,"toWire");var Ie=o(e=>typeof e=="string"?e:null,"str"),Or=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Hl(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Ie(r.pet_ref)??t,name:Ie(r.name),species:Ie(r.species),breed:Ie(r.breed),ageYears:Or(r.age_years),weightKg:Or(r.weight_kg)})}o(Hl,"fromWire");function Yl(e){if(typeof e!="object"||e===null)return null;let t=e,r=Ie(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Ie(t.pet_id),petRef:r,name:Ie(t.name),species:Ie(t.species),breed:Ie(t.breed),ageYears:Or(t.age_years),weightKg:Or(t.weight_kg),updatedAt:Ie(t.updated_at)})}o(Yl,"widgetPetFromWire");function ku(e){let t=Yl(e);return t===null?null:Object.freeze({...t,...jl(e)})}o(ku,"widgetPetProfileFromWire");function xu(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=Yl(r);return n===null?[]:[n]}))}o(xu,"petListFromWire");function Gl(e){return Ru(et({auth:e}),et({auth:e,unaryTimeoutMs:Su}))}o(Gl,"createPetsRepository");function Ru(e,t=e){let r=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),n=o(i=>zl(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?F(xu(l.value)):R(l.error)},async registerPet(i,l,s){let a=zl(i,l);if(a!==null)return R(a);let d=Cu(l);if("error"in d)return R(d.error);let p={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:d.body},f=await e.send("pets.registerPet",s?.signal?{...p,signal:s.signal}:p);return f.ok?F(Hl(f.value,i)):R(f.error)},async updatePet(i,l,s){let a=n(i);if(typeof a!="string")return R(a);let d=Eu(l);if("error"in d)return R(d.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:a,body:d.body},s?.signal));return u.ok?F(Hl(u.value,i)):R(u.error)},async getPetProfile(i,l){let s=n(i);if(typeof s!="string")return R(s);let a=await e.send("pets.getPetProfile",r({method:"GET",path:`${s}/profile`},l?.signal));if(!a.ok)return R(a.error);let d=ku(a.value);return d===null?R(te("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):F(d)},async deletePet(i,l){let s=n(i);if(typeof s!="string")return R(s);let a=await e.send("pets.deletePet",r({method:"DELETE",path:s},l?.signal));return a.ok?F(void 0):R(a.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?F(void 0):R(l.error)}}}o(Ru,"createPetsRepositoryOver");function Ar(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=Te(),i=react.useMemo(()=>Gl(e.registry.services.authFor(t)),[e,t,n]),[l,s]=react.useState({repository:i,pets:[],loading:true,error:null}),a=l.repository===i?l:{pets:[],loading:true,error:null},d=react.useRef(0),u=react.useCallback(async()=>{let f=++d.current;s(c=>({...c,repository:i,loading:true,error:null,pets:c.repository===i?c.pets:[]}));let m=await i.list();f===d.current&&s(m.ok?{repository:i,pets:m.value,loading:false,error:null}:c=>({repository:i,pets:c.repository===i?c.pets:[],loading:false,error:m.error}));},[i]);react.useEffect(()=>(u(),()=>{d.current+=1;}),[u]);let p=react.useMemo(()=>r===null?null:a.pets.find(f=>f.petRef===r)??null,[r,a.pets]);return react.useMemo(()=>({pets:a.pets,activePet:p,loading:a.loading,error:a.error,refresh:u}),[a.pets,a.loading,a.error,p,u])}o(Ar,"useEverfurPets");var $t=Object.freeze(["pet","issues","reason","clinician","time","review","booked"]),Jl=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Gn(e,t={}){let r=Object.freeze({...Jl,...t}),n=Yn(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Gn,"initialTelevetBookingState");function Br(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}o(Br,"isSkipped");function Lr(e){return $t[e]}o(Lr,"stepAt");function Yn(e,t){for(let r=e;r<$t.length;r+=1){let n=Lr(r);if(n&&!Br(n,t))return r}return $t.length-1}o(Yn,"nextVisible");function Xl(e,t){for(let r=e;r>=0;r-=1){let n=Lr(r);if(n&&!Br(n,t))return r}return null}o(Xl,"previousVisible");function Jn(e,t){return Xl(e.index-1,t)!==null}o(Jn,"hasPreviousStep");function Xn(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Yn(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(Lr(e.index)==="booked")return e;let n=Xl(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=$t.indexOf(t.step);if(n<0)return e;let i=Br(t.step,r)?Yn(n,r):n;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(Xn,"televetBookingReducer");function Qn(e){return Lr(e.index)??"pet"}o(Qn,"currentStep");function Kt(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&_e(e.state)&&r.length>0&&r.length<=$e}o(Kt,"canConfirm");function Nr(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(Nr,"isHoldExpired");function Ql(e,t,r){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!Nr(e,r)}o(Ql,"holdsSlot");var Zl=Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),Ou=dn();function Zn(e){return `televet.book.${Ou()}.${e}`}o(Zn,"televetBookingKey");function eo(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(eo,"attestation");var Au=Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"upset-stomach",label:"Upset stomach"},{id:"ear-infections",label:"Ear infections"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks, and heartworm"},{id:"joint-pain",label:"Joint pain and mobility"},{id:"eye-issues",label:"Eye issues"},{id:"urinary",label:"Urinary issues"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-dog-care",label:"Senior dog care",species:"dog"}]),Bu="other";function Lu(e){let t=e?.trim().toLowerCase()??"";return t.startsWith("dog")?"dog":t.startsWith("cat")?"cat":null}o(Lu,"televetIssueSpecies");function ea(e){let t=Lu(e),r=Au.filter(n=>!n.species||n.species===t).map(({id:n,label:i})=>Object.freeze({id:n,label:i}));return Object.freeze([...r,Object.freeze({id:Bu,label:y.otherIssue})])}o(ea,"televetIssueChips");function ta(e,t){let r=e.filter(i=>i.trim().length>0),n=t.trim();return r.length===0?n:n.length===0?r.join(", "):`${r.join(", ")}
1
+ 'use strict';var react=require('react'),jsxRuntime=require('react/jsx-runtime');var Ns=Object.defineProperty;var o=(e,t)=>Ns(e,"name",{value:t,configurable:true});function dr(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}o(dr,"assertNever");function mi(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})}o(mi,"errorFrame");function tn(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e);}catch{}}o(tn,"reportHostFailure");function Ms(e){return (typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}o(Ms,"isThenable");function ur(e,...t){if(typeof e=="function")try{let r=e(...t);return Ms(r)&&Promise.resolve(r).then(void 0,tn),r}catch(r){tn(r);return}}o(ur,"callHost");var gi=new WeakMap;function js(e){if(typeof e!="function")return;let t=gi.get(e);if(t!==void 0)return t;let r=o((...n)=>{ur(e,...n);},"guarded");return gi.set(e,r),r}o(js,"guardHost");function yt(e,t){let r=null;for(let n of t){let i=e[n];typeof i=="function"&&(r??={...e},r[n]=js(i));}return r??e}o(yt,"guardHostProps");function cr(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}))}o(cr,"callHostAsync");var g=o(e=>e,"DRAFT"),zs=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Hs(e){return zs.some(t=>e.toUpperCase().includes(t.toUpperCase()))}o(Hs,"isPlaceholderCopy");function W(e,t){let r=e;for(let[n,i]of Object.entries(t))r=r.split(`{${n}}`).join(i);return r}o(W,"fill");var le=Object.freeze({stateBlockedTitle:g("Not available in this state yet"),noCliniciansTitle:g("No vets available right now"),noCliniciansBody:g("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:g("Check again"),noCliniciansRegionBody:g("Video visits have to be with a vet licensed in your state, and we don\u2019t have one there yet."),yourVetTitle:g("Your Vet"),reviewsLabel:g("reviews"),rescheduleFromTemplate:g("Moving your visit on {when}"),rescheduleFailed:g("That did not move. Your original time is unchanged."),keepExistingCta:g("Keep my current time"),bookingPausedTitle:g("Booking is not available right now."),slotsErrorTitle:g("Could not load times"),noSlotsTitle:g("No times available"),nextOpeningTemplate:g("Next opening across our vets: {when}"),seeOtherVetsCta:g("See other vets"),retryCta:g("Try again"),holdExpired:g("That time is no longer held. Pick another."),slotTaken:g("That time was just taken. Pick another."),reasonPlaceholder:g("What is going on with your pet?"),reasonTooLong:g("That is too long. Please shorten it."),shareRecordsOff:g("Share health records with this vet"),confirmNotEntitled:g("A Pro membership is needed to book a video visit."),confirmFailed:g("That did not book. Try again."),checkAvailabilityCta:g("Check availability"),stateInterest:Object.freeze({cta:g("Add me to the list"),submitting:g("Adding you to the list\u2026"),joinedTitle:g("You are on the list"),joinedBody:g("We will let you know when this changes."),failed:g("That did not save. Try again.")}),media:Object.freeze({droppedTemplate:g("{n} attachment did not upload."),droppedPluralTemplate:g("{n} attachments did not upload."),refusedSizeTemplate:g("{n} attachment was too large to send."),refusedSizePluralTemplate:g("{n} attachments were too large to send."),refusedTypeTemplate:g("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:g("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:g("{n} attachment could not be read."),refusedUnreadablePluralTemplate:g("{n} attachments could not be read.")}),navTitle:g("Book a visit"),rescheduleNavTitle:g("Change your visit"),close:g("Close"),continueCta:g("Continue"),petSelectTitle:g("Who is this visit for?"),addPetCta:g("Add a pet"),locationUnknownTitle:g("We need your location to find a vet"),locationUnknownBody:g("Turn on location for Everfur, then try again."),locationUnknownCta:g("Allow location"),locationBlockedTitle:g("Location is turned off"),locationBlockedBody:g("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:g("Open Settings"),locationUnavailableTitle:g("We could not read your location"),locationUnavailableBody:g("Try again in a moment."),stateAttestTemplate:g("I confirm my pet and I are in {state} right now."),describeHeading:g("Tell the vet what you are seeing"),describeHelpLong:g("A few sentences is plenty. When it started, what changed, anything you've already tried."),addPhotoCta:g("ADD PHOTO OR VIDEO"),removePhotoLabel:g("Remove photo"),summaryPet:g("Pet"),summaryVet:g("Vet"),summaryWhen:g("When"),summaryLength:g("Length"),summaryReason:g("Reason"),summaryLengthTemplate:g("{n} minutes"),confirmCta:g("Confirm visit"),bookedTitle:g("You are booked."),addToCalendarCta:g("Add to calendar"),doneCta:g("Done"),booked:Object.freeze({remindPromise:g("We will notify you 30 minutes before."),summaryPromise:g("{pet}'s summary goes to the vet ahead of the call."),joinPromise:g("Join right here in the app. No links to hunt for."),backToPet:g("Back to {pet}"),calendarAdded:g("Added to your calendar"),calendarFailedBody:g("That did not save to your calendar.")}),chrome:Object.freeze({closeHint:g("Closes without saving"),discardTitle:g("Leave without booking?"),discardBody:g("Your answers will not be saved."),discardConfirmCta:g("Leave"),discardKeepCta:g("Keep going"),noPetsTitle:g("No pets on this account"),loadFailedTitle:g("Could not load"),retryCta:g("Try again")}),emergency:Object.freeze({bannerTitle:g("This cannot wait for a scheduled call."),keepBookingCta:g("I have handled this, keep booking"),lede:g("What you are describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:g("Call {petName}'s primary vet"),exitFindErTitle:g("Find an emergency vet near you"),startCallHint:g("Starts a phone call")}),visit:Object.freeze({title:g("Your visit")}),loading:Object.freeze({pets:"Loading pets. Nothing to read yet.",clinicians:"Loading vets. Nothing to read yet.",slots:"Loading times. Nothing to read yet.",consult:"Loading your visit. Nothing to read yet.",progressTemplate:"Step {step} of {total}"})});function vi(e=le){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>vi(t))}o(vi,"televetBookingCopyValues");function Ne(){return vi().every(e=>e.trim().length>0&&!Hs(e))}o(Ne,"isTelevetBookingCopyReady");var mt=Object.freeze({findEmergencyVet:"Find an emergency vet near you",poisonControl:"ASPCA Animal Poison Control",poisonControlDetail:"(888) 426-4435 \xB7 a fee may apply",poisonControlTel:"tel:+18884264435"}),y=Object.freeze({...le,petSelectTitle:"Who is this visit for?",describeHeading:"Type to the vet what you're seeing",describeHelpLong:"Describe the issues your pet is experiencing",reasonPlaceholder:"She's been scratching her left ear a lot this week...",yourVetTitle:"Which vet would you like to see?",timeHeading:"Pick a date and time",reviewHeading:"Does this look right?",issuesHeadingTemplate:"Select {pet}\u2019s main issues",issuesHint:"Can select more than 1",otherIssue:"Other",bookedHeadingTemplate:"You're booked with {vet}",addToCalendarCta:"Add to Calendar",backLabel:"Back",emergency:Object.freeze({...le.emergency,bannerTitle:"This can't wait for a scheduled call.",lede:"What you're describing is the kind of thing vets want to see in person, now. Please call one of these first.",ledeWithoutExits:le.emergency.lede,keepBookingCta:"I've handled this, continue with booking",exitPrimaryVetTitle:"Call {petName}'s primary vet"})});var rn=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(rn.map(e=>e.wireCode));var Us=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"}),hi=Object.freeze(rn.map(e=>Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:Us[e.wireCode]}))),Ws=new Map(hi.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),$s=Object.freeze(["http_envelope",...[...new Set(hi.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function pr(e,t){if(typeof e!="string")return;let r=e.trim().toUpperCase();if(r.length!==0)for(let n of [t??"http_envelope",...$s]){let i=Ws.get(n+r);if(i)return i}}o(pr,"contractErrorFor");function Ks(e){return e.envelope==="sse_frame"?`/errors#sse-${e.wireCode}`:e.envelope==="oauth_error"?`/errors#oauth-${e.wireCode}`:`/errors#${e.wireCode}`}o(Ks,"contractDocUrl");function Ti(e){return null}o(Ti,"publishedDocUrl");var qs=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 Si(e){return qs[e]}o(Si,"categoryFor");function Ei(e){let t=pr(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"}}o(Ei,"fromWire");var Ys=new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function nn(e){return Ys.has(e)}o(nn,"isAutoRetryable");var Gs=new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function Ci(e){return nn(e)||Gs.has(e)}o(Ci,"isRetryableCode");var Js=500,on=8e3,ki=4;function xi(e,t=Math.random){let r=Math.max(0,e),n=Math.min(Js*2**r,on);return Math.floor(t()*n)}o(xi,"backoffDelayMs");var Xs=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 ln(e){return Xs[e]}o(ln,"userFacingError");function Ri(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:false,writable:false,configurable:false});}o(Ri,"defineHidden");var Qs=/^[a-z][a-z0-9_]{0,63}$/;function te(e,t){let r=pr(t?.wireCode,t?.wireEnvelope),n={code:e,category:Si(e),retryable:t?.retryable??Ci(e),displayMessage:ln(e)};if(t?.httpStatus!==void 0&&(n.httpStatus=t.httpStatus),t?.requestId&&(n.requestId=t.requestId),typeof t?.reasonCode=="string"&&Qs.test(t.reasonCode)&&(n.reasonCode=t.reasonCode),r);return t?.wireMessage&&Ri(n,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Ri(n,"raw",t.raw),Object.freeze(n)}o(te,"makeEverfurError");function F(e,t){return Object.freeze(t===void 0?{ok:true,value:e}:{ok:true,value:e,warning:t})}o(F,"ok");function R(e){return Object.freeze({ok:false,error:e})}o(R,"err");var fr=class fr extends Error{constructor(t,r){super(r),this.name="EverfurConfigError",this.kind=t,Object.setPrototypeOf(this,fr.prototype);}};o(fr,"EverfurConfigError");var Bt=fr;function Zs(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}o(Zs,"authHeaders");function Lt(e,t){return {...e,headers:{...ed(e.headers),...Zs(t)}}}o(Lt,"withAuthHeaders");function ed(e){if(!e)return {};let t={};for(let[r,n]of Object.entries(e)){let i=r.toLowerCase();i==="authorization"||i==="x-everfur-partner-key"||(t[r]=n);}return t}o(ed,"stripAuthHeaders");async function _i(e,t){if(t.mode==="anonymous")return t.transport.request(Lt(e,{mode:"anonymous",publishableKey:t.publishableKey,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));let r;try{r=await t.identity.currentToken();}catch{return R(an())}let n=await t.transport.request(Lt(e,{mode:"personalized",token:r,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(n.ok||n.error.httpStatus!==401)return n;let i;try{i=await t.identity.currentToken({forceRefresh:!0});}catch{return R(an())}let l=await t.transport.request(Lt(e,{mode:"personalized",token:i,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return !l.ok&&l.error.httpStatus===401?R(an(l.error.httpStatus)):l}o(_i,"authedSend");function an(e){return te("authRejected",{retryable:false,...e!==void 0?{httpStatus:e}:{}})}o(an,"authRejectedError");function Pi(e){return te("internalError",{retryable:true,wireMessage:td(e)})}o(Pi,"networkError");function td(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}o(td,"describeCause");var sn=3e4,rd=on*2,nd="idempotency-key",od=new Set(["POST","PUT","PATCH","DELETE"]),id=Object.freeze({onEvent(){}}),ld=Object.freeze({setTimeout:o((e,t)=>setTimeout(e,t),"setTimeout"),clearTimeout:o(e=>clearTimeout(e),"clearTimeout"),now:o(()=>Date.now(),"now")});function ad(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}o(ad,"seededIdempotencyKey");function et(e){let t=e.observer??id,r=e.timers??ld,n=e.rng??Math.random,i=e.sleep??((m,c)=>Td(m,r,c)),l=e.maxAttempts??ki,s=e.unaryTimeoutMs??sn,a=e.newIdempotencyKey??dn(),d=o(m=>{try{t.onEvent(m);}catch{}},"emit");async function u(m,c,v){let b=v?.maxAttempts,h=Math.max(1,b??l),S=v?.idempotent??od.has(c.method),E=v?.idempotencyKey===void 0?null:ad(v.idempotencyKey),k=S?E??a():null,L=sd(c,k),x=0;for(;;){let A=o(ee=>Object.freeze({call:m,method:c.method,path:c.path,attempt:x,...k?{idempotencyKey:k}:{},...ee}),"stamp");d(A({phase:"attempt"}));let z=bd(s,r),H=hd(z.signal,c.signal),X;try{X=await _i({...L,signal:H.signal},e.auth);}catch(ee){X=R(Pi(ee));}finally{H.dispose(),z.cancel();}if(X.ok)return d(A({phase:"settled",ok:true,reason:"ok"})),X;let D=X.error,G=ud(D,x,{maxAttempts:h,rng:n,now:r.now(),aborted:c.signal?.aborted===true,...b!==void 0?{perCallMaxAttempts:b}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),q={ok:false,code:D.code,reason:G.reason,...D.httpStatus!==void 0?{httpStatus:D.httpStatus}:{},...D.requestId!==void 0?{requestId:D.requestId}:{}};if(!G.retry)return d(A({phase:"settled",...q})),R(D);if(d(A({phase:"retry",...q,delayMs:G.delayMs})),await i(G.delayMs,c.signal),c.signal?.aborted===true)return d(A({phase:"settled",...q,reason:"aborted"})),R(D);x+=1;}}o(u,"send");async function p(m){return Lt(m,await vd(e.auth))}o(p,"authorize");async function*f(m,c,v){d(Object.freeze({call:m,phase:"stream.open",method:c.method,path:c.path,attempt:0}));try{yield*e.auth.transport.stream(c,v);}catch{yield mi({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null,serverRequestId:null});}}return o(f,"stream"),Object.freeze({send:u,authorize:p,stream:f})}o(et,"createRequestFunnel");function sd(e,t){let r={};for(let[n,i]of Object.entries(e.headers??{}))n.toLowerCase()!==nd&&(r[n]=i);return t!==null&&(r["Idempotency-Key"]=t),{...e,headers:r}}o(sd,"assembleHeaders");function dn(){let e=0;return ()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}o(dn,"defaultIdempotencyKeyFactory");var dd=10;function ud(e,t,r){if(r.aborted)return {retry:false,reason:"aborted"};let n=cd(e);if(n==="quota")return {retry:false,reason:"daily-quota-exhausted"};if(n!=="burst"&&!nn(e.code))return {retry:false,reason:"terminal-code"};let i=n==="burst"?"burst-throttle":"retryable-code";if(o(()=>{if(r.policy===void 0)return false;try{return !r.policy.shouldRetry(e.code,t)}catch{return false}},"policyVetoedRetry")())return {retry:false,reason:"terminal-code"};let s=o(()=>{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(dd,Math.floor(u)))},"policyCeiling"),a=r.perCallMaxAttempts??s()??r.maxAttempts;if(t+1>=a)return {retry:false,reason:"attempts-exhausted"};let d=pd(e,r.now);return d!==null?d>rd?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:i,delayMs:d}:{retry:true,reason:i,delayMs:xi(t,r.rng)}}o(ud,"decideRetry");function cd(e){let t=e.code==="unknown"?Ei(gd(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}o(cd,"throttleKind");function pd(e,t){let r=yd(e.raw);if(r!==null){let i=r-t;return i>0?i:0}let n=fd(e.raw);return n===null?null:Math.round(n*1e3)}o(pd,"retryOverrideMs");function fd(e){for(let t of un(e)){let r=t.retry_after_seconds;if(typeof r=="number"&&Number.isFinite(r)&&r>=0)return r}return null}o(fd,"findRetryAfterSeconds");function yd(e){for(let t of un(e)){let r=t.resets_at,n=md(r);if(n!==null)return n}return null}o(yd,"findResetsAt");function un(e){if(!wi(e))return [];let t=[e];for(let r of ["error","detail"]){let n=e[r];wi(n)&&t.push(n);}return t}o(un,"candidateScopes");function md(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}o(md,"parseInstantMs");function gd(e){for(let t of un(e)){let r=t.code;if(typeof r=="string"&&r.length>0)return r}return null}o(gd,"rawWireCode");function wi(e){return typeof e=="object"&&e!==null}o(wi,"isRecord");async function vd(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}:{}}}o(vd,"resolveDeviceAuth");function bd(e,t){let r=new AbortController,n=t.setTimeout(()=>r.abort(),e);return {signal:r.signal,cancel:o(()=>t.clearTimeout(n),"cancel")}}o(bd,"boundedSignal");function hd(e,t){let r=o(()=>{},"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 i=o(()=>n.abort(),"onAbort");return e.addEventListener("abort",i,{once:true}),t.addEventListener("abort",i,{once:true}),{signal:n.signal,dispose:o(()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i);},"dispose")}}o(hd,"mergeSignals");function Td(e,t,r){return e<=0||r?.aborted===true?Promise.resolve():new Promise(n=>{let i=t.setTimeout(()=>{r?.removeEventListener("abort",l),n();},e),l=o(()=>{t.clearTimeout(i),n();},"onAbort");r?.addEventListener("abort",l,{once:true});})}o(Td,"delayAbortable");var Bi="televet_booking_not_live";function yr(e){return te("conflict",{retryable:false,reasonCode:Bi,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}o(yr,"televetBookingNotLiveError");var cn="televet_booking_key_reused",Ii="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function mr(e){return e.httpStatus!==409||e.reasonCode===cn||Nt(e)?.code!==Ii?e:te(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:Ii,reasonCode:cn,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}o(mr,"foldTelevetBookingKeyReused");function Nt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let r=t,n=r.detail??r.error;return typeof n=="object"&&n!==null?n:r}o(Nt,"details");function Sd(e){let t=Nt(e)?.categories;return Array.isArray(t)?Object.freeze(t.filter(r=>typeof r=="string")):Object.freeze([])}o(Sd,"categoriesOf");function Oi(e){let t=Nt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}o(Oi,"retryAfterOf");function Ai(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let r=Nt(e)?.message;return typeof r=="string"&&r.trim().length>0?r.trim():null}o(Ai,"messageOf");function Ed(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let r=Nt(e),n=r?.code??r?.error_code;return typeof n=="string"&&n.length>0?n:null}o(Ed,"codeOf");function Ue(e){let t=e.httpStatus;if(t===402)return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")return Object.freeze({kind:"rate_limited",retryAfterSeconds:Oi(e),message:Ai(e)});if(t===404)return Object.freeze({kind:"unavailable"});switch(Ed(e)){case "televet_rate_limited":return Object.freeze({kind:"rate_limited",retryAfterSeconds:Oi(e),message:Ai(e)});case "televet_emergency_ack_required":return Object.freeze({kind:"emergency",categories:Sd(e)});case "televet_not_entitled":return Object.freeze({kind:"not_entitled"});case "televet_slot_conflict":return Object.freeze({kind:"slot_taken"});case "televet_hold_invalid":return Object.freeze({kind:"slot_taken"});case Bi:return Object.freeze({kind:"slot_taken"});case cn:return Object.freeze({kind:"slot_taken"});case "televet_clinician_cannot_prescribe":case "televet_clinician_unavailable":case "televet_clinician_not_bookable":return Object.freeze({kind:"clinician_unavailable"});case "televet_membership_conflict":return Object.freeze({kind:"not_entitled"});case "televet_registry_unavailable":return Object.freeze({kind:"failed"});}return Object.freeze({kind:"failed"})}o(Ue,"televetBookingRefusal");function Cd(e){try{return new URL(e.trim()).protocol==="https:"}catch{return false}}o(Cd,"isSafeRoomUrl");function kd(e,t){return Cd(e)&&t.trim().length>0}o(kd,"isUsableRoomCredential");function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(gr,"isRecord");function pn(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}o(pn,"wholeNumber");function xd(e){if(!gr(e))return null;let t=pn(e.consult_minutes,1),r=pn(e.auto_end_minutes,0),n=pn(e.warn_before_seconds,0);return t===null||r===null||n===null?null:Object.freeze({consultMinutes:t,autoEndMinutes:r,warnBeforeSeconds:n})}o(xd,"parseCallLimits");function fn(e){if(!gr(e))return null;let t=e.room_url??e.url,r=e.token;if(typeof t!="string"||typeof r!="string"||!kd(t,r))return null;let n=e.recording_notice;return Object.freeze({roomUrl:t.trim(),token:r,recordingNotice:typeof n=="boolean"?n:true,callLimits:xd(e.call_limits)})}o(fn,"parseVetCallCredential");function yn(e){let t=Li(e.raw);return t!==null&&t.length>0?t:null}o(yn,"vetCallJoinReason");function Li(e){if(!gr(e))return null;let t=e.detail??e.error,n=(gr(t)?t:e).reason;return typeof n=="string"?n:null}o(Li,"reasonOf");function mn(e){if(e.httpStatus===404)return "unavailable";let t=Li(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}o(mn,"vetCallJoinRefusal");var Di=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],vr=new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),Rd=new Set(["scheduled","in_progress","awaiting_summary"]);function br(e){return Rd.has(e.status)}o(br,"isLiveConsult");var Fi=["wellness","prescription"],_d=60;function vn(e){let t=Date.parse(e.startsAt),r=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(r))return null;let n=Math.round((r-t)/6e4);return n>0?Math.min(n,_d):null}o(vn,"televetSlotMinutes");var hr=64,$e=2e3,Tr=10;function _e(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}o(_e,"isWellFormedStateCode");function De(e){return typeof e=="object"&&e!==null?e:null}o(De,"row");function Q(e){return typeof e=="string"&&e.length>0?e:null}o(Q,"str");function We(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}o(We,"trimmedOrNull");function gt(e,t){return typeof e=="boolean"?e:t}o(gt,"bool");function gn(e){return typeof e=="number"&&Number.isFinite(e)?e:null}o(gn,"num");function Ni(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}o(Ni,"closed");function vt(e,t){if(!Array.isArray(e))return Object.freeze([]);let r=[];for(let n of e){let i=t(n);i!==null&&r.push(i);}return Object.freeze(r)}o(vt,"parseList");function Mi(e,t){let r=De(e);return r===null?null:Object.freeze({state:Q(r.state)??t,wellnessAvailable:gt(r.wellness_available,false),prescriptionsAvailable:gt(r.prescriptions_available,false),cancellationPolicyText:We(r.cancellation_policy_text)})}o(Mi,"parseStatePolicy");function ji(e){let t=De(e);if(t===null)return null;let r=We(t.summary),n=We(t.version);return r===null||n===null?null:Object.freeze({summary:r,version:n})}o(ji,"parseCancellationPolicy");function zi(e){let t=De(e);if(t===null)return null;let r=Q(t.clinician_id),n=Q(t.display_name);return r===null||n===null?null:Object.freeze({clinicianId:r,displayName:n,credentials:We(t.credentials_text),rating:gn(t.rating),ratingCount:gn(t.rating_count),bio:We(t.bio),photoRef:Q(t.photo_ref),licensedStates:vt(t.licensed_states,i=>{let l=De(i),s=l===null?null:Q(l.state);return s===null?null:Object.freeze({state:s,canPrescribe:gt(l?.can_prescribe,false)})})})}o(zi,"parseClinician");function bn(e){let t=De(e);if(t===null)return null;let r=Q(t.slot_id),n=Q(t.starts_at);return r===null||n===null?null:Object.freeze({slotId:r,startsAt:n,endsAt:Q(t.ends_at)??n})}o(bn,"parseSlot");function Hi(e){let t=De(e);if(t===null)return null;let r=Q(t.slot_id),n=Q(t.hold_expires_at);return r===null||n===null?null:Object.freeze({slotId:r,expiresAt:n})}o(Hi,"parseSlotHold");function Dt(e){let t=De(e);if(t===null)return null;let r=Q(t.consult_id),n=Q(t.scheduled_at);return r===null||n===null?null:Object.freeze({consultId:r,petId:Q(t.pet_id)??"",clinicianId:Q(t.clinician_id)??"",clinicianName:We(t.display_name),reasonText:We(t.reason_text),mediaRefs:vt(t.media_refs,i=>Q(i)),status:Ni(Di,t.status),kind:Ni(Fi,t.kind),scheduledAt:n,emergencyFlagged:gt(t.emergency_flagged,false),hasRoom:Q(t.meeting_url)!==null})}o(Dt,"parseConsult");function Vi(e){let t=De(e);return Object.freeze({active:gt(t?.active,false)})}o(Vi,"parseBookingEntitlement");var Ke=240;function Ui(e){let t=De(e);if(t===null)return null;let r=gn(t.fee_cents);return r===null||r<0?null:Object.freeze({feeCents:r,currency:Q(t.currency)??"usd",feeRecorded:gt(t.fee_recorded,r>0),summary:We(t.summary)})}o(Ui,"parseCancelReceipt");var qe="/widget/v1/televet",Pd=`${qe}/state-policy`,wd=`${qe}/vets`,Wi=`${qe}/slots`,Id=`${qe}/slots/next`,Sr=`${qe}/consults`,Od=`${qe}/entitlement`,Ad=`${qe}/cancellation-policy`;function $i(e){return `${Wi}/${encodeURIComponent(e)}/hold`}o($i,"televetHoldCall");function Ki(e){return `${Sr}/${encodeURIComponent(e)}/reschedule`}o(Ki,"televetRescheduleCall");function Er(e){return `${Sr}/${encodeURIComponent(e)}`}o(Er,"televetConsultCall");function qi(e){return `${Er(e)}/join`}o(qi,"televetJoinCall");function Yi(e){return `${Er(e)}/cancel`}o(Yi,"televetCancelCall");var Gi=100;function ce(e){return R(te("validationFailed",{retryable:false,wireMessage:e}))}o(ce,"invalid");function tt(e){return R(te("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}o(tt,"unusable");function hn(e){return e.httpStatus===404}o(hn,"isDark");function bt(e,t,r){try{e?.track(t,r);}catch{}}o(bt,"safeTrack");function Ji(e){if(e.pet_id.trim().length===0)return "pet_id is required";if(e.clinician_id.trim().length===0)return "clinician_id is required";if(e.slot_id.trim().length===0)return "slot_id is required";if(!_e(e.state))return "state must be a two-letter US state code";let t=e.reason_text.trim();return t.length===0?"reason_text is required":t.length>$e?`reason_text must be at most ${$e} characters`:Bd(e)}o(Ji,"validateBookingBody");function Bd(e){let t=e.state_attested===true,r=e.cancellation_policy_version?.trim()??"";return t!==r.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":r.length>hr?`cancellation_policy_version must be at most ${hr} characters`:null}o(Bd,"attestationRefusal");function Sn(e){let t=e.funnel??et({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=e.telemetry;return {async statePolicy(n,i){let l=n.trim();if(!_e(l))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.state_policy",{method:"GET",path:`${Pd}/${encodeURIComponent(l)}`,...i?{signal:i}:{}});if(!s.ok)return R(s.error);let a=Mi(s.value,l);return a===null?tt("the state policy response was unreadable"):F(a)},async entitlement(n){let i=await t.send("televet.booking.entitlement",{method:"GET",path:Od,...n?{signal:n}:{}});return i.ok?F(Vi(i.value)):R(i.error)},async cancellationPolicy(n){let i=await t.send("televet.booking.cancellation_policy",{method:"GET",path:Ad,...n?{signal:n}:{}});return i.ok?F(ji(i.value)):F(null)},async clinicians(n,i){let l=n.trim();if(!_e(l))return ce("state must be a two-letter US state code");let s=await t.send("televet.booking.clinicians",{method:"GET",path:wd,query:{state:l},...i?{signal:i}:{}});return s.ok?F(vt(Tn(s.value,"vets"),zi)):hn(s.error)?F(Object.freeze([])):R(s.error)},async slots(n,i){let l=n.trim();if(l.length===0)return ce("clinicianId is required");let s=await t.send("televet.booking.slots",{method:"GET",path:Wi,query:{clinician_id:l},...i?{signal:i}:{}});return s.ok?F(vt(Tn(s.value,"slots"),bn)):hn(s.error)?F(Object.freeze([])):R(s.error)},async nextSlot(n){let i=await t.send("televet.booking.next_slot",{method:"GET",path:Id,...n?{signal:n}:{}});return i.ok?F(bn(Nd(i.value,"slot"))):F(null)},async holdSlot(n){let i=n.trim();if(i.length===0)return ce("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:$i(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return bt(r,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),R(l.error);let s=Hi(l.value);return s===null?tt("the hold response carried no usable expiry"):F(s)},async book(n,i){let l=Ji(n);if(l!==null)return ce(l);let s=i.trim();if(s.length===0)return ce("idempotencyKey is required");let a=await t.send("televet.booking.book",{method:"POST",path:Sr,body:Ld(n)},{idempotent:true,idempotencyKey:s,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.book_failed",{status:a.error.httpStatus??null}),R(mr(a.error));let d=Dt(a.value);return d===null?tt("the booking response was unreadable"):br(d)?F(d):(bt(r,"televet.booking.book_failed",{status:null,consult_status:d.status}),R(yr(d.status)))},async reschedule(n,i){let l=n.trim(),s=i.trim();if(l.length===0)return ce("consultId is required");if(s.length===0)return ce("slotId is required");let a=await t.send("televet.booking.reschedule",{method:"POST",path:Ki(l),body:{new_slot_id:s}},{idempotent:false,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.reschedule_failed",{status:a.error.httpStatus??null}),R(a.error);let d=Dt(a.value);return d===null?tt("the reschedule response was unreadable"):F(d)},async listConsults(n){let i=await t.send("televet.booking.consults",{method:"GET",path:Sr,query:{limit:String(Gi)},...n?{signal:n}:{}});return i.ok?F(vt(Tn(i.value,"consults"),Dt)):hn(i.error)?F(Object.freeze([])):R(i.error)},async getConsult(n,i){let l=n.trim();if(l.length===0)return ce("consultId is required");let s=await t.send("televet.booking.consult",{method:"GET",path:Er(l),...i?{signal:i}:{}});if(!s.ok)return R(s.error);let a=Dt(s.value);return a===null?tt("the consult response was unreadable"):F(a)},async joinConsult(n){let i=n.trim();if(i.length===0)return ce("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:qi(i)},{idempotent:false,maxAttempts:1});if(!l.ok)return bt(r,"televet.booking.join_failed",{status:l.error.httpStatus??null}),R(l.error);let s=fn(l.value);return s===null?tt("the join response carried no usable room credential"):F(s)},async cancelConsult(n,i){let l=n.trim(),s=i.trim();if(l.length===0)return ce("consultId is required");if(s.length===0)return ce("reason is required");if(s.length>Ke)return ce(`reason must be at most ${Ke} characters`);let a=await t.send("televet.booking.cancel",{method:"POST",path:Yi(l),body:{reason:s}},{idempotent:false,maxAttempts:1});if(!a.ok)return bt(r,"televet.booking.cancel_failed",{status:a.error.httpStatus??null}),R(a.error);let d=Ui(a.value);return d===null?tt("the cancel response was unreadable"):F(d)}}}o(Sn,"createTelevetBookingController");function Ld(e){let t=e.cancellation_policy_version?.trim()??"",r=e.state_attested===true&&t.length>0;return {pet_id:e.pet_id,clinician_id:e.clinician_id,slot_id:e.slot_id,state:e.state,reason_text:e.reason_text.trim(),species:e.species,media_refs:[...e.media_refs],emergency_acknowledged:e.emergency_acknowledged,share_health_records:e.share_health_records,...r?{state_attested:true,cancellation_policy_version:t}:{}}}o(Ld,"bookingWireBody");function Tn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let r=e,n=r[t]??r.items??r.data;if(Array.isArray(n))return n}return e}o(Tn,"rows");function Nd(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let r=e,n=r[t]??r.data;if(typeof n=="object"&&n!==null)return n}return e}o(Nd,"unwrap");var Xi=Symbol.for("@everfur/sdk#EverfurContext@v1"),Qi=globalThis,Zi=Qi[Xi]??(Qi[Xi]=react.createContext(null));Zi.displayName??="EverfurContext";function Te(){let e=react.useContext(Zi);if(e===null)throw new Bt("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return e}o(Te,"useEverfurContext");var Md=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 jd(e){return Md[e]}o(jd,"requires");function el(e,t,r){let n=jd(e),i=new Map;for(let a of t)i.set(a.resource,a);if(r?.isPending===true&&n.some(a=>!i.has(a)))return En({name:e,enabled:false,isPending:true,limits:{}});let l=zd(n,i);return n.filter(a=>i.get(a)?.granted!==true).length===0?En({name:e,enabled:true,isPending:false,limits:l}):En({name:e,enabled:false,isPending:false,limits:l,disabled:Hd(n,i)})}o(el,"decideCapability");function zd(e,t){let r={};for(let n of e){let i=t.get(n)?.limits;if(i)for(let[l,s]of Object.entries(i)){let a=r[l];r[l]=a===void 0?s:Math.min(a,s);}}return r}o(zd,"mergeLimits");function Hd(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:ln("accessDenied"),level:"user_entitlement",recoverable:false})}o(Hd,"disabledFor");function En(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)}o(En,"freezeDecision");function Ft(e){let{runtime:t}=Te(),r=t.entitlements,n=react.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return react.useMemo(()=>el(e,n.decisions,{isPending:n.isPending}),[e,n])}o(Ft,"useCapability");function Se(e){let{runtime:t,userRef:r,scopeEpoch:n}=Te();return react.useMemo(()=>{if(e)return e;if(r===null)return null;let{services:i}=t.registry;return Sn({auth:i.authFor(r),telemetry:i.telemetry,...i.errorPolicy?{errorPolicy:i.errorPolicy}:{}})},[t,r,n,e])}o(Se,"useTelevetBookingController");function Wd(){let{userRef:e}=Te(),t=Ft("televet");return react.useMemo(()=>({available:t.enabled&&e!==null,isPending:t.isPending}),[t.enabled,t.isPending,e])}o(Wd,"useTelevetBookingAvailable");function rt(e,t,r){let[n,i]=react.useState(()=>({key:e,data:null,isPending:t&&r!==null,error:null})),[l,s]=react.useState(0),a=react.useRef(r);a.current=r,react.useEffect(()=>{let p=a.current;if(!t||p===null){i({key:e,data:null,isPending:false,error:null});return}let f=new AbortController,m=true;return i(c=>c.key===e?{...c,isPending:true,error:null}:{key:e,data:null,isPending:true,error:null}),(async()=>{let c;try{c=await p(f.signal);}catch{m&&i({key:e,data:null,isPending:false,error:null});return}m&&(c.ok?i({key:e,data:c.value,isPending:false,error:null}):i({key:e,data:null,isPending:false,error:c.error}));})(),()=>{m=false,f.abort();}},[e,t,l]);let d=react.useCallback(()=>s(p=>p+1),[]),u=n.key===e;return react.useMemo(()=>({enabled:t,data:u?n.data:null,isPending:t&&(!u||n.isPending),isError:u&&n.error!==null,error:u?n.error:null,refetch:d}),[t,u,n.data,n.isPending,n.error,d])}o(rt,"useTelevetRead");function kn(e,t){let r=e?.trim()??"",n=t?.statePolicy!==void 0&&_e(r),i=t?.statePolicy;return rt(`state-policy:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(kn,"useTelevetStatePolicy");function xn(e){let t=e?.entitlement!==void 0,r=e?.entitlement;return rt("entitlement",t,t&&r?n=>r.call(e,n):null)}o(xn,"useTelevetBookingEntitlement");function Mt(e){let t=e?.cancellationPolicy!==void 0,r=e?.cancellationPolicy;return rt("cancellation-policy",t,t&&r?n=>r.call(e,n):null)}o(Mt,"useTelevetCancellationPolicy");function Rn(e,t){let r=e?.trim()??"",n=t?.clinicians!==void 0&&_e(r),i=t?.clinicians;return rt(`clinicians:${r}`,n,n&&i?l=>i.call(t,r,l):null)}o(Rn,"useTelevetClinicians");function jt(e,t){let r=e?.trim()??"",n=t!==null&&r.length>0;return rt(`slots:${r}`,n,n&&t?i=>t.slots(r,i):null)}o(jt,"useTelevetSlots");function _n(e){let t=e?.nextSlot!==void 0,r=e?.nextSlot;return rt("next-slot",t,t&&r?n=>r.call(e,n):null)}o(_n,"useTelevetNextSlot");function Pn(e){let[t,r]=react.useState(null),n=react.useRef(true),i=react.useRef(false),l=react.useRef(e);l.current=e,react.useEffect(()=>(n.current=true,()=>{n.current=false;}),[]);let s=react.useCallback((...a)=>{let d=l.current;if(d===null||i.current)return;let u=a[a.length-1],p=typeof u=="object"&&u!==null&&("onSuccess"in u||"onError"in u),f=p?u:void 0,m=p?a.slice(0,-1):a;i.current=true,r({variables:m[0]??null}),(async()=>{let c=null;try{c=await d(...m);}catch{c=null;}i.current=false,n.current&&r(null),c!==null&&(c.ok?f?.onSuccess?.(c.value):f?.onError?.(c.error));})();},[]);return react.useMemo(()=>({isPending:t!==null,variables:t?.variables??null,mutate:s}),[t,s])}o(Pn,"useTelevetWrite");function zt(e){return Pn(e?t=>e.holdSlot(t):null)}o(zt,"useTelevetHoldSlot");function wn(e){return Pn(e?(t,r)=>e.book(t,r):null)}o(wn,"useTelevetBookConsult");function In(e,t){return Pn(t&&e?r=>t.reschedule(e,r):null)}o(In,"useTelevetRescheduleConsult");function xr(e,t=0){let r=e?.listConsults!==void 0,n=e?.listConsults;return rt(`consults:${t}`,r,r&&n?i=>n.call(e,i):null)}o(xr,"useTelevetConsults");function Ht(e){return e.error!==null&&e.error.httpStatus===404}o(Ht,"televetReadIsDark");var On=15,An=250,nl=new Set(["scheduled","in_progress"]);function nt(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}o(nt,"startsAtMs");function Bn(e){let t=nt(e);return t===null?null:t-On*6e4}o(Bn,"televetJoinOpensAtMs");function Ln(e,t){if(!nl.has(e.status))return {joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return {joinable:false,reason:"room_not_ready"};let r=nt(e);return r===null||t<r-On*6e4?{joinable:false,reason:"too_early"}:t>r+An*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}o(Ln,"televetJoinDecision");function Vt(e,t){let r=[],n=[];for(let i of e){let l=nt(i);(nl.has(i.status)&&l!==null&&l+An*6e4>t?r:n).push(i);}return r.sort((i,l)=>(nt(i)??0)-(nt(l)??0)),n.sort((i,l)=>(nt(l)??0)-(nt(i)??0)),Object.freeze({upcoming:Object.freeze(r),past:Object.freeze(n)})}o(Vt,"splitTelevetVisits");function Nn(e){return e==="scheduled"}o(Nn,"canManageTelevetVisit");function ol(e){let t=xr(e);return t.enabled?t.isPending?"pending":t.isError||Vt(t.data??[],Date.now()).upcoming.length>0?"visits":"booking":"booking"}o(ol,"useTelevetLanding");var I=Object.freeze({bookCardTitle:"Book a video visit",bookCardCta:"Find a time",upcomingTitle:"Upcoming visits",pastTitle:"Past visits",emptyTitle:"No visits yet",emptyBody:"When you book a video visit, it will appear here.",loading:"Loading your visits\u2026",loadErrorTitle:"Could not load your visits",loadErrorBody:"Check your connection and try again.",retry:"Try again",joinCta:"Join visit",joining:"Joining\u2026",rescheduleCta:"Reschedule",cancelCta:"Cancel visit",cancelConfirmTitle:"Cancel this visit?",cancellationReasonLabel:"Why are you cancelling?",cancelConfirmCta:"Cancel visit",cancellingVisit:"Cancelling visit\u2026",cancelDismissCta:"Keep visit",cancelledTitle:"Visit cancelled",cancellationFeeRecorded:"A late cancellation fee was recorded for this visit.",cancellationFeeNotRecorded:"No late cancellation fee was recorded for this visit.",loadingCancellationTerms:"Loading cancellation terms\u2026",cancellationTermsUnavailable:"We could not confirm the current cancellation terms. Try again before continuing.",cancellationReasonMissing:"Tell us why you are cancelling.",cancellationReasonTooLong:o(e=>`Keep the reason to ${String(e)} characters or fewer.`,"cancellationReasonTooLong"),cancelTermsFirst:"We could not confirm the cancellation terms. Please try again before cancelling.",cancelFailed:"We could not cancel this visit. Refresh your visits to confirm its status before trying again."});function il(e){switch(e){case "scheduled":return "Scheduled";case "in_progress":return "In progress";case "awaiting_summary":return "Summary on its way";case "completed":return "Completed";case "cancelled_owner":return "Cancelled by you";case "cancelled_ops":return "Cancelled by Everfur";case "no_show_owner":return "Missed";case "no_show_vet":return "Vet couldn't attend";default:return null}}o(il,"televetVisitStatusWeb");function ll(e,t){if(e==="too_early")return t?`This visit opens at ${t}. You can join from then.`:"This visit has not opened yet.";if(e==="too_late")return "This visit has ended.";if(e==="room_not_ready")return "We are still setting up the video room. Try again in a moment.";switch(e){case "status_cancelled_owner":return "You cancelled this visit.";case "status_cancelled_ops":return "This visit was cancelled. Please book another time.";case "status_no_show_owner":return "This visit was missed.";case "status_no_show_vet":return "The vet could not make this visit. Please book another time.";case "status_awaiting_summary":return "This visit has ended. Your summary is on its way.";case "status_completed":return "This visit has ended.";default:return "This visit cannot be joined right now."}}o(ll,"televetJoinBlockWeb");var Mn=class Mn 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}};o(Mn,"HostRenderBoundary");var Dn=Mn;function Kd({render:e}){return e()}o(Kd,"RenderHost");function Fn({render:e,fallback:t,resetKey:r}){return react.createElement(Dn,{fallback:t,resetKey:r,children:react.createElement(Kd,{render:e})})}o(Fn,"HostRender");function Hn(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){Object.freeze(e);for(let t of Object.keys(e))Hn(e[t]);}return e}o(Hn,"deepFreeze");var qd=Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3}),dl={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ul={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},sl={nano:8,small:9,micro:10,tiny:11,caption:12,bodyTight:13,body:14,subtitle:16,heading:18,verdict:24},Yd={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},Gd={regular:"400",medium:"500",bold:"700"},Jd={eyebrow:1,monoWide:.9,headerBrand:-0.42,tight:-0.35},Xd=0,Rr="System",_r="monospace",Qd=["content","heading","control","compact","badge"];function Zd(e){let t={};for(let r of Qd)t[r]=e;return t}o(Zd,"authoredTierSizes");function cl(){return {family:Rr,mono:_r,fontUrl:null,families:{regular:Rr,medium:Rr,bold:Rr,mono:_r,monoMedium:_r,monoBold:_r},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:sl,tierSizes:Zd(sl),lineHeight:Yd,weight:Gd,letterSpacing:Jd,scale:1,maxScale:Xd,scaleCaps:qd}}o(cl,"baseType");var pl={},jn=Object.freeze({standard:Object.freeze([.2,0,0,1]),emphasized:Object.freeze([.2,.8,.2,1]),exit:Object.freeze([.4,0,1,1])});function zn(e){return `cubic-bezier(${e.join(", ")})`}o(zn,"cssCubicBezier");var fl={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:zn(jn.standard),emphasized:zn(jn.emphasized),exit:zn(jn.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",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#EFE9E3",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)"},yl=Hn({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:eu,space:dl,radius:ul,type:cl(),motion:fl,slots:pl}),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",bubbleVet:"#FFC3BC",onBubbleVet:"#111111",skeleton:"#23272C",scanButtonPink:"#FFC3BC",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)"};Hn({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false},color:tu,space:dl,radius:ul,type:cl(),motion:fl,slots:pl});var ml=Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),gl=globalThis,Vn=gl[ml]??(gl[ml]=react.createContext(yl));Vn.displayName??="EverfurThemeContext";function w(){return react.useContext(Vn)}o(w,"useEverfurTheme");var vl=Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});var bl='system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',ou="System";function iu(e){let t=e.trim();return t.length===0||t===ou?bl:`${hl(t)}, ${bl}`}o(iu,"cssFontFamily");function lu(e){let t=e.trim();return t.length===0||t==="monospace"?"ui-monospace, Menlo, Consolas, monospace":`${hl(t)}, ui-monospace, Menlo, Consolas, monospace`}o(lu,"cssMonoFamily");function hl(e){return `"${e.replace(/[\\"]/g,"\\$&")}"`}o(hl,"quote");function T(e,t){let r=e.type,n=r.families[t];return {fontFamily:t==="mono"||t==="monoMedium"||t==="monoBold"?lu(n):iu(n),fontWeight:r.namedFaces[t]?r.weight.regular:r.weight[vl[t]]}}o(T,"faceCss");var ht=Object.freeze({textAlign:"start"});var au=48;function su(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}o(su,"selectView");function El(e){let{capability:t,children:r,renderDisabled:n,renderPending:i,style:l,className:s}=e,a=Ft(t),d=react.useMemo(()=>su(a),[a]);switch(d){case "enabled":return r;case "pending":return i?jsxRuntime.jsx(Fn,{render:i,fallback:jsxRuntime.jsx(Tl,{capability:t,style:l,className:s})}):jsxRuntime.jsx(Tl,{capability:t,style:l,className:s});case "disabled":return n?jsxRuntime.jsx(Fn,{render:()=>n(a),fallback:jsxRuntime.jsx(Sl,{decision:a,style:l,className:s}),resetKey:a}):jsxRuntime.jsx(Sl,{decision:a,style:l,className:s});default:return dr(d)}}o(El,"CapabilityGate");function Tl({capability:e,style:t,className:r}){let n=w(),i=react.useMemo(()=>Cl(n),[n]);return jsxRuntime.jsx("div",{role:"status","aria-busy":"true","aria-label":`Loading ${e}`,className:r,style:{...i.offstate,...t},children:jsxRuntime.jsx("div",{style:i.skeletonBar})})}o(Tl,"PendingSkeleton");function Sl({decision:e,style:t,className:r}){let n=w(),i=react.useMemo(()=>Cl(n),[n]),l=e.disabled?.reason??"";return jsxRuntime.jsx("div",{className:r,style:{...i.offstate,...t},children:l.length>0?jsxRuntime.jsx("p",{style:i.offstateText,children:l}):null})}o(Sl,"OffState");function Cl(e){let{color:t,space:r,radius:n,type:i}=e;return {offstate:{...ht,boxSizing:"border-box",minHeight:au,display:"flex",flexDirection:"column",justifyContent:"center",padding:`${r.md}px ${r.lg}px`,backgroundColor:t.surfaceCream,borderRadius:n.md,border:`1px solid ${t.brandBorder}`},offstateText:{margin:0,...T(e,"regular"),fontSize:i.size.body,lineHeight:`${Math.round(i.size.body*i.lineHeight.normal)}px`,color:t.text.muted},skeletonBar:{height:r.md,borderRadius:n.xs,backgroundColor:t.brandSofter}}}o(Cl,"makeStyles");function Tt(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}o(Tt,"hasLoneSurrogate");function St(e){return [...e].length}o(St,"serverLength");var kl=Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function xl(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(kl,t)?kl[t]:null}o(xl,"canonicalPetSpecies");var Rl=50,du=128,Wn=120,_l=120,uu=2e3,Pl=120,cu=80,Ol=new Set(["male","female","unknown"]),Al=new Set(["day","month","year"]),Bl=new Set(["low","medium","high","athletic"]),Ll=new Set(["indoor","outdoor","both"]),Nl=new Set(["mild","moderate","severe"]),pu=/^(\d{4})-(\d{2})-(\d{2})$/,Dl=[["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"]],Fl=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];Object.freeze([...Dl,...Fl].map(([e])=>e));function fu(e){let t=pu.exec(e);if(t===null)return false;let[r,n,i]=[Number(t[1]),Number(t[2]),Number(t[3])],l=new Date(Date.UTC(r,n-1,i));return l.getUTCFullYear()===r&&l.getUTCMonth()===n-1&&l.getUTCDate()===i}o(fu,"isRealDate");var Wt=o(e=>(t,r)=>typeof r=="string"&&e.has(r)?null:`${t} must be one of ${[...e].join(", ")}`,"oneOf"),yu=o((e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,"boolean"),wr=o((e,t)=>typeof t=="string"&&fu(t)?null:`${e} must be a real date written YYYY-MM-DD`,"date"),we=o((e,t={})=>(r,n)=>{if(typeof n!="string")return `${r} must be a string`;if(Tt(n))return `${r} contains an unpaired surrogate and cannot be encoded`;let i=t.trimmed?n.trim():n;if(t.required&&i.length===0)return `${r} is required and must not be blank`;let l=St(i);return l<=e?null:`${r} is ${l} characters; the server accepts at most ${e}`},"text"),mu={sex:Wt(Ol),spayedNeutered:yu,birthDate:wr,birthDatePrecision:Wt(Al),activityLevel:Wt(Bl),indoorOutdoor:Wt(Ll),foodBrand:we(Pl),foodType:we(Pl),microchipId:we(cu)},$n=["ref","ref",false,we(du,{required:true,trimmed:true})],Kn=["notes","notes",false,we(uu,{trimmed:true})],wl=[$n,["name","name",true,we(Wn,{required:true,trimmed:true})],["dose","dose",false,we(_l,{trimmed:true})],["frequency","frequency",false,we(_l,{trimmed:true})],["startDate","start_date",false,wr],["endDate","end_date",false,wr],Kn],gu={allergies:[$n,["allergen","allergen",true,we(Wn,{required:true,trimmed:true})],["severity","severity",false,Wt(Nl)],Kn],medications:wl,supplements:wl,conditions:[$n,["conditionName","condition_name",true,we(Wn,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,wr],Kn]};function vu(e,t,r){let n=`${e}[${t}]`;if(typeof r!="object"||r===null||Array.isArray(r))return {error:`${n} must be an object`};let i=r,l={};for(let[d,u,p,f]of gu[e]){let m=i[d];if(m==null){if(p)return {error:`${n}.${d} is required`};m===null&&(l[u]=null);continue}let c=f(`${n}.${d}`,m);if(c!==null)return {error:c};l[u]=m;}let s=l.start_date,a=l.end_date;return typeof s=="string"&&typeof a=="string"&&a<s?{error:`${n}.endDate must not be before startDate`}:{item:l}}o(vu,"itemToWire");function bu(e,t){if(!Array.isArray(t))return {error:`${e} must be an array (send [] to clear it)`};if(t.length>Rl)return {error:`${e} has ${t.length} items; the server accepts at most ${Rl}`};let r=[],n=new Set;for(let i=0;i<t.length;i+=1){let l=vu(e,i,t[i]);if("error"in l)return l;let s=l.item.ref;if(typeof s=="string"){let a=s.trim();if(n.has(a))return {error:`${e}: ref ${JSON.stringify(a)} is used twice; a ref names one item`};n.add(a);}r.push(l.item);}return {items:r}}o(bu,"listToWire");function Ml(e,t){let r=e,n={};for(let[s,a]of Dl){let d=r[s];if(d!==void 0){if(d!==null){let u=mu[s](s,d);if(u!==null)return {error:u}}n[a]=d;}}let i=r.birthDate!==void 0,l=r.birthDatePrecision!==void 0;if(i!==l||i&&r.birthDate===null!=(r.birthDatePrecision===null))return {error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[s,a]of Fl){let d=r[s];if(d===void 0)continue;let u=bu(s,d);if("error"in u)return u;n[a]=u.items;}return Object.keys(n).length>0&&t!==void 0&&xl(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}}o(Ml,"petHealthToWire");var J=o(e=>typeof e=="string"?e:null,"str"),Ut=o((e,t)=>typeof t=="string"&&e.has(t)?t:null,"pick"),hu=o(e=>typeof e=="boolean"?e:null,"bool");function Pr(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([])}o(Pr,"itemsFromWire");function Il(e){let t=J(e.name);return t===null||t.length===0?null:Object.freeze({ref:J(e.ref),name:t,dose:J(e.dose),frequency:J(e.frequency),startDate:J(e.start_date),endDate:J(e.end_date),notes:J(e.notes)})}o(Il,"medicationFromWire");function jl(e){let t=e.profile_version;return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:Ut(Ol,e.sex),spayedNeutered:hu(e.spayed_neutered),birthDate:J(e.birth_date),birthDatePrecision:Ut(Al,e.birth_date_precision),activityLevel:Ut(Bl,e.activity_level),indoorOutdoor:Ut(Ll,e.indoor_outdoor),foodBrand:J(e.food_brand),foodType:J(e.food_type),microchipId:J(e.microchip_id),allergies:Pr(e.allergies,r=>{let n=J(r.allergen);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),allergen:n,severity:Ut(Nl,r.severity),notes:J(r.notes)})}),medications:Pr(e.medications,Il),supplements:Pr(e.supplements,Il),conditions:Pr(e.conditions,r=>{let n=J(r.condition_name);return n===null||n.length===0?null:Object.freeze({ref:J(r.ref),conditionName:n,diagnosedDate:J(r.diagnosed_date),notes:J(r.notes)})})})}o(jl,"petHealthFromWire");var Vl=100,Ul=50,Wl=100,$l=50,Kl=500,Tu=128,Su=6e4;function Oe(e){return te("validationFailed",{retryable:false,wireMessage:e})}o(Oe,"invalid");function ot(e,t,r){if(typeof t!="string")return Oe(`${e} must be a string`);let n=St(t);return n<=r?null:Oe(`${e} is ${n} characters; the server accepts at most ${r}`)}o(ot,"checkString");function Ir(e,t,r){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=r?null:Oe(`${e} must be a finite number between 0 and ${r}`)}o(Ir,"outOfRange");function zl(e,t){if(typeof e!="string")return Oe("pet_ref must be a string");if(e.trim().length===0)return Oe("pet_ref must not be blank");if(Tt(e))return Oe("pet_ref contains an unpaired surrogate and cannot be encoded");if(t!=null&&typeof t!="object")return Oe("profile must be an object");let r=[ot("pet_ref",e,Tu)];return t?.name!==void 0&&r.push(ot("name",t.name,Vl)),t?.species!==void 0&&r.push(ot("species",t.species,Ul)),t?.breed!==void 0&&r.push(ot("breed",t.breed,Wl)),t?.ageYears!==void 0&&r.push(Ir("age_years",t.ageYears,$l)),t?.weightKg!==void 0&&r.push(Ir("weight_kg",t.weightKg,Kl)),r.find(n=>n!==null)??null}o(zl,"validate");function ql(e,t){let r=Ml(e,t);return "error"in r?{error:Oe(r.error)}:r}o(ql,"healthToWire");function Eu(e){if(typeof e!="object"||e===null)return {error:Oe("patch must be an object")};let t=e,r=[["name","name",l=>ot("name",l,Vl)],["species","species",l=>ot("species",l,Ul)],["breed","breed",l=>ot("breed",l,Wl)],["ageYears","age_years",l=>Ir("age_years",l,$l)],["weightKg","weight_kg",l=>Ir("weight_kg",l,Kl)]],n={};for(let[l,s,a]of r){let d=t[l];if(d!==void 0){if(d!==null){let u=a(d);if(u!==null)return {error:u}}n[s]=d;}}let i=ql(t,t.species);return "error"in i?i:(Object.assign(n,i.body),Object.keys(n).length===0?{error:Oe("patch must change at least one field")}:{body:n})}o(Eu,"patchToWire");function Cu(e){if(e==null)return {body:{}};let t=ql(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}}}o(Cu,"toWire");var Ie=o(e=>typeof e=="string"?e:null,"str"),Or=o(e=>typeof e=="number"&&Number.isFinite(e)?e:null,"num");function Hl(e,t){let r=typeof e=="object"&&e!==null?e:{};return Object.freeze({petRef:Ie(r.pet_ref)??t,name:Ie(r.name),species:Ie(r.species),breed:Ie(r.breed),ageYears:Or(r.age_years),weightKg:Or(r.weight_kg)})}o(Hl,"fromWire");function Yl(e){if(typeof e!="object"||e===null)return null;let t=e,r=Ie(t.pet_ref);return r===null||r.length===0?null:Object.freeze({petId:Ie(t.pet_id),petRef:r,name:Ie(t.name),species:Ie(t.species),breed:Ie(t.breed),ageYears:Or(t.age_years),weightKg:Or(t.weight_kg),updatedAt:Ie(t.updated_at)})}o(Yl,"widgetPetFromWire");function ku(e){let t=Yl(e);return t===null?null:Object.freeze({...t,...jl(e)})}o(ku,"widgetPetProfileFromWire");function xu(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=Yl(r);return n===null?[]:[n]}))}o(xu,"petListFromWire");function Gl(e){return Ru(et({auth:e}),et({auth:e,unaryTimeoutMs:Su}))}o(Gl,"createPetsRepository");function Ru(e,t=e){let r=o((i,l)=>l?{...i,signal:l}:i,"withSignal"),n=o(i=>zl(i,void 0)??`/widget/v1/pets/${encodeURIComponent(i)}`,"petPath");return {async list(i){let l=await e.send("pets.list",r({method:"GET",path:"/widget/v1/pets"},i?.signal));return l.ok?F(xu(l.value)):R(l.error)},async registerPet(i,l,s){let a=zl(i,l);if(a!==null)return R(a);let d=Cu(l);if("error"in d)return R(d.error);let p={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(i)}`,body:d.body},f=await e.send("pets.registerPet",s?.signal?{...p,signal:s.signal}:p);return f.ok?F(Hl(f.value,i)):R(f.error)},async updatePet(i,l,s){let a=n(i);if(typeof a!="string")return R(a);let d=Eu(l);if("error"in d)return R(d.error);let u=await e.send("pets.updatePet",r({method:"PATCH",path:a,body:d.body},s?.signal));return u.ok?F(Hl(u.value,i)):R(u.error)},async getPetProfile(i,l){let s=n(i);if(typeof s!="string")return R(s);let a=await e.send("pets.getPetProfile",r({method:"GET",path:`${s}/profile`},l?.signal));if(!a.ok)return R(a.error);let d=ku(a.value);return d===null?R(te("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):F(d)},async deletePet(i,l){let s=n(i);if(typeof s!="string")return R(s);let a=await e.send("pets.deletePet",r({method:"DELETE",path:s},l?.signal));return a.ok?F(void 0):R(a.error)},async eraseUserData(i){let l=await t.send("pets.eraseUserData",r({method:"DELETE",path:"/widget/v1/me"},i?.signal),{maxAttempts:1});return l.ok?F(void 0):R(l.error)}}}o(Ru,"createPetsRepositoryOver");function Ar(){let{runtime:e,userRef:t,activePet:r,scopeEpoch:n}=Te(),i=react.useMemo(()=>Gl(e.registry.services.authFor(t)),[e,t,n]),[l,s]=react.useState({repository:i,pets:[],loading:true,error:null}),a=l.repository===i?l:{pets:[],loading:true,error:null},d=react.useRef(0),u=react.useCallback(async()=>{let f=++d.current;s(c=>({...c,repository:i,loading:true,error:null,pets:c.repository===i?c.pets:[]}));let m=await i.list();f===d.current&&s(m.ok?{repository:i,pets:m.value,loading:false,error:null}:c=>({repository:i,pets:c.repository===i?c.pets:[],loading:false,error:m.error}));},[i]);react.useEffect(()=>(u(),()=>{d.current+=1;}),[u]);let p=react.useMemo(()=>r===null?null:a.pets.find(f=>f.petRef===r)??null,[r,a.pets]);return react.useMemo(()=>({pets:a.pets,activePet:p,loading:a.loading,error:a.error,refresh:u}),[a.pets,a.loading,a.error,p,u])}o(Ar,"useEverfurPets");var $t=Object.freeze(["pet","issues","reason","clinician","time","review","booked"]),Jl=Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function Gn(e,t={}){let r=Object.freeze({...Jl,...t}),n=Yn(0,e);return Object.freeze({index:n,draft:r,furthestIndex:n})}o(Gn,"initialTelevetBookingState");function Br(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}o(Br,"isSkipped");function Lr(e){return $t[e]}o(Lr,"stepAt");function Yn(e,t){for(let r=e;r<$t.length;r+=1){let n=Lr(r);if(n&&!Br(n,t))return r}return $t.length-1}o(Yn,"nextVisible");function Xl(e,t){for(let r=e;r>=0;r-=1){let n=Lr(r);if(n&&!Br(n,t))return r}return null}o(Xl,"previousVisible");function Jn(e,t){return Xl(e.index-1,t)!==null}o(Jn,"hasPreviousStep");function Xn(e,t,r){switch(t.type){case "patch":{let n={...e.draft,...t.patch};return ("petId"in t.patch&&t.patch.petId!==e.draft.petId||"state"in t.patch&&t.patch.state!==e.draft.state||"clinicianId"in t.patch&&t.patch.clinicianId!==e.draft.clinicianId)&&e.draft.slot?Object.freeze({...e,draft:Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):Object.freeze({...e,draft:Object.freeze(n)})}case "next":{let n=Yn(e.index+1,r);return Object.freeze({...e,index:n,furthestIndex:Math.max(e.furthestIndex,n)})}case "back":{if(Lr(e.index)==="booked")return e;let n=Xl(e.index-1,r);return n===null?e:Object.freeze({...e,index:n})}case "goTo":{let n=$t.indexOf(t.step);if(n<0)return e;let i=Br(t.step,r)?Yn(n,r):n;return Object.freeze({...e,index:i,furthestIndex:Math.max(e.furthestIndex,i)})}default:return e}}o(Xn,"televetBookingReducer");function Qn(e){return Lr(e.index)??"pet"}o(Qn,"currentStep");function Kt(e,t){let r=t.trim();return !!e.petId&&!!e.clinicianId&&!!e.slot&&_e(e.state)&&r.length>0&&r.length<=$e}o(Kt,"canConfirm");function Nr(e,t){if(!e.holdExpiresAt)return false;let r=Date.parse(e.holdExpiresAt);return Number.isNaN(r)?false:r<=t}o(Nr,"isHoldExpired");function Ql(e,t,r){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!Nr(e,r)}o(Ql,"holdsSlot");var Zl=Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),Ou=dn();function Zn(e){return `televet.book.${Ou()}.${e}`}o(Zn,"televetBookingKey");function eo(e,t,r){let n=r?.version?.trim()??"";return !e||!t||n.length===0?Object.freeze({}):Object.freeze({state_attested:true,cancellation_policy_version:n})}o(eo,"attestation");var Au=Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"upset-stomach",label:"Upset stomach"},{id:"ear-infections",label:"Ear infections"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks, and heartworm"},{id:"joint-pain",label:"Joint pain and mobility"},{id:"eye-issues",label:"Eye issues"},{id:"urinary",label:"Urinary issues"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-dog-care",label:"Senior dog care",species:"dog"}]),Bu="other";function Lu(e){let t=e?.trim().toLowerCase()??"";return t.startsWith("dog")?"dog":t.startsWith("cat")?"cat":null}o(Lu,"televetIssueSpecies");function ea(e){let t=Lu(e),r=Au.filter(n=>!n.species||n.species===t).map(({id:n,label:i})=>Object.freeze({id:n,label:i}));return Object.freeze([...r,Object.freeze({id:Bu,label:y.otherIssue})])}o(ea,"televetIssueChips");function ta(e,t){let r=e.filter(i=>i.trim().length>0),n=t.trim();return r.length===0?n:n.length===0?r.join(", "):`${r.join(", ")}
2
2
  ${n}`}o(ta,"composeTelevetReason");function Fe(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}o(Fe,"parse");function Et(e){let t=Fe(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}o(Et,"formatClock");function Nu(e){let t=Fe(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}o(Nu,"formatDate");var it=10;function Ct(e){let t=Fe(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"":""}o(Ct,"formatZone");function Du(e){let t=Fe(e);if(!t)return "";let r=new Date(t.getTime()+it*6e4).toISOString(),n=Ct(e),i=`${Et(e)} - ${Et(r)}`;return n&&n!==""?`${i} ${n}`:i}o(Du,"formatVisitRange");function ra(e){let t=Nu(e),r=[Et(e),Ct(e)].filter(Boolean).join(" ");return [t,r].filter(Boolean).join(", ")}o(ra,"formatWhen");function Ee(e){let t=Fe(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),ra(e)].filter(Boolean).join(", "):""}o(Ee,"formatWhenWithDay");function na(e){let t=Fe(e);if(!t)return "";let r=t.toLocaleString(void 0,{weekday:"short",day:"numeric",month:"short",hour:"numeric",minute:"2-digit"}),n=Ct(e);return n?`${r} ${n}`:r}o(na,"formatShortDateTimeWithZone");function oa(e){return [Et(e),Ct(e)].filter(Boolean).join(" ")}o(oa,"formatClockWithZone");function qt(e){let t=Fe(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}o(qt,"localDayKey");function ia(e){let t=Fe(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}o(ia,"formatMonthLabel");function la(e){let t=Fe(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}o(la,"formatFullDayLabel");function sa(e){let{draft:t,reasonText:r,book:n,stateAttested:i,termsAttested:l,cancellationPolicy:s,triage:a,goTo:d,releaseSlot:u,setFailure:p,setEmergency:f,setBookedConsult:m,onBooked:c}=e,v=react.useCallback(h=>{if(!Kt(t,r)||!t.idempotencyKey)return;if(Nr(t,Date.now())){p("expired"),d("time");return}let S=o(E=>{let k=Ue(E);if(k.kind==="emergency"){f(k.categories);return}if(k.kind==="rate_limited"){p("rate_limited");return}p(k.kind==="not_entitled"?"not_entitled":k.kind==="slot_taken"?"taken":k.kind==="clinician_unavailable"?"clinician_unavailable":k.kind==="unavailable"?"unavailable":"failed"),k.kind==="slot_taken"&&(u(),d("time"));},"refuse");p(null),f(null),n.mutate({pet_id:t.petId,clinician_id:t.clinicianId,slot_id:t.slot.slotId,state:t.state,reason_text:r.trim(),species:null,media_refs:[],emergency_acknowledged:h||a.isAcknowledged(r),share_health_records:t.shareHealthRecords,...eo(i,l,s)},t.idempotencyKey,{onSuccess:o(E=>{if(!br(E)){S(yr(E.status));return}m(E),d("booked"),c?.(E);},"onSuccess"),onError:o(E=>S(mr(E)),"onError")});},[t,r,n,i,l,s,a,d,u,p,f,m,c]),b=react.useCallback(()=>v(false),[v]);return {submitBooking:v,confirm:b}}o(sa,"useBookingSubmit");function Mu(e){if(e.httpStatus===409)return Object.freeze({failure:"taken"});switch(Ue(e).kind){case "slot_taken":return Object.freeze({failure:"taken"});case "rate_limited":return Object.freeze({failure:"rate_limited"});case "not_entitled":return Object.freeze({failure:"not_entitled"});case "unavailable":return Object.freeze({failure:"unavailable"});default:return Object.freeze({failure:"failed"})}}o(Mu,"televetHoldFailure");function da(e){let{draft:t,hold:r,dispatch:n,setFailure:i,refetchSlots:l}=e;return react.useCallback(s=>{if(i(null),Ql(t,s.slotId,Date.now())){n({type:"next"});return}r.mutate(s.slotId,{onSuccess:o(a=>{n({type:"patch",patch:{slot:s,holdExpiresAt:a.expiresAt,idempotencyKey:Zn(s.slotId)}}),n({type:"next"});},"onSuccess"),onError:o(a=>{let d=Mu(a);i(d.failure),d.failure==="taken"&&l();},"onError")});},[t,r,n,i,l])}o(da,"useSlotHold");function to(e){return Object.freeze(e==="dark"?{title:le.noCliniciansTitle,message:le.noCliniciansBody,retryLabel:le.noCliniciansRetryCta,interestReason:null}:{title:le.noCliniciansTitle,message:le.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}o(to,"televetEmptyRosterView");function ro(e){return e?"roster":"dark"}o(ro,"televetEmptyRosterCause");var Yt=Object.freeze({failed:0,refused:Object.freeze({size:0,type:0,unreadable:0})});function no(e){let{failed:t,refused:r}=e;return t<=0&&r.size<=0&&r.type<=0&&r.unreadable<=0}o(no,"isMediaShortfallEmpty");function oo(e){let t=o(n=>Number.isFinite(n)&&n>0?Math.floor(n):0,"count"),r=le.media;return [{n:t(e.failed),one:r.droppedTemplate,many:r.droppedPluralTemplate},{n:t(e.refused.size),one:r.refusedSizeTemplate,many:r.refusedSizePluralTemplate},{n:t(e.refused.type),one:r.refusedTypeTemplate,many:r.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:r.refusedUnreadableTemplate,many:r.refusedUnreadablePluralTemplate}].filter(n=>n.n>0).map(n=>W(n.n===1?n.one:n.many,{n:String(n.n)}))}o(oo,"televetMediaShortfallLines");function Dr(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Yt:Object.freeze({failed:t,refused:Yt.refused})}o(Dr,"mediaShortfallFromUnsentPicks");function ju(e,t){let r=Dr(t);return r.failed===0?e:Object.freeze({failed:e.failed+r.failed,refused:e.refused})}o(ju,"withUnsentPicks");var pe=Object.freeze({title:"Vet test mode (sandbox tenants)",create:"Create a simulated visit for this pet",createLabel:"Create",visitTemplate:"Visit {visitRef}: {status}, scheduled {scheduledAt}.",eventsNote:"Raise one of the visit events that is not a status change, to see what a tap on it opens:",advance:Object.freeze({completed:"Complete it",cancelled:"Cancel it",no_show:"Mark no-show"}),events:Object.freeze({rescheduled:"Rescheduled",reminder:"Reminder (24h)",followup_sent:"Follow-up sent",message_received:"Vet replied",ended:"Ended"}),resultTemplate:"{label}: {result}.",errorTemplate:"{label}: {message}"});var io="/widget/v1/televet/sandbox/visits",zu=128,ua=64,fa=new Set(["booked","cancelled","completed","no_show"]),Hu=new Set(["applied","already_applied","not_applicable"]),ca=new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),pa=new Set(["24h","30m"]);function lt(e){return te("validationFailed",{retryable:false,wireMessage:e})}o(lt,"invalid");function lo(e,t,r){return typeof t!="string"||t.length===0?lt(`${e} is required and must be a non-empty string`):Tt(t)?lt(`${e} contains an unpaired surrogate and cannot be encoded`):St(t)>r?lt(`${e} is longer than ${r} characters`):null}o(lo,"textError");function Vu(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:r}=e;if(typeof t!="string"||!Hu.has(t)||typeof r!="object"||r===null)return null;let{visit_ref:n,pet_ref:i,status:l,scheduled_at:s}=r;return typeof n!="string"||n.length===0||typeof i!="string"||i.length===0||typeof l!="string"||!fa.has(l)||typeof s!="string"||s.length===0?null:Object.freeze({result:t,visit:Object.freeze({visitRef:n,petRef:i,status:l,scheduledAt:s})})}o(Vu,"mapActionResult");function ya(e){let t=e.funnel??et({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),r=o(async(n,i,l)=>{let s=await t.send(n,{method:"POST",path:i,body:l},{idempotent:false,maxAttempts:1});if(!s.ok)return R(s.error);let a=Vu(s.value);return a===null?R(te("internalError",{retryable:false})):F(a)},"run");return {createVisit(n){let i=lo("pet_ref",n,zu);return i!==null?Promise.resolve(R(i)):r("televet.sandbox.createVisit",io,{pet_ref:n})},advanceVisit(n,i){let l=lo("visit_ref",n,ua);if(l!==null)return Promise.resolve(R(l));if(typeof i!="string"||!fa.has(i))return Promise.resolve(R(lt("to must be booked, cancelled, completed or no_show")));let s=`${io}/${encodeURIComponent(n)}/advance`;return r("televet.sandbox.advanceVisit",s,{to:i})},simulateVisitEvent(n,i,l){let s=lo("visit_ref",n,ua);if(s!==null)return Promise.resolve(R(s));if(typeof i!="string"||!ca.has(i))return Promise.resolve(R(lt(`event must be one of ${[...ca].join(", ")}`)));if(i==="reminder"){if(typeof l!="string"||!pa.has(l))return Promise.resolve(R(lt(`stage must be one of ${[...pa].join(", ")} for a reminder`)))}else if(l!==void 0)return Promise.resolve(R(lt("stage is only for a reminder")));let a=`${io}/${encodeURIComponent(n)}/simulate`;return r("televet.sandbox.simulateVisitEvent",a,l===void 0?{event:i}:{event:i,stage:l})}}}o(ya,"createVetVisitSandboxController");function ma(){let{runtime:e,userRef:t,scopeEpoch:r}=Te();return react.useMemo(()=>{let{services:n}=e.registry;return ya({auth:n.authFor(t),...n.errorPolicy?{errorPolicy:n.errorPolicy}:{}})},[e,t,r])}o(ma,"useEverfurVetVisitSandbox");function Ku(e,t){return !e||!t.enabled?false:t.data!==null&&t.data.active===false||Ht({error:t.error??null})}o(Ku,"televetOpensSimulator");var qu=o(e=>e.livemode===false,"isSandbox");function Yu(){let e=Te().runtime.entitlements,t=react.useCallback(()=>qu(e.getSnapshot()),[e]);return react.useSyncExternalStore(e.subscribe,t,t)}o(Yu,"useTelevetSandboxTenant");function va(e,t){let r=Ku(Yu(),e);return {simulate:r,fundingRefused:t&&!r}}o(va,"useTelevetSimulatorRoute");function ba(e){let t=ma(),[r,n]=react.useState(null),[i,l]=react.useState(null),[s,a]=react.useState(false),d=react.useRef(false),u=react.useRef(true);react.useEffect(()=>(u.current=true,()=>{u.current=false;}),[]);let p=react.useCallback((b,h,S)=>{d.current||(d.current=true,a(true),h().then(E=>{if(d.current=false,!!u.current){if(a(false),!E.ok){l({tone:"danger",text:W(pe.errorTemplate,{label:b,message:E.error.displayMessage})});return}S&&n(E.value.visit),l({tone:"ok",text:W(pe.resultTemplate,{label:b,result:E.value.result})});}}));},[]),f=react.useCallback(()=>{p(pe.createLabel,()=>t.createVisit(e),true);},[e,p,t]),m=react.useCallback(b=>{r!==null&&p(pe.advance[b],()=>t.advanceVisit(r.visitRef,b),true);},[p,t,r]),c=react.useCallback(b=>{if(r===null)return;let h=b==="reminder"?"24h":void 0;p(pe.events[b],()=>t.simulateVisitEvent(r.visitRef,b,h),false);},[p,t,r]),v=r===null?null:W(pe.visitTemplate,{visitRef:r.visitRef,status:r.status,scheduledAt:r.scheduledAt});return {visit:r,visitLine:v,line:i,busy:s,create:f,advance:m,raise:c}}o(ba,"useTelevetVisitSimulator");var ha=Object.freeze(["completed","cancelled","no_show"]),Ta=Object.freeze(["rescheduled","reminder","followup_sent","message_received","ended"]);function co(e){let[t,r]=react.useState(false),[n,i]=react.useState(false),[l,s]=react.useState(null),a=react.useRef(null),d=react.useRef(null),u=react.useRef(true);react.useEffect(()=>(u.current=true,()=>{u.current=false,d.current?.abort(),d.current=null;}),[]);let p=react.useCallback(()=>{d.current?.abort(),d.current=null,u.current&&i(false);},[]),f=react.useCallback(async h=>{if(d.current!==null)return false;let S=h.trim();if(l!==null&&l===S||!e)return true;let E=a.current!==null&&a.current.reason===S?a.current.emergency:null;if(E===null){let k=new AbortController;d.current=k,i(true);try{let L=await e(S,k.signal);if(k.signal.aborted||!u.current)return !1;L===null?E=!1:(E=L.isEmergency||L.fallback,a.current=Object.freeze({reason:S,emergency:E}));}catch{if(k.signal.aborted||!u.current)return false;E=false;}finally{d.current===k&&(d.current=null,u.current&&i(false));}}return E===true?(r(true),false):true},[l,e]),m=react.useCallback(h=>{s(h.trim()),r(false);},[]),c=react.useCallback(()=>r(false),[]),v=react.useCallback(()=>{p(),a.current=null,s(null),r(false);},[p]),b=react.useCallback(h=>l!==null&&l===h.trim(),[l]);return {open:t,checking:n,check:f,acknowledge:m,close:c,cancel:p,reset:v,isAcknowledged:b}}o(co,"useEarlyTriage");function Zu(e){let t=e?.trim().toUpperCase()??"";return /^[A-Z]{2}$/.test(t)?t:null}o(Zu,"normalizeStateCode");function po(e,t){let r=Zu(e),[n,i]=react.useState(()=>Object.freeze({})),l=react.useRef(0),s=react.useRef(null),a=react.useCallback(d=>{if(!t||r===null)return null;let u=`${r}:${d}`;s.current!==null&&s.current!==u&&(l.current+=1),s.current=u;let p=n[u]??"idle";return {joined:p==="joined",pending:p==="pending",failed:p==="failed",onPress:o(()=>{if(p==="pending"||p==="joined")return;let f=l.current+=1;i(m=>Object.freeze({...m,[u]:"pending"})),(async()=>{let m=false;try{m=await t(r,d);}catch{m=false;}l.current===f&&i(c=>Object.freeze({...c,[u]:m?"joined":"failed"}));})();},"onPress")}},[r,n,t]);return react.useMemo(()=>({actionFor:a}),[a])}o(po,"useStateInterest");var xt=2;function Ea(e){return typeof e!="number"||!Number.isInteger(e)?xt:e<1?1:e>6?6:e}o(Ea,"headingLevel");function Jt(e){return e>=6?6:e+1}o(Jt,"nextHeadingLevel");function ae(e){return `h${String(e)}`}o(ae,"headingTag");var rc=Jt(xt),fo=react.createContext(rc);function ge(){return react.useContext(fo)}o(ge,"useNestedHeadingLevel");function nc(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}o(nc,"slotBox");function Ca(e){return e?.textColor===void 0?{}:{color:e.textColor}}o(Ca,"slotText");function ka(e,t){let r=nc(e,t),n={};return r.backgroundColor!==void 0&&(n.backgroundColor=r.backgroundColor),r.borderColor!==void 0&&(n.border=`${r.borderWidth??1}px solid ${r.borderColor}`),r.borderRadius!==void 0&&(n.borderRadius=r.borderRadius),n}o(ka,"slotBoxCss");var se=44;function N(){let e=w();return react.useMemo(()=>ic(e),[e])}o(N,"useBookingStyles");function _({label:e,onPress:t,kind:r="primary",disabled:n=false,loading:i=false,fullWidth:l=true,accessibilityLabel:s,describedBy:a,testID:d,style:u}){let p=N(),f=n||i;return jsxRuntime.jsx("button",{type:"button",onClick:t,disabled:f,"aria-busy":i||void 0,...s&&s!==e?{"aria-label":s}:{},...a?{"aria-describedby":a}:{},"data-testid":d,style:{...p.button,...r==="primary"?p.buttonPrimary:r==="danger"?p.buttonDanger:p.buttonSecondary,...l?p.buttonFull:p.buttonAuto,...f?p.buttonDisabled:null,...u},children:e})}o(_,"TelevetButton");function $({title:e,message:t,actionLabel:r,onAction:n,testID:i}){let l=N(),s=ae(ge()),a=typeof r=="string"&&r.length>0&&typeof n=="function";return jsxRuntime.jsxs("div",{style:l.stateCard,"data-testid":i,children:[jsxRuntime.jsx(s,{style:l.stateTitle,children:e}),t?jsxRuntime.jsx("p",{style:l.stateMessage,children:t}):null,a?jsxRuntime.jsx(_,{label:r,onPress:n,kind:"secondary",fullWidth:false}):null]})}o($,"TelevetStateCard");function ve({height:e,width:t="100%",testID:r}){let n=N();return jsxRuntime.jsx("span",{"aria-hidden":"true","data-testid":r,style:{...n.skeleton,height:e,width:t}})}o(ve,"TelevetSkeletonBlock");function K({message:e,assertive:t=false,testID:r,style:n}){let i=N();return jsxRuntime.jsx("p",{role:t?"alert":"status","data-testid":r,style:{...i.failure,...n},children:e})}o(K,"TelevetFailureLine");function ic(e){let{color:t,space:r,radius:n,type:i,slots:l}=e,{size:s,lineHeight:a}=i,d=o(u=>`${String(u)}px`,"rem");return {screen:{...ht,display:"flex",flexDirection:"column",minHeight:0,flex:"1 1 auto",gap:d(r.md),paddingLeft:d(r.xl),paddingRight:d(r.xl),boxSizing:"border-box"},stepFill:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:d(r.md)},list:{display:"flex",flexDirection:"column",gap:d(r.sm)},button:{minHeight:se,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:d(r.sm),paddingLeft:d(r.xl),paddingRight:d(r.xl),paddingTop:d(r.sm),paddingBottom:d(r.sm),borderRadius:d(n.pill),borderStyle:"solid",borderWidth:0,cursor:"pointer",textAlign:"center",...T(e,"medium"),fontSize:d(s.body),lineHeight:String(a.snug),boxSizing:"border-box"},buttonFull:{alignSelf:"stretch",width:"100%"},buttonAuto:{alignSelf:"flex-start",minWidth:se},buttonPrimary:{backgroundColor:t.primary,color:t.onPrimary,...ka(l.primaryButton),...Ca(l.primaryButton)},buttonSecondary:{borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",color:t.brand,...l.primaryButton?.borderRadius===void 0?null:{borderRadius:d(l.primaryButton.borderRadius)},...l.primaryButton?.borderColor===void 0?null:{borderColor:l.primaryButton.borderColor}},buttonDanger:{backgroundColor:t.danger,color:t.onPrimary},buttonDisabled:{opacity:.45,cursor:"not-allowed"},stateCard:{minHeight:140,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",gap:d(r.sm),padding:d(r.lg),borderRadius:d(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,boxSizing:"border-box"},stateTitle:{margin:0,...T(e,"medium"),color:t.brand,fontSize:d(s.subtitle),lineHeight:String(a.snug)},stateMessage:{margin:0,...T(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(a.normal)},skeleton:{display:"block",borderRadius:d(n.md),backgroundColor:t.skeleton,flexShrink:0},failure:{margin:0,...T(e,"regular"),color:t.danger,fontSize:d(s.caption),lineHeight:String(a.normal)},stepTitle:{margin:0,...T(e,"bold"),color:t.brand,fontSize:d(s.verdict),lineHeight:String(a.snug),textAlign:"center"},stepHelp:{margin:0,...T(e,"regular"),color:t.text.metaCool,fontSize:d(s.body),lineHeight:String(a.normal),textAlign:"center"},divider:{height:1,backgroundColor:t.brandBorder,flexShrink:0},scrollRoot:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},scrollBody:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},scrollFooter:{flexShrink:0,paddingTop:d(r.md),paddingBottom:d(r.lg)}}}o(ic,"makeBookingStyles");function Mr({petName:e,primaryVet:t,onFindEmergencyVet:r}){return r?true:t!=null&&(e?.trim()??"").length>0}o(Mr,"hasTelevetEmergencyExit");function Xt({petName:e,primaryVet:t,onFindEmergencyVet:r,testIDPrefix:n}){let i=w(),l=react.useMemo(()=>cc(i),[i]),s=e?.trim()??"",a=`${react.useId()}-primary-vet-hint`;return jsxRuntime.jsxs("div",{style:l.exits,"data-testid":`${n}-exits`,children:[r?jsxRuntime.jsx("button",{type:"button",onClick:()=>{ur(r);},style:{...l.card,...l.cardButton},"data-testid":`${n}-find-vet`,children:jsxRuntime.jsx("span",{style:l.title,children:mt.findEmergencyVet})}):null,null,t!=null&&s.length>0?jsxRuntime.jsx(dc,{petName:s,vet:t,hintId:a,local:l,testIDPrefix:n}):null]})}o(Xt,"TelevetEmergencyExits");function dc({petName:e,vet:t,hintId:r,local:n,testIDPrefix:i}){let l=W(y.emergency.exitPrimaryVetTitle,{petName:e}),s=t.detail?.trim()??"",a=jsxRuntime.jsxs("span",{style:n.text,children:[jsxRuntime.jsx("span",{style:n.title,children:l}),s.length>0?jsxRuntime.jsx("span",{style:n.detail,children:s}):null]});if(!t.dial)return jsxRuntime.jsx("div",{style:n.card,"data-testid":`${i}-primary-vet`,children:a});let d=t.dial;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{ur(d);},"aria-label":s.length>0?`${l}, ${s}`:l,"aria-describedby":r,style:{...n.card,...n.cardButton},"data-testid":`${i}-primary-vet-call`,children:[a,jsxRuntime.jsx("span",{id:r,style:uc,children:y.emergency.startCallHint})]})}o(dc,"PrimaryVetCard");var uc=Object.freeze({position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0});function cc(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i;return {exits:{display:"flex",flexDirection:"column",gap:r.sm},card:{display:"flex",alignItems:"center",gap:r.sm,minHeight:se,padding:r.lg,borderRadius:n.md,border:`1px solid ${t.brandBorder}`,background:t.surface,color:t.text.primary,textAlign:"start",textDecoration:"none",boxSizing:"border-box"},cardButton:{width:"100%",cursor:"pointer",font:"inherit",position:"relative"},text:{display:"flex",flexDirection:"column",gap:r.xs,flexShrink:1},title:{...T(e,"medium"),color:t.text.primary,fontSize:l.body,lineHeight:`${String(l.body*s.normal)}px`},detail:{...T(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:`${String(l.caption*s.normal)}px`}}}o(cc,"makeExitStyles");function Ra({petName:e,primaryVet:t,onFindEmergencyVet:r,onContinue:n}){let i=w(),l=N(),s=react.useMemo(()=>vo(i),[i]),a=ae(ge()),d=Mr({petName:e,primaryVet:t,onFindEmergencyVet:r})?y.emergency.lede:y.emergency.ledeWithoutExits;return jsxRuntime.jsxs("section",{role:"alert",style:{...l.stepFill,...s.emergencyPanel},"data-testid":"televet-early-emergency",children:[jsxRuntime.jsx(a,{style:s.emergencyTitle,children:y.emergency.bannerTitle}),jsxRuntime.jsx("p",{style:s.emergencyLede,children:d}),jsxRuntime.jsx(Xt,{petName:e,primaryVet:t,onFindEmergencyVet:r,testIDPrefix:"televet-early-emergency"}),jsxRuntime.jsx(_,{label:y.emergency.keepBookingCta,kind:"secondary",onPress:n,testID:"televet-early-emergency-continue"})]})}o(Ra,"TelevetEarlyEmergency");function mo({action:e,testIDPrefix:t}){let r=w(),n=react.useMemo(()=>vo(r),[r]),i=ae(ge());return e===null?null:e.joined?jsxRuntime.jsxs("div",{role:"status","data-testid":`${t}-joined`,style:n.interestFeedback,children:[jsxRuntime.jsx(i,{style:n.interestJoinedTitle,children:y.stateInterest.joinedTitle}),jsxRuntime.jsx("p",{style:n.interestBody,children:y.stateInterest.joinedBody})]}):jsxRuntime.jsxs("div",{"data-testid":t,style:n.interestAction,children:[jsxRuntime.jsx(_,{label:e.pending?y.stateInterest.submitting:y.stateInterest.cta,kind:"secondary",loading:e.pending,disabled:e.pending,onPress:e.onPress,testID:`${t}-submit`}),e.failed?jsxRuntime.jsx(K,{message:y.stateInterest.failed,assertive:true,testID:`${t}-error`}):null]})}o(mo,"TelevetStateInterestAction");function _a({cause:e,onRetry:t,stateInterest:r=null}){let n=to(e);return jsxRuntime.jsxs("div",{"data-testid":"televet-clinicians-empty",children:[jsxRuntime.jsx($,{title:n.title,message:n.message,...n.retryLabel!==null&&t?{actionLabel:n.retryLabel,onAction:t}:{}}),n.interestReason!==null?jsxRuntime.jsx(mo,{action:r??null,testIDPrefix:"televet-state-interest-no-licensed-vet"}):null]})}o(_a,"TelevetClinicianEmptyState");function pc({onCheckAvailability:e}){return jsxRuntime.jsx(go,{...e?{onCheckAvailability:e}:{}})}o(pc,"TelevetEntitlementInterestState");function go({onCheckAvailability:e,renderUnavailable:t}){let r=N();return jsxRuntime.jsxs("div",{"data-testid":"televet-booking-not-entitled",style:r.list,children:[t?t():jsxRuntime.jsx($,{title:y.bookingPausedTitle}),e?jsxRuntime.jsx(_,{label:y.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}o(go,"EntitlementPausedState");function Qt({shortfall:e,testIDPrefix:t}){let r=w(),n=react.useMemo(()=>vo(r),[r]);if(no(e))return null;let i=oo(e);return i.length===0?null:jsxRuntime.jsx("ul",{role:"status",style:n.mediaNotice,"data-testid":`${t}-media-notice`,children:i.map((l,s)=>jsxRuntime.jsx("li",{style:n.mediaLine,"data-testid":`${t}-media-line-${String(s)}`,children:l},l))})}o(Qt,"TelevetMediaDropNotice");function vo(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i;return {emergencyPanel:{display:"flex",flexDirection:"column",gap:r.sm,padding:r.lg,borderRadius:n.lg,border:`2px solid ${t.danger}`,background:t.surface},emergencyTitle:{...T(e,"medium"),margin:0,color:t.danger,fontSize:l.heading,lineHeight:`${String(l.heading*s.snug)}px`},emergencyLede:{...T(e,"regular"),margin:0,color:t.text.primary,fontSize:l.subtitle,lineHeight:`${String(l.subtitle*s.normal)}px`},interestAction:{display:"flex",flexDirection:"column",gap:r.sm,marginTop:r.sm},interestFeedback:{display:"flex",flexDirection:"column",gap:r.xs,marginTop:r.sm},interestJoinedTitle:{...T(e,"medium"),margin:0,color:t.brand,fontSize:l.body,lineHeight:`${String(l.body*s.snug)}px`},interestBody:{...T(e,"regular"),margin:0,color:t.text.metaCool,fontSize:l.body,lineHeight:`${String(l.body*s.normal)}px`},mediaNotice:{display:"flex",flexDirection:"column",gap:r.xs,margin:0,padding:0,listStyle:"none"},mediaLine:{...T(e,"regular"),color:t.text.metaCool,fontSize:l.caption,lineHeight:`${String(l.caption*s.normal)}px`}}}o(vo,"makeEdgeStyles");function Pa(e){let{surfaceUnavailable:t,notEntitled:r,policyBlocked:n,triageOpen:i,step:l}=e;return t||r&&l!=="clinician"||n?true:l==="reason"&&i}o(Pa,"televetBookingGateApplies");function wa({state:e,petName:t,primaryVet:r,onFindEmergencyVet:n,stateInterest:i=null,onCheckAvailability:l,onAcknowledgeEmergency:s,renderUnavailable:a}){let d=N(),{surfaceUnavailable:u,notEntitled:p,policyBlocked:f,triageOpen:m,step:c}=e;return u?jsxRuntime.jsx("div",{style:d.stepFill,"data-testid":"televet-booking-unavailable",children:a?a():jsxRuntime.jsx($,{title:y.bookingPausedTitle})}):p&&c!=="clinician"?jsxRuntime.jsx(go,{...l?{onCheckAvailability:l}:{},...a?{renderUnavailable:a}:{}}):f?jsxRuntime.jsxs("div",{"data-testid":"televet-booking-state-blocked",children:[jsxRuntime.jsx($,{title:y.stateBlockedTitle}),jsxRuntime.jsx(mo,{action:i,testIDPrefix:"televet-state-interest-state-blocked"})]}):c==="reason"&&m?jsxRuntime.jsx(Ra,{...t!==void 0?{petName:t}:{},...r?{primaryVet:r}:{},onFindEmergencyVet:n,onContinue:s}):null}o(wa,"TelevetBookingGate");function Ia(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}o(Ia,"televetClinicianOutcomeApplies");function Oa({state:e,cause:t,locationStatus:r,onRequestLocation:n,onRetry:i,stateInterest:l=null,renderUnavailable:s}){return e.noState?jsxRuntime.jsx("div",{"data-testid":"televet-booking-location-unknown",children:jsxRuntime.jsx($,{title:r==="blocked"?y.locationBlockedTitle:r==="unavailable"?y.locationUnavailableTitle:y.locationUnknownTitle,message:r==="blocked"?y.locationBlockedBody:r==="unavailable"?y.locationUnavailableBody:y.locationUnknownBody,actionLabel:n&&r!=="blocked"?y.locationUnknownCta:void 0,onAction:r==="blocked"?void 0:n})}):e.isEmpty?jsxRuntime.jsx(_a,{cause:t,onRetry:i,stateInterest:l}):jsxRuntime.jsx(go,{...s?{renderUnavailable:s}:{}})}o(Oa,"TelevetClinicianOutcome");function Aa(e){return `televet-consult-${e}`}o(Aa,"televetConsultCalendarKey");function ho({consult:e,petName:t,onDone:r,onAddToCalendar:n,canJoinInApp:i=false,lengthMinutes:l}){let s=w(),a=N(),d=react.useMemo(()=>gc(s),[s]),u=`${react.useId()}-booked-title`,p=ae(ge()),[f,m]=react.useState("idle"),c=o(async()=>{if(!n)return;m("saving");let b=new Date(e.scheduledAt);if(Number.isNaN(b.getTime())){m("failed");return}let h=typeof l=="number"&&Number.isFinite(l)&&l>0?l:it,S=await cr(n,{key:Aa(e.consultId),title:y.visit.title,startDate:b,endDate:new Date(b.getTime()+h*6e4),alarmOffsetMinutes:-30});if(!S.ok){m("failed");return}m(S.value===true?"saved":S.value==="handed-off"?"idle":"failed");},"addToCalendar"),v=[y.booked.remindPromise,W(y.booked.summaryPromise,{pet:t??""}),...i?[y.booked.joinPromise]:[]];return Ne()?jsxRuntime.jsxs("section",{style:d.screen,"aria-labelledby":u,"data-testid":"televet-booked",children:[jsxRuntime.jsx("div",{style:d.header,children:jsxRuntime.jsx(_,{label:y.doneCta,kind:"secondary",fullWidth:false,onPress:r,testID:"televet-booked-done"})}),jsxRuntime.jsx("div",{"aria-hidden":"true",style:d.avatar}),jsxRuntime.jsx(p,{id:u,style:d.title,children:e.clinicianName?W(y.bookedHeadingTemplate,{vet:e.clinicianName}):y.bookedTitle}),jsxRuntime.jsx("p",{style:d.when,children:jsxRuntime.jsx("time",{dateTime:e.scheduledAt,children:Ee(e.scheduledAt)})}),jsxRuntime.jsx("ol",{style:d.steps,"data-testid":"televet-booked-steps",children:v.map((b,h)=>jsxRuntime.jsxs("li",{style:d.step,children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:d.stepNumber,children:String(h+1)}),jsxRuntime.jsx("span",{style:d.stepText,children:b.trim()})]},b))}),jsxRuntime.jsxs("div",{style:d.actions,children:[n?jsxRuntime.jsx(_,{label:f==="saved"?y.booked.calendarAdded:y.addToCalendarCta,kind:"primary",loading:f==="saving",disabled:f==="saving"||f==="saved",onPress:()=>{c();},testID:"televet-booked-calendar"}):null,f==="failed"?jsxRuntime.jsx("p",{role:"status",style:{...a.failure,...d.calendarNote},"data-testid":"televet-booked-calendar-failed",children:y.booked.calendarFailedBody}):null,jsxRuntime.jsx(_,{label:t?W(y.booked.backToPet,{pet:t}):y.doneCta,kind:"secondary",onPress:r,testID:"televet-booked-back"})]})]}):jsxRuntime.jsx("div",{style:d.screen,"data-testid":"televet-booked-copy-unapproved"})}o(ho,"TelevetBookedScreen");function gc(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {screen:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,gap:a(r.md),paddingLeft:a(r.xl),paddingRight:a(r.xl),boxSizing:"border-box"},header:{display:"flex",justifyContent:"flex-end",paddingBottom:a(r.lg)},avatar:{alignSelf:"center",width:120,height:120,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,borderStyle:"solid",borderWidth:2,borderColor:t.success,boxSizing:"border-box"},title:{margin:0,textAlign:"center",...T(e,"bold"),color:t.brand,fontSize:a(l.verdict),lineHeight:String(s.tight),letterSpacing:"-0.7px",paddingTop:a(r.lg)},when:{margin:0,textAlign:"center",...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.subtitle),lineHeight:String(s.normal)},steps:{listStyle:"none",margin:0,marginTop:a(r.xl),padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,display:"flex",flexDirection:"column",gap:a(r.lg),boxSizing:"border-box"},step:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:a(r.md)},stepNumber:{width:26,height:26,flexShrink:0,borderRadius:"50%",backgroundColor:t.primary,display:"inline-flex",alignItems:"center",justifyContent:"center",...T(e,"medium"),color:t.onPrimary,fontSize:a(l.caption),lineHeight:"1"},stepText:{flex:"1 1 auto",minWidth:0,...T(e,"regular"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.normal)},actions:{marginTop:"auto",paddingBottom:a(r.xl),display:"flex",flexDirection:"column",gap:a(r.md)},calendarNote:{textAlign:"center"}}}o(gc,"makeStyles");function Ba(){let e=[];return {register(t){return e=[...e,t],()=>{e=e.filter(r=>r!==t);}},dispatch(){for(let t of [...e].reverse())try{if(t())return !0}catch{}return false}}}o(Ba,"createTelevetBackChannel");var To=react.createContext(null);function Zt(e,t=true){let r=react.useContext(To),n=react.useRef(e);n.current=e,react.useEffect(()=>{if(!(r===null||!t))return r.register(()=>n.current())},[r,t]);}o(Zt,"useTelevetBackChannel");var Pt=Object.freeze({position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0});var La='button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';function Co(e){return e.tagName==="DIALOG"}o(Co,"isDialogElement");function Sc(e,t){if(t.isDefaultPrevented()||t.nativeEvent.isComposing)return false;let r=t.target;return !(r instanceof Element)||r.closest("dialog")===e}o(Sc,"ownsEscape");function zr(e,t,r,n){let i=n?.escapeAtKeyDown===true,l=react.useRef(null),s=react.useRef(false),a=react.useRef(null),d=react.useRef(r);d.current=r;let u=react.useCallback(()=>{if(!s.current)return;s.current=false;let m=d.current===void 0?a.current:d.current.current;m&&m.isConnected&&m.focus(),(!m||!m.isConnected||document.activeElement===m)&&(a.current=null);},[]);react.useEffect(()=>{if(!e){u();return}let m=l.current;if(!s.current){let v=typeof document>"u"?null:document.activeElement;v!==null&&m!==null&&m.contains(v)||(a.current=v instanceof HTMLElement?v:null);}if(s.current=true,m===null)return;if(!Co(m)){m.contains(document.activeElement)||(m.querySelector(La)??m).focus();return}let c=m;typeof c.showModal=="function"?c.open||c.showModal():c.setAttribute("open","");},[e,u]),react.useEffect(()=>u,[u]),react.useEffect(()=>{let m=l.current;if(!e||m===null||!Co(m))return;let c=m;if(typeof c.showModal!="function")return;let v=null,b=o(S=>{S.target instanceof HTMLElement&&(v=S.target);},"onFocusIn"),h=o(()=>{if(!c.isConnected||c.open)return;let S=v;c.showModal(),S!==null&&S.isConnected&&c.contains(S)&&document.activeElement!==S&&S.focus();},"onNativeClose");return c.addEventListener("focusin",b),c.addEventListener("close",h),()=>{c.removeEventListener("focusin",b),c.removeEventListener("close",h);}},[e]);let p=react.useCallback(m=>{let c=l.current;if(c===null)return;if(m.key==="Escape"&&!Co(c)){m.preventDefault(),m.stopPropagation(),t();return}if(m.key==="Escape"&&i&&Sc(c,m)){m.preventDefault(),t();return}if(m.key!=="Tab")return;let v=Array.from(c.querySelectorAll(La)),b=v[0],h=v[v.length-1];if(!b||!h){m.preventDefault();return}let S=document.activeElement;m.shiftKey&&(S===b||!c.contains(S))?(m.preventDefault(),h.focus()):!m.shiftKey&&(S===h||!c.contains(S))&&(m.preventDefault(),b.focus());},[t,i]),f=react.useCallback(m=>{m.target===m.currentTarget&&(m.preventDefault(),t());},[t]);return {dialogRef:l,onKeyDown:p,onCancel:f}}o(zr,"useModalDialog");var ko=["pet","issues","reason","triage","clinician","time","review","booked"];function xo({step:e,furthestIndex:t,title:r,canGoBack:n,isDirty:i,onBack:l,onClose:s,onConfirmDiscard:a,headingLevel:d=xt,triageOpen:u=false}){let p=w(),f=react.useMemo(()=>Fa(p),[p]),[m,c]=react.useState(false),v=react.useRef(null),h=`${react.useId()}-close-hint`,S=ae(d);react.useEffect(()=>{if(!i||typeof window>"u")return;let x=o(A=>{A.preventDefault(),A.returnValue="";},"onBeforeUnload");return window.addEventListener("beforeunload",x),()=>window.removeEventListener("beforeunload",x)},[i]);let E=react.useCallback(()=>{if(!i){s();return}let x={title:y.chrome.discardTitle,body:y.chrome.discardBody,confirmLabel:y.chrome.discardConfirmCta,keepLabel:y.chrome.discardKeepCta};if(a){Promise.resolve(a(x)).then(A=>{A&&s();},()=>{});return}c(true);},[i,s,a]);Zt(()=>(E(),true));let k=ko.length,L=ko.indexOf(e==="reason"&&u?"triage":e)+1;return jsxRuntime.jsxs("div",{style:f.wrap,children:[jsxRuntime.jsxs("header",{style:f.bar,children:[jsxRuntime.jsx("div",{style:f.side,children:n?jsxRuntime.jsx("button",{type:"button",onClick:l,"data-testid":"televet-booking-back",style:{...f.tap,...f.back},children:y.backLabel}):null}),jsxRuntime.jsx(S,{style:Pt,children:r??y.navTitle}),jsxRuntime.jsxs("div",{style:f.progress,children:[jsxRuntime.jsx("p",{style:Pt,"data-testid":"televet-booking-progress-label",children:W(y.loading.progressTemplate,{step:String(L),total:String(k)})}),jsxRuntime.jsx("div",{"aria-hidden":"true",style:f.segments,"data-testid":"televet-booking-rail",children:ko.map((x,A)=>jsxRuntime.jsx("span",{"data-lit":A<L?"true":"false",style:{...f.segment,...A<L?f.segmentLit:null}},x))})]}),jsxRuntime.jsxs("div",{style:{...f.side,...f.sideRight},children:[jsxRuntime.jsx("button",{type:"button",ref:v,onClick:E,"aria-label":y.close,"aria-describedby":h,"data-testid":"televet-booking-close",style:{...f.tap,...f.closeTap},children:jsxRuntime.jsx("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:jsxRuntime.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}),jsxRuntime.jsx("span",{id:h,style:Pt,children:y.chrome.closeHint})]})]}),m?jsxRuntime.jsx(Rc,{onKeep:()=>c(false),onLeave:()=>{c(false),s();},returnFocusTo:v}):null]})}o(xo,"TelevetBookingChrome");function Rc({onKeep:e,onLeave:t,returnFocusTo:r}){let n=w(),i=react.useMemo(()=>Fa(n),[n]),{dialogRef:l,onKeyDown:s,onCancel:a}=zr(true,e,r),d=react.useId(),u=`${d}-discard-title`,p=`${d}-discard-body`;return jsxRuntime.jsxs("dialog",{ref:l,onKeyDown:s,onCancel:a,"aria-labelledby":u,"aria-describedby":p,"data-testid":"televet-booking-discard",style:i.dialog,children:[jsxRuntime.jsx("h2",{id:u,style:i.dialogTitle,children:y.chrome.discardTitle}),jsxRuntime.jsx("p",{id:p,style:i.dialogBody,children:y.chrome.discardBody}),jsxRuntime.jsxs("div",{style:i.dialogActions,children:[jsxRuntime.jsx(_,{label:y.chrome.discardKeepCta,onPress:e,kind:"primary",fullWidth:false,testID:"televet-booking-discard-keep"}),jsxRuntime.jsx(_,{label:y.chrome.discardConfirmCta,onPress:t,kind:"secondary",fullWidth:false,testID:"televet-booking-discard-leave"})]})]})}o(Rc,"DiscardDialog");var _c="Back";function Fa(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(u=>`${String(u)}px`,"rem"),d={background:"transparent",borderStyle:"none",padding:0,cursor:"pointer"};return {wrap:{backgroundColor:t.surface,flexShrink:0},bar:{display:"flex",flexDirection:"row",alignItems:"center",paddingLeft:a(r.lg),paddingRight:a(r.lg),minHeight:56,boxSizing:"border-box"},side:{width:64,flexShrink:0,display:"flex",alignItems:"center"},sideRight:{justifyContent:"flex-end"},tap:{...d,minHeight:se,minWidth:se,display:"inline-flex",alignItems:"center",justifyContent:"center"},closeTap:{justifyContent:"flex-end",color:t.text.primary},back:{...T(e,"bold"),color:t.brand,fontSize:a(l.body),paddingLeft:a(r.sm),paddingRight:a(r.sm)},progress:{flex:"1 1 auto",minWidth:0,display:"flex",justifyContent:"center"},segments:{display:"flex",alignItems:"center",gap:a(r.xs),width:"100%",maxWidth:480},segment:{display:"block",flex:"1 1 0",height:3,borderRadius:a(n.pill),backgroundColor:t.brandBorder},segmentLit:{backgroundColor:t.success},dialog:{margin:"auto",maxWidth:420,width:"calc(100% - 32px)",boxSizing:"border-box",padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:t.surface,color:t.text.primary},dialogTitle:{margin:0,...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},dialogBody:{margin:0,paddingTop:a(r.sm),...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.body),lineHeight:String(s.normal)},dialogActions:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.sm),paddingTop:a(r.lg)}}}o(Fa,"makeStyles");function Ma(e){let t=[],r=Pc(e.ageYears);r!==null&&t.push(`${String(r)} yr${r===1?"":"s"} old`);let n=e.weightKg;typeof n=="number"&&Number.isFinite(n)&&n>0&&t.push(`${String(Math.round(n))} kg`);let i=e.breed?.trim();return i&&t.push(i),t.join(" \xB7 ")}o(Ma,"formatTelevetPetMetaLine");function Pc(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}o(Pc,"wholeYears");function Ro({media:e,onChange:t,onPickMedia:r,listLabel:n}){let i=w(),l=react.useMemo(()=>Bc(i),[i]),s=Tr-e.length,[a,d]=react.useState(false);if(!r)return null;let u=o(async()=>{if(!(a||s<=0)){d(true);try{let p=await cr(r,s);if(!p.ok||p.value===null||p.value.length===0)return;let f=new Set(e.map(c=>c.uri)),m=p.value.filter(c=>typeof c?.uri=="string"&&c.uri.length>0&&!f.has(c.uri));if(m.length===0)return;t([...e,...m].slice(0,Tr));}finally{d(false);}}},"pick");return jsxRuntime.jsxs("ul",{role:"list","aria-label":n,style:l.row,children:[e.map((p,f)=>jsxRuntime.jsxs("li",{style:l.thumb,children:[jsxRuntime.jsx("img",{src:p.uri,alt:p.filename,style:l.thumbImage}),p.mimeType.startsWith("video/")?jsxRuntime.jsx("span",{"aria-hidden":"true",style:l.videoBadge,"data-testid":`televet-intake-media-video-${String(f)}`,children:Ac}):null,jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e.filter((m,c)=>c!==f)),"aria-label":`${y.removePhotoLabel}: ${p.filename}`,"data-testid":`televet-intake-media-remove-${String(f)}`,style:l.remove,children:jsxRuntime.jsx("span",{"aria-hidden":"true",style:l.removeGlyph,children:Oc})})]},`${p.uri}-${String(f)}`)),s>0?jsxRuntime.jsx("li",{style:l.addItem,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>{u();},disabled:a,"aria-busy":a||void 0,"data-testid":"televet-intake-add-media",style:{...l.dropzone,...a?l.dropzoneBusy:null},children:jsxRuntime.jsx("span",{style:l.dropzoneText,children:y.addPhotoCta})})}):null]})}o(Ro,"TelevetIntakeMedia");var Oc="\xD7",Ac="\u25B6",Hr=92;function Bc(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {row:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.md),paddingTop:a(r.sm)},thumb:{position:"relative",width:Hr,height:Hr,borderRadius:a(n.md),backgroundColor:t.surfaceSubtle},thumbImage:{width:"100%",height:"100%",objectFit:"cover",borderRadius:a(n.md),display:"block"},videoBadge:{position:"absolute",left:6,bottom:6,paddingLeft:6,paddingRight:6,paddingTop:2,paddingBottom:2,borderRadius:a(n.sm),backgroundColor:t.shadow,color:t.text.onBrand,fontSize:a(l.nano),lineHeight:"1"},addItem:{display:"flex"},remove:{position:"absolute",top:-8,right:-8,width:se-16,height:se-16,borderRadius:"50%",borderStyle:"none",backgroundColor:t.text.metaCool,display:"inline-flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},removeGlyph:{...T(e,"medium"),color:t.surface,fontSize:a(l.subtitle),lineHeight:"1"},dropzone:{width:Hr,height:Hr,borderRadius:a(n.md),borderWidth:1,borderStyle:"dashed",borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:a(r.sm),paddingRight:a(r.sm),cursor:"pointer",boxSizing:"border-box"},dropzoneBusy:{opacity:.6,cursor:"progress"},dropzoneText:{...T(e,"mono"),color:t.text.metaCool,fontSize:a(l.nano),lineHeight:String(s.normal),letterSpacing:"0.3px",textAlign:"center"}}}o(Bc,"makeStyles");function Po({slots:e,selectedDayKey:t,onSelectDay:r,groupLabel:n}){let i=w(),l=react.useMemo(()=>Dc(i),[i]),s=react.useMemo(()=>Ur(e),[e]),a=react.useRef(new Map),d=s[0],u=t??d?.key??null,p=react.useRef(null),f=react.useRef(false);react.useEffect(()=>{if(f.current)return;let c=p.current,v=u===null?void 0:a.current.get(u);if(!c||!v||(f.current=true,u===d?.key))return;let b=v.getBoundingClientRect().left-c.getBoundingClientRect().left;c.scrollLeft+=b-(c.clientWidth-v.clientWidth)/2;},[u,d]);let m=react.useCallback(c=>{let v=c.key==="ArrowRight"||c.key==="ArrowDown"?1:c.key==="ArrowLeft"||c.key==="ArrowUp"?-1:0,b=c.key==="Home"?0:c.key==="End"?s.length-1:null;if(v===0&&b===null)return;let h=s.findIndex(k=>k.key===u);if(h<0)return;let S=b??Math.min(s.length-1,Math.max(0,h+v)),E=s[S];E===void 0||E.key===u||(c.preventDefault(),r(E),a.current.get(E.key)?.focus());},[s,u,r]);return d===void 0?null:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{"aria-hidden":"true",style:l.month,"data-testid":"televet-day-strip-month",children:ia(d.iso)}),jsxRuntime.jsx("div",{ref:p,role:"radiogroup","aria-label":n,onKeyDown:m,style:l.strip,"data-testid":"televet-day-strip",children:s.map(c=>{let v=c.key===u;return jsxRuntime.jsxs("button",{ref:b=>{b?a.current.set(c.key,b):a.current.delete(c.key);},type:"button",role:"radio","aria-checked":v,tabIndex:v?0:-1,onClick:()=>r(c),"aria-label":la(c.iso),"data-testid":`televet-day-${c.key}`,style:{...l.day,...v?l.daySelected:null},children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:{...l.dayWeekday,...v?l.dayTextSelected:null},children:c.weekday}),jsxRuntime.jsx("span",{"aria-hidden":"true",style:{...l.dayNumber,...v?l.dayTextSelected:null},children:c.dayNumber})]},c.key)})})]})}o(Po,"TelevetDayStrip");function Ur(e){let t=new Map;for(let r of e){let n=qt(r.startsAt);if(t.has(n))continue;let i=new Date(r.startsAt);Number.isNaN(i.getTime())||t.set(n,Object.freeze({key:n,iso:r.startsAt,weekday:i.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(i.getDate())}));}return Object.freeze([...t.values()])}o(Ur,"televetDaysFromSlots");function Dc(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {month:{margin:0,textAlign:"center",...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug),paddingBottom:a(r.md)},strip:{display:"flex",flexDirection:"row",gap:a(r.sm),paddingLeft:a(r.xs),paddingRight:a(r.xs),overflowX:"auto",overscrollBehaviorX:"contain",scrollSnapType:"x proximity"},day:{width:52,flexShrink:0,scrollSnapAlign:"center",minHeight:se,paddingTop:a(r.md),paddingBottom:a(r.md),borderRadius:a(n.md),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,cursor:"pointer",boxSizing:"border-box"},daySelected:{backgroundColor:t.primary,borderColor:t.primary},dayWeekday:{...T(e,"mono"),color:t.text.secondary,fontSize:a(l.tiny),lineHeight:String(s.tight)},dayNumber:{...T(e,"medium"),color:t.brand,fontSize:a(l.heading),lineHeight:String(s.tight)},dayTextSelected:{color:t.onPrimary}}}o(Dc,"makeStyles");function er({slots:e,busySlotId:t,onPick:r,selectedSlot:n=null,header:i,dayGroupLabel:l,timeGroupLabel:s,rowTestIdPrefix:a="televet-slot",testID:d="televet-slot-list"}){let u=w(),p=react.useMemo(()=>zc(u),[u]),f=react.useMemo(()=>Ur(e),[e]),m=`${react.useId()}-zone`,[c,v]=react.useState(null),b=n?qt(n.startsAt):null,h=jc(f,[c,b])??f[0]?.key??null,S=react.useMemo(()=>h?e.filter(x=>qt(x.startsAt)===h):[],[e,h]),E=S[0],k=t!==null,L=E?Ct(E.startsAt):null;return jsxRuntime.jsxs("div",{style:p.root,"data-testid":d,children:[i,jsxRuntime.jsx(Po,{slots:e,selectedDayKey:h,onSelectDay:x=>v(x.key),groupLabel:l}),L?jsxRuntime.jsx("p",{id:m,style:p.zone,"data-testid":"televet-slot-zone",children:L}):null,jsxRuntime.jsx("div",{style:p.gridScroll,children:jsxRuntime.jsx("ul",{role:"list","aria-label":s,...L?{"aria-describedby":m}:{},"aria-busy":k||void 0,style:p.grid,children:S.map(x=>{let A=t===x.slotId;return jsxRuntime.jsx("li",{style:p.gridItem,children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(x),disabled:k,"aria-busy":A||void 0,"aria-label":Ee(x.startsAt),"data-testid":`${a}-${x.slotId}`,style:{...p.chip,...A?p.chipBusy:null,...k&&!A?p.chipDisabled:null},children:jsxRuntime.jsx("span",{"aria-hidden":"true",style:{...p.chipLabel,...A?p.chipLabelBusy:null},children:Et(x.startsAt)})})},x.slotId)})})})]})}o(er,"TelevetSlotPicker");function jc(e,t){for(let r of t)if(r!==null&&e.some(n=>n.key===r))return r;return null}o(jc,"firstOffered");function zc(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {root:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0},gridScroll:{flex:"1 1 auto",minHeight:0,overflowY:"auto",overscrollBehavior:"contain"},zone:{margin:0,textAlign:"center",...T(e,"mono"),color:t.text.secondary,fontSize:a(l.tiny),lineHeight:String(s.normal),letterSpacing:"0.4px",paddingTop:a(r.md),paddingBottom:a(r.md)},grid:{listStyle:"none",margin:0,padding:0,paddingBottom:a(r.xl),display:"flex",flexDirection:"row",flexWrap:"wrap",gap:a(r.md)},gridItem:{display:"flex",flexGrow:1,flexBasis:"28%",minWidth:96},chip:{width:"100%",minHeight:48,borderRadius:a(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",display:"inline-flex",alignItems:"center",justifyContent:"center",paddingLeft:a(r.md),paddingRight:a(r.md),cursor:"pointer",boxSizing:"border-box"},chipBusy:{backgroundColor:t.primary,borderColor:t.primary},chipDisabled:{opacity:.45,cursor:"not-allowed"},chipLabel:{...T(e,"regular"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.tight)},chipLabelBusy:{color:t.onPrimary}}}o(zc,"makeStyles");function Be(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {marker:{minHeight:1},chipRow:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:a(r.sm)},chip:{minHeight:44,padding:`${a(r.sm)} ${a(r.lg)}`,borderRadius:a(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brand,backgroundColor:t.surface,color:t.brand,cursor:"pointer",...T(e,"regular"),fontSize:a(l.body),lineHeight:String(s.snug)},chipOn:{borderColor:t.accent,backgroundColor:t.accent,color:t.onAccent,...T(e,"bold")},stepScroll:{paddingBottom:a(r.md)},visuallyHiddenHeading:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},petRow:{width:"100%",display:"flex",flexDirection:"row",alignItems:"center",gap:a(r.sm),minHeight:64,paddingLeft:a(r.md),paddingRight:a(r.md),paddingTop:a(r.sm),paddingBottom:a(r.sm),borderRadius:a(n.pill),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,backgroundColor:"transparent",textAlign:"left",cursor:"pointer",boxSizing:"border-box"},petRowSelected:{borderColor:t.primary},petDisc:{width:28,height:28,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...T(e,"medium"),color:t.brand,fontSize:a(l.caption),lineHeight:"1"},petRowText:{display:"flex",flexDirection:"column",minWidth:0,gap:2},petRowName:{...T(e,"medium"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.snug),overflowWrap:"anywhere"},petRowMeta:{...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.caption),lineHeight:String(s.normal),overflowWrap:"anywhere"},vetRow:{display:"flex",flexDirection:"row",alignItems:"center",gap:a(r.md)},vetAvatar:{width:64,height:64,flexShrink:0,borderRadius:"50%",backgroundColor:t.surfaceSubtle,display:"inline-flex",alignItems:"center",justifyContent:"center",...T(e,"medium"),color:t.brand,fontSize:a(l.heading),lineHeight:"1"},vetIdentity:{display:"flex",flexDirection:"column",flex:"1 1 auto",minWidth:0,gap:2},vetName:{margin:0,...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},vetCredentials:{margin:0,...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.caption),lineHeight:String(s.normal)},vetRating:{margin:0,...T(e,"regular"),color:t.text.secondary,fontSize:a(l.caption),lineHeight:String(s.normal)},vetBio:{margin:0,...T(e,"regular"),color:t.brand,fontSize:a(l.body),lineHeight:String(s.normal)},reasonInput:{width:"100%",minHeight:120,resize:"vertical",borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,borderRadius:a(n.md),padding:a(r.md),backgroundColor:t.surface,...T(e,"regular"),color:t.text.primary,fontSize:a(l.body),lineHeight:String(s.normal),boxSizing:"border-box"},emergencyBanner:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:a(r.md),padding:a(r.lg),borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.errorRed,backgroundColor:t.badgeBgCritical,boxSizing:"border-box"},emergencyTitle:{margin:0,...T(e,"bold"),color:t.errorRed,fontSize:a(l.subtitle),lineHeight:String(s.snug)},emergencyLede:{margin:0,...T(e,"regular"),color:t.text.primary,fontSize:a(l.body),lineHeight:String(s.normal)}}}o(Be,"makeLocalStyles");function ut({label:e,value:t,last:r=false,testID:n}){let i=w(),l=react.useMemo(()=>Ao(i),[i]);return jsxRuntime.jsxs("div",{style:{...l.row,...r?l.rowLast:null},"data-testid":n,children:[jsxRuntime.jsx("dt",{style:l.rowLabel,children:e}),jsxRuntime.jsx("dd",{style:l.rowValue,children:t})]})}o(ut,"TelevetSummaryRow");function tr({label:e,checked:t,onToggle:r,testID:n}){let i=w(),l=react.useMemo(()=>Ao(i),[i]);return jsxRuntime.jsxs("label",{style:l.consent,children:[jsxRuntime.jsx("input",{type:"checkbox",checked:t,onChange:s=>r(s.currentTarget.checked),"data-testid":n,style:Pt}),jsxRuntime.jsx("span",{"aria-hidden":"true",style:{...l.box,...t?l.boxChecked:null},children:t?jsxRuntime.jsx("span",{style:l.tick,children:Vc}):null}),jsxRuntime.jsx("span",{style:l.consentLabel,children:e})]})}o(tr,"TelevetConsentCheckbox");var Vc="\u2713";function Oo({children:e,testID:t}){let r=w(),n=react.useMemo(()=>Ao(r),[r]);return jsxRuntime.jsx("dl",{style:n.card,"data-testid":t,children:e})}o(Oo,"TelevetSummaryCard");function Ao(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"rem");return {card:{margin:0,borderRadius:a(n.lg),borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,paddingLeft:a(r.lg),paddingRight:a(r.lg),boxSizing:"border-box"},row:{display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",gap:a(r.lg),paddingTop:a(r.lg),paddingBottom:a(r.lg),borderBottomStyle:"solid",borderBottomWidth:1,borderBottomColor:t.brandBorder},rowLast:{borderBottomWidth:0},rowLabel:{margin:0,flexShrink:0,...T(e,"regular"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},rowValue:{margin:0,marginInlineStart:0,minWidth:0,textAlign:"right",overflowWrap:"anywhere",...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},consent:{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:a(r.md),minHeight:se,padding:a(r.lg),borderRadius:a(n.md),backgroundColor:t.surfaceSubtle,cursor:"pointer",boxSizing:"border-box"},box:{width:22,height:22,flexShrink:0,borderRadius:a(n.xs),borderStyle:"solid",borderWidth:1.5,borderColor:t.brand,backgroundColor:t.surface,display:"inline-flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},boxChecked:{backgroundColor:t.primary,borderColor:t.primary},tick:{...T(e,"bold"),color:t.onPrimary,fontSize:a(l.caption),lineHeight:"1"},consentLabel:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere",...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.body),lineHeight:String(s.normal)}}}o(Ao,"makeStyles");function Bo({headingRef:e,when:t,lengthMinutes:r,clinician:n,petName:i,reason:l,shareRecords:s,onToggleShare:a,stateCode:d,stateAttested:u,onToggleStateAttest:p,cancellationTerms:f,termsAttested:m,onToggleTermsAttest:c,canConfirm:v,busy:b,failure:h,onConfirm:S,emergency:E,onAcknowledgeEmergency:k,onSeeOtherVets:L,mediaShortfall:x=Yt,primaryVet:A,onFindEmergencyVet:z}){let H=N(),X=w(),D=react.useMemo(()=>Be(X),[X]),G=Mr({petName:i,primaryVet:A,onFindEmergencyVet:z})?y.emergency.lede:y.emergency.ledeWithoutExits;return jsxRuntime.jsxs("div",{style:H.scrollRoot,"data-testid":"televet-booking-review",children:[jsxRuntime.jsx("div",{style:H.scrollBody,"data-testid":"televet-booking-review-scroll",children:jsxRuntime.jsxs("div",{style:H.list,children:[jsxRuntime.jsx(ct,{headingRef:e,style:H.stepTitle,children:y.reviewHeading}),jsxRuntime.jsxs(Oo,{testID:"televet-review-summary",children:[i?jsxRuntime.jsx(ut,{label:y.summaryPet,value:i,testID:"televet-review-row-pet"}):null,n?jsxRuntime.jsx(ut,{label:y.summaryVet,value:n,testID:"televet-review-row-vet"}):null,jsxRuntime.jsx(ut,{label:y.summaryWhen,value:t,testID:"televet-review-row-when"}),jsxRuntime.jsx(ut,{label:y.summaryLength,value:W(y.summaryLengthTemplate,{n:String(r)}),testID:"televet-review-row-length"}),l?jsxRuntime.jsx(ut,{label:y.summaryReason,value:l,last:true,testID:"televet-review-row-reason"}):null]}),jsxRuntime.jsx(tr,{label:y.shareRecordsOff,checked:s,onToggle:a,testID:"televet-review-share-records"}),f?jsxRuntime.jsx(tr,{label:f,checked:m,onToggle:c,testID:"televet-review-terms-attest"}):null,d?jsxRuntime.jsx(tr,{label:W(y.stateAttestTemplate,{state:d}),checked:u,onToggle:p,testID:"televet-review-state-attest"}):null,jsxRuntime.jsx(Qt,{shortfall:x,testIDPrefix:"televet-review"}),E?jsxRuntime.jsxs("div",{role:"alert",style:D.emergencyBanner,"data-testid":"televet-review-emergency",children:[jsxRuntime.jsx(Ua,{style:D.emergencyTitle,children:y.emergency.bannerTitle}),jsxRuntime.jsx("p",{style:D.emergencyLede,children:G}),E.length>0?jsxRuntime.jsx("p",{style:D.emergencyLede,"data-testid":"televet-review-emergency-categories",children:E.join(", ")}):null,jsxRuntime.jsx(Xt,{petName:i,primaryVet:A,onFindEmergencyVet:z,testIDPrefix:"televet-review-emergency"}),jsxRuntime.jsx(_,{label:y.emergency.keepBookingCta,kind:"secondary",loading:b,disabled:b,onPress:k,testID:"televet-review-emergency-ack"})]}):null,h==="failed"?jsxRuntime.jsx(K,{message:y.confirmFailed}):null,h==="clinician_unavailable"?jsxRuntime.jsxs("div",{style:H.list,"data-testid":"televet-review-clinician-unavailable",children:[jsxRuntime.jsx(K,{message:y.confirmFailed}),jsxRuntime.jsx(_,{label:y.seeOtherVetsCta,kind:"secondary",onPress:L,testID:"televet-review-see-other-vets"})]}):null,h==="rate_limited"?jsxRuntime.jsx(K,{message:y.confirmFailed,testID:"televet-review-rate-limited"}):null,h==="not_entitled"?jsxRuntime.jsx(K,{message:y.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]})}),E?null:jsxRuntime.jsx("div",{style:H.scrollFooter,children:jsxRuntime.jsx(_,{label:y.confirmCta,kind:"primary",loading:b,disabled:!v||b||!!d&&!u||!!f&&!m,onPress:S,testID:"televet-review-confirm"})})]})}o(Bo,"ReviewStep");var $c="\u25CB",Kc="+";function Ye(e,t){return t?e.find(n=>n.petRef===t||n.petId===t)?.name??null:null}o(Ye,"nameOf");function ct({headingRef:e,style:t,id:r,children:n}){let i=ae(ge());return jsxRuntime.jsx(i,{ref:e,tabIndex:-1,style:t,...r===void 0?{}:{id:r},children:n})}o(ct,"StepHeading");function Ua({style:e,children:t}){let r=ae(Jt(ge()));return jsxRuntime.jsx(r,{style:e,children:t})}o(Ua,"SubHeading");function Wr({headingRef:e,pets:t,isPending:r,isError:n,onRetry:i,selectedId:l,onSelect:s,onAddPet:a}){let d=N(),u=w(),p=react.useMemo(()=>Be(u),[u]);return r?jsxRuntime.jsx("div",{role:"progressbar","aria-label":y.loading.pets,"aria-busy":"true",style:d.list,"data-testid":"televet-pets-loading",children:[0,1].map(f=>jsxRuntime.jsx(ve,{height:64},f))}):n?jsxRuntime.jsx("div",{"data-testid":"televet-pets-error",children:jsxRuntime.jsx($,{title:y.chrome.loadFailedTitle,actionLabel:y.chrome.retryCta,onAction:i})}):t.length===0?jsxRuntime.jsx("div",{"data-testid":"televet-pets-empty",children:jsxRuntime.jsx($,{title:y.chrome.noPetsTitle,actionLabel:y.addPetCta,onAction:a})}):jsxRuntime.jsxs("div",{style:d.stepFill,children:[jsxRuntime.jsx(ct,{headingRef:e,style:d.stepTitle,children:y.petSelectTitle}),jsxRuntime.jsx("div",{style:{...d.scrollBody,...p.stepScroll},children:jsxRuntime.jsxs("ul",{role:"list",style:d.list,"data-testid":"televet-pets",children:[t.map(f=>{let m=l===f.petRef;return jsxRuntime.jsx(Wa,{name:f.name??"",meta:Ma(f),selected:m,onPress:()=>s(f.petRef),testID:`televet-pet-${f.petRef}`},f.petRef)}),a?jsxRuntime.jsx(Wa,{name:y.addPetCta,meta:"",selected:false,onPress:a,testID:"televet-pet-add",glyph:Kc}):null]})})]})}o(Wr,"PetStep");function Wa({name:e,meta:t,selected:r,onPress:n,testID:i,glyph:l}){let s=w(),a=react.useMemo(()=>Be(s),[s]);return jsxRuntime.jsx("li",{children:jsxRuntime.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"data-testid":i,style:{...a.petRow,...r?a.petRowSelected:null},children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:a.petDisc,children:l??$a(e)}),jsxRuntime.jsxs("span",{style:a.petRowText,children:[jsxRuntime.jsx("span",{style:a.petRowName,children:e}),t?jsxRuntime.jsx("span",{style:a.petRowMeta,children:t}):null]})]})})}o(Wa,"PetRow");function $a(e){let t=e.trim();return t.length===0?$c:t.slice(0,1).toUpperCase()}o($a,"initialOf");function Ka({headingRef:e,clinicians:t,isPending:r,isError:n,selectedId:i,onSelect:l,onRetry:s}){let a=N(),d=w(),u=react.useMemo(()=>Be(d),[d]);if(r)return jsxRuntime.jsx("div",{role:"progressbar","aria-label":y.loading.clinicians,"aria-busy":"true",style:a.list,"data-testid":"televet-clinicians-loading",children:jsxRuntime.jsx(ve,{height:96})});if(n)return jsxRuntime.jsx("div",{"data-testid":"televet-clinicians-error",children:jsxRuntime.jsx($,{title:y.chrome.loadFailedTitle,actionLabel:y.chrome.retryCta,onAction:s})});if(t.length===0)return jsxRuntime.jsx("div",{"data-testid":"televet-clinicians-empty",children:jsxRuntime.jsx($,{title:y.noCliniciansTitle,message:y.noCliniciansBody,actionLabel:y.noCliniciansRetryCta,onAction:s})});let p=t.find(f=>f.clinicianId===i)??t[0];return p===void 0?null:jsxRuntime.jsxs("div",{style:a.list,"data-testid":"televet-clinicians",children:[jsxRuntime.jsx(ct,{headingRef:e,style:a.stepTitle,children:y.yourVetTitle}),jsxRuntime.jsxs("div",{style:u.vetRow,children:[jsxRuntime.jsx("span",{"aria-hidden":"true",style:u.vetAvatar,children:$a(p.displayName)}),jsxRuntime.jsxs("div",{style:u.vetIdentity,children:[jsxRuntime.jsx("p",{style:u.vetName,children:p.displayName}),p.credentials?jsxRuntime.jsx("p",{style:u.vetCredentials,children:p.credentials}):null,p.rating!==null&&p.ratingCount!==null?jsxRuntime.jsx("p",{style:u.vetRating,"data-testid":"televet-vet-rating",children:`\u2605 ${String(p.rating)} \xB7 ${String(p.ratingCount)} ${y.reviewsLabel}`}):null]})]}),p.bio?jsxRuntime.jsx("p",{style:u.vetBio,"data-testid":"televet-vet-bio",children:p.bio}):null,jsxRuntime.jsx("div",{style:a.divider}),jsxRuntime.jsx(_,{label:y.continueCta,kind:"primary",onPress:()=>l(p.clinicianId),testID:`televet-clinician-${p.clinicianId}`})]})}o(Ka,"ClinicianStep");function qa({headingRef:e,slots:t,enabled:r,isPending:n,isError:i,busySlotId:l,failure:s,selectedSlot:a,nextOpening:d,onPick:u,onRetry:p,onSeeOtherVets:f}){let m=N();return r?n?jsxRuntime.jsx("div",{role:"progressbar","aria-label":y.loading.slots,"aria-busy":"true",style:m.list,"data-testid":"televet-slots-loading",children:[0,1,2].map(c=>jsxRuntime.jsx(ve,{height:48},c))}):i?jsxRuntime.jsx($,{title:y.slotsErrorTitle,actionLabel:y.retryCta,onAction:p,testID:"televet-slots-error"}):t.length===0?jsxRuntime.jsx("div",{"data-testid":"televet-slots-empty",children:jsxRuntime.jsx($,{title:y.noSlotsTitle,message:d?W(y.nextOpeningTemplate,{when:Ee(d.startsAt)}):void 0,actionLabel:d?y.seeOtherVetsCta:void 0,onAction:d?f:void 0})}):jsxRuntime.jsxs("div",{style:m.stepFill,"data-testid":"televet-slots",children:[jsxRuntime.jsx(ct,{headingRef:e,style:m.stepTitle,children:y.timeHeading}),s==="expired"?jsxRuntime.jsx(K,{message:y.holdExpired}):null,s==="taken"?jsxRuntime.jsx(K,{message:y.slotTaken}):null,s==="failed"||s==="rate_limited"?jsxRuntime.jsx(K,{message:y.confirmFailed,testID:"televet-slots-hold-failed"}):null,jsxRuntime.jsx(er,{slots:t,busySlotId:l,onPick:u,selectedSlot:a,dayGroupLabel:y.summaryWhen,timeGroupLabel:y.navTitle})]}):jsxRuntime.jsx("div",{"data-testid":"televet-slots-unavailable",children:jsxRuntime.jsx($,{title:y.bookingPausedTitle})})}o(qa,"SlotStep");function Ya({headingRef:e,petName:t,chips:r,selected:n,onToggle:i,onNext:l}){let s=N(),a=w(),d=react.useMemo(()=>Be(a),[a]),u=W(y.issuesHeadingTemplate,{pet:t??""});return jsxRuntime.jsxs("div",{style:s.scrollRoot,"data-testid":"televet-booking-issues",children:[jsxRuntime.jsx("div",{style:s.scrollBody,children:jsxRuntime.jsxs("div",{style:s.list,children:[jsxRuntime.jsx(ct,{headingRef:e,style:s.stepTitle,children:u}),jsxRuntime.jsx("p",{style:s.stepHelp,children:y.issuesHint}),jsxRuntime.jsx("div",{role:"group","aria-label":u,style:d.chipRow,children:r.map(p=>{let f=n.includes(p.id);return jsxRuntime.jsx("button",{type:"button","aria-pressed":f,onClick:()=>i(p.id),style:{...d.chip,...f?d.chipOn:null},"data-testid":`televet-issue-${p.id}`,children:p.label},p.id)})})]})}),jsxRuntime.jsx("div",{style:s.scrollFooter,children:jsxRuntime.jsx(_,{label:y.continueCta,kind:"primary",onPress:l,testID:"televet-issues-next"})})]})}o(Ya,"IssuesStep");function Ga({headingRef:e,value:t,composed:r,onChange:n,onNext:i,media:l,onChangeMedia:s,onPickMedia:a,checking:d=false}){let u=N(),p=w(),f=react.useMemo(()=>Be(p),[p]),m=react.useId(),c=`${m}-reason-heading`,v=`${m}-reason-help`,b=(r??t).trim(),h=b.length>$e,S=b.length>0&&!h;return jsxRuntime.jsxs("div",{style:u.scrollRoot,"data-testid":"televet-booking-reason",children:[jsxRuntime.jsx("div",{style:u.scrollBody,"data-testid":"televet-booking-reason-scroll",children:jsxRuntime.jsxs("div",{style:u.list,children:[jsxRuntime.jsx(ct,{headingRef:e,id:c,style:u.stepTitle,children:y.describeHeading}),jsxRuntime.jsx("p",{id:v,style:u.stepHelp,children:y.describeHelpLong}),jsxRuntime.jsx("textarea",{value:t,onChange:E=>n(E.currentTarget.value),"aria-labelledby":c,"aria-describedby":v,"aria-invalid":h||void 0,placeholder:y.reasonPlaceholder,style:f.reasonInput,"data-testid":"televet-reason-input"}),h?jsxRuntime.jsx(K,{message:y.reasonTooLong}):null,jsxRuntime.jsx(Ro,{media:l,onChange:s,listLabel:y.addPhotoCta,...a?{onPickMedia:a}:{}})]})}),jsxRuntime.jsx("div",{style:u.scrollFooter,children:jsxRuntime.jsx(_,{label:y.continueCta,kind:"primary",disabled:!S,loading:d,onPress:i,testID:"televet-reason-next"})})]})}o(Ga,"ReasonStep");function Xa({headingRef:e,petId:t,roster:r,onAddPet:n,onPickPet:i}){return t===null?jsxRuntime.jsx(Wr,{headingRef:e,pets:r.pets,isPending:r.loading,isError:r.error!==null,onRetry:()=>{r.refresh();},onAddPet:n,selectedId:null,onSelect:i}):jsxRuntime.jsx(qc,{petRef:t})}o(Xa,"TelevetVisitSimulator");function qc({petRef:e}){let t=N(),r=ba(e);return jsxRuntime.jsx("div",{style:{...t.stepFill,...t.scrollBody},"data-testid":"televet-simulator",children:jsxRuntime.jsxs("div",{style:t.list,children:[jsxRuntime.jsx($,{title:pe.title}),jsxRuntime.jsx(_,{label:pe.create,onPress:r.create,kind:"secondary",disabled:r.busy,testID:"televet-simulator-create"}),r.visitLine!==null?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("p",{style:t.stateMessage,"data-testid":"televet-simulator-visit",children:r.visitLine}),ha.map(n=>jsxRuntime.jsx(_,{label:pe.advance[n],onPress:()=>r.advance(n),kind:"secondary",disabled:r.busy,testID:`televet-simulator-advance-${n}`},n)),jsxRuntime.jsx("p",{style:t.stateMessage,children:pe.eventsNote}),Ta.map(n=>jsxRuntime.jsx(_,{label:pe.events[n],onPress:()=>r.raise(n),kind:"secondary",disabled:r.busy,testID:`televet-simulator-event-${n}`},n))]}):null,r.line===null?null:r.line.tone==="danger"?jsxRuntime.jsx(K,{message:r.line.text,testID:"televet-simulator-error"}):jsxRuntime.jsx("p",{role:"status",style:t.stateMessage,"data-testid":"televet-simulator-log",children:r.line.text})]})})}o(qc,"SimulatorScreen");function Do(e){let{petRef:t,usState:r,controller:n,onBooked:i,onExit:l,onAddPet:s,onPickMedia:a,onAddToCalendar:d,onConfirmDiscard:u,onRequestLocation:p,locationStatus:f="unknown",onTriageReason:m,onStateInterest:c,primaryVet:v,onFindEmergencyVet:b,canJoinInApp:h=false,renderUnavailable:S,headingLevel:E,style:k,testID:L}=yt(e,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),x=Ea(E??xt),A=Jt(x),z=N(),H=w(),X=react.useMemo(()=>Be(H),[H]),D=Se(n),G=Ar(),q=G.pets,ee=q.length,ye=react.useMemo(()=>({ownedPetCount:ee,withIssues:true}),[ee]),[he,Le]=react.useReducer((M,Ze)=>Xn(M,Ze,ye),void 0,()=>Gn({ownedPetCount:0,withIssues:true},{petId:t??null,state:r??null})),O=react.useCallback(M=>Le(M),[]),[Ge,Je]=react.useState(""),[Xe,Y]=react.useState([]),[xe,V]=react.useState(null),[ze,pt]=react.useState(null),[qr,Zo]=react.useState(false),[Yr,ei]=react.useState(false),[ti,hs]=react.useState([]),[Gr,Ts]=react.useState(null),[Ss,Es]=react.useState(null),{draft:P}=he,ne=Qn(he),ri=react.useMemo(()=>ea(q.find(M=>M.petRef===P.petId||M.petId===P.petId)?.species??null),[q,P.petId]),Qe=ta(Xe.map(M=>ri.find(Ze=>Ze.id===M)?.label??""),Ge),ni=react.useRef(P.state);ni.current!==P.state&&(ni.current=P.state,qr&&Zo(false),Yr&&ei(false));let sr=kn(P.state,D),oi=Mt(D),ft=xn(D),me=Rn(P.state,D),He=jt(P.clinicianId,D),Jr=He.refetch,Cs=_n(D).data??null,Xr=zt(D),ii=wn(D),Re=co(m??null),li=po(P.state,c??null).actionFor("no_licensed_vet"),Qr=r??null;react.useEffect(()=>{Qr&&!P.state&&O({type:"patch",patch:{state:Qr}});},[Qr,P.state,O]),react.useEffect(()=>{t&&!P.petId&&O({type:"patch",patch:{petId:t}});},[t,P.petId,O]);let Zr=q.length===1?q[0]?.petRef??null:null;react.useEffect(()=>{Zr&&!P.petId&&O({type:"patch",patch:{petId:Zr}});},[Zr,P.petId,O]);let ai=react.useRef(ne);ai.current=ne;let si=react.useRef(0);react.useEffect(()=>{ee!==si.current&&(si.current=ee,O({type:"goTo",step:ai.current}));},[ee,O]);let en=me.data?.[0]?.clinicianId??null;react.useEffect(()=>{en&&!P.clinicianId&&O({type:"patch",patch:{clinicianId:en}});},[en,P.clinicianId,O]);let Ve=react.useRef(null),di=react.useRef(false);react.useEffect(()=>{if(!di.current){di.current=true;return}Ve.current?.focus();},[ne]);let ks=da({draft:P,hold:Xr,dispatch:O,setFailure:V,refetchSlots:Jr}),{submitBooking:xs,confirm:Rs}=sa({draft:P,reasonText:Qe,book:ii,stateAttested:qr,termsAttested:Yr,cancellationPolicy:oi.data??null,triage:Re,goTo:react.useCallback(M=>O({type:"goTo",step:M}),[O]),releaseSlot:react.useCallback(()=>{Es(P.slot),O({type:"patch",patch:Zl}),Jr();},[P.slot,O,Jr]),setFailure:V,setEmergency:pt,setBookedConsult:Ts,...i?{onBooked:i}:{}}),_s=sr.enabled&&sr.data!==null&&!sr.data.wellnessAvailable,Ps=ft.enabled&&ft.data?.active===false||xe==="not_entitled",{simulate:ui,fundingRefused:ci}=va(ft,Ps),ws=ft.enabled&&ft.data!==null,Is=ro(ws),pi=Dr(ti.length),Os=Qe.trim().length>0||!!P.slot,fi={surfaceUnavailable:D===null||xe==="unavailable"||Ht(ft)||Ht(sr),notEntitled:ci,policyBlocked:_s,triageOpen:Re.open,step:ne},As=Pa(fi),yi={noState:!P.state,isPending:me.enabled&&me.isPending,isError:me.isError,isEmpty:(me.data?.length??0)===0,notEntitled:ci},Bs=Ia(yi);return Ne()?jsxRuntime.jsx(fo.Provider,{value:A,children:jsxRuntime.jsxs("div",{style:{...z.screen,...k},"data-testid":L??"televet-booking",children:[jsxRuntime.jsx(xo,{step:ne,furthestIndex:he.furthestIndex,triageOpen:Re.open,canGoBack:!ui&&(Re.open||Jn(he,ye))&&ne!=="booked",isDirty:Os,onBack:()=>{if(Re.open){Re.close();return}Re.cancel(),O({type:"back"});},onClose:()=>l?.(),headingLevel:x,...u?{onConfirmDiscard:u}:{}}),ui?jsxRuntime.jsx(Xa,{headingRef:Ve,petId:P.petId,roster:G,onAddPet:s,onPickPet:M=>O({type:"patch",patch:{petId:M}})}):As?jsxRuntime.jsx(wa,{state:fi,petName:Ye(q,P.petId),...v?{primaryVet:v}:{},onFindEmergencyVet:b,stateInterest:li,...c?{onCheckAvailability:o(()=>O({type:"goTo",step:"clinician"}),"onCheckAvailability")}:{},onAcknowledgeEmergency:()=>{Re.acknowledge(Qe),O({type:"next"});},...S?{renderUnavailable:S}:{}}):ne==="time"?jsxRuntime.jsx(qa,{headingRef:Ve,slots:He.data??[],enabled:He.enabled,isPending:He.enabled&&He.isPending&&He.data===null,isError:He.isError,busySlotId:Xr.isPending?Xr.variables:null,failure:xe,selectedSlot:P.slot??Ss,nextOpening:Cs,onPick:ks,onRetry:()=>He.refetch(),onSeeOtherVets:()=>O({type:"goTo",step:"clinician"})}):ne==="review"?jsxRuntime.jsx(Bo,{headingRef:Ve,when:P.slot?Ee(P.slot.startsAt):"",lengthMinutes:(P.slot?vn(P.slot):null)??it,petName:Ye(q,P.petId),reason:Qe.trim(),clinician:me.data?.find(M=>M.clinicianId===P.clinicianId)?.displayName??null,shareRecords:P.shareHealthRecords,stateCode:P.state,stateAttested:qr,onToggleStateAttest:Zo,cancellationTerms:oi.data?.summary??null,termsAttested:Yr,onToggleTermsAttest:ei,onToggleShare:M=>O({type:"patch",patch:{shareHealthRecords:M}}),canConfirm:Kt(P,Qe),busy:ii.isPending,failure:xe,onConfirm:Rs,emergency:ze,onAcknowledgeEmergency:()=>xs(true),mediaShortfall:pi,primaryVet:v,onFindEmergencyVet:b,onSeeOtherVets:()=>O({type:"goTo",step:"clinician"})}):ne==="booked"?jsxRuntime.jsx("div",{style:z.stepFill,"data-testid":"televet-booking-booked",children:Gr?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ho,{consult:Gr,petName:Ye(q,Gr.petId)??Ye(q,P.petId),onDone:()=>l?.(),canJoinInApp:h,lengthMinutes:(P.slot?vn(P.slot):null)??it,...d?{onAddToCalendar:d}:{}}),jsxRuntime.jsx(Qt,{shortfall:pi,testIDPrefix:"televet-booked"})]}):null}):ne==="clinician"&&Bs?jsxRuntime.jsx(Oa,{state:yi,cause:Is,locationStatus:f,...p?{onRequestLocation:p}:{},onRetry:()=>me.refetch(),stateInterest:li,...S?{renderUnavailable:S}:{}}):ne==="clinician"?jsxRuntime.jsx(Ka,{headingRef:Ve,clinicians:me.data??[],isPending:me.enabled&&me.isPending,isError:me.isError,selectedId:P.clinicianId,onRetry:()=>me.refetch(),onSelect:M=>{O({type:"patch",patch:{clinicianId:M}}),O({type:"next"});}}):ne==="issues"?jsxRuntime.jsx(Ya,{headingRef:Ve,petName:Ye(q,P.petId),chips:ri,selected:Xe,onToggle:M=>Y(Ze=>Ze.includes(M)?Ze.filter(Ls=>Ls!==M):[...Ze,M]),onNext:()=>O({type:"next"})}):ne==="reason"?jsxRuntime.jsx(Ga,{headingRef:Ve,value:Ge,composed:Qe,onChange:Je,media:ti,onChangeMedia:hs,...a?{onPickMedia:a}:{},checking:Re.checking,onNext:()=>{Re.check(Qe).then(M=>{M&&O({type:"next"});});}}):ne==="pet"?jsxRuntime.jsx(Wr,{headingRef:Ve,pets:q,isPending:G.loading,isError:G.error!==null,onRetry:()=>{G.refresh();},onAddPet:s,selectedId:P.petId,onSelect:M=>{O({type:"patch",patch:{petId:M}}),O({type:"next"});}}):jsxRuntime.jsx("div",{style:X.marker,"data-testid":`televet-booking-step-${ne}`})]})}):jsxRuntime.jsx("div",{style:{...z.screen,...k},"data-testid":L??"televet-booking",children:jsxRuntime.jsx("div",{style:z.stepFill,"data-testid":"televet-booking-copy-unapproved",children:S?S():null})})}o(Do,"EverfurTelevetBooking");var Za=Symbol.for("@everfur/sdk/televet");function es(){let e=globalThis,t=e[Za];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[Za]=r,r}o(es,"televetGlobal");function $r(){return es().dailyRegistered}o($r,"isEverfurDailyRegistered");function Fo(){let e=es(),t=e.noticeReceipts;if(t!==void 0)return t;let r=new Map;return e.noticeReceipts=r,r}o(Fo,"noticeReceipts");function ts(e){let t=Fo(),r=t.get(e);r!==void 0?r.holders+=1:t.set(e,{holders:1,joined:false});}o(ts,"markRecordingNoticeAccepted");function rs(e){let t=Fo(),r=t.get(e);r!==void 0&&(r.holders-=1,r.holders<=0&&t.delete(e));}o(rs,"clearRecordingNoticeAccepted");function ns(e){return Fo().get(e)?.joined===true}o(ns,"isTelevetCallJoined");var je=Object.freeze({muteCta:"Mute",unmuteCta:"Unmute",cameraOffCta:"Camera off",cameraOnCta:"Camera on",leaveCta:"Leave",switchCameraCta:"Switch camera",speakerOffCta:"Speaker off",speakerOnCta:"Speaker on",lobbyTitleNoName:"Your vet is joining",lobbySubtitle:"Usually under a minute",lobbyPrepLabel:"WHILE YOU WAIT",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:o(e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:je.lobbyTitleNoName},"lobbyTitle"),lobbyPrep:o(e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:je.lobbyPrepNoPet},"lobbyPrep"),lobbyDuration:o(e=>`${e} MINUTE VISIT`,"lobbyDuration"),joinFailedReason:"That did not open. Try again.",recordingNoticeTitle:"This consultation is recorded.",recordingNoticeCta:"Continue to the call",recordingNoticeDecline:"Not now",selfCameraOffLabel:"Your camera is off"});function os(e){switch(e){case "too_early":return "This visit has not opened yet.";case "too_late":return "This visit has ended.";case "room_not_ready":return "We are still setting up the video room. Try again in a moment.";case "status_cancelled_owner":return "You cancelled this visit.";case "status_cancelled_ops":return "This visit was cancelled. Please book another time.";case "status_no_show_owner":return "This visit was missed.";case "status_no_show_vet":return "The vet could not make this visit. Please book another time.";case "status_awaiting_summary":return "This visit has ended. Your summary is on its way.";case "status_completed":return "This visit has ended.";default:return ir}}o(os,"televetJoinRefusalWebCopy");var ir="This visit cannot be joined right now.";function is(e){return e==="room_not_ready"||e==="unknown"}o(is,"televetJoinIsRetryable");function ls(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}}o(ls,"memoizeTelevetLoader");var ss=Object.freeze({status:"joining"});function Mo(e,t){let[r,n]=react.useState(0),[i,l]=react.useState(ss),s=react.useRef(null);react.useEffect(()=>{let d=t?.joinConsult;if(t===null||d===void 0){l(Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let u=`${e}#${String(r)}`,p=s.current;if(p===null||p.key!==u){let m;try{m=d.call(t,e);}catch(c){m=Promise.reject(c);}p={key:u,promise:m},s.current=p;}let f=true;return l(ss),p.promise.then(m=>{f&&(m.ok?l(Object.freeze({status:"ready",credential:m.value})):l(Object.freeze({status:"refused",refusal:mn(m.error),reason:yn(m.error)})));},()=>{f&&l(Object.freeze({status:"refused",refusal:"unknown",reason:null}));}),()=>{f=false;}},[e,t,r]);let a=react.useCallback(()=>n(d=>d+1),[]);return {state:i,retry:a}}o(Mo,"useTelevetJoin");var us=ls(()=>import('@everfur/sdk/web/televet/call')),np=sn;function jo({consultId:e,controller:t,onLeave:r,style:n}){let i=N(),[l,s]=react.useState(null),a=l===e,[d]=react.useState($r);react.useEffect(()=>{if(d)return;let p=true;return us().then(f=>{p&&ip(f.EVERFUR_DAILY_SETUP);},()=>{}),()=>{p=false;}},[d]),Zt(()=>(r(),true),!a);let u=react.useCallback(()=>{s(null),r();},[r]);return d?a?jsxRuntime.jsx(op,{consultId:e,controller:t,onLeave:u,style:n},e):jsxRuntime.jsx(cs,{onContinue:()=>s(e),onDecline:r,style:n}):jsxRuntime.jsxs("div",{style:{...i.stepFill,...n},"data-testid":"televet-join-call-unavailable",children:[jsxRuntime.jsx(K,{message:ir}),jsxRuntime.jsx(_,{label:je.leaveCta,kind:"secondary",onPress:r,testID:"televet-join-unavailable-leave"})]})}o(jo,"TelevetJoinScreen");function cs({onContinue:e,onDecline:t,busy:r=false,declineHeld:n=false,style:i}){let l=N(),s=`${react.useId()}-recording-notice`,a=react.useRef(null);return react.useEffect(()=>{let d=a.current;if(!d)return;let u=d.ownerDocument.activeElement;u!==null&&u!==d.ownerDocument.body||d.focus();},[]),jsxRuntime.jsx("div",{style:{...l.stepFill,...i},children:jsxRuntime.jsxs("div",{ref:a,role:"alertdialog","aria-labelledby":s,"aria-busy":r||void 0,tabIndex:-1,"data-testid":"everfur-vet-call-recording-notice",style:l.stateCard,children:[jsxRuntime.jsx("p",{id:s,style:l.stateTitle,children:je.recordingNoticeTitle}),jsxRuntime.jsx(_,{label:je.recordingNoticeCta,kind:"primary",loading:r,onPress:()=>e?.(),testID:"everfur-vet-call-recording-continue"}),jsxRuntime.jsx(_,{label:je.recordingNoticeDecline,kind:"secondary",disabled:n,onPress:()=>t?.(),testID:"everfur-vet-call-recording-decline"})]})})}o(cs,"TelevetRecordingNotice");function op({consultId:e,controller:t,onLeave:r,style:n}){let i=N(),l=Se(t),{state:s,retry:a}=Mo(e,l),d=s.status==="ready"?s.credential:null,[u,p]=react.useState(null),[f,m]=react.useState(false),c=d!==null;react.useEffect(()=>{if(!c||u!==null)return;let x=true;return us().then(A=>{x&&p(()=>A);},()=>{x&&m(true);}),()=>{x=false;}},[c,u]);let[v,b]=react.useState(null);react.useEffect(()=>{if(d===null)return;let x=d.roomUrl;return ts(x),b(d),()=>{rs(x);}},[d]);let h=s.status==="joining",[S,E]=react.useState(false);react.useEffect(()=>{if(!h){E(false);return}let x=setTimeout(()=>E(true),np);return ()=>{clearTimeout(x);}},[h]);let k=h&&!S;if(Zt(()=>(k||d!==null&&u!==null&&!f&&ns(d.roomUrl)||r(),true)),s.status==="refused"||f){let x=s.status==="refused"?s.refusal:"unavailable",A=s.status==="refused"?os(s.reason):ir;return jsxRuntime.jsxs("div",{style:{...i.stepFill,...n},"data-testid":"televet-join-refused",children:[jsxRuntime.jsx(K,{message:A,testID:"televet-join-refused-message"}),is(x)&&s.status==="refused"?jsxRuntime.jsx(_,{label:y.retryCta,kind:"primary",onPress:a,testID:"televet-join-retry"}):null,jsxRuntime.jsx(_,{label:je.leaveCta,kind:"secondary",onPress:r,testID:"televet-join-leave"})]})}if(d===null||u===null||v!==d)return jsxRuntime.jsx(cs,{busy:true,declineHeld:k,onDecline:r,style:n});let{EverfurVetCall:L}=u;return jsxRuntime.jsx(L,{roomUrl:d.roomUrl,token:d.token,onLeave:r,renderUnavailable:()=>jsxRuntime.jsxs("div",{style:i.stepFill,"data-testid":"televet-join-call-unavailable",children:[jsxRuntime.jsx(K,{message:ir}),jsxRuntime.jsx(_,{label:je.leaveCta,kind:"secondary",onPress:r,testID:"televet-join-unavailable-leave"})]}),...n?{style:n}:{}})}o(op,"TelevetJoinRoom");var ds=false;function ip(e){if(ds)return;ds=true;let t=globalThis.console;try{t?.warn?.(e);}catch{}}o(ip,"warnSetupOnce");var sp=2e4;function ps(e=true,t=sp){let[r,n]=react.useState(()=>Date.now());return react.useEffect(()=>{if(!e)return;n(Date.now());let i=setInterval(()=>n(Date.now()),t);return ()=>clearInterval(i)},[e,t]),r}o(ps,"useNowMs");function dp(e){let t=e.trim().length;return t<1?I.cancellationReasonMissing:t>Ke?I.cancellationReasonTooLong(Ke):null}o(dp,"reasonRefusal");function Ho({terms:e,submitting:t,failure:r,onConfirm:n,onDismiss:i,onRetryTerms:l,styles:s}){let[a,d]=react.useState(""),[u,p]=react.useState(null),f=react.useId(),m=react.useId(),c=e.status==="ready",v=o(()=>{if(t||!c)return;let b=dp(a);p(b),b||n(a.trim());},"confirm");return jsxRuntime.jsxs("form",{onSubmit:b=>{b.preventDefault(),v();},"aria-label":I.cancelConfirmCta,noValidate:true,style:s.form,"data-testid":"televet-visit-cancel-form",children:[jsxRuntime.jsx("p",{style:s.noticeTitle,children:I.cancelConfirmTitle}),e.status==="ready"?jsxRuntime.jsx("div",{style:s.notice,"data-testid":"televet-visit-cancel-terms",children:jsxRuntime.jsx("p",{style:s.note,children:e.summary})}):e.status==="loading"?jsxRuntime.jsx("div",{role:"status",style:s.notice,children:jsxRuntime.jsx("p",{style:s.note,children:I.loadingCancellationTerms})}):jsxRuntime.jsxs("div",{role:"alert",style:{...s.notice,...s.noticeDanger},"data-testid":"televet-visit-cancel-terms-error",children:[jsxRuntime.jsx("p",{style:s.note,children:I.cancellationTermsUnavailable}),jsxRuntime.jsx(_,{label:I.retry,kind:"secondary",fullWidth:false,onPress:l})]}),jsxRuntime.jsx("label",{htmlFor:f,style:s.label,children:I.cancellationReasonLabel}),jsxRuntime.jsx("textarea",{id:f,value:a,onChange:b=>{d(b.target.value),u&&p(null);},maxLength:Ke,rows:3,disabled:t||!c,"aria-invalid":u?true:void 0,"aria-describedby":u?m:void 0,style:s.textarea,"data-testid":"televet-visit-cancel-reason"}),u?jsxRuntime.jsx("p",{id:m,role:"alert",style:s.fieldError,children:u}):null,r?jsxRuntime.jsx("div",{role:"alert",style:{...s.notice,...s.noticeDanger},"data-testid":"televet-visit-cancel-failed",children:jsxRuntime.jsx("p",{style:s.note,children:r})}):null,jsxRuntime.jsxs("div",{style:s.actions,children:[jsxRuntime.jsx(_,{label:t?I.cancellingVisit:I.cancelConfirmCta,kind:"danger",fullWidth:false,disabled:t||!c,loading:t,onPress:v,testID:"televet-visit-cancel-yes"}),jsxRuntime.jsx(_,{label:I.cancelDismissCta,kind:"secondary",fullWidth:false,disabled:t,onPress:i,testID:"televet-visit-cancel-keep"})]})]})}o(Ho,"TelevetCancelVisitForm");function ms(e){let{color:t,space:r,radius:n,type:i}=e,{size:l,lineHeight:s}=i,a=o(d=>`${String(d)}px`,"px");return {screen:{...ht,display:"flex",flexDirection:"column",gap:a(r.md),paddingLeft:a(r.xl),paddingRight:a(r.xl),boxSizing:"border-box"},topBar:{display:"flex",alignItems:"center",justifyContent:"flex-end",minHeight:44},topBarStart:{justifyContent:"flex-start"},iconButton:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:44,height:44,padding:0,border:0,borderRadius:a(n.pill),background:"transparent",color:t.text.primary,cursor:"pointer"},textButton:{display:"inline-flex",alignItems:"center",minHeight:44,padding:`0 ${a(r.sm)}`,border:0,borderRadius:a(n.pill),background:"transparent",color:t.brand,cursor:"pointer",...T(e,"bold"),fontSize:a(l.body)},panel:{display:"flex",flexDirection:"column",borderStyle:"solid",borderWidth:1,borderColor:t.brandBorder,borderRadius:a(n.lg),backgroundColor:t.surface,overflow:"hidden"},panelBody:{display:"flex",flexDirection:"column",gap:a(r.md),padding:a(r.lg)},panelHeader:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:a(r.sm),padding:`${a(r.md)} ${a(r.lg)}`,borderBottom:`1px solid ${t.brandBorder}`},panelTitle:{margin:0,...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},count:{...T(e,"mono"),color:t.text.metaCool,fontSize:a(l.caption)},bookTitle:{margin:0,...T(e,"medium"),color:t.brand,fontSize:a(l.subtitle),lineHeight:String(s.snug)},list:{listStyle:"none",margin:0,padding:0},row:{display:"flex",flexDirection:"column",gap:a(r.sm),padding:`${a(r.md)} ${a(r.lg)}`,borderBottom:`1px solid ${t.brandBorder}`},rowHead:{display:"flex",flexWrap:"wrap",alignItems:"flex-start",justifyContent:"space-between",gap:a(r.sm)},when:{margin:0,...T(e,"medium"),color:t.text.primary,fontSize:a(l.subtitle),lineHeight:String(s.snug)},pet:{margin:0,...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.caption)},chip:{display:"inline-flex",alignItems:"center",padding:`2px ${a(r.sm)}`,borderRadius:a(n.pill),backgroundColor:t.surfaceSubtle,...T(e,"mono"),color:t.text.metaCool,fontSize:a(l.micro),letterSpacing:"0.04em",textTransform:"uppercase"},chipPositive:{backgroundColor:t.badgeBgPositive,color:t.brand},actions:{display:"flex",flexWrap:"wrap",gap:a(r.sm)},note:{margin:0,...T(e,"regular"),color:t.text.metaCool,fontSize:a(l.body),lineHeight:String(s.normal)},notice:{display:"flex",flexDirection:"column",gap:a(r.xs),padding:a(r.md),borderRadius:a(n.md),backgroundColor:t.surfaceSubtle},noticeTitle:{margin:0,...T(e,"medium"),color:t.text.primary,fontSize:a(l.body),lineHeight:String(s.snug)},noticeDanger:{backgroundColor:t.badgeBgCritical},form:{display:"flex",flexDirection:"column",gap:a(r.sm),marginTop:a(r.sm),paddingTop:a(r.md),borderTop:`1px solid ${t.brandBorder}`},label:{...T(e,"medium"),color:t.text.primary,fontSize:a(l.body)},textarea:{minHeight:96,padding:a(r.sm),borderRadius:a(n.md),border:`1px solid ${t.brandBorder}`,...T(e,"regular"),fontSize:a(l.body),color:t.text.primary,backgroundColor:t.surface,resize:"vertical",boxSizing:"border-box"},fieldError:{margin:0,...T(e,"regular"),color:t.danger,fontSize:a(l.caption)},empty:{display:"flex",flexDirection:"column",gap:a(r.xs),padding:a(r.lg)},skeletons:{display:"flex",flexDirection:"column",gap:a(r.sm),padding:a(r.lg)}}}o(ms,"makeVisitStyles");function Wo({controller:e,onJoin:t,onReschedule:r,onBook:n,onBack:i,isRoot:l=true,revision:s=0,returnedTo:a=false,nowMs:d,style:u}){let p=w(),f=react.useMemo(()=>ms(p),[p]),m=ae(ge()),c=Se(e),[v,b]=react.useState(0),h=xr(c,s+v),S=Mt(c),{pets:E}=Ar(),[k,L]=react.useState({status:"idle"}),[x,A]=react.useState(null),z=h.data??[],H=ps(z.some(Y=>!vr.has(Y.status))),X=d??H,{upcoming:D,past:G}=react.useMemo(()=>Vt(z,X),[z,X]),q=react.useRef(null),ee=react.useRef(null),ye=react.useRef(null),he=react.useRef(null),Le=react.useRef(a),O=!(h.enabled&&h.isPending);react.useEffect(()=>{Le.current&&ee.current?.focus();},[]),react.useEffect(()=>{!Le.current||!O||(Le.current=false,!q.current?.contains(document.activeElement)&&(ye.current??he.current)?.focus());},[O]);let Ge=S.data!==null&&S.data!==void 0?{status:"ready",summary:S.data.summary}:S.enabled&&S.isPending?{status:"loading"}:{status:"error"},Je=o((Y,xe)=>{let V=c?.cancelConsult;if(Ge.status!=="ready"||!c||!V){L({status:"failed",consultId:Y.consultId,message:I.cancelTermsFirst});return}L({status:"submitting",consultId:Y.consultId}),V.call(c,Y.consultId,xe).then(ze=>{ze.ok?(A(ze.value),L({status:"idle"})):L({status:"failed",consultId:Y.consultId,message:I.cancelFailed}),b(pt=>pt+1);},()=>L({status:"failed",consultId:Y.consultId,message:I.cancelFailed}));},"cancelVisit"),Xe=o(Y=>jsxRuntime.jsx(cp,{consult:Y,petName:Ye(E,Y.petId),nowMs:X,styles:f,cancelling:k.status!=="idle"&&k.consultId===Y.consultId?k:null,anyCancelInFlight:k.status==="submitting",terms:Ge,onJoin:t,onReschedule:r,onAskCancel:()=>{A(null),L({status:"asking",consultId:Y.consultId});},onDismissCancel:()=>L({status:"idle"}),onCancel:xe=>Je(Y,xe),onRetryTerms:()=>S.refetch()},Y.consultId),"renderRow");return jsxRuntime.jsxs("div",{ref:q,style:{...f.screen,...u},"data-testid":"televet-visits",children:[jsxRuntime.jsx("div",{style:l?f.topBar:{...f.topBar,...f.topBarStart},children:l?jsxRuntime.jsx("button",{type:"button",onClick:i,"aria-label":pp,style:f.iconButton,"data-testid":"televet-visits-close",children:jsxRuntime.jsx(yp,{})}):jsxRuntime.jsx("button",{type:"button",onClick:i,style:f.textButton,"data-testid":"televet-visits-back",children:fp})}),x?jsxRuntime.jsxs("div",{role:"status",style:f.notice,"data-testid":"televet-visits-cancel-receipt",children:[jsxRuntime.jsx("p",{style:f.noticeTitle,children:I.cancelledTitle}),x.summary?jsxRuntime.jsx("p",{style:f.note,children:x.summary}):null,jsxRuntime.jsx("p",{style:f.note,children:x.feeRecorded?I.cancellationFeeRecorded:I.cancellationFeeNotRecorded})]}):null,n?jsxRuntime.jsx("section",{style:f.panel,"data-testid":"televet-visits-book-card",children:jsxRuntime.jsxs("div",{style:f.panelBody,children:[jsxRuntime.jsx("p",{style:f.bookTitle,children:I.bookCardTitle}),jsxRuntime.jsx(_,{label:I.bookCardCta,onPress:n,testID:"televet-visits-book"})]})}):null,h.enabled&&h.isPending?jsxRuntime.jsxs("section",{style:f.panel,children:[jsxRuntime.jsx(Uo,{Title:m,title:I.pastTitle,count:null,styles:f,headingRef:ee}),jsxRuntime.jsx("div",{role:"progressbar","aria-label":I.loading,"aria-busy":"true",style:f.skeletons,"data-testid":"televet-visits-loading",children:[0,1,2].map(Y=>jsxRuntime.jsx(ve,{height:56},Y))})]}):h.isError&&h.data===null?jsxRuntime.jsxs("div",{ref:he,role:"alert",tabIndex:-1,style:{...f.notice,...f.noticeDanger},"data-testid":"televet-visits-error",children:[jsxRuntime.jsx("p",{style:f.noticeTitle,children:I.loadErrorTitle}),jsxRuntime.jsx("p",{style:f.note,"data-testid":"televet-visits-error-body",children:I.loadErrorBody}),jsxRuntime.jsx(_,{label:I.retry,kind:"secondary",fullWidth:false,onPress:()=>h.refetch()})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[D.length>0?jsxRuntime.jsxs("section",{style:f.panel,"data-testid":"televet-visits-upcoming",children:[jsxRuntime.jsx(Uo,{Title:m,title:I.upcomingTitle,count:D.length,styles:f,headingRef:ye}),jsxRuntime.jsx("ul",{"aria-label":I.upcomingTitle,style:f.list,children:D.map(Xe)})]}):null,jsxRuntime.jsxs("section",{style:f.panel,"data-testid":"televet-visits-past",children:[jsxRuntime.jsx(Uo,{Title:m,title:I.pastTitle,count:G.length,styles:f,...D.length===0?{headingRef:ye}:{}}),z.length===0?jsxRuntime.jsxs("div",{style:f.empty,"data-testid":"televet-visits-empty",children:[jsxRuntime.jsx("p",{style:f.noticeTitle,children:I.emptyTitle}),jsxRuntime.jsx("p",{style:f.note,children:I.emptyBody})]}):G.length===0?null:jsxRuntime.jsx("ul",{"aria-label":I.pastTitle,style:f.list,children:G.map(Xe)})]})]})]})}o(Wo,"TelevetVisitsScreen");function Uo({Title:e,title:t,count:r,styles:n,headingRef:i}){return jsxRuntime.jsxs("div",{style:n.panelHeader,children:[jsxRuntime.jsx(e,{style:n.panelTitle,...i?{ref:i,tabIndex:-1}:{},children:t}),r===null?null:jsxRuntime.jsx("span",{style:n.count,children:r})]})}o(Uo,"PanelHeader");function cp({consult:e,petName:t,nowMs:r,styles:n,cancelling:i,anyCancelInFlight:l,terms:s,onJoin:a,onReschedule:d,onAskCancel:u,onDismissCancel:p,onCancel:f,onRetryTerms:m}){let c=Ln(e,r),v=vr.has(e.status),b=il(e.status),h=Bn(e),S=Nn(e.status),E=e.consultId,k=react.useId(),L=!c.joinable&&!v;return jsxRuntime.jsxs("li",{style:n.row,"data-testid":`televet-visits-row-${E}`,children:[jsxRuntime.jsxs("div",{style:n.rowHead,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{style:n.when,children:na(e.scheduledAt)}),t?jsxRuntime.jsx("p",{style:n.pet,children:t}):null]}),b?jsxRuntime.jsx("span",{style:c.joinable?{...n.chip,...n.chipPositive}:n.chip,"data-testid":`televet-visits-status-${E}`,children:b}):null]}),jsxRuntime.jsxs("div",{style:n.actions,children:[v?null:jsxRuntime.jsx(_,{label:I.joinCta,fullWidth:false,disabled:!c.joinable,onPress:()=>a(e,t),describedBy:L?k:void 0,testID:`televet-visits-join-${E}`}),S&&d?jsxRuntime.jsx(_,{label:I.rescheduleCta,kind:"secondary",fullWidth:false,onPress:()=>d(e),testID:`televet-visits-reschedule-${E}`}):null,S?jsxRuntime.jsx(_,{label:I.cancelCta,kind:"danger",fullWidth:false,disabled:l,onPress:u,testID:`televet-visits-cancel-${E}`}):null]}),L?jsxRuntime.jsx("p",{id:k,style:n.note,"data-testid":`televet-visits-join-note-${E}`,children:ll(c.reason,h===null?void 0:oa(new Date(h).toISOString()))}):null,i?jsxRuntime.jsx(Ho,{terms:s,submitting:i.status==="submitting",failure:i.status==="failed"?i.message:null,onConfirm:f,onDismiss:p,onRetryTerms:m,styles:n}):null]})}o(cp,"VisitRow");var pp="Close",fp="Back";function yp(){return jsxRuntime.jsx("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:jsxRuntime.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}o(yp,"CloseGlyph");function $o(e){let{consult:t,onRescheduled:r,onCancel:n,controller:i,style:l,testID:s}=yt(e,["onRescheduled","onCancel"]),a=N(),d=Se(i),u=jt(t?.clinicianId??null,d),p=zt(d),f=In(t?.consultId??null,d),[m,c]=react.useState(null),v=react.useCallback(h=>{c(null),p.mutate(h.slotId,{onSuccess:o(()=>{f.mutate(h.slotId,{onSuccess:o(S=>r?.(S),"onSuccess"),onError:o(S=>c(Ue(S).kind==="unavailable"?"unavailable":"failed"),"onError")});},"onSuccess"),onError:o(S=>c(Ue(S).kind==="unavailable"?"unavailable":"taken"),"onError")});},[p,f,r]),b=p.isPending||f.isPending;return Ne()?t?jsxRuntime.jsxs("section",{style:{...a.stepFill,...l},"aria-label":y.rescheduleNavTitle,"data-testid":s??"televet-reschedule",children:[jsxRuntime.jsx("p",{style:a.stepHelp,children:W(y.rescheduleFromTemplate,{when:Ee(t.scheduledAt)})}),m==="taken"?jsxRuntime.jsx(K,{message:y.slotTaken}):null,m==="failed"?jsxRuntime.jsx(K,{message:y.rescheduleFailed}):null,m==="unavailable"?jsxRuntime.jsx(K,{message:y.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,u.enabled?u.isPending?jsxRuntime.jsx("div",{role:"progressbar","aria-label":y.loading.slots,"aria-busy":"true",style:a.list,"data-testid":"televet-reschedule-slots-loading",children:[0,1,2].map(h=>jsxRuntime.jsx(ve,{height:48},h))}):u.isError?jsxRuntime.jsx($,{title:y.slotsErrorTitle,actionLabel:y.retryCta,onAction:()=>u.refetch(),testID:"televet-reschedule-slots-error"}):(u.data??[]).length===0?jsxRuntime.jsx("div",{"data-testid":"televet-reschedule-empty",children:jsxRuntime.jsx($,{title:y.noSlotsTitle})}):jsxRuntime.jsx(er,{slots:u.data??[],busySlotId:b?p.variables:null,onPick:v,dayGroupLabel:y.summaryWhen,timeGroupLabel:y.rescheduleNavTitle,rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):jsxRuntime.jsx("div",{"data-testid":"televet-reschedule-paused",children:jsxRuntime.jsx($,{title:y.bookingPausedTitle})}),jsxRuntime.jsx(_,{label:y.keepExistingCta,kind:"secondary",disabled:b,onPress:()=>n?.(),testID:"televet-reschedule-keep"})]}):jsxRuntime.jsx("div",{role:"progressbar","aria-label":y.loading.consult,"aria-busy":"true",style:{...a.list,...l},"data-testid":"televet-reschedule-loading",children:[0,1].map(h=>jsxRuntime.jsx(ve,{height:48},h))}):jsxRuntime.jsx("div",{style:{...a.stepFill,...l},"data-testid":"televet-reschedule-copy-unapproved"})}o($o,"EverfurTelevetReschedule");function Go(e){let t=e.visitRef?.trim()??"";return t.length>0?Object.freeze({name:"visit",visitRef:t,intent:e.intent??null}):Yo}o(Go,"televetScreenForRequest");var Yo=Object.freeze({name:"home"}),Sp=Object.freeze({name:"visits"}),Ep=Object.freeze({name:"booking"});function Cp(e,t){switch(t.type){case "push":return Object.freeze({stack:Object.freeze([...e.stack,t.screen])});case "pop":return e.stack.length<=1?e:Object.freeze({stack:Object.freeze(e.stack.slice(0,-1))});case "land":return e.stack[0]?.name!=="home"?e:Object.freeze({stack:Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}o(Cp,"navReducer");function bs(e){let{style:t,renderPending:r,className:n,...i}=yt(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);return jsxRuntime.jsx(El,{capability:"televet",style:t,...n!==void 0?{className:n}:{},...r?{renderPending:r}:{},children:jsxRuntime.jsx(kp,{...i,...t!==void 0?{style:t}:{}})})}o(bs,"EverfurTelevetFlow");function kp({petRef:e,usState:t,controller:r,onBooked:n,onExit:i,onAddPet:l,onPickMedia:s,onAddToCalendar:a,onConfirmDiscard:d,onRequestLocation:u,locationStatus:p,primaryVet:f,onFindEmergencyVet:m,onTriageReason:c,historyMode:v="memory",canJoinInApp:b=false,renderUnavailable:h,initialScreen:S,headingLevel:E,style:k}){let L=N(),[x,A]=react.useReducer(Cp,S??Yo,V=>Object.freeze({stack:Object.freeze([V])})),z=x.stack[x.stack.length-1]??Yo,H=x.stack.length,X=react.useRef(H),D=H<X.current;react.useEffect(()=>{X.current=H;},[H]);let[G,q]=react.useState(0),ee=react.useCallback(()=>q(V=>V+1),[]),ye=react.useRef(0),he=react.useRef(H);he.current=H,react.useEffect(()=>{if(v!=="browser"||typeof window>"u")return;let V=o(ze=>{let pt=ze.state?.efTelevet;typeof pt=="number"&&pt<he.current&&(ye.current=Math.max(0,ye.current-1),A({type:"pop"}));},"onPopState");return window.addEventListener("popstate",V),()=>window.removeEventListener("popstate",V)},[v]);let Le=react.useCallback(V=>{v==="browser"&&typeof window<"u"&&(ye.current+=1,window.history.pushState({efTelevet:he.current+1},"")),A({type:"push",screen:V});},[v]),O=react.useCallback(()=>{if(v==="browser"&&typeof window<"u"&&ye.current>0){ye.current-=1,window.history.go(-1);return}A({type:"pop"});},[v]),Ge=react.useCallback(()=>h?h():jsxRuntime.jsx("div",{style:L.list,"data-testid":"televet-unavailable",children:Ne()?jsxRuntime.jsx($,{title:y.bookingPausedTitle}):null}),[h,L.list]),Je=react.useCallback(()=>{H>1?O():i?.();},[H,O,i]),Xe=react.useCallback(V=>A({type:"land",screen:V==="visits"?Sp:Ep}),[]),Y=jsxRuntime.jsx(Do,{...e!==void 0?{petRef:e}:{},...t!==void 0?{usState:t}:{},...r?{controller:r}:{},onBooked:V=>{ee(),n?.(V);},onExit:Je,...l?{onAddPet:l}:{},...s?{onPickMedia:s}:{},...a?{onAddToCalendar:a}:{},...d?{onConfirmDiscard:d}:{},...u?{onRequestLocation:u}:{},...p?{locationStatus:p}:{},...f?{primaryVet:f}:{},...m?{onFindEmergencyVet:m}:{},...c?{onTriageReason:c}:{},canJoinInApp:b,renderUnavailable:Ge,...E!==void 0?{headingLevel:E}:{},...k?{style:k}:{}}),xe=jsxRuntime.jsx(Wo,{...r?{controller:r}:{},revision:G,isRoot:H<=1,returnedTo:D,onJoin:(V,ze)=>Le({name:"call",consultId:V.consultId,clinicianName:V.clinicianName,petName:ze}),onReschedule:V=>Le({name:"reschedule",consult:V}),onBook:()=>Le({name:"booking"}),onBack:Je,...k?{style:k}:{}});switch(z.name){case "home":return jsxRuntime.jsx(xp,{controller:r,onLand:Xe,style:k});case "booking":return Y;case "visits":case "visit":return xe;case "reschedule":return jsxRuntime.jsx($o,{consult:z.consult,...r?{controller:r}:{},onRescheduled:()=>{ee(),O();},onCancel:()=>O(),...k?{style:k}:{}});case "call":return jsxRuntime.jsx(jo,{consultId:z.consultId,...r?{controller:r}:{},...z.clinicianName!==void 0?{clinicianName:z.clinicianName}:{},...z.petName!==void 0?{petName:z.petName}:{},onLeave:()=>{ee(),Je();},...k?{style:k}:{}});default:return dr(z)}}o(kp,"TelevetFlowBody");function xp({controller:e,onLand:t,style:r}){let n=N(),i=Se(e),l=ol(i);return react.useEffect(()=>{l!=="pending"&&t(l);},[l,t]),jsxRuntime.jsxs("div",{role:"progressbar","aria-label":I.loading,"aria-busy":"true",style:{...n.screen,...n.list,...r},"data-testid":"televet-landing-loading",children:[jsxRuntime.jsx(ve,{height:72}),jsxRuntime.jsx(ve,{height:72})]})}o(xp,"TelevetLandingScreen");var Jo=bs;var Pp=Object.freeze({escapeAtKeyDown:true});function wp({request:e,onClose:t,onAddToCalendar:r}){let n=w(),i=react.useMemo(()=>Ip(n),[n]),l=react.useMemo(()=>Ba(),[]),s=react.useCallback(()=>{l.dispatch()||t();},[l,t]),{dialogRef:a,onKeyDown:d,onCancel:u}=zr(true,s,void 0,Pp),p=react.useMemo(()=>Go(e),[e]);return jsxRuntime.jsx("dialog",{ref:a,onKeyDown:d,onCancel:u,"aria-label":y.visit.title,"data-testid":"everfur-televet-dialog",style:i,children:jsxRuntime.jsx(To.Provider,{value:l,children:jsxRuntime.jsx(Jo,{...e.petRef!==void 0?{petRef:e.petRef}:{},...e.usState!==void 0?{usState:e.usState}:{},initialScreen:p,onExit:t,...r?{onAddToCalendar:r}:{},canJoinInApp:$r(),historyMode:"memory"})})})}o(wp,"EverfurTelevetDialog");function Ip(e){let{color:t,radius:r,space:n}=e;return {position:"fixed",inset:0,boxSizing:"border-box",width:"100%",maxWidth:640,height:"100%",maxHeight:"100%",margin:"0 auto",padding:`${String(n.lg)}px 0`,border:0,borderRadius:r.lg,display:"flex",flexDirection:"column",overflowY:"auto",backgroundColor:t.surface,color:t.text.primary}}o(Ip,"dialogStyle");exports.BACK_LABEL=_c;exports.CANCELLATION_POLICY_VERSION_MAX=hr;exports.CANCEL_REASON_MAX=Ke;exports.CONSULT_KINDS=Fi;exports.CONSULT_MINUTES=it;exports.CONSULT_STATUSES=Di;exports.EverfurTelevet=Jo;exports.EverfurTelevetBooking=Do;exports.EverfurTelevetDialog=wp;exports.EverfurTelevetFlow=bs;exports.EverfurTelevetReschedule=$o;exports.MEDIA_REFS_MAX=Tr;exports.NO_MEDIA_SHORTFALL=Yt;exports.REASON_TEXT_MAX=$e;exports.TELEVET_BOOKING_BASE=qe;exports.TELEVET_BOOKING_COPY=le;exports.TELEVET_BOOKING_COPY_WEB=y;exports.TELEVET_BOOKING_STEPS=$t;exports.TELEVET_CONSULT_PAGE_LIMIT=Gi;exports.TELEVET_EMERGENCY_EXITS_WEB=mt;exports.TELEVET_JOIN_CLOSES_MINUTES_AFTER=An;exports.TELEVET_JOIN_OPENS_MINUTES_BEFORE=On;exports.TERMINAL_CONSULT_STATUSES=vr;exports.TelevetBookedScreen=ho;exports.TelevetBookingChrome=xo;exports.TelevetCancelVisitForm=Ho;exports.TelevetClinicianEmptyState=_a;exports.TelevetConsentCheckbox=tr;exports.TelevetDayStrip=Po;exports.TelevetEarlyEmergency=Ra;exports.TelevetEmergencyExits=Xt;exports.TelevetEntitlementInterestState=pc;exports.TelevetIntakeMedia=Ro;exports.TelevetJoinScreen=jo;exports.TelevetMediaDropNotice=Qt;exports.TelevetSlotPicker=er;exports.TelevetStateInterestAction=mo;exports.TelevetSummaryCard=Oo;exports.TelevetSummaryRow=ut;exports.TelevetVisitsScreen=Wo;exports.attestation=eo;exports.canConfirm=Kt;exports.canManageTelevetVisit=Nn;exports.createTelevetBookingController=Sn;exports.currentStep=Qn;exports.emptyTelevetDraft=Jl;exports.formatVisitRange=Du;exports.formatWhen=ra;exports.formatWhenWithDay=Ee;exports.hasPreviousStep=Jn;exports.initialTelevetBookingState=Gn;exports.isHoldExpired=Nr;exports.isMediaShortfallEmpty=no;exports.isSkipped=Br;exports.isTelevetBookingCopyReady=Ne;exports.isWellFormedStateCode=_e;exports.mediaShortfallFromUnsentPicks=Dr;exports.parseVetCallCredential=fn;exports.splitTelevetVisits=Vt;exports.televetBookingKey=Zn;exports.televetBookingReducer=Xn;exports.televetBookingRefusal=Ue;exports.televetCancelCall=Yi;exports.televetConsultCalendarKey=Aa;exports.televetConsultCall=Er;exports.televetDaysFromSlots=Ur;exports.televetEmptyRosterCause=ro;exports.televetEmptyRosterView=to;exports.televetHoldCall=$i;exports.televetJoinCall=qi;exports.televetJoinDecision=Ln;exports.televetJoinOpensAtMs=Bn;exports.televetMediaShortfallLines=oo;exports.televetRescheduleCall=Ki;exports.televetScreenForRequest=Go;exports.useEarlyTriage=co;exports.useStateInterest=po;exports.useTelevetBookConsult=wn;exports.useTelevetBookingAvailable=Wd;exports.useTelevetBookingController=Se;exports.useTelevetBookingEntitlement=xn;exports.useTelevetCancellationPolicy=Mt;exports.useTelevetClinicians=Rn;exports.useTelevetHoldSlot=zt;exports.useTelevetJoin=Mo;exports.useTelevetNextSlot=_n;exports.useTelevetRescheduleConsult=In;exports.useTelevetSlots=jt;exports.useTelevetStatePolicy=kn;exports.validateBookingBody=Ji;exports.vetCallJoinReason=yn;exports.vetCallJoinRefusal=mn;exports.withUnsentPicks=ju;