@everfur/sdk 1.5.0 → 1.5.2

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 (87) hide show
  1. package/dist/{bookingCopy.d-BuDv16WP.d.ts → bookingCopy.d-BL2-URcv.d.ts} +3 -2
  2. package/dist/{bookingCopy.d-rnBSqOSN.d.cts → bookingCopy.d-Dfew1pjY.d.cts} +3 -2
  3. package/dist/care/index.cjs +2 -2
  4. package/dist/care/index.js +2 -2
  5. package/dist/chat/index.cjs +235 -234
  6. package/dist/chat/index.js +311 -310
  7. package/dist/chat/lite/index.cjs +339 -338
  8. package/dist/chat/lite/index.js +314 -313
  9. package/dist/{chunk-4KFFE42Z.js → chunk-2T5CB5MW.js} +20 -20
  10. package/dist/{chunk-HHCGXQJR.js → chunk-ASE36WGP.js} +11 -11
  11. package/dist/{chunk-6IHY7HS7.js → chunk-CMDCBYUH.js} +1 -1
  12. package/dist/{chunk-BMYNDBUR.js → chunk-K7YHXFPQ.js} +1 -1
  13. package/dist/client/index.cjs +1 -1
  14. package/dist/client/index.d.cts +2 -2
  15. package/dist/client/index.d.ts +2 -2
  16. package/dist/client/index.js +1 -1
  17. package/dist/core/index.cjs +31 -31
  18. package/dist/core/index.js +31 -31
  19. package/dist/health-plan/index.cjs +266 -266
  20. package/dist/health-plan/index.js +443 -443
  21. package/dist/{inbox.d-DJ9xgU1Z.d.ts → inbox.d-B2JXK0uI.d.ts} +1 -1
  22. package/dist/{inbox.d-CPcMMz-Y.d.cts → inbox.d-CwA1ogzV.d.cts} +1 -1
  23. package/dist/index.cjs +257 -256
  24. package/dist/index.js +364 -363
  25. package/dist/{models.d-BULqCO2R.d.ts → models.d-NAWqF1wC.d.ts} +4 -1
  26. package/dist/{models.d-BKmOfoqV.d.cts → models.d-wJ_Ze4p5.d.cts} +4 -1
  27. package/dist/notifications/inbox/index.cjs +28 -28
  28. package/dist/notifications/inbox/index.d.cts +5 -5
  29. package/dist/notifications/inbox/index.d.ts +5 -5
  30. package/dist/notifications/inbox/index.js +53 -53
  31. package/dist/notifications/index.cjs +1 -1
  32. package/dist/notifications/index.d.cts +3 -3
  33. package/dist/notifications/index.d.ts +3 -3
  34. package/dist/notifications/index.js +1 -1
  35. package/dist/{parse.d-Cj3fURer.d.ts → parse.d-QjB2LJCd.d.ts} +19 -10
  36. package/dist/{parse.d-cH7ZmMeo.d.cts → parse.d-_Ttu2h5g.d.cts} +19 -10
  37. package/dist/records/depth/index.cjs +80 -80
  38. package/dist/records/depth/index.js +115 -115
  39. package/dist/records/index.cjs +653 -653
  40. package/dist/records/index.js +1074 -1074
  41. package/dist/{route.d-DSYEd2MR.d.ts → route.d-DtuKY5dM.d.ts} +1 -1
  42. package/dist/{route.d-DCzQh4ix.d.cts → route.d-Nt-r-7IO.d.cts} +1 -1
  43. package/dist/server/events/index.cjs +1 -1
  44. package/dist/server/events/index.js +1 -1
  45. package/dist/server/index.cjs +1 -1
  46. package/dist/server/index.js +1 -1
  47. package/dist/shop/index.cjs +188 -188
  48. package/dist/shop/index.js +386 -386
  49. package/dist/shop/orders-v2/index.cjs +72 -72
  50. package/dist/shop/orders-v2/index.js +126 -126
  51. package/dist/tabs/index.cjs +114 -111
  52. package/dist/tabs/index.d.cts +19 -6
  53. package/dist/tabs/index.d.ts +19 -6
  54. package/dist/tabs/index.js +191 -188
  55. package/dist/televet/booking/index.cjs +214 -212
  56. package/dist/televet/booking/index.d.cts +2 -2
  57. package/dist/televet/booking/index.d.ts +2 -2
  58. package/dist/televet/booking/index.js +344 -342
  59. package/dist/televet/call/index.cjs +53 -53
  60. package/dist/televet/call/index.js +67 -67
  61. package/dist/{useInboxUnread.d-CXiaR3BZ.d.ts → useInboxUnread.d-0DrQPn7J.d.ts} +1 -1
  62. package/dist/{useInboxUnread.d-DERpMelw.d.cts → useInboxUnread.d-CRcOTkmu.d.cts} +1 -1
  63. package/dist/web/health-plan/index.cjs +1 -1
  64. package/dist/web/health-plan/index.js +1 -1
  65. package/dist/web/inbox/index.cjs +1 -1
  66. package/dist/web/inbox/index.d.cts +6 -6
  67. package/dist/web/inbox/index.d.ts +6 -6
  68. package/dist/web/inbox/index.js +1 -1
  69. package/dist/web/index.cjs +184 -184
  70. package/dist/web/index.js +181 -181
  71. package/dist/web/notifications/index.cjs +1 -1
  72. package/dist/web/notifications/index.d.cts +2 -2
  73. package/dist/web/notifications/index.d.ts +2 -2
  74. package/dist/web/notifications/index.js +1 -1
  75. package/dist/web/records-sheet/index.cjs +1 -1
  76. package/dist/web/records-sheet/index.js +1 -1
  77. package/dist/web/shop/index.cjs +1 -1
  78. package/dist/web/shop/index.js +2 -2
  79. package/dist/web/televet/booking/index.cjs +7 -8
  80. package/dist/web/televet/booking/index.d.cts +2 -2
  81. package/dist/web/televet/booking/index.d.ts +2 -2
  82. package/dist/web/televet/booking/index.js +7 -8
  83. package/dist/web/televet/call/index.cjs +1 -1
  84. package/dist/web/televet/call/index.js +1 -1
  85. package/dist/web/ui/index.cjs +1 -1
  86. package/dist/web/ui/index.js +33 -33
  87. package/package.json +1 -1
@@ -1,238 +1,240 @@
1
1
  /*! @everfur/sdk. Copyright (c) 2026 Strand Health Inc. dba Everfur. All rights reserved. Use is subject to the Everfur SDK License: https://docs.everfur.com/license */
2
- "use strict";var e=require("react"),t=require("react-native"),n=require("zod"),r=require("react/jsx-runtime"),l=require("@everfur/sdk/televet/call"),i=require("react-native-safe-area-context");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}})}t.default=e;return Object.freeze(t)}var a=/*#__PURE__*/o(l);function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
3
- return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var s=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],c=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),d=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function u(e){return d.has(e.status)}var p=["wellness","prescription"],h=60;function f(e){let t=Date.parse(e.startsAt),n=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(n))return null;let r=Math.round((n-t)/6e4);return r>0?Math.min(r,h):null}var m=64,g=2e3,y=10;function isWellFormedStateCode(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}function b(e){return typeof e=="object"&&e!==null?e:null}function v(e){return typeof e=="string"&&e.length>0?e:null}function x(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function T(e,t){return typeof e=="boolean"?e:t}function k(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function w(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}function S(e,t){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let r of e){let e=t(r);e!==null&&n.push(e)}/* @__PURE__ */
4
- return Object.freeze(n)}function j(e,t){let n=b(e);return n===null?null:/* @__PURE__ */Object.freeze({state:v(n.state)??t,wellnessAvailable:T(n.wellness_available,false),prescriptionsAvailable:T(n.prescriptions_available,false),cancellationPolicyText:x(n.cancellation_policy_text)})}function C(e){let t=b(e);if(t===null)return null;let n=x(t.summary),r=x(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function _(e){let t=b(e);if(t===null)return null;let n=v(t.clinician_id),r=v(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:x(t.credentials_text),rating:k(t.rating),ratingCount:k(t.rating_count),bio:x(t.bio),photoRef:v(t.photo_ref),licensedStates:S(t.licensed_states,e=>{let t=b(e),n=t===null?null:v(t.state);return n===null?null:/* @__PURE__ */Object.freeze({state:n,canPrescribe:T(t?.can_prescribe,false)})}),role:I(t.clinician_role)})}function I(e){let t=v(e)?.trim().toLowerCase();return t==="vet"||t==="vet_tech"?t:null}function E(e){let t=b(e);if(t===null)return null;let n=v(t.slot_id),r=v(t.starts_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,startsAt:r,endsAt:v(t.ends_at)??r})}function D(e){let t=b(e);if(t===null)return null;let n=t.is_emergency===true,r=t.fallback===true;return n||r?/* @__PURE__ */Object.freeze({isEmergency:n,fallback:r}):t.is_emergency===false&&t.fallback===false?/* @__PURE__ */Object.freeze({isEmergency:false,fallback:false}):null}function P(e){let t=b(e);if(t===null)return null;let n=v(t.slot_id),r=v(t.hold_expires_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,expiresAt:r})}function R(e){let t=b(e);if(t===null)return null;let n=v(t.consult_id),r=v(t.scheduled_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({consultId:n,petId:v(t.pet_id)??"",clinicianId:v(t.clinician_id)??"",clinicianName:x(t.display_name),reasonText:x(t.reason_text),mediaRefs:S(t.media_refs,e=>v(e)),status:w(s,t.status),kind:w(p,t.kind),scheduledAt:r,emergencyFlagged:T(t.emergency_flagged,false),hasRoom:v(t.meeting_url)!==null})}function z(e){let t=b(e);/* @__PURE__ */
5
- return Object.freeze({active:T(t?.active,false)})}var F=240;function L(e){let t=b(e);if(t===null)return null;let n=k(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:v(t.currency)??"usd",feeRecorded:T(t.fee_recorded,n>0),summary:x(t.summary)})}var A=15,O=250,V=/* @__PURE__ */new Set(["scheduled","in_progress"]);function N(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=N(e);return t===null?null:t-A*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(c.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=N(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-A*6e4?{ready:false,reason:"not_open_yet"}:t>n+O*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!V.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=N(e);return n===null||t<n-A*6e4?{joinable:false,reason:"too_early"}:t>n+O*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=N(l);(V.has(l.status)&&e!==null&&e+O*6e4>t?n:r).push(l)}return n.sort((e,t)=>(N(e)??0)-(N(t)??0)),r.sort((e,t)=>(N(t)??0)-(N(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function B(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function M(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function H(e,...t){if(typeof e=="function")try{let n=e(...t);return M(n)&&Promise.resolve(n).then(void 0,B),n}catch(e){B(e);return}}var $=/* @__PURE__ */new WeakMap;function W(e){if(typeof e!="function")return;let t=$.get(e);if(t!==void 0)return t;let n=(...t)=>{H(e,...t)};return $.set(e,n),n}function U(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=W(t))}return n??e}function q(e,...t){let n;try{n=e(...t)}catch(e){return B(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function K(){let e=[];return{register(t){return e=[...e,t],()=>{e=e.filter(e=>e!==t)}},dispatch(){for(let t of[...e].reverse())try{if(t())return!0}catch{}return false}}}var Y=e.createContext(null);function G(t,n=true){let r=e.useContext(Y),l=e.useRef(t);l.current=t,e.useEffect(()=>{if(!(r===null||!n))return r.register(()=>l.current())},[r,n])}var J="Go to the nearest emergency vet now.";var DRAFT=e=>e,Q=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function X(e){return Q.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function Z(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var ee=/* @__PURE__ */Object.freeze({stateBlockedTitle:DRAFT("Not available in this state yet"),noCliniciansTitle:DRAFT("No vets available right now"),noCliniciansBody:DRAFT("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:DRAFT("Check again"),noCliniciansRegionBody:DRAFT("Video visits have to be with a vet licensed in your state, and we don’t have one there yet."),yourVetTitle:DRAFT("Your vet"),licensedPillTemplate:DRAFT("Licensed in {state}"),reviewsLabel:DRAFT("reviews"),vetTechRoleLabel:DRAFT("Vet tech"),vetTechNoRxLine:DRAFT("Vet techs can’t prescribe medication."),rescheduleFromTemplate:DRAFT("Moving your visit on {when}"),rescheduleFailed:DRAFT("That did not move. Your original time is unchanged."),rescheduleStepLabel:DRAFT("Reschedule"),rescheduleTitleTemplate:DRAFT("Pick a new time for {pet}"),rescheduleNowLabel:DRAFT("Now"),rescheduleMoveTemplate:DRAFT("Move to {when}"),rescheduleMoving:DRAFT("Moving…"),rescheduleKeepLabel:DRAFT("Keep the visit as it is"),keepExistingCta:DRAFT("Keep my current time"),bookingPausedTitle:DRAFT("Booking is not available right now."),slotsErrorTitle:DRAFT("Could not load times"),noSlotsTitle:DRAFT("No times available"),nextOpeningTemplate:DRAFT("Next opening across our vets: {when}"),seeOtherVetsCta:DRAFT("See other vets"),retryCta:DRAFT("Try again"),holdExpired:DRAFT("That time is no longer held. Pick another."),slotTaken:DRAFT("That time was just taken. Pick another."),reasonPlaceholder:DRAFT("What is going on with your pet?"),reasonTooLong:DRAFT("That is too long. Please shorten it."),shareRecordsOff:DRAFT("Share health records with this vet"),confirmNotEntitled:DRAFT("A Pro membership is needed to book a video visit."),confirmFailed:DRAFT("That did not book. Try again."),checkAvailabilityCta:DRAFT("Check availability"),stateInterest:/* @__PURE__ */Object.freeze({cta:DRAFT("Add me to the list"),submitting:DRAFT("Adding you to the list…"),joinedTitle:DRAFT("You are on the list"),joinedBody:DRAFT("We will let you know when this changes."),failed:DRAFT("That did not save. Try again.")}),media:/* @__PURE__ */Object.freeze({droppedTemplate:DRAFT("{n} attachment did not upload."),droppedPluralTemplate:DRAFT("{n} attachments did not upload."),refusedSizeTemplate:DRAFT("{n} attachment was too large to send."),refusedSizePluralTemplate:DRAFT("{n} attachments were too large to send."),refusedTypeTemplate:DRAFT("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:DRAFT("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:DRAFT("{n} attachment could not be read."),refusedUnreadablePluralTemplate:DRAFT("{n} attachments could not be read.")}),navTitle:DRAFT("Book a visit"),petFallback:"your pet",whereTitleTemplate:DRAFT("Where will {pet} be during the visit?"),whereLeadTemplate:DRAFT("Pick where {pronoun} be for the call, not where you live. It decides what the vet can do."),wherePronounFallback:"they’ll",whereFormLabelTemplate:DRAFT("Where {pet} will be"),whereLegend:DRAFT("State"),wherePrescribeMetaTemplate:DRAFT("Video visit, and prescriptions if {pet} needs them"),whereWellnessMeta:DRAFT("Wellness visit: advice and a care plan, no prescriptions yet"),whereAnotherState:DRAFT("Another state"),whereWhichState:DRAFT("Which state?"),whereLicensedTemplate:DRAFT("{vet} is licensed in {state}, so a prescription can be part of {pet}’s plan."),whereAskEveryTime:DRAFT("We ask every time: state rules require it."),issuesTitleTemplate:DRAFT("What’s going on with {pet}?"),issuesHint:DRAFT("Pick as many as you like."),issuesFormLabel:DRAFT("What’s going on"),issuesLegend:DRAFT("Main issues"),issuesPickOne:DRAFT("Pick at least one. Not sure? Choose Something else."),otherIssue:DRAFT("Something else"),describeHeadingTemplate:DRAFT("Tell {vet} what you’re seeing"),describeFieldLabel:DRAFT("What you’re seeing"),emergencyCheck:/* @__PURE__ */Object.freeze({titleTemplate:DRAFT("Is {pet} doing any of these right now?"),lead:DRAFT("A scheduled video visit isn’t the right place for an emergency."),signs:/* @__PURE__ */Object.freeze([DRAFT("Trouble breathing, or blue, grey or very pale gums"),DRAFT("Collapsed, or can’t stand up"),DRAFT("A seizure"),DRAFT("Ate something toxic, like grapes, chocolate, xylitol or medicine"),DRAFT("A swollen, hard belly, or retching with nothing coming up"),DRAFT("Bleeding that won’t stop"),DRAFT("Straining to pee with nothing coming out")]),formLabel:DRAFT("Emergency check"),legend:DRAFT("Any of these now?"),noneCta:DRAFT("No, none of these"),someCta:DRAFT("Yes, at least one")}),timeHeading:DRAFT("Pick a time"),timeMorning:DRAFT("Morning"),timeAfternoon:DRAFT("Afternoon"),timeEvening:DRAFT("Evening"),timeLegendTemplate:DRAFT("Time on {day}"),dayLegend:DRAFT("Day"),reviewHeading:DRAFT("Does this look right?"),summaryWhere:DRAFT("Where"),changeCta:DRAFT("Change"),whereAttestTemplate:DRAFT("{pet} and I will be in {state} during the visit."),attestBoth:DRAFT("Check both boxes to book the visit."),bookedStepLabel:DRAFT("Booked"),bookedTitleTemplate:DRAFT("You’re booked with {vet}"),bookedLeadTemplate:DRAFT("{when}, for {pet}."),footnote:DRAFT("Video visits are with a licensed veterinarian. Prescriptions where allowed, starting with California. In an emergency, go to the nearest emergency animal hospital."),rescheduleNavTitle:DRAFT("Change your visit"),close:DRAFT("Close"),continueCta:DRAFT("Continue"),petSelectTitle:DRAFT("Who is this visit for?"),addPetCta:DRAFT("Add a pet"),addAnotherPetCta:DRAFT("Add another pet"),locationUnknownTitle:DRAFT("We need your location to find a vet"),locationUnknownBody:DRAFT("Turn on location for Everfur, then try again."),locationUnknownCta:DRAFT("Allow location"),locationBlockedTitle:DRAFT("Location is turned off"),locationBlockedBody:DRAFT("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:DRAFT("Open Settings"),locationUnavailableTitle:DRAFT("We could not read your location"),locationUnavailableBody:DRAFT("Try again in a moment."),stateAttestTemplate:DRAFT("I confirm my pet and I are in {state} right now."),describeHeading:DRAFT("Tell the vet what you are seeing"),describeHelpLong:DRAFT("When it started, what’s changed, what you’ve tried. Anything helps."),addPhotoCta:DRAFT("Add photos or videos"),addPhotoMeta:DRAFT("Optional. A close-up in good light helps."),removePhotoLabel:DRAFT("Remove photo"),summaryPet:DRAFT("Pet"),summaryVet:DRAFT("Vet"),summaryWhen:DRAFT("When"),summaryLength:DRAFT("Length"),summaryReason:DRAFT("About"),summaryLengthTemplate:DRAFT("{n} minutes"),confirmCta:DRAFT("Book the visit"),confirmBusy:DRAFT("Booking…"),bookedTitle:DRAFT("You are booked."),addToCalendarCta:DRAFT("Add to calendar"),doneCta:DRAFT("Done"),booked:/* @__PURE__ */Object.freeze({remindPromise:DRAFT("We will notify you 30 minutes before."),summaryPromise:DRAFT("{pet}'s summary goes to the vet ahead of the call."),recordsPromiseTemplate:DRAFT("{pet}’s records and your notes go to {vet} ahead of the call."),recordsPhotoPromiseTemplate:DRAFT("{pet}’s records, your notes and the photo go to {vet} ahead of the call."),stepsLabel:DRAFT("What happens next"),joinPromise:DRAFT("Join right here in the app. No links to hunt for."),backToPet:DRAFT("Back to {pet}"),calendarAdded:DRAFT("Added to your calendar"),calendarFailedBody:DRAFT("That did not save to your calendar.")}),chrome:/* @__PURE__ */Object.freeze({closeHint:DRAFT("Closes without saving"),discardTitle:DRAFT("Leave without booking?"),discardBody:DRAFT("Your answers will not be saved."),discardConfirmCta:DRAFT("Leave"),discardKeepCta:DRAFT("Keep going"),noPetsTitle:DRAFT("No pets on this account"),loadFailedTitle:DRAFT("Could not load"),retryCta:DRAFT("Try again")}),emergency:/* @__PURE__ */Object.freeze({bannerTitle:DRAFT("This can’t wait for a scheduled visit."),keepBookingCta:DRAFT("I’ve handled this, continue booking"),lede:DRAFT("What you’re describing is the kind of thing vets want to see in person, now. Call one of these first."),ledeWithoutExits:DRAFT("What you’re describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:DRAFT("Call {petName}’s regular vet"),exitFindErTitle:DRAFT("Find an emergency vet near you"),exitGoToErTitle:J,startCallHint:DRAFT("Starts a phone call"),poisonControl:DRAFT("ASPCA Animal Poison Control"),poisonControlDetail:DRAFT("(888) 426-4435 · a fee may apply"),poisonControlTel:"tel:+18884264435"}),visit:/* @__PURE__ */Object.freeze({title:DRAFT("Your visit")}),loading:/* @__PURE__ */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 te(e=ee){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>te(e))}function isTelevetBookingCopyReady(){return te().every(e=>e.trim().length>0&&!X(e))}var ne=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],re=/* @__PURE__ */Object.freeze(ne.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(re.map(e=>e.wireCode));var le=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),ie=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:le[e.wireCode]}))),oe=new Map(ie.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),ae=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(ie.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...ae]){let t=oe.get(e+n);if(t)return t}}var se=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return se[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var ce=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return ce.has(e)}var de=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||de.has(e)}var ue=500,pe=8e3,he=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(ue*2**n,pe);return Math.floor(t()*r)}var fe="This feature isn't available on your account right now.",me="Something in that request was not right. Check the details and try again.",ge=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:fe,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:me,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:fe,runtimeDisposed:me,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",be="linked_account_read_only";function ve(e,t,n){return e==="conflict"&&n===be?fe:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return ge[e]}function xe(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var Te=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===be,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:ve(e,t?.wireCode,r?be:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&Te.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&xe(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&xe(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
2
+ "use strict";var e=require("react"),t=require("react-native"),n=require("zod"),r=require("react/jsx-runtime"),l=require("@everfur/sdk/televet/call"),i=require("react-native-safe-area-context");function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);if(e){Object.keys(e).forEach(function(n){if(n!=="default"){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}})}t.default=e;return Object.freeze(t)}var a=/*#__PURE__*/o(t);var s=/*#__PURE__*/o(l);function assertNever(e){throw new Error(`assertNever: unhandled discriminated-union member ${JSON.stringify(e)}`)}function errorFrame(e){/* @__PURE__ */
3
+ return Object.freeze({kind:"error",terminal:true,code:e.code,retryable:e.retryable,wireMessage:e.wireMessage,synthesized:e.synthesized,lastEventId:e.lastEventId,serverRequestId:null,...e.freeCap?{freeCap:/* @__PURE__ */Object.freeze({...e.freeCap})}:{}})}var c=["scheduled","in_progress","awaiting_summary","completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"],d=/* @__PURE__ */new Set(["completed","cancelled_owner","cancelled_ops","no_show_owner","no_show_vet"]),u=/* @__PURE__ */new Set(["scheduled","in_progress","awaiting_summary"]);function p(e){return u.has(e.status)}var h=["wellness","prescription"],f=60;function m(e){let t=Date.parse(e.startsAt),n=Date.parse(e.endsAt);if(Number.isNaN(t)||Number.isNaN(n))return null;let r=Math.round((n-t)/6e4);return r>0?Math.min(r,f):null}var g=64,b=2e3,y=10;function isWellFormedStateCode(e){return typeof e=="string"&&/^[A-Za-z]{2}$/.test(e.trim())}function v(e){return typeof e=="object"&&e!==null?e:null}function x(e){return typeof e=="string"&&e.length>0?e:null}function T(e){return typeof e=="string"&&e.trim().length>0?e.trim():null}function k(e,t){return typeof e=="boolean"?e:t}function w(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function S(e,t){return typeof t=="string"&&e.includes(t)?t:"unknown"}function j(e,t){if(!Array.isArray(e))/* @__PURE__ */return Object.freeze([]);let n=[];for(let r of e){let e=t(r);e!==null&&n.push(e)}/* @__PURE__ */
4
+ return Object.freeze(n)}function C(e,t){let n=v(e);return n===null?null:/* @__PURE__ */Object.freeze({state:x(n.state)??t,wellnessAvailable:k(n.wellness_available,false),prescriptionsAvailable:k(n.prescriptions_available,false),cancellationPolicyText:T(n.cancellation_policy_text)})}function _(e){let t=v(e);if(t===null)return null;let n=T(t.summary),r=T(t.version);return n===null||r===null?null:/* @__PURE__ */Object.freeze({summary:n,version:r})}function I(e){let t=v(e);if(t===null)return null;let n=x(t.clinician_id),r=x(t.display_name);return n===null||r===null?null:/* @__PURE__ */Object.freeze({clinicianId:n,displayName:r,credentials:T(t.credentials_text),rating:w(t.rating),ratingCount:w(t.rating_count),bio:T(t.bio),photoRef:x(t.photo_ref),licensedStates:j(t.licensed_states,e=>{let t=v(e),n=t===null?null:x(t.state);return n===null?null:/* @__PURE__ */Object.freeze({state:n,canPrescribe:k(t?.can_prescribe,false)})}),role:E(t.clinician_role)})}function E(e){let t=x(e)?.trim().toLowerCase();return t==="vet"||t==="vet_tech"?t:null}function D(e){let t=v(e);if(t===null)return null;let n=x(t.slot_id),r=x(t.starts_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,startsAt:r,endsAt:x(t.ends_at)??r})}function P(e){let t=v(e);if(t===null)return null;let n=t.is_emergency===true,r=t.fallback===true;return n||r?/* @__PURE__ */Object.freeze({isEmergency:n,fallback:r}):t.is_emergency===false&&t.fallback===false?/* @__PURE__ */Object.freeze({isEmergency:false,fallback:false}):null}function R(e){let t=v(e);if(t===null)return null;let n=x(t.slot_id),r=x(t.hold_expires_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({slotId:n,expiresAt:r})}function z(e){let t=v(e);if(t===null)return null;let n=x(t.consult_id),r=x(t.scheduled_at);return n===null||r===null?null:/* @__PURE__ */Object.freeze({consultId:n,petId:x(t.pet_id)??"",clinicianId:x(t.clinician_id)??"",clinicianName:T(t.display_name),reasonText:T(t.reason_text),mediaRefs:j(t.media_refs,e=>x(e)),status:S(c,t.status),kind:S(h,t.kind),scheduledAt:r,emergencyFlagged:k(t.emergency_flagged,false),hasRoom:x(t.meeting_url)!==null})}function F(e){let t=v(e);/* @__PURE__ */
5
+ return Object.freeze({active:k(t?.active,false)})}var L=240;function A(e){let t=v(e);if(t===null)return null;let n=w(t.fee_cents);return n===null||n<0?null:/* @__PURE__ */Object.freeze({feeCents:n,currency:x(t.currency)??"usd",feeRecorded:k(t.fee_recorded,n>0),summary:T(t.summary)})}var O=15,V=250,N=/* @__PURE__ */new Set(["scheduled","in_progress"]);function B(e){let t=Date.parse(e.scheduledAt);return Number.isNaN(t)?null:t}function televetJoinOpensAtMs(e){let t=B(e);return t===null?null:t-O*6e4}function televetJoinReadiness(e,t){if(e===null)return{ready:false,reason:"not_open_yet"};if(d.has(e.status))return{ready:false,reason:"consult_over"};if(e.status==="in_progress")return{ready:true};let n=B(e);return n===null?{ready:false,reason:"not_open_yet"}:t<n-O*6e4?{ready:false,reason:"not_open_yet"}:t>n+V*6e4?{ready:false,reason:"consult_over"}:{ready:true}}function televetJoinDecision(e,t){if(!N.has(e.status))return{joinable:false,reason:`status_${e.status}`};if(!e.hasRoom)return{joinable:false,reason:"room_not_ready"};let n=B(e);return n===null||t<n-O*6e4?{joinable:false,reason:"too_early"}:t>n+V*6e4?{joinable:false,reason:"too_late"}:{joinable:true}}function splitTelevetVisits(e,t){let n=[],r=[];for(let l of e){let e=B(l);(N.has(l.status)&&e!==null&&e+V*6e4>t?n:r).push(l)}return n.sort((e,t)=>(B(e)??0)-(B(t)??0)),r.sort((e,t)=>(B(t)??0)-(B(e)??0)),/* @__PURE__ */Object.freeze({upcoming:/* @__PURE__ */Object.freeze(n),past:/* @__PURE__ */Object.freeze(r)})}function canManageTelevetVisit(e){return e==="scheduled"}function M(e){let t=globalThis.console;try{t?.error?.("[everfur] A host callback threw; the SDK ignored it.",e)}catch{}}function H(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&typeof e.then=="function"}function $(e,...t){if(typeof e=="function")try{let n=e(...t);return H(n)&&Promise.resolve(n).then(void 0,M),n}catch(e){M(e);return}}var W=/* @__PURE__ */new WeakMap;function U(e){if(typeof e!="function")return;let t=W.get(e);if(t!==void 0)return t;let n=(...t)=>{$(e,...t)};return W.set(e,n),n}function q(e,t){let n=null;for(let r of t){let t=e[r];typeof t=="function"&&(n??={...e},n[r]=U(t))}return n??e}function K(e,...t){let n;try{n=e(...t)}catch(e){return M(e),Promise.resolve({ok:false,error:e})}return Promise.resolve(n).then(e=>({ok:true,value:e}),e=>({ok:false,error:e}))}function Y(){let e=[];return{register(t){return e=[...e,t],()=>{e=e.filter(e=>e!==t)}},dispatch(){for(let t of[...e].reverse())try{if(t())return!0}catch{}return false}}}var G=e.createContext(null);function J(t,n=true){let r=e.useContext(G),l=e.useRef(t);l.current=t,e.useEffect(()=>{if(!(r===null||!n))return r.register(()=>l.current())},[r,n])}var Q="Go to the nearest emergency vet now.";var DRAFT=e=>e,X=["[PLACEHOLDER","[PLAN NAME]","[LINK]","[Last]","TODO","TBD"];function Z(e){return X.some(t=>e.toUpperCase().includes(t.toUpperCase()))}function ee(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}var te=/* @__PURE__ */Object.freeze({stateBlockedTitle:DRAFT("Not available in this state yet"),noCliniciansTitle:DRAFT("No vets available right now"),noCliniciansBody:DRAFT("Nobody is free in your area at the moment. This changes through the day."),noCliniciansRetryCta:DRAFT("Check again"),noCliniciansRegionBody:DRAFT("Video visits have to be with a vet licensed in your state, and we don’t have one there yet."),yourVetTitle:DRAFT("Your vet"),licensedPillTemplate:DRAFT("Licensed in {state}"),reviewsLabel:DRAFT("reviews"),vetTechRoleLabel:DRAFT("Vet tech"),vetTechNoRxLine:DRAFT("Vet techs can’t prescribe medication."),rescheduleFromTemplate:DRAFT("Moving your visit on {when}"),rescheduleFailed:DRAFT("That did not move. Your original time is unchanged."),rescheduleStepLabel:DRAFT("Reschedule"),rescheduleTitleTemplate:DRAFT("Pick a new time for {pet}"),rescheduleNowLabel:DRAFT("Now"),rescheduleMoveTemplate:DRAFT("Move to {when}"),rescheduleMoving:DRAFT("Moving…"),rescheduleKeepLabel:DRAFT("Keep the visit as it is"),keepExistingCta:DRAFT("Keep my current time"),bookingPausedTitle:DRAFT("Booking is not available right now."),slotsErrorTitle:DRAFT("Could not load times"),noSlotsTitle:DRAFT("No times available"),nextOpeningTemplate:DRAFT("Next opening across our vets: {when}"),seeOtherVetsCta:DRAFT("See other vets"),retryCta:DRAFT("Try again"),holdExpired:DRAFT("That time is no longer held. Pick another."),slotTaken:DRAFT("That time was just taken. Pick another."),reasonPlaceholder:DRAFT("What is going on with your pet?"),reasonTooLong:DRAFT("That is too long. Please shorten it."),shareRecordsOff:DRAFT("Share health records with this vet"),confirmNotEntitled:DRAFT("A Pro membership is needed to book a video visit."),confirmFailed:DRAFT("That did not book. Try again."),checkAvailabilityCta:DRAFT("Check availability"),stateInterest:/* @__PURE__ */Object.freeze({cta:DRAFT("Add me to the list"),submitting:DRAFT("Adding you to the list…"),joinedTitle:DRAFT("You are on the list"),joinedBody:DRAFT("We will let you know when this changes."),failed:DRAFT("That did not save. Try again.")}),media:/* @__PURE__ */Object.freeze({droppedTemplate:DRAFT("{n} attachment did not upload."),droppedPluralTemplate:DRAFT("{n} attachments did not upload."),refusedSizeTemplate:DRAFT("{n} attachment was too large to send."),refusedSizePluralTemplate:DRAFT("{n} attachments were too large to send."),refusedTypeTemplate:DRAFT("{n} attachment is a file type that cannot be sent."),refusedTypePluralTemplate:DRAFT("{n} attachments are file types that cannot be sent."),refusedUnreadableTemplate:DRAFT("{n} attachment could not be read."),refusedUnreadablePluralTemplate:DRAFT("{n} attachments could not be read.")}),navTitle:DRAFT("Book a visit"),petFallback:"your pet",whereTitleTemplate:DRAFT("Where will {pet} be during the visit?"),whereLeadTemplate:DRAFT("Pick where {pronoun} be for the call, not where you live. It decides what the vet can do."),wherePronounFallback:"they’ll",whereFormLabelTemplate:DRAFT("Where {pet} will be"),whereLegend:DRAFT("State"),wherePrescribeMetaTemplate:DRAFT("Video visit, and prescriptions if {pet} needs them"),whereWellnessMeta:DRAFT("Wellness visit: advice and a care plan, no prescriptions yet"),whereAnotherState:DRAFT("Another state"),whereWhichState:DRAFT("Which state?"),whereLicensedTemplate:DRAFT("{vet} is licensed in {state}, so a prescription can be part of {pet}’s plan."),whereAskEveryTime:DRAFT("We ask every time: state rules require it."),issuesTitleTemplate:DRAFT("What’s going on with {pet}?"),issuesHint:DRAFT("Pick as many as you like."),issuesFormLabel:DRAFT("What’s going on"),issuesLegend:DRAFT("Main issues"),issuesPickOne:DRAFT("Pick at least one. Not sure? Choose Something else."),otherIssue:DRAFT("Something else"),describeHeadingTemplate:DRAFT("Tell {vet} what you’re seeing"),describeFieldLabel:DRAFT("What you’re seeing"),emergencyCheck:/* @__PURE__ */Object.freeze({titleTemplate:DRAFT("Is {pet} doing any of these right now?"),lead:DRAFT("A scheduled video visit isn’t the right place for an emergency."),signs:/* @__PURE__ */Object.freeze([DRAFT("Trouble breathing, or blue, grey or very pale gums"),DRAFT("Collapsed, or can’t stand up"),DRAFT("A seizure"),DRAFT("Ate something toxic, like grapes, chocolate, xylitol or medicine"),DRAFT("A swollen, hard belly, or retching with nothing coming up"),DRAFT("Bleeding that won’t stop"),DRAFT("Straining to pee with nothing coming out")]),formLabel:DRAFT("Emergency check"),legend:DRAFT("Any of these now?"),noneCta:DRAFT("No, none of these"),someCta:DRAFT("Yes, at least one")}),timeHeading:DRAFT("Pick a time"),timeMorning:DRAFT("Morning"),timeAfternoon:DRAFT("Afternoon"),timeEvening:DRAFT("Evening"),timeLegendTemplate:DRAFT("Time on {day}"),dayLegend:DRAFT("Day"),reviewHeading:DRAFT("Does this look right?"),summaryWhere:DRAFT("Where"),changeCta:DRAFT("Change"),whereAttestTemplate:DRAFT("{pet} and I will be in {state} during the visit."),attestBoth:DRAFT("Check both boxes to book the visit."),bookedStepLabel:DRAFT("Booked"),bookedTitleTemplate:DRAFT("You’re booked with {vet}"),bookedLeadTemplate:DRAFT("{when}, for {pet}."),footnote:DRAFT("Video visits are with a licensed veterinarian. Prescriptions where allowed, starting with California. In an emergency, go to the nearest emergency animal hospital."),rescheduleNavTitle:DRAFT("Change your visit"),close:DRAFT("Close"),continueCta:DRAFT("Continue"),petSelectTitle:DRAFT("Who is this visit for?"),addPetCta:DRAFT("Add a pet"),addAnotherPetCta:DRAFT("Add another pet"),locationUnknownTitle:DRAFT("We need your location to find a vet"),locationUnknownBody:DRAFT("Turn on location for Everfur, then try again."),locationUnknownCta:DRAFT("Allow location"),locationBlockedTitle:DRAFT("Location is turned off"),locationBlockedBody:DRAFT("Everfur needs your location to match you with a vet in your area."),locationBlockedCta:DRAFT("Open Settings"),locationUnavailableTitle:DRAFT("We could not read your location"),locationUnavailableBody:DRAFT("Try again in a moment."),stateAttestTemplate:DRAFT("I confirm my pet and I are in {state} right now."),describeHeading:DRAFT("Tell the vet what you are seeing"),describeHelpLong:DRAFT("When it started, what’s changed, what you’ve tried. Anything helps."),addPhotoCta:DRAFT("Add photos or videos"),addPhotoMeta:DRAFT("Optional. A close-up in good light helps."),removePhotoLabel:DRAFT("Remove photo"),summaryPet:DRAFT("Pet"),summaryVet:DRAFT("Vet"),summaryWhen:DRAFT("When"),summaryLength:DRAFT("Length"),summaryReason:DRAFT("About"),summaryLengthTemplate:DRAFT("{n} minutes"),confirmCta:DRAFT("Book the visit"),confirmBusy:DRAFT("Booking…"),bookedTitle:DRAFT("You are booked."),addToCalendarCta:DRAFT("Add to calendar"),doneCta:DRAFT("Done"),booked:/* @__PURE__ */Object.freeze({remindPromise:DRAFT("We will notify you 30 minutes before."),summaryPromise:DRAFT("{pet}'s summary goes to the vet ahead of the call."),recordsPromiseTemplate:DRAFT("{pet}’s records and your notes go to {vet} ahead of the call."),recordsPhotoPromiseTemplate:DRAFT("{pet}’s records, your notes and the photo go to {vet} ahead of the call."),stepsLabel:DRAFT("What happens next"),joinPromise:DRAFT("Join right here in the app. No links to hunt for."),backToPet:DRAFT("Back to {pet}"),calendarAdded:DRAFT("Added to your calendar"),calendarFailedBody:DRAFT("That did not save to your calendar.")}),chrome:/* @__PURE__ */Object.freeze({closeHint:DRAFT("Closes without saving"),discardTitle:DRAFT("Leave without booking?"),discardBody:DRAFT("Your answers will not be saved."),discardConfirmCta:DRAFT("Leave"),discardKeepCta:DRAFT("Keep going"),noPetsTitle:DRAFT("No pets on this account"),loadFailedTitle:DRAFT("Could not load"),retryCta:DRAFT("Try again")}),emergency:/* @__PURE__ */Object.freeze({bannerTitle:DRAFT("This can’t wait for a scheduled visit."),keepBookingCta:DRAFT("I’ve handled this, continue booking"),lede:DRAFT("What you’re describing is the kind of thing vets want to see in person, now. Call one of these first."),ledeWithoutExits:DRAFT("What you’re describing is the kind of thing vets want to see in person, now."),exitPrimaryVetTitle:DRAFT("Call {petName}’s regular vet"),exitFindErTitle:DRAFT("Find an emergency vet near you"),exitGoToErTitle:Q,startCallHint:DRAFT("Starts a phone call"),poisonControl:DRAFT("ASPCA Animal Poison Control"),poisonControlDetail:DRAFT("(888) 426-4435 · a fee may apply"),poisonControlTel:"tel:+18884264435"}),visit:/* @__PURE__ */Object.freeze({title:DRAFT("Your visit")}),loading:/* @__PURE__ */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 ne(e=te){return typeof e=="string"?[e]:typeof e!="object"||e===null?[]:Object.values(e).flatMap(e=>ne(e))}function isTelevetBookingCopyReady(){return ne().every(e=>e.trim().length>0&&!Z(e))}var re=[{wireCode:"AccessDeniedException",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"AuthorizationException",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"ConflictException",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"DAILY_QUOTA_EXCEEDED",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"FILE_TOO_LARGE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"IDEMPOTENCY_KEY_IN_FLIGHT",envelope:"http_envelope",httpStatus:409,retryable:true},{wireCode:"IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"INVALID_CONTENT_TYPE",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"InternalFailureException",envelope:"http_envelope",httpStatus:500,retryable:true},{wireCode:"MethodNotAllowedException",envelope:"http_envelope",httpStatus:405,retryable:false},{wireCode:"NotImplementedException",envelope:"http_envelope",httpStatus:501,retryable:false},{wireCode:"PaymentRequiredException",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ResourceNotFoundException",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"ServiceUnavailableException",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"TIER_UPGRADE_REQUIRED",envelope:"http_envelope",httpStatus:402,retryable:false},{wireCode:"ThrottlingException",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"ValidationException",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"accessDenied",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"access_denied",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"anchor_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"anchor_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"anonTokenInvalid",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"attachment_unreadable",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"authExpired",envelope:"http_envelope",httpStatus:401,retryable:true},{wireCode:"authRejected",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"before_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundle_not_uploaded",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"bundles_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"catalog_empty_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"catalog_shrink_refused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"consent_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_required",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"consent_scope_wrong_route",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"device_cipher_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"email_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"endpoint_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"environment_mismatch",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_cursor_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"event_payload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_not_available",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"event_type_unknown",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_required",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"idempotency_key_reused",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"inbox_cursor_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"insufficientCapability",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"insufficient_scope",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"internal_error",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"invalidRequest",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"invalid_client",envelope:"oauth_error",httpStatus:401,retryable:false},{wireCode:"invalid_client_metadata",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_grant",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_redirect_uri",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_request",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_scope",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"invalid_target",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"item_id_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"linked_account_read_only",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_connection_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"mcp_request_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"mcp_request_gone",envelope:"http_envelope",httpStatus:410,retryable:false},{wireCode:"mcp_request_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"not_found",envelope:"sse_frame",httpStatus:200,retryable:false},{wireCode:"not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"open_url_not_allowed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"partner_visit_link_conflict",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"partner_visit_owner_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"partner_visit_pet_already_mapped",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"payload_too_large",envelope:"http_envelope",httpStatus:413,retryable:false},{wireCode:"petRefInUse",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"pet_health_list_removals_unconfirmed",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_health_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"pet_not_registered",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"provider_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"rateLimited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"read_target_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"record_subject_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"record_upload_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"records_consent_required",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"restricted_key",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"sandbox_only",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_required",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"session_revoked",envelope:"http_envelope",httpStatus:401,retryable:false},{wireCode:"share_limit_reached",envelope:"http_envelope",httpStatus:429,retryable:false},{wireCode:"slow_down",envelope:"oauth_error",httpStatus:429,retryable:true},{wireCode:"species_unsupported",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"subscription_keys_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"tenant_filter_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"tenant_has_no_capabilities",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tenant_resource_not_found",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"tenant_surface_not_enabled",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"ticket_not_resolved",envelope:"http_envelope",httpStatus:409,retryable:false},{wireCode:"tickets_disabled",envelope:"http_envelope",httpStatus:404,retryable:false},{wireCode:"timeout",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"timezone_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"token_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"unavailable",envelope:"sse_frame",httpStatus:200,retryable:true},{wireCode:"unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"unrestrictedKeyRequired",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"unsupported_grant_type",envelope:"oauth_error",httpStatus:400,retryable:false},{wireCode:"unsupported_response_type",envelope:"oauth_error",httpStatus:302,retryable:false},{wireCode:"user_ref_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"verify_mint_rate_limited",envelope:"http_envelope",httpStatus:429,retryable:true},{wireCode:"verify_mint_refused",envelope:"http_envelope",httpStatus:403,retryable:false},{wireCode:"verify_mint_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"verify_user_ref_invalid",envelope:"http_envelope",httpStatus:422,retryable:false},{wireCode:"web_push_unavailable",envelope:"http_envelope",httpStatus:503,retryable:true},{wireCode:"webhook_endpoint_update_empty",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_endpoint_update_invalid",envelope:"http_envelope",httpStatus:400,retryable:false},{wireCode:"webhook_url_rejected",envelope:"http_envelope",httpStatus:400,retryable:false}],le=/* @__PURE__ */Object.freeze(re.map(e=>/* @__PURE__ */Object.freeze(e)));/* @__PURE__ */Object.freeze(le.map(e=>e.wireCode));var ie=/* @__PURE__ */Object.freeze({ValidationException:"validationFailed",AuthorizationException:"authRejected",PaymentRequiredException:"paymentRequired",AccessDeniedException:"accessDenied",ResourceNotFoundException:"resourceNotFound",ConflictException:"conflict",ThrottlingException:"rateLimited",InternalFailureException:"internalError",NotImplementedException:"notImplemented",ServiceUnavailableException:"serviceUnavailable",MethodNotAllowedException:"validationFailed",authExpired:"authExpired",unavailable:"serviceUnavailable",session_required:"sessionRequired",session_revoked:"authExpired",anonTokenInvalid:"authRejected",accessDenied:"accessDenied",invalidRequest:"sdkUpdateRequired",authRejected:"authRejected",rateLimited:"rateLimited",insufficientCapability:"accessDenied",unrestrictedKeyRequired:"accessDenied",user_ref_invalid:"validationFailed",event_cursor_invalid:"validationFailed",event_filter_invalid:"validationFailed",event_payload_invalid:"validationFailed",event_type_unknown:"validationFailed",idempotency_key_invalid:"validationFailed",idempotency_key_required:"validationFailed",idempotency_key_reused:"idempotencyConflict",payload_too_large:"validationFailed",webhook_url_rejected:"validationFailed",webhook_endpoint_update_empty:"validationFailed",webhook_endpoint_update_invalid:"validationFailed",event_type_not_available:"conflict",record_subject_not_found:"resourceNotFound",records_consent_required:"conflict",record_species_unsupported:"validationFailed",record_upload_invalid:"validationFailed",FILE_TOO_LARGE:"validationFailed",INVALID_CONTENT_TYPE:"validationFailed",attachment_unreadable:"validationFailed",provider_unsupported:"validationFailed",token_invalid:"validationFailed",device_cipher_unavailable:"serviceUnavailable",email_invalid:"validationFailed",consent_required:"validationFailed",consent_invalid:"validationFailed",consent_scope_wrong_route:"validationFailed",IDEMPOTENCY_KEY_IN_FLIGHT:"idempotencyInFlight",IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST:"idempotencyConflict",DAILY_QUOTA_EXCEEDED:"quotaExceeded",TIER_UPGRADE_REQUIRED:"paymentRequired",not_found:"conversationNotFound",timeout:"streamTimeout",internal_error:"internalError",invalid_request:"validationFailed",invalid_client:"authRejected",invalid_grant:"authRejected",unsupported_grant_type:"validationFailed",invalid_scope:"validationFailed",invalid_target:"validationFailed",invalid_redirect_uri:"validationFailed",invalid_client_metadata:"validationFailed",unsupported_response_type:"validationFailed",access_denied:"accessDenied",slow_down:"rateLimited",mcp_request_not_found:"resourceNotFound",mcp_request_gone:"resourceNotFound",mcp_connection_not_found:"resourceNotFound",mcp_request_conflict:"conflict",sandbox_only:"accessDenied",tenant_has_no_capabilities:"conflict",verify_mint_refused:"accessDenied",verify_mint_rate_limited:"rateLimited",verify_mint_unavailable:"serviceUnavailable",verify_user_ref_invalid:"validationFailed",insufficient_scope:"accessDenied",tenant_filter_invalid:"validationFailed",tenant_resource_not_found:"resourceNotFound",tenant_surface_not_enabled:"conflict",pet_health_species_unsupported:"validationFailed",pet_health_list_removals_unconfirmed:"validationFailed",petRefInUse:"conflict",share_limit_reached:"conflict",pet_not_registered:"resourceNotFound",species_unsupported:"validationFailed",partner_visit_owner_only:"accessDenied",partner_visit_link_conflict:"conflict",partner_visit_pet_already_mapped:"conflict",linked_account_read_only:"conflict",catalog_empty_refused:"conflict",catalog_shrink_refused:"conflict",endpoint_not_allowed:"validationFailed",event_id_invalid:"validationFailed",inbox_cursor_invalid:"validationFailed",item_id_invalid:"validationFailed",open_url_not_allowed:"validationFailed",read_target_invalid:"validationFailed",subscription_keys_invalid:"validationFailed",web_push_unavailable:"serviceUnavailable",anchor_not_found:"resourceNotFound",anchor_ref_invalid:"validationFailed",before_invalid:"validationFailed",bundle_mismatch:"validationFailed",bundle_not_uploaded:"validationFailed",bundles_unavailable:"serviceUnavailable",environment_mismatch:"validationFailed",restricted_key:"accessDenied",ticket_not_resolved:"conflict",tickets_disabled:"resourceNotFound",timezone_invalid:"validationFailed"}),oe=/* @__PURE__ */Object.freeze(le.map(e=>/* @__PURE__ */Object.freeze({wireCode:e.wireCode,envelope:e.envelope,retryable:e.retryable,normalized:ie[e.wireCode]}))),ae=new Map(oe.map(e=>[e.envelope+e.wireCode.toUpperCase(),e])),se=/* @__PURE__ */Object.freeze(["http_envelope",...[...new Set(oe.map(e=>e.envelope))].filter(e=>e!=="http_envelope").sort()]);function contractErrorFor(e,t){if(typeof e!="string")return;let n=e.trim().toUpperCase();if(n.length!==0)for(let e of[t??"http_envelope",...se]){let t=ae.get(e+n);if(t)return t}}var ce=/* @__PURE__ */Object.freeze({authExpired:"authentication",authRejected:"authentication",sessionRequired:"authentication",identitySignatureRequired:"authentication",accessDenied:"authorization",paymentRequired:"entitlement",quotaExceeded:"rateLimit",rateLimited:"rateLimit",validationFailed:"invalidRequest",sdkUpdateRequired:"invalidRequest",runtimeDisposed:"invalidRequest",conversationNotFound:"notFound",petNotFound:"notFound",resourceNotFound:"notFound",conflict:"conflict",idempotencyConflict:"conflict",idempotencyInFlight:"conflict",streamTimeout:"connection",streamIncomplete:"connection",upstreamLlmTimeout:"connection",serviceUnavailable:"connection",internalError:"server",notImplemented:"server",mediaUploadFailed:"media",moderationBlocked:"policy",unknown:"unknown"});function categoryFor(e){return ce[e]}function fromWire(e){let t=contractErrorFor(e);if(t)return t.normalized;let n=(e??"").trim().toUpperCase(),r=n.replace(/[^A-Z0-9]/g,"");if(r==="AUTHREJECTED")return"authRejected";if(n.startsWith("AUTH"))return"authExpired";switch(r){case"DAILYQUOTAEXCEEDED":case"QUOTAEXCEEDED":return"quotaExceeded";case"RATELIMITED":case"TOOMANYREQUESTS":case"TELEVETRATELIMITED":return"rateLimited";case"IDEMPOTENCYKEYCONFLICT":case"IDEMPOTENCYCONFLICT":return"idempotencyConflict";case"ACCESSDENIED":case"FORBIDDEN":return"accessDenied";case"IDENTITYSIGNATUREREQUIRED":return"identitySignatureRequired";case"FREECAPREACHED":return"paymentRequired";case"RUNTIMEDISPOSED":return"runtimeDisposed";case"NOTFOUND":case"CONVERSATIONNOTFOUND":return"conversationNotFound";case"PETNOTFOUND":return"petNotFound";case"TIMEOUT":case"STREAMTIMEOUT":return"streamTimeout";case"MEDIAUPLOADFAILED":case"UNRECOGNIZEDVIDEOFORMAT":case"FILETOOSMALL":return"mediaUploadFailed";case"MODERATIONBLOCKED":return"moderationBlocked";case"UPSTREAMLLMTIMEOUT":return"upstreamLlmTimeout";case"INTERNALERROR":case"INTERNALSERVERERROR":return"internalError";case"STREAMINCOMPLETE":case"CHATSTREAMINCOMPLETE":return"streamIncomplete";case"INVALIDANALYSISTYPE":case"INVALIDUPLOADPURPOSE":return"unknown";default:return"unknown"}}var de=/* @__PURE__ */new Set(["streamTimeout","rateLimited","internalError","upstreamLlmTimeout","streamIncomplete"]);function isAutoRetryable(e){return de.has(e)}var ue=/* @__PURE__ */new Set(["serviceUnavailable","conflict","idempotencyInFlight"]);function isRetryableCode(e){return isAutoRetryable(e)||ue.has(e)}var pe=500,he=8e3,fe=4;function backoffDelayMs(e,t=Math.random){let n=Math.max(0,e),r=Math.min(pe*2**n,he);return Math.floor(t()*r)}var me="This feature isn't available on your account right now.",ge="Something in that request was not right. Check the details and try again.",be=/* @__PURE__ */Object.freeze({authExpired:"Please sign in again to continue.",authRejected:"Please sign in again to continue.",sessionRequired:"This app needs to be updated to keep using Everfur.",accessDenied:me,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:ge,sdkUpdateRequired:"This app needs to be updated to keep using Everfur.",conflict:"That is already running. Wait for it to finish, then try again.",idempotencyConflict:"That message was already delivered.",idempotencyInFlight:"That is still processing. Give it a moment.",conversationNotFound:"This conversation is no longer available.",petNotFound:"We could not find that pet. Please pick a pet and try again.",resourceNotFound:"We could not find that.",streamTimeout:"The response timed out. Tap retry to try again.",mediaUploadFailed:"We could not upload that photo. Please attach it again.",moderationBlocked:"This request cannot be answered here.",upstreamLlmTimeout:"The response timed out. Tap retry to try again.",internalError:"We hit a snag on our end. Please try again.",notImplemented:"That is not available yet.",serviceUnavailable:"That service is briefly unavailable. Try again shortly.",streamIncomplete:"The connection dropped mid-answer. Tap retry to continue.",identitySignatureRequired:me,runtimeDisposed:ge,unknown:"Something went wrong. Please try again."}),ye="This session has ended. Please sign in again.",ve="linked_account_read_only";function xe(e,t,n){return e==="conflict"&&n===ve?me:(e==="authRejected"||e==="authExpired")&&typeof t=="string"&&t.trim().toLowerCase()==="session_revoked"?ye:userFacingError(e)}function userFacingError(e){return be[e]}function Te(e,t,n){Object.defineProperty(e,t,{value:n,enumerable:false,writable:false,configurable:false})}var ke=/^[a-z][a-z0-9_]{0,63}$/;function makeEverfurError(e,t){let n=contractErrorFor(t?.wireCode,t?.wireEnvelope),r=e==="conflict"&&t?.reasonCode===ve,l={code:e,category:categoryFor(e),retryable:t?.retryable??(r?false:isRetryableCode(e)),displayMessage:xe(e,t?.wireCode,r?ve:null)};t?.httpStatus!==void 0&&(l.httpStatus=t.httpStatus),t?.requestId&&(l.requestId=t.requestId),typeof t?.reasonCode=="string"&&ke.test(t.reasonCode)&&(l.reasonCode=t.reasonCode);let i=t?.retryAfterSeconds;if(typeof i=="number"&&Number.isFinite(i)&&i>=0&&(l.retryAfterSeconds=Math.round(i)),n);return t?.wireMessage&&Te(l,"wireMessage",t.wireMessage),t?.raw!==void 0&&t.raw!==null&&Te(l,"raw",t.raw),/* @__PURE__ */Object.freeze(l)}function ok(e,t){/* @__PURE__ */
6
6
  return Object.freeze({ok:true,value:e})}function err(e){/* @__PURE__ */
7
- return Object.freeze({ok:false,error:e})}var ke=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var we="x-everfur-anon-token",Se="anonTokenInvalid";async function je(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function Ce(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...n?{wireMessage:n}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[we]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{..._e(e.headers),...authHeaders(t)}}}function _e(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===we||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await je(t),r=await t.transport.request(withAuthHeaders(e,Ie(t,n)));if(r.ok||De(r.error.raw)!==Se||t.anonIdentity===void 0||t.userRef!==null)return r;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===n?r:t.transport.request(withAuthHeaders(e,Ie(t,l)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(Ce(e))}let r=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(Ce(e,{wireCode:De(r.error.raw),requestId:r.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(Ee(i.error))):i}function Ie(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function Ee(e){let t=e.raw,n=De(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...n?{wireCode:n}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function De(e){if(typeof e!="object"||e===null)return null;let t=e,n=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof n=="string"&&n.length>0?n:null}function Pe(e,t){let n=globalThis.URL;if(typeof n=="function"){let r;try{r=t===void 0?new n(e):new n(e,t)}catch{return null}try{if(r.protocol)return r}catch{}}return Le(e)}var Re=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,ze=/[\s\u0000-\u001f\u007f\\]/,Fe={"http:":"80","https:":"443"};function Le(e,t){let n=e.trim();let r=ze.test(n)?null:Re.exec(n);if(r===null)return null;let[,l="",i="",o="",a="",s="",c="",d="",u=""]=r,p=`${l.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===Fe[p]?"":String(h),m=Fe[p]!==void 0,g=a.toLowerCase()+(f&&`:${f}`),y=c||(m?"/":""),b=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${b}${g}${y}${d}${u}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:y,search:d==="?"?"":d,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Ae(e)})}function Ae(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var Oe=3e4,Ve=pe*2,Ne="idempotency-key",Be=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),Me=/* @__PURE__ */Object.freeze({onEvent(){}}),He=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function $e(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??Me,n=e.timers??He,r=e.rng??Math.random,l=e.sleep??((e,t)=>it(e,n,t)),i=e.maxAttempts??he,o=e.unaryTimeoutMs??Oe,a=e.newIdempotencyKey??Ue(),s=e=>{try{t.onEvent(e)}catch{}};async function c(t,c,d){let u=d?.maxAttempts,p=Math.max(1,u??i),h=d?.idempotent??Be.has(c.method),f=d?.idempotencyKey===void 0?null:$e(d.idempotencyKey),m=h?f??a():null,g=We(c,m),y=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:c.method,path:c.path,attempt:y,...m?{idempotencyKey:m}:{},...e});s(i({phase:"attempt"}));let a=rt(o,n),d=lt(a.signal,c.signal),h;try{h=await authedSend({...g,signal:d.signal},e.auth)}catch(e){h=err(networkError(e))}finally{d.dispose(),a.cancel()}if(h.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,b=Ke(f,y,{maxAttempts:p,rng:r,now:n.now(),aborted:c.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:f.code,reason:b.reason,...f.httpStatus!==void 0?{httpStatus:f.httpStatus}:{},...f.requestId!==void 0?{requestId:f.requestId}:{}};if(!b.retry)return s(i({phase:"settled",...v})),err(f);if(s(i({phase:"retry",...v,delayMs:b.delayMs})),await l(b.delayMs,c.signal),c.signal?.aborted===true)return s(i({phase:"settled",...v,reason:"aborted"})),err(f);y+=1}}async function d(t){return withAuthHeaders(t,await nt(e.auth))}async function*u(t,n,r){s(
7
+ return Object.freeze({ok:false,error:e})}var we=class _EverfurConfigError extends Error{constructor(e,t){super(t),this.name="EverfurConfigError",this.kind=e,Object.setPrototypeOf(this,_EverfurConfigError.prototype)}};var Se="x-everfur-anon-token",je="anonTokenInvalid";async function Ce(e){if(e.userRef!==null||e.anonIdentity===void 0)return null;try{return await e.anonIdentity.token()}catch{return null}}function _e(e,t){let n=e instanceof Error?e.message:typeof e=="string"?e:null;return makeEverfurError("authRejected",{retryable:false,...t?.wireCode?{wireCode:t.wireCode}:{},...t?.requestId?{requestId:t.requestId}:{},...n?{wireMessage:n}:{},...e!=null?{raw:e}:{}})}function authHeaders(e){let t={};return e.mode==="personalized"?t.authorization=`Bearer ${e.token}`:(t["x-everfur-partner-key"]=e.publishableKey,e.anonToken&&(t[Se]=e.anonToken)),e.userRef&&(t["x-everfur-user-ref"]=e.userRef),e.sessionId&&(t["x-everfur-session-id"]=e.sessionId),t}function withAuthHeaders(e,t){return{...e,headers:{...Ie(e.headers),...authHeaders(t)}}}function Ie(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase();e==="authorization"||e==="x-everfur-partner-key"||e===Se||(t[n]=r)}return t}async function authedSend(e,t){if(t.mode==="anonymous"){let n=await Ce(t),r=await t.transport.request(withAuthHeaders(e,Ee(t,n)));if(r.ok||Pe(r.error.raw)!==je||t.anonIdentity===void 0||t.userRef!==null)return r;let l=await t.anonIdentity.token({forceRefresh:true});return l===null||l===n?r:t.transport.request(withAuthHeaders(e,Ee(t,l)))}let n;try{n=await t.identity.currentToken()}catch(e){return t.identity.reportRejected?.(),err(_e(e))}let r=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:n,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));if(r.ok||r.error.httpStatus!==401)return r;let l;try{l=await t.identity.currentToken({forceRefresh:!0})}catch(e){return t.identity.reportRejected?.(),err(_e(e,{wireCode:Pe(r.error.raw),requestId:r.error.requestId}))}let i=await t.transport.request(withAuthHeaders(e,{mode:"personalized",token:l,userRef:t.userRef,...t.sessionId?{sessionId:t.sessionId}:{}}));return!i.ok&&i.error.httpStatus===401?(t.identity.reportRejected?.(),err(De(i.error))):i}function Ee(e,t){return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}function De(e){let t=e.raw,n=Pe(t);return makeEverfurError("authRejected",{retryable:false,...e.httpStatus!==void 0?{httpStatus:e.httpStatus}:{},...e.requestId?{requestId:e.requestId}:{},...n?{wireCode:n}:{},...e.reasonCode?{reasonCode:e.reasonCode}:{},...e.wireMessage?{wireMessage:e.wireMessage}:{},...t!=null?{raw:t}:{}})}function Pe(e){if(typeof e!="object"||e===null)return null;let t=e,n=(typeof t.error=="object"&&t.error!==null?t.error.code:void 0)??t.code;return typeof n=="string"&&n.length>0?n:null}function Re(e,t){let n=globalThis.URL;if(typeof n=="function"){let r;try{r=t===void 0?new n(e):new n(e,t)}catch{return null}try{if(r.protocol)return r}catch{}}return Ae(e)}var ze=/^([a-z][a-z0-9+.-]*):\/\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?(\[[0-9a-f:.]+\]|[\w.~-]+)(?::(\d*))?(\/[^?#]*)?(\?[^#]*)?(#.*)?$/i,Fe=/[\s\u0000-\u001f\u007f\\]/,Le={"http:":"80","https:":"443"};function Ae(e,t){let n=e.trim();let r=Fe.test(n)?null:ze.exec(n);if(r===null)return null;let[,l="",i="",o="",a="",s="",c="",d="",u=""]=r,p=`${l.toLowerCase()}:`,h=Number(s);if(h>65535)return null;let f=s===""||String(h)===Le[p]?"":String(h),m=Le[p]!==void 0,g=a.toLowerCase()+(f&&`:${f}`),b=c||(m?"/":""),y=i||o?`${i}${o&&`:${o}`}@`:"";return{href:`${p}//${y}${g}${b}${d}${u}`,protocol:p,username:i,password:o,hostname:a.toLowerCase(),port:f,origin:m?`${p}//${g}`:"null",pathname:b,search:d==="?"?"":d,hash:u==="#"?"":u}}function networkError(e){return makeEverfurError("internalError",{retryable:true,wireMessage:Oe(e)})}function Oe(e){return e instanceof Error?e.message:typeof e=="string"?e:"network request failed"}var Ve=3e4,Ne=he*2,Be="idempotency-key",Me=/* @__PURE__ */new Set(["POST","PUT","PATCH","DELETE"]),He=/* @__PURE__ */Object.freeze({onEvent(){}}),$e=/* @__PURE__ */Object.freeze({setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now()});function We(e){let t=e.trim().replace(/[^A-Za-z0-9_.:-]/g,"-");return t.length===0?null:`efs_${t}`.slice(0,128)}function createRequestFunnel(e){let t=e.observer??He,n=e.timers??$e,r=e.rng??Math.random,l=e.sleep??((e,t)=>ot(e,n,t)),i=e.maxAttempts??fe,o=e.unaryTimeoutMs??Ve,a=e.newIdempotencyKey??qe(),s=e=>{try{t.onEvent(e)}catch{}};async function c(t,c,d){let u=d?.maxAttempts,p=Math.max(1,u??i),h=d?.idempotent??Me.has(c.method),f=d?.idempotencyKey===void 0?null:We(d.idempotencyKey),m=h?f??a():null,g=Ue(c,m),b=0;for(;;){let i=e=>/* @__PURE__ */Object.freeze({call:t,method:c.method,path:c.path,attempt:b,...m?{idempotencyKey:m}:{},...e});s(i({phase:"attempt"}));let a=lt(o,n),d=it(a.signal,c.signal),h;try{h=await authedSend({...g,signal:d.signal},e.auth)}catch(e){h=err(networkError(e))}finally{d.dispose(),a.cancel()}if(h.ok)return s(i({phase:"settled",ok:true,reason:"ok"})),h;let f=h.error,y=Ye(f,b,{maxAttempts:p,rng:r,now:n.now(),aborted:c.signal?.aborted===true,...u!==void 0?{perCallMaxAttempts:u}:{},...e.errorPolicy!==void 0?{policy:e.errorPolicy}:{}}),v={ok:false,code:f.code,reason:y.reason,...f.httpStatus!==void 0?{httpStatus:f.httpStatus}:{},...f.requestId!==void 0?{requestId:f.requestId}:{}};if(!y.retry)return s(i({phase:"settled",...v})),err(f);if(s(i({phase:"retry",...v,delayMs:y.delayMs})),await l(y.delayMs,c.signal),c.signal?.aborted===true)return s(i({phase:"settled",...v,reason:"aborted"})),err(f);b+=1}}async function d(t){return withAuthHeaders(t,await rt(e.auth))}async function*u(t,n,r){s(
8
8
  /* @__PURE__ */Object.freeze({call:t,phase:"stream.open",method:n.method,path:n.path,attempt:0}));try{yield*e.auth.transport.stream(n,r)}catch{yield errorFrame({code:"internal_error",retryable:true,wireMessage:null,synthesized:true,lastEventId:null})}}/* @__PURE__ */
9
- return Object.freeze({send:c,authorize:d,stream:u})}function We(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==Ne&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function Ue(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var qe=10;function Ke(e,t,n){if(n.aborted)return{retry:false,reason:"aborted"};let r=Ye(e);if(r==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(r!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let l=r==="burst"?"burst-throttle":"retryable-code";if((()=>{if(n.policy===void 0)return false;try{return!n.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let i=()=>{if(n.policy===void 0)return null;let t;try{t=n.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(qe,Math.floor(t)))},o=n.perCallMaxAttempts??i()??n.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Ge(e,n.now);return a!==null?a>Ve?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:a}:{retry:true,reason:l,delayMs:backoffDelayMs(t,n.rng)}}function Ye(e){let t=e.code==="unknown"?fromWire(et(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Ge(e,t){let n=Qe(e.raw);if(n!==null){let e=n-t;return e>0?e:0}let r=Je(e.raw);return r===null?null:Math.round(r*1e3)}function Je(e){for(let t of Xe(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function Qe(e){for(let t of Xe(e)){let e=t.resets_at,n=Ze(e);if(n!==null)return n}return null}function Xe(e){if(!tt(e))return[];let t=[e];for(let n of["error","detail"]){let r=e[n];tt(r)&&t.push(r)}return t}function Ze(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function et(e){for(let t of Xe(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function tt(e){return typeof e=="object"&&e!==null}async function nt(e){if(e.mode==="anonymous"){let t=await je(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function rt(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return{signal:n.signal,cancel:()=>t.clearTimeout(r)}}function lt(e,t){let n=()=>{};if(!t)return{signal:e,dispose:n};let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),{signal:r.signal,dispose:n};let l=()=>r.abort();return e.addEventListener("abort",l,{once:true}),t.addEventListener("abort",l,{once:true}),{signal:r.signal,dispose:()=>{e.removeEventListener("abort",l),t.removeEventListener("abort",l)}}}function it(e,t,n){return e<=0||n?.aborted===true?Promise.resolve():new Promise(r=>{let l=t.setTimeout(()=>{n?.removeEventListener("abort",i),r()},e),i=()=>{t.clearTimeout(l),r()};n?.addEventListener("abort",i,{once:true})})}var ot=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/webp","image/heic","image/heif","application/pdf","text/csv","video/mp4","video/quicktime"]),at=25*1024*1024,st=200*1024*1024,ct=[[".jpg","image/jpeg"],[".jpeg","image/jpeg"],[".png","image/png"],[".webp","image/webp"],[".heic","image/heic"],[".heif","image/heif"],[".pdf","application/pdf"],[".csv","text/csv"],[".mp4","video/mp4"],[".mov","video/quicktime"]];function dt(e,t){let n=(t??"").trim().toLowerCase();if(n==="image/jpg")return"image/jpeg";if(ot.includes(n))return n;if(n.length>0)return null;let r=e.toLowerCase();return ct.find(([e])=>r.endsWith(e))?.[1]??null}function ut(e){let t=dt(e.filename,e.mimeType);if(t===null)return"type";if(!Number.isFinite(e.fileSize)||e.fileSize<=0)return"unreadable";let n=t.startsWith("video/")?st:at;return e.fileSize<=n?null:"size"}function pt(e){if(typeof e!="object"||e===null)return null;let t=e,n=e=>typeof e=="string"&&e.length>0?e:null,r=e=>typeof e=="number"&&Number.isFinite(e)?e:null,l=n(t.upload_url),i=n(t.s3_key);if(l===null||i===null)return null;let o={},a=t.upload_fields;if(typeof a=="object"&&a!==null)for(let[e,t]of Object.entries(a))typeof t=="string"&&(o[e]=t);/* @__PURE__ */
10
- return Object.freeze({upload_id:n(t.upload_id)??"",upload_url:l,upload_fields:/* @__PURE__ */Object.freeze(o),expires_in_seconds:r(t.expires_in_seconds)??0,max_content_length:r(t.max_content_length)??at,s3_key:i,purpose:n(t.purpose)})}function ht(e){if(typeof e!="object"||e===null)return null;let t=[e,e.detail,e.error];for(let e of t)if(!(typeof e!="object"||e===null))for(let t of["error","code"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function ft(e){if(e.httpStatus===404)return"dark";if(e.httpStatus===400){let t=ht(e.raw);if(t==="FILE_TOO_LARGE")return"size";if(t==="INVALID_CONTENT_TYPE")return"type"}return"failed"}var mt="televet_booking_not_live";function gt(e){return makeEverfurError("conflict",{retryable:false,reasonCode:mt,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}var yt="televet_booking_key_reused",bt="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function vt(e){return e.httpStatus!==409||e.reasonCode===yt||xt(e)?.code!==bt?e:makeEverfurError(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:bt,reasonCode:yt,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function xt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let n=t,r=n.detail??n.error;return typeof r=="object"&&r!==null?r:n}function Tt(e){let t=xt(e)?.categories;return Array.isArray(t)?/* @__PURE__ */Object.freeze(t.filter(e=>typeof e=="string")):/* @__PURE__ */Object.freeze([])}function kt(e){let t=xt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}function wt(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let n=xt(e)?.message;return typeof n=="string"&&n.trim().length>0?n.trim():null}function St(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let n=xt(e),r=n?.code??n?.error_code;return typeof r=="string"&&r.length>0?r:null}function televetBookingRefusal(e){let t=e.httpStatus;if(t===402)/* @__PURE__ */return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")/* @__PURE__ */
11
- return Object.freeze({kind:"rate_limited",retryAfterSeconds:kt(e),message:wt(e)});if(t===404)/* @__PURE__ */return Object.freeze({kind:"unavailable"});switch(St(e)){case"televet_rate_limited":/* @__PURE__ */
12
- return Object.freeze({kind:"rate_limited",retryAfterSeconds:kt(e),message:wt(e)});case"televet_emergency_ack_required":/* @__PURE__ */
13
- return Object.freeze({kind:"emergency",categories:Tt(e)});case"televet_not_entitled":/* @__PURE__ */
9
+ return Object.freeze({send:c,authorize:d,stream:u})}function Ue(e,t){let n={};for(let[t,r]of Object.entries(e.headers??{}))t.toLowerCase()!==Be&&(n[t]=r);return t!==null&&(n["Idempotency-Key"]=t),{...e,headers:n}}function qe(){let e=0;return()=>`efk_${Date.now().toString(36)}_${(e++).toString(36)}_${Math.random().toString(36).slice(2,12)}`}var Ke=10;function Ye(e,t,n){if(n.aborted)return{retry:false,reason:"aborted"};let r=Ge(e);if(r==="quota")return{retry:false,reason:"daily-quota-exhausted"};if(r!=="burst"&&!isAutoRetryable(e.code))return{retry:false,reason:"terminal-code"};let l=r==="burst"?"burst-throttle":"retryable-code";if((()=>{if(n.policy===void 0)return false;try{return!n.policy.shouldRetry(e.code,t)}catch{return false}})())return{retry:false,reason:"terminal-code"};let i=()=>{if(n.policy===void 0)return null;let t;try{t=n.policy.maxAttempts(e.code)}catch{return null}return typeof t!="number"||!Number.isFinite(t)?null:Math.max(1,Math.min(Ke,Math.floor(t)))},o=n.perCallMaxAttempts??i()??n.maxAttempts;if(t+1>=o)return{retry:false,reason:"attempts-exhausted"};let a=Je(e,n.now);return a!==null?a>Ne?{retry:false,reason:"server-reset-beyond-budget"}:{retry:true,reason:l,delayMs:a}:{retry:true,reason:l,delayMs:backoffDelayMs(t,n.rng)}}function Ge(e){let t=e.code==="unknown"?fromWire(tt(e.raw)):e.code;return t==="quotaExceeded"?"quota":t==="rateLimited"||e.httpStatus===429?"burst":null}function Je(e,t){let n=Xe(e.raw);if(n!==null){let e=n-t;return e>0?e:0}let r=Qe(e.raw);return r===null?null:Math.round(r*1e3)}function Qe(e){for(let t of Ze(e)){let e=t.retry_after_seconds;if(typeof e=="number"&&Number.isFinite(e)&&e>=0)return e}return null}function Xe(e){for(let t of Ze(e)){let e=t.resets_at,n=et(e);if(n!==null)return n}return null}function Ze(e){if(!nt(e))return[];let t=[e];for(let n of["error","detail"]){let r=e[n];nt(r)&&t.push(r)}return t}function et(e){if(typeof e=="number"&&Number.isFinite(e))return e<1e11?Math.round(e*1e3):Math.round(e);if(typeof e=="string"&&e.trim().length>0){let t=Date.parse(e);return Number.isFinite(t)?t:null}return null}function tt(e){for(let t of Ze(e)){let e=t.code;if(typeof e=="string"&&e.length>0)return e}return null}function nt(e){return typeof e=="object"&&e!==null}async function rt(e){if(e.mode==="anonymous"){let t=await Ce(e);return{mode:"anonymous",publishableKey:e.publishableKey,userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{},...t!==null?{anonToken:t}:{}}}return{mode:"personalized",token:await e.identity.currentToken(),userRef:e.userRef,...e.sessionId?{sessionId:e.sessionId}:{}}}function lt(e,t){let n=new AbortController,r=t.setTimeout(()=>n.abort(),e);return{signal:n.signal,cancel:()=>t.clearTimeout(r)}}function it(e,t){let n=()=>{};if(!t)return{signal:e,dispose:n};let r=new AbortController;if(e.aborted||t.aborted)return r.abort(),{signal:r.signal,dispose:n};let l=()=>r.abort();return e.addEventListener("abort",l,{once:true}),t.addEventListener("abort",l,{once:true}),{signal:r.signal,dispose:()=>{e.removeEventListener("abort",l),t.removeEventListener("abort",l)}}}function ot(e,t,n){return e<=0||n?.aborted===true?Promise.resolve():new Promise(r=>{let l=t.setTimeout(()=>{n?.removeEventListener("abort",i),r()},e),i=()=>{t.clearTimeout(l),r()};n?.addEventListener("abort",i,{once:true})})}var at=/* @__PURE__ */Object.freeze(["image/jpeg","image/png","image/webp","image/heic","image/heif","application/pdf","text/csv","video/mp4","video/quicktime"]),st=25*1024*1024,ct=200*1024*1024,dt=[[".jpg","image/jpeg"],[".jpeg","image/jpeg"],[".png","image/png"],[".webp","image/webp"],[".heic","image/heic"],[".heif","image/heif"],[".pdf","application/pdf"],[".csv","text/csv"],[".mp4","video/mp4"],[".mov","video/quicktime"]];function ut(e,t){let n=(t??"").trim().toLowerCase();if(n==="image/jpg")return"image/jpeg";if(at.includes(n))return n;if(n.length>0)return null;let r=e.toLowerCase();return dt.find(([e])=>r.endsWith(e))?.[1]??null}function pt(e){let t=ut(e.filename,e.mimeType);if(t===null)return"type";if(!Number.isFinite(e.fileSize)||e.fileSize<=0)return"unreadable";let n=t.startsWith("video/")?ct:st;return e.fileSize<=n?null:"size"}function ht(e){if(typeof e!="object"||e===null)return null;let t=e,n=e=>typeof e=="string"&&e.length>0?e:null,r=e=>typeof e=="number"&&Number.isFinite(e)?e:null,l=n(t.upload_url),i=n(t.s3_key);if(l===null||i===null)return null;let o={},a=t.upload_fields;if(typeof a=="object"&&a!==null)for(let[e,t]of Object.entries(a))typeof t=="string"&&(o[e]=t);/* @__PURE__ */
10
+ return Object.freeze({upload_id:n(t.upload_id)??"",upload_url:l,upload_fields:/* @__PURE__ */Object.freeze(o),expires_in_seconds:r(t.expires_in_seconds)??0,max_content_length:r(t.max_content_length)??st,s3_key:i,purpose:n(t.purpose)})}function ft(e){if(typeof e!="object"||e===null)return null;let t=[e,e.detail,e.error];for(let e of t)if(!(typeof e!="object"||e===null))for(let t of["error","code"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}return null}function mt(e){if(e.httpStatus===404)return"dark";if(e.httpStatus===400){let t=ft(e.raw);if(t==="FILE_TOO_LARGE")return"size";if(t==="INVALID_CONTENT_TYPE")return"type"}return"failed"}var gt="televet_booking_not_live";function bt(e){return makeEverfurError("conflict",{retryable:false,reasonCode:gt,wireMessage:`the booking was answered with a consult whose status is ${e}, which is not a live visit`})}var yt="televet_booking_key_reused",vt="IDEMPOTENCY_KEY_REUSED_DIFFERENT_REQUEST";function xt(e){return e.httpStatus!==409||e.reasonCode===yt||Tt(e)?.code!==vt?e:makeEverfurError(e.code,{retryable:false,httpStatus:409,...e.requestId!==void 0?{requestId:e.requestId}:{},wireCode:vt,reasonCode:yt,...e.wireMessage!==void 0?{wireMessage:e.wireMessage}:{},raw:e.raw})}function Tt(e){let t=e.raw;if(typeof t!="object"||t===null)return null;let n=t,r=n.detail??n.error;return typeof r=="object"&&r!==null?r:n}function kt(e){let t=Tt(e)?.categories;return Array.isArray(t)?/* @__PURE__ */Object.freeze(t.filter(e=>typeof e=="string")):/* @__PURE__ */Object.freeze([])}function wt(e){let t=Tt(e)?.retry_after_seconds;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:null}function St(e){let t=e.wireMessage;if(typeof t=="string"&&t.trim().length>0)return t.trim();let n=Tt(e)?.message;return typeof n=="string"&&n.trim().length>0?n.trim():null}function jt(e){let t=e.reasonCode;if(typeof t=="string"&&t.length>0)return t;let n=Tt(e),r=n?.code??n?.error_code;return typeof r=="string"&&r.length>0?r:null}function televetBookingRefusal(e){let t=e.httpStatus;if(t===402)/* @__PURE__ */return Object.freeze({kind:"not_entitled"});if(t===429||e.code==="rateLimited"||e.code==="quotaExceeded")/* @__PURE__ */
11
+ return Object.freeze({kind:"rate_limited",retryAfterSeconds:wt(e),message:St(e)});if(t===404)/* @__PURE__ */return Object.freeze({kind:"unavailable"});switch(jt(e)){case"televet_rate_limited":/* @__PURE__ */
12
+ return Object.freeze({kind:"rate_limited",retryAfterSeconds:wt(e),message:St(e)});case"televet_emergency_ack_required":/* @__PURE__ */
13
+ return Object.freeze({kind:"emergency",categories:kt(e)});case"televet_not_entitled":/* @__PURE__ */
14
14
  return Object.freeze({kind:"not_entitled"});case"televet_slot_conflict":/* @__PURE__ */
15
15
  return Object.freeze({kind:"slot_taken"});case"televet_hold_invalid":/* @__PURE__ */
16
- return Object.freeze({kind:"slot_taken"});case mt:/* @__PURE__ */
16
+ return Object.freeze({kind:"slot_taken"});case gt:/* @__PURE__ */
17
17
  return Object.freeze({kind:"slot_taken"});case yt:/* @__PURE__ */
18
18
  return Object.freeze({kind:"slot_taken"});case"televet_clinician_cannot_prescribe":case"televet_clinician_unavailable":case"televet_clinician_not_bookable":/* @__PURE__ */
19
19
  return Object.freeze({kind:"clinician_unavailable"});case"televet_membership_conflict":/* @__PURE__ */
20
20
  return Object.freeze({kind:"not_entitled"});case"televet_registry_unavailable":/* @__PURE__ */
21
21
  return Object.freeze({kind:"failed"})}/* @__PURE__ */
22
- return Object.freeze({kind:"failed"})}function jt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function isSafeRoomUrl(e){return Pe(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function Ct(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}function _t(e){if(!jt(e))return null;let t=Ct(e.consult_minutes,1),n=Ct(e.auto_end_minutes,0),r=Ct(e.warn_before_seconds,0);return t===null||n===null||r===null?null:/* @__PURE__ */Object.freeze({consultMinutes:t,autoEndMinutes:n,warnBeforeSeconds:r})}function parseVetCallCredential(e){if(!jt(e))return null;let t=e.room_url??e.url,n=e.token;if(typeof t!="string"||typeof n!="string"||!isUsableRoomCredential(t,n))return null;let r=e.recording_notice;/* @__PURE__ */
23
- return Object.freeze({roomUrl:t.trim(),token:n,recordingNotice:typeof r=="boolean"?r:true,callLimits:_t(e.call_limits)})}function vetCallJoinReason(e){let t=It(e.raw);return t!==null&&t.length>0?t:null}function It(e){if(!jt(e))return null;let t=e.detail??e.error,n=(jt(t)?t:e).reason;return typeof n=="string"?n:null}function vetCallJoinRefusal(e){if(e.httpStatus===404)return"unavailable";let t=It(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}var Et="/widget/v1/televet",Dt=`${Et}/messages/threads`;function televetThreadMessagesCall(petRef){return`${Dt}/${encodeURIComponent(petRef)}/messages`}function televetThreadReadCall(petRef){return`${Dt}/${encodeURIComponent(petRef)}/read`}function televetVisitSummaryCall(e){return`${Et}/consults/${encodeURIComponent(e)}/summary`}var Pt=4e3,Rt=50,zt=100,Ft=/* @__PURE__ */n.z.string().min(1).refine(e=>!Number.isNaN(Date.parse(e))),Lt=/* @__PURE__ */n.z.string().nullish(),At=/* @__PURE__ */n.z.object({message_id:/* @__PURE__ */n.z.string().min(1),pet_ref:/* @__PURE__ */n.z.string().min(1),role:/* @__PURE__ */n.z.enum(["owner","vet","system"]),content:/* @__PURE__ */n.z.string(),created_at:Ft,sender:/* @__PURE__ */n.z.object({display_name:Lt,specialty:Lt}).nullish(),sender_display_name:Lt,attachment_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}),Ot=/* @__PURE__ */n.z.object({pet_ref:/* @__PURE__ */n.z.string().min(1),last_message_at:Ft,unread_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish(),owner_can_start:/* @__PURE__ */n.z.boolean().nullish(),last_message:/* @__PURE__ */At.nullish()}),Vt=/* @__PURE__ */n.z.object({drug:/* @__PURE__ */n.z.string().nullish(),strength:Lt,form:Lt,sig:Lt,quantity:/* @__PURE__ */n.z.union([/* @__PURE__ */n.z.string(),/* @__PURE__ */n.z.number()]).nullish(),refills:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}).passthrough(),Nt=/* @__PURE__ */n.z.object({consult_id:/* @__PURE__ */n.z.string().min(1),findings_text:/* @__PURE__ */n.z.string().nullish(),next_steps_text:/* @__PURE__ */n.z.string().nullish(),medications:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.unknown()).nullish(),product_refs:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),action_items:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),approved_at:Ft,approved_by_display_name:Lt,credentials_text:Lt});function Bt(e){let t=e?.trim()??"";return t.length>0?t:null}function Mt(e){let t=e.role==="vet";/* @__PURE__ */
24
- return Object.freeze({messageId:e.message_id,petRef:e.pet_ref,role:e.role,content:e.content,createdAt:e.created_at,senderName:t?Bt(e.sender?.display_name)??Bt(e.sender_display_name):null,senderSpecialty:t?Bt(e.sender?.specialty):null,attachmentCount:e.attachment_count??0})}function Ht(e){let t=At.safeParse(e);return t.success?Mt(t.data):null}function $t(e){let t=n.z.array(At).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(Mt)):null}function Wt(e){let t=n.z.array(Ot).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(e=>/* @__PURE__ */Object.freeze({petRef:e.pet_ref,lastMessageAt:e.last_message_at,unreadCount:e.unread_count??0,ownerCanStart:e.owner_can_start??true,lastMessage:e.last_message?Mt(e.last_message):null}))):null}function Ut(e){let t=Vt.safeParse(e);if(!t.success)return null;let n=Bt(t.data.drug);if(n===null)return null;let r=t.data.quantity;/* @__PURE__ */
25
- return Object.freeze({drug:n,strength:Bt(t.data.strength),form:Bt(t.data.form),sig:Bt(t.data.sig),quantity:r==null?null:Bt(String(r)),refills:t.data.refills??null})}function qt(e){let t=Nt.safeParse(e);if(!t.success)return null;let n=t.data;/* @__PURE__ */
26
- return Object.freeze({consultId:n.consult_id,findingsText:n.findings_text??"",nextStepsText:n.next_steps_text??"",medications:/* @__PURE__ */Object.freeze((n.medications??[]).map(Ut).filter(e=>e!==null)),productRefs:/* @__PURE__ */Object.freeze([...n.product_refs??[]]),actionItems:/* @__PURE__ */Object.freeze((n.action_items??[]).filter(e=>e.trim().length>0)),approvedAt:n.approved_at,approvedByName:Bt(n.approved_by_display_name),credentialsText:Bt(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function Kt(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Yt(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Gt(e){return e===void 0||!Number.isFinite(e)?Rt:Math.min(zt,Math.max(1,Math.trunc(e)))}function Jt(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function Qt(e,t,n){try{e?.track(t,n)}catch{}}function Xt(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:Dt,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=Wt(n.value);return r===null?Yt("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!Jt(l))return Kt("before must be an ISO date-time");let i=await e.send("televet.messages.thread",{method:"GET",path:televetThreadMessagesCall(r),query:{...l?{before:l}:{},limit:Gt(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=$t(i.value);return o===null?Yt("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return Kt("petRef is required");if(n.trim().length===0)return Kt("content must not be blank");if(n.length>Pt)return Kt(`content must be at most ${Pt} characters`);let l=await e.send("televet.messages.send",{method:"POST",path:televetThreadMessagesCall(r),body:{content:n}},{idempotent:false,maxAttempts:1});if(!l.ok)return Qt(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=Ht(l.value);return i===null?Yt("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return Kt("petRef is required");if(!Jt(t))return Kt("readAt must be an ISO date-time");let r=await e.send("televet.messages.read",{method:"PUT",path:televetThreadReadCall(n),body:{read_at:t}});return r.ok?ok(void 0):err(r.error)},async visitSummary(t,n){let r=t.trim();if(r.length===0)return Kt("consultId is required");let l=await e.send("televet.messages.summary",{method:"GET",path:televetVisitSummaryCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=qt(l.value);return i===null?Yt("the visit summary was unreadable"):ok(i)}}}var Zt="/widget/v1/televet",en=`${Zt}/state-policy`,tn=`${Zt}/vets`,nn=`${Zt}/slots`,rn=`${Zt}/slots/next`,ln=`${Zt}/consults`,on=`${Zt}/entitlement`,an=`${Zt}/cancellation-policy`,sn=`${Zt}/attachments/initiate`,cn=`${ln}/triage`;function televetHoldCall(e){return`${nn}/${encodeURIComponent(e)}/hold`}function televetRescheduleCall(e){return`${ln}/${encodeURIComponent(e)}/reschedule`}function televetConsultCall(e){return`${ln}/${encodeURIComponent(e)}`}function televetJoinCall(e){return`${televetConsultCall(e)}/join`}function televetCancelCall(e){return`${televetConsultCall(e)}/cancel`}var dn=100;function un(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function pn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function hn(e){return e.httpStatus===404}function fn(e,t,n){try{e?.track(t,n)}catch{}}function validateBookingBody(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(!isWellFormedStateCode(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>g?`reason_text must be at most ${g} characters`:mn(e)}function mn(e){let t=e.state_attested===true,n=e.cancellation_policy_version?.trim()??"";return t!==n.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":n.length>m?`cancellation_policy_version must be at most ${m} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...Xt(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${en}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=j(l.value,r);return i===null?pn("the state policy response was unreadable"):ok(i)},async entitlement(e){let n=await t.send("televet.booking.entitlement",{method:"GET",path:on,...e?{signal:e}:{}});return n.ok?ok(z(n.value)):err(n.error)},async cancellationPolicy(e){let n=await t.send("televet.booking.cancellation_policy",{method:"GET",path:an,...e?{signal:e}:{}});return n.ok?ok(C(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return un("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:tn,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"vets"),_)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return un("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:nn,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(S(yn(l.value,"slots"),E)):hn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async nextSlot(e){let n=await t.send("televet.booking.next_slot",{method:"GET",path:rn,...e?{signal:e}:{}});return n.ok?ok(E(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return un("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=P(l.value);return i===null?pn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return un("slotId is required");let r=await t.send("televet.booking.release_hold",{method:"DELETE",path:televetHoldCall(n)},{idempotent:false,maxAttempts:1});return!r.ok&&r.error.httpStatus!==404?err(r.error):ok(void 0)},async book(e,r){let l=validateBookingBody(e);if(l!==null)return un(l);let i=r.trim();if(i.length===0)return un("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:ln,body:gn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(vt(o.error));let a=R(o.value);return a===null?pn("the booking response was unreadable"):u(a)?ok(a):(fn(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(gt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("slotId is required");let o=await t.send("televet.booking.reschedule",{method:"POST",path:televetRescheduleCall(l),body:{new_slot_id:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=R(o.value);return a===null?pn("the reschedule response was unreadable"):ok(a)},async triage(e,r){let l=e.trim();if(l.length===0)return ok(null);let i=await t.send("televet.booking.triage",{method:"POST",path:cn,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(D(i.value)):(fn(n,"televet.booking.triage_unavailable",{status:i.error.httpStatus??null}),ok(null))},async listConsults(e){let n=await t.send("televet.booking.consults",{method:"GET",path:ln,query:{limit:String(dn)},...e?{signal:e}:{}});return n.ok?ok(S(yn(n.value,"consults"),R)):hn(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.consult",{method:"GET",path:televetConsultCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=R(l.value);return i===null?pn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return un("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return fn(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?pn("the join response carried no usable room credential"):ok(i)},async cancelConsult(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return un("consultId is required");if(i.length===0)return un("reason is required");if(i.length>F)return un(`reason must be at most ${F} characters`);let o=await t.send("televet.booking.cancel",{method:"POST",path:televetCancelCall(l),body:{reason:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return fn(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=L(o.value);return a===null?pn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:sn,body:{filename:e.filename,content_type:e.contentType,file_size:e.fileSize},...n?{signal:n}:{}});if(!r.ok)return err(r.error);let l=pt(r.value);return l===null?pn("the attachment presign was unreadable"):ok(l)}}}function gn(e){let t=e.cancellation_policy_version?.trim()??"",n=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,...n?{state_attested:true,cancellation_policy_version:t}:{}}}function yn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let n=e,r=n[t]??n.items??n.data;if(Array.isArray(r))return r}return e}function unwrap(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e,r=n[t]??n.data;if(typeof r=="object"&&r!==null)return r}return e}var bn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),vn=globalThis,xn=vn[bn]??(vn[bn]=e.createContext(null));xn.displayName??="EverfurContext";function Tn(){let t=e.useContext(xn);if(t===null)throw new ke("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var kn=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return kn[e]}function decideCapability(e,t,n){let r=requires(e),l=/* @__PURE__ */new Map;for(let e of t)l.set(e.resource,e);if(n?.isPending===true&&r.some(e=>!l.has(e)))return jn({name:e,enabled:false,isPending:true,limits:{}});let i=wn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?jn({name:e,enabled:true,isPending:false,limits:i}):jn({name:e,enabled:false,isPending:false,limits:i,disabled:Sn(r,l)})}function wn(e,t){let n={};for(let r of e){let e=t.get(r)?.limits;if(e)for(let[t,r]of Object.entries(e)){let e=n[t];n[t]=e===void 0?r:Math.min(e,r)}}return n}function Sn(e,t){for(let n of e){let e=t.get(n)?.disabled;if(e)/* @__PURE__ */
22
+ return Object.freeze({kind:"failed"})}function Ct(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function isSafeRoomUrl(e){return Re(e.trim())?.protocol==="https:"}function isUsableRoomCredential(e,t){return isSafeRoomUrl(e)&&t.trim().length>0}function _t(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=t?e:null}function It(e){if(!Ct(e))return null;let t=_t(e.consult_minutes,1),n=_t(e.auto_end_minutes,0),r=_t(e.warn_before_seconds,0);return t===null||n===null||r===null?null:/* @__PURE__ */Object.freeze({consultMinutes:t,autoEndMinutes:n,warnBeforeSeconds:r})}function parseVetCallCredential(e){if(!Ct(e))return null;let t=e.room_url??e.url,n=e.token;if(typeof t!="string"||typeof n!="string"||!isUsableRoomCredential(t,n))return null;let r=e.recording_notice;/* @__PURE__ */
23
+ return Object.freeze({roomUrl:t.trim(),token:n,recordingNotice:typeof r=="boolean"?r:true,callLimits:It(e.call_limits)})}function vetCallJoinReason(e){let t=Et(e.raw);return t!==null&&t.length>0?t:null}function Et(e){if(!Ct(e))return null;let t=e.detail??e.error,n=(Ct(t)?t:e).reason;return typeof n=="string"?n:null}function vetCallJoinRefusal(e){if(e.httpStatus===404)return"unavailable";let t=Et(e.raw);return t==="too_early"||t==="too_late"||t==="room_not_ready"?t:t!==null&&t.startsWith("status_")?"not_joinable":"unknown"}var Dt="/widget/v1/televet",Pt=`${Dt}/messages/threads`;function televetThreadMessagesCall(petRef){return`${Pt}/${encodeURIComponent(petRef)}/messages`}function televetThreadReadCall(petRef){return`${Pt}/${encodeURIComponent(petRef)}/read`}function televetVisitSummaryCall(e){return`${Dt}/consults/${encodeURIComponent(e)}/summary`}var Rt=4e3,zt=50,Ft=100,Lt=/* @__PURE__ */n.z.string().min(1).refine(e=>!Number.isNaN(Date.parse(e))),At=/* @__PURE__ */n.z.string().nullish(),Ot=/* @__PURE__ */n.z.object({message_id:/* @__PURE__ */n.z.string().min(1),pet_ref:/* @__PURE__ */n.z.string().min(1),role:/* @__PURE__ */n.z.enum(["owner","vet","system"]),content:/* @__PURE__ */n.z.string(),created_at:Lt,sender:/* @__PURE__ */n.z.object({display_name:At,specialty:At}).nullish(),sender_display_name:At,attachment_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}),Vt=/* @__PURE__ */n.z.object({pet_ref:/* @__PURE__ */n.z.string().min(1),last_message_at:Lt,unread_count:/* @__PURE__ */n.z.number().int().nonnegative().nullish(),owner_can_start:/* @__PURE__ */n.z.boolean().nullish(),last_message:/* @__PURE__ */Ot.nullish()}),Nt=/* @__PURE__ */n.z.object({drug:/* @__PURE__ */n.z.string().nullish(),strength:At,form:At,sig:At,quantity:/* @__PURE__ */n.z.union([/* @__PURE__ */n.z.string(),/* @__PURE__ */n.z.number()]).nullish(),refills:/* @__PURE__ */n.z.number().int().nonnegative().nullish()}).passthrough(),Bt=/* @__PURE__ */n.z.object({consult_id:/* @__PURE__ */n.z.string().min(1),findings_text:/* @__PURE__ */n.z.string().nullish(),next_steps_text:/* @__PURE__ */n.z.string().nullish(),medications:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.unknown()).nullish(),product_refs:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),action_items:/* @__PURE__ */n.z.array(/* @__PURE__ */n.z.string()).nullish(),approved_at:Lt,approved_by_display_name:At,credentials_text:At});function Mt(e){let t=e?.trim()??"";return t.length>0?t:null}function Ht(e){let t=e.role==="vet";/* @__PURE__ */
24
+ return Object.freeze({messageId:e.message_id,petRef:e.pet_ref,role:e.role,content:e.content,createdAt:e.created_at,senderName:t?Mt(e.sender?.display_name)??Mt(e.sender_display_name):null,senderSpecialty:t?Mt(e.sender?.specialty):null,attachmentCount:e.attachment_count??0})}function $t(e){let t=Ot.safeParse(e);return t.success?Ht(t.data):null}function Wt(e){let t=n.z.array(Ot).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(Ht)):null}function Ut(e){let t=n.z.array(Vt).safeParse(e);return t.success?/* @__PURE__ */Object.freeze(t.data.map(e=>/* @__PURE__ */Object.freeze({petRef:e.pet_ref,lastMessageAt:e.last_message_at,unreadCount:e.unread_count??0,ownerCanStart:e.owner_can_start??true,lastMessage:e.last_message?Ht(e.last_message):null}))):null}function qt(e){let t=Nt.safeParse(e);if(!t.success)return null;let n=Mt(t.data.drug);if(n===null)return null;let r=t.data.quantity;/* @__PURE__ */
25
+ return Object.freeze({drug:n,strength:Mt(t.data.strength),form:Mt(t.data.form),sig:Mt(t.data.sig),quantity:r==null?null:Mt(String(r)),refills:t.data.refills??null})}function Kt(e){let t=Bt.safeParse(e);if(!t.success)return null;let n=t.data;/* @__PURE__ */
26
+ return Object.freeze({consultId:n.consult_id,findingsText:n.findings_text??"",nextStepsText:n.next_steps_text??"",medications:/* @__PURE__ */Object.freeze((n.medications??[]).map(qt).filter(e=>e!==null)),productRefs:/* @__PURE__ */Object.freeze([...n.product_refs??[]]),actionItems:/* @__PURE__ */Object.freeze((n.action_items??[]).filter(e=>e.trim().length>0)),approvedAt:n.approved_at,approvedByName:Mt(n.approved_by_display_name),credentialsText:Mt(n.credentials_text)})}function isVetMessagesDark(e){return e.httpStatus===404}function isVetThreadVetFirst(e){return e.httpStatus===409}function Yt(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function Gt(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function Jt(e){return e===void 0||!Number.isFinite(e)?zt:Math.min(Ft,Math.max(1,Math.trunc(e)))}function Qt(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))}function Xt(e,t,n){try{e?.track(t,n)}catch{}}function Zt(e,t){return{async listVetThreads(t){let n=await e.send("televet.messages.threads",{method:"GET",path:Pt,...t?{signal:t}:{}});if(!n.ok)return err(n.error);let r=Ut(n.value);return r===null?Gt("the vet thread list was unreadable"):ok(r)},async listVetMessages(petRef,t={},n){let r=petRef.trim();if(r.length===0)return Yt("petRef is required");let l=t.before?.trim();if(l!==void 0&&l.length>0&&!Qt(l))return Yt("before must be an ISO date-time");let i=await e.send("televet.messages.thread",{method:"GET",path:televetThreadMessagesCall(r),query:{...l?{before:l}:{},limit:Jt(t.limit)},...n?{signal:n}:{}});if(!i.ok)return err(i.error);let o=Wt(i.value);return o===null?Gt("the vet thread page was unreadable"):ok(o)},async sendVetMessage(petRef,n){let r=petRef.trim();if(r.length===0)return Yt("petRef is required");if(n.trim().length===0)return Yt("content must not be blank");if(n.length>Rt)return Yt(`content must be at most ${Rt} characters`);let l=await e.send("televet.messages.send",{method:"POST",path:televetThreadMessagesCall(r),body:{content:n}},{idempotent:false,maxAttempts:1});if(!l.ok)return Xt(t,"televet.messages.send_failed",{status:l.error.httpStatus??null}),err(l.error);let i=$t(l.value);return i===null?Gt("the sent message was unreadable"):ok(i)},async markVetThreadRead(petRef,t){let n=petRef.trim();if(n.length===0)return Yt("petRef is required");if(!Qt(t))return Yt("readAt must be an ISO date-time");let r=await e.send("televet.messages.read",{method:"PUT",path:televetThreadReadCall(n),body:{read_at:t}});return r.ok?ok(void 0):err(r.error)},async visitSummary(t,n){let r=t.trim();if(r.length===0)return Yt("consultId is required");let l=await e.send("televet.messages.summary",{method:"GET",path:televetVisitSummaryCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=Kt(l.value);return i===null?Gt("the visit summary was unreadable"):ok(i)}}}var en="/widget/v1/televet",tn=`${en}/state-policy`,nn=`${en}/vets`,rn=`${en}/slots`,ln=`${en}/slots/next`,on=`${en}/consults`,an=`${en}/entitlement`,sn=`${en}/cancellation-policy`,cn=`${en}/attachments/initiate`,dn=`${on}/triage`;function televetHoldCall(e){return`${rn}/${encodeURIComponent(e)}/hold`}function televetRescheduleCall(e){return`${on}/${encodeURIComponent(e)}/reschedule`}function televetConsultCall(e){return`${on}/${encodeURIComponent(e)}`}function televetJoinCall(e){return`${televetConsultCall(e)}/join`}function televetCancelCall(e){return`${televetConsultCall(e)}/cancel`}var un=100;function pn(e){return err(makeEverfurError("validationFailed",{retryable:false,wireMessage:e}))}function hn(e){return err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:e}))}function fn(e){return e.httpStatus===404}function mn(e,t,n){try{e?.track(t,n)}catch{}}function validateBookingBody(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(!isWellFormedStateCode(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>b?`reason_text must be at most ${b} characters`:gn(e)}function gn(e){let t=e.state_attested===true,n=e.cancellation_policy_version?.trim()??"";return t!==n.length>0?"state_attested and cancellation_policy_version must be sent together or omitted together":n.length>g?`cancellation_policy_version must be at most ${g} characters`:null}function createTelevetBookingController(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=e.telemetry;return{...Zt(t,n),async statePolicy(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return pn("state must be a two-letter US state code");let l=await t.send("televet.booking.state_policy",{method:"GET",path:`${tn}/${encodeURIComponent(r)}`,...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=C(l.value,r);return i===null?hn("the state policy response was unreadable"):ok(i)},async entitlement(e){let n=await t.send("televet.booking.entitlement",{method:"GET",path:an,...e?{signal:e}:{}});return n.ok?ok(F(n.value)):err(n.error)},async cancellationPolicy(e){let n=await t.send("televet.booking.cancellation_policy",{method:"GET",path:sn,...e?{signal:e}:{}});return n.ok?ok(_(n.value)):ok(null)},async clinicians(e,n){let r=e.trim();if(!isWellFormedStateCode(r))return pn("state must be a two-letter US state code");let l=await t.send("televet.booking.clinicians",{method:"GET",path:nn,query:{state:r},...n?{signal:n}:{}});return l.ok?ok(j(yn(l.value,"vets"),I)):fn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async slots(e,n){let r=e.trim();if(r.length===0)return pn("clinicianId is required");let l=await t.send("televet.booking.slots",{method:"GET",path:rn,query:{clinician_id:r},...n?{signal:n}:{}});return l.ok?ok(j(yn(l.value,"slots"),D)):fn(l.error)?ok(/* @__PURE__ */Object.freeze([])):err(l.error)},async nextSlot(e){let n=await t.send("televet.booking.next_slot",{method:"GET",path:ln,...e?{signal:e}:{}});return n.ok?ok(D(unwrap(n.value,"slot"))):ok(null)},async holdSlot(e){let r=e.trim();if(r.length===0)return pn("slotId is required");let l=await t.send("televet.booking.hold",{method:"POST",path:televetHoldCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return mn(n,"televet.booking.hold_failed",{status:l.error.httpStatus??null}),err(l.error);let i=R(l.value);return i===null?hn("the hold response carried no usable expiry"):ok(i)},async releaseHold(e){let n=e.trim();if(n.length===0)return pn("slotId is required");let r=await t.send("televet.booking.release_hold",{method:"DELETE",path:televetHoldCall(n)},{idempotent:false,maxAttempts:1});return!r.ok&&r.error.httpStatus!==404?err(r.error):ok(void 0)},async book(e,r){let l=validateBookingBody(e);if(l!==null)return pn(l);let i=r.trim();if(i.length===0)return pn("idempotencyKey is required");let o=await t.send("televet.booking.book",{method:"POST",path:on,body:bn(e)},{idempotent:true,idempotencyKey:i,maxAttempts:1});if(!o.ok)return mn(n,"televet.booking.book_failed",{status:o.error.httpStatus??null}),err(xt(o.error));let a=z(o.value);return a===null?hn("the booking response was unreadable"):p(a)?ok(a):(mn(n,"televet.booking.book_failed",{status:null,consult_status:a.status}),err(bt(a.status)))},async reschedule(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return pn("consultId is required");if(i.length===0)return pn("slotId is required");let o=await t.send("televet.booking.reschedule",{method:"POST",path:televetRescheduleCall(l),body:{new_slot_id:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return mn(n,"televet.booking.reschedule_failed",{status:o.error.httpStatus??null}),err(o.error);let a=z(o.value);return a===null?hn("the reschedule response was unreadable"):ok(a)},async triage(e,r){let l=e.trim();if(l.length===0)return ok(null);let i=await t.send("televet.booking.triage",{method:"POST",path:dn,body:{reason_text:l},...r?{signal:r}:{}},{idempotent:false,maxAttempts:1});return i.ok?ok(P(i.value)):(mn(n,"televet.booking.triage_unavailable",{status:i.error.httpStatus??null}),ok(null))},async listConsults(e){let n=await t.send("televet.booking.consults",{method:"GET",path:on,query:{limit:String(un)},...e?{signal:e}:{}});return n.ok?ok(j(yn(n.value,"consults"),z)):fn(n.error)?ok(/* @__PURE__ */Object.freeze([])):err(n.error)},async getConsult(e,n){let r=e.trim();if(r.length===0)return pn("consultId is required");let l=await t.send("televet.booking.consult",{method:"GET",path:televetConsultCall(r),...n?{signal:n}:{}});if(!l.ok)return err(l.error);let i=z(l.value);return i===null?hn("the consult response was unreadable"):ok(i)},async joinConsult(e){let r=e.trim();if(r.length===0)return pn("consultId is required");let l=await t.send("televet.booking.join",{method:"POST",path:televetJoinCall(r)},{idempotent:false,maxAttempts:1});if(!l.ok)return mn(n,"televet.booking.join_failed",{status:l.error.httpStatus??null}),err(l.error);let i=parseVetCallCredential(l.value);return i===null?hn("the join response carried no usable room credential"):ok(i)},async cancelConsult(e,r){let l=e.trim(),i=r.trim();if(l.length===0)return pn("consultId is required");if(i.length===0)return pn("reason is required");if(i.length>L)return pn(`reason must be at most ${L} characters`);let o=await t.send("televet.booking.cancel",{method:"POST",path:televetCancelCall(l),body:{reason:i}},{idempotent:false,maxAttempts:1});if(!o.ok)return mn(n,"televet.booking.cancel_failed",{status:o.error.httpStatus??null}),err(o.error);let a=A(o.value);return a===null?hn("the cancel response was unreadable"):ok(a)},async initiateAttachment(e,n){let r=await t.send("televet.booking.attachment_initiate",{method:"POST",path:cn,body:{filename:e.filename,content_type:e.contentType,file_size:e.fileSize},...n?{signal:n}:{}});if(!r.ok)return err(r.error);let l=ht(r.value);return l===null?hn("the attachment presign was unreadable"):ok(l)}}}function bn(e){let t=e.cancellation_policy_version?.trim()??"",n=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,...n?{state_attested:true,cancellation_policy_version:t}:{}}}function yn(e,t){if(Array.isArray(e))return e;if(typeof e=="object"&&e!==null){let n=e,r=n[t]??n.items??n.data;if(Array.isArray(r))return r}return e}function unwrap(e,t){if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let n=e,r=n[t]??n.data;if(typeof r=="object"&&r!==null)return r}return e}var vn=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurContext@v1"),xn=globalThis,Tn=xn[vn]??(xn[vn]=e.createContext(null));Tn.displayName??="EverfurContext";function kn(){let t=e.useContext(Tn);if(t===null)throw new we("not-initialized","Everfur hooks must be called inside <EverfurProvider>. Wrap your tree once, high.");return t}var wn=/* @__PURE__ */Object.freeze({chat:/* @__PURE__ */Object.freeze(["chat.message.create"]),records:/* @__PURE__ */Object.freeze(["records.upload.create","records.record.read"]),recordsClinic:/* @__PURE__ */Object.freeze(["records.clinic.create"]),video:/* @__PURE__ */Object.freeze(["video.gait.execute"]),photo:/* @__PURE__ */Object.freeze(["photo.checkup.execute"]),animations:/* @__PURE__ */Object.freeze(["animations.state.read"]),televet:/* @__PURE__ */Object.freeze(["televet.visit.create"]),texting:/* @__PURE__ */Object.freeze(["sms.identity.read","sms.identity.update"]),healthPlan:/* @__PURE__ */Object.freeze(["shop.plan.read","shop.plan.update"])});function requires(e){return wn[e]}function decideCapability(e,t,n){let r=requires(e),l=/* @__PURE__ */new Map;for(let e of t)l.set(e.resource,e);if(n?.isPending===true&&r.some(e=>!l.has(e)))return Cn({name:e,enabled:false,isPending:true,limits:{}});let i=Sn(r,l);return r.filter(e=>l.get(e)?.granted!==true).length===0?Cn({name:e,enabled:true,isPending:false,limits:i}):Cn({name:e,enabled:false,isPending:false,limits:i,disabled:jn(r,l)})}function Sn(e,t){let n={};for(let r of e){let e=t.get(r)?.limits;if(e)for(let[t,r]of Object.entries(e)){let e=n[t];n[t]=e===void 0?r:Math.min(e,r)}}return n}function jn(e,t){for(let n of e){let e=t.get(n)?.disabled;if(e)/* @__PURE__ */
27
27
  return Object.freeze({reason:e.reason,level:e.level,recoverable:e.recoverable})}/* @__PURE__ */
28
- return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function jn(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(t){let{runtime:n}=Tn(),r=n.entitlements,l=e.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return e.useMemo(()=>decideCapability(t,l.decisions,{isPending:l.isPending}),[t,l])}var Cn=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),_n=60;var In=/* @__PURE__ */Object.freeze({title:Cn.rate_limited.title,body:Cn.rate_limited.body});function En(e){return e!=null&&(e.code==="rateLimited"||e.httpStatus===429)}function Dn(e,t){return Ge(e,t)??_n*1e3}function Pn(t){let n=En(t),[r,l]=e.useState(null);return e.useEffect(()=>{if(!n||t==null)return;let e=setTimeout(()=>l(t),Dn(t,Date.now()));return()=>clearTimeout(e)},[t,n]),{rateLimited:n,waiting:n&&r!==t}}var Rn=3e4;function zn(e={}){let t=e.now??Date.now,n=/* @__PURE__ */new Map,r=e=>e!==void 0&&e.settled!==null&&t()<e.keptUntil?e.settled:null,l=(e,t,r)=>{let l=t.promise;t.waiters+=1;let i=()=>{t.waiters-=1,t.waiters===0&&t.promise!==null&&(t.abort.abort(),n.get(e)===t&&n.delete(e))};return r.aborted?(i(),l):(r.addEventListener("abort",i,{once:true}),l.finally(()=>r.removeEventListener("abort",i)))},i=(e,r,l,i)=>{if(r.promise=null,n.get(e)!==r||r.abort.signal.aborted){n.get(e)===r&&n.delete(e);return}l.ok&&i>0?(r.settled=l,r.keptUntil=t()+i):!l.ok&&En(l.error)?(r.settled=l,r.keptUntil=t()+Dn(l.error,t())):n.delete(e)};/* @__PURE__ */
29
- return Object.freeze({read(e,t,o){let a=n.get(e);if(a?.promise)return l(e,a,o.signal);let s=r(a);if(s!==null&&(o.force!==true||!s.ok&&En(s.error)))return Promise.resolve(s);let c={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,c),c.promise=t(c.abort.signal).then(t=>(i(e,c,t,o.freshMs),t),t=>{throw c.promise=null,n.get(e)===c&&n.delete(e),t}),l(e,c,o.signal)},peek(e){return r(n.get(e))},invalidate(e){for(let t of[...n.keys()])e.some(e=>t.startsWith(e))&&n.delete(t)}})}var Fn=/* @__PURE__ */new WeakMap;function Ln(e){let t=Fn.get(e);return t===void 0&&(t=zn(),Fn.set(e,t)),t}var An=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),On=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function Vn(e,t){Fn.get(e)?.invalidate(t)}function useTelevetBookingController(t){let{runtime:n,userRef:userRef,scopeEpoch:r}=Tn();return e.useMemo(()=>t||(userRef===null?null:Bn(n,`${userRef}\0${r}`,()=>{let{services:e}=n.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[n,userRef,r,t])}var Nn=/* @__PURE__ */new WeakMap;function Bn(e,t,n){let r=Nn.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return Nn.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=Tn(),t=useCapability("televet");return e.useMemo(()=>({available:t.enabled&&userRef!==null,isPending:t.isPending}),[t.enabled,t.isPending,userRef])}function Mn(t,n,r,l,i=Rn,o=false){let[a,s]=e.useState(()=>{let e=n&&r!==null&&l!==null&&!o?Ln(l).peek(t):null;return e!==null?e.ok?{key:t,data:e.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:e.error}:{key:t,data:null,isPending:n&&r!==null,error:null}}),[c,d]=e.useState(0),u=e.useRef(r);u.current=r;let p=e.useRef(l);p.current=l;let h=e.useRef(o);e.useEffect(()=>{let e=u.current;if(!n||e===null){s({key:t,data:null,isPending:false,error:null});return}let r=h.current;h.current=false;let l=p.current===null?null:Ln(p.current),o=r||l===null?null:l.peek(t);if(o!==null){s(o.ok?{key:t,data:o.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:o.error});return}let a=new AbortController,c=true;return s(e=>e.key===t?{...e,isPending:true,error:null}:{key:t,data:null,isPending:true,error:null}),(async()=>{let n;try{n=l===null?await e(a.signal):await l.read(t,e,{signal:a.signal,freshMs:i,force:r})}catch{c&&s({key:t,data:null,isPending:false,error:null});return}c&&(n.ok?s({key:t,data:n.value,isPending:false,error:null}):s({key:t,data:null,isPending:false,error:n.error}))})(),()=>{c=false,a.abort()}},[t,n,c]);let f=e.useCallback(()=>{h.current=true,d(e=>e+1)},[]),m=a.key===t;return e.useMemo(()=>({enabled:n,data:m?a.data:null,isPending:n&&(!m||a.isPending),isError:m&&a.error!==null,error:m?a.error:null,refetch:f}),[n,m,a.data,a.isPending,a.error,f])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return Mn(`state-policy:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetBookingEntitlement(e){let t=e?.entitlement!==void 0,n=e?.entitlement;return Mn("entitlement",t,t&&n?t=>n.call(e,t):null,e,0)}function useTelevetCancellationPolicy(e){let t=e?.cancellationPolicy!==void 0,n=e?.cancellationPolicy;return Mn("cancellation-policy",t,t&&n?t=>n.call(e,t):null,e)}function useTelevetClinicians(e,t){let n=e?.trim()??"",r=t?.clinicians!==void 0&&isWellFormedStateCode(n),l=t?.clinicians;return Mn(`clinicians:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetSlots(e,t){let n=e?.trim()??"",r=t!==null&&n.length>0;return Mn(`slots:${n}`,r,r&&t?e=>t.slots(n,e):null,t)}function useTelevetNextSlot(e){let t=e?.nextSlot!==void 0,n=e?.nextSlot;return Mn("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function Hn(t){let[n,r]=e.useState(null),l=e.useRef(true),i=e.useRef(false),o=e.useRef(t);o.current=t,e.useEffect(()=>(l.current=true,()=>{l.current=false}),[]);let a=e.useCallback((...e)=>{let t=o.current;if(t===null||i.current)return;let n=e[e.length-1],a=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),s=a?n:void 0,c=a?e.slice(0,-1):e;i.current=true,r({variables:c[0]??null}),(async()=>{let e=null;try{e=await t(...c)}catch{e=null}i.current=false,l.current&&r(null),e!==null&&(e.ok?s?.onSuccess?.(e.value):s?.onError?.(e.error))})()},[]);return e.useMemo(()=>({isPending:n!==null,variables:n?.variables??null,mutate:a}),[n,a])}async function $n(e,t,n){let r=await n;return r.ok&&Vn(e,t),r}function useTelevetHoldSlot(e){return Hn(e?t=>$n(e,An,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return Hn(e?(t,n)=>$n(e,On,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return Hn(t&&e?n=>$n(t,On,t.reschedule(e,n)):null)}function Wn(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return Mn(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,Rn,n?.reread===true)}function Un(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return Mn(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function qn(e,t){let n=t?.cancelConsult;return Hn(t&&n&&e?r=>$n(t,On,n.call(t,e,r)):null)}function Kn(e){return e.error!==null&&e.error.httpStatus===404}function Yn(e){let t=Wn(e);if(!t.enabled)return"booking";if(t.isPending)return"pending";if(t.isError)return"visits";let{upcoming:n,past:r}=splitTelevetVisits(t.data??[],Date.now());return n.length>0||r.length>0?"visits":"booking"}var Gn=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let n=e.type,r=n.families[t];return t==="mono"||n.namedFaces[t]?{fontFamily:r}:{fontFamily:r,fontWeight:n.weight[Gn[t]]}}function headingFace(e,t="bold"){let{headingFamily:n,headingWeight:r}=e.type;if(n===null&&r===null)return face(e,t);if(n!==null)return{fontFamily:n,fontWeight:r??e.type.weight[Gn[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function Jn(e){return e<=450?"regular":e<=650?"medium":"bold"}var Qn={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=Xn.get(e);n===void 0&&(n=/* @__PURE__ */new Map,Xn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=Zn(e,t);return n.set(t,l),l}var Xn=/* @__PURE__ */new WeakMap;function Zn(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=Jn(Number(r)),i=n.face==="mono"?face(e,Qn[l]):n.face==="heading"?headingFace(e,l):face(e,l),o=n.face==="heading"?e.type.headingWeight??r:r,a=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=n.size,c={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(c.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(c.textTransform="uppercase"),/* @__PURE__ */Object.freeze(c)}var er=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var tr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){tr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var nr=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var rr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},lr={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},ir={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},or={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},ar={regular:"400",medium:"500",bold:"700"},sr={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},cr=0,dr="System",ur="monospace",pr=["content","heading","control","compact","badge"];function hr(e){let t={};for(let n of pr)t[n]=e;return t}var fr=[];function mr(){return{family:dr,mono:ur,fontUrl:null,families:{regular:dr,medium:dr,bold:dr,mono:ur,monoMedium:ur,monoBold:ur},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:ir,tierSizes:hr(ir),lineHeight:or,weight:ar,letterSpacing:sr,scale:1,maxScale:cr,scaleCaps:nr,headingFamily:null,headingWeight:null,fontSources:fr,roles:er,typeScale:1}}var gr={},yr=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var br={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(yr.standard),emphasized:cssCubicBezier(yr.emphasized),exit:cssCubicBezier(yr.exit)},reducedMotion:false},vr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},xr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:vr,space:rr,radius:lr,type:mr(),motion:br,slots:gr}),Tr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:Tr,space:rr,radius:lr,type:mr(),motion:br,slots:gr});var kr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),wr=globalThis,Sr=wr[kr]??(wr[kr]=e.createContext(xr));Sr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(Sr)}function jr(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:n,variant:r,...l}){let i=useEverfurTheme(),o=r===void 0?void 0:i.type.roles[r],a=jr(i.type,n??o?.tier??"content"),s=r===void 0?l:{...l,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},l.style]};return e.createElement(t.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var Cr=e.forwardRef(function(n,r){return e.createElement(t.TextInput,{...n,...r===null?{}:{ref:r}})});var _r=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:n,resetKey:r}){return e.createElement(_r,{fallback:n,resetKey:r,children:e.createElement(RenderHost,{render:t})})}var Ir=48;function Er(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=t,s=useCapability(n),c=e.useMemo(()=>Er(s),[s]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */r.jsx(HostRender,{render:o,fallback:/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */r.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */r.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */r.jsx(OffState,{decision:s,style:a});default:return assertNever(c)}}function PendingSkeleton({capability:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Dr(i),[i]);/* @__PURE__ */
30
- return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${n}`,children:/* @__PURE__ */r.jsx(t.View,{style:o.skeletonBar})})}function OffState({decision:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Dr(i),[i]),a=n.disabled?.reason??"";/* @__PURE__ */
31
- return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */r.jsx(Text,{style:o.offstateText,children:a}):null})}function Dr(e){let{color:n,space:r,radius:l,type:i}=e;return t.StyleSheet.create({offstate:{minHeight:Ir,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:n.surfaceCream,borderRadius:l.md,borderWidth:t.StyleSheet.hairlineWidth,borderColor:n.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:n.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:n.brandSofter}})}function Pr(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1}else if(n>=56320&&n<=57343)return true}return false}function Rr(e){return[...e].length}var zr=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(zr,t)?zr[t]:null}var Fr=50,Lr=128,Ar=120,Or=120,Vr=2e3,Nr=120,Br=80,Mr=/* @__PURE__ */new Set(["male","female","unknown"]),Hr=/* @__PURE__ */new Set(["day","month","year"]),$r=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Wr=/* @__PURE__ */new Set(["indoor","outdoor","both"]),Ur=/* @__PURE__ */new Set(["mild","moderate","severe"]),qr=/^(\d{4})-(\d{2})-(\d{2})$/,Kr=[["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"]],Yr=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Kr,...Yr].map(([e])=>e));function Gr(e){let t=qr.exec(e);if(t===null)return false;let[n,r,l]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(n,r-1,l));return i.getUTCFullYear()===n&&i.getUTCMonth()===r-1&&i.getUTCDate()===l}var Jr=e=>(t,n)=>typeof n=="string"&&e.has(n)?null:`${t} must be one of ${[...e].join(", ")}`,Qr=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Xr=(e,t)=>typeof t=="string"&&Gr(t)?null:`${e} must be a real date written YYYY-MM-DD`,Zr=(e,t={})=>(n,r)=>{if(typeof r!="string")return`${n} must be a string`;if(Pr(r))return`${n} contains an unpaired surrogate and cannot be encoded`;let l=t.trimmed?r.trim():r;if(t.required&&l.length===0)return`${n} is required and must not be blank`;let i=Rr(l);return i<=e?null:`${n} is ${i} characters; the server accepts at most ${e}`},el={sex:Jr(Mr),spayedNeutered:Qr,birthDate:Xr,birthDatePrecision:Jr(Hr),activityLevel:Jr($r),indoorOutdoor:Jr(Wr),foodBrand:Zr(Nr),foodType:Zr(Nr),microchipId:Zr(Br)},tl=["ref","ref",false,Zr(Lr,{required:true,trimmed:true})],nl=["notes","notes",false,Zr(Vr,{trimmed:true})],rl=[tl,["name","name",true,Zr(Ar,{required:true,trimmed:true})],["dose","dose",false,Zr(Or,{trimmed:true})],["frequency","frequency",false,Zr(Or,{trimmed:true})],["startDate","start_date",false,Xr],["endDate","end_date",false,Xr],nl],ll={allergies:[tl,["allergen","allergen",true,Zr(Ar,{required:true,trimmed:true})],["severity","severity",false,Jr(Ur)],nl],medications:rl,supplements:rl,conditions:[tl,["conditionName","condition_name",true,Zr(Ar,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Xr],nl]};function il(e,t,n){let r=`${e}[${t}]`;if(typeof n!="object"||n===null||Array.isArray(n))return{error:`${r} must be an object`};let l=n,i={};for(let[t,n,o,a]of ll[e]){let e=l[t];if(e==null){if(o)return{error:`${r}.${t} is required`};e===null&&(i[n]=null);continue}let s=a(`${r}.${t}`,e);if(s!==null)return{error:s};i[n]=e}let o=i.start_date,a=i.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${r}.endDate must not be before startDate`}:{item:i}}function ol(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>Fr)return{error:`${e} has ${t.length} items; the server accepts at most ${Fr}`};let n=[],r=/* @__PURE__ */new Set;for(let l=0;l<t.length;l+=1){let i=il(e,l,t[l]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(r.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};r.add(t)}n.push(i.item)}return{items:n}}function al(e,t){let n=e,r={};for(let[e,t]of Kr){let l=n[e];if(l!==void 0){if(l!==null){let t=el[e](e,l);if(t!==null)return{error:t}}r[t]=l}}let l=n.birthDate!==void 0,i=n.birthDatePrecision!==void 0;if(l!==i||l&&n.birthDate===null!=(n.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Yr){let l=n[e];if(l===void 0)continue;let i=ol(e,l);if("error"in i)return i;r[t]=i.items}return Object.keys(r).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:r}}var sl=e=>typeof e=="string"?e:null,cl=(e,t)=>typeof t=="string"&&e.has(t)?t:null,dl=e=>typeof e=="boolean"?e:null;function ul(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let n=t(e);return n===null?[]:[n]})):/* @__PURE__ */Object.freeze([])}function pl(e){let t=sl(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),name:t,dose:sl(e.dose),frequency:sl(e.frequency),startDate:sl(e.start_date),endDate:sl(e.end_date),notes:sl(e.notes)})}function hl(e){let t=e.profile_version;/* @__PURE__ */
32
- return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:cl(Mr,e.sex),spayedNeutered:dl(e.spayed_neutered),birthDate:sl(e.birth_date),birthDatePrecision:cl(Hr,e.birth_date_precision),activityLevel:cl($r,e.activity_level),indoorOutdoor:cl(Wr,e.indoor_outdoor),foodBrand:sl(e.food_brand),foodType:sl(e.food_type),microchipId:sl(e.microchip_id),allergies:ul(e.allergies,e=>{let t=sl(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),allergen:t,severity:cl(Ur,e.severity),notes:sl(e.notes)})}),medications:ul(e.medications,pl),supplements:ul(e.supplements,pl),conditions:ul(e.conditions,e=>{let t=sl(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:sl(e.ref),conditionName:t,diagnosedDate:sl(e.diagnosed_date),notes:sl(e.notes)})})})}var fl=100,ml=50,gl=100,yl=50,bl=500,vl=128,xl=6e4;function Tl(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function kl(e,t,n){if(typeof t!="string")return Tl(`${e} must be a string`);let r=Rr(t);return r<=n?null:Tl(`${e} is ${r} characters; the server accepts at most ${n}`)}function wl(e,t,n){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=n?null:Tl(`${e} must be a finite number between 0 and ${n}`)}function Sl(petRef,e){if(typeof petRef!="string")return Tl("pet_ref must be a string");if(petRef.trim().length===0)return Tl("pet_ref must not be blank");if(Pr(petRef))return Tl("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return Tl("profile must be an object");let t=[kl("pet_ref",petRef,vl)];return e?.name!==void 0&&t.push(kl("name",e.name,fl)),e?.species!==void 0&&t.push(kl("species",e.species,ml)),e?.breed!==void 0&&t.push(kl("breed",e.breed,gl)),e?.ageYears!==void 0&&t.push(wl("age_years",e.ageYears,yl)),e?.weightKg!==void 0&&t.push(wl("weight_kg",e.weightKg,bl)),t.find(e=>e!==null)??null}function jl(e,t){let n=al(e,t);return"error"in n?{error:Tl(n.error)}:n}function Cl(e){if(typeof e!="object"||e===null)return{error:Tl("patch must be an object")};let t=e,n=[["name","name",e=>kl("name",e,fl)],["species","species",e=>kl("species",e,ml)],["breed","breed",e=>kl("breed",e,gl)],["ageYears","age_years",e=>wl("age_years",e,yl)],["weightKg","weight_kg",e=>wl("weight_kg",e,bl)]],r={};for(let[e,l,i]of n){let n=t[e];if(n!==void 0){if(n!==null){let e=i(n);if(e!==null)return{error:e}}r[l]=n}}let l=jl(t,t.species);return"error"in l?l:(Object.assign(r,l.body),Object.keys(r).length===0?{error:Tl("patch must change at least one field")}:{body:r})}function _l(e){if(e==null)return{body:{}};let t=jl(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}}}var Il=e=>typeof e=="string"?e:null,El=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function Dl(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
33
- return Object.freeze({petRef:Il(t.pet_ref)??petRef,name:Il(t.name),species:Il(t.species),breed:Il(t.breed),ageYears:El(t.age_years),weightKg:El(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=Il(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:Il(t.pet_id),petRef:petRef,name:Il(t.name),species:Il(t.species),breed:Il(t.breed),ageYears:El(t.age_years),weightKg:El(t.weight_kg),updatedAt:Il(t.updated_at)})}function Pl(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...hl(e)})}function Rl(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];/* @__PURE__ */
34
- return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return zl(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:xl}))}function zl(e,t=e){let n=(e,t)=>t?{...e,signal:t}:e,r=petRef=>Sl(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(t){let r=await e.send("pets.list",n({method:"GET",path:"/widget/v1/pets"},t?.signal));return r.ok?ok(Rl(r.value)):err(r.error)},async registerPet(petRef,t,n){let r=Sl(petRef,t);if(r!==null)return err(r);let l=_l(t);if("error"in l)return err(l.error);let i={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:l.body},o=await e.send("pets.registerPet",n?.signal?{...i,signal:n.signal}:i);return o.ok?ok(Dl(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=r(petRef);if(typeof i!="string")return err(i);let o=Cl(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",n({method:"PATCH",path:i,body:o.body},l?.signal));return a.ok?ok(Dl(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.getPetProfile",n({method:"GET",path:`${l}/profile`},t?.signal));if(!i.ok)return err(i.error);let o=Pl(i.value);return o===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(o)},async deletePet(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.deletePet",n({method:"DELETE",path:l},t?.signal));return i.ok?ok(void 0):err(i.error)},async eraseUserData(e){let r=await t.send("pets.eraseUserData",n({method:"DELETE",path:"/widget/v1/me"},e?.signal),{maxAttempts:1});return r.ok?ok(void 0):err(r.error)}}}var Fl=/* @__PURE__ */new WeakMap;function Ll(e,t){let n=Fl.get(e);return n===void 0&&(n=/* @__PURE__ */new Set,Fl.set(e,n)),n.add(t),()=>{n?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:n,scopeEpoch:r}=Tn(),l=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,r]),[i,o]=e.useState({repository:l,pets:[],loading:true,error:null}),a=i.repository===l?i:{pets:[],loading:true,error:null},s=e.useRef(0),c=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:l,loading:true,error:null,pets:e.repository===l?e.pets:[]}));let t=await l.list();e===s.current&&o(t.ok?{repository:l,pets:t.value,loading:false,error:null}:e=>({repository:l,pets:e.repository===l?e.pets:[],loading:false,error:t.error}))},[l]);e.useEffect(()=>(c(),()=>{s.current+=1}),[c]),e.useEffect(()=>Ll(t,()=>{c()}),[t,c]);let d=e.useMemo(()=>n===null?null:a.pets.find(e=>e.petRef===n)??null,[n,a.pets]);return e.useMemo(()=>({pets:a.pets,activePet:d,loading:a.loading,error:a.error,refresh:c}),[a.pets,a.loading,a.error,d,c])}var Al=/* @__PURE__ */Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"ear-infections",label:"Ear problems"},{id:"upset-stomach",label:"Upset stomach"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks and heartworm"},{id:"joint-pain",label:"Joints and mobility"},{id:"eye-issues",label:"Eyes"},{id:"urinary",label:"Peeing and urinary"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-care",label:"Senior care"},{id:"wellness",label:"A wellness check-in"}].map(e=>/* @__PURE__ */Object.freeze(e))),Ol="other";function Vl(e){/* @__PURE__ */
35
- return Object.freeze([...Al/* @__PURE__ */,Object.freeze({id:Ol,label:ee.otherIssue})])}function Nl(e,t){let n=e.filter(e=>e.trim().length>0),r=t.trim();return n.length===0?r:r.length===0?n.join(", "):`${n.join(", ")}\n${r}`}var Bl=/* @__PURE__ */Object.freeze([["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["DC","District of Columbia"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]].map(([e,t])=>/* @__PURE__ */Object.freeze({code:e,name:t})));function Ml(e){let t=e?.trim().toUpperCase()??"";return Bl.find(e=>e.code===t)?.name??t}function Hl(e,t){return e?e.wellnessAvailable?e.prescriptionsAvailable?Z(ee.wherePrescribeMetaTemplate,{pet:t}):ee.whereWellnessMeta:ee.stateBlockedTitle:null}function $l(e,t,n,r){if(!e||!t||!n||!t.prescriptionsAvailable)return null;let l=n.trim().toUpperCase();return e.licensedStates.some(e=>e.state.trim().toUpperCase()===l&&e.canPrescribe)?Z(ee.whereLicensedTemplate,{vet:e.displayName,state:Ml(l),pet:r}):null}function Wl(t){let{hostState:n,state:r,policy:l,clinician:i,petName:o,controller:a,onState:s}=t,c=n&&isWellFormedStateCode(n)?n.trim().toUpperCase():null,d=r&&isWellFormedStateCode(r)?r.trim().toUpperCase():null,u=useTelevetStatePolicy(c,a),[p,h]=e.useState(c===null||d!==null&&d!==c),f=c===null||p,m=e.useCallback(()=>{c!==null&&(h(false),s(c))},[c,s]),g=e.useCallback(()=>{h(true),d===c&&s(null)},[d,c,s]),y=e.useCallback(e=>{h(true),s(e.trim().toUpperCase())},[s]),b=c===null?null:{code:c,name:Ml(c),meta:Hl(u.data,o)},v=f&&d!==null&&(c===null||d!==c||p)?d:null,x=v===null?null:{code:v,name:Ml(v),meta:Hl(l.data,o)};return{hostPlace:b,otherSelected:f,otherPlace:x,licensedLine:$l(i,l.data,d,o),stateName:d===null?null:Ml(d),canContinue:d!==null,pickHost:m,pickOther:g,pickState:y}}function Ul(t){let{reasonText:n,state:r,hostState:l,clinicianId:i,clinicians:o,policy:a,petName:s,controller:c,dispatch:d}=t,[u,p]=e.useState([]),[h,f]=e.useState(null),m=e.useRef(false),g=e.useMemo(()=>Vl(),[]),y=u.map(e=>g.find(t=>t.id===e)?.label??"").filter(Boolean),b=Nl(y,n),v=y.length>0?y.join(", "):n.trim(),x=e.useCallback(e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),T=o?.find(e=>e.clinicianId===i)??o?.[0]??null,k=Wl({hostState:l,state:r,policy:a,clinician:T,petName:s??ee.petFallback,controller:c,onState:e.useCallback(e=>{m.current=true,d({type:"patch",patch:{state:e,clinicianId:null}})},[d])});return{issueChips:g,concernIds:u,toggleConcern:x,composedReason:b,aboutLine:v,emergencyAnswer:h,setEmergencyAnswer:f,where:k,matchedClinician:T,whereTouched:m}}var ql=/* @__PURE__ */Object.freeze(["pet","where","issues","reason","emergency","clinician","time","review","booked"]),Kl=/* @__PURE__ */Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function initialTelevetBookingState(e,t={}){let n=/* @__PURE__ */Object.freeze({...Kl,...t}),r=Gl(0,e);/* @__PURE__ */
36
- return Object.freeze({index:r,draft:n,furthestIndex:r})}function isSkipped(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}function Yl(e){return ql[e]}function Gl(e,t){for(let n=e;n<ql.length;n+=1){let e=Yl(n);if(e&&!isSkipped(e,t))return n}return ql.length-1}function Jl(e,t){for(let n=e;n>=0;n-=1){let e=Yl(n);if(e&&!isSkipped(e,t))return n}return null}function hasPreviousStep(e,t){return Jl(e.index-1,t)!==null}function televetBookingReducer(e,t,n){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?/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze(n)})}case"next":{let t=Gl(e.index+1,n);/* @__PURE__ */
37
- return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(Yl(e.index)==="booked")return e;let t=Jl(e.index-1,n);return t===null?e:/* @__PURE__ */Object.freeze({...e,index:t})}case"goTo":{let r=ql.indexOf(t.step);if(r<0)return e;let l=isSkipped(t.step,n)?Gl(r,n):r;/* @__PURE__ */
38
- return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function Ql(e){return ql.filter(t=>t!=="booked"&&(e===void 0||!isSkipped(t,e)))}function Xl(e,t,n=false){let r=e==="reason"&&n?"emergency":e,l=r==="booked"||t.includes(r)?t:Ql();return{current:r==="booked"?l.length:l.indexOf(r)+1,total:l.length,steps:l}}function currentStep(e){return Yl(e.index)??"pet"}function canConfirm(e,t){let n=t.trim();return!!e.petId&&!!e.clinicianId&&!!e.slot&&isWellFormedStateCode(e.state)&&n.length>0&&n.length<=g}function isHoldExpired(e,t){if(!e.holdExpiresAt)return false;let n=Date.parse(e.holdExpiresAt);return Number.isNaN(n)?false:n<=t}function Zl(e,t,n){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!isHoldExpired(e,n)}var ei=/* @__PURE__ */Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),ti=Ue();function televetBookingKey(e){return`televet.book.${ti()}.${e}`}function attestation(e,t,n){let r=n?.version?.trim()??"";return!e||!t||r.length===0?/* @__PURE__ */Object.freeze({}):/* @__PURE__ */Object.freeze({state_attested:true,cancellation_policy_version:r})}function ni(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function ri(e){let t=ni(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}function li(e){let t=ni(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}function ii(e){let t=ni(e);return t?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""}var oi=10;function ai(e){let t=ni(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(e=>e.type==="timeZoneName")?.value??"":""}function formatVisitRange(e){let t=ni(e);if(!t)return"";let n=new Date(t.getTime()+oi*6e4).toISOString(),r=ai(e),l=`${ri(e)} - ${ri(n)}`;return r&&r!==""?`${l} ${r}`:l}function formatWhen(e){let t=li(e),n=[ri(e),ai(e)].filter(Boolean).join(" ");return[t,n].filter(Boolean).join(", ")}function formatWhenWithDay(e){let t=ni(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),formatWhen(e)].filter(Boolean).join(", "):""}function si(e){let t=ni(e);if(!t)return"";let n=t.toLocaleDateString(void 0,{weekday:"short"}),r=t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),l=[ri(e),ai(e)].filter(Boolean).join(" ");return[n,r,l].filter(Boolean).join(", ")}function ci(e){return[ri(e),ai(e)].filter(Boolean).join(" ")}function di(e){let t=ni(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}function ui(e){let t=ni(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}function pi(e){let t=ni(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function hi(e){return e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function fi(e){let t=ni(e);return t?[hi(t),ci(e)].filter(Boolean).join(" · "):""}function mi(e){return ni(e)?`${pi(e)} at ${ci(e)}`:""}function gi(e,t=false){let n=ni(e);return n?`${hi(n)} at ${t?ci(e):ri(e)}`:""}function yi(e){let t=ni(e),n=t===null?0:t.getHours();return n<12?"morning":n<17?"afternoon":"evening"}function bi(t){let{draft:n,reasonText:r,book:l,stateAttested:i,termsAttested:o,cancellationPolicy:a,triage:s,goTo:c,releaseSlot:d,setFailure:p,setEmergency:h,setBookedConsult:f,onBooked:m,media:g}=t,y=e.useCallback(e=>{let t=n.idempotencyKey;if(!canConfirm(n,r)||!t||g?.sending)return;if(isHoldExpired(n,Date.now())){p("expired"),c("time");return}let y=e=>{let t=televetBookingRefusal(e);if(t.kind==="emergency"){h(t.categories);return}if(t.kind==="rate_limited"){p("rate_limited");return}p(t.kind==="not_entitled"?"not_entitled":t.kind==="slot_taken"?"taken":t.kind==="clinician_unavailable"?"clinician_unavailable":t.kind==="unavailable"?"unavailable":"failed"),t.kind==="slot_taken"&&(d(),c("time"))};p(null),h(null);let b=d=>l.mutate({pet_id:n.petId,clinician_id:n.clinicianId,slot_id:n.slot.slotId,state:n.state,reason_text:r.trim(),species:null,media_refs:d,emergency_acknowledged:e||s.isAcknowledged(r),share_health_records:n.shareHealthRecords,...attestation(i,o,a)},t,{onSuccess:e=>{if(!u(e)){y(gt(e.status));return}f(e),c("booked"),m?.(e)},onError:e=>y(vt(e))});if(!g){b([]);return}g.send().then(b,()=>b([]))},[n,r,l,i,o,a,s,c,d,p,h,f,m,g]),b=e.useCallback(()=>y(false),[y]);return{submitBooking:y,confirm:b}}function vi(e){return e.slot!==null&&e.holdExpiresAt!==null&&e.idempotencyKey!==null?e.slot.slotId:null}function xi({controller:t,draft:n,keep:r}){let l=vi(n),i=e.useRef({controller:t,keep:r});i.current={controller:t,keep:r};let o=e.useRef(null);e.useEffect(()=>{let e=o.current;o.current=l,e!==null&&e!==l&&Ti(i.current,e)},[l]),e.useEffect(()=>()=>{let e=o.current;o.current=null,e!==null&&Ti(i.current,e)},[])}function Ti(e,t){if(e.keep)return;let n=e.controller,r=n?.releaseHold;n==null||r===void 0||r.call(n,t).catch(()=>{}).finally(()=>Vn(n,An))}function ki(e){if(e.httpStatus===409)/* @__PURE__ */return Object.freeze({failure:"taken"});switch(televetBookingRefusal(e).kind){case"slot_taken":/* @__PURE__ */
28
+ return Object.freeze({reason:userFacingError("accessDenied"),level:"user_entitlement",recoverable:false})}function Cn(e){let t={name:e.name,enabled:e.enabled,isPending:e.isPending,limits:/* @__PURE__ */Object.freeze({...e.limits})};return e.disabled!==void 0&&(t.disabled=e.disabled),/* @__PURE__ */Object.freeze(t)}function useCapability(t){let{runtime:n}=kn(),r=n.entitlements,l=e.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);return e.useMemo(()=>decideCapability(t,l.decisions,{isPending:l.isPending}),[t,l])}var _n=/* @__PURE__ */Object.freeze({idle:/* @__PURE__ */Object.freeze({title:"Find your pet’s clinic",body:"Search for the clinic that holds your pet’s records. We’ll request them on your behalf once you sign the authorization.",action:null}),no_requests:/* @__PURE__ */Object.freeze({title:"No record requests yet",body:"When you request records from a clinic, you’ll be able to track every step here.",action:null}),no_records:/* @__PURE__ */Object.freeze({title:"Nothing to show just yet",body:"Once your pet’s records arrive and our team reviews them, lab trends and visits will appear here.",action:null}),rate_limited:/* @__PURE__ */Object.freeze({title:"Slow down a moment",body:"You’ve made a lot of requests just now. You can try again shortly.",action:"Try again"}),service_unavailable:/* @__PURE__ */Object.freeze({title:"Records search is temporarily down",body:"We’re working on it. Please try again in a few minutes.",action:"Try again"}),error:/* @__PURE__ */Object.freeze({title:"Couldn’t reach Everfur",body:"Check your connection and try again.",action:"Try again"})}),In=60;var En=/* @__PURE__ */Object.freeze({title:_n.rate_limited.title,body:_n.rate_limited.body});function Dn(e){return e!=null&&(e.code==="rateLimited"||e.httpStatus===429)}function Pn(e,t){return Je(e,t)??In*1e3}function Rn(t){let n=Dn(t),[r,l]=e.useState(null);return e.useEffect(()=>{if(!n||t==null)return;let e=setTimeout(()=>l(t),Pn(t,Date.now()));return()=>clearTimeout(e)},[t,n]),{rateLimited:n,waiting:n&&r!==t}}var zn=3e4;function Fn(e={}){let t=e.now??Date.now,n=/* @__PURE__ */new Map,r=e=>e!==void 0&&e.settled!==null&&t()<e.keptUntil?e.settled:null,l=(e,t,r)=>{let l=t.promise;t.waiters+=1;let i=()=>{t.waiters-=1,t.waiters===0&&t.promise!==null&&(t.abort.abort(),n.get(e)===t&&n.delete(e))};return r.aborted?(i(),l):(r.addEventListener("abort",i,{once:true}),l.finally(()=>r.removeEventListener("abort",i)))},i=(e,r,l,i)=>{if(r.promise=null,n.get(e)!==r||r.abort.signal.aborted){n.get(e)===r&&n.delete(e);return}l.ok&&i>0?(r.settled=l,r.keptUntil=t()+i):!l.ok&&Dn(l.error)?(r.settled=l,r.keptUntil=t()+Pn(l.error,t())):n.delete(e)};/* @__PURE__ */
29
+ return Object.freeze({read(e,t,o){let a=n.get(e);if(a?.promise)return l(e,a,o.signal);let s=r(a);if(s!==null&&(o.force!==true||!s.ok&&Dn(s.error)))return Promise.resolve(s);let c={abort:new AbortController,promise:null,settled:null,keptUntil:0,waiters:0};return n.set(e,c),c.promise=t(c.abort.signal).then(t=>(i(e,c,t,o.freshMs),t),t=>{throw c.promise=null,n.get(e)===c&&n.delete(e),t}),l(e,c,o.signal)},peek(e){return r(n.get(e))},invalidate(e){for(let t of[...n.keys()])e.some(e=>t.startsWith(e))&&n.delete(t)}})}var Ln=/* @__PURE__ */new WeakMap;function An(e){let t=Ln.get(e);return t===void 0&&(t=Fn(),Ln.set(e,t)),t}var On=/* @__PURE__ */Object.freeze(["slots:","next-slot"]),Vn=/* @__PURE__ */Object.freeze(["consults:","consult:","slots:","next-slot"]);function Nn(e,t){Ln.get(e)?.invalidate(t)}function useTelevetBookingController(t){let{runtime:n,userRef:userRef,scopeEpoch:r}=kn();return e.useMemo(()=>t||(userRef===null?null:Mn(n,`${userRef}\0${r}`,()=>{let{services:e}=n.registry;return createTelevetBookingController({auth:e.authFor(userRef),telemetry:e.telemetry,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})})),[n,userRef,r,t])}var Bn=/* @__PURE__ */new WeakMap;function Mn(e,t,n){let r=Bn.get(e);if(r!==void 0&&r.scope===t)return r.controller;let l=n();return Bn.set(e,{scope:t,controller:l}),l}function useTelevetBookingAvailable(){let{userRef:userRef}=kn(),t=useCapability("televet");return e.useMemo(()=>({available:t.enabled&&userRef!==null,isPending:t.isPending}),[t.enabled,t.isPending,userRef])}function Hn(t,n,r,l,i=zn,o=false){let[a,s]=e.useState(()=>{let e=n&&r!==null&&l!==null&&!o?An(l).peek(t):null;return e!==null?e.ok?{key:t,data:e.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:e.error}:{key:t,data:null,isPending:n&&r!==null,error:null}}),[c,d]=e.useState(0),u=e.useRef(r);u.current=r;let p=e.useRef(l);p.current=l;let h=e.useRef(o);e.useEffect(()=>{let e=u.current;if(!n||e===null){s({key:t,data:null,isPending:false,error:null});return}let r=h.current;h.current=false;let l=p.current===null?null:An(p.current),o=r||l===null?null:l.peek(t);if(o!==null){s(o.ok?{key:t,data:o.value,isPending:false,error:null}:{key:t,data:null,isPending:false,error:o.error});return}let a=new AbortController,c=true;return s(e=>e.key===t?{...e,isPending:true,error:null}:{key:t,data:null,isPending:true,error:null}),(async()=>{let n;try{n=l===null?await e(a.signal):await l.read(t,e,{signal:a.signal,freshMs:i,force:r})}catch{c&&s({key:t,data:null,isPending:false,error:null});return}c&&(n.ok?s({key:t,data:n.value,isPending:false,error:null}):s({key:t,data:null,isPending:false,error:n.error}))})(),()=>{c=false,a.abort()}},[t,n,c]);let f=e.useCallback(()=>{h.current=true,d(e=>e+1)},[]),m=a.key===t;return e.useMemo(()=>({enabled:n,data:m?a.data:null,isPending:n&&(!m||a.isPending),isError:m&&a.error!==null,error:m?a.error:null,refetch:f}),[n,m,a.data,a.isPending,a.error,f])}function useTelevetStatePolicy(e,t){let n=e?.trim()??"",r=t?.statePolicy!==void 0&&isWellFormedStateCode(n),l=t?.statePolicy;return Hn(`state-policy:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetBookingEntitlement(e){let t=e?.entitlement!==void 0,n=e?.entitlement;return Hn("entitlement",t,t&&n?t=>n.call(e,t):null,e,0)}function useTelevetCancellationPolicy(e){let t=e?.cancellationPolicy!==void 0,n=e?.cancellationPolicy;return Hn("cancellation-policy",t,t&&n?t=>n.call(e,t):null,e)}function useTelevetClinicians(e,t){let n=e?.trim()??"",r=t?.clinicians!==void 0&&isWellFormedStateCode(n),l=t?.clinicians;return Hn(`clinicians:${n}`,r,r&&l?e=>l.call(t,n,e):null,t)}function useTelevetSlots(e,t){let n=e?.trim()??"",r=t!==null&&n.length>0;return Hn(`slots:${n}`,r,r&&t?e=>t.slots(n,e):null,t)}function useTelevetNextSlot(e){let t=e?.nextSlot!==void 0,n=e?.nextSlot;return Hn("next-slot",t,t&&n?t=>n.call(e,t):null,e)}function $n(t){let[n,r]=e.useState(null),l=e.useRef(true),i=e.useRef(false),o=e.useRef(t);o.current=t,e.useEffect(()=>(l.current=true,()=>{l.current=false}),[]);let a=e.useCallback((...e)=>{let t=o.current;if(t===null||i.current)return;let n=e[e.length-1],a=typeof n=="object"&&n!==null&&("onSuccess"in n||"onError"in n),s=a?n:void 0,c=a?e.slice(0,-1):e;i.current=true,r({variables:c[0]??null}),(async()=>{let e=null;try{e=await t(...c)}catch{e=null}i.current=false,l.current&&r(null),e!==null&&(e.ok?s?.onSuccess?.(e.value):s?.onError?.(e.error))})()},[]);return e.useMemo(()=>({isPending:n!==null,variables:n?.variables??null,mutate:a}),[n,a])}async function Wn(e,t,n){let r=await n;return r.ok&&Nn(e,t),r}function useTelevetHoldSlot(e){return $n(e?t=>Wn(e,On,e.holdSlot(t)):null)}function useTelevetBookConsult(e){return $n(e?(t,n)=>Wn(e,Vn,e.book(t,n)):null)}function useTelevetRescheduleConsult(e,t){return $n(t&&e?n=>Wn(t,Vn,t.reschedule(e,n)):null)}function Un(e,t=0,n){let r=e?.listConsults!==void 0,l=e?.listConsults;return Hn(`consults:${t}`,r,r&&l?t=>l.call(e,t):null,e,zn,n?.reread===true)}function qn(e,t,n=0){let r=e?.trim()??"",l=t?.getConsult!==void 0&&r.length>0,i=t?.getConsult;return Hn(`consult:${r}:${n}`,l,l&&i?e=>i.call(t,r,e):null,t)}function Kn(e,t){let n=t?.cancelConsult;return $n(t&&n&&e?r=>Wn(t,Vn,n.call(t,e,r)):null)}function Yn(e){return e.error!==null&&e.error.httpStatus===404}function Gn(e){let t=Un(e);if(!t.enabled)return"booking";if(t.isPending)return"pending";if(t.isError)return"visits";let{upcoming:n,past:r}=splitTelevetVisits(t.data??[],Date.now());return n.length>0||r.length>0?"visits":"booking"}var Jn=/* @__PURE__ */Object.freeze({regular:"regular",medium:"medium",bold:"bold",mono:"regular",monoMedium:"medium",monoBold:"bold"});function face(e,t){let n=e.type,r=n.families[t];return t==="mono"||n.namedFaces[t]?{fontFamily:r}:{fontFamily:r,fontWeight:n.weight[Jn[t]]}}function headingFace(e,t="bold"){let{headingFamily:n,headingWeight:r}=e.type;if(n===null&&r===null)return face(e,t);if(n!==null)return{fontFamily:n,fontWeight:r??e.type.weight[Jn[t]]};let l=face(e,t);return l.fontWeight===void 0||r===null?l:{fontFamily:l.fontFamily,fontWeight:r}}function Qn(e){return e<=450?"regular":e<=650?"medium":"bold"}var Xn={regular:"mono",medium:"monoMedium",bold:"monoBold"};function textRole(e,t){let n=Zn.get(e);n===void 0&&(n=/* @__PURE__ */new Map,Zn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let l=er(e,t);return n.set(t,l),l}var Zn=/* @__PURE__ */new WeakMap;function er(e,t){let n=e.type.roles[t],r=n.weight==="400"&&n.face!=="mono"?e.type.weight.regular:n.weight,l=Qn(Number(r)),i=n.face==="mono"?face(e,Xn[l]):n.face==="heading"?headingFace(e,l):face(e,l),o=n.face==="heading"?e.type.headingWeight??r:r,a=i.fontWeight===void 0?i:{fontFamily:i.fontFamily,fontWeight:o},s=n.size,c={...a,fontSize:s,lineHeight:Math.round(s*n.lineHeight*100)/100};return n.letterSpacing!==0&&(c.letterSpacing=Math.round(s*n.letterSpacing*100)/100),n.uppercase&&(c.textTransform="uppercase"),/* @__PURE__ */Object.freeze(c)}var tr=/* @__PURE__ */Object.freeze({display:/* @__PURE__ */Object.freeze({size:29,lineHeight:1.06,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),title:/* @__PURE__ */Object.freeze({size:23,lineHeight:1.12,weight:"800",face:"heading",letterSpacing:-.01,uppercase:false,tier:"heading"}),cardTitle:/* @__PURE__ */Object.freeze({size:19,lineHeight:1.22,weight:"800",face:"sans",letterSpacing:0,uppercase:false,tier:"heading"}),rowTitle:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.4,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),body:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),message:/* @__PURE__ */Object.freeze({size:15.5,lineHeight:1.5,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),bodySmall:/* @__PURE__ */Object.freeze({size:14.5,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),caption:/* @__PURE__ */Object.freeze({size:13,lineHeight:1.4,weight:"400",face:"sans",letterSpacing:0,uppercase:false,tier:"content"}),label:/* @__PURE__ */Object.freeze({size:10.5,lineHeight:1.4,weight:"400",face:"mono",letterSpacing:.05,uppercase:true,tier:"compact"}),eyebrow:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"400",face:"mono",letterSpacing:.07,uppercase:true,tier:"compact"}),chip:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.3,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),tab:/* @__PURE__ */Object.freeze({size:16,lineHeight:1.5,weight:"600",face:"sans",letterSpacing:0,uppercase:false,tier:"compact"}),button:/* @__PURE__ */Object.freeze({size:15,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"control"}),badge:/* @__PURE__ */Object.freeze({size:12,lineHeight:1.5,weight:"700",face:"sans",letterSpacing:0,uppercase:false,tier:"badge"})});var nr=Object.freeze;function deepFreeze(e){if(e!==null&&typeof e=="object"&&!Object.isFrozen(e)){nr(e);for(let t of Object.keys(e))deepFreeze(e[t])}return e}var rr=/* @__PURE__ */Object.freeze({content:0,heading:2,control:1.8,compact:1.5,badge:1.3});var lr={xs:4,sm:8,md:12,lg:16,xl:24,xxl:32},ir={tile:5,xs:6,sm:10,md:14,lg:20,xl:28,pill:500},or={nano:8,small:9,micro:10,tiny:11,caption:13,bodyTight:15,body:17,subtitle:20,heading:22,verdict:24},ar={tight:1.15,snug:1.3,normal:1.4,relaxed:1.55},sr={regular:"400",medium:"500",bold:"700"},cr={eyebrow:1,monoWide:.9,headerBrand:-.42,tight:-.35},dr=0,ur="System",pr="monospace",hr=["content","heading","control","compact","badge"];function fr(e){let t={};for(let n of hr)t[n]=e;return t}var mr=[];function gr(){return{family:ur,mono:pr,fontUrl:null,families:{regular:ur,medium:ur,bold:ur,mono:pr,monoMedium:pr,monoBold:pr},namedFaces:{regular:false,medium:false,bold:false,mono:false,monoMedium:false,monoBold:false},fontUrls:{},size:or,tierSizes:fr(or),lineHeight:ar,weight:sr,letterSpacing:cr,scale:1,maxScale:dr,scaleCaps:rr,headingFamily:null,headingWeight:null,fontSources:mr,roles:tr,typeScale:1}}var br={},yr=/* @__PURE__ */Object.freeze({standard:/* @__PURE__ */Object.freeze([.2,0,0,1]),emphasized:/* @__PURE__ */Object.freeze([.2,.8,.2,1]),exit:/* @__PURE__ */Object.freeze([.4,0,1,1])});function cssCubicBezier(e){return`cubic-bezier(${e.join(", ")})`}var vr={duration:{instant:80,fast:140,normal:220,slow:320},spring:{gentle:{damping:18,stiffness:200}},easing:{standard:cssCubicBezier(yr.standard),emphasized:cssCubicBezier(yr.emphasized),exit:cssCubicBezier(yr.exit)},reducedMotion:false},xr={brand:"#10462E",brandSoft:"rgba(16,70,46,0.10)",brandSofter:"rgba(16,70,46,0.15)",brandBorder:"rgba(16,70,46,0.18)",borderHairlineGreen:"rgba(16,70,46,0.25)",brandBorderStrong:"rgba(16,70,46,0.55)",brandInk:"#10462E",linkInk:"#10462E",surface:"#FFFFFF",surfaceCream:"#FFFFFF",surfaceSubtle:"#F1F5F2",background:"#FFFFFF",borderRingCream:"#E4E4E4",chatGround:"#FFFFFF",composerFill:"#FFFFFF",composerBorder:"rgba(16,70,46,0.75)",shadow:"#0B3421",text:{primary:"#000000",secondary:"#0E462E",muted:"#6B6B6B",placeholder:"rgba(61,61,61,0.75)",onBrand:"#FFFFFF",metaCool:"#3D3D3D",timestamp:"rgba(61,61,61,0.75)"},primary:"#10462E",onPrimary:"#FFFFFF",accent:"#10462E",onAccent:"#FFFFFF",accentEdge:"#07C168",success:"#07C168",danger:"#C03410",onDanger:"#FFFFFF",errorRed:"#C03410",warningStrong:"#A45610",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.12)",badgeBgCaution:"rgba(217,130,29,0.14)",badgeBgCritical:"rgba(192,52,16,0.06)",badgeBgNeutral:"rgba(107,107,107,0.12)",bubbleUser:"#10462E",bubbleAssistant:"#FFFFFF",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#E9F1E9",scanButtonPink:"#FFC3BC",highlight:"#FFC3BC",onHighlight:"#000000",mark:"#07C168",controlEdge:"rgba(16,70,46,0.18)",structureEdge:"rgba(16,70,46,0.25)",primaryEdge:"#10462E",checkupCardLowRiskBg:"rgba(7,193,104,0.10)",checkupCardConcernBg:"rgba(239,167,0,0.10)",info:"#10462E",badgeBgInfo:"rgba(16,70,46,0.10)",infoEdge:"rgba(16,70,46,0.25)"},Tr=deepFreeze({brightness:"light",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:xr,space:lr,radius:ir,type:gr(),motion:vr,slots:br}),kr={brand:"#6BD39A",brandSoft:"rgba(107,211,154,0.12)",brandSofter:"rgba(107,211,154,0.18)",brandBorder:"rgba(107,211,154,0.22)",borderHairlineGreen:"rgba(107,211,154,0.28)",brandBorderStrong:"rgba(107,211,154,0.55)",brandInk:"#6BD39A",linkInk:"#6BD39A",surface:"#1C1F23",surfaceCream:"#23272C",surfaceSubtle:"#23272C",background:"#15171A",borderRingCream:"#3A3F45",chatGround:"#1C1F23",composerFill:"#23272C",composerBorder:"rgba(107,211,154,0.75)",shadow:"#000000",text:{primary:"#F5F3F0",secondary:"#A9E4C4",muted:"#9A9A9A",placeholder:"rgba(255,255,255,0.55)",onBrand:"#0E1F17",metaCool:"#C9C9C9",timestamp:"rgba(245,243,240,0.7)"},primary:"#6BD39A",onPrimary:"#0E1F17",accent:"#6BD39A",onAccent:"#0E1F17",accentEdge:"#34D888",success:"#07C168",danger:"#F87171",onDanger:"#0E1F17",errorRed:"#FF6B5B",warningStrong:"#F0A35E",cautionAccent:"#D9821D",riskConcern:"#EFA700",sentiment:{up:"#07C168",neutral:"#FBC558",down:"#FF1B00"},badgeBgPositive:"rgba(7,193,104,0.18)",badgeBgCaution:"rgba(217,130,29,0.20)",badgeBgCritical:"rgba(185,28,28,0.22)",badgeBgNeutral:"rgba(255,255,255,0.10)",bubbleUser:"#6BD39A",bubbleAssistant:"#1C1F23",bubbleVet:"#FFC3BC",onBubbleVet:"#000000",skeleton:"#23272C",scanButtonPink:"#FFC3BC",highlight:"#605051",onHighlight:"#F5F3F0",mark:"#07C168",controlEdge:"rgba(107,211,154,0.22)",structureEdge:"rgba(107,211,154,0.28)",primaryEdge:"#6BD39A",checkupCardLowRiskBg:"rgba(7,193,104,0.16)",checkupCardConcernBg:"rgba(239,167,0,0.16)",info:"#6BD39A",badgeBgInfo:"rgba(107,211,154,0.12)",infoEdge:"rgba(107,211,154,0.28)"};deepFreeze({brightness:"dark",highContrast:false,meta:{displayName:"Everfur",logoUrl:null,placeholder:null,hidePoweredBy:false,assistantAvatarUrl:null},color:kr,space:lr,radius:ir,type:gr(),motion:vr,slots:br});var wr=/* @__PURE__ */Symbol.for("@everfur/sdk#EverfurThemeContext@v1"),Sr=globalThis,jr=Sr[wr]??(Sr[wr]=e.createContext(Tr));jr.displayName??="EverfurThemeContext";function useEverfurTheme(){return e.useContext(jr)}function Cr(e,t){let n=e.scaleCaps[t];return n>0?n:void 0}function Text({tier:n,variant:r,...l}){let i=useEverfurTheme(),o=r===void 0?void 0:i.type.roles[r],a=Cr(i.type,n??o?.tier??"content"),s=r===void 0?l:{...l,style:[{...textRole(i,r),color:i.color.text.primary,flexShrink:1},l.style]};return e.createElement(t.Text,a===void 0?s:{maxFontSizeMultiplier:a,...s})}var _r=e.forwardRef(function(n,r){return e.createElement(t.TextInput,{...n,...r===null?{}:{ref:r}})});var Ir=class extends e.Component{constructor(){super(...arguments);this.state={failed:false,key:this.props.resetKey}}static getDerivedStateFromError(){return{failed:true}}static getDerivedStateFromProps(e,t){return Object.is(e.resetKey,t.key)?null:{failed:false,key:e.resetKey}}render(){return this.state.failed?this.props.fallback:this.props.children}};function RenderHost({render:e}){return e()}function HostRender({render:t,fallback:n,resetKey:r}){return e.createElement(Ir,{fallback:n,resetKey:r,children:e.createElement(RenderHost,{render:t})})}var Er=48;function Dr(e){return e.isPending?"pending":e.enabled?"enabled":"disabled"}function CapabilityGate(t){let{capability:n,children:l,renderDisabled:i,renderPending:o,style:a}=t,s=useCapability(n),c=e.useMemo(()=>Dr(s),[s]);switch(c){case"enabled":return l;case"pending":return o?/* @__PURE__ */r.jsx(HostRender,{render:o,fallback:/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a})}):/* @__PURE__ */r.jsx(PendingSkeleton,{capability:n,style:a});case"disabled":return i?/* @__PURE__ */r.jsx(HostRender,{render:()=>i(s),fallback:/* @__PURE__ */r.jsx(OffState,{decision:s,style:a}),resetKey:s}):/* @__PURE__ */r.jsx(OffState,{decision:s,style:a});default:return assertNever(c)}}function PendingSkeleton({capability:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Pr(i),[i]);/* @__PURE__ */
30
+ return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityState:{busy:true},accessibilityLabel:`Loading ${n}`,children:/* @__PURE__ */r.jsx(t.View,{style:o.skeletonBar})})}function OffState({decision:n,style:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Pr(i),[i]),a=n.disabled?.reason??"";/* @__PURE__ */
31
+ return r.jsx(t.View,{style:[o.offstate,l],accessible:true,accessibilityRole:"text",accessibilityLabel:a,children:a.length>0?/* @__PURE__ */r.jsx(Text,{style:o.offstateText,children:a}):null})}function Pr(e){let{color:n,space:r,radius:l,type:i}=e;return t.StyleSheet.create({offstate:{minHeight:Er,justifyContent:"center",paddingHorizontal:r.lg,paddingVertical:r.md,backgroundColor:n.surfaceCream,borderRadius:l.md,borderWidth:t.StyleSheet.hairlineWidth,borderColor:n.brandBorder},offstateText:{...face(e,"regular"),fontSize:i.size.body,lineHeight:Math.round(i.size.body*i.lineHeight.normal),color:n.text.muted},skeletonBar:{height:r.md,borderRadius:l.xs,backgroundColor:n.brandSofter}})}function Rr(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let n=e.charCodeAt(t+1);if(!(n>=56320&&n<=57343))return true;t+=1}else if(n>=56320&&n<=57343)return true}return false}function zr(e){return[...e].length}var Fr=/* @__PURE__ */Object.freeze({dog:"dog",canine:"dog",k9:"dog",puppy:"dog",cat:"cat",feline:"cat",kitten:"cat"});function canonicalPetSpecies(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Object.prototype.hasOwnProperty.call(Fr,t)?Fr[t]:null}var Lr=50,Ar=128,Or=120,Vr=120,Nr=2e3,Br=120,Mr=80,Hr=/* @__PURE__ */new Set(["male","female","unknown"]),$r=/* @__PURE__ */new Set(["day","month","year"]),Wr=/* @__PURE__ */new Set(["low","medium","high","athletic"]),Ur=/* @__PURE__ */new Set(["indoor","outdoor","both"]),qr=/* @__PURE__ */new Set(["mild","moderate","severe"]),Kr=/^(\d{4})-(\d{2})-(\d{2})$/,Yr=[["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"]],Gr=[["allergies","allergies"],["medications","medications"],["supplements","supplements"],["conditions","conditions"]];/* @__PURE__ */Object.freeze([...Yr,...Gr].map(([e])=>e));function Jr(e){let t=Kr.exec(e);if(t===null)return false;let[n,r,l]=[Number(t[1]),Number(t[2]),Number(t[3])],i=new Date(Date.UTC(n,r-1,l));return i.getUTCFullYear()===n&&i.getUTCMonth()===r-1&&i.getUTCDate()===l}var Qr=e=>(t,n)=>typeof n=="string"&&e.has(n)?null:`${t} must be one of ${[...e].join(", ")}`,Xr=(e,t)=>typeof t=="boolean"?null:`${e} must be true or false`,Zr=(e,t)=>typeof t=="string"&&Jr(t)?null:`${e} must be a real date written YYYY-MM-DD`,el=(e,t={})=>(n,r)=>{if(typeof r!="string")return`${n} must be a string`;if(Rr(r))return`${n} contains an unpaired surrogate and cannot be encoded`;let l=t.trimmed?r.trim():r;if(t.required&&l.length===0)return`${n} is required and must not be blank`;let i=zr(l);return i<=e?null:`${n} is ${i} characters; the server accepts at most ${e}`},tl={sex:Qr(Hr),spayedNeutered:Xr,birthDate:Zr,birthDatePrecision:Qr($r),activityLevel:Qr(Wr),indoorOutdoor:Qr(Ur),foodBrand:el(Br),foodType:el(Br),microchipId:el(Mr)},nl=["ref","ref",false,el(Ar,{required:true,trimmed:true})],rl=["notes","notes",false,el(Nr,{trimmed:true})],ll=[nl,["name","name",true,el(Or,{required:true,trimmed:true})],["dose","dose",false,el(Vr,{trimmed:true})],["frequency","frequency",false,el(Vr,{trimmed:true})],["startDate","start_date",false,Zr],["endDate","end_date",false,Zr],rl],il={allergies:[nl,["allergen","allergen",true,el(Or,{required:true,trimmed:true})],["severity","severity",false,Qr(qr)],rl],medications:ll,supplements:ll,conditions:[nl,["conditionName","condition_name",true,el(Or,{required:true,trimmed:true})],["diagnosedDate","diagnosed_date",false,Zr],rl]};function ol(e,t,n){let r=`${e}[${t}]`;if(typeof n!="object"||n===null||Array.isArray(n))return{error:`${r} must be an object`};let l=n,i={};for(let[t,n,o,a]of il[e]){let e=l[t];if(e==null){if(o)return{error:`${r}.${t} is required`};e===null&&(i[n]=null);continue}let s=a(`${r}.${t}`,e);if(s!==null)return{error:s};i[n]=e}let o=i.start_date,a=i.end_date;return typeof o=="string"&&typeof a=="string"&&a<o?{error:`${r}.endDate must not be before startDate`}:{item:i}}function al(e,t){if(!Array.isArray(t))return{error:`${e} must be an array (send [] to clear it)`};if(t.length>Lr)return{error:`${e} has ${t.length} items; the server accepts at most ${Lr}`};let n=[],r=/* @__PURE__ */new Set;for(let l=0;l<t.length;l+=1){let i=ol(e,l,t[l]);if("error"in i)return i;let o=i.item.ref;if(typeof o=="string"){let t=o.trim();if(r.has(t))return{error:`${e}: ref ${JSON.stringify(t)} is used twice; a ref names one item`};r.add(t)}n.push(i.item)}return{items:n}}function sl(e,t){let n=e,r={};for(let[e,t]of Yr){let l=n[e];if(l!==void 0){if(l!==null){let t=tl[e](e,l);if(t!==null)return{error:t}}r[t]=l}}let l=n.birthDate!==void 0,i=n.birthDatePrecision!==void 0;if(l!==i||l&&n.birthDate===null!=(n.birthDatePrecision===null))return{error:"birthDate and birthDatePrecision must be sent together, both set or both null"};for(let[e,t]of Gr){let l=n[e];if(l===void 0)continue;let i=al(e,l);if("error"in i)return i;r[t]=i.items}return Object.keys(r).length>0&&t!==void 0&&canonicalPetSpecies(t)===null?{error:"health fields need a pet Everfur reads as a dog or a cat (dog, canine, k9, puppy, cat, feline, kitten)"}:{body:r}}var cl=e=>typeof e=="string"?e:null,dl=(e,t)=>typeof t=="string"&&e.has(t)?t:null,ul=e=>typeof e=="boolean"?e:null;function pl(e,t){return Array.isArray(e)?/* @__PURE__ */Object.freeze(e.flatMap(e=>{if(typeof e!="object"||e===null||Array.isArray(e))return[];let n=t(e);return n===null?[]:[n]})):/* @__PURE__ */Object.freeze([])}function hl(e){let t=cl(e.name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cl(e.ref),name:t,dose:cl(e.dose),frequency:cl(e.frequency),startDate:cl(e.start_date),endDate:cl(e.end_date),notes:cl(e.notes)})}function fl(e){let t=e.profile_version;/* @__PURE__ */
32
+ return Object.freeze({profileVersion:typeof t=="number"&&Number.isInteger(t)&&t>=0?t:0,sex:dl(Hr,e.sex),spayedNeutered:ul(e.spayed_neutered),birthDate:cl(e.birth_date),birthDatePrecision:dl($r,e.birth_date_precision),activityLevel:dl(Wr,e.activity_level),indoorOutdoor:dl(Ur,e.indoor_outdoor),foodBrand:cl(e.food_brand),foodType:cl(e.food_type),microchipId:cl(e.microchip_id),allergies:pl(e.allergies,e=>{let t=cl(e.allergen);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cl(e.ref),allergen:t,severity:dl(qr,e.severity),notes:cl(e.notes)})}),medications:pl(e.medications,hl),supplements:pl(e.supplements,hl),conditions:pl(e.conditions,e=>{let t=cl(e.condition_name);return t===null||t.length===0?null:/* @__PURE__ */Object.freeze({ref:cl(e.ref),conditionName:t,diagnosedDate:cl(e.diagnosed_date),notes:cl(e.notes)})})})}var ml=100,gl=50,bl=100,yl=50,vl=500,xl=128,Tl=6e4;function kl(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function wl(e,t,n){if(typeof t!="string")return kl(`${e} must be a string`);let r=zr(t);return r<=n?null:kl(`${e} is ${r} characters; the server accepts at most ${n}`)}function Sl(e,t,n){return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=n?null:kl(`${e} must be a finite number between 0 and ${n}`)}function jl(petRef,e){if(typeof petRef!="string")return kl("pet_ref must be a string");if(petRef.trim().length===0)return kl("pet_ref must not be blank");if(Rr(petRef))return kl("pet_ref contains an unpaired surrogate and cannot be encoded");if(e!=null&&typeof e!="object")return kl("profile must be an object");let t=[wl("pet_ref",petRef,xl)];return e?.name!==void 0&&t.push(wl("name",e.name,ml)),e?.species!==void 0&&t.push(wl("species",e.species,gl)),e?.breed!==void 0&&t.push(wl("breed",e.breed,bl)),e?.ageYears!==void 0&&t.push(Sl("age_years",e.ageYears,yl)),e?.weightKg!==void 0&&t.push(Sl("weight_kg",e.weightKg,vl)),t.find(e=>e!==null)??null}function Cl(e,t){let n=sl(e,t);return"error"in n?{error:kl(n.error)}:n}function _l(e){if(typeof e!="object"||e===null)return{error:kl("patch must be an object")};let t=e,n=[["name","name",e=>wl("name",e,ml)],["species","species",e=>wl("species",e,gl)],["breed","breed",e=>wl("breed",e,bl)],["ageYears","age_years",e=>Sl("age_years",e,yl)],["weightKg","weight_kg",e=>Sl("weight_kg",e,vl)]],r={};for(let[e,l,i]of n){let n=t[e];if(n!==void 0){if(n!==null){let e=i(n);if(e!==null)return{error:e}}r[l]=n}}let l=Cl(t,t.species);return"error"in l?l:(Object.assign(r,l.body),Object.keys(r).length===0?{error:kl("patch must change at least one field")}:{body:r})}function Il(e){if(e==null)return{body:{}};let t=Cl(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}}}var El=e=>typeof e=="string"?e:null,Dl=e=>typeof e=="number"&&Number.isFinite(e)?e:null;function Pl(e,petRef){let t=typeof e=="object"&&e!==null?e:{};/* @__PURE__ */
33
+ return Object.freeze({petRef:El(t.pet_ref)??petRef,name:El(t.name),species:El(t.species),breed:El(t.breed),ageYears:Dl(t.age_years),weightKg:Dl(t.weight_kg)})}function widgetPetFromWire(e){if(typeof e!="object"||e===null)return null;let t=e,petRef=El(t.pet_ref);return petRef===null||petRef.length===0?null:/* @__PURE__ */Object.freeze({petId:El(t.pet_id),petRef:petRef,name:El(t.name),species:El(t.species),breed:El(t.breed),ageYears:Dl(t.age_years),weightKg:Dl(t.weight_kg),updatedAt:El(t.updated_at)})}function Rl(e){let t=widgetPetFromWire(e);return t===null?null:/* @__PURE__ */Object.freeze({...t,...fl(e)})}function zl(e){let t=Array.isArray(e)?e:typeof e=="object"&&e!==null&&Array.isArray(e.pets)?e.pets:[];/* @__PURE__ */
34
+ return Object.freeze(t.flatMap(e=>{let t=widgetPetFromWire(e);return t===null?[]:[t]}))}function createPetsRepository(e){return Fl(createRequestFunnel({auth:e}),createRequestFunnel({auth:e,unaryTimeoutMs:Tl}))}function Fl(e,t=e){let n=(e,t)=>t?{...e,signal:t}:e,r=petRef=>jl(petRef,void 0)??`/widget/v1/pets/${encodeURIComponent(petRef)}`;return{async list(t){let r=await e.send("pets.list",n({method:"GET",path:"/widget/v1/pets"},t?.signal));return r.ok?ok(zl(r.value)):err(r.error)},async registerPet(petRef,t,n){let r=jl(petRef,t);if(r!==null)return err(r);let l=Il(t);if("error"in l)return err(l.error);let i={method:"POST",path:`/widget/v1/pets/${encodeURIComponent(petRef)}`,body:l.body},o=await e.send("pets.registerPet",n?.signal?{...i,signal:n.signal}:i);return o.ok?ok(Pl(o.value,petRef)):err(o.error)},async updatePet(petRef,t,l){let i=r(petRef);if(typeof i!="string")return err(i);let o=_l(t);if("error"in o)return err(o.error);let a=await e.send("pets.updatePet",n({method:"PATCH",path:i,body:o.body},l?.signal));return a.ok?ok(Pl(a.value,petRef)):err(a.error)},async getPetProfile(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.getPetProfile",n({method:"GET",path:`${l}/profile`},t?.signal));if(!i.ok)return err(i.error);let o=Rl(i.value);return o===null?err(makeEverfurError("internalError",{retryable:false,httpStatus:502,wireMessage:"the pet profile response carried no pet_ref"})):ok(o)},async deletePet(petRef,t){let l=r(petRef);if(typeof l!="string")return err(l);let i=await e.send("pets.deletePet",n({method:"DELETE",path:l},t?.signal));return i.ok?ok(void 0):err(i.error)},async eraseUserData(e){let r=await t.send("pets.eraseUserData",n({method:"DELETE",path:"/widget/v1/me"},e?.signal),{maxAttempts:1});return r.ok?ok(void 0):err(r.error)}}}var Ll=/* @__PURE__ */new WeakMap;function Al(e,t){let n=Ll.get(e);return n===void 0&&(n=/* @__PURE__ */new Set,Ll.set(e,n)),n.add(t),()=>{n?.delete(t)}}function useEverfurPets(){let{runtime:t,userRef:userRef,activePet:n,scopeEpoch:r}=kn(),l=e.useMemo(()=>createPetsRepository(t.registry.services.authFor(userRef)),[t,userRef,r]),[i,o]=e.useState({repository:l,pets:[],loading:true,error:null}),a=i.repository===l?i:{pets:[],loading:true,error:null},s=e.useRef(0),c=e.useCallback(async()=>{let e=++s.current;o(e=>({...e,repository:l,loading:true,error:null,pets:e.repository===l?e.pets:[]}));let t=await l.list();e===s.current&&o(t.ok?{repository:l,pets:t.value,loading:false,error:null}:e=>({repository:l,pets:e.repository===l?e.pets:[],loading:false,error:t.error}))},[l]);e.useEffect(()=>(c(),()=>{s.current+=1}),[c]),e.useEffect(()=>Al(t,()=>{c()}),[t,c]);let d=e.useMemo(()=>n===null?null:a.pets.find(e=>e.petRef===n)??null,[n,a.pets]);return e.useMemo(()=>({pets:a.pets,activePet:d,loading:a.loading,error:a.error,refresh:c}),[a.pets,a.loading,a.error,d,c])}var Ol=/* @__PURE__ */Object.freeze([{id:"itchy-skin",label:"Itchy skin and allergies"},{id:"ear-infections",label:"Ear problems"},{id:"upset-stomach",label:"Upset stomach"},{id:"anxiety",label:"Anxiety and behavior"},{id:"parasites",label:"Fleas, ticks and heartworm"},{id:"joint-pain",label:"Joints and mobility"},{id:"eye-issues",label:"Eyes"},{id:"urinary",label:"Peeing and urinary"},{id:"surgery-aftercare",label:"Surgery aftercare"},{id:"senior-care",label:"Senior care"},{id:"wellness",label:"A wellness check-in"}].map(e=>/* @__PURE__ */Object.freeze(e))),Vl="other";function Nl(e){/* @__PURE__ */
35
+ return Object.freeze([...Ol/* @__PURE__ */,Object.freeze({id:Vl,label:te.otherIssue})])}function Bl(e,t){let n=e.filter(e=>e.trim().length>0),r=t.trim();return n.length===0?r:r.length===0?n.join(", "):`${n.join(", ")}\n${r}`}var Ml=/* @__PURE__ */Object.freeze([["AL","Alabama"],["AK","Alaska"],["AZ","Arizona"],["AR","Arkansas"],["CA","California"],["CO","Colorado"],["CT","Connecticut"],["DE","Delaware"],["DC","District of Columbia"],["FL","Florida"],["GA","Georgia"],["HI","Hawaii"],["ID","Idaho"],["IL","Illinois"],["IN","Indiana"],["IA","Iowa"],["KS","Kansas"],["KY","Kentucky"],["LA","Louisiana"],["ME","Maine"],["MD","Maryland"],["MA","Massachusetts"],["MI","Michigan"],["MN","Minnesota"],["MS","Mississippi"],["MO","Missouri"],["MT","Montana"],["NE","Nebraska"],["NV","Nevada"],["NH","New Hampshire"],["NJ","New Jersey"],["NM","New Mexico"],["NY","New York"],["NC","North Carolina"],["ND","North Dakota"],["OH","Ohio"],["OK","Oklahoma"],["OR","Oregon"],["PA","Pennsylvania"],["RI","Rhode Island"],["SC","South Carolina"],["SD","South Dakota"],["TN","Tennessee"],["TX","Texas"],["UT","Utah"],["VT","Vermont"],["VA","Virginia"],["WA","Washington"],["WV","West Virginia"],["WI","Wisconsin"],["WY","Wyoming"]].map(([e,t])=>/* @__PURE__ */Object.freeze({code:e,name:t})));function Hl(e){let t=e?.trim().toUpperCase()??"";return Ml.find(e=>e.code===t)?.name??t}function $l(e,t){return e?e.wellnessAvailable?e.prescriptionsAvailable?ee(te.wherePrescribeMetaTemplate,{pet:t}):te.whereWellnessMeta:te.stateBlockedTitle:null}function Wl(e,t,n,r){if(!e||!t||!n||!t.prescriptionsAvailable)return null;let l=n.trim().toUpperCase();return e.licensedStates.some(e=>e.state.trim().toUpperCase()===l&&e.canPrescribe)?ee(te.whereLicensedTemplate,{vet:e.displayName,state:Hl(l),pet:r}):null}function Ul(t){let{hostState:n,state:r,policy:l,clinician:i,petName:o,controller:a,onState:s}=t,c=n&&isWellFormedStateCode(n)?n.trim().toUpperCase():null,d=r&&isWellFormedStateCode(r)?r.trim().toUpperCase():null,u=useTelevetStatePolicy(c,a),[p,h]=e.useState(c===null||d!==null&&d!==c),f=c===null||p,m=e.useCallback(()=>{c!==null&&(h(false),s(c))},[c,s]),g=e.useCallback(()=>{h(true),d===c&&s(null)},[d,c,s]),b=e.useCallback(e=>{h(true),s(e.trim().toUpperCase())},[s]),y=c===null?null:{code:c,name:Hl(c),meta:$l(u.data,o)},v=f&&d!==null&&(c===null||d!==c||p)?d:null,x=v===null?null:{code:v,name:Hl(v),meta:$l(l.data,o)};return{hostPlace:y,otherSelected:f,otherPlace:x,licensedLine:Wl(i,l.data,d,o),stateName:d===null?null:Hl(d),canContinue:d!==null,pickHost:m,pickOther:g,pickState:b}}function ql(t){let{reasonText:n,state:r,hostState:l,clinicianId:i,clinicians:o,policy:a,petName:s,controller:c,dispatch:d}=t,[u,p]=e.useState([]),[h,f]=e.useState(null),m=e.useRef(false),g=e.useMemo(()=>Nl(),[]),b=u.map(e=>g.find(t=>t.id===e)?.label??"").filter(Boolean),y=Bl(b,n),v=b.length>0?b.join(", "):n.trim(),x=e.useCallback(e=>p(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]),T=o?.find(e=>e.clinicianId===i)??o?.[0]??null,k=Ul({hostState:l,state:r,policy:a,clinician:T,petName:s??te.petFallback,controller:c,onState:e.useCallback(e=>{m.current=true,d({type:"patch",patch:{state:e,clinicianId:null}})},[d])});return{issueChips:g,concernIds:u,toggleConcern:x,composedReason:y,aboutLine:v,emergencyAnswer:h,setEmergencyAnswer:f,where:k,matchedClinician:T,whereTouched:m}}var Kl=/* @__PURE__ */Object.freeze(["pet","where","issues","reason","emergency","clinician","time","review","booked"]),Yl=/* @__PURE__ */Object.freeze({petId:null,state:null,clinicianId:null,slot:null,holdExpiresAt:null,shareHealthRecords:false,idempotencyKey:null});function initialTelevetBookingState(e,t={}){let n=/* @__PURE__ */Object.freeze({...Yl,...t}),r=Jl(0,e);/* @__PURE__ */
36
+ return Object.freeze({index:r,draft:n,furthestIndex:r})}function isSkipped(e,t){return e==="pet"?t.ownedPetCount<=1:e==="issues"?t.withIssues!==true:false}function Gl(e){return Kl[e]}function Jl(e,t){for(let n=e;n<Kl.length;n+=1){let e=Gl(n);if(e&&!isSkipped(e,t))return n}return Kl.length-1}function Ql(e,t){for(let n=e;n>=0;n-=1){let e=Gl(n);if(e&&!isSkipped(e,t))return n}return null}function hasPreviousStep(e,t){return Ql(e.index-1,t)!==null}function televetBookingReducer(e,t,n){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?/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze({...n,slot:null,holdExpiresAt:null,idempotencyKey:null})}):/* @__PURE__ */Object.freeze({...e,draft:/* @__PURE__ */Object.freeze(n)})}case"next":{let t=Jl(e.index+1,n);/* @__PURE__ */
37
+ return Object.freeze({...e,index:t,furthestIndex:Math.max(e.furthestIndex,t)})}case"back":{if(Gl(e.index)==="booked")return e;let t=Ql(e.index-1,n);return t===null?e:/* @__PURE__ */Object.freeze({...e,index:t})}case"goTo":{let r=Kl.indexOf(t.step);if(r<0)return e;let l=isSkipped(t.step,n)?Jl(r,n):r;/* @__PURE__ */
38
+ return Object.freeze({...e,index:l,furthestIndex:Math.max(e.furthestIndex,l)})}default:return e}}function Xl(e){return Kl.filter(t=>t!=="booked"&&(e===void 0||!isSkipped(t,e)))}function Zl(e,t,n=false){let r=e==="reason"&&n?"emergency":e,l=r==="booked"||t.includes(r)?t:Xl();return{current:r==="booked"?l.length:l.indexOf(r)+1,total:l.length,steps:l}}function currentStep(e){return Gl(e.index)??"pet"}function canConfirm(e,t){let n=t.trim();return!!e.petId&&!!e.clinicianId&&!!e.slot&&isWellFormedStateCode(e.state)&&n.length>0&&n.length<=b}function isHoldExpired(e,t){if(!e.holdExpiresAt)return false;let n=Date.parse(e.holdExpiresAt);return Number.isNaN(n)?false:n<=t}function ei(e,t,n){return e.slot?.slotId!==t||e.holdExpiresAt===null||e.idempotencyKey===null?false:!isHoldExpired(e,n)}var ti=/* @__PURE__ */Object.freeze({slot:null,holdExpiresAt:null,idempotencyKey:null}),ni=qe();function televetBookingKey(e){return`televet.book.${ni()}.${e}`}function attestation(e,t,n){let r=n?.version?.trim()??"";return!e||!t||r.length===0?/* @__PURE__ */Object.freeze({}):/* @__PURE__ */Object.freeze({state_attested:true,cancellation_policy_version:r})}function ri(e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function li(e){let t=ri(e);return t?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):""}function ii(e){let t=ri(e);return t?t.toLocaleDateString(void 0,{month:"long",day:"numeric"}):""}function oi(e){let t=ri(e);return t?t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"}):""}var ai=10;function si(e){let t=ri(e);return t?new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(e=>e.type==="timeZoneName")?.value??"":""}function formatVisitRange(e){let t=ri(e);if(!t)return"";let n=new Date(t.getTime()+ai*6e4).toISOString(),r=si(e),l=`${li(e)} - ${li(n)}`;return r&&r!==""?`${l} ${r}`:l}function formatWhen(e){let t=ii(e),n=[li(e),si(e)].filter(Boolean).join(" ");return[t,n].filter(Boolean).join(", ")}function formatWhenWithDay(e){let t=ri(e);return t?[t.toLocaleDateString(void 0,{weekday:"short"}),formatWhen(e)].filter(Boolean).join(", "):""}function ci(e){let t=ri(e);if(!t)return"";let n=t.toLocaleDateString(void 0,{weekday:"short"}),r=t.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}),l=[li(e),si(e)].filter(Boolean).join(" ");return[n,r,l].filter(Boolean).join(", ")}function di(e){return[li(e),si(e)].filter(Boolean).join(" ")}function ui(e){let t=ri(e);return t?`${t.getFullYear()}-${t.getMonth()+1}-${t.getDate()}`:"unknown"}function pi(e){let t=ri(e);return t===null?"":t.toLocaleDateString(void 0,{month:"long"})}function hi(e){let t=ri(e);return t===null?"":t.toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"})}function fi(e){return e.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function mi(e){let t=ri(e);return t?[fi(t),di(e)].filter(Boolean).join(" · "):""}function gi(e){return ri(e)?`${hi(e)} at ${di(e)}`:""}function bi(e,t=false){let n=ri(e);return n?`${fi(n)} at ${t?di(e):li(e)}`:""}function yi(e){let t=ri(e),n=t===null?0:t.getHours();return n<12?"morning":n<17?"afternoon":"evening"}function vi(t){let{draft:n,reasonText:r,book:l,stateAttested:i,termsAttested:o,cancellationPolicy:a,triage:s,goTo:c,releaseSlot:d,setFailure:u,setEmergency:h,setBookedConsult:f,onBooked:m,media:g}=t,b=e.useCallback(e=>{let t=n.idempotencyKey;if(!canConfirm(n,r)||!t||g?.sending)return;if(isHoldExpired(n,Date.now())){u("expired"),c("time");return}let b=e=>{let t=televetBookingRefusal(e);if(t.kind==="emergency"){h(t.categories);return}if(t.kind==="rate_limited"){u("rate_limited");return}u(t.kind==="not_entitled"?"not_entitled":t.kind==="slot_taken"?"taken":t.kind==="clinician_unavailable"?"clinician_unavailable":t.kind==="unavailable"?"unavailable":"failed"),t.kind==="slot_taken"&&(d(),c("time"))};u(null),h(null);let y=d=>l.mutate({pet_id:n.petId,clinician_id:n.clinicianId,slot_id:n.slot.slotId,state:n.state,reason_text:r.trim(),species:null,media_refs:d,emergency_acknowledged:e||s.isAcknowledged(r),share_health_records:n.shareHealthRecords,...attestation(i,o,a)},t,{onSuccess:e=>{if(!p(e)){b(bt(e.status));return}f(e),c("booked"),m?.(e)},onError:e=>b(xt(e))});if(!g){y([]);return}g.send().then(y,()=>y([]))},[n,r,l,i,o,a,s,c,d,u,h,f,m,g]),y=e.useCallback(()=>b(false),[b]);return{submitBooking:b,confirm:y}}function xi(e){return e.slot!==null&&e.holdExpiresAt!==null&&e.idempotencyKey!==null?e.slot.slotId:null}function Ti({controller:t,draft:n,keep:r}){let l=xi(n),i=e.useRef({controller:t,keep:r});i.current={controller:t,keep:r};let o=e.useRef(null);e.useEffect(()=>{let e=o.current;o.current=l,e!==null&&e!==l&&ki(i.current,e)},[l]),e.useEffect(()=>()=>{let e=o.current;o.current=null,e!==null&&ki(i.current,e)},[])}function ki(e,t){if(e.keep)return;let n=e.controller,r=n?.releaseHold;n==null||r===void 0||r.call(n,t).catch(()=>{}).finally(()=>Nn(n,On))}function wi(e){if(e.httpStatus===409)/* @__PURE__ */return Object.freeze({failure:"taken"});switch(televetBookingRefusal(e).kind){case"slot_taken":/* @__PURE__ */
39
39
  return Object.freeze({failure:"taken"});case"rate_limited":/* @__PURE__ */
40
40
  return Object.freeze({failure:"rate_limited"});case"not_entitled":/* @__PURE__ */
41
41
  return Object.freeze({failure:"not_entitled"});case"unavailable":/* @__PURE__ */
42
42
  return Object.freeze({failure:"unavailable"});default:/* @__PURE__ */
43
- return Object.freeze({failure:"failed"})}}function wi(t){let{draft:n,hold:r,dispatch:l,setFailure:i,refetchSlots:o}=t;return e.useCallback(e=>{if(i(null),Zl(n,e.slotId,Date.now())){l({type:"next"});return}r.mutate(e.slotId,{onSuccess:t=>{l({type:"patch",patch:{slot:e,holdExpiresAt:t.expiresAt,idempotencyKey:televetBookingKey(e.slotId)}}),l({type:"next"})},onError:e=>{let t=ki(e);i(t.failure),t.failure==="taken"&&o()}})},[n,r,l,i,o])}function Si(e){let t=e?.triage;return!e||!t?null:async(n,r)=>{let l=await t.call(e,n,r);return l.ok?l.value:null}}function useEarlyTriage(t){let[n,r]=e.useState(false),[l,i]=e.useState(false),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true);e.useEffect(()=>(d.current=true,()=>{d.current=false,c.current?.abort(),c.current=null}),[]);let u=e.useCallback(()=>{c.current?.abort(),c.current=null,d.current&&i(false)},[]),p=e.useCallback(async e=>{if(c.current!==null)return false;let n=e.trim();if(o!==null&&o===n||!t)return true;let l=s.current!==null&&s.current.reason===n?s.current.emergency:null;if(l===null){let e=new AbortController;c.current=e,i(true);try{let r=await t(n,e.signal);if(e.signal.aborted||!d.current)return!1;r===null?l=!1:(l=r.isEmergency||r.fallback,s.current=/* @__PURE__ */Object.freeze({reason:n,emergency:l}))}catch{if(e.signal.aborted||!d.current)return false;l=false}finally{c.current===e&&(c.current=null,d.current&&i(false))}}return l===true?(r(true),false):true},[o,t]),h=e.useCallback(e=>{a(e.trim()),r(false)},[]),f=e.useCallback(()=>r(false),[]),m=e.useCallback(()=>{u(),s.current=null,a(null),r(false)},[u]),g=e.useCallback(e=>o!==null&&o===e.trim(),[o]);return{open:n,checking:l,check:p,acknowledge:h,close:f,cancel:u,reset:m,isAcknowledged:g}}function ji(e){let t=e?.trim().toUpperCase()??"";return/^[A-Z]{2}$/.test(t)?t:null}function useStateInterest(t,n){let r=ji(t),[l,i]=e.useState(()=>/* @__PURE__ */Object.freeze({})),o=e.useRef(0),a=e.useRef(null),s=e.useCallback(e=>{if(!n||r===null)return null;let t=`${r}:${e}`;a.current!==null&&a.current!==t&&(o.current+=1),a.current=t;let s=l[t]??"idle";return{joined:s==="joined",pending:s==="pending",failed:s==="failed",onPress:()=>{if(s==="pending"||s==="joined")return;let l=o.current+=1;i(e=>/* @__PURE__ */Object.freeze({...e,[t]:"pending"})),(async()=>{let a=false;try{a=await n(r,e)}catch{a=false}o.current===l&&i(e=>/* @__PURE__ */Object.freeze({...e,[t]:a?"joined":"failed"}))})()}}},[r,l,n]);return e.useMemo(()=>({actionFor:s}),[s])}function televetEmptyRosterView(e){/* @__PURE__ */
44
- return Object.freeze(e==="dark"?{title:ee.noCliniciansTitle,message:ee.noCliniciansBody,retryLabel:ee.noCliniciansRetryCta,interestReason:null}:{title:ee.noCliniciansTitle,message:ee.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}function televetEmptyRosterCause(e){return e?"roster":"dark"}var Ci=120;function sanitizeFilename(e){if(!e)return"attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return"attachment";if(t.length<=Ci)return t;let n=t.lastIndexOf(".");if(n===-1||n===t.length-1)return t.slice(0,Ci);let r=t.slice(n);return r.length>=Ci?t.slice(0,Ci):`${t.slice(0,n).slice(0,Ci-r.length)}${r}`}var _i=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),Ii=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function Ei(e,t,n,r){/* @__PURE__ */
45
- return Object.freeze({code:e,retryable:t,filename:n,...{}})}async function uploadAttachmentBytes(e,t,n,r){let l=()=>r?.signal?.aborted===true;if(l())return Ii(Ei("cancelled",true,n.filename));try{return await e.postMultipart(t,n.file,{...r?.signal?{signal:r.signal}:{},...r?.onProgress?{onProgress:r.onProgress}:{}}),_i(void 0)}catch{return l()?Ii(Ei("cancelled",true,n.filename)):Ii(Ei("server",true,n.filename))}}var Di=/* @__PURE__ */Object.freeze({failed:0,refused:/* @__PURE__ */Object.freeze({size:0,type:0,unreadable:0})});function isMediaShortfallEmpty(e){let{failed:t,refused:n}=e;return t<=0&&n.size<=0&&n.type<=0&&n.unreadable<=0}function televetMediaShortfallLines(e){let t=e=>Number.isFinite(e)&&e>0?Math.floor(e):0,n=ee.media;return[{n:t(e.failed),one:n.droppedTemplate,many:n.droppedPluralTemplate},{n:t(e.refused.size),one:n.refusedSizeTemplate,many:n.refusedSizePluralTemplate},{n:t(e.refused.type),one:n.refusedTypeTemplate,many:n.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:n.refusedUnreadableTemplate,many:n.refusedUnreadablePluralTemplate}].filter(e=>e.n>0).map(e=>Z(e.n===1?e.one:e.many,{n:String(e.n)}))}function mediaShortfallFromUnsentPicks(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Di:/* @__PURE__ */Object.freeze({failed:t,refused:Di.refused})}function withUnsentPicks(e,t){let n=mediaShortfallFromUnsentPicks(t);return n.failed===0?e:/* @__PURE__ */Object.freeze({failed:e.failed+n.failed,refused:e.refused})}var Pi=6e4;function Ri(e){let t=dt(e.filename,e.mimeType);return t===null?null:{file:{uri:e.uri,name:e.filename,mimeType:t,sizeBytes:e.fileSize},filename:e.filename,contentType:t,sizeBytes:e.fileSize}}function zi(e,t){if(e?.kind!=="ready")return null;let n=e.policy.expires_in_seconds*1e3;return t-e.at<n-Pi?e.policy:null}function Fi({media:t,controller:n,transport:r}){let[l,i]=e.useState(()=>/* @__PURE__ */new Map),[o,a]=e.useState(false),[s,c]=e.useState(false),d=e.useRef(l),u=e.useRef(t);u.current=t;let p=e.useRef(false),h=e.useRef(false),f=e.useRef(new AbortController);e.useEffect(()=>{let e=new AbortController;return f.current=e,()=>e.abort()},[]);let m=n?.initiateAttachment?.bind(n),g=o||m===void 0,y=e.useCallback((e,t)=>{let n=new Map(d.current);n.set(e,t),d.current=n,i(n)},[]),b=e.useCallback(()=>{p.current=true,a(true)},[]),v=e.useCallback(async(e,t)=>{if(m===void 0)return"dark";let n=await m({filename:t.filename,contentType:t.contentType,fileSize:t.sizeBytes},f.current.signal);if(f.current.signal.aborted)return null;if(n.ok)return y(e.uri,{kind:"ready",policy:n.value,at:Date.now()}),n.value;let r=ft(n.error);return r==="dark"?"dark":(y(e.uri,r==="failed"?{kind:"retry"}:{kind:"refused",cause:r}),null)},[m,y]);e.useEffect(()=>{if(!g)for(let e of t){if(d.current.has(e.uri))continue;let t=ut(e),n=Ri(e);if(t!==null||n===null){y(e.uri,{kind:"refused",cause:t??"type"});continue}y(e.uri,{kind:"checking"}),v(e,n).then(e=>{e==="dark"&&b()})}},[t,g,v,y,b]);let x=e.useCallback(async()=>{if(p.current||m===void 0||h.current)return[];h.current=true,c(true);let e=[];try{for(let t of u.current){let n=d.current.get(t.uri);if(n?.kind==="sent"){e.push(n.s3Key);continue}if(n?.kind==="refused")continue;let l=Ri(t);if(l===null)continue;let i=zi(n,Date.now());if(i===null){let e=await v(t,l);if(e==="dark")return b(),[];if(e===null){d.current.get(t.uri)?.kind==="retry"&&y(t.uri,{kind:"failed"});continue}i=e}if(f.current.signal.aborted)return[];let o=await uploadAttachmentBytes(r,i,l,{signal:f.current.signal});if(f.current.signal.aborted)return[];o.ok?(y(t.uri,{kind:"sent",s3Key:i.s3_key}),e.push(i.s3_key)):y(t.uri,{kind:"failed"})}return e}catch{return e}finally{h.current=false,f.current.signal.aborted||c(false)}},[m,v,y,b,r]),T=e.useMemo(()=>{if(t.length===0)return Di;if(g)return mediaShortfallFromUnsentPicks(t.length);let e={size:0,type:0,unreadable:0},n=0;for(let r of t){let t=l.get(r.uri);t?.kind==="refused"?e[t.cause]+=1:t?.kind==="failed"&&(n+=1)}return n===0&&e.size+e.type+e.unreadable===0?Di:/* @__PURE__ */Object.freeze({failed:n,refused:/* @__PURE__ */Object.freeze(e)})},[t,g,l]),k=e.useMemo(()=>t.flatMap(e=>{let t=l.get(e.uri);return t?.kind==="sent"?[{key:t.s3Key,pick:e}]:[]}),[t,l]),w=e.useCallback(e=>{if(g)return T;let t=new Set(e.mediaRefs),n=k.filter(e=>!t.has(e.key)).length;return n===0?T:/* @__PURE__ */Object.freeze({failed:T.failed+n,refused:T.refused})},[g,T,k]),S=e.useCallback(e=>{if(g||k.length!==1)return false;let[t]=k;return t===void 0||!e.mediaRefs.includes(t.key)?false:(dt(t.pick.filename,t.pick.mimeType)??"").startsWith("image/")},[g,k]),j=!g&&[...l.values()].some(e=>e.kind==="ready"||e.kind==="sent");return e.useMemo(()=>({shortfall:T,sending:s,live:j,send:x,bookedShortfall:w,sentOnePhoto:S}),[T,s,j,x,w,S])}var Li="file",Ai="multipart upload failed";function Oi(e){let t;try{t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);t.append(Li,e.file)}catch{return Promise.reject(new Error(Ai))}return e.fetch!==void 0?Bi(e.fetch,e.url,t,e.signal):Ni(e.url,t,e.signal)}function Vi(e){return e>=200&&e<300}function Ni(e,t,n){return new Promise((r,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||n?.aborted===true){l(new Error(Ai));return}let o=null,a=()=>{o!==null&&n?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(Ai))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),r(Vi(l.status))},l.onerror=s,l.ontimeout=s,l.onabort=s,n!==void 0&&(o=()=>{try{l.abort()}finally{s()}},n.addEventListener("abort",o,{once:!0})),l.send(t)}catch{s()}})}function Bi(e,t,n,r){return Promise.resolve().then(()=>e(t,{method:"POST",body:n,credentials:"omit",...r?{signal:r}:{}})).then(e=>e.ok)}var Mi="chat attachment upload: the file handle has no uri",Hi="chat attachment upload failed";function $i(e){return{uri:e.uri,name:sanitizeFilename(e.name),type:e.mimeType}}function createRnChatAttachmentTransport(e={}){/* @__PURE__ */
46
- return Object.freeze({postMultipart(t,n,r){if(typeof n.uri!="string"||n.uri.length===0)return Promise.reject(new Error(Mi));let{signal:l,onProgress:i}=r,o=()=>Promise.reject(new Error(Hi));return l?.aborted===true?o():Oi({url:t.upload_url,fields:t.upload_fields,file:$i(n),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var Wi=/* @__PURE__ */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:/* @__PURE__ */Object.freeze({completed:"Complete it",cancelled:"Cancel it",no_show:"Mark no-show"}),events:/* @__PURE__ */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 Ui="/widget/v1/televet/sandbox/visits",qi=128,Ki=64,Yi=/* @__PURE__ */new Set(["booked","cancelled","completed","no_show"]),Gi=/* @__PURE__ */new Set(["applied","already_applied","not_applicable"]),Ji=/* @__PURE__ */new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),Qi=/* @__PURE__ */new Set(["24h","30m"]);function Xi(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function Zi(e,t,n){return typeof t!="string"||t.length===0?Xi(`${e} is required and must be a non-empty string`):Pr(t)?Xi(`${e} contains an unpaired surrogate and cannot be encoded`):Rr(t)>n?Xi(`${e} is longer than ${n} characters`):null}function eo(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:n}=e;if(typeof t!="string"||!Gi.has(t)||typeof n!="object"||n===null)return null;let{visit_ref:r,pet_ref:l,status:i,scheduled_at:o}=n;return typeof r!="string"||r.length===0||typeof l!="string"||l.length===0||typeof i!="string"||!Yi.has(i)||typeof o!="string"||o.length===0?null:/* @__PURE__ */Object.freeze({result:t,visit:/* @__PURE__ */Object.freeze({visitRef:r,petRef:l,status:i,scheduledAt:o})})}function to(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=async(e,n,r)=>{let l=await t.send(e,{method:"POST",path:n,body:r},{idempotent:false,maxAttempts:1});if(!l.ok)return err(l.error);let i=eo(l.value);return i===null?err(makeEverfurError("internalError",{retryable:false})):ok(i)};return{createVisit(petRef){let e=Zi("pet_ref",petRef,qi);return e!==null?Promise.resolve(err(e)):n("televet.sandbox.createVisit",Ui,{pet_ref:petRef})},advanceVisit(e,t){let r=Zi("visit_ref",e,Ki);if(r!==null)return Promise.resolve(err(r));if(typeof t!="string"||!Yi.has(t))return Promise.resolve(err(Xi("to must be booked, cancelled, completed or no_show")));let l=`${Ui}/${encodeURIComponent(e)}/advance`;return n("televet.sandbox.advanceVisit",l,{to:t})},simulateVisitEvent(e,t,r){let l=Zi("visit_ref",e,Ki);if(l!==null)return Promise.resolve(err(l));if(typeof t!="string"||!Ji.has(t))return Promise.resolve(err(Xi(`event must be one of ${[...Ji].join(", ")}`)));if(t==="reminder"){if(typeof r!="string"||!Qi.has(r))return Promise.resolve(err(Xi(`stage must be one of ${[...Qi].join(", ")} for a reminder`)))}else if(r!==void 0)return Promise.resolve(err(Xi("stage is only for a reminder")));let i=`${Ui}/${encodeURIComponent(e)}/simulate`;return n("televet.sandbox.simulateVisitEvent",i,r===void 0?{event:t}:{event:t,stage:r})}}}function useEverfurVetVisitSandbox(){let{runtime:t,userRef:userRef,scopeEpoch:n}=Tn();return e.useMemo(()=>{let{services:e}=t.registry;return to({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[t,userRef,n])}function no(e,t){return!e||!t.enabled?false:t.data!==null&&t.data.active===false||Kn({error:t.error??null})}var ro=e=>e.livemode===false;function lo(){let t=Tn().runtime.entitlements,n=e.useCallback(()=>ro(t.getSnapshot()),[t]);return e.useSyncExternalStore(t.subscribe,n,n)}function io(e,t){let n=no(lo(),e);return{simulate:n,fundingRefused:t&&!n}}function oo(e,t){return!e||!t.enabled?true:(t.data!==null||(t.error??null)!==null)&&!no(true,t)}function ao(e,t){return oo(lo(),t)?e:null}function so(petRef){let t=useEverfurVetVisitSandbox(),[n,r]=e.useState(null),[l,i]=e.useState(null),[o,a]=e.useState(false),s=e.useRef(false),c=e.useRef(true);e.useEffect(()=>(c.current=true,()=>{c.current=false}),[]);let d=e.useCallback((e,t,n)=>{s.current||(s.current=true,a(true),t().then(t=>{if(s.current=false,!!c.current){if(a(false),!t.ok){i({tone:"danger",text:Z(Wi.errorTemplate,{label:e,message:t.error.displayMessage})});return}n&&r(t.value.visit),i({tone:"ok",text:Z(Wi.resultTemplate,{label:e,result:t.value.result})})}}))},[]),u=e.useCallback(()=>{d(Wi.createLabel,()=>t.createVisit(petRef),true)},[petRef,d,t]),p=e.useCallback(e=>{n!==null&&d(Wi.advance[e],()=>t.advanceVisit(n.visitRef,e),true)},[d,t,n]),h=e.useCallback(e=>{if(n===null)return;let r=e==="reminder"?"24h":void 0;d(Wi.events[e],()=>t.simulateVisitEvent(n.visitRef,e,r),false)},[d,t,n]),f=n===null?null:Z(Wi.visitTemplate,{visitRef:n.visitRef,status:n.status,scheduledAt:n.scheduledAt});return{visit:n,visitLine:f,line:l,busy:o,create:u,advance:p,raise:h}}var co=/* @__PURE__ */Object.freeze(["completed","cancelled","no_show"]),uo=/* @__PURE__ */Object.freeze(["rescheduled","reminder","followup_sent","message_received","ended"]);function parseColor(e){let t=po(e);return t===null?null:vo(t)}function po(e){if(typeof e=="number")return mo(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return ho(t.slice(1));if(t.toLowerCase().startsWith("0x"))return ho(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return fo(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=ho(t);if(e!==null)return e}return/^\d+$/.test(t)?mo(Number.parseInt(t,10)):null}function ho(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:yo(t[0]),g:yo(t[1]),b:yo(t[2]),a:1};if(t.length===6)return{r:go(t,0),g:go(t,2),b:go(t,4),a:1};if(t.length===8){let e=go(t,0);return{r:go(t,2),g:go(t,4),b:go(t,6),a:e/255}}return null}function fo(e){let t=e.indexOf("("),n=e.indexOf(")");if(t<0||n<0||n<t)return null;let r=e.slice(t+1,n).split(",").map(e=>e.trim());if(r.length<3)return null;let l=bo(Number(r[0])),i=bo(Number(r[1])),o=bo(Number(r[2]));if(l===null||i===null||o===null)return null;let a=1;if(r.length>=4){let e=Number(r[3]);if(!Number.isFinite(e))return null;a=Math.min(1,Math.max(0,e))}return{r:l,g:i,b:o,a:a}}function mo(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,n=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:n===0?1:n/255}}function go(e,t){return Number.parseInt(e.slice(t,t+2),16)}function yo(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function bo(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function vo(e){if(e.a>=1)return xo(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function xo(e,t,n){return`#${To(e)}${To(t)}${To(n)}`.toUpperCase()}function To(e){return e.toString(16).padStart(2,"0")}var ko="#FFFFFF",wo="#000000";function So(e){let t=t=>e.reduce((e,n)=>Math.min(e,contrastRatio(t,n)),Number.POSITIVE_INFINITY);return t(ko)>=t(wo)?ko:wo}function jo(e){let t=Co(e.r/255),n=Co(e.g/255),r=Co(e.b/255);return.2126*t+.7152*n+.0722*r}function Co(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function _o(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function contrastRatio(e,t){let n=po(e),r=po(t);if(n===null||r===null)return 1;let l=r.a>=1?r:{...r},i=n.a>=1?n:Io(n,l);return _o(jo(i),jo(l))}function Io(e,t){let n=e.a,r=(e,t)=>Math.round(e*n+t*(1-n));return{r:r(e.r,t.r),g:r(e.g,t.g),b:r(e.b,t.b),a:1}}function Eo(e,t){let n=po(e),r=po(t);if(n===null||r===null)return null;let l=n.a>=1?n:Io(n,{...r});return xo(l.r,l.g,l.b)}function Do(e,t){let n=po(e);if(n===null)return null;let r=Math.min(1,Math.max(0,t));return`rgba(${n.r}, ${n.g}, ${n.b}, ${r})`}var Po=.22,Ro=.5,zo="#FFC3BC";function Fo(e){let t=e.color;return{ink:t.brandInk,text:t.text.primary,muted:t.text.muted,line:t.borderRingCream,mist:t.surfaceSubtle,surface:t.surface,pink:t.highlight,onPink:t.onHighlight,go:t.mark,alert:t.danger,alertWash:t.badgeBgCritical}}function Lo(e){let t=e.color,n=parseColor(t.highlight)===zo,r=Do(t.highlight,n?Po:Ro);return{...Fo(e),pinkSoft:(r===null?null:Eo(r,t.surface))??t.surface}}function Ao(e,t){if(e===void 0)return{};let n={};return e.backgroundColor!==void 0&&(n.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(n.borderColor=e.borderColor,n.borderWidth=t??1),e.borderRadius!==void 0&&(n.borderRadius=e.borderRadius),n}function Oo(e,t){return e===void 0||e.borderRadius!==void 0||e.backgroundColor===void 0&&e.borderColor===void 0?e:{...e,borderRadius:t}}function Vo(e){return e?.textColor===void 0?{}:{color:e.textColor}}var No=44;function Bo(){let t=useEverfurTheme();return e.useMemo(()=>Mo(t),[t])}function TelevetButton({label:e,onPress:n,kind:l="primary",disabled:i=false,loading:o=false,fullWidth:a=true,accessibilityLabel:s,testID:c,style:d}){let u=Bo(),p=useEverfurTheme(),h=i||o;/* @__PURE__ */
43
+ return Object.freeze({failure:"failed"})}}function Si(t){let{draft:n,hold:r,dispatch:l,setFailure:i,refetchSlots:o}=t;return e.useCallback(e=>{if(i(null),ei(n,e.slotId,Date.now())){l({type:"next"});return}r.mutate(e.slotId,{onSuccess:t=>{l({type:"patch",patch:{slot:e,holdExpiresAt:t.expiresAt,idempotencyKey:televetBookingKey(e.slotId)}}),l({type:"next"})},onError:e=>{let t=wi(e);i(t.failure),t.failure==="taken"&&o()}})},[n,r,l,i,o])}function ji(e){let t=e?.triage;return!e||!t?null:async(n,r)=>{let l=await t.call(e,n,r);return l.ok?l.value:null}}function useEarlyTriage(t){let[n,r]=e.useState(false),[l,i]=e.useState(false),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true);e.useEffect(()=>(d.current=true,()=>{d.current=false,c.current?.abort(),c.current=null}),[]);let u=e.useCallback(()=>{c.current?.abort(),c.current=null,d.current&&i(false)},[]),p=e.useCallback(async e=>{if(c.current!==null)return false;let n=e.trim();if(o!==null&&o===n||!t)return true;let l=s.current!==null&&s.current.reason===n?s.current.emergency:null;if(l===null){let e=new AbortController;c.current=e,i(true);try{let r=await t(n,e.signal);if(e.signal.aborted||!d.current)return!1;r===null?l=!1:(l=r.isEmergency||r.fallback,s.current=/* @__PURE__ */Object.freeze({reason:n,emergency:l}))}catch{if(e.signal.aborted||!d.current)return false;l=false}finally{c.current===e&&(c.current=null,d.current&&i(false))}}return l===true?(r(true),false):true},[o,t]),h=e.useCallback(e=>{a(e.trim()),r(false)},[]),f=e.useCallback(()=>r(false),[]),m=e.useCallback(()=>{u(),s.current=null,a(null),r(false)},[u]),g=e.useCallback(e=>o!==null&&o===e.trim(),[o]);return{open:n,checking:l,check:p,acknowledge:h,close:f,cancel:u,reset:m,isAcknowledged:g}}function Ci(e){let t=e?.trim().toUpperCase()??"";return/^[A-Z]{2}$/.test(t)?t:null}function useStateInterest(t,n){let r=Ci(t),[l,i]=e.useState(()=>/* @__PURE__ */Object.freeze({})),o=e.useRef(0),a=e.useRef(null),s=e.useCallback(e=>{if(!n||r===null)return null;let t=`${r}:${e}`;a.current!==null&&a.current!==t&&(o.current+=1),a.current=t;let s=l[t]??"idle";return{joined:s==="joined",pending:s==="pending",failed:s==="failed",onPress:()=>{if(s==="pending"||s==="joined")return;let l=o.current+=1;i(e=>/* @__PURE__ */Object.freeze({...e,[t]:"pending"})),(async()=>{let a=false;try{a=await n(r,e)}catch{a=false}o.current===l&&i(e=>/* @__PURE__ */Object.freeze({...e,[t]:a?"joined":"failed"}))})()}}},[r,l,n]);return e.useMemo(()=>({actionFor:s}),[s])}function televetEmptyRosterView(e){/* @__PURE__ */
44
+ return Object.freeze(e==="dark"?{title:te.noCliniciansTitle,message:te.noCliniciansBody,retryLabel:te.noCliniciansRetryCta,interestReason:null}:{title:te.noCliniciansTitle,message:te.noCliniciansRegionBody,retryLabel:null,interestReason:"no_licensed_vet"})}function televetEmptyRosterCause(e){return e?"roster":"dark"}var _i=120;function sanitizeFilename(e){if(!e)return"attachment";let t=e.replace(/[\\/]+/g," ").replace(/[\x00-\x1f\x7f"]/g,"").replace(/\s+/g," ").trim();if(!t)return"attachment";if(t.length<=_i)return t;let n=t.lastIndexOf(".");if(n===-1||n===t.length-1)return t.slice(0,_i);let r=t.slice(n);return r.length>=_i?t.slice(0,_i):`${t.slice(0,n).slice(0,_i-r.length)}${r}`}var Ii=e=>/* @__PURE__ */Object.freeze({ok:true,value:e}),Ei=e=>/* @__PURE__ */Object.freeze({ok:false,error:e});function Di(e,t,n,r){/* @__PURE__ */
45
+ return Object.freeze({code:e,retryable:t,filename:n,...{}})}async function uploadAttachmentBytes(e,t,n,r){let l=()=>r?.signal?.aborted===true;if(l())return Ei(Di("cancelled",true,n.filename));try{return await e.postMultipart(t,n.file,{...r?.signal?{signal:r.signal}:{},...r?.onProgress?{onProgress:r.onProgress}:{}}),Ii(void 0)}catch{return l()?Ei(Di("cancelled",true,n.filename)):Ei(Di("server",true,n.filename))}}var Pi=/* @__PURE__ */Object.freeze({failed:0,refused:/* @__PURE__ */Object.freeze({size:0,type:0,unreadable:0})});function isMediaShortfallEmpty(e){let{failed:t,refused:n}=e;return t<=0&&n.size<=0&&n.type<=0&&n.unreadable<=0}function televetMediaShortfallLines(e){let t=e=>Number.isFinite(e)&&e>0?Math.floor(e):0,n=te.media;return[{n:t(e.failed),one:n.droppedTemplate,many:n.droppedPluralTemplate},{n:t(e.refused.size),one:n.refusedSizeTemplate,many:n.refusedSizePluralTemplate},{n:t(e.refused.type),one:n.refusedTypeTemplate,many:n.refusedTypePluralTemplate},{n:t(e.refused.unreadable),one:n.refusedUnreadableTemplate,many:n.refusedUnreadablePluralTemplate}].filter(e=>e.n>0).map(e=>ee(e.n===1?e.one:e.many,{n:String(e.n)}))}function mediaShortfallFromUnsentPicks(e){let t=Number.isFinite(e)&&e>0?Math.floor(e):0;return t===0?Pi:/* @__PURE__ */Object.freeze({failed:t,refused:Pi.refused})}function withUnsentPicks(e,t){let n=mediaShortfallFromUnsentPicks(t);return n.failed===0?e:/* @__PURE__ */Object.freeze({failed:e.failed+n.failed,refused:e.refused})}var Ri=6e4;function zi(e){let t=ut(e.filename,e.mimeType);return t===null?null:{file:{uri:e.uri,name:e.filename,mimeType:t,sizeBytes:e.fileSize},filename:e.filename,contentType:t,sizeBytes:e.fileSize}}function Fi(e,t){if(e?.kind!=="ready")return null;let n=e.policy.expires_in_seconds*1e3;return t-e.at<n-Ri?e.policy:null}function Li({media:t,controller:n,transport:r}){let[l,i]=e.useState(()=>/* @__PURE__ */new Map),[o,a]=e.useState(false),[s,c]=e.useState(false),d=e.useRef(l),u=e.useRef(t);u.current=t;let p=e.useRef(false),h=e.useRef(false),f=e.useRef(new AbortController);e.useEffect(()=>{let e=new AbortController;return f.current=e,()=>e.abort()},[]);let m=n?.initiateAttachment?.bind(n),g=o||m===void 0,b=e.useCallback((e,t)=>{let n=new Map(d.current);n.set(e,t),d.current=n,i(n)},[]),y=e.useCallback(()=>{p.current=true,a(true)},[]),v=e.useCallback(async(e,t)=>{if(m===void 0)return"dark";let n=await m({filename:t.filename,contentType:t.contentType,fileSize:t.sizeBytes},f.current.signal);if(f.current.signal.aborted)return null;if(n.ok)return b(e.uri,{kind:"ready",policy:n.value,at:Date.now()}),n.value;let r=mt(n.error);return r==="dark"?"dark":(b(e.uri,r==="failed"?{kind:"retry"}:{kind:"refused",cause:r}),null)},[m,b]);e.useEffect(()=>{if(!g)for(let e of t){if(d.current.has(e.uri))continue;let t=pt(e),n=zi(e);if(t!==null||n===null){b(e.uri,{kind:"refused",cause:t??"type"});continue}b(e.uri,{kind:"checking"}),v(e,n).then(e=>{e==="dark"&&y()})}},[t,g,v,b,y]);let x=e.useCallback(async()=>{if(p.current||m===void 0||h.current)return[];h.current=true,c(true);let e=[];try{for(let t of u.current){let n=d.current.get(t.uri);if(n?.kind==="sent"){e.push(n.s3Key);continue}if(n?.kind==="refused")continue;let l=zi(t);if(l===null)continue;let i=Fi(n,Date.now());if(i===null){let e=await v(t,l);if(e==="dark")return y(),[];if(e===null){d.current.get(t.uri)?.kind==="retry"&&b(t.uri,{kind:"failed"});continue}i=e}if(f.current.signal.aborted)return[];let o=await uploadAttachmentBytes(r,i,l,{signal:f.current.signal});if(f.current.signal.aborted)return[];o.ok?(b(t.uri,{kind:"sent",s3Key:i.s3_key}),e.push(i.s3_key)):b(t.uri,{kind:"failed"})}return e}catch{return e}finally{h.current=false,f.current.signal.aborted||c(false)}},[m,v,b,y,r]),T=e.useMemo(()=>{if(t.length===0)return Pi;if(g)return mediaShortfallFromUnsentPicks(t.length);let e={size:0,type:0,unreadable:0},n=0;for(let r of t){let t=l.get(r.uri);t?.kind==="refused"?e[t.cause]+=1:t?.kind==="failed"&&(n+=1)}return n===0&&e.size+e.type+e.unreadable===0?Pi:/* @__PURE__ */Object.freeze({failed:n,refused:/* @__PURE__ */Object.freeze(e)})},[t,g,l]),k=e.useMemo(()=>t.flatMap(e=>{let t=l.get(e.uri);return t?.kind==="sent"?[{key:t.s3Key,pick:e}]:[]}),[t,l]),w=e.useCallback(e=>{if(g)return T;let t=new Set(e.mediaRefs),n=k.filter(e=>!t.has(e.key)).length;return n===0?T:/* @__PURE__ */Object.freeze({failed:T.failed+n,refused:T.refused})},[g,T,k]),S=e.useCallback(e=>{if(g||k.length!==1)return false;let[t]=k;return t===void 0||!e.mediaRefs.includes(t.key)?false:(ut(t.pick.filename,t.pick.mimeType)??"").startsWith("image/")},[g,k]),j=!g&&[...l.values()].some(e=>e.kind==="ready"||e.kind==="sent");return e.useMemo(()=>({shortfall:T,sending:s,live:j,send:x,bookedShortfall:w,sentOnePhoto:S}),[T,s,j,x,w,S])}var Ai="file",Oi="multipart upload failed";function Vi(e){let t;try{t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);t.append(Ai,e.file)}catch{return Promise.reject(new Error(Oi))}return e.fetch!==void 0?Mi(e.fetch,e.url,t,e.signal):Bi(e.url,t,e.signal)}function Ni(e){return e>=200&&e<300}function Bi(e,t,n){return new Promise((r,l)=>{let i=globalThis.XMLHttpRequest;if(typeof i!="function"||n?.aborted===true){l(new Error(Oi));return}let o=null,a=()=>{o!==null&&n?.removeEventListener("abort",o)},s=()=>{a(),l(new Error(Oi))};try{let l=new i;l.open("POST",e),l.withCredentials=!1,l.onload=()=>{a(),r(Ni(l.status))},l.onerror=s,l.ontimeout=s,l.onabort=s,n!==void 0&&(o=()=>{try{l.abort()}finally{s()}},n.addEventListener("abort",o,{once:!0})),l.send(t)}catch{s()}})}function Mi(e,t,n,r){return Promise.resolve().then(()=>e(t,{method:"POST",body:n,credentials:"omit",...r?{signal:r}:{}})).then(e=>e.ok)}var Hi="chat attachment upload: the file handle has no uri",$i="chat attachment upload failed";function Wi(e){return{uri:e.uri,name:sanitizeFilename(e.name),type:e.mimeType}}function createRnChatAttachmentTransport(e={}){/* @__PURE__ */
46
+ return Object.freeze({postMultipart(t,n,r){if(typeof n.uri!="string"||n.uri.length===0)return Promise.reject(new Error(Hi));let{signal:l,onProgress:i}=r,o=()=>Promise.reject(new Error($i));return l?.aborted===true?o():Vi({url:t.upload_url,fields:t.upload_fields,file:Wi(n),signal:l,fetch:e.fetch}).then(e=>{if(!e)return o();i?.(1)},o)}})}var Ui=/* @__PURE__ */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:/* @__PURE__ */Object.freeze({completed:"Complete it",cancelled:"Cancel it",no_show:"Mark no-show"}),events:/* @__PURE__ */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 qi="/widget/v1/televet/sandbox/visits",Ki=128,Yi=64,Gi=/* @__PURE__ */new Set(["booked","cancelled","completed","no_show"]),Ji=/* @__PURE__ */new Set(["applied","already_applied","not_applicable"]),Qi=/* @__PURE__ */new Set(["rescheduled","reminder","followup_sent","message_received","ended"]),Xi=/* @__PURE__ */new Set(["24h","30m"]);function Zi(e){return makeEverfurError("validationFailed",{retryable:false,wireMessage:e})}function eo(e,t,n){return typeof t!="string"||t.length===0?Zi(`${e} is required and must be a non-empty string`):Rr(t)?Zi(`${e} contains an unpaired surrogate and cannot be encoded`):zr(t)>n?Zi(`${e} is longer than ${n} characters`):null}function to(e){if(typeof e!="object"||e===null)return null;let{result:t,visit:n}=e;if(typeof t!="string"||!Ji.has(t)||typeof n!="object"||n===null)return null;let{visit_ref:r,pet_ref:l,status:i,scheduled_at:o}=n;return typeof r!="string"||r.length===0||typeof l!="string"||l.length===0||typeof i!="string"||!Gi.has(i)||typeof o!="string"||o.length===0?null:/* @__PURE__ */Object.freeze({result:t,visit:/* @__PURE__ */Object.freeze({visitRef:r,petRef:l,status:i,scheduledAt:o})})}function no(e){let t=e.funnel??createRequestFunnel({auth:e.auth,...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}}),n=async(e,n,r)=>{let l=await t.send(e,{method:"POST",path:n,body:r},{idempotent:false,maxAttempts:1});if(!l.ok)return err(l.error);let i=to(l.value);return i===null?err(makeEverfurError("internalError",{retryable:false})):ok(i)};return{createVisit(petRef){let e=eo("pet_ref",petRef,Ki);return e!==null?Promise.resolve(err(e)):n("televet.sandbox.createVisit",qi,{pet_ref:petRef})},advanceVisit(e,t){let r=eo("visit_ref",e,Yi);if(r!==null)return Promise.resolve(err(r));if(typeof t!="string"||!Gi.has(t))return Promise.resolve(err(Zi("to must be booked, cancelled, completed or no_show")));let l=`${qi}/${encodeURIComponent(e)}/advance`;return n("televet.sandbox.advanceVisit",l,{to:t})},simulateVisitEvent(e,t,r){let l=eo("visit_ref",e,Yi);if(l!==null)return Promise.resolve(err(l));if(typeof t!="string"||!Qi.has(t))return Promise.resolve(err(Zi(`event must be one of ${[...Qi].join(", ")}`)));if(t==="reminder"){if(typeof r!="string"||!Xi.has(r))return Promise.resolve(err(Zi(`stage must be one of ${[...Xi].join(", ")} for a reminder`)))}else if(r!==void 0)return Promise.resolve(err(Zi("stage is only for a reminder")));let i=`${qi}/${encodeURIComponent(e)}/simulate`;return n("televet.sandbox.simulateVisitEvent",i,r===void 0?{event:t}:{event:t,stage:r})}}}function useEverfurVetVisitSandbox(){let{runtime:t,userRef:userRef,scopeEpoch:n}=kn();return e.useMemo(()=>{let{services:e}=t.registry;return no({auth:e.authFor(userRef),...e.errorPolicy?{errorPolicy:e.errorPolicy}:{}})},[t,userRef,n])}function ro(e,t){return!e||!t.enabled?false:t.data!==null&&t.data.active===false||Yn({error:t.error??null})}var lo=e=>e.livemode===false;function io(){let t=kn().runtime.entitlements,n=e.useCallback(()=>lo(t.getSnapshot()),[t]);return e.useSyncExternalStore(t.subscribe,n,n)}function oo(e,t){let n=ro(io(),e);return{simulate:n,fundingRefused:t&&!n}}function ao(e,t){return!e||!t.enabled?true:(t.data!==null||(t.error??null)!==null)&&!ro(true,t)}function so(e,t){return ao(io(),t)?e:null}function co(petRef){let t=useEverfurVetVisitSandbox(),[n,r]=e.useState(null),[l,i]=e.useState(null),[o,a]=e.useState(false),s=e.useRef(false),c=e.useRef(true);e.useEffect(()=>(c.current=true,()=>{c.current=false}),[]);let d=e.useCallback((e,t,n)=>{s.current||(s.current=true,a(true),t().then(t=>{if(s.current=false,!!c.current){if(a(false),!t.ok){i({tone:"danger",text:ee(Ui.errorTemplate,{label:e,message:t.error.displayMessage})});return}n&&r(t.value.visit),i({tone:"ok",text:ee(Ui.resultTemplate,{label:e,result:t.value.result})})}}))},[]),u=e.useCallback(()=>{d(Ui.createLabel,()=>t.createVisit(petRef),true)},[petRef,d,t]),p=e.useCallback(e=>{n!==null&&d(Ui.advance[e],()=>t.advanceVisit(n.visitRef,e),true)},[d,t,n]),h=e.useCallback(e=>{if(n===null)return;let r=e==="reminder"?"24h":void 0;d(Ui.events[e],()=>t.simulateVisitEvent(n.visitRef,e,r),false)},[d,t,n]),f=n===null?null:ee(Ui.visitTemplate,{visitRef:n.visitRef,status:n.status,scheduledAt:n.scheduledAt});return{visit:n,visitLine:f,line:l,busy:o,create:u,advance:p,raise:h}}var uo=/* @__PURE__ */Object.freeze(["completed","cancelled","no_show"]),po=/* @__PURE__ */Object.freeze(["rescheduled","reminder","followup_sent","message_received","ended"]);function parseColor(e){let t=ho(e);return t===null?null:xo(t)}function ho(e){if(typeof e=="number")return go(e);if(typeof e!="string")return null;let t=e.trim();if(t.length===0)return null;if(t.startsWith("#"))return fo(t.slice(1));if(t.toLowerCase().startsWith("0x"))return fo(t.slice(2));if(t.toLowerCase().startsWith("rgb"))return mo(t);if(/^[0-9a-fA-F]+$/.test(t)){let e=fo(t);if(e!==null)return e}return/^\d+$/.test(t)?go(Number.parseInt(t,10)):null}function fo(e){let t=e.trim();if(!/^[0-9a-fA-F]+$/.test(t))return null;if(t.length===3)return{r:yo(t[0]),g:yo(t[1]),b:yo(t[2]),a:1};if(t.length===6)return{r:bo(t,0),g:bo(t,2),b:bo(t,4),a:1};if(t.length===8){let e=bo(t,0);return{r:bo(t,2),g:bo(t,4),b:bo(t,6),a:e/255}}return null}function mo(e){let t=e.indexOf("("),n=e.indexOf(")");if(t<0||n<0||n<t)return null;let r=e.slice(t+1,n).split(",").map(e=>e.trim());if(r.length<3)return null;let l=vo(Number(r[0])),i=vo(Number(r[1])),o=vo(Number(r[2]));if(l===null||i===null||o===null)return null;let a=1;if(r.length>=4){let e=Number(r[3]);if(!Number.isFinite(e))return null;a=Math.min(1,Math.max(0,e))}return{r:l,g:i,b:o,a:a}}function go(e){if(!Number.isFinite(e))return null;let t=Math.trunc(e)>>>0,n=t>>>24&255;return{r:t>>>16&255,g:t>>>8&255,b:t&255,a:n===0?1:n/255}}function bo(e,t){return Number.parseInt(e.slice(t,t+2),16)}function yo(e){return Number.parseInt(`${e??"0"}${e??"0"}`,16)}function vo(e){return Number.isFinite(e)?Math.min(255,Math.max(0,Math.round(e))):null}function xo(e){if(e.a>=1)return To(e.r,e.g,e.b);let t=Math.round(e.a*1e3)/1e3;return`rgba(${e.r},${e.g},${e.b},${t})`}function To(e,t,n){return`#${ko(e)}${ko(t)}${ko(n)}`.toUpperCase()}function ko(e){return e.toString(16).padStart(2,"0")}var wo="#FFFFFF",So="#000000";function jo(e){let t=t=>e.reduce((e,n)=>Math.min(e,contrastRatio(t,n)),Number.POSITIVE_INFINITY);return t(wo)>=t(So)?wo:So}function Co(e){let t=_o(e.r/255),n=_o(e.g/255),r=_o(e.b/255);return.2126*t+.7152*n+.0722*r}function _o(e){return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Io(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function contrastRatio(e,t){let n=ho(e),r=ho(t);if(n===null||r===null)return 1;let l=r.a>=1?r:{...r},i=n.a>=1?n:Eo(n,l);return Io(Co(i),Co(l))}function Eo(e,t){let n=e.a,r=(e,t)=>Math.round(e*n+t*(1-n));return{r:r(e.r,t.r),g:r(e.g,t.g),b:r(e.b,t.b),a:1}}function Do(e,t){let n=ho(e),r=ho(t);if(n===null||r===null)return null;let l=n.a>=1?n:Eo(n,{...r});return To(l.r,l.g,l.b)}function Po(e,t){let n=ho(e);if(n===null)return null;let r=Math.min(1,Math.max(0,t));return`rgba(${n.r}, ${n.g}, ${n.b}, ${r})`}var Ro=.22,zo=.5,Fo="#FFC3BC";function Lo(e){let t=e.color;return{ink:t.brandInk,text:t.text.primary,muted:t.text.muted,line:t.borderRingCream,mist:t.surfaceSubtle,surface:t.surface,pink:t.highlight,onPink:t.onHighlight,go:t.mark,alert:t.danger,alertWash:t.badgeBgCritical}}function Ao(e){let t=e.color,n=parseColor(t.highlight)===Fo,r=Po(t.highlight,n?Ro:zo);return{...Lo(e),pinkSoft:(r===null?null:Do(r,t.surface))??t.surface}}function Oo(e,t){if(e===void 0)return{};let n={};return e.backgroundColor!==void 0&&(n.backgroundColor=e.backgroundColor),e.borderColor!==void 0&&(n.borderColor=e.borderColor,n.borderWidth=t??1),e.borderRadius!==void 0&&(n.borderRadius=e.borderRadius),n}function Vo(e,t){return e===void 0||e.borderRadius!==void 0||e.backgroundColor===void 0&&e.borderColor===void 0?e:{...e,borderRadius:t}}function No(e){return e?.textColor===void 0?{}:{color:e.textColor}}var Bo=44;function Mo(){let t=useEverfurTheme();return e.useMemo(()=>Ho(t),[t])}function TelevetButton({label:e,onPress:n,kind:l="primary",disabled:i=false,loading:o=false,fullWidth:a=true,accessibilityLabel:s,testID:c,style:d}){let u=Mo(),p=useEverfurTheme(),h=i||o;/* @__PURE__ */
47
47
  return r.jsxs(t.Pressable,{onPress:n,disabled:h,accessibilityRole:"button",accessibilityLabel:s??e,accessibilityState:{disabled:h,busy:o},style:({pressed:e})=>[u.button,l==="primary"?u.buttonPrimary:l==="danger"?u.buttonDanger:l==="quiet"?u.buttonQuiet:u.buttonSecondary,a?u.buttonFull:u.buttonAuto,h?u.buttonDisabled:null,e&&!p.motion.reducedMotion?u.buttonPressed:null,d],testID:c,children:[o?/* @__PURE__ */r.jsx(t.ActivityIndicator,{size:"small",color:l==="secondary"||l==="quiet"?p.color.brandInk:l==="danger"?p.color.onDanger:p.color.onPrimary}):null,
48
- /* @__PURE__ */r.jsx(Text,{tier:"control",style:l==="secondary"||l==="quiet"?u.buttonSecondaryLabel:l==="danger"?u.buttonDangerLabel:u.buttonPrimaryLabel,children:e})]})}function TelevetStateCard({title:e,message:n,actionLabel:l,onAction:i,testID:o}){let a=Bo(),s=typeof l=="string"&&l.length>0&&typeof i=="function";/* @__PURE__ */
48
+ /* @__PURE__ */r.jsx(Text,{tier:"control",style:l==="secondary"||l==="quiet"?u.buttonSecondaryLabel:l==="danger"?u.buttonDangerLabel:u.buttonPrimaryLabel,children:e})]})}function TelevetStateCard({title:e,message:n,actionLabel:l,onAction:i,testID:o}){let a=Mo(),s=typeof l=="string"&&l.length>0&&typeof i=="function";/* @__PURE__ */
49
49
  return r.jsxs(t.View,{style:a.stateCard,testID:o,children:[
50
- /* @__PURE__ */r.jsx(Text,{style:a.stateTitle,accessibilityRole:"header",children:e}),n?/* @__PURE__ */r.jsx(Text,{style:a.stateMessage,children:n}):null,s?/* @__PURE__ */r.jsx(TelevetButton,{label:l,onPress:i,kind:"secondary",fullWidth:false}):null]})}function TelevetSkeletonBlock({height:e,width:n="100%",testID:l}){let i=Bo();/* @__PURE__ */
51
- return r.jsx(t.View,{style:[i.skeleton,{height:e,width:n}],testID:l,accessibilityElementsHidden:true,importantForAccessibility:"no"})}function TelevetFailureLine({message:e,assertive:t=false,testID:n,style:l}){let i=Bo();/* @__PURE__ */
52
- return r.jsx(Text,{style:[i.failure,l],accessibilityLiveRegion:t?"assertive":"polite",testID:n,children:e})}function Mo(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=e.slots.bookingStep,c=s?.backgroundColor!==void 0||s?.borderColor!==void 0?{padding:r.lg,...Ao(s,1)}:Ao(s,1),d=Vo(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},stepFill:{flex:1,minHeight:0,gap:r.md},stepFillBox:{flex:1,minHeight:0,gap:r.md,...c},list:{gap:r.sm},button:{minHeight:52,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,paddingHorizontal:20,paddingVertical:r.xs,borderRadius:l.pill,borderWidth:1.5,borderColor:"transparent"},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:No,minHeight:No},buttonPrimary:{backgroundColor:n.primary,borderColor:n.primaryEdge},buttonSecondary:{borderColor:n.brandInk,backgroundColor:n.surface},buttonQuiet:{backgroundColor:"transparent",paddingHorizontal:r.sm},buttonDanger:{backgroundColor:n.danger,borderColor:n.danger},buttonDisabled:{opacity:.45},buttonPressed:{transform:[{scale:.97}]},buttonPrimaryLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},buttonDangerLabel:{...face(e,"bold"),color:n.onDanger,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},buttonSecondaryLabel:{...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},stateCard:{minHeight:140,justifyContent:"center",gap:r.sm,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:n.brandBorder,...Ao(e.slots.card,1)},stateTitle:{...headingFace(e,"medium"),color:n.brandInk,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...d},stateMessage:{...face(e,"regular"),color:n.text.metaCool,fontSize:o.body,lineHeight:o.body*a.normal,...d},skeleton:{borderRadius:l.md,backgroundColor:n.skeleton},failure:{...face(e,"regular"),color:n.danger,fontSize:o.caption,lineHeight:o.caption*a.normal},stepTitle:{...headingFace(e,"medium"),color:n.brandInk,fontSize:o.heading,lineHeight:o.heading*a.snug,letterSpacing:-.33},stepHelp:{...face(e,"regular"),color:n.text.primary,fontSize:o.body,lineHeight:o.body*a.relaxed},divider:{height:1,backgroundColor:n.brandBorder},scrollRoot:{flex:1,minHeight:0,...c},scrollBody:{flex:1},scrollFooter:{paddingTop:r.md,paddingBottom:r.lg}})}function TelevetEmergencyExits({petName:n,primaryVet:l,onFindEmergencyVet:i}){let o=useEverfurTheme(),a=e.useMemo(()=>Ho(o),[o]),s=n?.trim()??"",c=[];return i||c.push(
53
- /* @__PURE__ */r.jsx(t.View,{style:a.vetCard,testID:"televet-emergency-go-to-er",children:/* @__PURE__ */r.jsx(Text,{style:a.vetTitle,children:ee.emergency.exitGoToErTitle})},"go-to-er")),i&&c.push(
54
- /* @__PURE__ */r.jsx(t.Pressable,{accessibilityRole:"button",accessibilityLabel:ee.emergency.exitFindErTitle,onPress:()=>{H(i)},style:a.vetCard,testID:"televet-emergency-find-vet",children:/* @__PURE__ */r.jsx(t.View,{style:a.vetRow,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:a.vetTitle,children:ee.emergency.exitFindErTitle})})},"find")),c.push(
55
- /* @__PURE__ */r.jsx(t.Pressable,{accessibilityRole:"link",accessibilityLabel:`${ee.emergency.poisonControl}, ${ee.emergency.poisonControlDetail}`,accessibilityHint:ee.emergency.startCallHint,onPress:()=>{t.Linking.openURL(ee.emergency.poisonControlTel).catch(()=>{})},style:a.vetCard,testID:"televet-emergency-poison-control",children:/* @__PURE__ */r.jsxs(t.View,{style:a.vetText,children:[
56
- /* @__PURE__ */r.jsx(Text,{tier:"control",style:a.vetTitle,children:ee.emergency.poisonControl}),
57
- /* @__PURE__ */r.jsx(Text,{style:a.vetDetail,children:ee.emergency.poisonControlDetail})]})},"poison")),l!=null&&s.length>0&&c.push(/* @__PURE__ */r.jsx(PrimaryVetCard,{petName:s,vet:l},"clinic")),c.length===0?null:/* @__PURE__ */r.jsx(t.View,{style:a.box,testID:"televet-emergency-exits",children:c.map((e,n)=>/* @__PURE__ */r.jsx(t.View,{style:n>0?a.split:null,children:e},n))})}function PrimaryVetCard({petName:n,vet:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ho(i),[i]),a=Z(ee.emergency.exitPrimaryVetTitle,{petName:n}),s=l.detail?.trim()??"",c=/* @__PURE__ */r.jsx(t.View,{style:o.vetRow,children:/* @__PURE__ */r.jsxs(t.View,{style:o.vetText,children:[
50
+ /* @__PURE__ */r.jsx(Text,{style:a.stateTitle,accessibilityRole:"header",children:e}),n?/* @__PURE__ */r.jsx(Text,{style:a.stateMessage,children:n}):null,s?/* @__PURE__ */r.jsx(TelevetButton,{label:l,onPress:i,kind:"secondary",fullWidth:false}):null]})}function TelevetSkeletonBlock({height:e,width:n="100%",testID:l}){let i=Mo();/* @__PURE__ */
51
+ return r.jsx(t.View,{style:[i.skeleton,{height:e,width:n}],testID:l,accessibilityElementsHidden:true,importantForAccessibility:"no"})}function TelevetFailureLine({message:e,assertive:t=false,testID:n,style:l}){let i=Mo();/* @__PURE__ */
52
+ return r.jsx(Text,{style:[i.failure,l],accessibilityLiveRegion:t?"assertive":"polite",testID:n,children:e})}function Ho(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=e.slots.bookingStep,c=s?.backgroundColor!==void 0||s?.borderColor!==void 0?{padding:r.lg,...Oo(s,1)}:Oo(s,1),d=No(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl,gap:r.md},stepFill:{flex:1,minHeight:0,gap:r.md},stepFillBox:{flex:1,minHeight:0,gap:r.md,...c},list:{gap:r.sm},button:{minHeight:52,flexDirection:"row",alignItems:"center",justifyContent:"center",gap:r.sm,paddingHorizontal:20,paddingVertical:r.xs,borderRadius:l.pill,borderWidth:1.5,borderColor:"transparent"},buttonFull:{alignSelf:"stretch"},buttonAuto:{alignSelf:"flex-start",minWidth:Bo,minHeight:Bo},buttonPrimary:{backgroundColor:n.primary,borderColor:n.primaryEdge},buttonSecondary:{borderColor:n.brandInk,backgroundColor:n.surface},buttonQuiet:{backgroundColor:"transparent",paddingHorizontal:r.sm},buttonDanger:{backgroundColor:n.danger,borderColor:n.danger},buttonDisabled:{opacity:.45},buttonPressed:{transform:[{scale:.97}]},buttonPrimaryLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},buttonDangerLabel:{...face(e,"bold"),color:n.onDanger,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},buttonSecondaryLabel:{...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},stateCard:{minHeight:140,justifyContent:"center",gap:r.sm,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:n.brandBorder,...Oo(e.slots.card,1)},stateTitle:{...headingFace(e,"medium"),color:n.brandInk,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...d},stateMessage:{...face(e,"regular"),color:n.text.metaCool,fontSize:o.body,lineHeight:o.body*a.normal,...d},skeleton:{borderRadius:l.md,backgroundColor:n.skeleton},failure:{...face(e,"regular"),color:n.danger,fontSize:o.caption,lineHeight:o.caption*a.normal},stepTitle:{...headingFace(e,"medium"),color:n.brandInk,fontSize:o.heading,lineHeight:o.heading*a.snug,letterSpacing:-.33},stepHelp:{...face(e,"regular"),color:n.text.primary,fontSize:o.body,lineHeight:o.body*a.relaxed},divider:{height:1,backgroundColor:n.brandBorder},scrollRoot:{flex:1,minHeight:0,...c},scrollBody:{flex:1},scrollFooter:{paddingTop:r.md,paddingBottom:r.lg}})}function TelevetEmergencyExits({petName:n,primaryVet:l,onFindEmergencyVet:i}){let o=useEverfurTheme(),a=e.useMemo(()=>$o(o),[o]),s=n?.trim()??"",c=[];return i||c.push(
53
+ /* @__PURE__ */r.jsx(t.View,{style:a.vetCard,testID:"televet-emergency-go-to-er",children:/* @__PURE__ */r.jsx(Text,{style:a.vetTitle,children:te.emergency.exitGoToErTitle})},"go-to-er")),i&&c.push(
54
+ /* @__PURE__ */r.jsx(t.Pressable,{accessibilityRole:"button",accessibilityLabel:te.emergency.exitFindErTitle,onPress:()=>{$(i)},style:a.vetCard,testID:"televet-emergency-find-vet",children:/* @__PURE__ */r.jsx(t.View,{style:a.vetRow,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:a.vetTitle,children:te.emergency.exitFindErTitle})})},"find")),c.push(
55
+ /* @__PURE__ */r.jsx(t.Pressable,{accessibilityRole:"link",accessibilityLabel:`${te.emergency.poisonControl}, ${te.emergency.poisonControlDetail}`,accessibilityHint:te.emergency.startCallHint,onPress:()=>{t.Linking.openURL(te.emergency.poisonControlTel).catch(()=>{})},style:a.vetCard,testID:"televet-emergency-poison-control",children:/* @__PURE__ */r.jsxs(t.View,{style:a.vetText,children:[
56
+ /* @__PURE__ */r.jsx(Text,{tier:"control",style:a.vetTitle,children:te.emergency.poisonControl}),
57
+ /* @__PURE__ */r.jsx(Text,{style:a.vetDetail,children:te.emergency.poisonControlDetail})]})},"poison")),l!=null&&s.length>0&&c.push(/* @__PURE__ */r.jsx(PrimaryVetCard,{petName:s,vet:l},"clinic")),c.length===0?null:/* @__PURE__ */r.jsx(t.View,{style:a.box,testID:"televet-emergency-exits",children:c.map((e,n)=>/* @__PURE__ */r.jsx(t.View,{style:n>0?a.split:null,children:e},n))})}function PrimaryVetCard({petName:n,vet:l}){let i=useEverfurTheme(),o=e.useMemo(()=>$o(i),[i]),a=ee(te.emergency.exitPrimaryVetTitle,{petName:n}),s=l.detail?.trim()??"",c=/* @__PURE__ */r.jsx(t.View,{style:o.vetRow,children:/* @__PURE__ */r.jsxs(t.View,{style:o.vetText,children:[
58
58
  /* @__PURE__ */r.jsx(Text,{tier:"control",style:o.vetTitle,children:a}),s.length>0?/* @__PURE__ */r.jsx(Text,{style:o.vetDetail,children:s}):null]})});if(!l.dial)/* @__PURE__ */
59
59
  return r.jsx(t.View,{style:o.vetCard,testID:"televet-early-emergency-primary-vet",children:c});let d=l.dial;/* @__PURE__ */
60
- return r.jsx(t.Pressable,{accessibilityRole:"link",accessibilityLabel:s.length>0?`${a}, ${s}`:a,accessibilityHint:ee.emergency.startCallHint,onPress:()=>{H(d)},style:o.vetCard,testID:"televet-early-emergency-primary-vet-call",children:c})}function Ho(e){let{space:t,radius:n,type:r}=e,{size:l,lineHeight:i}=r,o=Lo(e);return{box:{borderRadius:n.sm,backgroundColor:o.surface,paddingHorizontal:14},split:{borderTopWidth:1,borderTopColor:o.line},vetCard:{minHeight:No,justifyContent:"center",paddingVertical:t.md},vetRow:{flexDirection:"row",alignItems:"center",gap:t.sm},vetText:{flexShrink:1,gap:2},vetTitle:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug},vetDetail:{...face(e,"regular"),color:o.muted,fontSize:l.caption,lineHeight:l.caption*i.normal}}}function TelevetEarlyEmergency({petName:n,primaryVet:l,onFindEmergencyVet:i,onContinue:o}){let a=useEverfurTheme(),s=Bo(),c=e.useMemo(()=>$o(a),[a]);/* @__PURE__ */
60
+ return r.jsx(t.Pressable,{accessibilityRole:"link",accessibilityLabel:s.length>0?`${a}, ${s}`:a,accessibilityHint:te.emergency.startCallHint,onPress:()=>{$(d)},style:o.vetCard,testID:"televet-early-emergency-primary-vet-call",children:c})}function $o(e){let{space:t,radius:n,type:r}=e,{size:l,lineHeight:i}=r,o=Ao(e);return{box:{borderRadius:n.sm,backgroundColor:o.surface,paddingHorizontal:14},split:{borderTopWidth:1,borderTopColor:o.line},vetCard:{minHeight:Bo,justifyContent:"center",paddingVertical:t.md},vetRow:{flexDirection:"row",alignItems:"center",gap:t.sm},vetText:{flexShrink:1,gap:2},vetTitle:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug},vetDetail:{...face(e,"regular"),color:o.muted,fontSize:l.caption,lineHeight:l.caption*i.normal}}}function TelevetEarlyEmergency({petName:n,primaryVet:l,onFindEmergencyVet:i,onContinue:o}){let a=useEverfurTheme(),s=Mo(),c=e.useMemo(()=>Wo(a),[a]);/* @__PURE__ */
61
61
  return r.jsxs(t.View,{style:[s.stepFill,c.emergencyPanel],testID:"televet-early-emergency",children:[
62
- /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:c.emergencyTitle,children:ee.emergency.bannerTitle}),
63
- /* @__PURE__ */r.jsx(Text,{style:c.emergencyLede,children:ee.emergency.lede}),
62
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:c.emergencyTitle,children:te.emergency.bannerTitle}),
63
+ /* @__PURE__ */r.jsx(Text,{style:c.emergencyLede,children:te.emergency.lede}),
64
64
  /* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:n,primaryVet:l,onFindEmergencyVet:i}),
65
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",onPress:o,testID:"televet-early-emergency-continue"})]})}function TelevetStateInterestAction({action:n,testIDPrefix:l}){let i=useEverfurTheme(),o=e.useMemo(()=>$o(i),[i]);return n===null?null:n.joined?/* @__PURE__ */r.jsxs(t.View,{testID:`${l}-joined`,style:o.interestFeedback,children:[
66
- /* @__PURE__ */r.jsx(Text,{tier:"control",accessibilityRole:"header",children:ee.stateInterest.joinedTitle}),
67
- /* @__PURE__ */r.jsx(Text,{style:o.interestBody,children:ee.stateInterest.joinedBody})]}):/* @__PURE__ */r.jsxs(t.View,{testID:l,style:o.interestAction,children:[
68
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.stateInterest.cta,kind:"secondary",loading:n.pending,disabled:n.pending,onPress:n.onPress,testID:`${l}-submit`}),n.failed?
69
- /* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.stateInterest.failed,testID:`${l}-error`}):null]})}function TelevetClinicianEmptyState({cause:e,onRetry:n,stateInterest:l=null}){let i=televetEmptyRosterView(e);/* @__PURE__ */
65
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.emergency.keepBookingCta,kind:"secondary",onPress:o,testID:"televet-early-emergency-continue"})]})}function TelevetStateInterestAction({action:n,testIDPrefix:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Wo(i),[i]);return n===null?null:n.joined?/* @__PURE__ */r.jsxs(t.View,{testID:`${l}-joined`,style:o.interestFeedback,children:[
66
+ /* @__PURE__ */r.jsx(Text,{tier:"control",accessibilityRole:"header",children:te.stateInterest.joinedTitle}),
67
+ /* @__PURE__ */r.jsx(Text,{style:o.interestBody,children:te.stateInterest.joinedBody})]}):/* @__PURE__ */r.jsxs(t.View,{testID:l,style:o.interestAction,children:[
68
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.stateInterest.cta,kind:"secondary",loading:n.pending,disabled:n.pending,onPress:n.onPress,testID:`${l}-submit`}),n.failed?
69
+ /* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.stateInterest.failed,testID:`${l}-error`}):null]})}function TelevetClinicianEmptyState({cause:e,onRetry:n,stateInterest:l=null}){let i=televetEmptyRosterView(e);/* @__PURE__ */
70
70
  return r.jsxs(t.View,{testID:"televet-clinicians-empty",children:[
71
71
  /* @__PURE__ */r.jsx(TelevetStateCard,{title:i.title,message:i.message,...i.retryLabel!==null&&n?{actionLabel:i.retryLabel,onAction:n}:{}}),i.interestReason!==null?/* @__PURE__ */r.jsx(TelevetStateInterestAction,{action:l??null,testIDPrefix:"televet-state-interest-no-licensed-vet"}):null]})}function TelevetEntitlementInterestState({onCheckAvailability:e}){/* @__PURE__ */
72
- return r.jsx(EntitlementPausedState,{...e?{onCheckAvailability:e}:{}})}function EntitlementPausedState({onCheckAvailability:e,renderUnavailable:n}){let l=Bo();/* @__PURE__ */
73
- return r.jsxs(t.View,{testID:"televet-booking-not-entitled",style:l.list,children:[n?n():/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle}),e?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}function TelevetMediaDropNotice({shortfall:n,testIDPrefix:l}){let i=useEverfurTheme(),o=e.useMemo(()=>$o(i),[i]);if(isMediaShortfallEmpty(n))return null;let a=televetMediaShortfallLines(n);return a.length===0?null:/* @__PURE__ */r.jsx(t.View,{style:o.mediaNotice,testID:`${l}-media-notice`,children:a.map((e,t)=>/* @__PURE__ */r.jsx(Text,{style:o.mediaLine,accessibilityLiveRegion:"polite",testID:`${l}-media-line-${String(t)}`,children:e},e))})}function $o(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l;return{emergencyPanel:{flex:0,gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:2,borderColor:t.danger,backgroundColor:t.surface},emergencyTitle:{...face(e,"medium"),color:t.danger,fontSize:i.heading,lineHeight:i.heading*o.snug},emergencyLede:{...face(e,"regular"),color:t.text.primary,fontSize:i.subtitle,lineHeight:i.subtitle*o.normal},interestAction:{gap:n.sm,marginTop:n.sm},interestFeedback:{gap:n.xs,marginTop:n.sm},interestBody:{...face(e,"regular"),color:t.text.metaCool},mediaNotice:{gap:n.xs},mediaLine:{...face(e,"regular"),color:t.text.metaCool,fontSize:i.caption,lineHeight:i.caption*o.normal}}}function Wo(e){let{surfaceUnavailable:t,notEntitled:n,policyBlocked:r,triageOpen:l,step:i}=e;return t||n&&i!=="clinician"||r?true:i==="reason"&&l}function TelevetBookingGate({state:e,petName:n,primaryVet:l,onFindEmergencyVet:i,stateInterest:o=null,onCheckAvailability:a,onAcknowledgeEmergency:s,renderUnavailable:c}){let d=Bo(),{surfaceUnavailable:u,notEntitled:p,policyBlocked:h,triageOpen:f,step:m}=e;return u?/* @__PURE__ */r.jsx(t.View,{style:d.stepFill,testID:"televet-booking-unavailable",children:c?c():/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle})}):p&&m!=="clinician"?/* @__PURE__ */r.jsx(EntitlementPausedState,{...a?{onCheckAvailability:a}:{},...c?{renderUnavailable:c}:{}}):h?
72
+ return r.jsx(EntitlementPausedState,{...e?{onCheckAvailability:e}:{}})}function EntitlementPausedState({onCheckAvailability:e,renderUnavailable:n}){let l=Mo();/* @__PURE__ */
73
+ return r.jsxs(t.View,{testID:"televet-booking-not-entitled",style:l.list,children:[n?n():/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.bookingPausedTitle}),e?/* @__PURE__ */r.jsx(TelevetButton,{label:te.checkAvailabilityCta,kind:"secondary",onPress:e,testID:"televet-check-state-availability"}):null]})}function TelevetMediaDropNotice({shortfall:n,testIDPrefix:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Wo(i),[i]);if(isMediaShortfallEmpty(n))return null;let a=televetMediaShortfallLines(n);return a.length===0?null:/* @__PURE__ */r.jsx(t.View,{style:o.mediaNotice,testID:`${l}-media-notice`,children:a.map((e,t)=>/* @__PURE__ */r.jsx(Text,{style:o.mediaLine,accessibilityLiveRegion:"polite",testID:`${l}-media-line-${String(t)}`,children:e},e))})}function Wo(e){let{color:t,space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l;return{emergencyPanel:{flex:0,gap:n.sm,padding:n.lg,borderRadius:r.lg,borderWidth:2,borderColor:t.danger,backgroundColor:t.surface},emergencyTitle:{...face(e,"medium"),color:t.danger,fontSize:i.heading,lineHeight:i.heading*o.snug},emergencyLede:{...face(e,"regular"),color:t.text.primary,fontSize:i.subtitle,lineHeight:i.subtitle*o.normal},interestAction:{gap:n.sm,marginTop:n.sm},interestFeedback:{gap:n.xs,marginTop:n.sm},interestBody:{...face(e,"regular"),color:t.text.metaCool},mediaNotice:{gap:n.xs},mediaLine:{...face(e,"regular"),color:t.text.metaCool,fontSize:i.caption,lineHeight:i.caption*o.normal}}}function Uo(e){let{surfaceUnavailable:t,notEntitled:n,policyBlocked:r,triageOpen:l,step:i}=e;return t||n&&i!=="clinician"||r?true:i==="reason"&&l}function TelevetBookingGate({state:e,petName:n,primaryVet:l,onFindEmergencyVet:i,stateInterest:o=null,onCheckAvailability:a,onAcknowledgeEmergency:s,renderUnavailable:c}){let d=Mo(),{surfaceUnavailable:u,notEntitled:p,policyBlocked:h,triageOpen:f,step:m}=e;return u?/* @__PURE__ */r.jsx(t.View,{style:d.stepFill,testID:"televet-booking-unavailable",children:c?c():/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.bookingPausedTitle})}):p&&m!=="clinician"?/* @__PURE__ */r.jsx(EntitlementPausedState,{...a?{onCheckAvailability:a}:{},...c?{renderUnavailable:c}:{}}):h?
74
74
  /* @__PURE__ */r.jsxs(t.View,{testID:"televet-booking-state-blocked",children:[
75
- /* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.stateBlockedTitle}),
76
- /* @__PURE__ */r.jsx(TelevetStateInterestAction,{action:o,testIDPrefix:"televet-state-interest-state-blocked"})]}):m==="reason"&&f?/* @__PURE__ */r.jsx(TelevetEarlyEmergency,{...n!==void 0?{petName:n}:{},...l?{primaryVet:l}:{},onFindEmergencyVet:i,onContinue:s}):null}var Uo=false;function qo(){if(!Uo){Uo=true;try{globalThis.console?.warn?.("[everfur] The vet booking has no US state for this member, so it cannot list vets. Pass the member's two-letter state as `usState` (on EverfurTelevet, VetVisitButton or EverfurChat as `vetUsState`), or pass `onRequestLocation` so the booking can ask your app to resolve one. The SDK never reads a device location itself.")}catch{}}}function Ko(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}function TelevetClinicianOutcome({state:n,cause:l,locationStatus:i,onRequestLocation:o,onRetry:a,stateInterest:s=null,renderUnavailable:c}){let d=n.noState&&!o;return e.useEffect(()=>{d&&qo()},[d]),n.noState?
77
- /* @__PURE__ */r.jsx(t.View,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:i==="blocked"?ee.locationBlockedTitle:i==="unavailable"?ee.locationUnavailableTitle:ee.locationUnknownTitle,message:i==="blocked"?ee.locationBlockedBody:i==="unavailable"?ee.locationUnavailableBody:o?ee.locationUnknownBody:void 0,actionLabel:o?i==="blocked"?ee.locationBlockedCta:ee.locationUnknownCta:void 0,onAction:o})}):n.isEmpty?/* @__PURE__ */r.jsx(TelevetClinicianEmptyState,{cause:l,onRetry:a,stateInterest:s}):/* @__PURE__ */r.jsx(EntitlementPausedState,{...c?{renderUnavailable:c}:{}})}function Yo(e){return e.trim().replace(/^dr\.?\s+/i,"").slice(0,1).toUpperCase()}function televetConsultCalendarKey(e){return`televet-consult-${e}`}function TelevetBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,canJoinInApp:a=false,sharedRecords:s=false,sentPhoto:c=false}){let d=useEverfurTheme(),u=Bo(),p=e.useMemo(()=>Go(d),[d]),[h,f]=e.useState("idle"),m=async()=>{if(!o)return;f("saving");let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){f("failed");return}let t=await q(o,{key:televetConsultCalendarKey(n.consultId),title:ee.visit.title,startDate:e,endDate:new Date(e.getTime()+oi*6e4),alarmOffsetMinutes:-30});f(t.ok&&t.value===true?"saved":"failed")},g=n.clinicianName?.trim()??"",y=l?.trim()||ee.petFallback.charAt(0).toUpperCase()+ee.petFallback.slice(1),b=[ee.booked.remindPromise,s&&g.length>0?Z(c?ee.booked.recordsPhotoPromiseTemplate:ee.booked.recordsPromiseTemplate,{pet:y,vet:g}):Z(ee.booked.summaryPromise,{pet:y}),...a?[ee.booked.joinPromise]:[]],v=e.useRef(new t.Animated.Value(d.motion.reducedMotion?1:0)).current;return e.useEffect(()=>{d.motion.reducedMotion||t.Animated.spring(v,{toValue:1,damping:14,stiffness:180,mass:1,useNativeDriver:true}).start()},[v,d.motion.reducedMotion]),isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:p.screen,testID:"televet-booked",children:[
78
- /* @__PURE__ */r.jsx(t.Animated.View,{style:[p.avatar,{opacity:v,transform:[{scale:v.interpolate({inputRange:[0,1],outputRange:[.92,1]})}]}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.avatarText,children:g.length>0?Yo(g):""})}),
79
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.title,accessibilityRole:"header",children:g.length>0?Z(ee.bookedTitleTemplate,{vet:g}):ee.bookedTitle}),
80
- /* @__PURE__ */r.jsx(Text,{style:p.when,children:l?Z(ee.bookedLeadTemplate,{when:mi(n.scheduledAt),pet:l}):mi(n.scheduledAt)}),
81
- /* @__PURE__ */r.jsx(t.View,{style:p.steps,accessibilityLabel:ee.booked.stepsLabel,testID:"televet-booked-steps",children:b.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[p.step,n===b.length-1?p.stepLast:null],children:[
75
+ /* @__PURE__ */r.jsx(TelevetStateCard,{title:te.stateBlockedTitle}),
76
+ /* @__PURE__ */r.jsx(TelevetStateInterestAction,{action:o,testIDPrefix:"televet-state-interest-state-blocked"})]}):m==="reason"&&f?/* @__PURE__ */r.jsx(TelevetEarlyEmergency,{...n!==void 0?{petName:n}:{},...l?{primaryVet:l}:{},onFindEmergencyVet:i,onContinue:s}):null}var qo=false;function Ko(){if(!qo){qo=true;try{globalThis.console?.warn?.("[everfur] The vet booking has no US state for this member, so it cannot list vets. Pass the member's two-letter state as `usState` (on EverfurTelevet, VetVisitButton or EverfurChat as `vetUsState`), or pass `onRequestLocation` so the booking can ask your app to resolve one. The SDK never reads a device location itself.")}catch{}}}function Yo(e){return e.noState?true:e.isPending||e.isError?false:e.isEmpty||e.notEntitled}function TelevetClinicianOutcome({state:n,cause:l,locationStatus:i,onRequestLocation:o,onRetry:a,stateInterest:s=null,renderUnavailable:c}){let d=n.noState&&!o;return e.useEffect(()=>{d&&Ko()},[d]),n.noState?
77
+ /* @__PURE__ */r.jsx(t.View,{testID:"televet-booking-location-unknown",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:i==="blocked"?te.locationBlockedTitle:i==="unavailable"?te.locationUnavailableTitle:te.locationUnknownTitle,message:i==="blocked"?te.locationBlockedBody:i==="unavailable"?te.locationUnavailableBody:o?te.locationUnknownBody:void 0,actionLabel:o?i==="blocked"?te.locationBlockedCta:te.locationUnknownCta:void 0,onAction:o})}):n.isEmpty?/* @__PURE__ */r.jsx(TelevetClinicianEmptyState,{cause:l,onRetry:a,stateInterest:s}):/* @__PURE__ */r.jsx(EntitlementPausedState,{...c?{renderUnavailable:c}:{}})}function Go(e){return e.trim().replace(/^dr\.?\s+/i,"").slice(0,1).toUpperCase()}function televetConsultCalendarKey(e){return`televet-consult-${e}`}function TelevetBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,canJoinInApp:a=false,sharedRecords:s=false,sentPhoto:c=false}){let d=useEverfurTheme(),u=Mo(),p=e.useMemo(()=>Jo(d),[d]),[h,f]=e.useState("idle"),m=async()=>{if(!o)return;f("saving");let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){f("failed");return}let t=await K(o,{key:televetConsultCalendarKey(n.consultId),title:te.visit.title,startDate:e,endDate:new Date(e.getTime()+ai*6e4),alarmOffsetMinutes:-30});f(t.ok&&t.value===true?"saved":"failed")},g=n.clinicianName?.trim()??"",b=l?.trim()||te.petFallback.charAt(0).toUpperCase()+te.petFallback.slice(1),y=[te.booked.remindPromise,s&&g.length>0?ee(c?te.booked.recordsPhotoPromiseTemplate:te.booked.recordsPromiseTemplate,{pet:b,vet:g}):ee(te.booked.summaryPromise,{pet:b}),...a?[te.booked.joinPromise]:[]],v=e.useRef(new t.Animated.Value(d.motion.reducedMotion?1:0)).current;return e.useEffect(()=>{d.motion.reducedMotion||t.Animated.spring(v,{toValue:1,damping:14,stiffness:180,mass:1,useNativeDriver:true}).start()},[v,d.motion.reducedMotion]),isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:p.screen,testID:"televet-booked",children:[
78
+ /* @__PURE__ */r.jsx(t.Animated.View,{style:[p.avatar,{opacity:v,transform:[{scale:v.interpolate({inputRange:[0,1],outputRange:[.92,1]})}]}],accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.avatarText,children:g.length>0?Go(g):""})}),
79
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:p.title,accessibilityRole:"header",children:g.length>0?ee(te.bookedTitleTemplate,{vet:g}):te.bookedTitle}),
80
+ /* @__PURE__ */r.jsx(Text,{style:p.when,children:l?ee(te.bookedLeadTemplate,{when:gi(n.scheduledAt),pet:l}):gi(n.scheduledAt)}),
81
+ /* @__PURE__ */r.jsx(t.View,{style:p.steps,accessibilityLabel:te.booked.stepsLabel,testID:"televet-booked-steps",children:y.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[p.step,n===y.length-1?p.stepLast:null],children:[
82
82
  /* @__PURE__ */r.jsx(Text,{tier:"badge",style:p.stepNumberText,accessibilityElementsHidden:true,importantForAccessibility:"no",children:String(n+1).padStart(2,"0")}),
83
83
  /* @__PURE__ */r.jsx(Text,{style:p.stepText,children:e.trim()})]},e))}),
84
- /* @__PURE__ */r.jsxs(t.View,{style:p.actions,children:[h==="failed"?/* @__PURE__ */r.jsx(Text,{style:[u.failure,p.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:ee.booked.calendarFailedBody}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:h==="saved"?ee.booked.calendarAdded:ee.addToCalendarCta,kind:"secondary",loading:h==="saving",disabled:h==="saving"||h==="saved",onPress:()=>{m()},testID:"televet-booked-calendar"}):null,
85
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.doneCta,kind:"primary",onPress:i,testID:"televet-booked-done"})]})]}):/* @__PURE__ */r.jsx(t.View,{style:p.screen,testID:"televet-booked-copy-unapproved"})}function Go(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=Vo(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,paddingTop:n.lg,gap:n.md},avatar:{alignSelf:"center",width:112,height:112,borderRadius:56,backgroundColor:a.mist,borderWidth:4,borderColor:a.go,alignItems:"center",justifyContent:"center"},avatarText:{...face(e,"medium"),color:a.ink,fontSize:38,lineHeight:44},title:{textAlign:"center",...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,letterSpacing:-.33,paddingTop:n.md},when:{textAlign:"center",...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed},steps:{marginTop:n.md,paddingHorizontal:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...Ao(e.slots.card,1)},step:{flexDirection:"row",alignItems:"flex-start",gap:n.md,paddingVertical:14,borderBottomWidth:1,borderBottomColor:a.line},stepLast:{borderBottomWidth:0},stepNumberText:{width:28,...face(e,"monoBold"),color:a.ink,fontSize:13,lineHeight:i.body*o.relaxed,...s},stepText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed,...s},actions:{marginTop:"auto",paddingBottom:n.xl,gap:n.md},calendarNote:{textAlign:"center"}})}function Jo(t){let[n,r]=e.useState(null);return{shown:t!==null&&n!==t,onError:()=>r(t)}}function BrandLogo({logoUrl:e,name:n,barStyle:l,logoStyle:i,testID:o}){let a=Jo(e);return e===null||!a.shown?null:/* @__PURE__ */r.jsx(t.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */r.jsx(t.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:n,onError:a.onError})})}function TelevetBookingChrome({step:n,furthestIndex:l,title:i,canGoBack:o,isDirty:a,onBack:s,onClose:c,onConfirmDiscard:d,triageOpen:u=false,stepContext:p,presentation:h="rail"}){let f=useEverfurTheme(),m=e.useMemo(()=>ta(f),[f]),g=e.useMemo(()=>()=>{if(!a){c();return}let e={title:ee.chrome.discardTitle,body:ee.chrome.discardBody,confirmLabel:ee.chrome.discardConfirmCta,keepLabel:ee.chrome.discardKeepCta};if(d){Promise.resolve(d(e)).then(e=>{e&&c()},()=>{});return}t.Alert.alert(e.title,e.body,[{text:e.keepLabel,style:"cancel"},{text:e.confirmLabel,style:"destructive",onPress:c}])},[a,c,d]),y=e.useMemo(()=>()=>o?(s(),true):(g(),true),[o,s,g]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",y);return()=>{e.remove()}},[y]),G(y);let b=e.useMemo(()=>Ql(p),[p]),{current:v,total:x,steps:T}=Xl(n,b,u),k=n==="booked"?ee.bookedStepLabel:Z(ee.loading.progressTemplate,{step:String(v),total:String(x)});return h==="nav"?/* @__PURE__ */r.jsx(t.View,{style:m.wrap,children:/* @__PURE__ */r.jsxs(t.View,{style:m.navBar,children:[
86
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Xo,testID:"televet-booking-back",style:m.navIcon,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
87
- /* @__PURE__ */r.jsx(Text,{tier:"compact",numberOfLines:1,style:m.navTitle,accessibilityRole:"header",testID:"televet-booking-title",children:i??ee.navTitle}),
88
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:ee.close,accessibilityHint:ee.chrome.closeHint,testID:"televet-booking-close",style:m.navIcon,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Qo})})]})}):/* @__PURE__ */r.jsxs(t.View,{style:m.wrap,children:[
84
+ /* @__PURE__ */r.jsxs(t.View,{style:p.actions,children:[h==="failed"?/* @__PURE__ */r.jsx(Text,{style:[u.failure,p.calendarNote],accessibilityLiveRegion:"polite",testID:"televet-booked-calendar-failed",children:te.booked.calendarFailedBody}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:h==="saved"?te.booked.calendarAdded:te.addToCalendarCta,kind:"secondary",loading:h==="saving",disabled:h==="saving"||h==="saved",onPress:()=>{m()},testID:"televet-booked-calendar"}):null,
85
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.doneCta,kind:"primary",onPress:i,testID:"televet-booked-done"})]})]}):/* @__PURE__ */r.jsx(t.View,{style:p.screen,testID:"televet-booked-copy-unapproved"})}function Jo(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Ao(e),s=No(e.slots.card);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:n.xl,paddingTop:n.lg,gap:n.md},avatar:{alignSelf:"center",width:112,height:112,borderRadius:56,backgroundColor:a.mist,borderWidth:4,borderColor:a.go,alignItems:"center",justifyContent:"center"},avatarText:{...face(e,"medium"),color:a.ink,fontSize:38,lineHeight:44},title:{textAlign:"center",...headingFace(e,"medium"),color:a.ink,fontSize:i.heading,lineHeight:i.heading*o.snug,letterSpacing:-.33,paddingTop:n.md},when:{textAlign:"center",...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed},steps:{marginTop:n.md,paddingHorizontal:n.lg,borderRadius:r.lg,borderWidth:1,borderColor:a.line,backgroundColor:a.surface,...Oo(e.slots.card,1)},step:{flexDirection:"row",alignItems:"flex-start",gap:n.md,paddingVertical:14,borderBottomWidth:1,borderBottomColor:a.line},stepLast:{borderBottomWidth:0},stepNumberText:{width:28,...face(e,"monoBold"),color:a.ink,fontSize:13,lineHeight:i.body*o.relaxed,...s},stepText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed,...s},actions:{marginTop:"auto",paddingBottom:n.xl,gap:n.md},calendarNote:{textAlign:"center"}})}function Qo(t){let[n,r]=e.useState(null);return{shown:t!==null&&n!==t,onError:()=>r(t)}}function BrandLogo({logoUrl:e,name:n,barStyle:l,logoStyle:i,testID:o}){let a=Qo(e);return e===null||!a.shown?null:/* @__PURE__ */r.jsx(t.View,{style:l,...o===void 0?{}:{testID:o},children:/* @__PURE__ */r.jsx(t.Image,{source:{uri:e},style:i,resizeMode:"contain",accessible:true,accessibilityRole:"image",accessibilityLabel:n,onError:a.onError})})}function TelevetBookingChrome({step:n,furthestIndex:l,title:i,canGoBack:o,isDirty:a,onBack:s,onClose:c,onConfirmDiscard:d,triageOpen:u=false,stepContext:p,presentation:h="rail"}){let f=useEverfurTheme(),m=e.useMemo(()=>na(f),[f]),g=e.useMemo(()=>()=>{if(!a){c();return}let e={title:te.chrome.discardTitle,body:te.chrome.discardBody,confirmLabel:te.chrome.discardConfirmCta,keepLabel:te.chrome.discardKeepCta};if(d){Promise.resolve(d(e)).then(e=>{e&&c()},()=>{});return}t.Alert.alert(e.title,e.body,[{text:e.keepLabel,style:"cancel"},{text:e.confirmLabel,style:"destructive",onPress:c}])},[a,c,d]),b=e.useMemo(()=>()=>o?(s(),true):(g(),true),[o,s,g]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",b);return()=>{e.remove()}},[b]),J(b);let y=e.useMemo(()=>Xl(p),[p]),{current:v,total:x,steps:T}=Zl(n,y,u),k=n==="booked"?te.bookedStepLabel:ee(te.loading.progressTemplate,{step:String(v),total:String(x)});return h==="nav"?/* @__PURE__ */r.jsx(t.View,{style:m.wrap,children:/* @__PURE__ */r.jsxs(t.View,{style:m.navBar,children:[
86
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Zo,testID:"televet-booking-back",style:m.navIcon,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
87
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",numberOfLines:1,style:m.navTitle,accessibilityRole:"header",testID:"televet-booking-title",children:i??te.navTitle}),
88
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:te.close,accessibilityHint:te.chrome.closeHint,testID:"televet-booking-close",style:m.navIcon,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Xo})})]})}):/* @__PURE__ */r.jsxs(t.View,{style:m.wrap,children:[
89
89
  /* @__PURE__ */r.jsx(BrandLogo,{logoUrl:f.meta.logoUrl,name:f.meta.displayName,barStyle:m.logoBar,logoStyle:m.logo,testID:"televet-booking-logo"}),
90
90
  /* @__PURE__ */r.jsxs(t.View,{style:m.bar,children:[
91
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Xo,testID:"televet-booking-back",style:m.ring,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
92
- /* @__PURE__ */r.jsxs(t.View,{style:m.center,accessibilityRole:"header",accessibilityLabel:`${i??ee.navTitle}, ${k}`,children:[
91
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:o?s:g,accessibilityRole:"button",accessibilityLabel:Zo,testID:"televet-booking-back",style:m.ring,children:/* @__PURE__ */r.jsx(t.View,{style:m.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
92
+ /* @__PURE__ */r.jsxs(t.View,{style:m.center,accessibilityRole:"header",accessibilityLabel:`${i??te.navTitle}, ${k}`,children:[
93
93
  /* @__PURE__ */r.jsx(Text,{tier:"compact",style:m.stepLabel,testID:"televet-booking-progress-label",children:k}),
94
94
  /* @__PURE__ */r.jsx(t.View,{style:m.segments,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",testID:"televet-booking-rail",children:T.map((e,n)=>/* @__PURE__ */r.jsx(t.View,{style:[m.segment,n<v?m.segmentDone:null]},e))})]}),
95
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:ee.close,accessibilityHint:ee.chrome.closeHint,testID:"televet-booking-close",style:m.ring,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Qo})})]})]})}var Qo="×",Xo="Back",Zo=28,ea=160;function ta(e){let{space:n,type:r}=e,l=Lo(e),i=e.slots.header,o=i?.textColor??l.ink;return t.StyleSheet.create({wrap:{...Ao(Oo(i,e.radius.lg))},logoBar:{alignItems:"center",paddingTop:n.sm},logo:{height:Zo,width:ea},bar:{flexDirection:"row",alignItems:"center",gap:n.md,paddingVertical:n.sm,minHeight:60},ring:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:l.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:o,transform:[{rotate:"45deg"}]},close:{...face(e,"regular"),color:o,fontSize:24,lineHeight:26},center:{flex:1,alignItems:"center",gap:6},stepLabel:{...face(e,"monoBold"),color:o,fontSize:12,lineHeight:16,letterSpacing:1.2,textTransform:"uppercase"},segments:{flexDirection:"row",gap:4,alignSelf:"stretch"},segment:{flex:1,height:4,borderRadius:2,backgroundColor:l.mist},segmentDone:{backgroundColor:l.go},title:{...headingFace(e,"medium"),color:o,fontSize:r.size.subtitle},navBar:{flexDirection:"row",alignItems:"center",minHeight:58,paddingHorizontal:n.sm,gap:n.xs},navIcon:{width:No,height:No,alignItems:"center",justifyContent:"center"},navTitle:{...textRole(e,"cardTitle"),fontSize:17*r.typeScale,lineHeight:25.5*r.typeScale,color:o,flex:1,textAlign:"center"}})}var na=/* @__PURE__ */Object.freeze({noteLabel:"Anything the vet should know? (optional)",bookCta:"Book visit",bookAtTemplate:"Book {day}, {time}",today:"Today",tomorrow:"Tomorrow",bookedTitleTemplate:"{pet}’s booked.",whenTemplate:"{day}, {date} at {time}",who:"Video visit with a licensed Everfur vet"});function ra(e){return e?Z(na.bookedTitleTemplate,{pet:e}):ee.bookedTitle}var la=18,ia=78;function oa(e,n=1){let r=e.color,l=e.type.typeScale,i=e=>Math.round(e*l*100)/100,o=e.slots.card,a=e.slots.input,s=e.slots.primaryButton?.borderRadius??999,c=o?.backgroundColor??r.surface,d=Vo(o).color??r.text.primary,u={shadowColor:r.text.primary,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1};return t.StyleSheet.create({screen:{paddingHorizontal:0,gap:0,backgroundColor:r.background},pad:{flex:1,minHeight:0,paddingHorizontal:e.space.xl,paddingTop:e.space.md,gap:e.space.md},bleed:{flex:1,minHeight:0},body:{paddingTop:8,paddingHorizontal:la,paddingBottom:20},scroll:{flex:1},stepLabel:{...textRole(e,"label"),fontSize:i(11),lineHeight:i(16.5),letterSpacing:i(.88),color:r.text.muted},title:{...textRole(e,"display"),lineHeight:i(31.32),marginTop:8,color:r.text.primary},subtitle:{...textRole(e,"body"),lineHeight:i(21.75),marginTop:8,color:r.text.metaCool},options:{gap:10,marginTop:20},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:56,paddingVertical:12,paddingHorizontal:16,borderRadius:16,backgroundColor:c,borderWidth:2,borderColor:"transparent",...u},optionPicked:{backgroundColor:r.highlight,borderColor:r.text.primary},radio:{width:22,height:22,borderRadius:11,borderWidth:2,borderColor:r.controlEdge},radioPicked:{borderWidth:7,borderColor:r.text.primary},optionLabel:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),color:d,flex:1},optionLabelPicked:{color:r.onHighlight},note:{gap:6,marginTop:18},noteLabel:{...textRole(e,"rowTitle"),fontSize:i(14),lineHeight:i(21),color:r.text.primary},noteInput:{...textRole(e,"body"),fontSize:i(16),lineHeight:i(22.4),minHeight:84,paddingVertical:12,paddingHorizontal:14,borderRadius:a?.borderRadius??14,borderWidth:1,borderColor:a?.borderColor??r.borderRingCream,backgroundColor:a?.backgroundColor??r.surface,color:a?.textColor??r.text.primary,textAlignVertical:"top"},days:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:18},day:{flexGrow:1,flexBasis:0,minWidth:Math.ceil(ia*n),minHeight:62,paddingVertical:8,paddingHorizontal:6,borderRadius:14,backgroundColor:c,alignItems:"center",justifyContent:"center",...u},dayPicked:{backgroundColor:r.primary},dayName:{...textRole(e,"cardTitle"),fontSize:i(15),lineHeight:i(22.5),color:d,textAlign:"center"},dayDate:{...face(e,"medium"),fontSize:i(13),lineHeight:i(19.5),color:r.text.muted,textAlign:"center"},dayTextPicked:{color:r.onPrimary},dayDatePicked:{color:r.onPrimary,opacity:.78},slots:{gap:10,marginTop:18},slotRow:{flexDirection:"row",gap:10},slot:{flex:1,minHeight:52,paddingHorizontal:14,borderRadius:999,backgroundColor:c,borderWidth:1.5,borderColor:r.borderRingCream,alignItems:"center",justifyContent:"center"},slotPicked:{backgroundColor:r.accent,borderWidth:2,borderColor:r.text.primary},slotSpacer:{flex:1},slotLabel:{...textRole(e,"rowTitle"),fontSize:i(15.5),lineHeight:i(23.25),color:d,textAlign:"center"},slotLabelPicked:{color:r.onAccent},ticks:{marginTop:18,gap:4},lines:{marginTop:12,gap:8},foot:{paddingTop:12,paddingHorizontal:la,paddingBottom:34,backgroundColor:r.background,borderTopWidth:1,borderTopColor:r.surfaceSubtle,gap:10},button:{minHeight:48,paddingHorizontal:22,borderRadius:s,backgroundColor:r.primary,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:8},buttonGhost:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.text.primary},buttonDisabled:{opacity:.4},buttonLabel:{...textRole(e,"button"),fontSize:i(16),lineHeight:i(24),color:r.onPrimary,textAlign:"center"},buttonGhostLabel:{color:r.text.primary},fine:{...textRole(e,"caption"),fontSize:i(12.5),lineHeight:i(18.75),color:r.text.muted,textAlign:"center"},done:{paddingTop:40,paddingHorizontal:22,paddingBottom:20,alignItems:"center"},check:{width:76,height:76,borderRadius:38,backgroundColor:r.accent,alignItems:"center",justifyContent:"center"},checkMark:{width:34,height:18,marginTop:-8,borderLeftWidth:4,borderBottomWidth:4,borderColor:r.onAccent,transform:[{rotate:"-45deg"}]},doneTitle:{...textRole(e,"display"),fontSize:i(34),lineHeight:i(39.1),marginTop:20,color:r.text.primary,textAlign:"center"},when:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),marginTop:10,color:r.text.primary,textAlign:"center"},who:{...textRole(e,"body"),marginTop:2,color:r.text.metaCool,textAlign:"center"},note2:{marginTop:22,alignSelf:"stretch"},calendarNote:{...textRole(e,"caption"),color:r.danger,textAlign:"center"}})}function aa(e){let t=[],n=e.breed?.trim();n&&t.push(n);let r=sa(e.ageYears);r!==null&&t.push(`${String(r)} year${r===1?"":"s"}`);let l=e.weightKg;return typeof l=="number"&&Number.isFinite(l)&&l>0&&t.push(`${String(Math.round(l))} kg`),t.join(" · ")}function sa(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}var ca=/* @__PURE__ */Object.freeze({}),da=100,ua=20;function pa(e,t,n,r){return![e,t,n,r].every(Number.isFinite)||e+n>r+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function ha(n,r){let l=typeof n=="number",i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true),u=e.useCallback(()=>{c.current!==null&&clearTimeout(c.current),c.current=null},[]);e.useEffect(()=>(d.current=true,()=>{d.current=false,u()}),[u]);let p=e.useCallback(function e(n){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!d.current||i===null)return;let o=pa(l,i.y,i.height,t.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}n>=ua||(c.current=setTimeout(()=>{c.current=null,e(n+1)},da))})},[]),h=e.useCallback(e=>{let{y:t,height:n}=e.nativeEvent.layout;s.current={y:t,height:n},u(),p(0)},[p,u]);return e.useMemo(()=>{if(!r)return{avoidingProps:ca,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:h}:{onLayout:h},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,n,o,h])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */r.jsx(t.View,{ref:e,collapsable:false,pointerEvents:"none",style:fa})}var fa=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function TelevetIntakeMedia({media:n,onChange:l,onPickMedia:i,meta:o}){let a=useEverfurTheme(),s=e.useMemo(()=>ba(a),[a]),c=y-n.length,[d,u]=e.useState(false);if(!i)return null;let p=async()=>{if(!(d||c<=0)){u(true);try{let e=await q(i,c);if(!e.ok||e.value===null||e.value.length===0)return;let t=new Set(n.map(e=>e.uri)),r=e.value.filter(e=>typeof e?.uri=="string"&&e.uri.length>0&&!t.has(e.uri));if(r.length===0)return;l([...n,...r].slice(0,y))}finally{u(false)}}};/* @__PURE__ */
95
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:g,accessibilityRole:"button",accessibilityLabel:te.close,accessibilityHint:te.chrome.closeHint,testID:"televet-booking-close",style:m.ring,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:m.close,accessibilityElementsHidden:true,importantForAccessibility:"no",children:Xo})})]})]})}var Xo="×",Zo="Back",ea=28,ta=160;function na(e){let{space:n,type:r}=e,l=Ao(e),i=e.slots.header,o=i?.textColor??l.ink;return t.StyleSheet.create({wrap:{...Oo(Vo(i,e.radius.lg))},logoBar:{alignItems:"center",paddingTop:n.sm},logo:{height:ea,width:ta},bar:{flexDirection:"row",alignItems:"center",gap:n.md,paddingVertical:n.sm,minHeight:60},ring:{width:Bo,height:Bo,borderRadius:Bo/2,borderWidth:1.5,borderColor:l.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:o,transform:[{rotate:"45deg"}]},close:{...face(e,"regular"),color:o,fontSize:24,lineHeight:26},center:{flex:1,alignItems:"center",gap:6},stepLabel:{...face(e,"monoBold"),color:o,fontSize:12,lineHeight:16,letterSpacing:1.2,textTransform:"uppercase"},segments:{flexDirection:"row",gap:4,alignSelf:"stretch"},segment:{flex:1,height:4,borderRadius:2,backgroundColor:l.mist},segmentDone:{backgroundColor:l.go},title:{...headingFace(e,"medium"),color:o,fontSize:r.size.subtitle},navBar:{flexDirection:"row",alignItems:"center",minHeight:58,paddingHorizontal:n.sm,gap:n.xs},navIcon:{width:Bo,height:Bo,alignItems:"center",justifyContent:"center"},navTitle:{...textRole(e,"cardTitle"),fontSize:17*r.typeScale,lineHeight:25.5*r.typeScale,color:o,flex:1,textAlign:"center"}})}var ra=640,la=600,ia=/* @__PURE__ */Object.freeze({width:0,height:0}),oa="useWindowDimensions"in a&&typeof a.useWindowDimensions=="function"?a.useWindowDimensions:()=>ia,aa=/* @__PURE__ */Object.freeze({width:"100%",maxWidth:ra,alignSelf:"center"});/* @__PURE__ */Object.freeze({...aa,flex:1});var sa=/* @__PURE__ */Object.freeze({...aa,flexGrow:1,flexShrink:1});function ca(){return oa().width>=la}var da=/* @__PURE__ */Symbol.for("@everfur/sdk#InSdkColumn@v1"),ua=globalThis,pa=ua[da]??(ua[da]=e.createContext(false));pa.displayName??="EverfurInSdkColumn";function SdkColumnReset({children:e}){/* @__PURE__ */
96
+ return r.jsx(pa.Provider,{value:false,children:e})}function SdkTabletColumn({children:n,style:l,testID:i}){let o=ca(),a=e.useContext(pa);return!o||a?n:/* @__PURE__ */r.jsx(t.View,{style:l===void 0?sa:[sa,l],testID:i??"everfur-tablet-column",children:/* @__PURE__ */r.jsx(pa.Provider,{value:true,children:n})})}var ha=/* @__PURE__ */Object.freeze({noteLabel:"Anything the vet should know? (optional)",bookCta:"Book visit",bookAtTemplate:"Book {day}, {time}",today:"Today",tomorrow:"Tomorrow",bookedTitleTemplate:"{pet}’s booked.",whenTemplate:"{day}, {date} at {time}",who:"Video visit with a licensed Everfur vet"});function fa(e){return e?ee(ha.bookedTitleTemplate,{pet:e}):te.bookedTitle}var ma=18,ga=78;function ba(e,n=1){let r=e.color,l=e.type.typeScale,i=e=>Math.round(e*l*100)/100,o=e.slots.card,a=e.slots.input,s=e.slots.primaryButton?.borderRadius??999,c=o?.backgroundColor??r.surface,d=No(o).color??r.text.primary,u={shadowColor:r.text.primary,shadowOpacity:.06,shadowRadius:3,shadowOffset:{width:0,height:1},elevation:1};return t.StyleSheet.create({screen:{paddingHorizontal:0,gap:0,backgroundColor:r.background},pad:{flex:1,minHeight:0,paddingHorizontal:e.space.xl,paddingTop:e.space.md,gap:e.space.md},bleed:{flex:1,minHeight:0},body:{paddingTop:8,paddingHorizontal:ma,paddingBottom:20},scroll:{flex:1},stepLabel:{...textRole(e,"label"),fontSize:i(11),lineHeight:i(16.5),letterSpacing:i(.88),color:r.text.muted},title:{...textRole(e,"display"),lineHeight:i(31.32),marginTop:8,color:r.text.primary},subtitle:{...textRole(e,"body"),lineHeight:i(21.75),marginTop:8,color:r.text.metaCool},options:{gap:10,marginTop:20},option:{flexDirection:"row",alignItems:"center",gap:12,minHeight:56,paddingVertical:12,paddingHorizontal:16,borderRadius:16,backgroundColor:c,borderWidth:2,borderColor:"transparent",...u},optionPicked:{backgroundColor:r.highlight,borderColor:r.text.primary},radio:{width:22,height:22,borderRadius:11,borderWidth:2,borderColor:r.controlEdge},radioPicked:{borderWidth:7,borderColor:r.text.primary},optionLabel:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),color:d,flex:1},optionLabelPicked:{color:r.onHighlight},note:{gap:6,marginTop:18},noteLabel:{...textRole(e,"rowTitle"),fontSize:i(14),lineHeight:i(21),color:r.text.primary},noteInput:{...textRole(e,"body"),fontSize:i(16),lineHeight:i(22.4),minHeight:84,paddingVertical:12,paddingHorizontal:14,borderRadius:a?.borderRadius??14,borderWidth:1,borderColor:a?.borderColor??r.borderRingCream,backgroundColor:a?.backgroundColor??r.surface,color:a?.textColor??r.text.primary,textAlignVertical:"top"},days:{flexDirection:"row",flexWrap:"wrap",gap:8,marginTop:18},day:{flexGrow:1,flexBasis:0,minWidth:Math.ceil(ga*n),minHeight:62,paddingVertical:8,paddingHorizontal:6,borderRadius:14,backgroundColor:c,alignItems:"center",justifyContent:"center",...u},dayPicked:{backgroundColor:r.primary},dayName:{...textRole(e,"cardTitle"),fontSize:i(15),lineHeight:i(22.5),color:d,textAlign:"center"},dayDate:{...face(e,"medium"),fontSize:i(13),lineHeight:i(19.5),color:r.text.muted,textAlign:"center"},dayTextPicked:{color:r.onPrimary},dayDatePicked:{color:r.onPrimary,opacity:.78},slots:{gap:10,marginTop:18},slotRow:{flexDirection:"row",gap:10},slot:{flex:1,minHeight:52,paddingHorizontal:14,borderRadius:999,backgroundColor:c,borderWidth:1.5,borderColor:r.borderRingCream,alignItems:"center",justifyContent:"center"},slotPicked:{backgroundColor:r.accent,borderWidth:2,borderColor:r.text.primary},slotSpacer:{flex:1},slotLabel:{...textRole(e,"rowTitle"),fontSize:i(15.5),lineHeight:i(23.25),color:d,textAlign:"center"},slotLabelPicked:{color:r.onAccent},ticks:{marginTop:18,gap:4},lines:{marginTop:12,gap:8},foot:{paddingTop:12,paddingHorizontal:ma,paddingBottom:34,backgroundColor:r.background,borderTopWidth:1,borderTopColor:r.surfaceSubtle,gap:10},button:{minHeight:48,paddingHorizontal:22,borderRadius:s,backgroundColor:r.primary,alignItems:"center",justifyContent:"center",flexDirection:"row",gap:8},buttonGhost:{backgroundColor:"transparent",borderWidth:1.5,borderColor:r.text.primary},buttonDisabled:{opacity:.4},buttonLabel:{...textRole(e,"button"),fontSize:i(16),lineHeight:i(24),color:r.onPrimary,textAlign:"center"},buttonGhostLabel:{color:r.text.primary},fine:{...textRole(e,"caption"),fontSize:i(12.5),lineHeight:i(18.75),color:r.text.muted,textAlign:"center"},done:{paddingTop:40,paddingHorizontal:22,paddingBottom:20,alignItems:"center"},check:{width:76,height:76,borderRadius:38,backgroundColor:r.accent,alignItems:"center",justifyContent:"center"},checkMark:{width:34,height:18,marginTop:-8,borderLeftWidth:4,borderBottomWidth:4,borderColor:r.onAccent,transform:[{rotate:"-45deg"}]},doneTitle:{...textRole(e,"display"),fontSize:i(34),lineHeight:i(39.1),marginTop:20,color:r.text.primary,textAlign:"center"},when:{...textRole(e,"rowTitle"),fontSize:i(16),lineHeight:i(24),marginTop:10,color:r.text.primary,textAlign:"center"},who:{...textRole(e,"body"),marginTop:2,color:r.text.metaCool,textAlign:"center"},note2:{marginTop:22,alignSelf:"stretch"},calendarNote:{...textRole(e,"caption"),color:r.danger,textAlign:"center"}})}function ya(e){let t=[],n=e.breed?.trim();n&&t.push(n);let r=va(e.ageYears);r!==null&&t.push(`${String(r)} year${r===1?"":"s"}`);let l=e.weightKg;return typeof l=="number"&&Number.isFinite(l)&&l>0&&t.push(`${String(Math.round(l))} kg`),t.join(" · ")}function va(e){if(typeof e!="number"||!Number.isFinite(e))return null;let t=Math.floor(e);return t>=0?t:null}var xa=/* @__PURE__ */Object.freeze({}),Ta=100,ka=20;function wa(e,t,n,r){return![e,t,n,r].every(Number.isFinite)||e+n>r+1?null:{chatTop:Math.max(0,e),parentTop:Math.max(0,e-t)}}function Sa(n,r){let l=typeof n=="number",i=e.useRef(null),[o,a]=e.useState(null),s=e.useRef(null),c=e.useRef(null),d=e.useRef(true),u=e.useCallback(()=>{c.current!==null&&clearTimeout(c.current),c.current=null},[]);e.useEffect(()=>(d.current=true,()=>{d.current=false,u()}),[u]);let p=e.useCallback(function e(n){i.current?.measureInWindow((r,l)=>{let i=s.current;if(!d.current||i===null)return;let o=wa(l,i.y,i.height,t.Dimensions.get("window").height);if(o!==null){a(e=>e!==null&&e.chatTop===o.chatTop&&e.parentTop===o.parentTop?e:o);return}n>=ka||(c.current=setTimeout(()=>{c.current=null,e(n+1)},Ta))})},[]),h=e.useCallback(e=>{let{y:t,height:n}=e.nativeEvent.layout;s.current={y:t,height:n},u(),p(0)},[p,u]);return e.useMemo(()=>{if(!r)return{avoidingProps:xa,probeRef:null,topInWindow:null};let e=o?.parentTop??0;return{avoidingProps:e>0?{keyboardVerticalOffset:e,onLayout:h}:{onLayout:h},probeRef:i,topInWindow:o?.chatTop??null}},[r,l,n,o,h])}function KeyboardOffsetProbe({probeRef:e}){return e===null?null:/* @__PURE__ */r.jsx(t.View,{ref:e,collapsable:false,pointerEvents:"none",style:ja})}var ja=/* @__PURE__ */Object.freeze({position:"absolute",top:0,left:0,width:0,height:0});function TelevetIntakeMedia({media:n,onChange:l,onPickMedia:i,meta:o}){let a=useEverfurTheme(),s=e.useMemo(()=>Ea(a),[a]),c=y-n.length,[d,u]=e.useState(false);if(!i)return null;let p=async()=>{if(!(d||c<=0)){u(true);try{let e=await K(i,c);if(!e.ok||e.value===null||e.value.length===0)return;let t=new Set(n.map(e=>e.uri)),r=e.value.filter(e=>typeof e?.uri=="string"&&e.uri.length>0&&!t.has(e.uri));if(r.length===0)return;l([...n,...r].slice(0,y))}finally{u(false)}}};/* @__PURE__ */
96
97
  return r.jsxs(t.View,{children:[
97
98
  /* @__PURE__ */r.jsxs(t.View,{style:s.row,children:[n.map((e,i)=>/* @__PURE__ */r.jsxs(t.View,{style:s.thumb,children:[
98
- /* @__PURE__ */r.jsx(t.Image,{source:{uri:e.uri},style:s.thumbImage,resizeMode:"cover"}),e.mimeType?.startsWith("video/")?/* @__PURE__ */r.jsx(t.View,{style:s.videoBadge,testID:`televet-intake-media-video-${String(i)}`,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.videoBadgeText,children:ga})}):null,
99
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>l(n.filter((e,t)=>t!==i)),accessibilityRole:"button",accessibilityLabel:ee.removePhotoLabel,testID:`televet-intake-media-remove-${String(i)}`,style:s.remove,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:s.removeGlyph,children:ma})})]},`${e.uri}-${String(i)}`)),c>0?/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>{p()},disabled:d,accessibilityRole:"button",accessibilityLabel:ee.addPhotoCta,accessibilityState:{busy:d,disabled:d},testID:"televet-intake-add-media",style:[s.dropzone,d?s.dropzoneBusy:null],children:d?/* @__PURE__ */r.jsx(t.ActivityIndicator,{testID:"televet-intake-media-busy"}):/* @__PURE__ */r.jsx(Text,{tier:"compact",style:s.dropzoneText,children:ee.addPhotoCta})}):null]}),o?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:s.meta,testID:"televet-intake-media-meta",children:o}):null]})}var ma="×",ga="▶",ya=92;function ba(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i;return t.StyleSheet.create({row:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingTop:r.sm},thumb:{width:ya,height:ya,borderRadius:l.md,backgroundColor:n.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:l.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:l.sm,backgroundColor:n.shadow},videoBadgeText:{color:n.text.onBrand,fontSize:o.nano},remove:{position:"absolute",top:-8,right:-8,width:No-16,height:No-16,borderRadius:No/2,backgroundColor:n.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...face(e,"medium"),color:n.surface,fontSize:o.subtitle,lineHeight:o.subtitle,includeFontPadding:false},dropzone:{width:ya,height:ya,borderRadius:l.md,borderWidth:1,borderStyle:"dashed",borderColor:n.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.sm},dropzoneBusy:{opacity:.6},meta:{...face(e,"regular"),color:n.text.metaCool,fontSize:o.caption,lineHeight:o.caption*a.normal,paddingTop:r.sm},dropzoneText:{...face(e,"mono"),color:n.text.metaCool,fontSize:o.nano,lineHeight:o.nano*a.normal,letterSpacing:.3,textAlign:"center"}})}function TelevetDayStrip({slots:n,selectedDayKey:l,onSelectDay:i}){let o=useEverfurTheme(),a=e.useMemo(()=>Ta(o),[o]),s=e.useMemo(()=>televetDaysFromSlots(n),[n]),c=xa(),d=s[0];return d===void 0?null:/* @__PURE__ */r.jsxs(t.View,{children:[
100
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:a.month,testID:"televet-day-strip-month",children:ui(d.iso)}),
99
+ /* @__PURE__ */r.jsx(t.Image,{source:{uri:e.uri},style:s.thumbImage,resizeMode:"cover"}),e.mimeType?.startsWith("video/")?/* @__PURE__ */r.jsx(t.View,{style:s.videoBadge,testID:`televet-intake-media-video-${String(i)}`,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.videoBadgeText,children:_a})}):null,
100
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>l(n.filter((e,t)=>t!==i)),accessibilityRole:"button",accessibilityLabel:te.removePhotoLabel,testID:`televet-intake-media-remove-${String(i)}`,style:s.remove,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:s.removeGlyph,children:Ca})})]},`${e.uri}-${String(i)}`)),c>0?/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>{p()},disabled:d,accessibilityRole:"button",accessibilityLabel:te.addPhotoCta,accessibilityState:{busy:d,disabled:d},testID:"televet-intake-add-media",style:[s.dropzone,d?s.dropzoneBusy:null],children:d?/* @__PURE__ */r.jsx(t.ActivityIndicator,{testID:"televet-intake-media-busy"}):/* @__PURE__ */r.jsx(Text,{tier:"compact",style:s.dropzoneText,children:te.addPhotoCta})}):null]}),o?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:s.meta,testID:"televet-intake-media-meta",children:o}):null]})}var Ca="×",_a="▶",Ia=92;function Ea(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i;return t.StyleSheet.create({row:{flexDirection:"row",flexWrap:"wrap",gap:r.md,paddingTop:r.sm},thumb:{width:Ia,height:Ia,borderRadius:l.md,backgroundColor:n.surfaceSubtle},thumbImage:{width:"100%",height:"100%",borderRadius:l.md},videoBadge:{position:"absolute",left:6,bottom:6,paddingHorizontal:6,paddingVertical:2,borderRadius:l.sm,backgroundColor:n.shadow},videoBadgeText:{color:n.text.onBrand,fontSize:o.nano},remove:{position:"absolute",top:-8,right:-8,width:Bo-16,height:Bo-16,borderRadius:Bo/2,backgroundColor:n.text.metaCool,alignItems:"center",justifyContent:"center"},removeGlyph:{...face(e,"medium"),color:n.surface,fontSize:o.subtitle,lineHeight:o.subtitle,includeFontPadding:false},dropzone:{width:Ia,height:Ia,borderRadius:l.md,borderWidth:1,borderStyle:"dashed",borderColor:n.brandBorder,alignItems:"center",justifyContent:"center",paddingHorizontal:r.sm},dropzoneBusy:{opacity:.6},meta:{...face(e,"regular"),color:n.text.metaCool,fontSize:o.caption,lineHeight:o.caption*a.normal,paddingTop:r.sm},dropzoneText:{...face(e,"mono"),color:n.text.metaCool,fontSize:o.nano,lineHeight:o.nano*a.normal,letterSpacing:.3,textAlign:"center"}})}function TelevetDayStrip({slots:n,selectedDayKey:l,onSelectDay:i}){let o=useEverfurTheme(),a=e.useMemo(()=>Ra(o),[o]),s=e.useMemo(()=>televetDaysFromSlots(n),[n]),c=Pa(),d=s[0];return d===void 0?null:/* @__PURE__ */r.jsxs(t.View,{children:[
101
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:a.month,testID:"televet-day-strip-month",children:pi(d.iso)}),
101
102
  /* @__PURE__ */r.jsx(t.ScrollView,{ref:c.scrollRef,horizontal:true,showsHorizontalScrollIndicator:false,contentContainerStyle:a.strip,onLayout:c.onStripLayout,onContentSizeChange:c.onContentSize,testID:"televet-day-strip",children:s.map(e=>{let n=e.key===l;/* @__PURE__ */
102
- return r.jsxs(t.Pressable,{onLayout:n?c.onSelectedDayLayout:void 0,onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:pi(e.iso),accessibilityState:{selected:n},testID:`televet-day-${e.key}`,style:[a.day,n?a.daySelected:null],children:[
103
+ return r.jsxs(t.Pressable,{onLayout:n?c.onSelectedDayLayout:void 0,onPress:()=>i(e),accessibilityRole:"button",accessibilityLabel:hi(e.iso),accessibilityState:{selected:n},testID:`televet-day-${e.key}`,style:[a.day,n?a.daySelected:null],children:[
103
104
  /* @__PURE__ */r.jsx(Text,{tier:"compact",style:[a.dayWeekday,n?a.dayTextSelected:null],children:e.weekday}),
104
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:[a.dayNumber,n?a.dayTextSelected:null],children:e.dayNumber})]},e.key)})})]})}var va=/* @__PURE__ */Object.freeze({done:false,viewport:null,content:null,chip:null});function xa(){let t=e.useRef(null),n=e.useRef(va),r=e.useCallback(e=>{let r={...n.current,...e};if(r.done||r.viewport===null||r.content===null||r.chip===null){n.current=r;return}n.current={...r,done:true};let l=r.chip.x-(r.viewport-r.chip.width)/2,i=Math.min(Math.max(0,l),Math.max(0,r.content-r.viewport));i>0&&t.current?.scrollTo({x:i,animated:false})},[]),l=e.useCallback(e=>r({viewport:e.nativeEvent.layout.width}),[r]),i=e.useCallback(e=>r({content:e}),[r]),o=e.useCallback(e=>{let{x:t,width:n}=e.nativeEvent.layout;r({chip:{x:t,width:n}})},[r]);return{scrollRef:t,onStripLayout:l,onContentSize:i,onSelectedDayLayout:o}}function televetDaysFromSlots(e){let t=/* @__PURE__ */new Map;for(let n of e){let e=di(n.startsAt);if(t.has(e))continue;let r=new Date(n.startsAt);Number.isNaN(r.getTime())||t.set(e,
105
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:[a.dayNumber,n?a.dayTextSelected:null],children:e.dayNumber})]},e.key)})})]})}var Da=/* @__PURE__ */Object.freeze({done:false,viewport:null,content:null,chip:null});function Pa(){let t=e.useRef(null),n=e.useRef(Da),r=e.useCallback(e=>{let r={...n.current,...e};if(r.done||r.viewport===null||r.content===null||r.chip===null){n.current=r;return}n.current={...r,done:true};let l=r.chip.x-(r.viewport-r.chip.width)/2,i=Math.min(Math.max(0,l),Math.max(0,r.content-r.viewport));i>0&&t.current?.scrollTo({x:i,animated:false})},[]),l=e.useCallback(e=>r({viewport:e.nativeEvent.layout.width}),[r]),i=e.useCallback(e=>r({content:e}),[r]),o=e.useCallback(e=>{let{x:t,width:n}=e.nativeEvent.layout;r({chip:{x:t,width:n}})},[r]);return{scrollRef:t,onStripLayout:l,onContentSize:i,onSelectedDayLayout:o}}function televetDaysFromSlots(e){let t=/* @__PURE__ */new Map;for(let n of e){let e=ui(n.startsAt);if(t.has(e))continue;let r=new Date(n.startsAt);Number.isNaN(r.getTime())||t.set(e,
105
106
  /* @__PURE__ */Object.freeze({key:e,iso:n.startsAt,weekday:r.toLocaleDateString(void 0,{weekday:"short"}),dayNumber:String(r.getDate())}))}/* @__PURE__ */
106
- return Object.freeze([...t.values()])}function Ta(e){let{space:n,type:r}=e,{size:l,lineHeight:i}=r,o=Lo(e),a=e.slots.chip,s=Vo(a);return t.StyleSheet.create({month:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug,paddingBottom:n.md},strip:{gap:n.sm,paddingHorizontal:2,paddingVertical:2},day:{width:52,minHeight:64,paddingVertical:n.sm,borderRadius:14,borderWidth:1.5,borderColor:o.line,backgroundColor:o.surface,alignItems:"center",justifyContent:"center",gap:2,...Ao(a,1.5)},daySelected:{backgroundColor:o.pink,borderColor:o.ink},dayWeekday:{...face(e,"monoBold"),color:o.ink,fontSize:11,lineHeight:14,letterSpacing:.88,textTransform:"uppercase",...s},dayNumber:{...face(e,"medium"),color:o.ink,fontSize:l.heading,lineHeight:l.heading*i.tight,...s},dayTextSelected:{color:o.onPink}})}function TelevetSlotPicker({slots:n,busySlotId:l,onPick:i,selectedSlot:o=null,ListHeaderComponent:a,rowTestIdPrefix:s="televet-slot",testID:c="televet-slot-list",periodLabels:d}){let u=useEverfurTheme(),p=e.useMemo(()=>Sa(u),[u]),h=e.useMemo(()=>televetDaysFromSlots(n),[n]),[f,m]=e.useState(null),g=o?di(o.startsAt):null,y=wa(h,[f,g])??h[0]?.key??null,b=e.useMemo(()=>y?n.filter(e=>di(e.startsAt)===y):[],[n,y]),v=a,x=e.useMemo(()=>b.map(e=>ai(e.startsAt)),[b]),T=e.useMemo(()=>new Set(x.filter(e=>e.length>0)).size>1,[x]),k=b[0];
107
+ return Object.freeze([...t.values()])}function Ra(e){let{space:n,type:r}=e,{size:l,lineHeight:i}=r,o=Ao(e),a=e.slots.chip,s=No(a);return t.StyleSheet.create({month:{...face(e,"bold"),color:o.ink,fontSize:l.body,lineHeight:l.body*i.snug,paddingBottom:n.md},strip:{gap:n.sm,paddingHorizontal:2,paddingVertical:2},day:{width:52,minHeight:64,paddingVertical:n.sm,borderRadius:14,borderWidth:1.5,borderColor:o.line,backgroundColor:o.surface,alignItems:"center",justifyContent:"center",gap:2,...Oo(a,1.5)},daySelected:{backgroundColor:o.pink,borderColor:o.ink},dayWeekday:{...face(e,"monoBold"),color:o.ink,fontSize:11,lineHeight:14,letterSpacing:.88,textTransform:"uppercase",...s},dayNumber:{...face(e,"medium"),color:o.ink,fontSize:l.heading,lineHeight:l.heading*i.tight,...s},dayTextSelected:{color:o.onPink}})}function TelevetSlotPicker({slots:n,busySlotId:l,onPick:i,selectedSlot:o=null,ListHeaderComponent:a,rowTestIdPrefix:s="televet-slot",testID:c="televet-slot-list",periodLabels:d}){let u=useEverfurTheme(),p=e.useMemo(()=>La(u),[u]),h=e.useMemo(()=>televetDaysFromSlots(n),[n]),[f,m]=e.useState(null),g=o?ui(o.startsAt):null,b=Fa(h,[f,g])??h[0]?.key??null,y=e.useMemo(()=>b?n.filter(e=>ui(e.startsAt)===b):[],[n,b]),v=a,x=e.useMemo(()=>y.map(e=>si(e.startsAt)),[y]),T=e.useMemo(()=>new Set(x.filter(e=>e.length>0)).size>1,[x]),k=y[0];
107
108
  /* @__PURE__ */
108
109
  return r.jsxs(t.View,{style:p.root,testID:c,children:[v?/* @__PURE__ */r.jsx(v,{}):null,
109
- /* @__PURE__ */r.jsx(TelevetDayStrip,{slots:n,selectedDayKey:y,onSelectDay:e=>m(e.key)}),k&&!T?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.zone,testID:"televet-slot-zone",children:ai(k.startsAt)}):null,
110
- /* @__PURE__ */r.jsx(t.ScrollView,{style:p.gridScroll,contentContainerStyle:p.groups,showsVerticalScrollIndicator:false,children:ka(b,d).map(e=>/* @__PURE__ */r.jsxs(t.View,{style:p.group,children:[e.label?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.period,accessibilityRole:"header",testID:`televet-slot-period-${e.key}`,children:e.label}):null,
111
- /* @__PURE__ */r.jsx(t.View,{style:p.grid,children:e.slots.map(e=>{let n=b.indexOf(e),a=l===e.slotId,c=l!==null,d=o?.slotId===e.slotId,h=T?x[n]??"":"";/* @__PURE__ */
112
- return r.jsxs(t.Pressable,{onPress:()=>i(e),disabled:c,accessibilityRole:"button",accessibilityLabel:[ri(e.startsAt),h].filter(e=>e.length>0).join(" "),accessibilityState:{disabled:c,busy:a,selected:d},testID:`${s}-${e.slotId}`,style:({pressed:e})=>[p.chip,d?p.chipPicked:null,a?p.chipBusy:null,c&&!a?p.chipDisabled:null,e&&!u.motion.reducedMotion?p.chipPressed:null],children:[
113
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipLabel,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],children:ri(e.startsAt)}),h.length>0?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipZone,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],testID:`${s}-${e.slotId}-zone`,children:h}):null]},e.slotId)})})]},e.key))})]})}function ka(e,t){return t?["morning","afternoon","evening"].map(n=>({key:n,label:t[n],slots:e.filter(e=>yi(e.startsAt)===n)})).filter(e=>e.slots.length>0):[{key:"all",label:null,slots:e}]}function wa(e,t){for(let n of t)if(n!==null&&e.some(e=>e.key===n))return n;return null}function Sa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.chip,d=Vo(c);return t.StyleSheet.create({root:{flex:1,minHeight:0},groups:{gap:r.lg,paddingBottom:r.xl},group:{gap:r.sm},period:{...face(e,"monoBold"),color:s.muted,fontSize:12,lineHeight:16,letterSpacing:.96,textTransform:"uppercase"},gridScroll:{flex:1},zone:{textAlign:"center",...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,paddingVertical:r.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:r.sm},chip:{minWidth:96,flexGrow:1,flexBasis:"auto",minHeight:44,borderRadius:l.pill,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,...Ao(c,1.5)},chipPicked:{borderColor:s.ink,backgroundColor:s.pink},chipLabelPicked:{color:s.onPink},chipPressed:{transform:[{scale:.95}]},chipBusy:{backgroundColor:n.primary,borderColor:n.primary},chipDisabled:{opacity:.45},chipLabel:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug,fontVariant:["tabular-nums"],...d},chipLabelBusy:{color:n.onPrimary},chipZone:{...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,...d}})}function TelevetSummaryRow({label:n,value:l,last:i=false,action:o,note:a,testID:s}){let c=useEverfurTheme(),d=e.useMemo(()=>Ca(c),[c]);/* @__PURE__ */
110
+ /* @__PURE__ */r.jsx(TelevetDayStrip,{slots:n,selectedDayKey:b,onSelectDay:e=>m(e.key)}),k&&!T?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.zone,testID:"televet-slot-zone",children:si(k.startsAt)}):null,
111
+ /* @__PURE__ */r.jsx(t.ScrollView,{style:p.gridScroll,contentContainerStyle:p.groups,showsVerticalScrollIndicator:false,children:za(y,d).map(e=>/* @__PURE__ */r.jsxs(t.View,{style:p.group,children:[e.label?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:p.period,accessibilityRole:"header",testID:`televet-slot-period-${e.key}`,children:e.label}):null,
112
+ /* @__PURE__ */r.jsx(t.View,{style:p.grid,children:e.slots.map(e=>{let n=y.indexOf(e),a=l===e.slotId,c=l!==null,d=o?.slotId===e.slotId,h=T?x[n]??"":"";/* @__PURE__ */
113
+ return r.jsxs(t.Pressable,{onPress:()=>i(e),disabled:c,accessibilityRole:"button",accessibilityLabel:[li(e.startsAt),h].filter(e=>e.length>0).join(" "),accessibilityState:{disabled:c,busy:a,selected:d},testID:`${s}-${e.slotId}`,style:({pressed:e})=>[p.chip,d?p.chipPicked:null,a?p.chipBusy:null,c&&!a?p.chipDisabled:null,e&&!u.motion.reducedMotion?p.chipPressed:null],children:[
114
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipLabel,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],children:li(e.startsAt)}),h.length>0?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[p.chipZone,d?p.chipLabelPicked:null,a?p.chipLabelBusy:null],testID:`${s}-${e.slotId}-zone`,children:h}):null]},e.slotId)})})]},e.key))})]})}function za(e,t){return t?["morning","afternoon","evening"].map(n=>({key:n,label:t[n],slots:e.filter(e=>yi(e.startsAt)===n)})).filter(e=>e.slots.length>0):[{key:"all",label:null,slots:e}]}function Fa(e,t){for(let n of t)if(n!==null&&e.some(e=>e.key===n))return n;return null}function La(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Ao(e),c=e.slots.chip,d=No(c);return t.StyleSheet.create({root:{flex:1,minHeight:0},groups:{gap:r.lg,paddingBottom:r.xl},group:{gap:r.sm},period:{...face(e,"monoBold"),color:s.muted,fontSize:12,lineHeight:16,letterSpacing:.96,textTransform:"uppercase"},gridScroll:{flex:1},zone:{textAlign:"center",...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,paddingVertical:r.md},grid:{flexDirection:"row",flexWrap:"wrap",gap:r.sm},chip:{minWidth:96,flexGrow:1,flexBasis:"auto",minHeight:44,borderRadius:l.pill,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,alignItems:"center",justifyContent:"center",paddingHorizontal:r.md,...Oo(c,1.5)},chipPicked:{borderColor:s.ink,backgroundColor:s.pink},chipLabelPicked:{color:s.onPink},chipPressed:{transform:[{scale:.95}]},chipBusy:{backgroundColor:n.primary,borderColor:n.primary},chipDisabled:{opacity:.45},chipLabel:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug,fontVariant:["tabular-nums"],...d},chipLabelBusy:{color:n.onPrimary},chipZone:{...face(e,"mono"),color:n.text.muted,fontSize:o.tiny,lineHeight:o.tiny*a.normal,letterSpacing:.4,...d}})}function TelevetSummaryRow({label:n,value:l,last:i=false,action:o,note:a,testID:s}){let c=useEverfurTheme(),d=e.useMemo(()=>Oa(c),[c]);/* @__PURE__ */
114
115
  return r.jsxs(t.View,{style:[d.row,i?d.rowLast:null],testID:s,children:[
115
116
  /* @__PURE__ */r.jsx(Text,{style:d.rowLabel,children:n}),a?/* @__PURE__ */r.jsxs(t.View,{style:d.rowValueStack,children:[
116
117
  /* @__PURE__ */r.jsx(Text,{style:[d.rowValue,d.rowValueStacked],children:l}),
117
- /* @__PURE__ */r.jsx(Text,{style:d.rowNote,testID:s?`${s}-note`:void 0,children:a})]}):/* @__PURE__ */r.jsx(Text,{style:d.rowValue,children:l}),o??null]})}function TelevetConsentCheckbox({label:n,checked:l,onToggle:i,testID:o}){let a=useEverfurTheme(),s=e.useMemo(()=>Ca(a),[a]);/* @__PURE__ */
118
+ /* @__PURE__ */r.jsx(Text,{style:d.rowNote,testID:s?`${s}-note`:void 0,children:a})]}):/* @__PURE__ */r.jsx(Text,{style:d.rowValue,children:l}),o??null]})}function TelevetConsentCheckbox({label:n,checked:l,onToggle:i,testID:o}){let a=useEverfurTheme(),s=e.useMemo(()=>Oa(a),[a]);/* @__PURE__ */
118
119
  return r.jsxs(t.Pressable,{onPress:()=>i(!l),accessibilityRole:"checkbox",accessibilityLabel:n,accessibilityState:{checked:l},testID:o,style:s.consent,children:[
119
- /* @__PURE__ */r.jsx(t.View,{style:[s.box,l?s.boxChecked:null],children:l?/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.tick,children:ja}):null}),
120
- /* @__PURE__ */r.jsx(Text,{style:s.consentLabel,children:n})]})}var ja="✓";function TelevetSummaryCard({children:n,testID:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Ca(i),[i]);/* @__PURE__ */
121
- return r.jsx(t.View,{style:o.card,testID:l,children:n})}function Ca(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Vo(e.slots.card);return t.StyleSheet.create({card:{borderRadius:l.lg,borderWidth:1,borderColor:n.borderRingCream,backgroundColor:n.surface,paddingHorizontal:r.lg,...Ao(e.slots.card,1)},row:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:48,paddingVertical:r.md,borderBottomWidth:1,borderBottomColor:n.borderRingCream},rowLast:{borderBottomWidth:0},rowLabel:{width:64,...face(e,"regular"),color:n.text.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValue:{flex:1,...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValueStack:{flex:1,gap:2},rowValueStacked:{flex:0},rowNote:{...face(e,"regular"),color:n.text.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...s},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:No,paddingVertical:14,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:n.surfaceSubtle},box:{width:22,height:22,borderRadius:l.xs,borderWidth:1.5,borderColor:n.brandInk,backgroundColor:n.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:n.primary,borderColor:n.primary},tick:{...face(e,"bold"),color:n.onPrimary,fontSize:o.caption,lineHeight:o.caption,includeFontPadding:false},consentLabel:{flex:1,...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed}})}function ReviewStep({when:n,onChangeWhen:l,stateName:i,about:o,lengthMinutes:a,clinician:s,clinicianRole:c,petName:d,reason:u,shareRecords:p,onToggleShare:h,stateCode:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,failure:k,onConfirm:w,emergency:S,onAcknowledgeEmergency:j,onSeeOtherVets:C,mediaShortfall:_=Di,primaryVet:I,onFindEmergencyVet:E}){let D=Bo(),P=useEverfurTheme(),R=e.useMemo(()=>Da(P),[P]),z=i??f??"",F=d?Z(ee.whereAttestTemplate,{pet:d,state:z}):Z(ee.stateAttestTemplate,{state:z}),L=o??u,A=ee.emergency.lede;/* @__PURE__ */
120
+ /* @__PURE__ */r.jsx(t.View,{style:[s.box,l?s.boxChecked:null],children:l?/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.tick,children:Aa}):null}),
121
+ /* @__PURE__ */r.jsx(Text,{style:s.consentLabel,children:n})]})}var Aa="✓";function TelevetSummaryCard({children:n,testID:l}){let i=useEverfurTheme(),o=e.useMemo(()=>Oa(i),[i]);/* @__PURE__ */
122
+ return r.jsx(t.View,{style:o.card,testID:l,children:n})}function Oa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=No(e.slots.card);return t.StyleSheet.create({card:{borderRadius:l.lg,borderWidth:1,borderColor:n.borderRingCream,backgroundColor:n.surface,paddingHorizontal:r.lg,...Oo(e.slots.card,1)},row:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:48,paddingVertical:r.md,borderBottomWidth:1,borderBottomColor:n.borderRingCream},rowLast:{borderBottomWidth:0},rowLabel:{width:64,...face(e,"regular"),color:n.text.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValue:{flex:1,...face(e,"bold"),color:n.brandInk,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...s},rowValueStack:{flex:1,gap:2},rowValueStacked:{flex:0},rowNote:{...face(e,"regular"),color:n.text.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...s},consent:{flexDirection:"row",alignItems:"flex-start",gap:r.md,minHeight:Bo,paddingVertical:14,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:n.surfaceSubtle},box:{width:22,height:22,borderRadius:l.xs,borderWidth:1.5,borderColor:n.brandInk,backgroundColor:n.surface,alignItems:"center",justifyContent:"center"},boxChecked:{backgroundColor:n.primary,borderColor:n.primary},tick:{...face(e,"bold"),color:n.onPrimary,fontSize:o.caption,lineHeight:o.caption,includeFontPadding:false},consentLabel:{flex:1,...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed}})}function ReviewStep({when:n,onChangeWhen:l,stateName:i,about:o,lengthMinutes:a,clinician:s,clinicianRole:c,petName:d,reason:u,shareRecords:p,onToggleShare:h,stateCode:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:b,termsAttested:y,onToggleTermsAttest:v,canConfirm:x,busy:T,failure:k,onConfirm:w,emergency:S,onAcknowledgeEmergency:j,onSeeOtherVets:C,mediaShortfall:_=Pi,primaryVet:I,onFindEmergencyVet:E}){let D=Mo(),P=useEverfurTheme(),R=e.useMemo(()=>Ma(P),[P]),z=i??f??"",F=d?ee(te.whereAttestTemplate,{pet:d,state:z}):ee(te.stateAttestTemplate,{state:z}),L=o??u,A=te.emergency.lede;/* @__PURE__ */
122
123
  return r.jsxs(t.View,{style:D.scrollRoot,testID:"televet-booking-review",children:[
123
124
  /* @__PURE__ */r.jsxs(t.ScrollView,{style:D.scrollBody,contentContainerStyle:R.body,keyboardShouldPersistTaps:"handled",showsVerticalScrollIndicator:false,testID:"televet-booking-review-scroll",children:[
124
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:D.stepTitle,accessibilityRole:"header",children:ee.reviewHeading}),
125
- /* @__PURE__ */r.jsxs(TelevetSummaryCard,{testID:"televet-review-summary",children:[d?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryPet,value:d,testID:"televet-review-row-pet"}):null,s?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryVet,value:c==="vet_tech"?`${s} · ${ee.vetTechRoleLabel}`:s,note:c==="vet_tech"?ee.vetTechNoRxLine:null,testID:"televet-review-row-vet"}):null,
126
- /* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryWhen,value:n,testID:"televet-review-row-when",action:l?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.changeCta,kind:"quiet",fullWidth:false,onPress:l,testID:"televet-review-change-when"}):null}),
127
- /* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryLength,value:Z(ee.summaryLengthTemplate,{n:String(a)}),testID:"televet-review-row-length"}),z?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryWhere,value:z,testID:"televet-review-row-where"}):null,L?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:ee.summaryReason,value:L,last:true,testID:"televet-review-row-reason"}):null]}),f?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:F,checked:m,onToggle:g,testID:"televet-review-state-attest"}):null,y?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:y,checked:b,onToggle:v,testID:"televet-review-terms-attest"}):null,
128
- /* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:ee.shareRecordsOff,checked:p,onToggle:h,testID:"televet-review-share-records"}),
125
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:D.stepTitle,accessibilityRole:"header",children:te.reviewHeading}),
126
+ /* @__PURE__ */r.jsxs(TelevetSummaryCard,{testID:"televet-review-summary",children:[d?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryPet,value:d,testID:"televet-review-row-pet"}):null,s?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryVet,value:c==="vet_tech"?`${s} · ${te.vetTechRoleLabel}`:s,note:c==="vet_tech"?te.vetTechNoRxLine:null,testID:"televet-review-row-vet"}):null,
127
+ /* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryWhen,value:n,testID:"televet-review-row-when",action:l?/* @__PURE__ */r.jsx(TelevetButton,{label:te.changeCta,kind:"quiet",fullWidth:false,onPress:l,testID:"televet-review-change-when"}):null}),
128
+ /* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryLength,value:ee(te.summaryLengthTemplate,{n:String(a)}),testID:"televet-review-row-length"}),z?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryWhere,value:z,testID:"televet-review-row-where"}):null,L?/* @__PURE__ */r.jsx(TelevetSummaryRow,{label:te.summaryReason,value:L,last:true,testID:"televet-review-row-reason"}):null]}),f?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:F,checked:m,onToggle:g,testID:"televet-review-state-attest"}):null,b?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:b,checked:y,onToggle:v,testID:"televet-review-terms-attest"}):null,
129
+ /* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:te.shareRecordsOff,checked:p,onToggle:h,testID:"televet-review-share-records"}),
129
130
  /* @__PURE__ */r.jsx(TelevetMediaDropNotice,{shortfall:_,testIDPrefix:"televet-review"}),S?/* @__PURE__ */r.jsxs(t.View,{style:R.emergencyBanner,testID:"televet-review-emergency",children:[
130
- /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:R.emergencyTitle,children:ee.emergency.bannerTitle}),
131
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:R.emergencyTitle,children:te.emergency.bannerTitle}),
131
132
  /* @__PURE__ */r.jsx(Text,{style:R.emergencyLede,children:A}),S.length>0?/* @__PURE__ */r.jsx(Text,{style:R.emergencyLede,testID:"televet-review-emergency-categories",children:S.join(", ")}):null,
132
133
  /* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:d,primaryVet:I,onFindEmergencyVet:E}),
133
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:j,testID:"televet-review-emergency-ack"})]}):null,k==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}):null,k==="clinician_unavailable"?/* @__PURE__ */r.jsxs(t.View,{style:D.list,testID:"televet-review-clinician-unavailable",children:[
134
- /* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}),
135
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:C,testID:"televet-review-see-other-vets"})]}):null,k==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed,testID:"televet-review-rate-limited"}):null,k==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]}),S?null:/* @__PURE__ */r.jsx(t.View,{style:D.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:T?ee.confirmBusy:ee.confirmCta,kind:"primary",loading:T,disabled:!x||T||!!f&&!m||!!y&&!b,onPress:w,testID:"televet-review-confirm"})})]})}var _a="○";function Ia(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.name??null:null}function TelevetStepFrame({heading:n,lead:l,testID:i,scrollTestID:o,scrollRef:a,footer:s,children:c}){let d=Bo(),u=useEverfurTheme(),p=e.useMemo(()=>Da(u),[u]),h=t.Platform.OS==="ios",f=ha(void 0,h);/* @__PURE__ */
134
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:j,testID:"televet-review-emergency-ack"})]}):null,k==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed}):null,k==="clinician_unavailable"?/* @__PURE__ */r.jsxs(t.View,{style:D.list,testID:"televet-review-clinician-unavailable",children:[
135
+ /* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed}),
136
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.seeOtherVetsCta,kind:"secondary",onPress:C,testID:"televet-review-see-other-vets"})]}):null,k==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed,testID:"televet-review-rate-limited"}):null,k==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.bookingPausedTitle,testID:"televet-review-not-entitled"}):null]}),S?null:/* @__PURE__ */r.jsx(t.View,{style:D.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:T?te.confirmBusy:te.confirmCta,kind:"primary",loading:T,disabled:!x||T||!!f&&!m||!!b&&!y,onPress:w,testID:"televet-review-confirm"})})]})}var Va="○";function Na(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.name??null:null}function TelevetStepFrame({heading:n,lead:l,testID:i,scrollTestID:o,scrollRef:a,footer:s,children:c}){let d=Mo(),u=useEverfurTheme(),p=e.useMemo(()=>Ma(u),[u]),h=t.Platform.OS==="ios",f=Sa(void 0,h);/* @__PURE__ */
136
137
  return r.jsx(t.View,{style:d.scrollRoot,testID:i,children:/* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:h?"padding":void 0,style:p.avoider,...f.avoidingProps,children:[
137
138
  /* @__PURE__ */r.jsx(KeyboardOffsetProbe,{probeRef:f.probeRef}),
138
139
  /* @__PURE__ */r.jsxs(t.ScrollView,{...a?{ref:a}:{},style:d.scrollBody,contentContainerStyle:p.body,keyboardShouldPersistTaps:"handled",keyboardDismissMode:h?"interactive":"on-drag",showsVerticalScrollIndicator:false,...o?{testID:o}:{},children:[
139
140
  /* @__PURE__ */r.jsxs(t.View,{style:p.head,children:[
140
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:d.stepTitle,accessibilityRole:"header",children:n}),l?/* @__PURE__ */r.jsx(Text,{style:d.stepHelp,children:l}):null]}),c]}),s?/* @__PURE__ */r.jsx(t.View,{style:d.scrollFooter,children:s}):null]})})}function TelevetChoiceRow({title:n,meta:l,selected:i,onPress:o,testID:a,leading:s}){let c=useEverfurTheme(),d=e.useMemo(()=>Da(c),[c]);/* @__PURE__ */
141
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:d.stepTitle,accessibilityRole:"header",children:n}),l?/* @__PURE__ */r.jsx(Text,{style:d.stepHelp,children:l}):null]}),c]}),s?/* @__PURE__ */r.jsx(t.View,{style:d.scrollFooter,children:s}):null]})})}function TelevetChoiceRow({title:n,meta:l,selected:i,onPress:o,testID:a,leading:s}){let c=useEverfurTheme(),d=e.useMemo(()=>Ma(c),[c]);/* @__PURE__ */
141
142
  return r.jsxs(t.Pressable,{onPress:o,accessibilityRole:"radio",accessibilityLabel:l?`${n}, ${l}`:n,accessibilityState:{checked:i,selected:i},testID:a,style:({pressed:e})=>[d.choice,i?d.choiceSelected:null,e&&!c.motion.reducedMotion?d.pressed:null],children:[s??/* @__PURE__ */r.jsx(t.View,{style:d.radio,children:/* @__PURE__ */r.jsx(t.View,{style:[d.radioDot,i?d.radioDotOn:null]})}),
142
143
  /* @__PURE__ */r.jsxs(t.View,{style:d.choiceText,children:[
143
- /* @__PURE__ */r.jsx(Text,{style:d.choiceTitle,children:n}),l?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:d.choiceMeta,children:l}):null]})]})}function PetStep({pets:n,isPending:l,isError:i,error:o,onRetry:a,selectedId:s,onSelect:c,onNext:d,onAddPet:u}){let p=Bo(),h=useEverfurTheme(),f=e.useMemo(()=>Da(h),[h]);return l?/* @__PURE__ */r.jsx(t.View,{style:p.list,testID:"televet-pets-loading",children:[0,1].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72},e))}):i?/* @__PURE__ */r.jsx(t.View,{testID:"televet-pets-error",children:/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:ee.chrome.loadFailedTitle,actionLabel:ee.chrome.retryCta,onRetry:a})}):n.length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-pets-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.chrome.noPetsTitle,actionLabel:ee.addPetCta,onAction:u})}):/* @__PURE__ */r.jsxs(TelevetStepFrame,{heading:ee.petSelectTitle,testID:"televet-booking-pets",footer:d?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",disabled:!s,onPress:d,testID:"televet-pets-next"}):null,children:[
144
- /* @__PURE__ */r.jsx(t.View,{style:f.choices,accessibilityRole:"radiogroup",testID:"televet-pets",children:n.map(e=>/* @__PURE__ */r.jsx(TelevetChoiceRow,{title:e.name??"",meta:aa(e),selected:s===e.petRef,onPress:()=>c(e.petRef),testID:`televet-pet-${e.petRef}`,leading:/* @__PURE__ */r.jsx(t.View,{style:f.petDisc,children:/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.petDiscGlyph,children:Ea(e.name??"")})})},e.petRef))}),u?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.addAnotherPetCta,kind:"quiet",fullWidth:false,onPress:u,testID:"televet-pet-add"}):null]})}function Ea(e){let t=e.trim();return t.length===0?_a:t.slice(0,1).toUpperCase()}function ClinicianStep({clinicians:n,isPending:l,isError:i,error:o,selectedId:a,stateCode:s,stateName:c,onSelect:d,onRetry:u}){let p=Bo(),h=useEverfurTheme(),f=e.useMemo(()=>Da(h),[h]);if(l)/* @__PURE__ */
144
+ /* @__PURE__ */r.jsx(Text,{style:d.choiceTitle,children:n}),l?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:d.choiceMeta,children:l}):null]})]})}function PetStep({pets:n,isPending:l,isError:i,error:o,onRetry:a,selectedId:s,onSelect:c,onNext:d,onAddPet:u}){let p=Mo(),h=useEverfurTheme(),f=e.useMemo(()=>Ma(h),[h]);return l?/* @__PURE__ */r.jsx(t.View,{style:p.list,testID:"televet-pets-loading",children:[0,1].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72},e))}):i?/* @__PURE__ */r.jsx(t.View,{testID:"televet-pets-error",children:/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:te.chrome.loadFailedTitle,actionLabel:te.chrome.retryCta,onRetry:a})}):n.length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-pets-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.chrome.noPetsTitle,actionLabel:te.addPetCta,onAction:u})}):/* @__PURE__ */r.jsxs(TelevetStepFrame,{heading:te.petSelectTitle,testID:"televet-booking-pets",footer:d?/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",disabled:!s,onPress:d,testID:"televet-pets-next"}):null,children:[
145
+ /* @__PURE__ */r.jsx(t.View,{style:f.choices,accessibilityRole:"radiogroup",testID:"televet-pets",children:n.map(e=>/* @__PURE__ */r.jsx(TelevetChoiceRow,{title:e.name??"",meta:ya(e),selected:s===e.petRef,onPress:()=>c(e.petRef),testID:`televet-pet-${e.petRef}`,leading:/* @__PURE__ */r.jsx(t.View,{style:f.petDisc,children:/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.petDiscGlyph,children:Ba(e.name??"")})})},e.petRef))}),u?/* @__PURE__ */r.jsx(TelevetButton,{label:te.addAnotherPetCta,kind:"quiet",fullWidth:false,onPress:u,testID:"televet-pet-add"}):null]})}function Ba(e){let t=e.trim();return t.length===0?Va:t.slice(0,1).toUpperCase()}function ClinicianStep({clinicians:n,isPending:l,isError:i,error:o,selectedId:a,stateCode:s,stateName:c,onSelect:d,onRetry:u}){let p=Mo(),h=useEverfurTheme(),f=e.useMemo(()=>Ma(h),[h]);if(l)/* @__PURE__ */
145
146
  return r.jsx(t.View,{style:p.list,testID:"televet-clinicians-loading",children:/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:220})});if(i)/* @__PURE__ */
146
- return r.jsx(t.View,{testID:"televet-clinicians-error",children:/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:ee.chrome.loadFailedTitle,actionLabel:ee.chrome.retryCta,onRetry:u})});if(n.length===0)/* @__PURE__ */
147
- return r.jsx(t.View,{testID:"televet-clinicians-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.noCliniciansTitle,message:ee.noCliniciansBody,actionLabel:ee.noCliniciansRetryCta,onAction:u})});let m=n.find(e=>e.clinicianId===a)??n[0];if(m===void 0)return null;let g=s?.trim().toUpperCase()??"",y=g.length>0&&m.licensedStates.some(e=>e.state.trim().toUpperCase()===g),b=m.role==="vet_tech";/* @__PURE__ */
148
- return r.jsx(TelevetStepFrame,{heading:ee.yourVetTitle,testID:"televet-clinicians",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",onPress:()=>d(m.clinicianId),testID:`televet-clinician-${m.clinicianId}`}),children:/* @__PURE__ */r.jsxs(t.View,{style:f.meet,children:[
149
- /* @__PURE__ */r.jsx(t.View,{style:f.vetAvatar,children:/* @__PURE__ */r.jsx(Text,{tier:"heading",style:f.vetAvatarText,children:Yo(m.displayName)||_a})}),
150
- /* @__PURE__ */r.jsx(Text,{style:f.vetName,children:m.credentials?`${m.displayName}, ${m.credentials}`:m.displayName}),b?/* @__PURE__ */r.jsx(t.View,{style:f.pill,testID:"televet-vet-role",children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:f.pillText,children:ee.vetTechRoleLabel})}):null,y&&c?/* @__PURE__ */r.jsx(t.View,{style:f.pill,testID:"televet-vet-licensed",children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:f.pillText,children:Z(ee.licensedPillTemplate,{state:c})})}):null,b?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.vetRating,testID:"televet-vet-no-rx",children:ee.vetTechNoRxLine}):null,m.rating!==null&&m.ratingCount!==null?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.vetRating,testID:"televet-vet-rating",children:`★ ${String(m.rating)} · ${String(m.ratingCount)} ${ee.reviewsLabel}`}):null,m.bio?/* @__PURE__ */r.jsx(Text,{style:f.vetBio,testID:"televet-vet-bio",children:m.bio}):null]})})}function SlotStep({slots:e,enabled:n,isPending:l,isError:i,error:o,busySlotId:a,failure:s,selectedSlot:c,nextOpening:d,onPick:u,onRetry:p,onSeeOtherVets:h}){let f=Bo();return n?l?/* @__PURE__ */r.jsx(t.View,{style:f.list,testID:"televet-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):i?/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:ee.slotsErrorTitle,actionLabel:ee.retryCta,onRetry:p,testID:"televet-slots-error"}):e.length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-slots-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.noSlotsTitle,message:d?Z(ee.nextOpeningTemplate,{when:formatWhenWithDay(d.startsAt)}):void 0,actionLabel:d?ee.seeOtherVetsCta:void 0,onAction:d?h:void 0})}):
147
+ return r.jsx(t.View,{testID:"televet-clinicians-error",children:/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:te.chrome.loadFailedTitle,actionLabel:te.chrome.retryCta,onRetry:u})});if(n.length===0)/* @__PURE__ */
148
+ return r.jsx(t.View,{testID:"televet-clinicians-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.noCliniciansTitle,message:te.noCliniciansBody,actionLabel:te.noCliniciansRetryCta,onAction:u})});let m=n.find(e=>e.clinicianId===a)??n[0];if(m===void 0)return null;let g=s?.trim().toUpperCase()??"",b=g.length>0&&m.licensedStates.some(e=>e.state.trim().toUpperCase()===g),y=m.role==="vet_tech";/* @__PURE__ */
149
+ return r.jsx(TelevetStepFrame,{heading:te.yourVetTitle,testID:"televet-clinicians",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",onPress:()=>d(m.clinicianId),testID:`televet-clinician-${m.clinicianId}`}),children:/* @__PURE__ */r.jsxs(t.View,{style:f.meet,children:[
150
+ /* @__PURE__ */r.jsx(t.View,{style:f.vetAvatar,children:/* @__PURE__ */r.jsx(Text,{tier:"heading",style:f.vetAvatarText,children:Go(m.displayName)||Va})}),
151
+ /* @__PURE__ */r.jsx(Text,{style:f.vetName,children:m.credentials?`${m.displayName}, ${m.credentials}`:m.displayName}),y?/* @__PURE__ */r.jsx(t.View,{style:f.pill,testID:"televet-vet-role",children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:f.pillText,children:te.vetTechRoleLabel})}):null,b&&c?/* @__PURE__ */r.jsx(t.View,{style:f.pill,testID:"televet-vet-licensed",children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:f.pillText,children:ee(te.licensedPillTemplate,{state:c})})}):null,y?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.vetRating,testID:"televet-vet-no-rx",children:te.vetTechNoRxLine}):null,m.rating!==null&&m.ratingCount!==null?/* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.vetRating,testID:"televet-vet-rating",children:`★ ${String(m.rating)} · ${String(m.ratingCount)} ${te.reviewsLabel}`}):null,m.bio?/* @__PURE__ */r.jsx(Text,{style:f.vetBio,testID:"televet-vet-bio",children:m.bio}):null]})})}function SlotStep({slots:e,enabled:n,isPending:l,isError:i,error:o,busySlotId:a,failure:s,selectedSlot:c,nextOpening:d,onPick:u,onRetry:p,onSeeOtherVets:h}){let f=Mo();return n?l?/* @__PURE__ */r.jsx(t.View,{style:f.list,testID:"televet-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):i?/* @__PURE__ */r.jsx(TelevetLoadFailed,{error:o,title:te.slotsErrorTitle,actionLabel:te.retryCta,onRetry:p,testID:"televet-slots-error"}):e.length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-slots-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.noSlotsTitle,message:d?ee(te.nextOpeningTemplate,{when:formatWhenWithDay(d.startsAt)}):void 0,actionLabel:d?te.seeOtherVetsCta:void 0,onAction:d?h:void 0})}):
151
152
  /* @__PURE__ */r.jsxs(t.View,{style:f.stepFillBox,testID:"televet-slots",children:[
152
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:f.stepTitle,accessibilityRole:"header",children:ee.timeHeading}),s==="expired"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.holdExpired}):null,s==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,s==="failed"||s==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed,testID:"televet-slots-hold-failed"}):null,
153
- /* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:e,busySlotId:a,onPick:u,selectedSlot:c,periodLabels:{morning:ee.timeMorning,afternoon:ee.timeAfternoon,evening:ee.timeEvening}})]}):/* @__PURE__ */r.jsx(t.View,{testID:"televet-slots-unavailable",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle})})}function ReasonStep({value:n,composed:l,vetName:i,onChange:o,onNext:a,media:s,onChangeMedia:c,onPickMedia:d,mediaLive:u=false,checking:p=false}){let h=useEverfurTheme(),f=e.useMemo(()=>Da(h),[h]),m=(l??n).trim(),y=m.length>0&&m.length<=g,b=i?Z(ee.describeHeadingTemplate,{vet:i}):ee.describeHeading;/* @__PURE__ */
154
- return r.jsxs(TelevetStepFrame,{heading:b,lead:ee.describeHelpLong,testID:"televet-booking-reason",scrollTestID:"televet-booking-reason-scroll",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",disabled:!y,loading:p,onPress:a,testID:"televet-reason-next"}),children:[
153
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:f.stepTitle,accessibilityRole:"header",children:te.timeHeading}),s==="expired"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.holdExpired}):null,s==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.slotTaken}):null,s==="failed"||s==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed,testID:"televet-slots-hold-failed"}):null,
154
+ /* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:e,busySlotId:a,onPick:u,selectedSlot:c,periodLabels:{morning:te.timeMorning,afternoon:te.timeAfternoon,evening:te.timeEvening}})]}):/* @__PURE__ */r.jsx(t.View,{testID:"televet-slots-unavailable",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.bookingPausedTitle})})}function ReasonStep({value:n,composed:l,vetName:i,onChange:o,onNext:a,media:s,onChangeMedia:c,onPickMedia:d,mediaLive:u=false,checking:p=false}){let h=useEverfurTheme(),f=e.useMemo(()=>Ma(h),[h]),m=(l??n).trim(),g=m.length>0&&m.length<=b,y=i?ee(te.describeHeadingTemplate,{vet:i}):te.describeHeading;/* @__PURE__ */
155
+ return r.jsxs(TelevetStepFrame,{heading:y,lead:te.describeHelpLong,testID:"televet-booking-reason",scrollTestID:"televet-booking-reason-scroll",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",disabled:!g,loading:p,onPress:a,testID:"televet-reason-next"}),children:[
155
156
  /* @__PURE__ */r.jsxs(t.View,{style:f.field,children:[
156
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.fieldLabel,children:ee.describeFieldLabel}),
157
- /* @__PURE__ */r.jsx(Cr,{value:n,onChangeText:o,multiline:true,accessibilityLabel:ee.describeFieldLabel,placeholder:ee.reasonPlaceholder,placeholderTextColor:h.color.text.placeholder,style:f.reasonInput,testID:"televet-reason-input"})]}),(l??n).trim().length>g?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.reasonTooLong}):null,
158
- /* @__PURE__ */r.jsx(TelevetIntakeMedia,{media:s,onChange:c,meta:u?ee.addPhotoMeta:null,...d?{onPickMedia:d}:{}})]})}function Da(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.card,d=Vo(c);return t.StyleSheet.create({marker:{minHeight:1},spacer:{height:r.md},body:{gap:r.xl,paddingBottom:r.xl},avoider:{flex:1,minHeight:0},head:{gap:r.sm},pressed:{transform:[{scale:.98}]},choices:{gap:r.md},choice:{flexDirection:"row",alignItems:"center",gap:r.lg,minHeight:64,paddingVertical:r.lg,paddingHorizontal:18,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Ao(c,1.5)},choiceSelected:{borderColor:s.ink,backgroundColor:s.pinkSoft},radio:{width:22,height:22,borderRadius:11,borderWidth:1.5,borderColor:s.ink,alignItems:"center",justifyContent:"center"},radioDot:{width:10,height:10,borderRadius:5,backgroundColor:"transparent"},radioDotOn:{backgroundColor:s.ink},choiceText:{flex:1,gap:2},choiceTitle:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug},choiceMeta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},petDisc:{width:48,height:48,borderRadius:24,backgroundColor:s.mist,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...face(e,"medium"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle},meet:{alignItems:"center",gap:6,paddingVertical:r.xxl,paddingHorizontal:r.xl,borderRadius:l.lg,borderWidth:1,borderColor:s.line,...Ao(c,1)},vetAvatar:{width:104,height:104,borderRadius:52,borderWidth:4,borderColor:s.go,backgroundColor:s.mist,alignItems:"center",justifyContent:"center",marginBottom:r.sm},vetAvatarText:{...face(e,"medium"),color:s.ink,fontSize:36,lineHeight:40},vetName:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,textAlign:"center",...d},pill:{height:24,paddingHorizontal:10,borderRadius:l.pill,borderWidth:1.5,borderColor:s.line,justifyContent:"center",marginVertical:r.xs},pillText:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},vetRating:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...d},vetBio:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed,textAlign:"center",...d},field:{gap:r.sm},fieldLabel:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},reasonInput:{minHeight:140,textAlignVertical:"top",borderWidth:1.5,borderColor:s.line,borderRadius:l.lg,paddingVertical:r.lg,paddingHorizontal:18,backgroundColor:s.surface,...face(e,"regular"),color:n.text.primary,fontSize:o.body,lineHeight:o.body*a.relaxed,...Ao(e.slots.input,1.5),...Vo(e.slots.input)},emergencyBanner:{gap:r.md,padding:18,borderRadius:l.lg,borderWidth:1.5,borderColor:s.alert,backgroundColor:s.alertWash},emergencyTitle:{...face(e,"bold"),color:n.errorRed,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},emergencyLede:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.relaxed}})}function TelevetLoadFailed({error:e,title:t,actionLabel:n,onRetry:l,testID:i}){let o=Pn(e),a=i===void 0?{}:{testID:i};return o.rateLimited?/* @__PURE__ */r.jsx(TelevetStateCard,{title:In.title,message:In.body,...o.waiting?{}:{actionLabel:n,onAction:l},testID:i===void 0?"televet-rate-limited":`${i}-rate-limited`}):/* @__PURE__ */r.jsx(TelevetStateCard,{title:t,actionLabel:n,onAction:l,...a})}function Pa(){let n=useEverfurTheme(),{fontScale:r}=t.useWindowDimensions(),l=n.type.scaleCaps.heading,i=l>0?Math.min(r||1,l):r||1;return e.useMemo(()=>oa(n,i),[n,i])}function StepLabel({step:e,styles:t}){/* @__PURE__ */
159
- return r.jsx(Text,{tier:"compact",style:t.stepLabel,testID:"televet-quick-step",children:Z(ee.loading.progressTemplate,{step:String(e),total:"2"})})}function QuickButton({label:e,onPress:n,disabled:l=false,busy:i=false,ghost:o=false,styles:a,testID:s}){let c=l||i;/* @__PURE__ */
160
- return r.jsx(t.Pressable,{onPress:n,disabled:c,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:c,busy:i},style:[a.button,o?a.buttonGhost:null,c?a.buttonDisabled:null],testID:s,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:[a.buttonLabel,o?a.buttonGhostLabel:null],children:e})})}function TelevetQuickReasonStep({petName:e,reasons:n,pickedId:l,onPick:i,note:o,onChangeNote:a,notePlaceholder:s,checking:c,onNext:d}){let u=Pa(),p=useEverfurTheme();/* @__PURE__ */
157
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:f.fieldLabel,children:te.describeFieldLabel}),
158
+ /* @__PURE__ */r.jsx(_r,{value:n,onChangeText:o,multiline:true,accessibilityLabel:te.describeFieldLabel,placeholder:te.reasonPlaceholder,placeholderTextColor:h.color.text.placeholder,style:f.reasonInput,testID:"televet-reason-input"})]}),(l??n).trim().length>b?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.reasonTooLong}):null,
159
+ /* @__PURE__ */r.jsx(TelevetIntakeMedia,{media:s,onChange:c,meta:u?te.addPhotoMeta:null,...d?{onPickMedia:d}:{}})]})}function Ma(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Ao(e),c=e.slots.card,d=No(c);return t.StyleSheet.create({marker:{minHeight:1},spacer:{height:r.md},body:{gap:r.xl,paddingBottom:r.xl},avoider:{flex:1,minHeight:0},head:{gap:r.sm},pressed:{transform:[{scale:.98}]},choices:{gap:r.md},choice:{flexDirection:"row",alignItems:"center",gap:r.lg,minHeight:64,paddingVertical:r.lg,paddingHorizontal:18,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Oo(c,1.5)},choiceSelected:{borderColor:s.ink,backgroundColor:s.pinkSoft},radio:{width:22,height:22,borderRadius:11,borderWidth:1.5,borderColor:s.ink,alignItems:"center",justifyContent:"center"},radioDot:{width:10,height:10,borderRadius:5,backgroundColor:"transparent"},radioDotOn:{backgroundColor:s.ink},choiceText:{flex:1,gap:2},choiceTitle:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug},choiceMeta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},petDisc:{width:48,height:48,borderRadius:24,backgroundColor:s.mist,alignItems:"center",justifyContent:"center"},petDiscGlyph:{...face(e,"medium"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle},meet:{alignItems:"center",gap:6,paddingVertical:r.xxl,paddingHorizontal:r.xl,borderRadius:l.lg,borderWidth:1,borderColor:s.line,...Oo(c,1)},vetAvatar:{width:104,height:104,borderRadius:52,borderWidth:4,borderColor:s.go,backgroundColor:s.mist,alignItems:"center",justifyContent:"center",marginBottom:r.sm},vetAvatarText:{...face(e,"medium"),color:s.ink,fontSize:36,lineHeight:40},vetName:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,textAlign:"center",...d},pill:{height:24,paddingHorizontal:10,borderRadius:l.pill,borderWidth:1.5,borderColor:s.line,justifyContent:"center",marginVertical:r.xs},pillText:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},vetRating:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...d},vetBio:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.relaxed,textAlign:"center",...d},field:{gap:r.sm},fieldLabel:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},reasonInput:{minHeight:140,textAlignVertical:"top",borderWidth:1.5,borderColor:s.line,borderRadius:l.lg,paddingVertical:r.lg,paddingHorizontal:18,backgroundColor:s.surface,...face(e,"regular"),color:n.text.primary,fontSize:o.body,lineHeight:o.body*a.relaxed,...Oo(e.slots.input,1.5),...No(e.slots.input)},emergencyBanner:{gap:r.md,padding:18,borderRadius:l.lg,borderWidth:1.5,borderColor:s.alert,backgroundColor:s.alertWash},emergencyTitle:{...face(e,"bold"),color:n.errorRed,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},emergencyLede:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.relaxed}})}function TelevetLoadFailed({error:e,title:t,actionLabel:n,onRetry:l,testID:i}){let o=Rn(e),a=i===void 0?{}:{testID:i};return o.rateLimited?/* @__PURE__ */r.jsx(TelevetStateCard,{title:En.title,message:En.body,...o.waiting?{}:{actionLabel:n,onAction:l},testID:i===void 0?"televet-rate-limited":`${i}-rate-limited`}):/* @__PURE__ */r.jsx(TelevetStateCard,{title:t,actionLabel:n,onAction:l,...a})}function Ha(){let n=useEverfurTheme(),{fontScale:r}=t.useWindowDimensions(),l=n.type.scaleCaps.heading,i=l>0?Math.min(r||1,l):r||1;return e.useMemo(()=>ba(n,i),[n,i])}function StepLabel({step:e,styles:t}){/* @__PURE__ */
160
+ return r.jsx(Text,{tier:"compact",style:t.stepLabel,testID:"televet-quick-step",children:ee(te.loading.progressTemplate,{step:String(e),total:"2"})})}function QuickButton({label:e,onPress:n,disabled:l=false,busy:i=false,ghost:o=false,styles:a,testID:s}){let c=l||i;/* @__PURE__ */
161
+ return r.jsx(t.Pressable,{onPress:n,disabled:c,accessibilityRole:"button",accessibilityLabel:e,accessibilityState:{disabled:c,busy:i},style:[a.button,o?a.buttonGhost:null,c?a.buttonDisabled:null],testID:s,children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:[a.buttonLabel,o?a.buttonGhostLabel:null],children:e})})}function TelevetQuickReasonStep({petName:e,reasons:n,pickedId:l,onPick:i,note:o,onChangeNote:a,notePlaceholder:s,checking:c,onNext:d}){let u=Ha(),p=useEverfurTheme();/* @__PURE__ */
161
162
  return r.jsxs(t.View,{style:u.bleed,testID:"televet-quick-reason",children:[
162
163
  /* @__PURE__ */r.jsxs(t.ScrollView,{style:u.scroll,contentContainerStyle:u.body,keyboardShouldPersistTaps:"handled",children:[
163
164
  /* @__PURE__ */r.jsx(StepLabel,{step:1,styles:u}),
164
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:u.title,accessibilityRole:"header",children:Z(ee.issuesTitleTemplate,{pet:e??ee.petFallback})}),
165
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:u.title,accessibilityRole:"header",children:ee(te.issuesTitleTemplate,{pet:e??te.petFallback})}),
165
166
  /* @__PURE__ */r.jsx(t.View,{style:u.options,accessibilityRole:"radiogroup",children:n.map(e=>{let n=e.id===l;/* @__PURE__ */
166
167
  return r.jsxs(t.Pressable,{onPress:()=>i(e.id),accessibilityRole:"radio",accessibilityState:{checked:n},accessibilityLabel:e.label,style:[u.option,n?u.optionPicked:null],testID:`televet-quick-reason-${e.id}`,children:[
167
168
  /* @__PURE__ */r.jsx(t.View,{style:[u.radio,n?u.radioPicked:null]}),
168
169
  /* @__PURE__ */r.jsx(Text,{style:[u.optionLabel,n?u.optionLabelPicked:null],children:e.label})]},e.id)})}),
169
170
  /* @__PURE__ */r.jsxs(t.View,{style:u.note,children:[
170
- /* @__PURE__ */r.jsx(Text,{style:u.noteLabel,nativeID:"televet-quick-note-label",children:na.noteLabel}),
171
- /* @__PURE__ */r.jsx(Cr,{value:o,onChangeText:a,placeholder:s,placeholderTextColor:p.color.text.muted,accessibilityLabel:na.noteLabel,multiline:true,style:u.noteInput,testID:"televet-quick-note"})]})]}),
172
- /* @__PURE__ */r.jsx(t.View,{style:u.foot,children:/* @__PURE__ */r.jsx(QuickButton,{label:ee.timeHeading,onPress:d,disabled:!l,busy:c,styles:u,testID:"televet-quick-next"})})]})}function Ra(e,t){let n=di(e);if(n===di(new Date(t).toISOString()))return na.today;let r=new Date(t);return r.setDate(r.getDate()+1),n===di(r.toISOString())?na.tomorrow:new Date(e).toLocaleDateString(void 0,{weekday:"short"})}function za(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Fa(e){try{let t=new Intl.DateTimeFormat(void 0,{timeZoneName:"shortGeneric"}).formatToParts(new Date(e)).find(e=>e.type==="timeZoneName");if(t?.value)return t.value}catch{}return ai(e)}function La(e,t){if(!e)return na.bookCta;let n=Ra(e.startsAt,t),r=n===na.today||n===na.tomorrow?n.toLowerCase():n;return Z(na.bookAtTemplate,{day:r,time:ri(e.startsAt)})}function TelevetQuickTimeStep(n){let{slots:l,subtitle:i,finePrint:o,selectedSlot:a,busySlotId:s,failure:c,onPick:d,renderUnready:u,petName:p,stateCode:h,stateName:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:y,termsAttested:b,onToggleTermsAttest:v,canConfirm:x,busy:T,onConfirm:k,emergency:w,onAcknowledgeEmergency:S,onSeeOtherVets:j,primaryVet:C,onFindEmergencyVet:_}=n,I=Pa(),E=useEverfurTheme(),D=e.useMemo(()=>Da(E),[E]),P=n.nowMs??Date.now(),R=e.useMemo(()=>{let e=/* @__PURE__ */new Map;for(let t of l){if(Number.isNaN(new Date(t.startsAt).getTime()))continue;let n=di(t.startsAt);e.has(n)||e.set(n,t.startsAt)}return[...e.entries()].map(([e,t])=>({key:e,iso:t}))},[l]),[z,F]=e.useState(null),L=a?di(a.startsAt):null,A=[z,L,R[0]?.key].find(e=>e!=null&&R.some(t=>t.key===e))??null,O=l.filter(e=>di(e.startsAt)===A),V=[];for(let e=0;e<O.length;e+=2)V.push(O.slice(e,e+2));let N=f??h??"",B=p?Z(ee.whereAttestTemplate,{pet:p,state:N}):Z(ee.stateAttestTemplate,{state:N}),M=ee.emergency.lede,H=u===null,$=!H||!x||T||!!h&&!m||!!y&&!b;/* @__PURE__ */
171
+ /* @__PURE__ */r.jsx(Text,{style:u.noteLabel,nativeID:"televet-quick-note-label",children:ha.noteLabel}),
172
+ /* @__PURE__ */r.jsx(_r,{value:o,onChangeText:a,placeholder:s,placeholderTextColor:p.color.text.muted,accessibilityLabel:ha.noteLabel,multiline:true,style:u.noteInput,testID:"televet-quick-note"})]})]}),
173
+ /* @__PURE__ */r.jsx(t.View,{style:u.foot,children:/* @__PURE__ */r.jsx(QuickButton,{label:te.timeHeading,onPress:d,disabled:!l,busy:c,styles:u,testID:"televet-quick-next"})})]})}function $a(e,t){let n=ui(e);if(n===ui(new Date(t).toISOString()))return ha.today;let r=new Date(t);return r.setDate(r.getDate()+1),n===ui(r.toISOString())?ha.tomorrow:new Date(e).toLocaleDateString(void 0,{weekday:"short"})}function Wa(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ua(e){try{let t=new Intl.DateTimeFormat(void 0,{timeZoneName:"shortGeneric"}).formatToParts(new Date(e)).find(e=>e.type==="timeZoneName");if(t?.value)return t.value}catch{}return si(e)}function qa(e,t){if(!e)return ha.bookCta;let n=$a(e.startsAt,t),r=n===ha.today||n===ha.tomorrow?n.toLowerCase():n;return ee(ha.bookAtTemplate,{day:r,time:li(e.startsAt)})}function TelevetQuickTimeStep(n){let{slots:l,subtitle:i,finePrint:o,selectedSlot:a,busySlotId:s,failure:c,onPick:d,renderUnready:u,petName:p,stateCode:h,stateName:f,stateAttested:m,onToggleStateAttest:g,cancellationTerms:b,termsAttested:y,onToggleTermsAttest:v,canConfirm:x,busy:T,onConfirm:k,emergency:w,onAcknowledgeEmergency:S,onSeeOtherVets:j,primaryVet:C,onFindEmergencyVet:_}=n,I=Ha(),E=useEverfurTheme(),D=e.useMemo(()=>Ma(E),[E]),P=n.nowMs??Date.now(),R=e.useMemo(()=>{let e=/* @__PURE__ */new Map;for(let t of l){if(Number.isNaN(new Date(t.startsAt).getTime()))continue;let n=ui(t.startsAt);e.has(n)||e.set(n,t.startsAt)}return[...e.entries()].map(([e,t])=>({key:e,iso:t}))},[l]),[z,F]=e.useState(null),L=a?ui(a.startsAt):null,A=[z,L,R[0]?.key].find(e=>e!=null&&R.some(t=>t.key===e))??null,O=l.filter(e=>ui(e.startsAt)===A),V=[];for(let e=0;e<O.length;e+=2)V.push(O.slice(e,e+2));let N=f??h??"",B=p?ee(te.whereAttestTemplate,{pet:p,state:N}):ee(te.stateAttestTemplate,{state:N}),M=te.emergency.lede,H=u===null,$=!H||!x||T||!!h&&!m||!!b&&!y;/* @__PURE__ */
173
174
  return r.jsxs(t.View,{style:I.bleed,testID:"televet-quick-time",children:[
174
175
  /* @__PURE__ */r.jsxs(t.ScrollView,{style:I.scroll,contentContainerStyle:I.body,children:[
175
176
  /* @__PURE__ */r.jsx(StepLabel,{step:2,styles:I}),
176
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:I.title,accessibilityRole:"header",children:ee.timeHeading}),
177
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:I.title,accessibilityRole:"header",children:te.timeHeading}),
177
178
  /* @__PURE__ */r.jsx(Text,{style:I.subtitle,children:i}),u?/* @__PURE__ */r.jsx(t.View,{style:I.lines,children:u()}):/* @__PURE__ */r.jsxs(r.Fragment,{children:[
178
- /* @__PURE__ */r.jsx(t.View,{style:I.days,accessibilityRole:"radiogroup",children:R.map(e=>{let n=e.key===A,l=Ra(e.iso,P),i=za(e.iso);/* @__PURE__ */
179
+ /* @__PURE__ */r.jsx(t.View,{style:I.days,accessibilityRole:"radiogroup",children:R.map(e=>{let n=e.key===A,l=$a(e.iso,P),i=Wa(e.iso);/* @__PURE__ */
179
180
  return r.jsxs(t.Pressable,{onPress:()=>F(e.key),accessibilityRole:"radio",accessibilityState:{checked:n},accessibilityLabel:`${l}, ${i}`,style:[I.day,n?I.dayPicked:null],testID:`televet-quick-day-${e.key}`,children:[
180
181
  /* @__PURE__ */r.jsx(Text,{tier:"heading",style:[I.dayName,n?I.dayTextPicked:null],children:l}),
181
182
  /* @__PURE__ */r.jsx(Text,{tier:"heading",style:[I.dayDate,n?I.dayDatePicked:null],children:i})]},e.key)})}),
182
183
  /* @__PURE__ */r.jsx(t.View,{style:I.slots,accessibilityRole:"radiogroup",testID:"televet-slots",children:V.map(e=>/* @__PURE__ */r.jsxs(t.View,{style:I.slotRow,children:[e.map(e=>{let n=a?.slotId===e.slotId,l=s===e.slotId;/* @__PURE__ */
183
- return r.jsx(t.Pressable,{onPress:()=>d(e),disabled:s!==null||T,accessibilityRole:"radio",accessibilityState:{checked:n,busy:l},style:[I.slot,n?I.slotPicked:null],testID:`televet-slot-${e.slotId}`,children:/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[I.slotLabel,n?I.slotLabelPicked:null],children:ri(e.startsAt)})},e.slotId)}),e.length===1?/* @__PURE__ */r.jsx(t.View,{style:I.slotSpacer}):null]},e[0]?.slotId))})]}),
184
- /* @__PURE__ */r.jsxs(t.View,{style:I.lines,children:[c==="expired"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.holdExpired}):null,c==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,c==="failed"||c==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed,testID:"televet-quick-failed"}):null,c==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle}):null,c==="clinician_unavailable"?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
185
- /* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.confirmFailed}),
186
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.seeOtherVetsCta,kind:"secondary",onPress:j,testID:"televet-quick-see-other-vets"})]}):null]}),H&&a?/* @__PURE__ */r.jsxs(t.View,{style:I.ticks,children:[h?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:B,checked:m,onToggle:g,testID:"televet-quick-state-attest"}):null,y?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:y,checked:b,onToggle:v,testID:"televet-quick-terms-attest"}):null]}):null,w?/* @__PURE__ */r.jsxs(t.View,{style:[D.emergencyBanner,I.ticks],testID:"televet-quick-emergency",children:[
187
- /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:D.emergencyTitle,children:ee.emergency.bannerTitle}),
184
+ return r.jsx(t.Pressable,{onPress:()=>d(e),disabled:s!==null||T,accessibilityRole:"radio",accessibilityState:{checked:n,busy:l},style:[I.slot,n?I.slotPicked:null],testID:`televet-slot-${e.slotId}`,children:/* @__PURE__ */r.jsx(Text,{tier:"compact",style:[I.slotLabel,n?I.slotLabelPicked:null],children:li(e.startsAt)})},e.slotId)}),e.length===1?/* @__PURE__ */r.jsx(t.View,{style:I.slotSpacer}):null]},e[0]?.slotId))})]}),
185
+ /* @__PURE__ */r.jsxs(t.View,{style:I.lines,children:[c==="expired"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.holdExpired}):null,c==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.slotTaken}):null,c==="failed"||c==="rate_limited"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed,testID:"televet-quick-failed"}):null,c==="not_entitled"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.bookingPausedTitle}):null,c==="clinician_unavailable"?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
186
+ /* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.confirmFailed}),
187
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.seeOtherVetsCta,kind:"secondary",onPress:j,testID:"televet-quick-see-other-vets"})]}):null]}),H&&a?/* @__PURE__ */r.jsxs(t.View,{style:I.ticks,children:[h?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:B,checked:m,onToggle:g,testID:"televet-quick-state-attest"}):null,b?/* @__PURE__ */r.jsx(TelevetConsentCheckbox,{label:b,checked:y,onToggle:v,testID:"televet-quick-terms-attest"}):null]}):null,w?/* @__PURE__ */r.jsxs(t.View,{style:[D.emergencyBanner,I.ticks],testID:"televet-quick-emergency",children:[
188
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",accessibilityRole:"header",accessibilityLiveRegion:"assertive",style:D.emergencyTitle,children:te.emergency.bannerTitle}),
188
189
  /* @__PURE__ */r.jsx(Text,{style:D.emergencyLede,children:M}),w.length>0?/* @__PURE__ */r.jsx(Text,{style:D.emergencyLede,children:w.join(", ")}):null,
189
190
  /* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:p,primaryVet:C,onFindEmergencyVet:_}),
190
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:S,testID:"televet-quick-emergency-ack"})]}):null]}),w?null:/* @__PURE__ */r.jsxs(t.View,{style:I.foot,children:[
191
- /* @__PURE__ */r.jsx(QuickButton,{label:T?ee.confirmBusy:La(a,P),onPress:k,disabled:$,busy:T,styles:I,testID:"televet-quick-book"}),o?/* @__PURE__ */r.jsx(Text,{style:I.fine,testID:"televet-quick-fine",children:o}):null]})]})}function Aa(e,t){let n=Z(na.whenTemplate,{day:Ra(e,t),date:za(e),time:ri(e)}),r=Fa(e);return r?`${n} ${r}`:n}function TelevetQuickBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,renderNote:a,nowMs:s}){let c=Pa(),[d,u]=e.useState("idle"),p=async()=>{if(!o)return;let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){u("failed");return}u("saving");let t=await q(o,{key:televetConsultCalendarKey(n.consultId),title:ee.visit.title,startDate:e,endDate:new Date(e.getTime()+oi*6e4),alarmOffsetMinutes:-30});u(t.ok&&t.value===true?"saved":"failed")};/* @__PURE__ */
191
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.emergency.keepBookingCta,kind:"secondary",loading:T,disabled:T,onPress:S,testID:"televet-quick-emergency-ack"})]}):null]}),w?null:/* @__PURE__ */r.jsxs(t.View,{style:I.foot,children:[
192
+ /* @__PURE__ */r.jsx(QuickButton,{label:T?te.confirmBusy:qa(a,P),onPress:k,disabled:$,busy:T,styles:I,testID:"televet-quick-book"}),o?/* @__PURE__ */r.jsx(Text,{style:I.fine,testID:"televet-quick-fine",children:o}):null]})]})}function Ka(e,t){let n=ee(ha.whenTemplate,{day:$a(e,t),date:Wa(e),time:li(e)}),r=Ua(e);return r?`${n} ${r}`:n}function TelevetQuickBookedScreen({consult:n,petName:l,onDone:i,onAddToCalendar:o,renderNote:a,nowMs:s}){let c=Ha(),[d,u]=e.useState("idle"),p=async()=>{if(!o)return;let e=new Date(n.scheduledAt);if(Number.isNaN(e.getTime())){u("failed");return}u("saving");let t=await K(o,{key:televetConsultCalendarKey(n.consultId),title:te.visit.title,startDate:e,endDate:new Date(e.getTime()+ai*6e4),alarmOffsetMinutes:-30});u(t.ok&&t.value===true?"saved":"failed")};/* @__PURE__ */
192
193
  return r.jsxs(t.View,{style:c.bleed,testID:"televet-quick-booked",children:[
193
194
  /* @__PURE__ */r.jsxs(t.ScrollView,{style:c.scroll,contentContainerStyle:c.done,children:[
194
195
  /* @__PURE__ */r.jsx(t.View,{style:c.check,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:/* @__PURE__ */r.jsx(t.View,{style:c.checkMark})}),
195
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:c.doneTitle,accessibilityRole:"header",children:ra(l)}),
196
- /* @__PURE__ */r.jsx(Text,{style:c.when,testID:"televet-quick-booked-when",children:Aa(n.scheduledAt,s??Date.now())}),
197
- /* @__PURE__ */r.jsx(Text,{style:c.who,children:na.who}),a?/* @__PURE__ */r.jsx(t.View,{style:c.note2,children:a()}):null]}),
198
- /* @__PURE__ */r.jsxs(t.View,{style:c.foot,children:[d==="failed"?/* @__PURE__ */r.jsx(Text,{style:c.calendarNote,accessibilityLiveRegion:"polite",testID:"televet-quick-calendar-failed",children:ee.booked.calendarFailedBody}):null,o?/* @__PURE__ */r.jsx(QuickButton,{label:d==="saved"?ee.booked.calendarAdded:ee.addToCalendarCta,onPress:()=>{p()},disabled:d==="saved",busy:d==="saving",ghost:true,styles:c,testID:"televet-quick-calendar"}):null,
199
- /* @__PURE__ */r.jsx(QuickButton,{label:ee.doneCta,onPress:i,styles:c,testID:"televet-quick-done"})]})]})}function TelevetVisitSimulator({petId:e,roster:t,onAddPet:n,onPickPet:l}){return e===null?/* @__PURE__ */r.jsx(PetStep,{pets:t.pets,isPending:t.loading,isError:t.error!==null,onRetry:()=>{t.refresh()},onAddPet:n,selectedId:null,onSelect:l}):/* @__PURE__ */r.jsx(SimulatorScreen,{petRef:e})}function SimulatorScreen({petRef:petRef}){let e=Bo(),n=so(petRef);/* @__PURE__ */
196
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:c.doneTitle,accessibilityRole:"header",children:fa(l)}),
197
+ /* @__PURE__ */r.jsx(Text,{style:c.when,testID:"televet-quick-booked-when",children:Ka(n.scheduledAt,s??Date.now())}),
198
+ /* @__PURE__ */r.jsx(Text,{style:c.who,children:ha.who}),a?/* @__PURE__ */r.jsx(t.View,{style:c.note2,children:a()}):null]}),
199
+ /* @__PURE__ */r.jsxs(t.View,{style:c.foot,children:[d==="failed"?/* @__PURE__ */r.jsx(Text,{style:c.calendarNote,accessibilityLiveRegion:"polite",testID:"televet-quick-calendar-failed",children:te.booked.calendarFailedBody}):null,o?/* @__PURE__ */r.jsx(QuickButton,{label:d==="saved"?te.booked.calendarAdded:te.addToCalendarCta,onPress:()=>{p()},disabled:d==="saved",busy:d==="saving",ghost:true,styles:c,testID:"televet-quick-calendar"}):null,
200
+ /* @__PURE__ */r.jsx(QuickButton,{label:te.doneCta,onPress:i,styles:c,testID:"televet-quick-done"})]})]})}function TelevetVisitSimulator({petId:e,roster:t,onAddPet:n,onPickPet:l}){return e===null?/* @__PURE__ */r.jsx(PetStep,{pets:t.pets,isPending:t.loading,isError:t.error!==null,onRetry:()=>{t.refresh()},onAddPet:n,selectedId:null,onSelect:l}):/* @__PURE__ */r.jsx(SimulatorScreen,{petRef:e})}function SimulatorScreen({petRef:petRef}){let e=Mo(),n=co(petRef);/* @__PURE__ */
200
201
  return r.jsx(t.View,{style:e.stepFill,testID:"televet-simulator",children:/* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:e.list,children:[
201
- /* @__PURE__ */r.jsx(TelevetStateCard,{title:Wi.title}),
202
- /* @__PURE__ */r.jsx(TelevetButton,{label:Wi.create,onPress:n.create,kind:"secondary",disabled:n.busy,testID:"televet-simulator-create"}),n.visitLine!==null?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
203
- /* @__PURE__ */r.jsx(Text,{style:e.stateMessage,testID:"televet-simulator-visit",children:n.visitLine}),co.map(e=>/* @__PURE__ */r.jsx(TelevetButton,{label:Wi.advance[e],onPress:()=>n.advance(e),kind:"secondary",disabled:n.busy,testID:`televet-simulator-advance-${e}`},e)),
204
- /* @__PURE__ */r.jsx(Text,{style:e.stateMessage,children:Wi.eventsNote}),uo.map(e=>/* @__PURE__ */r.jsx(TelevetButton,{label:Wi.events[e],onPress:()=>n.raise(e),kind:"secondary",disabled:n.busy,testID:`televet-simulator-event-${e}`},e))]}):null,n.line===null?null:n.line.tone==="danger"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:n.line.text,testID:"televet-simulator-error"}):/* @__PURE__ */r.jsx(Text,{style:e.stateMessage,accessibilityLiveRegion:"polite",testID:"televet-simulator-log",children:n.line.text})]})})}function TelevetPick({label:n,on:l,onPress:i,testID:o,role:a="checkbox"}){let s=useEverfurTheme(),c=e.useMemo(()=>Oa(s),[s]);/* @__PURE__ */
202
+ /* @__PURE__ */r.jsx(TelevetStateCard,{title:Ui.title}),
203
+ /* @__PURE__ */r.jsx(TelevetButton,{label:Ui.create,onPress:n.create,kind:"secondary",disabled:n.busy,testID:"televet-simulator-create"}),n.visitLine!==null?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
204
+ /* @__PURE__ */r.jsx(Text,{style:e.stateMessage,testID:"televet-simulator-visit",children:n.visitLine}),uo.map(e=>/* @__PURE__ */r.jsx(TelevetButton,{label:Ui.advance[e],onPress:()=>n.advance(e),kind:"secondary",disabled:n.busy,testID:`televet-simulator-advance-${e}`},e)),
205
+ /* @__PURE__ */r.jsx(Text,{style:e.stateMessage,children:Ui.eventsNote}),po.map(e=>/* @__PURE__ */r.jsx(TelevetButton,{label:Ui.events[e],onPress:()=>n.raise(e),kind:"secondary",disabled:n.busy,testID:`televet-simulator-event-${e}`},e))]}):null,n.line===null?null:n.line.tone==="danger"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:n.line.text,testID:"televet-simulator-error"}):/* @__PURE__ */r.jsx(Text,{style:e.stateMessage,accessibilityLiveRegion:"polite",testID:"televet-simulator-log",children:n.line.text})]})})}function TelevetPick({label:n,on:l,onPress:i,testID:o,role:a="checkbox"}){let s=useEverfurTheme(),c=e.useMemo(()=>Ya(s),[s]);/* @__PURE__ */
205
206
  return r.jsxs(t.Pressable,{onPress:i,accessibilityRole:a,accessibilityLabel:n,accessibilityState:{checked:l},testID:o,style:({pressed:e})=>[c.pick,l?c.pickOn:null,e&&!s.motion.reducedMotion?c.pressed:null],children:[l?/* @__PURE__ */r.jsx(t.View,{style:c.check,accessibilityElementsHidden:true,importantForAccessibility:"no"}):null,
206
- /* @__PURE__ */r.jsx(Text,{tier:"control",style:[c.pickLabel,l?c.pickLabelOn:null],children:n})]})}function WhereStep({petName:n,where:l,onNext:i}){let o=useEverfurTheme(),a=e.useMemo(()=>Da(o),[o]),s=e.useMemo(()=>Oa(o),[o]),c=n??ee.petFallback,d=l.otherSelected;/* @__PURE__ */
207
- return r.jsxs(TelevetStepFrame,{heading:Z(ee.whereTitleTemplate,{pet:c}),lead:Z(ee.whereLeadTemplate,{pronoun:ee.wherePronounFallback}),testID:"televet-booking-where",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",disabled:!l.canContinue,onPress:i,testID:"televet-where-next"}),children:[l.hostPlace?/* @__PURE__ */r.jsxs(t.View,{style:a.choices,accessibilityRole:"radiogroup",accessibilityLabel:Z(ee.whereFormLabelTemplate,{pet:c}),children:[
207
+ /* @__PURE__ */r.jsx(Text,{tier:"control",style:[c.pickLabel,l?c.pickLabelOn:null],children:n})]})}function WhereStep({petName:n,where:l,onNext:i}){let o=useEverfurTheme(),a=e.useMemo(()=>Ma(o),[o]),s=e.useMemo(()=>Ya(o),[o]),c=n??te.petFallback,d=l.otherSelected;/* @__PURE__ */
208
+ return r.jsxs(TelevetStepFrame,{heading:ee(te.whereTitleTemplate,{pet:c}),lead:ee(te.whereLeadTemplate,{pronoun:te.wherePronounFallback}),testID:"televet-booking-where",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",disabled:!l.canContinue,onPress:i,testID:"televet-where-next"}),children:[l.hostPlace?/* @__PURE__ */r.jsxs(t.View,{style:a.choices,accessibilityRole:"radiogroup",accessibilityLabel:ee(te.whereFormLabelTemplate,{pet:c}),children:[
208
209
  /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:l.hostPlace.name,meta:l.hostPlace.meta,selected:!d,onPress:l.pickHost,testID:"televet-where-host"}),
209
- /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:ee.whereAnotherState,meta:l.otherPlace?.meta??null,selected:d,onPress:l.pickOther,testID:"televet-where-other"})]}):null,d?/* @__PURE__ */r.jsxs(t.View,{style:a.field,children:[
210
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:a.fieldLabel,accessibilityRole:"header",children:ee.whereWhichState}),
211
- /* @__PURE__ */r.jsx(t.View,{style:s.pickRow,accessibilityRole:"radiogroup",accessibilityLabel:ee.whereWhichState,children:Bl.filter(e=>e.code!==l.hostPlace?.code).map(e=>/* @__PURE__ */r.jsx(TelevetPick,{label:e.name,role:"radio",on:l.otherPlace?.code===e.code,onPress:()=>l.pickState(e.code),testID:`televet-where-state-${e.code}`},e.code))}),l.hostPlace===null&&l.otherPlace?.meta?/* @__PURE__ */r.jsx(Text,{style:s.note,children:l.otherPlace.meta}):null]}):null,l.licensedLine?/* @__PURE__ */r.jsx(Text,{style:s.callout,testID:"televet-where-licensed",children:l.licensedLine}):null,
212
- /* @__PURE__ */r.jsx(Text,{style:s.note,children:ee.whereAskEveryTime})]})}function IssuesStep({petName:n,chips:l,selected:i,onToggle:o,onNext:a}){let s=useEverfurTheme(),c=e.useMemo(()=>Oa(s),[s]);/* @__PURE__ */
213
- return r.jsx(TelevetStepFrame,{heading:Z(ee.issuesTitleTemplate,{pet:n??ee.petFallback}),lead:ee.issuesHint,testID:"televet-booking-issues",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",disabled:i.length===0,onPress:a,testID:"televet-issues-next"}),children:/* @__PURE__ */r.jsx(t.View,{style:c.pickRow,accessibilityLabel:ee.issuesFormLabel,children:l.map(e=>/* @__PURE__ */r.jsx(TelevetPick,{label:e.label,on:i.includes(e.id),onPress:()=>o(e.id),testID:`televet-issue-${e.id}`},e.id))})})}function EmergencyStep({petName:n,answer:l,onAnswer:i,onNext:o,onHandled:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=e.useMemo(()=>Da(d),[d]),p=e.useMemo(()=>Oa(d),[d]),h=ee.emergencyCheck,f=ee.emergency.lede,m=e.useRef(null),g=e.useRef(false);e.useEffect(()=>{l!=="some"&&(g.current=false)},[l]);let y=e=>{g.current||(g.current=true,m.current?.scrollTo({y:Math.max(0,e.nativeEvent.layout.y-d.space.md),animated:!d.motion.reducedMotion}))};/* @__PURE__ */
214
- return r.jsxs(TelevetStepFrame,{heading:Z(h.titleTemplate,{pet:n??ee.petFallback}),lead:h.lead,scrollRef:m,testID:"televet-booking-emergency",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:ee.continueCta,kind:"primary",disabled:l!=="none",onPress:o,testID:"televet-emergency-next"}),children:[
210
+ /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:te.whereAnotherState,meta:l.otherPlace?.meta??null,selected:d,onPress:l.pickOther,testID:"televet-where-other"})]}):null,d?/* @__PURE__ */r.jsxs(t.View,{style:a.field,children:[
211
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:a.fieldLabel,accessibilityRole:"header",children:te.whereWhichState}),
212
+ /* @__PURE__ */r.jsx(t.View,{style:s.pickRow,accessibilityRole:"radiogroup",accessibilityLabel:te.whereWhichState,children:Ml.filter(e=>e.code!==l.hostPlace?.code).map(e=>/* @__PURE__ */r.jsx(TelevetPick,{label:e.name,role:"radio",on:l.otherPlace?.code===e.code,onPress:()=>l.pickState(e.code),testID:`televet-where-state-${e.code}`},e.code))}),l.hostPlace===null&&l.otherPlace?.meta?/* @__PURE__ */r.jsx(Text,{style:s.note,children:l.otherPlace.meta}):null]}):null,l.licensedLine?/* @__PURE__ */r.jsx(Text,{style:s.callout,testID:"televet-where-licensed",children:l.licensedLine}):null,
213
+ /* @__PURE__ */r.jsx(Text,{style:s.note,children:te.whereAskEveryTime})]})}function IssuesStep({petName:n,chips:l,selected:i,onToggle:o,onNext:a}){let s=useEverfurTheme(),c=e.useMemo(()=>Ya(s),[s]);/* @__PURE__ */
214
+ return r.jsx(TelevetStepFrame,{heading:ee(te.issuesTitleTemplate,{pet:n??te.petFallback}),lead:te.issuesHint,testID:"televet-booking-issues",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",disabled:i.length===0,onPress:a,testID:"televet-issues-next"}),children:/* @__PURE__ */r.jsx(t.View,{style:c.pickRow,accessibilityLabel:te.issuesFormLabel,children:l.map(e=>/* @__PURE__ */r.jsx(TelevetPick,{label:e.label,on:i.includes(e.id),onPress:()=>o(e.id),testID:`televet-issue-${e.id}`},e.id))})})}function EmergencyStep({petName:n,answer:l,onAnswer:i,onNext:o,onHandled:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=e.useMemo(()=>Ma(d),[d]),p=e.useMemo(()=>Ya(d),[d]),h=te.emergencyCheck,f=te.emergency.lede,m=e.useRef(null),g=e.useRef(false);e.useEffect(()=>{l!=="some"&&(g.current=false)},[l]);let b=e=>{g.current||(g.current=true,m.current?.scrollTo({y:Math.max(0,e.nativeEvent.layout.y-d.space.md),animated:!d.motion.reducedMotion}))};/* @__PURE__ */
215
+ return r.jsxs(TelevetStepFrame,{heading:ee(h.titleTemplate,{pet:n??te.petFallback}),lead:h.lead,scrollRef:m,testID:"televet-booking-emergency",footer:/* @__PURE__ */r.jsx(TelevetButton,{label:te.continueCta,kind:"primary",disabled:l!=="none",onPress:o,testID:"televet-emergency-next"}),children:[
215
216
  /* @__PURE__ */r.jsx(t.View,{style:p.signs,testID:"televet-emergency-signs",children:h.signs.map(e=>/* @__PURE__ */r.jsxs(t.View,{style:p.sign,children:[
216
217
  /* @__PURE__ */r.jsx(t.View,{style:p.bullet}),
217
218
  /* @__PURE__ */r.jsx(Text,{style:p.signText,children:e})]},e))}),
218
219
  /* @__PURE__ */r.jsxs(t.View,{style:u.choices,accessibilityRole:"radiogroup",accessibilityLabel:h.legend,children:[
219
220
  /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:h.noneCta,selected:l==="none",onPress:()=>i("none"),testID:"televet-emergency-none"}),
220
- /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:h.someCta,selected:l==="some",onPress:()=>i("some"),testID:"televet-emergency-some"})]}),l==="some"?/* @__PURE__ */r.jsxs(t.View,{style:u.emergencyBanner,accessibilityLiveRegion:"assertive",onLayout:y,testID:"televet-emergency-panel",children:[
221
- /* @__PURE__ */r.jsx(Text,{style:u.emergencyTitle,accessibilityRole:"header",children:ee.emergency.bannerTitle}),
221
+ /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:h.someCta,selected:l==="some",onPress:()=>i("some"),testID:"televet-emergency-some"})]}),l==="some"?/* @__PURE__ */r.jsxs(t.View,{style:u.emergencyBanner,accessibilityLiveRegion:"assertive",onLayout:b,testID:"televet-emergency-panel",children:[
222
+ /* @__PURE__ */r.jsx(Text,{style:u.emergencyTitle,accessibilityRole:"header",children:te.emergency.bannerTitle}),
222
223
  /* @__PURE__ */r.jsx(Text,{style:u.emergencyLede,children:f}),
223
224
  /* @__PURE__ */r.jsx(TelevetEmergencyExits,{petName:n,primaryVet:s,onFindEmergencyVet:c}),
224
- /* @__PURE__ */r.jsx(TelevetButton,{label:ee.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function Oa(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Lo(e),s=e.slots.chip;return t.StyleSheet.create({pickRow:{flexDirection:"row",flexWrap:"wrap",gap:10},pick:{minHeight:44,flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,borderRadius:r.pill,borderWidth:1,borderColor:a.ink,backgroundColor:a.surface,...Ao(s,1)},pickOn:{backgroundColor:a.pink,borderColor:a.ink},pressed:{transform:[{scale:.97}]},check:{width:12,height:7,marginTop:-3,borderLeftWidth:2,borderBottomWidth:2,borderColor:a.onPink,transform:[{rotate:"-45deg"}]},pickLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug,...Vo(s)},pickLabelOn:{color:a.onPink},note:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},callout:{padding:n.md,borderRadius:r.sm,backgroundColor:a.mist,overflow:"hidden",...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},signs:{gap:n.sm},sign:{flexDirection:"row",gap:n.md,alignItems:"flex-start"},bullet:{width:6,height:6,borderRadius:3,backgroundColor:a.text,marginTop:i.body*.6},signText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed}})}function EverfurTelevetBooking(n){let{petRef:petRef,usState:l,controller:i,onBooked:o,onExit:a,onAddPet:s,onPickMedia:c,onAddToCalendar:d,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h="unknown",onTriageReason:m,onStateInterest:g,primaryVet:y,onFindEmergencyVet:b,canJoinInApp:v=false,renderUnavailable:x,style:T,testID:k,variant:w="steps",quick:S}=U(n,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),j=Bo(),C=useEverfurTheme(),_=e.useMemo(()=>Da(C),[C]),I=useTelevetBookingController(i),E=useEverfurPets(),D=E.pets,P=D.length,R=e.useMemo(()=>({ownedPetCount:P,withIssues:true}),[P]),[z,F]=e.useReducer((e,t)=>televetBookingReducer(e,t,R),void 0,()=>{let e=initialTelevetBookingState({ownedPetCount:0,withIssues:true},{petId:petRef??null,state:l??null});return w==="quick"&&l?televetBookingReducer(e,{type:"goTo",step:"reason"},{ownedPetCount:0,withIssues:true}):e}),L=w==="quick",A=e.useCallback(e=>F(e),[]),[O,V]=e.useState(""),[N,B]=e.useState(null),M=e.useMemo(()=>S?.reasons!==void 0&&S.reasons.length>0?S.reasons:Vl(),[S?.reasons]),[H,$]=e.useState(null),[W,q]=e.useState(null),[K,Y]=e.useState(false),[G,J]=e.useState(false),[Q,X]=e.useState([]),Z=e.useMemo(()=>createRnChatAttachmentTransport(),[]),te=Fi({media:Q,controller:I,transport:Z}),[ne,re]=e.useState(null),{draft:le}=z,ie=currentStep(z),oe=e.useRef(le.state);oe.current!==le.state&&(oe.current=le.state,K&&Y(false),G&&J(false));let ae=useTelevetStatePolicy(le.state,I),se=useTelevetCancellationPolicy(I),ce=useTelevetBookingEntitlement(I),de=ao(I,ce),ue=useTelevetClinicians(le.state,de),pe=useTelevetSlots(le.clinicianId,de),he=pe.refetch,fe=useTelevetNextSlot(de).data??null,me=useTelevetHoldSlot(I),ge=useTelevetBookConsult(I),ye=e.useMemo(()=>Si(I),[I]),be=useEarlyTriage(m??ye),ve=useStateInterest(le.state,g??null).actionFor("no_licensed_vet"),xe=l??null,Te=Ia(D,le.petId),ke=Ul({reasonText:O,state:le.state,hostState:xe,clinicianId:le.clinicianId,clinicians:ue.data,policy:ae,petName:Te,controller:I,dispatch:A}),{where:we,matchedClinician:Se}=ke,je=M.find(e=>e.id===N)?.label,Ce=L?Nl(je?[je]:[],O):ke.composedReason;e.useEffect(()=>{xe&&!le.state&&!ke.whereTouched.current&&A({type:"patch",patch:{state:xe}})},[xe,le.state,A]),e.useEffect(()=>{petRef&&!le.petId&&A({type:"patch",patch:{petId:petRef}})},[petRef,le.petId,A]);let _e=D.length===1?D[0]?.petRef??null:null;e.useEffect(()=>{_e&&!le.petId&&A({type:"patch",patch:{petId:_e}})},[_e,le.petId,A]);let Ie=e.useRef(ie);Ie.current=ie;let Ee=e.useRef(le.petId);Ee.current=le.petId;let De=e.useRef(0);e.useEffect(()=>{if(P===De.current)return;De.current=P;let e=P>1&&!Ee.current;A({type:"goTo",step:e?"pet":Ie.current})},[P,A]);let Pe=ue.data?.[0]?.clinicianId??null;e.useEffect(()=>{Pe&&!le.clinicianId&&A({type:"patch",patch:{clinicianId:Pe}})},[Pe,le.clinicianId,A]);let Re=e.useCallback(e=>{L&&e.type==="next"||A(e)},[L,A]),ze=wi({draft:le,hold:me,dispatch:Re,setFailure:$,refetchSlots:he});xi({controller:I,draft:le,keep:ie==="booked"||ge.isPending});let{submitBooking:Fe,confirm:Le}=bi({draft:le,reasonText:Ce,book:ge,stateAttested:K,termsAttested:G,cancellationPolicy:se.data??null,triage:be,goTo:e.useCallback(e=>A({type:"goTo",step:e}),[A]),releaseSlot:e.useCallback(()=>{A({type:"patch",patch:ei}),he()},[A,he]),setFailure:$,setEmergency:q,setBookedConsult:re,...o?{onBooked:o}:{},media:te}),Ae=ae.enabled&&ae.data!==null&&!ae.data.wellnessAvailable&&ie!=="pet"&&ie!=="where",Oe=ce.enabled&&ce.data?.active===false||H==="not_entitled",{simulate:Ve,fundingRefused:Ne}=io(ce,Oe),Be=ce.enabled&&ce.data!==null,Me=televetEmptyRosterCause(Be),He=Ce.trim().length>0||!!le.slot,$e=I===null||H==="unavailable"||Kn(ce)||Kn(ae),We={noState:!le.state,isPending:ue.enabled&&ue.isPending,isError:ue.isError,isEmpty:(ue.data?.length??0)===0,notEntitled:Ne},Ue=Ko(We),qe=ie==="clinician"?"time":ie==="time"?"reason":ie==="reason"&&!xe?"where":(ie==="reason"||ie==="where")&&P>1?"pet":null,Ke=e=>A({type:"goTo",step:e==="pet"&&!xe?"where":e==="reason"?"time":"reason"}),Ye=e.useMemo(()=>oa(C),[C]),Ge={surfaceUnavailable:$e,notEntitled:Ne,policyBlocked:Ae,triageOpen:be.open,step:ie},Je=Wo(Ge),Qe=L&&!Ve&&!Je&&(ie==="reason"||ie==="time"&&!Ue||ie==="booked"),Xe=e=>L&&!Qe?/* @__PURE__ */r.jsx(t.View,{style:Ye.pad,children:e}):e;return isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:[j.screen,L?Ye.screen:null,T],testID:k??"televet-booking",children:[
225
- /* @__PURE__ */r.jsx(TelevetBookingChrome,{step:ie,furthestIndex:z.furthestIndex,canGoBack:!Ve&&(be.open||(L?qe!==null:hasPreviousStep(z,R)))&&ie!=="booked",isDirty:He,onBack:()=>{if(be.open){be.close();return}be.cancel(),L&&qe?A({type:"goTo",step:qe}):L||A({type:"back"})},onClose:()=>a?.(),triageOpen:be.open,stepContext:R,presentation:L?"nav":"rail",...u?{onConfirmDiscard:u}:{}}),Xe(Ve?/* @__PURE__ */r.jsx(TelevetVisitSimulator,{petId:le.petId,roster:E,onAddPet:s,onPickPet:e=>A({type:"patch",patch:{petId:e}})}):Je?/* @__PURE__ */r.jsx(TelevetBookingGate,{state:Ge,petName:Ia(D,le.petId),...y?{primaryVet:y}:{},onFindEmergencyVet:b,stateInterest:ve,...g?{onCheckAvailability:()=>A({type:"goTo",step:"clinician"})}:{},onAcknowledgeEmergency:()=>{be.acknowledge(Ce),L?Ke("reason"):A({type:"next"})},...x?{renderUnavailable:x}:{}}):L&&ie==="reason"?/* @__PURE__ */r.jsx(TelevetQuickReasonStep,{petName:Te,reasons:M,pickedId:N,onPick:B,note:O,onChangeNote:V,notePlaceholder:S?.notePlaceholder??ee.reasonPlaceholder,checking:be.checking,onNext:()=>{be.check(Ce).then(e=>{e&&Ke("reason")})}}):L&&ie==="time"&&!Ue?/* @__PURE__ */r.jsx(TelevetQuickTimeStep,{slots:pe.data??[],subtitle:S?.subtitle??na.who,finePrint:S?.finePrint??null,selectedSlot:le.slot,busySlotId:me.isPending?me.variables:null,failure:H,onPick:ze,renderUnready:!pe.enabled||pe.isPending&&pe.data===null||pe.isError||(pe.data?.length??0)===0?()=>/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:null,failure:null,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):null,petName:Te,stateCode:le.state,stateName:we.stateName,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,canConfirm:canConfirm(le,Ce),busy:ge.isPending||te.sending,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),primaryVet:y,onFindEmergencyVet:b}):L&&ie==="time"?
226
- /* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):L&&ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsx(TelevetQuickBookedScreen,{consult:ne,petName:Ia(D,ne.petId)??Te,onDone:()=>a?.(),renderNote:S?.renderBookedNote,...d?{onAddToCalendar:d}:{}}):null}):ie==="time"?/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:me.isPending?me.variables:null,failure:H,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):ie==="review"?/* @__PURE__ */r.jsx(ReviewStep,{when:le.slot?fi(le.slot.startsAt):"",onChangeWhen:()=>A({type:"goTo",step:"time"}),stateName:we.stateName,about:ke.aboutLine,lengthMinutes:(le.slot?f(le.slot):null)??oi,petName:Ia(D,le.petId),reason:Ce.trim(),clinician:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.displayName??null,clinicianRole:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.role??null,shareRecords:le.shareHealthRecords,stateCode:le.state,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,onToggleShare:e=>A({type:"patch",patch:{shareHealthRecords:e}}),canConfirm:canConfirm(le,Ce),busy:ge.isPending||te.sending,failure:H,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),mediaShortfall:te.shortfall,primaryVet:y,onFindEmergencyVet:b}):ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
227
- /* @__PURE__ */r.jsx(TelevetBookedScreen,{consult:ne,petName:Ia(D,ne.petId)??Ia(D,le.petId),onDone:()=>a?.(),canJoinInApp:v,sharedRecords:le.shareHealthRecords,sentPhoto:te.sentOnePhoto(ne),...d?{onAddToCalendar:d}:{}}),
228
- /* @__PURE__ */r.jsx(TelevetMediaDropNotice,{shortfall:te.bookedShortfall(ne),testIDPrefix:"televet-booked"})]}):null}):ie==="clinician"&&Ue?
229
- /* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):ie==="clinician"?/* @__PURE__ */r.jsx(ClinicianStep,{clinicians:ue.data??[],isPending:ue.enabled&&ue.isPending,isError:ue.isError,error:ue.error,selectedId:le.clinicianId,stateCode:le.state,stateName:we.stateName,onRetry:()=>ue.refetch(),onSelect:e=>{A({type:"patch",patch:{clinicianId:e}}),A({type:"next"})}}):ie==="reason"?/* @__PURE__ */r.jsx(ReasonStep,{value:O,composed:Ce,vetName:Se?.displayName??null,onChange:V,media:Q,onChangeMedia:X,mediaLive:te.live,...c?{onPickMedia:c}:{},checking:be.checking,onNext:()=>{be.check(Ce).then(e=>{e&&A({type:"next"})})}}):ie==="pet"?
230
- /* @__PURE__ */r.jsx(PetStep,{pets:D,isPending:E.loading,isError:E.error!==null,error:E.error,onRetry:()=>{E.refresh()},onAddPet:s,selectedId:le.petId,onSelect:e=>A({type:"patch",patch:{petId:e}}),onNext:()=>L?Ke("pet"):A({type:"next"})}):ie==="where"?/* @__PURE__ */r.jsx(WhereStep,{petName:Te,where:we,onNext:()=>L?Ke("where"):A({type:"next"})}):ie==="issues"?/* @__PURE__ */r.jsx(IssuesStep,{petName:Te,chips:ke.issueChips,selected:ke.concernIds,onToggle:ke.toggleConcern,onNext:()=>A({type:"next"})}):ie==="emergency"?/* @__PURE__ */r.jsx(EmergencyStep,{petName:Te,answer:ke.emergencyAnswer,onAnswer:ke.setEmergencyAnswer,onNext:()=>A({type:"next"}),onHandled:()=>{be.acknowledge(Ce),A({type:"next"})},...y?{primaryVet:y}:{},onFindEmergencyVet:b}):
231
- /* @__PURE__ */r.jsx(t.View,{style:_.marker,testID:`televet-booking-step-${ie}`}))]}):/* @__PURE__ */r.jsx(t.View,{style:[j.screen,T],testID:k??"televet-booking",children:/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-copy-unapproved",children:x?x():null})})}var Va=2e4;function Na(t=true,n=Va){let[r,l]=e.useState(()=>Date.now());return e.useEffect(()=>{if(!t)return;l(Date.now());let e=setInterval(()=>l(Date.now()),n);return()=>clearInterval(e)},[t,n]),r}function Ba(e){return e.httpStatus!==void 0&&!isVetMessagesDark(e)}function useVetThreads(t,n=0){let r=t?.listVetThreads,l=r!==void 0,[i,o]=e.useState(()=>({availability:l?"pending":"dark",threads:[],isPending:l,error:null})),[a,s]=e.useState(0);e.useEffect(()=>{if(!t||!r){o({availability:"dark",threads:[],isPending:false,error:null});return}let e=new AbortController,n=true;return o(e=>({...e,isPending:true})),r.call(t,e.signal).then(e=>{n&&(e.ok?o({availability:"lit",threads:e.value,isPending:false,error:null}):isVetMessagesDark(e.error)?o({availability:"dark",threads:[],isPending:false,error:null}):o(t=>({availability:Ba(e.error)?"lit":t.availability,threads:t.threads,isPending:false,error:e.error})))},()=>{n&&o(e=>({...e,isPending:false}))}),()=>{n=false,e.abort()}},[t,r,n,a]);let c=e.useCallback(()=>s(e=>e+1),[]);return e.useMemo(()=>({...i,refetch:c}),[i,c])}function useVetThread(t,petRef,n={}){let r=n.now??Date.now,l=t?.listVetMessages,[i,o]=e.useState([]),[a,s]=e.useState("loading"),[c,d]=e.useState(false),[u,p]=e.useState(false),[h,f]=e.useState(n.ownerCanStart===false),[m,g]=e.useState(false),[y,b]=e.useState(null),[v,x]=e.useState(0),[T,k]=e.useState(0),w=e.useRef(true),S=e.useRef(false),j=e.useRef(false),C=e.useRef(r);C.current=r,e.useEffect(()=>(w.current=true,()=>{w.current=false}),[]),e.useEffect(()=>{n.ownerCanStart===false&&f(true)},[n.ownerCanStart]),e.useEffect(()=>{if(o([]),d(false),!t||!l){s("ready");return}s("loading");let e=new AbortController,n=true;return l.call(t,petRef,{},e.signal).then(e=>{if(n){if(!e.ok){s("error");return}o([...e.value].reverse()),d(e.value.length>=Rt),s("ready")}},()=>{n&&s("error")}),()=>{n=false,e.abort()}},[t,l,petRef,T]);let _=e.useRef(null);e.useEffect(()=>{let e=t?.markVetThreadRead;a!=="ready"||!t||!e||_.current===petRef||(_.current=petRef,e.call(t,petRef,new Date(C.current()).toISOString()).catch(()=>{}))},[a,t,petRef]);let I=e.useCallback(()=>{let e=i[0];if(!t||!l||!c||e===void 0||j.current)return;j.current=true,p(true);let n=new AbortController;l.call(t,petRef,{before:e.createdAt},n.signal).then(e=>{if(j.current=false,!w.current||(p(false),!e.ok))return;let t=new Set(i.map(e=>e.messageId)),n=[...e.value].reverse().filter(e=>!t.has(e.messageId));o(e=>[...n,...e]),d(e.value.length>=Rt)},()=>{j.current=false,w.current&&p(false)})},[t,l,petRef,c,i]),E=e.useCallback(async e=>{let n=t?.sendVetMessage;if(!t||!n||S.current||e.trim().length===0)return false;S.current=true,g(true),b(null);let r=false;try{let l=await n.call(t,petRef,e);if(!w.current)return l.ok;l.ok?(r=!0,o(e=>[...e,l.value]),x(e=>e+1)):isVetThreadVetFirst(l.error)?(f(!0),b("vetWritesFirst")):b("notSent")}catch{w.current&&b("notSent")}finally{S.current=false,w.current&&g(false)}return r},[t,petRef]),D=e.useCallback(()=>k(e=>e+1),[]),P=t?.sendVetMessage!==void 0&&!h;return e.useMemo(()=>({status:a,messages:i,hasOlder:c,loadingOlder:u,loadOlder:I,canWrite:P,sending:m,sendFailure:y,sentCount:v,send:E,retry:D}),[a,i,c,u,I,P,m,y,v,E,D])}function useVisitSummary(t,n){let r=t?.visitSummary,[l,i]=e.useState(()=>({status:r?"loading":"absent",summary:null})),[o,a]=e.useState(0);e.useEffect(()=>{if(!t||!r){i({status:"absent",summary:null});return}i({status:"loading",summary:null});let e=new AbortController,l=true;return r.call(t,n,e.signal).then(e=>{l&&(e.ok?i({status:"ready",summary:e.value}):i({status:isVetMessagesDark(e.error)?"pending":"error",summary:null}))},()=>{l&&i({status:"error",summary:null})}),()=>{l=false,e.abort()}},[t,r,n,o]);let s=e.useCallback(()=>a(e=>e+1),[]);return e.useMemo(()=>({...l,retry:s}),[l,s])}function vetThreadPetRef(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.petRef??null:null}var Ma="your vet",Ha="your pet",$a=/* @__PURE__ */Object.freeze({messagesTitle:"Messages",newPillNative:"New",newPillWeb:"New reply",previewOwnerTemplate:"You: {text}",previewVetTemplateWeb:"{vet}: {text}",threadMetaTemplateNative:"With {vet}",threadLogTemplate:"Messages with {vet}",composerLabelTemplateNative:"Message {vet}",composerLabelWeb:"Message",composerPlaceholderTemplate:"Message {vet}…",send:"Send",composerNoteTemplate:"{vet} usually replies within a day. Emergency? Call a vet.",sent:"Sent",bookVisitWeb:"Book a visit",empty:"No messages yet",loading:"Loading",loadFailed:"Could not load",retry:"Try again",notSent:"Not sent",vetWritesFirst:"Your vet will write first. You can reply once they do.",attachmentsTemplate:"{n} attached",runningLateTemplate:"Running late? Message {vet}",sawTitleTemplate:"What {vet} saw",summaryLabel:"Summary",fromVetTemplate:"From {vet}",planTitleTemplate:"{pet}’s plan",wordForWord:"Word for word",fromThisVisitTitle:"From this visit",messageVetTemplate:"Message {vet}",bookFollowUp:"Book a follow-up",summaryFootnoteTemplate:"A summary of your video visit, written by {vet}. In an emergency, go to the nearest emergency animal hospital.",summaryPending:"Summary on its way"});function Wa(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}function Ua(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function qa(e){let t=e?.trim()??"";return t.length>0?t:Ma}function Ka(e){let t=e?.trim()??"";return t.length>0?t:Ha}function Ya(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Ga=/* @__PURE__ */Object.freeze({pastTitle:"Past video visits",upcomingTitle:"Next video visit",bookedPill:"Booked",visitTitleTemplate:"{pet} with {vet}",minutesTemplate:"{n} minutes",emptyTitle:"No visits yet",bookCta:"Find a time",bookCardTitle:"Book a video visit",bookAnotherTitle:"Book another visit",bookCardSubtitle:"Get help for your pet from home.",loadErrorTitle:"Could not load your visits",retryCta:"Try again",statusCompleted:"Completed",statusCancelled:"Cancelled",statusMissed:"Missed",manageCta:"Manage",getReadyCta:"Get ready",joinCta:"Join the visit",joinDisabledReason:"You can join closer to the time.",joinOverReason:"This visit has ended.",vetUnassigned:"Your vet",rescheduleCta:"Reschedule",cancelCta:"Cancel",cancelConfirmTitleTemplate:"Cancel {pet}’s visit?",cancelConfirmTitle:"Cancel this visit?",cancelConfirmBody:"You can book another one afterwards.",cancelConfirmCta:"Cancel the visit",cancelKeepCta:"Keep the visit",cancelWhyTitle:"What changed?",cancelWhyOptional:"Optional",cancelWhyBetterTemplate:"{pet} is better",cancelWhyTime:"The time doesn’t work",cancelWhyRegularVet:"We’ll see our regular vet",cancelWhyOther:"Something else",cancelWhyTimeHint:"Another time might be easier.",cancelMoveInstead:"Move the visit instead",summaryWhen:"When",summaryVet:"Vet",summaryAbout:"About",cancelFailedTitle:"Could not cancel",cancelReason:"Cancelled by the pet parent in the app.",cancelPolicyErrorTitle:"Could not load what you need to agree to",phaseCancelled:"This visit was cancelled",phaseCancelledBody:"You can book another visit when you are ready.",notFoundTitle:"Not found",notFoundBody:"This visit is no longer available.",staleTitle:"Could not load your visits",staleRetry:"Try again"});function Ja(e){switch(e){case"completed":return Ga.statusCompleted;case"cancelled_owner":case"cancelled_ops":return Ga.statusCancelled;case"no_show_owner":case"no_show_vet":return Ga.statusMissed;default:return null}}function TelevetVisitBackRow({onBack:e,testID:n}){let l=Qa();/* @__PURE__ */
232
- return r.jsx(t.View,{style:l.navRow,children:/* @__PURE__ */r.jsx(t.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:Xo,testID:n,style:l.backTap,children:/* @__PURE__ */r.jsx(t.View,{style:l.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}function Qa(){let t=useEverfurTheme();return e.useMemo(()=>Xa(t),[t])}function Xa(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c=e.slots.header,d=e.slots.card,u=Vo(d);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl},body:{gap:r.lg,paddingBottom:r.xl},navRow:{paddingVertical:r.sm,flexDirection:"row",...Ao(Oo(c,l.lg))},backTap:{width:No,height:No,borderRadius:No/2,borderWidth:1.5,borderColor:s.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:r.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:c?.textColor??s.ink,transform:[{rotate:"45deg"}]},title:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},list:{gap:0},card:{gap:14,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},cardHead:{flexDirection:"row",alignItems:"center",gap:r.sm},pill:{marginLeft:"auto",height:24,paddingHorizontal:10,borderRadius:l.pill,backgroundColor:s.pink,justifyContent:"center"},pillLine:{backgroundColor:s.surface,borderWidth:1.5,borderColor:s.line},pillText:{...face(e,"monoBold"),color:s.onPink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},pillLineText:{color:s.muted},visit:{flexDirection:"row",alignItems:"flex-start",gap:r.lg},dateTile:{width:56,paddingVertical:r.sm,borderRadius:14,backgroundColor:s.pinkSoft,alignItems:"center",gap:2},dateTileSmall:{...face(e,"monoBold"),color:s.ink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},dateTileDay:{...face(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.tight},visitMain:{flex:1,gap:2},visitTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitLine:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},row:{gap:2,paddingVertical:r.md,borderTopWidth:1,borderTopColor:s.line},rowFirst:{borderTopWidth:0,paddingTop:0},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},when:{flex:1,...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},status:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",...u},meta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},bookCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},bookTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...u},bookSubtitle:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},footnote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.relaxed,textAlign:"center"},visitCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Ao(d,1)},visitWhen:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,...u},visitWho:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitMeta:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},reason:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},terms:{padding:r.md,borderRadius:l.sm,backgroundColor:s.mist,...face(e,"regular"),color:s.text,fontSize:o.caption,lineHeight:o.caption*a.normal},noticeTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},noticeBody:{...face(e,"regular"),color:s.muted,fontSize:o.body,lineHeight:o.body*a.normal},receipt:{gap:r.xs,padding:r.md,borderRadius:l.sm,backgroundColor:s.mist},stack:{gap:r.sm},whyHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:r.sm},whyTitle:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},whyNote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},hint:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:s.mist},muted:{...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight}})}function Za(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Lo(e),c={...face(e,"regular"),maxWidth:"85%",paddingVertical:10,paddingHorizontal:14,borderRadius:18,fontSize:o.body,lineHeight:o.body*a.normal};return t.StyleSheet.create({head:{gap:2},screenTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},meta:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal},log:{gap:r.sm,paddingBottom:r.md},day:{alignSelf:"center",...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",paddingTop:r.sm},item:{gap:4,alignItems:"flex-start"},itemMine:{alignItems:"flex-end"},whoRow:{flexDirection:"row",alignItems:"baseline",gap:r.sm},who:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight},time:{...face(e,"regular"),color:s.muted,fontSize:o.caption},bubbleMine:{...c,backgroundColor:n.bubbleUser,color:n.onPrimary,borderBottomRightRadius:6},bubbleVet:{...c,backgroundColor:n.bubbleVet,color:n.onBubbleVet,borderBottomLeftRadius:6},system:{...face(e,"regular"),color:s.muted,fontSize:o.caption,textAlign:"center",alignSelf:"center"},attachments:{...face(e,"regular"),color:s.muted,fontSize:o.caption},composer:{flexDirection:"row",alignItems:"flex-end",gap:r.sm,padding:r.sm,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Ao(e.slots.input,1.5)},field:{flex:1,minHeight:No,paddingHorizontal:r.sm,paddingVertical:10,...face(e,"regular"),color:s.text,fontSize:o.body,...Vo(e.slots.input)},send:{minWidth:No,height:No,paddingHorizontal:r.md,borderRadius:No/2,backgroundColor:n.primary,alignItems:"center",justifyContent:"center"},sendDisabled:{opacity:.5},sendLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight},note:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},failure:{...face(e,"bold"),color:s.alert,fontSize:o.caption},label:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},body:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},planItem:{flexDirection:"row",gap:r.md,alignItems:"flex-start"},planNumber:{...face(e,"monoBold"),color:s.ink,fontSize:12,letterSpacing:.9,paddingTop:3},planText:{flex:1,...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},rowPress:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:No},rowMain:{flex:1,gap:2},rowEnd:{alignItems:"flex-end",gap:4},preview:{...face(e,"regular"),color:s.muted,fontSize:o.caption},link:{minHeight:No,justifyContent:"center",alignSelf:"flex-start"},linkText:{...face(e,"bold"),color:n.linkInk,fontSize:o.bodyTight,textDecorationLine:"underline"}})}function es(){let t=useEverfurTheme();return e.useMemo(()=>Za(t),[t])}function TelevetConsultScreen({consult:n,controller:l,onJoin:i,onReschedule:o,onCancelled:a,onBack:s,revision:d=0,onMessageVet:u,nowMs:p,style:h}){let f=Qa(),m=es(),g=useTelevetBookingController(l),[y,b]=e.useState(0),v=Un(n.consultId,g,d+y),x=useTelevetCancellationPolicy(g),T=qn(n.consultId,g),{pets:k}=useEverfurPets(),w=useVetThreads(g),[S,j]=e.useState(false),[C,_]=e.useState(null),[I,E]=e.useState(false),[D,P]=e.useState(null),R=v.isError&&v.error?.httpStatus===404,z=R?null:v.data??n,F=z!==null&&c.has(z.status),L=Na(!F),A=televetJoinReadiness(z,p??L),O=z===null?null:Ia(k,z.petId),V=x.data?.summary.trim()||null,N=e.useCallback(()=>{V&&(E(false),T.mutate(C??Ga.cancelReason,{onSuccess:e=>{j(false),P(e),b(e=>e+1),a?.(e)},onError:()=>E(true)}))},[V,T,a,C]);if(z===null)/* @__PURE__ */
225
+ /* @__PURE__ */r.jsx(TelevetButton,{label:te.emergency.keepBookingCta,kind:"quiet",fullWidth:false,onPress:a,testID:"televet-emergency-handled"})]}):null]})}function Ya(e){let{space:n,radius:r,type:l}=e,{size:i,lineHeight:o}=l,a=Ao(e),s=e.slots.chip;return t.StyleSheet.create({pickRow:{flexDirection:"row",flexWrap:"wrap",gap:10},pick:{minHeight:44,flexDirection:"row",alignItems:"center",gap:n.sm,paddingHorizontal:n.lg,borderRadius:r.pill,borderWidth:1,borderColor:a.ink,backgroundColor:a.surface,...Oo(s,1)},pickOn:{backgroundColor:a.pink,borderColor:a.ink},pressed:{transform:[{scale:.97}]},check:{width:12,height:7,marginTop:-3,borderLeftWidth:2,borderBottomWidth:2,borderColor:a.onPink,transform:[{rotate:"-45deg"}]},pickLabel:{...face(e,"bold"),color:a.ink,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.snug,...No(s)},pickLabelOn:{color:a.onPink},note:{...face(e,"regular"),color:a.muted,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},callout:{padding:n.md,borderRadius:r.sm,backgroundColor:a.mist,overflow:"hidden",...face(e,"regular"),color:a.text,fontSize:i.bodyTight,lineHeight:i.bodyTight*o.relaxed},signs:{gap:n.sm},sign:{flexDirection:"row",gap:n.md,alignItems:"flex-start"},bullet:{width:6,height:6,borderRadius:3,backgroundColor:a.text,marginTop:i.body*.6},signText:{flex:1,...face(e,"regular"),color:a.text,fontSize:i.body,lineHeight:i.body*o.relaxed}})}function EverfurTelevetBooking(e){/* @__PURE__ */
226
+ return r.jsx(SdkTabletColumn,{children:/* @__PURE__ */r.jsx(BookingBody,{...e})})}function BookingBody(n){let{petRef:petRef,usState:l,controller:i,onBooked:o,onExit:a,onAddPet:s,onPickMedia:c,onAddToCalendar:d,onConfirmDiscard:u,onRequestLocation:p,locationStatus:h="unknown",onTriageReason:f,onStateInterest:g,primaryVet:b,onFindEmergencyVet:y,canJoinInApp:v=false,renderUnavailable:x,style:T,testID:k,variant:w="steps",quick:S}=q(n,["onBooked","onExit","onAddPet","onRequestLocation","onFindEmergencyVet"]),j=Mo(),C=useEverfurTheme(),_=e.useMemo(()=>Ma(C),[C]),I=useTelevetBookingController(i),E=useEverfurPets(),D=E.pets,P=D.length,R=e.useMemo(()=>({ownedPetCount:P,withIssues:true}),[P]),[z,F]=e.useReducer((e,t)=>televetBookingReducer(e,t,R),void 0,()=>{let e=initialTelevetBookingState({ownedPetCount:0,withIssues:true},{petId:petRef??null,state:l??null});return w==="quick"&&l?televetBookingReducer(e,{type:"goTo",step:"reason"},{ownedPetCount:0,withIssues:true}):e}),L=w==="quick",A=e.useCallback(e=>F(e),[]),[O,V]=e.useState(""),[N,B]=e.useState(null),M=e.useMemo(()=>S?.reasons!==void 0&&S.reasons.length>0?S.reasons:Nl(),[S?.reasons]),[H,$]=e.useState(null),[W,U]=e.useState(null),[K,Y]=e.useState(false),[G,J]=e.useState(false),[Q,X]=e.useState([]),Z=e.useMemo(()=>createRnChatAttachmentTransport(),[]),ee=Li({media:Q,controller:I,transport:Z}),[ne,re]=e.useState(null),{draft:le}=z,ie=currentStep(z),oe=e.useRef(le.state);oe.current!==le.state&&(oe.current=le.state,K&&Y(false),G&&J(false));let ae=useTelevetStatePolicy(le.state,I),se=useTelevetCancellationPolicy(I),ce=useTelevetBookingEntitlement(I),de=so(I,ce),ue=useTelevetClinicians(le.state,de),pe=useTelevetSlots(le.clinicianId,de),he=pe.refetch,fe=useTelevetNextSlot(de).data??null,me=useTelevetHoldSlot(I),ge=useTelevetBookConsult(I),be=e.useMemo(()=>ji(I),[I]),ye=useEarlyTriage(f??be),ve=useStateInterest(le.state,g??null).actionFor("no_licensed_vet"),xe=l??null,Te=Na(D,le.petId),ke=ql({reasonText:O,state:le.state,hostState:xe,clinicianId:le.clinicianId,clinicians:ue.data,policy:ae,petName:Te,controller:I,dispatch:A}),{where:we,matchedClinician:Se}=ke,je=M.find(e=>e.id===N)?.label,Ce=L?Bl(je?[je]:[],O):ke.composedReason;e.useEffect(()=>{xe&&!le.state&&!ke.whereTouched.current&&A({type:"patch",patch:{state:xe}})},[xe,le.state,A]),e.useEffect(()=>{petRef&&!le.petId&&A({type:"patch",patch:{petId:petRef}})},[petRef,le.petId,A]);let _e=D.length===1?D[0]?.petRef??null:null;e.useEffect(()=>{_e&&!le.petId&&A({type:"patch",patch:{petId:_e}})},[_e,le.petId,A]);let Ie=e.useRef(ie);Ie.current=ie;let Ee=e.useRef(le.petId);Ee.current=le.petId;let De=e.useRef(0);e.useEffect(()=>{if(P===De.current)return;De.current=P;let e=P>1&&!Ee.current;A({type:"goTo",step:e?"pet":Ie.current})},[P,A]);let Pe=ue.data?.[0]?.clinicianId??null;e.useEffect(()=>{Pe&&!le.clinicianId&&A({type:"patch",patch:{clinicianId:Pe}})},[Pe,le.clinicianId,A]);let Re=e.useCallback(e=>{L&&e.type==="next"||A(e)},[L,A]),ze=Si({draft:le,hold:me,dispatch:Re,setFailure:$,refetchSlots:he});Ti({controller:I,draft:le,keep:ie==="booked"||ge.isPending});let{submitBooking:Fe,confirm:Le}=vi({draft:le,reasonText:Ce,book:ge,stateAttested:K,termsAttested:G,cancellationPolicy:se.data??null,triage:ye,goTo:e.useCallback(e=>A({type:"goTo",step:e}),[A]),releaseSlot:e.useCallback(()=>{A({type:"patch",patch:ti}),he()},[A,he]),setFailure:$,setEmergency:U,setBookedConsult:re,...o?{onBooked:o}:{},media:ee}),Ae=ae.enabled&&ae.data!==null&&!ae.data.wellnessAvailable&&ie!=="pet"&&ie!=="where",Oe=ce.enabled&&ce.data?.active===false||H==="not_entitled",{simulate:Ve,fundingRefused:Ne}=oo(ce,Oe),Be=ce.enabled&&ce.data!==null,Me=televetEmptyRosterCause(Be),He=Ce.trim().length>0||!!le.slot,$e=I===null||H==="unavailable"||Yn(ce)||Yn(ae),We={noState:!le.state,isPending:ue.enabled&&ue.isPending,isError:ue.isError,isEmpty:(ue.data?.length??0)===0,notEntitled:Ne},Ue=Yo(We),qe=ie==="clinician"?"time":ie==="time"?"reason":ie==="reason"&&!xe?"where":(ie==="reason"||ie==="where")&&P>1?"pet":null,Ke=e=>A({type:"goTo",step:e==="pet"&&!xe?"where":e==="reason"?"time":"reason"}),Ye=e.useMemo(()=>ba(C),[C]),Ge={surfaceUnavailable:$e,notEntitled:Ne,policyBlocked:Ae,triageOpen:ye.open,step:ie},Je=Uo(Ge),Qe=L&&!Ve&&!Je&&(ie==="reason"||ie==="time"&&!Ue||ie==="booked"),Xe=e=>L&&!Qe?/* @__PURE__ */r.jsx(t.View,{style:Ye.pad,children:e}):e;return isTelevetBookingCopyReady()?/* @__PURE__ */r.jsxs(t.View,{style:[j.screen,L?Ye.screen:null,T],testID:k??"televet-booking",children:[
227
+ /* @__PURE__ */r.jsx(TelevetBookingChrome,{step:ie,furthestIndex:z.furthestIndex,canGoBack:!Ve&&(ye.open||(L?qe!==null:hasPreviousStep(z,R)))&&ie!=="booked",isDirty:He,onBack:()=>{if(ye.open){ye.close();return}ye.cancel(),L&&qe?A({type:"goTo",step:qe}):L||A({type:"back"})},onClose:()=>a?.(),triageOpen:ye.open,stepContext:R,presentation:L?"nav":"rail",...u?{onConfirmDiscard:u}:{}}),Xe(Ve?/* @__PURE__ */r.jsx(TelevetVisitSimulator,{petId:le.petId,roster:E,onAddPet:s,onPickPet:e=>A({type:"patch",patch:{petId:e}})}):Je?/* @__PURE__ */r.jsx(TelevetBookingGate,{state:Ge,petName:Na(D,le.petId),...b?{primaryVet:b}:{},onFindEmergencyVet:y,stateInterest:ve,...g?{onCheckAvailability:()=>A({type:"goTo",step:"clinician"})}:{},onAcknowledgeEmergency:()=>{ye.acknowledge(Ce),L?Ke("reason"):A({type:"next"})},...x?{renderUnavailable:x}:{}}):L&&ie==="reason"?/* @__PURE__ */r.jsx(TelevetQuickReasonStep,{petName:Te,reasons:M,pickedId:N,onPick:B,note:O,onChangeNote:V,notePlaceholder:S?.notePlaceholder??te.reasonPlaceholder,checking:ye.checking,onNext:()=>{ye.check(Ce).then(e=>{e&&Ke("reason")})}}):L&&ie==="time"&&!Ue?/* @__PURE__ */r.jsx(TelevetQuickTimeStep,{slots:pe.data??[],subtitle:S?.subtitle??ha.who,finePrint:S?.finePrint??null,selectedSlot:le.slot,busySlotId:me.isPending?me.variables:null,failure:H,onPick:ze,renderUnready:!pe.enabled||pe.isPending&&pe.data===null||pe.isError||(pe.data?.length??0)===0?()=>/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:null,failure:null,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):null,petName:Te,stateCode:le.state,stateName:we.stateName,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,canConfirm:canConfirm(le,Ce),busy:ge.isPending||ee.sending,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),primaryVet:b,onFindEmergencyVet:y}):L&&ie==="time"?
228
+ /* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):L&&ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsx(TelevetQuickBookedScreen,{consult:ne,petName:Na(D,ne.petId)??Te,onDone:()=>a?.(),renderNote:S?.renderBookedNote,...d?{onAddToCalendar:d}:{}}):null}):ie==="time"?/* @__PURE__ */r.jsx(SlotStep,{slots:pe.data??[],enabled:pe.enabled,isPending:pe.enabled&&pe.isPending&&pe.data===null,isError:pe.isError,error:pe.error,busySlotId:me.isPending?me.variables:null,failure:H,selectedSlot:le.slot,nextOpening:fe,onPick:ze,onRetry:()=>pe.refetch(),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"})}):ie==="review"?/* @__PURE__ */r.jsx(ReviewStep,{when:le.slot?mi(le.slot.startsAt):"",onChangeWhen:()=>A({type:"goTo",step:"time"}),stateName:we.stateName,about:ke.aboutLine,lengthMinutes:(le.slot?m(le.slot):null)??ai,petName:Na(D,le.petId),reason:Ce.trim(),clinician:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.displayName??null,clinicianRole:ue.data?.find(e=>e.clinicianId===le.clinicianId)?.role??null,shareRecords:le.shareHealthRecords,stateCode:le.state,stateAttested:K,onToggleStateAttest:Y,cancellationTerms:se.data?.summary??null,termsAttested:G,onToggleTermsAttest:J,onToggleShare:e=>A({type:"patch",patch:{shareHealthRecords:e}}),canConfirm:canConfirm(le,Ce),busy:ge.isPending||ee.sending,failure:H,onConfirm:Le,emergency:W,onAcknowledgeEmergency:()=>Fe(true),onSeeOtherVets:()=>A({type:"goTo",step:"clinician"}),mediaShortfall:ee.shortfall,primaryVet:b,onFindEmergencyVet:y}):ie==="booked"?/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-booked",children:ne?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
229
+ /* @__PURE__ */r.jsx(TelevetBookedScreen,{consult:ne,petName:Na(D,ne.petId)??Na(D,le.petId),onDone:()=>a?.(),canJoinInApp:v,sharedRecords:le.shareHealthRecords,sentPhoto:ee.sentOnePhoto(ne),...d?{onAddToCalendar:d}:{}}),
230
+ /* @__PURE__ */r.jsx(TelevetMediaDropNotice,{shortfall:ee.bookedShortfall(ne),testIDPrefix:"televet-booked"})]}):null}):ie==="clinician"&&Ue?
231
+ /* @__PURE__ */r.jsx(TelevetClinicianOutcome,{state:We,cause:Me,locationStatus:h,...p?{onRequestLocation:p}:{},onRetry:()=>ue.refetch(),stateInterest:ve,...x?{renderUnavailable:x}:{}}):ie==="clinician"?/* @__PURE__ */r.jsx(ClinicianStep,{clinicians:ue.data??[],isPending:ue.enabled&&ue.isPending,isError:ue.isError,error:ue.error,selectedId:le.clinicianId,stateCode:le.state,stateName:we.stateName,onRetry:()=>ue.refetch(),onSelect:e=>{A({type:"patch",patch:{clinicianId:e}}),A({type:"next"})}}):ie==="reason"?/* @__PURE__ */r.jsx(ReasonStep,{value:O,composed:Ce,vetName:Se?.displayName??null,onChange:V,media:Q,onChangeMedia:X,mediaLive:ee.live,...c?{onPickMedia:c}:{},checking:ye.checking,onNext:()=>{ye.check(Ce).then(e=>{e&&A({type:"next"})})}}):ie==="pet"?
232
+ /* @__PURE__ */r.jsx(PetStep,{pets:D,isPending:E.loading,isError:E.error!==null,error:E.error,onRetry:()=>{E.refresh()},onAddPet:s,selectedId:le.petId,onSelect:e=>A({type:"patch",patch:{petId:e}}),onNext:()=>L?Ke("pet"):A({type:"next"})}):ie==="where"?/* @__PURE__ */r.jsx(WhereStep,{petName:Te,where:we,onNext:()=>L?Ke("where"):A({type:"next"})}):ie==="issues"?/* @__PURE__ */r.jsx(IssuesStep,{petName:Te,chips:ke.issueChips,selected:ke.concernIds,onToggle:ke.toggleConcern,onNext:()=>A({type:"next"})}):ie==="emergency"?/* @__PURE__ */r.jsx(EmergencyStep,{petName:Te,answer:ke.emergencyAnswer,onAnswer:ke.setEmergencyAnswer,onNext:()=>A({type:"next"}),onHandled:()=>{ye.acknowledge(Ce),A({type:"next"})},...b?{primaryVet:b}:{},onFindEmergencyVet:y}):
233
+ /* @__PURE__ */r.jsx(t.View,{style:_.marker,testID:`televet-booking-step-${ie}`}))]}):/* @__PURE__ */r.jsx(t.View,{style:[j.screen,T],testID:k??"televet-booking",children:/* @__PURE__ */r.jsx(t.View,{style:j.stepFill,testID:"televet-booking-copy-unapproved",children:x?x():null})})}var Ga=2e4;function Ja(t=true,n=Ga){let[r,l]=e.useState(()=>Date.now());return e.useEffect(()=>{if(!t)return;l(Date.now());let e=setInterval(()=>l(Date.now()),n);return()=>clearInterval(e)},[t,n]),r}function Qa(e){return e.httpStatus!==void 0&&!isVetMessagesDark(e)}function useVetThreads(t,n=0){let r=t?.listVetThreads,l=r!==void 0,[i,o]=e.useState(()=>({availability:l?"pending":"dark",threads:[],isPending:l,error:null})),[a,s]=e.useState(0);e.useEffect(()=>{if(!t||!r){o({availability:"dark",threads:[],isPending:false,error:null});return}let e=new AbortController,n=true;return o(e=>({...e,isPending:true})),r.call(t,e.signal).then(e=>{n&&(e.ok?o({availability:"lit",threads:e.value,isPending:false,error:null}):isVetMessagesDark(e.error)?o({availability:"dark",threads:[],isPending:false,error:null}):o(t=>({availability:Qa(e.error)?"lit":t.availability,threads:t.threads,isPending:false,error:e.error})))},()=>{n&&o(e=>({...e,isPending:false}))}),()=>{n=false,e.abort()}},[t,r,n,a]);let c=e.useCallback(()=>s(e=>e+1),[]);return e.useMemo(()=>({...i,refetch:c}),[i,c])}function useVetThread(t,petRef,n={}){let r=n.now??Date.now,l=t?.listVetMessages,[i,o]=e.useState([]),[a,s]=e.useState("loading"),[c,d]=e.useState(false),[u,p]=e.useState(false),[h,f]=e.useState(n.ownerCanStart===false),[m,g]=e.useState(false),[b,y]=e.useState(null),[v,x]=e.useState(0),[T,k]=e.useState(0),w=e.useRef(true),S=e.useRef(false),j=e.useRef(false),C=e.useRef(r);C.current=r,e.useEffect(()=>(w.current=true,()=>{w.current=false}),[]),e.useEffect(()=>{n.ownerCanStart===false&&f(true)},[n.ownerCanStart]),e.useEffect(()=>{if(o([]),d(false),!t||!l){s("ready");return}s("loading");let e=new AbortController,n=true;return l.call(t,petRef,{},e.signal).then(e=>{if(n){if(!e.ok){s("error");return}o([...e.value].reverse()),d(e.value.length>=zt),s("ready")}},()=>{n&&s("error")}),()=>{n=false,e.abort()}},[t,l,petRef,T]);let _=e.useRef(null);e.useEffect(()=>{let e=t?.markVetThreadRead;a!=="ready"||!t||!e||_.current===petRef||(_.current=petRef,e.call(t,petRef,new Date(C.current()).toISOString()).catch(()=>{}))},[a,t,petRef]);let I=e.useCallback(()=>{let e=i[0];if(!t||!l||!c||e===void 0||j.current)return;j.current=true,p(true);let n=new AbortController;l.call(t,petRef,{before:e.createdAt},n.signal).then(e=>{if(j.current=false,!w.current||(p(false),!e.ok))return;let t=new Set(i.map(e=>e.messageId)),n=[...e.value].reverse().filter(e=>!t.has(e.messageId));o(e=>[...n,...e]),d(e.value.length>=zt)},()=>{j.current=false,w.current&&p(false)})},[t,l,petRef,c,i]),E=e.useCallback(async e=>{let n=t?.sendVetMessage;if(!t||!n||S.current||e.trim().length===0)return false;S.current=true,g(true),y(null);let r=false;try{let l=await n.call(t,petRef,e);if(!w.current)return l.ok;l.ok?(r=!0,o(e=>[...e,l.value]),x(e=>e+1)):isVetThreadVetFirst(l.error)?(f(!0),y("vetWritesFirst")):y("notSent")}catch{w.current&&y("notSent")}finally{S.current=false,w.current&&g(false)}return r},[t,petRef]),D=e.useCallback(()=>k(e=>e+1),[]),P=t?.sendVetMessage!==void 0&&!h;return e.useMemo(()=>({status:a,messages:i,hasOlder:c,loadingOlder:u,loadOlder:I,canWrite:P,sending:m,sendFailure:b,sentCount:v,send:E,retry:D}),[a,i,c,u,I,P,m,b,v,E,D])}function useVisitSummary(t,n){let r=t?.visitSummary,[l,i]=e.useState(()=>({status:r?"loading":"absent",summary:null})),[o,a]=e.useState(0);e.useEffect(()=>{if(!t||!r){i({status:"absent",summary:null});return}i({status:"loading",summary:null});let e=new AbortController,l=true;return r.call(t,n,e.signal).then(e=>{l&&(e.ok?i({status:"ready",summary:e.value}):i({status:isVetMessagesDark(e.error)?"pending":"error",summary:null}))},()=>{l&&i({status:"error",summary:null})}),()=>{l=false,e.abort()}},[t,r,n,o]);let s=e.useCallback(()=>a(e=>e+1),[]);return e.useMemo(()=>({...l,retry:s}),[l,s])}function vetThreadPetRef(e,t){return t?e.find(e=>e.petRef===t||e.petId===t)?.petRef??null:null}var Xa="your vet",Za="your pet",es=/* @__PURE__ */Object.freeze({messagesTitle:"Messages",newPillNative:"New",newPillWeb:"New reply",previewOwnerTemplate:"You: {text}",previewVetTemplateWeb:"{vet}: {text}",threadMetaTemplateNative:"With {vet}",threadLogTemplate:"Messages with {vet}",composerLabelTemplateNative:"Message {vet}",composerLabelWeb:"Message",composerPlaceholderTemplate:"Message {vet}…",send:"Send",composerNoteTemplate:"{vet} usually replies within a day. Emergency? Call a vet.",sent:"Sent",bookVisitWeb:"Book a visit",empty:"No messages yet",loading:"Loading",loadFailed:"Could not load",retry:"Try again",notSent:"Not sent",vetWritesFirst:"Your vet will write first. You can reply once they do.",attachmentsTemplate:"{n} attached",runningLateTemplate:"Running late? Message {vet}",sawTitleTemplate:"What {vet} saw",summaryLabel:"Summary",fromVetTemplate:"From {vet}",planTitleTemplate:"{pet}’s plan",wordForWord:"Word for word",fromThisVisitTitle:"From this visit",messageVetTemplate:"Message {vet}",bookFollowUp:"Book a follow-up",summaryFootnoteTemplate:"A summary of your video visit, written by {vet}. In an emergency, go to the nearest emergency animal hospital.",summaryPending:"Summary on its way"});function ts(e,t){let n=e;for(let[e,r]of Object.entries(t))n=n.split(`{${e}}`).join(r);return n}function ns(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function rs(e){let t=e?.trim()??"";return t.length>0?t:Xa}function ls(e){let t=e?.trim()??"";return t.length>0?t:Za}function is(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}var os=/* @__PURE__ */Object.freeze({pastTitle:"Past video visits",upcomingTitle:"Next video visit",bookedPill:"Booked",visitTitleTemplate:"{pet} with {vet}",minutesTemplate:"{n} minutes",emptyTitle:"No visits yet",bookCta:"Find a time",bookCardTitle:"Book a video visit",bookAnotherTitle:"Book another visit",bookCardSubtitle:"Get help for your pet from home.",loadErrorTitle:"Could not load your visits",retryCta:"Try again",statusCompleted:"Completed",statusCancelled:"Cancelled",statusMissed:"Missed",manageCta:"Manage",getReadyCta:"Get ready",joinCta:"Join the visit",joinDisabledReason:"You can join closer to the time.",joinOverReason:"This visit has ended.",vetUnassigned:"Your vet",rescheduleCta:"Reschedule",cancelCta:"Cancel",cancelConfirmTitleTemplate:"Cancel {pet}’s visit?",cancelConfirmTitle:"Cancel this visit?",cancelConfirmBody:"You can book another one afterwards.",cancelConfirmCta:"Cancel the visit",cancelKeepCta:"Keep the visit",cancelWhyTitle:"What changed?",cancelWhyOptional:"Optional",cancelWhyBetterTemplate:"{pet} is better",cancelWhyTime:"The time doesn’t work",cancelWhyRegularVet:"We’ll see our regular vet",cancelWhyOther:"Something else",cancelWhyTimeHint:"Another time might be easier.",cancelMoveInstead:"Move the visit instead",summaryWhen:"When",summaryVet:"Vet",summaryAbout:"About",cancelFailedTitle:"Could not cancel",cancelReason:"Cancelled by the pet parent in the app.",cancelPolicyErrorTitle:"Could not load what you need to agree to",phaseCancelled:"This visit was cancelled",phaseCancelledBody:"You can book another visit when you are ready.",notFoundTitle:"Not found",notFoundBody:"This visit is no longer available.",staleTitle:"Could not load your visits",staleRetry:"Try again"});function as(e){switch(e){case"completed":return os.statusCompleted;case"cancelled_owner":case"cancelled_ops":return os.statusCancelled;case"no_show_owner":case"no_show_vet":return os.statusMissed;default:return null}}function TelevetVisitBackRow({onBack:e,testID:n}){let l=ss();/* @__PURE__ */
234
+ return r.jsx(t.View,{style:l.navRow,children:/* @__PURE__ */r.jsx(t.Pressable,{onPress:e,accessibilityRole:"button",accessibilityLabel:Zo,testID:n,style:l.backTap,children:/* @__PURE__ */r.jsx(t.View,{style:l.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})})})}function ss(){let t=useEverfurTheme();return e.useMemo(()=>cs(t),[t])}function cs(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Ao(e),c=e.slots.header,d=e.slots.card,u=No(d);return t.StyleSheet.create({screen:{flex:1,paddingHorizontal:r.xl},body:{gap:r.lg,paddingBottom:r.xl},navRow:{paddingVertical:r.sm,flexDirection:"row",...Oo(Vo(c,l.lg))},backTap:{width:Bo,height:Bo,borderRadius:Bo/2,borderWidth:1.5,borderColor:s.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:r.xs,borderLeftWidth:2,borderBottomWidth:2,borderColor:c?.textColor??s.ink,transform:[{rotate:"45deg"}]},title:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug},list:{gap:0},card:{gap:14,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Oo(d,1)},cardHead:{flexDirection:"row",alignItems:"center",gap:r.sm},pill:{marginLeft:"auto",height:24,paddingHorizontal:10,borderRadius:l.pill,backgroundColor:s.pink,justifyContent:"center"},pillLine:{backgroundColor:s.surface,borderWidth:1.5,borderColor:s.line},pillText:{...face(e,"monoBold"),color:s.onPink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},pillLineText:{color:s.muted},visit:{flexDirection:"row",alignItems:"flex-start",gap:r.lg},dateTile:{width:56,paddingVertical:r.sm,borderRadius:14,backgroundColor:s.pinkSoft,alignItems:"center",gap:2},dateTileSmall:{...face(e,"monoBold"),color:s.ink,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},dateTileDay:{...face(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.tight},visitMain:{flex:1,gap:2},visitTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitLine:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},row:{gap:2,paddingVertical:r.md,borderTopWidth:1,borderTopColor:s.line},rowFirst:{borderTopWidth:0,paddingTop:0},rowHead:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:r.sm},when:{flex:1,...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},status:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",...u},meta:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},bookCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Oo(d,1)},bookTitle:{...headingFace(e,"bold"),color:s.ink,fontSize:o.subtitle,lineHeight:o.subtitle*a.snug,...u},bookSubtitle:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},footnote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.relaxed,textAlign:"center"},visitCard:{gap:r.md,padding:r.lg,borderRadius:l.lg,borderWidth:1,borderColor:s.line,backgroundColor:s.surface,...Oo(d,1)},visitWhen:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug,...u},visitWho:{...face(e,"bold"),color:s.ink,fontSize:o.body,lineHeight:o.body*a.snug,...u},visitMeta:{...face(e,"regular"),color:s.text,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal,...u},reason:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal,...u},terms:{padding:r.md,borderRadius:l.sm,backgroundColor:s.mist,...face(e,"regular"),color:s.text,fontSize:o.caption,lineHeight:o.caption*a.normal},noticeTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},noticeBody:{...face(e,"regular"),color:s.muted,fontSize:o.body,lineHeight:o.body*a.normal},receipt:{gap:r.xs,padding:r.md,borderRadius:l.sm,backgroundColor:s.mist},stack:{gap:r.sm},whyHead:{flexDirection:"row",flexWrap:"wrap",alignItems:"baseline",gap:r.sm},whyTitle:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.snug},whyNote:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},hint:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:r.sm,paddingVertical:r.sm,paddingHorizontal:r.lg,borderRadius:l.sm,backgroundColor:s.mist},muted:{...face(e,"regular"),color:n.text.primary,fontSize:o.bodyTight}})}function ds(e){let{color:n,space:r,radius:l,type:i}=e,{size:o,lineHeight:a}=i,s=Ao(e),c={...face(e,"regular"),maxWidth:"85%",paddingVertical:10,paddingHorizontal:14,borderRadius:18,fontSize:o.body,lineHeight:o.body*a.normal};return t.StyleSheet.create({head:{gap:2},screenTitle:{...headingFace(e,"medium"),color:s.ink,fontSize:o.heading,lineHeight:o.heading*a.snug},meta:{...face(e,"regular"),color:s.muted,fontSize:o.bodyTight,lineHeight:o.bodyTight*a.normal},log:{gap:r.sm,paddingBottom:r.md},day:{alignSelf:"center",...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase",paddingTop:r.sm},item:{gap:4,alignItems:"flex-start"},itemMine:{alignItems:"flex-end"},whoRow:{flexDirection:"row",alignItems:"baseline",gap:r.sm},who:{...face(e,"bold"),color:s.ink,fontSize:o.bodyTight},time:{...face(e,"regular"),color:s.muted,fontSize:o.caption},bubbleMine:{...c,backgroundColor:n.bubbleUser,color:n.onPrimary,borderBottomRightRadius:6},bubbleVet:{...c,backgroundColor:n.bubbleVet,color:n.onBubbleVet,borderBottomLeftRadius:6},system:{...face(e,"regular"),color:s.muted,fontSize:o.caption,textAlign:"center",alignSelf:"center"},attachments:{...face(e,"regular"),color:s.muted,fontSize:o.caption},composer:{flexDirection:"row",alignItems:"flex-end",gap:r.sm,padding:r.sm,borderRadius:l.lg,borderWidth:1.5,borderColor:s.line,backgroundColor:s.surface,...Oo(e.slots.input,1.5)},field:{flex:1,minHeight:Bo,paddingHorizontal:r.sm,paddingVertical:10,...face(e,"regular"),color:s.text,fontSize:o.body,...No(e.slots.input)},send:{minWidth:Bo,height:Bo,paddingHorizontal:r.md,borderRadius:Bo/2,backgroundColor:n.primary,alignItems:"center",justifyContent:"center"},sendDisabled:{opacity:.5},sendLabel:{...face(e,"bold"),color:n.onPrimary,fontSize:o.bodyTight},note:{...face(e,"regular"),color:s.muted,fontSize:o.caption,lineHeight:o.caption*a.normal},failure:{...face(e,"bold"),color:s.alert,fontSize:o.caption},label:{...face(e,"monoBold"),color:s.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},body:{...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},planItem:{flexDirection:"row",gap:r.md,alignItems:"flex-start"},planNumber:{...face(e,"monoBold"),color:s.ink,fontSize:12,letterSpacing:.9,paddingTop:3},planText:{flex:1,...face(e,"regular"),color:s.text,fontSize:o.body,lineHeight:o.body*a.normal},rowPress:{flexDirection:"row",alignItems:"center",gap:r.md,minHeight:Bo},rowMain:{flex:1,gap:2},rowEnd:{alignItems:"flex-end",gap:4},preview:{...face(e,"regular"),color:s.muted,fontSize:o.caption},link:{minHeight:Bo,justifyContent:"center",alignSelf:"flex-start"},linkText:{...face(e,"bold"),color:n.linkInk,fontSize:o.bodyTight,textDecorationLine:"underline"}})}function us(){let t=useEverfurTheme();return e.useMemo(()=>ds(t),[t])}function TelevetConsultScreen({consult:n,controller:l,onJoin:i,onReschedule:o,onCancelled:a,onBack:s,revision:c=0,onMessageVet:u,nowMs:p,style:h}){let f=ss(),m=us(),g=useTelevetBookingController(l),[b,y]=e.useState(0),v=qn(n.consultId,g,c+b),x=useTelevetCancellationPolicy(g),T=Kn(n.consultId,g),{pets:k}=useEverfurPets(),w=useVetThreads(g),[S,j]=e.useState(false),[C,_]=e.useState(null),[I,E]=e.useState(false),[D,P]=e.useState(null),R=v.isError&&v.error?.httpStatus===404,z=R?null:v.data??n,F=z!==null&&d.has(z.status),L=Ja(!F),A=televetJoinReadiness(z,p??L),O=z===null?null:Na(k,z.petId),V=x.data?.summary.trim()||null,N=e.useCallback(()=>{V&&(E(false),T.mutate(C??os.cancelReason,{onSuccess:e=>{j(false),P(e),y(e=>e+1),a?.(e)},onError:()=>E(true)}))},[V,T,a,C]);if(z===null)/* @__PURE__ */
233
235
  return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult-missing",children:[
234
236
  /* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:s,testID:"televet-consult-back"}),
235
- /* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.notFoundTitle,message:Ga.notFoundBody})]});let B=z.status,M=B==="cancelled_owner"||B==="cancelled_ops",H=B==="scheduled"||B==="in_progress",$=canManageTelevetVisit(B)&&D===null,W=z.clinicianName??Ga.vetUnassigned,U=[O,z.reasonText].filter(Boolean).join(" · "),q=w.availability==="lit"?vetThreadPetRef(k,z.petId):null,K=q===null?void 0:w.threads.find(e=>e.petRef===q),Y=q===null?null:{petRef:q,petName:O,vetName:z.clinicianName,...K?{ownerCanStart:K.ownerCanStart}:{}};/* @__PURE__ */
237
+ /* @__PURE__ */r.jsx(TelevetStateCard,{title:os.notFoundTitle,message:os.notFoundBody})]});let B=z.status,M=B==="cancelled_owner"||B==="cancelled_ops",H=B==="scheduled"||B==="in_progress",$=canManageTelevetVisit(B)&&D===null,W=z.clinicianName??os.vetUnassigned,U=[O,z.reasonText].filter(Boolean).join(" · "),q=w.availability==="lit"?vetThreadPetRef(k,z.petId):null,K=q===null?void 0:w.threads.find(e=>e.petRef===q),Y=q===null?null:{petRef:q,petName:O,vetName:z.clinicianName,...K?{ownerCanStart:K.ownerCanStart}:{}};/* @__PURE__ */
236
238
  return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult",children:[
237
239
  /* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:s,testID:"televet-consult-back"}),
238
240
  /* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:f.body,children:[
@@ -240,120 +242,120 @@ return r.jsxs(t.View,{style:[f.screen,h],testID:"televet-consult",children:[
240
242
  /* @__PURE__ */r.jsx(Text,{style:f.visitWhen,accessibilityRole:"header",testID:"televet-consult-when",children:formatWhenWithDay(z.scheduledAt)}),
241
243
  /* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[
242
244
  /* @__PURE__ */r.jsx(Text,{style:f.visitWho,testID:"televet-consult-vet",children:W}),U?/* @__PURE__ */r.jsx(Text,{style:f.visitMeta,numberOfLines:2,children:U}):null]})]}),H&&D===null?/* @__PURE__ */r.jsxs(r.Fragment,{children:[
243
- /* @__PURE__ */r.jsx(TelevetButton,{label:Ga.joinCta,disabled:!A.ready,onPress:()=>i(z,O),testID:"televet-consult-join"}),A.ready?null:/* @__PURE__ */r.jsx(Text,{style:f.reason,testID:"televet-consult-join-reason",children:A.reason==="consult_over"?Ga.joinOverReason:Ga.joinDisabledReason}),Y&&u?/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>u(Y),accessibilityRole:"link",style:m.link,testID:"televet-consult-late",children:/* @__PURE__ */r.jsx(Text,{style:m.linkText,children:Wa($a.runningLateTemplate,{vet:z.clinicianName??Ma})})}):null,$&&o?/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.rescheduleCta,kind:"secondary",onPress:()=>o(z),testID:"televet-consult-reschedule"}):null]}):null,D?/* @__PURE__ */r.jsx(t.View,{style:f.receipt,testID:"televet-consult-cancel-receipt",children:/* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityLiveRegion:"polite",children:D.summary??Ga.phaseCancelled})}):M?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancelled",children:[
244
- /* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityRole:"header",children:Ga.phaseCancelled}),
245
- /* @__PURE__ */r.jsx(Text,{style:f.noticeBody,children:Ga.phaseCancelledBody})]}):null,$?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[V?/* @__PURE__ */r.jsx(Text,{style:f.terms,accessibilityLiveRegion:"polite",testID:"televet-consult-cancellation-policy",children:V}):x.enabled&&x.isPending?/* @__PURE__ */r.jsx(t.View,{testID:"televet-consult-cancellation-policy-loading",children:/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:42})}):/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.cancelPolicyErrorTitle,actionLabel:Ga.retryCta,onAction:()=>x.refetch(),testID:"televet-consult-cancellation-policy-error"}),S?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancel-confirm",children:[
246
- /* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityRole:"header",children:O?Z(Ga.cancelConfirmTitleTemplate,{pet:O}):Ga.cancelConfirmTitle}),
245
+ /* @__PURE__ */r.jsx(TelevetButton,{label:os.joinCta,disabled:!A.ready,onPress:()=>i(z,O),testID:"televet-consult-join"}),A.ready?null:/* @__PURE__ */r.jsx(Text,{style:f.reason,testID:"televet-consult-join-reason",children:A.reason==="consult_over"?os.joinOverReason:os.joinDisabledReason}),Y&&u?/* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>u(Y),accessibilityRole:"link",style:m.link,testID:"televet-consult-late",children:/* @__PURE__ */r.jsx(Text,{style:m.linkText,children:ts(es.runningLateTemplate,{vet:z.clinicianName??Xa})})}):null,$&&o?/* @__PURE__ */r.jsx(TelevetButton,{label:os.rescheduleCta,kind:"secondary",onPress:()=>o(z),testID:"televet-consult-reschedule"}):null]}):null,D?/* @__PURE__ */r.jsx(t.View,{style:f.receipt,testID:"televet-consult-cancel-receipt",children:/* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityLiveRegion:"polite",children:D.summary??os.phaseCancelled})}):M?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancelled",children:[
246
+ /* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityRole:"header",children:os.phaseCancelled}),
247
+ /* @__PURE__ */r.jsx(Text,{style:f.noticeBody,children:os.phaseCancelledBody})]}):null,$?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[V?/* @__PURE__ */r.jsx(Text,{style:f.terms,accessibilityLiveRegion:"polite",testID:"televet-consult-cancellation-policy",children:V}):x.enabled&&x.isPending?/* @__PURE__ */r.jsx(t.View,{testID:"televet-consult-cancellation-policy-loading",children:/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:42})}):/* @__PURE__ */r.jsx(TelevetStateCard,{title:os.cancelPolicyErrorTitle,actionLabel:os.retryCta,onAction:()=>x.refetch(),testID:"televet-consult-cancellation-policy-error"}),S?/* @__PURE__ */r.jsxs(t.View,{style:f.stack,testID:"televet-consult-cancel-confirm",children:[
248
+ /* @__PURE__ */r.jsx(Text,{style:f.noticeTitle,accessibilityRole:"header",children:O?ee(os.cancelConfirmTitleTemplate,{pet:O}):os.cancelConfirmTitle}),
247
249
  /* @__PURE__ */r.jsxs(t.View,{style:f.whyHead,children:[
248
- /* @__PURE__ */r.jsx(Text,{style:f.whyTitle,children:Ga.cancelWhyTitle}),
249
- /* @__PURE__ */r.jsx(Text,{style:f.whyNote,testID:"televet-consult-cancel-optional",children:Ga.cancelWhyOptional})]}),
250
- /* @__PURE__ */r.jsx(t.View,{style:f.stack,accessibilityRole:"radiogroup",accessibilityLabel:`${Ga.cancelWhyTitle} ${Ga.cancelWhyOptional}`,children:[...O?[{id:"better",label:Z(Ga.cancelWhyBetterTemplate,{pet:O})}]:[],{id:"time",label:Ga.cancelWhyTime},{id:"regular-vet",label:Ga.cancelWhyRegularVet},{id:"other",label:Ga.cancelWhyOther}].map(e=>/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[
250
+ /* @__PURE__ */r.jsx(Text,{style:f.whyTitle,children:os.cancelWhyTitle}),
251
+ /* @__PURE__ */r.jsx(Text,{style:f.whyNote,testID:"televet-consult-cancel-optional",children:os.cancelWhyOptional})]}),
252
+ /* @__PURE__ */r.jsx(t.View,{style:f.stack,accessibilityRole:"radiogroup",accessibilityLabel:`${os.cancelWhyTitle} ${os.cancelWhyOptional}`,children:[...O?[{id:"better",label:ee(os.cancelWhyBetterTemplate,{pet:O})}]:[],{id:"time",label:os.cancelWhyTime},{id:"regular-vet",label:os.cancelWhyRegularVet},{id:"other",label:os.cancelWhyOther}].map(e=>/* @__PURE__ */r.jsxs(t.View,{style:f.stack,children:[
251
253
  /* @__PURE__ */r.jsx(TelevetChoiceRow,{title:e.label,selected:C===e.label,onPress:()=>_(C===e.label?null:e.label),testID:`televet-consult-cancel-why-${e.id}`}),e.id==="time"&&C===e.label?/* @__PURE__ */r.jsxs(t.View,{style:f.hint,testID:"televet-consult-cancel-time-hint",children:[
252
- /* @__PURE__ */r.jsx(Text,{style:f.muted,children:Ga.cancelWhyTimeHint}),o?/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelMoveInstead,kind:"quiet",fullWidth:false,onPress:()=>o(z),testID:"televet-consult-cancel-move"}):null]}):null]},e.id))}),I?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:Ga.cancelFailedTitle,testID:"televet-consult-cancel-failed"}):null,
253
- /* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelConfirmCta,kind:"danger",loading:T.isPending,onPress:N,testID:"televet-consult-cancel-yes"}),
254
- /* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelKeepCta,kind:"secondary",disabled:T.isPending,onPress:()=>{j(false),E(false)},testID:"televet-consult-cancel-keep"})]}):/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.cancelCta,kind:"secondary",disabled:!V,onPress:()=>{E(false),j(true)},testID:"televet-consult-cancel"})]}):null,v.isError&&!R?/* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.staleTitle,actionLabel:Ga.staleRetry,onAction:()=>v.refetch(),testID:"televet-consult-stale"}):null]})]})}var ts=/* @__PURE__ */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:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:ts.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:ts.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:ts.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",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 ns(e){switch(e){case"too_early":return"You can join closer to the time.";case"too_late":return"This visit has ended.";case"room_not_ready":return"The room is still being set up. Try again in a moment.";case"not_joinable":return"This visit is no longer open.";case"unavailable":return"No way to join this visit yet.";default:return"That did not open. Try again."}}var rs="No way to join this visit yet.";function ls(e){return e==="room_not_ready"||e==="unknown"}var is=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function os(){let e=globalThis,t=e[is];if(t!==void 0)return t;let n={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[is]=n,n}function as(){return os().dailyRegistered}function ss(e){let t=null;return()=>{if(t!==null)return t;let n=e();return t=n,n.then(void 0,()=>{t===n&&(t=null)}),n}}var cs=/* @__PURE__ */Object.freeze({status:"joining"});function useTelevetJoin(t,n){let[r,l]=e.useState(0),[i,o]=e.useState(cs),a=e.useRef(null);e.useEffect(()=>{let e=n?.joinConsult;if(n===null||e===void 0){o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let l=`${t}#${String(r)}`,i=a.current;if(i===null||i.key!==l){let r;try{r=e.call(n,t)}catch(e){r=Promise.reject(e)}i={key:l,promise:r},a.current=i}let s=true;return o(cs),i.promise.then(e=>{s&&(e.ok?o(/* @__PURE__ */Object.freeze({status:"ready",credential:e.value})):o(/* @__PURE__ */Object.freeze({status:"refused",refusal:vetCallJoinRefusal(e.error),reason:vetCallJoinReason(e.error)})))},()=>{s&&o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unknown",reason:null}))}),()=>{s=false}},[t,n,r]);let s=e.useCallback(()=>l(e=>e+1),[]);return{state:i,retry:s}}var ds=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function us(){let e=globalThis;return e[ds]??=/* @__PURE__ */new Map}function ps(e){let t=us();t.set(e,(t.get(e)??0)+1)}function hs(e){let t=us(),n=t.get(e)??0;n<=1?t.delete(e):t.set(e,n-1)}var fs=e.createContext(null);function ms(t){let n=e.useContext(fs);e.useEffect(()=>{if(!(n===null||!t))return n.setFullBleed(true),()=>{n.setFullBleed(false)}},[n,t])}var gs=ss(()=>Promise.resolve(a));function TelevetJoinScreen({consultId:e,...n}){let l=Bo(),i=bs();return i===null?/* @__PURE__ */r.jsx(t.View,{style:[l.screen,n.style],testID:"televet-join-checking"}):/* @__PURE__ */r.jsx(TelevetJoinGate,{consultId:e,...n,canHostCall:i},e)}function TelevetJoinGate({canHostCall:t,onLeave:n,style:l,...i}){let[o,a]=e.useState(false);ys(()=>(n(),true),!o);let s=e.useCallback(()=>{a(false),n()},[n]);return t?o?/* @__PURE__ */r.jsx(TelevetJoinRoom,{...i,onLeave:s,style:l}):/* @__PURE__ */r.jsx(TelevetRecordingNotice,{onContinue:()=>a(true),onLeave:n,style:l}):/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:n,style:l})}function TelevetJoinRoom({consultId:n,controller:l,clinicianName:i,petName:o,onLeave:a,style:s}){let c=Bo(),d=useTelevetBookingController(l),{state:u,retry:p}=useTelevetJoin(n,d),[h,f]=e.useState(null),[m,g]=e.useState(false),y=u.status==="ready";e.useEffect(()=>{if(!y||h!==null)return;let e=true;return gs().then(t=>{e&&f(()=>t)},()=>{e&&g(true)}),()=>{e=false}},[y,h]);let b=u.status==="ready"?u.credential.roomUrl:null,[v,x]=e.useState(null);e.useEffect(()=>{if(b!==null)return ps(b),x(b),()=>{hs(b)}},[b]);let T=y&&h!==null&&!m;ys(()=>(T||a(),true),true);let k=u.status==="ready"?u.credential:null;if(ms(T&&k!==null&&h.isUsableRoomCredential(k.roomUrl,k.token)&&h.loadEverfurDaily().available),u.status==="refused"||m){let e=u.status==="refused"?u.refusal:"unavailable";/* @__PURE__ */
254
+ /* @__PURE__ */r.jsx(Text,{style:f.muted,children:os.cancelWhyTimeHint}),o?/* @__PURE__ */r.jsx(TelevetButton,{label:os.cancelMoveInstead,kind:"quiet",fullWidth:false,onPress:()=>o(z),testID:"televet-consult-cancel-move"}):null]}):null]},e.id))}),I?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:os.cancelFailedTitle,testID:"televet-consult-cancel-failed"}):null,
255
+ /* @__PURE__ */r.jsx(TelevetButton,{label:os.cancelConfirmCta,kind:"danger",loading:T.isPending,onPress:N,testID:"televet-consult-cancel-yes"}),
256
+ /* @__PURE__ */r.jsx(TelevetButton,{label:os.cancelKeepCta,kind:"secondary",disabled:T.isPending,onPress:()=>{j(false),E(false)},testID:"televet-consult-cancel-keep"})]}):/* @__PURE__ */r.jsx(TelevetButton,{label:os.cancelCta,kind:"secondary",disabled:!V,onPress:()=>{E(false),j(true)},testID:"televet-consult-cancel"})]}):null,v.isError&&!R?/* @__PURE__ */r.jsx(TelevetStateCard,{title:os.staleTitle,actionLabel:os.staleRetry,onAction:()=>v.refetch(),testID:"televet-consult-stale"}):null]})]})}var ps=/* @__PURE__ */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:"",lobbyPrepLabel:"While you wait",lobbyPrepNoPet:"Have your pet nearby and somewhere well lit.",lobbyTitle:e=>{let t=e?.trim()??"";return t.length>0?`${t} is joining`:ps.lobbyTitleNoName},lobbyPrep:e=>{let t=e?.trim()??"";return t.length>0?`Have ${t} nearby and somewhere well lit.`:ps.lobbyPrepNoPet},lobbyDuration:e=>`${e} minutes`,waitingRoomLabel:"Waiting room",leaveWaitingRoomLabel:"Leave the waiting room",lobbyTipsTitle:e=>{let t=e?.trim()??"";return t.length>0?`Before ${t} joins`:ps.lobbyPrepLabel},lobbyTipSpot:"Find a bright, quiet spot.",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 hs(e){switch(e){case"too_early":return"You can join closer to the time.";case"too_late":return"This visit has ended.";case"room_not_ready":return"The room is still being set up. Try again in a moment.";case"not_joinable":return"This visit is no longer open.";case"unavailable":return"No way to join this visit yet.";default:return"That did not open. Try again."}}var fs="No way to join this visit yet.";function ms(e){return e==="room_not_ready"||e==="unknown"}var gs=/* @__PURE__ */Symbol.for("@everfur/sdk/televet");function bs(){let e=globalThis,t=e[gs];if(t!==void 0)return t;let n={presenter:null,snapshot:/* @__PURE__ */Object.freeze({request:null,serial:0,activeHost:null}),hosts:[],nextHost:1,listeners:/* @__PURE__ */new Set,dailyRegistered:false};return e[gs]=n,n}function ys(){return bs().dailyRegistered}function vs(e){let t=null;return()=>{if(t!==null)return t;let n=e();return t=n,n.then(void 0,()=>{t===n&&(t=null)}),n}}var xs=/* @__PURE__ */Object.freeze({status:"joining"});function useTelevetJoin(t,n){let[r,l]=e.useState(0),[i,o]=e.useState(xs),a=e.useRef(null);e.useEffect(()=>{let e=n?.joinConsult;if(n===null||e===void 0){o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unavailable",reason:null}));return}let l=`${t}#${String(r)}`,i=a.current;if(i===null||i.key!==l){let r;try{r=e.call(n,t)}catch(e){r=Promise.reject(e)}i={key:l,promise:r},a.current=i}let s=true;return o(xs),i.promise.then(e=>{s&&(e.ok?o(/* @__PURE__ */Object.freeze({status:"ready",credential:e.value})):o(/* @__PURE__ */Object.freeze({status:"refused",refusal:vetCallJoinRefusal(e.error),reason:vetCallJoinReason(e.error)})))},()=>{s&&o(/* @__PURE__ */Object.freeze({status:"refused",refusal:"unknown",reason:null}))}),()=>{s=false}},[t,n,r]);let s=e.useCallback(()=>l(e=>e+1),[]);return{state:i,retry:s}}var Ts=/* @__PURE__ */Symbol.for("@everfur/sdk/televet/recording-notice-receipt");function ks(){let e=globalThis;return e[Ts]??=/* @__PURE__ */new Map}function ws(e){let t=ks();t.set(e,(t.get(e)??0)+1)}function Ss(e){let t=ks(),n=t.get(e)??0;n<=1?t.delete(e):t.set(e,n-1)}var js=e.createContext(null);function Cs(t){let n=e.useContext(js);e.useEffect(()=>{if(!(n===null||!t))return n.setFullBleed(true),()=>{n.setFullBleed(false)}},[n,t])}var _s=vs(()=>Promise.resolve(s));function TelevetJoinScreen({consultId:e,...n}){let l=Mo(),i=Es();return i===null?/* @__PURE__ */r.jsx(t.View,{style:[l.screen,n.style],testID:"televet-join-checking"}):/* @__PURE__ */r.jsx(TelevetJoinGate,{consultId:e,...n,canHostCall:i},e)}function TelevetJoinGate({canHostCall:t,onLeave:n,style:l,...i}){let[o,a]=e.useState(false);Is(()=>(n(),true),!o);let s=e.useCallback(()=>{a(false),n()},[n]);return t?o?/* @__PURE__ */r.jsx(TelevetJoinRoom,{...i,onLeave:s,style:l}):/* @__PURE__ */r.jsx(TelevetRecordingNotice,{onContinue:()=>a(true),onLeave:n,style:l}):/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:n,style:l})}function TelevetJoinRoom({consultId:n,controller:l,clinicianName:i,petName:o,onLeave:a,style:s}){let c=Mo(),d=useTelevetBookingController(l),{state:u,retry:p}=useTelevetJoin(n,d),[h,f]=e.useState(null),[m,g]=e.useState(false),b=u.status==="ready";e.useEffect(()=>{if(!b||h!==null)return;let e=true;return _s().then(t=>{e&&f(()=>t)},()=>{e&&g(true)}),()=>{e=false}},[b,h]);let y=u.status==="ready"?u.credential.roomUrl:null,[v,x]=e.useState(null);e.useEffect(()=>{if(y!==null)return ws(y),x(y),()=>{Ss(y)}},[y]);let T=b&&h!==null&&!m;Is(()=>(T||a(),true),true);let k=u.status==="ready"?u.credential:null;if(Cs(T&&k!==null&&h.isUsableRoomCredential(k.roomUrl,k.token)&&h.loadEverfurDaily().available),u.status==="refused"||m){let e=u.status==="refused"?u.refusal:"unavailable";/* @__PURE__ */
255
257
  return r.jsxs(t.View,{style:[c.screen,c.stepFill,s],testID:"televet-join-refused",children:[
256
- /* @__PURE__ */r.jsx(TelevetFailureLine,{message:ns(e),testID:"televet-join-refused-message"}),ls(e)&&u.status==="refused"?/* @__PURE__ */r.jsx(TelevetButton,{label:ee.retryCta,kind:"primary",onPress:p,testID:"televet-join-retry"}):null,
257
- /* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:a,testID:"televet-join-leave"})]})}if(u.status==="joining"||h===null||v!==u.credential.roomUrl)/* @__PURE__ */
258
+ /* @__PURE__ */r.jsx(TelevetFailureLine,{message:hs(e),testID:"televet-join-refused-message"}),ms(e)&&u.status==="refused"?/* @__PURE__ */r.jsx(TelevetButton,{label:te.retryCta,kind:"primary",onPress:p,testID:"televet-join-retry"}):null,
259
+ /* @__PURE__ */r.jsx(TelevetButton,{label:ps.leaveCta,kind:"secondary",onPress:a,testID:"televet-join-leave"})]})}if(u.status==="joining"||h===null||v!==u.credential.roomUrl)/* @__PURE__ */
258
260
  return r.jsx(TelevetRecordingNotice,{busy:true,onLeave:a,style:s});let{EverfurVetCall:w}=h;/* @__PURE__ */
259
- return r.jsx(w,{roomUrl:u.credential.roomUrl,token:u.credential.token,onLeave:a,clinicianName:i??null,petName:o??null,consultMinutes:u.credential.callLimits?.consultMinutes??null,renderUnavailable:()=>/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:a,style:s}),style:s})}function TelevetRecordingNotice({onContinue:e,onLeave:n,busy:l=false,style:i}){let o=Bo();/* @__PURE__ */
261
+ return r.jsx(w,{roomUrl:u.credential.roomUrl,token:u.credential.token,onLeave:a,clinicianName:i??null,petName:o??null,consultMinutes:u.credential.callLimits?.consultMinutes??null,renderUnavailable:()=>/* @__PURE__ */r.jsx(TelevetJoinUnavailable,{onLeave:a,style:s}),style:s})}function TelevetRecordingNotice({onContinue:e,onLeave:n,busy:l=false,style:i}){let o=Mo();/* @__PURE__ */
260
262
  return r.jsx(t.View,{style:[o.screen,o.stepFill,i],children:/* @__PURE__ */r.jsxs(t.View,{style:o.stateCard,testID:"everfur-vet-call-recording-notice",accessibilityState:{busy:l},children:[
261
- /* @__PURE__ */r.jsx(Text,{style:o.stateTitle,accessibilityRole:"header",children:ts.recordingNoticeTitle}),
262
- /* @__PURE__ */r.jsx(TelevetButton,{label:ts.recordingNoticeCta,kind:"primary",loading:l,onPress:()=>e?.(),testID:"everfur-vet-call-recording-continue"}),
263
- /* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:n,testID:"everfur-vet-call-recording-leave"})]})})}function TelevetJoinUnavailable({onLeave:e,style:n}){let l=Bo();/* @__PURE__ */
263
+ /* @__PURE__ */r.jsx(Text,{style:o.stateTitle,accessibilityRole:"header",children:ps.recordingNoticeTitle}),
264
+ /* @__PURE__ */r.jsx(TelevetButton,{label:ps.recordingNoticeCta,kind:"primary",loading:l,onPress:()=>e?.(),testID:"everfur-vet-call-recording-continue"}),
265
+ /* @__PURE__ */r.jsx(TelevetButton,{label:ps.leaveCta,kind:"secondary",onPress:n,testID:"everfur-vet-call-recording-leave"})]})})}function TelevetJoinUnavailable({onLeave:e,style:n}){let l=Mo();/* @__PURE__ */
264
266
  return r.jsxs(t.View,{style:[l.screen,l.stepFill,n],testID:"televet-join-call-unavailable",children:[
265
- /* @__PURE__ */r.jsx(TelevetFailureLine,{message:rs}),
266
- /* @__PURE__ */r.jsx(TelevetButton,{label:ts.leaveCta,kind:"secondary",onPress:e,testID:"televet-join-unavailable-leave"})]})}function ys(n,r){G(n,r);let l=e.useRef(n);l.current=n,e.useEffect(()=>{if(!r)return;let e=t.BackHandler.addEventListener("hardwareBackPress",()=>l.current());return()=>{e.remove()}},[r])}function bs(){let[t,n]=e.useState(()=>as()?null:false);return e.useEffect(()=>{let e=true;return gs().then(t=>{if(!e)return;let r=t.loadEverfurDaily();if(n(r.available),!r.available)try{globalThis.console?.warn?.(`${t.EVERFUR_DAILY_SETUP} (${r.reason})`)}catch{}},()=>{e&&n(false)}),()=>{e=false}},[]),t}function EverfurTelevetReschedule(n){let{consult:l,onRescheduled:i,onCancel:o,controller:a,style:s,testID:c}=U(n,["onRescheduled","onCancel"]),d=Bo(),u=useTelevetBookingController(a),p=useTelevetSlots(l?.clinicianId??null,u),h=useTelevetHoldSlot(u),f=useTelevetRescheduleConsult(l?.consultId??null,u),[m,g]=e.useState(null),[y,b]=e.useState(null),{pets:v}=useEverfurPets(),x=useEverfurTheme(),T=e.useMemo(()=>vs(x),[x]),k=e.useCallback(e=>{g(null),h.mutate(e.slotId,{onSuccess:()=>{f.mutate(e.slotId,{onSuccess:e=>i?.(e),onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"failed")})},onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"taken")})},[h,f,i]),w=h.isPending||f.isPending;return isTelevetBookingCopyReady()?l?
267
+ /* @__PURE__ */r.jsx(TelevetFailureLine,{message:fs}),
268
+ /* @__PURE__ */r.jsx(TelevetButton,{label:ps.leaveCta,kind:"secondary",onPress:e,testID:"televet-join-unavailable-leave"})]})}function Is(n,r){J(n,r);let l=e.useRef(n);l.current=n,e.useEffect(()=>{if(!r)return;let e=t.BackHandler.addEventListener("hardwareBackPress",()=>l.current());return()=>{e.remove()}},[r])}function Es(){let[t,n]=e.useState(()=>ys()?null:false);return e.useEffect(()=>{let e=true;return _s().then(t=>{if(!e)return;let r=t.loadEverfurDaily();if(n(r.available),!r.available)try{globalThis.console?.warn?.(`${t.EVERFUR_DAILY_SETUP} (${r.reason})`)}catch{}},()=>{e&&n(false)}),()=>{e=false}},[]),t}function EverfurTelevetReschedule(e){/* @__PURE__ */
269
+ return r.jsx(SdkTabletColumn,{children:/* @__PURE__ */r.jsx(RescheduleBody,{...e})})}function RescheduleBody(n){let{consult:l,onRescheduled:i,onCancel:o,controller:a,style:s,testID:c}=q(n,["onRescheduled","onCancel"]),d=Mo(),u=useTelevetBookingController(a),p=useTelevetSlots(l?.clinicianId??null,u),h=useTelevetHoldSlot(u),f=useTelevetRescheduleConsult(l?.consultId??null,u),[m,g]=e.useState(null),[b,y]=e.useState(null),{pets:v}=useEverfurPets(),x=useEverfurTheme(),T=e.useMemo(()=>Ds(x),[x]),k=e.useCallback(e=>{g(null),h.mutate(e.slotId,{onSuccess:()=>{f.mutate(e.slotId,{onSuccess:e=>i?.(e),onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"failed")})},onError:e=>g(televetBookingRefusal(e).kind==="unavailable"?"unavailable":"taken")})},[h,f,i]),w=h.isPending||f.isPending;return isTelevetBookingCopyReady()?l?
267
270
  /* @__PURE__ */r.jsxs(t.View,{style:[d.screen,d.stepFill,s],testID:c??"televet-reschedule",children:[
268
271
  /* @__PURE__ */r.jsxs(t.View,{style:T.bar,children:[
269
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>o?.(),disabled:w,accessibilityRole:"button",accessibilityLabel:ee.keepExistingCta,testID:"televet-reschedule-keep",style:T.ring,children:/* @__PURE__ */r.jsx(t.View,{style:T.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
270
- /* @__PURE__ */r.jsx(Text,{tier:"compact",style:T.label,children:ee.rescheduleStepLabel})]}),
271
- /* @__PURE__ */r.jsx(Text,{tier:"heading",style:d.stepTitle,accessibilityRole:"header",children:Z(ee.rescheduleTitleTemplate,{pet:Ia(v,l.petId)??ee.petFallback})}),
272
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:()=>o?.(),disabled:w,accessibilityRole:"button",accessibilityLabel:te.keepExistingCta,testID:"televet-reschedule-keep",style:T.ring,children:/* @__PURE__ */r.jsx(t.View,{style:T.chevron,accessibilityElementsHidden:true,importantForAccessibility:"no"})}),
273
+ /* @__PURE__ */r.jsx(Text,{tier:"compact",style:T.label,children:te.rescheduleStepLabel})]}),
274
+ /* @__PURE__ */r.jsx(Text,{tier:"heading",style:d.stepTitle,accessibilityRole:"header",children:ee(te.rescheduleTitleTemplate,{pet:Na(v,l.petId)??te.petFallback})}),
272
275
  /* @__PURE__ */r.jsxs(t.View,{style:T.now,testID:"televet-reschedule-now",children:[
273
- /* @__PURE__ */r.jsx(t.View,{style:T.nowPill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:T.nowPillText,children:ee.rescheduleNowLabel})}),
274
- /* @__PURE__ */r.jsx(Text,{style:T.nowText,accessibilityLabel:Z(ee.rescheduleFromTemplate,{when:fi(l.scheduledAt)}),children:fi(l.scheduledAt)})]}),m==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.slotTaken}):null,m==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.rescheduleFailed}):null,m==="unavailable"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:ee.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,p.enabled?p.isPending?/* @__PURE__ */r.jsx(t.View,{style:d.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):p.isError?/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.slotsErrorTitle,actionLabel:ee.retryCta,onAction:()=>p.refetch(),testID:"televet-reschedule-slots-error"}):(p.data??[]).length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.noSlotsTitle})}):/* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:p.data??[],busySlotId:w?h.variables:null,onPick:e=>{g(null),b(e)},selectedSlot:y,periodLabels:{morning:ee.timeMorning,afternoon:ee.timeAfternoon,evening:ee.timeEvening},rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-paused",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle})}),y?/* @__PURE__ */r.jsx(t.View,{style:d.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:w?ee.rescheduleMoving:Z(ee.rescheduleMoveTemplate,{when:gi(y.startsAt)}),loading:w,onPress:()=>k(y),testID:"televet-reschedule-move"})}):null]}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.list,s],testID:"televet-reschedule-loading",children:[0,1].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.stepFill,s],testID:"televet-reschedule-copy-unapproved"})}function vs(e){let n=Lo(e);return t.StyleSheet.create({bar:{flexDirection:"row",alignItems:"center",gap:14,paddingVertical:e.space.sm},ring:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:n.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:n.ink,transform:[{rotate:"45deg"}]},label:{...face(e,"monoBold"),color:n.muted,fontSize:12,letterSpacing:.96,textTransform:"uppercase"},now:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:10},nowPill:{height:24,paddingHorizontal:10,borderRadius:999,borderWidth:1.5,borderColor:n.line,justifyContent:"center"},nowPillText:{...face(e,"monoBold"),color:n.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},nowText:{...face(e,"regular"),color:n.muted,fontSize:e.type.size.body,textDecorationLine:"line-through"}})}function TelevetVetMessagesCard({threads:e,pets:n,onOpen:l}){let i=Qa(),o=es();/* @__PURE__ */
276
+ /* @__PURE__ */r.jsx(t.View,{style:T.nowPill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:T.nowPillText,children:te.rescheduleNowLabel})}),
277
+ /* @__PURE__ */r.jsx(Text,{style:T.nowText,accessibilityLabel:ee(te.rescheduleFromTemplate,{when:mi(l.scheduledAt)}),children:mi(l.scheduledAt)})]}),m==="taken"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.slotTaken}):null,m==="failed"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.rescheduleFailed}):null,m==="unavailable"?/* @__PURE__ */r.jsx(TelevetFailureLine,{message:te.bookingPausedTitle,testID:"televet-reschedule-unavailable"}):null,p.enabled?p.isPending?/* @__PURE__ */r.jsx(t.View,{style:d.list,testID:"televet-reschedule-slots-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):p.isError?/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.slotsErrorTitle,actionLabel:te.retryCta,onAction:()=>p.refetch(),testID:"televet-reschedule-slots-error"}):(p.data??[]).length===0?/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-empty",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.noSlotsTitle})}):/* @__PURE__ */r.jsx(TelevetSlotPicker,{slots:p.data??[],busySlotId:w?h.variables:null,onPick:e=>{g(null),y(e)},selectedSlot:b,periodLabels:{morning:te.timeMorning,afternoon:te.timeAfternoon,evening:te.timeEvening},rowTestIdPrefix:"televet-reschedule-slot",testID:"televet-reschedule-slots"}):/* @__PURE__ */r.jsx(t.View,{testID:"televet-reschedule-paused",children:/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.bookingPausedTitle})}),b?/* @__PURE__ */r.jsx(t.View,{style:d.scrollFooter,children:/* @__PURE__ */r.jsx(TelevetButton,{label:w?te.rescheduleMoving:ee(te.rescheduleMoveTemplate,{when:bi(b.startsAt)}),loading:w,onPress:()=>k(b),testID:"televet-reschedule-move"})}):null]}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.list,s],testID:"televet-reschedule-loading",children:[0,1].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:48},e))}):/* @__PURE__ */r.jsx(t.View,{style:[d.screen,d.stepFill,s],testID:"televet-reschedule-copy-unapproved"})}function Ds(e){let n=Ao(e);return t.StyleSheet.create({bar:{flexDirection:"row",alignItems:"center",gap:14,paddingVertical:e.space.sm},ring:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:n.line,alignItems:"center",justifyContent:"center"},chevron:{width:10,height:10,marginLeft:4,borderLeftWidth:2,borderBottomWidth:2,borderColor:n.ink,transform:[{rotate:"45deg"}]},label:{...face(e,"monoBold"),color:n.muted,fontSize:12,letterSpacing:.96,textTransform:"uppercase"},now:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:10},nowPill:{height:24,paddingHorizontal:10,borderRadius:999,borderWidth:1.5,borderColor:n.line,justifyContent:"center"},nowPillText:{...face(e,"monoBold"),color:n.muted,fontSize:11,letterSpacing:.9,textTransform:"uppercase"},nowText:{...face(e,"regular"),color:n.muted,fontSize:e.type.size.body,textDecorationLine:"line-through"}})}function TelevetVetMessagesCard({threads:e,pets:n,onOpen:l}){let i=ss(),o=us();/* @__PURE__ */
275
278
  return r.jsxs(t.View,{style:i.card,testID:"televet-messages-card",children:[
276
- /* @__PURE__ */r.jsx(Text,{style:i.title,accessibilityRole:"header",children:$a.messagesTitle}),
277
- /* @__PURE__ */r.jsx(t.View,{style:i.list,children:e.map((e,a)=>{let s=n.find(t=>t.petRef===e.petRef)?.name??null,c=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,d=Ua(Ka(s)),u=e.lastMessage?xs(e.lastMessage):null,p=Ya(e.lastMessageAt),h=e.unreadCount>0;/* @__PURE__ */
278
- return r.jsxs(t.Pressable,{onPress:()=>l({petRef:e.petRef,petName:s,vetName:c,ownerCanStart:e.ownerCanStart}),accessibilityRole:"button",accessibilityLabel:[d,u,p,h?$a.newPillNative:null].filter(Boolean).join(", "),style:[i.row,a===0?i.rowFirst:null,o.rowPress],testID:`televet-messages-row-${e.petRef}`,children:[
279
+ /* @__PURE__ */r.jsx(Text,{style:i.title,accessibilityRole:"header",children:es.messagesTitle}),
280
+ /* @__PURE__ */r.jsx(t.View,{style:i.list,children:e.map((e,a)=>{let s=n.find(t=>t.petRef===e.petRef)?.name??null,c=e.lastMessage?.role==="vet"?e.lastMessage.senderName:null,d=ns(ls(s)),u=e.lastMessage?Ps(e.lastMessage):null,p=is(e.lastMessageAt),h=e.unreadCount>0;/* @__PURE__ */
281
+ return r.jsxs(t.Pressable,{onPress:()=>l({petRef:e.petRef,petName:s,vetName:c,ownerCanStart:e.ownerCanStart}),accessibilityRole:"button",accessibilityLabel:[d,u,p,h?es.newPillNative:null].filter(Boolean).join(", "),style:[i.row,a===0?i.rowFirst:null,o.rowPress],testID:`televet-messages-row-${e.petRef}`,children:[
279
282
  /* @__PURE__ */r.jsxs(t.View,{style:o.rowMain,children:[
280
283
  /* @__PURE__ */r.jsx(Text,{style:i.when,children:d}),u?/* @__PURE__ */r.jsx(Text,{style:o.preview,numberOfLines:1,children:u}):null]}),
281
- /* @__PURE__ */r.jsxs(t.View,{style:o.rowEnd,children:[p?/* @__PURE__ */r.jsx(Text,{style:i.meta,children:p}):null,h?/* @__PURE__ */r.jsx(t.View,{style:[i.pill,{marginLeft:0}],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:i.pillText,children:$a.newPillNative})}):null]})]},e.petRef)})})]})}function xs(e){let t=e.content.split(`\n`)[0]?.trim()??"";return e.role==="owner"?Wa($a.previewOwnerTemplate,{text:t}):t}function TelevetVisitsScreen({controller:n,onOpenVisit:l,onBook:i,onBack:o,revision:a=0,onOpenThread:s,onOpenSummary:d,joinFirst:u,onJoinFirst:p,nowMs:h,style:f}){let m=Qa(),g=useTelevetBookingController(n),y=Wn(g,a),{pets:b}=useEverfurPets(),v=useVetThreads(g,a),x=v.availability==="lit",T=y.data??[],k=T.some(e=>!c.has(e.status)),w=Na(k),S=h??w,{upcoming:j,past:C}=e.useMemo(()=>splitTelevetVisits(T,S),[T,S]),_=y.enabled&&y.isPending,I=y.isError&&y.data===null,E=e.useRef(u??null),D=y.enabled&&!_&&!I;e.useEffect(()=>{let e=E.current;if(e===null||!p||!D)return;E.current=null;let t=j.find(t=>t.consultId===e)??null;p(t,t?Ia(b,t.petId):null)},[D,j,b,p]);let P=e=>{let t=Ia(b,e.petId),n=e.clinicianName;return t&&n?Z(Ga.visitTitleTemplate,{pet:t,vet:n}):t??n},R=(e,n)=>{let i=Ja(e.status),o=P(e);return e.status==="completed"&&x&&d?/* @__PURE__ */r.jsxs(t.Pressable,{onPress:()=>d(e),accessibilityRole:"button",accessibilityLabel:[o??si(e.scheduledAt),i].filter(Boolean).join(", "),style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-summary-${e.consultId}`,children:[
284
+ /* @__PURE__ */r.jsxs(t.View,{style:o.rowEnd,children:[p?/* @__PURE__ */r.jsx(Text,{style:i.meta,children:p}):null,h?/* @__PURE__ */r.jsx(t.View,{style:[i.pill,{marginLeft:0}],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:i.pillText,children:es.newPillNative})}):null]})]},e.petRef)})})]})}function Ps(e){let t=e.content.split(`\n`)[0]?.trim()??"";return e.role==="owner"?ts(es.previewOwnerTemplate,{text:t}):t}function TelevetVisitsScreen({controller:n,onOpenVisit:l,onBook:i,onBack:o,revision:a=0,onOpenThread:s,onOpenSummary:c,joinFirst:u,onJoinFirst:p,nowMs:h,style:f}){let m=ss(),g=useTelevetBookingController(n),b=Un(g,a),{pets:y}=useEverfurPets(),v=useVetThreads(g,a),x=v.availability==="lit",T=b.data??[],k=T.some(e=>!d.has(e.status)),w=Ja(k),S=h??w,{upcoming:j,past:C}=e.useMemo(()=>splitTelevetVisits(T,S),[T,S]),_=b.enabled&&b.isPending,I=b.isError&&b.data===null,E=e.useRef(u??null),D=b.enabled&&!_&&!I;e.useEffect(()=>{let e=E.current;if(e===null||!p||!D)return;E.current=null;let t=j.find(t=>t.consultId===e)??null;p(t,t?Na(y,t.petId):null)},[D,j,y,p]);let P=e=>{let t=Na(y,e.petId),n=e.clinicianName;return t&&n?ee(os.visitTitleTemplate,{pet:t,vet:n}):t??n},R=(e,n)=>{let i=as(e.status),o=P(e);return e.status==="completed"&&x&&c?/* @__PURE__ */r.jsxs(t.Pressable,{onPress:()=>c(e),accessibilityRole:"button",accessibilityLabel:[o??ci(e.scheduledAt),i].filter(Boolean).join(", "),style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-summary-${e.consultId}`,children:[
282
285
  /* @__PURE__ */r.jsxs(t.View,{style:m.rowHead,children:[
283
- /* @__PURE__ */r.jsx(Text,{style:m.when,children:o??si(e.scheduledAt)}),i?/* @__PURE__ */r.jsx(Text,{style:m.status,children:i}):null]}),o?/* @__PURE__ */r.jsx(Text,{style:m.meta,children:si(e.scheduledAt)}):null]},e.consultId):/* @__PURE__ */r.jsxs(t.View,{style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-row-${e.consultId}`,children:[
286
+ /* @__PURE__ */r.jsx(Text,{style:m.when,children:o??ci(e.scheduledAt)}),i?/* @__PURE__ */r.jsx(Text,{style:m.status,children:i}):null]}),o?/* @__PURE__ */r.jsx(Text,{style:m.meta,children:ci(e.scheduledAt)}):null]},e.consultId):/* @__PURE__ */r.jsxs(t.View,{style:[m.row,n===0?m.rowFirst:null],testID:`televet-visits-row-${e.consultId}`,children:[
284
287
  /* @__PURE__ */r.jsxs(t.View,{style:m.rowHead,children:[
285
- /* @__PURE__ */r.jsx(Text,{style:m.when,children:o??si(e.scheduledAt)}),i?/* @__PURE__ */r.jsx(Text,{style:m.status,testID:`televet-visits-status-${e.consultId}`,children:i}):null]}),o?/* @__PURE__ */r.jsx(Text,{style:m.meta,children:si(e.scheduledAt)}):null,e.status==="completed"?null:/* @__PURE__ */r.jsx(TelevetButton,{label:Ga.manageCta,kind:"quiet",fullWidth:false,onPress:()=>l(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)},z=e=>{let n=new Date(e.scheduledAt),i=Number.isNaN(n.getTime())?null:{weekday:n.toLocaleDateString(void 0,{weekday:"short"}),day:String(n.getDate()),month:n.toLocaleDateString(void 0,{month:"short"})},o=e.reasonText?.split(`\n`)[0]?.trim()??"";/* @__PURE__ */
288
+ /* @__PURE__ */r.jsx(Text,{style:m.when,children:o??ci(e.scheduledAt)}),i?/* @__PURE__ */r.jsx(Text,{style:m.status,testID:`televet-visits-status-${e.consultId}`,children:i}):null]}),o?/* @__PURE__ */r.jsx(Text,{style:m.meta,children:ci(e.scheduledAt)}):null,e.status==="completed"?null:/* @__PURE__ */r.jsx(TelevetButton,{label:os.manageCta,kind:"quiet",fullWidth:false,onPress:()=>l(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)},z=e=>{let n=new Date(e.scheduledAt),i=Number.isNaN(n.getTime())?null:{weekday:n.toLocaleDateString(void 0,{weekday:"short"}),day:String(n.getDate()),month:n.toLocaleDateString(void 0,{month:"short"})},o=e.reasonText?.split(`\n`)[0]?.trim()??"";/* @__PURE__ */
286
289
  return r.jsxs(t.View,{style:m.card,testID:`televet-visits-row-${e.consultId}`,children:[
287
290
  /* @__PURE__ */r.jsxs(t.View,{style:m.cardHead,children:[
288
- /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:Ga.upcomingTitle}),e.status==="scheduled"?/* @__PURE__ */r.jsx(t.View,{style:m.pill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:m.pillText,children:Ga.bookedPill})}):null]}),
291
+ /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:os.upcomingTitle}),e.status==="scheduled"?/* @__PURE__ */r.jsx(t.View,{style:m.pill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:m.pillText,children:os.bookedPill})}):null]}),
289
292
  /* @__PURE__ */r.jsxs(t.View,{style:m.visit,children:[i?/* @__PURE__ */r.jsxs(t.View,{style:m.dateTile,accessibilityElementsHidden:true,importantForAccessibility:"no-hide-descendants",children:[
290
293
  /* @__PURE__ */r.jsx(Text,{tier:"badge",style:m.dateTileSmall,children:i.weekday}),
291
294
  /* @__PURE__ */r.jsx(Text,{tier:"heading",style:m.dateTileDay,children:i.day}),
292
295
  /* @__PURE__ */r.jsx(Text,{tier:"badge",style:m.dateTileSmall,children:i.month})]}):null,
293
296
  /* @__PURE__ */r.jsxs(t.View,{style:m.visitMain,children:[P(e)?/* @__PURE__ */r.jsx(Text,{style:m.visitTitle,children:P(e)}):null,
294
- /* @__PURE__ */r.jsx(Text,{style:m.visitLine,children:fi(e.scheduledAt)}),o?/* @__PURE__ */r.jsx(Text,{style:m.visitLine,children:o}):null]})]}),
295
- /* @__PURE__ */r.jsx(TelevetButton,{label:Ga.getReadyCta,kind:"primary",onPress:()=>l(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)};/* @__PURE__ */
297
+ /* @__PURE__ */r.jsx(Text,{style:m.visitLine,children:mi(e.scheduledAt)}),o?/* @__PURE__ */r.jsx(Text,{style:m.visitLine,children:o}):null]})]}),
298
+ /* @__PURE__ */r.jsx(TelevetButton,{label:os.getReadyCta,kind:"primary",onPress:()=>l(e),testID:`televet-visits-open-${e.consultId}`})]},e.consultId)};/* @__PURE__ */
296
299
  return r.jsxs(t.View,{style:[m.screen,f],testID:"televet-visits",children:[
297
300
  /* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:o,testID:"televet-visits-back"}),
298
301
  /* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:m.body,children:[I?
299
302
  /* @__PURE__ */r.jsxs(t.View,{style:m.stack,children:[
300
- /* @__PURE__ */r.jsx(TelevetStateCard,{title:Ga.loadErrorTitle,actionLabel:Ga.retryCta,onAction:()=>y.refetch(),testID:"televet-visits-error"}),i?/* @__PURE__ */r.jsx(BookCard,{title:Ga.bookCardTitle,onBook:i}):null]}):_?/* @__PURE__ */r.jsx(t.View,{style:m.stack,testID:"televet-visits-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72},e))}):T.length===0?
301
- /* @__PURE__ */r.jsxs(t.View,{style:m.stack,testID:"televet-visits-empty",children:[i?/* @__PURE__ */r.jsx(BookCard,{title:Ga.bookCardTitle,onBook:i}):null,
303
+ /* @__PURE__ */r.jsx(TelevetStateCard,{title:os.loadErrorTitle,actionLabel:os.retryCta,onAction:()=>b.refetch(),testID:"televet-visits-error"}),i?/* @__PURE__ */r.jsx(BookCard,{title:os.bookCardTitle,onBook:i}):null]}):_?/* @__PURE__ */r.jsx(t.View,{style:m.stack,testID:"televet-visits-loading",children:[0,1,2].map(e=>/* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72},e))}):T.length===0?
304
+ /* @__PURE__ */r.jsxs(t.View,{style:m.stack,testID:"televet-visits-empty",children:[i?/* @__PURE__ */r.jsx(BookCard,{title:os.bookCardTitle,onBook:i}):null,
302
305
  /* @__PURE__ */r.jsxs(t.View,{style:m.card,children:[
303
- /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:Ga.pastTitle}),
304
- /* @__PURE__ */r.jsx(Text,{style:m.meta,children:Ga.emptyTitle})]})]}):/* @__PURE__ */r.jsxs(t.View,{style:m.body,children:[j.length>0?/* @__PURE__ */r.jsx(t.View,{style:m.body,testID:"televet-visits-upcoming",children:j.map(z)}):i?/* @__PURE__ */r.jsx(BookCard,{title:Ga.bookCardTitle,onBook:i}):null,x&&s&&v.threads.length>0?/* @__PURE__ */r.jsx(TelevetVetMessagesCard,{threads:v.threads,pets:b,onOpen:s}):null,
306
+ /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:os.pastTitle}),
307
+ /* @__PURE__ */r.jsx(Text,{style:m.meta,children:os.emptyTitle})]})]}):/* @__PURE__ */r.jsxs(t.View,{style:m.body,children:[j.length>0?/* @__PURE__ */r.jsx(t.View,{style:m.body,testID:"televet-visits-upcoming",children:j.map(z)}):i?/* @__PURE__ */r.jsx(BookCard,{title:os.bookCardTitle,onBook:i}):null,x&&s&&v.threads.length>0?/* @__PURE__ */r.jsx(TelevetVetMessagesCard,{threads:v.threads,pets:y,onOpen:s}):null,
305
308
  /* @__PURE__ */r.jsxs(t.View,{style:m.card,testID:"televet-visits-past",children:[
306
- /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:Ga.pastTitle}),C.length>0?/* @__PURE__ */r.jsx(t.View,{style:m.list,children:C.map(R)}):null]}),j.length>0&&i?/* @__PURE__ */r.jsx(BookCard,{title:Ga.bookAnotherTitle,onBook:i}):null]}),
307
- /* @__PURE__ */r.jsx(Text,{style:m.footnote,testID:"televet-visits-footnote",children:ee.footnote})]})]})}function BookCard({title:e,onBook:n}){let l=Qa();/* @__PURE__ */
309
+ /* @__PURE__ */r.jsx(Text,{style:m.title,accessibilityRole:"header",children:os.pastTitle}),C.length>0?/* @__PURE__ */r.jsx(t.View,{style:m.list,children:C.map(R)}):null]}),j.length>0&&i?/* @__PURE__ */r.jsx(BookCard,{title:os.bookAnotherTitle,onBook:i}):null]}),
310
+ /* @__PURE__ */r.jsx(Text,{style:m.footnote,testID:"televet-visits-footnote",children:te.footnote})]})]})}function BookCard({title:e,onBook:n}){let l=ss();/* @__PURE__ */
308
311
  return r.jsxs(t.View,{style:l.bookCard,testID:"televet-visits-book-card",children:[
309
312
  /* @__PURE__ */r.jsx(Text,{style:l.bookTitle,children:e}),
310
- /* @__PURE__ */r.jsx(Text,{style:l.bookSubtitle,children:Ga.bookCardSubtitle}),
311
- /* @__PURE__ */r.jsx(TelevetButton,{label:Ga.bookCta,kind:"primary",onPress:n,testID:"televet-visits-book"})]})}var Ts=48,ks=/* @__PURE__ */Object.freeze({flex:1,minHeight:0});function TelevetVetThreadScreen({petRef:petRef,petName:n,vetName:l,ownerCanStart:i,controller:o,onBack:a,style:s}){let c=Qa(),d=es(),u=useTelevetBookingController(o),p=useVetThread(u,petRef,{ownerCanStart:i}),[h,f]=e.useState(""),m=e.useRef(null),g=t.Platform.OS==="ios",y=ha(void 0,g),b=l?.trim()||ws(p.messages),v=qa(b),x=p.messages[p.messages.length-1]?.messageId;e.useEffect(()=>{p.status==="ready"&&m.current?.scrollToEnd?.({animated:false})},[p.status,x]);let T=()=>{let e=h;e.trim().length===0||p.sending||p.send(e).then(e=>{e&&f("")})},k=h.trim().length>0&&!p.sending;/* @__PURE__ */
313
+ /* @__PURE__ */r.jsx(Text,{style:l.bookSubtitle,children:os.bookCardSubtitle}),
314
+ /* @__PURE__ */r.jsx(TelevetButton,{label:os.bookCta,kind:"primary",onPress:n,testID:"televet-visits-book"})]})}var Rs=48,zs=/* @__PURE__ */Object.freeze({flex:1,minHeight:0});function TelevetVetThreadScreen({petRef:petRef,petName:n,vetName:l,ownerCanStart:i,controller:o,onBack:a,style:s}){let c=ss(),d=us(),u=useTelevetBookingController(o),p=useVetThread(u,petRef,{ownerCanStart:i}),[h,f]=e.useState(""),m=e.useRef(null),g=t.Platform.OS==="ios",b=Sa(void 0,g),y=l?.trim()||Fs(p.messages),v=rs(y),x=p.messages[p.messages.length-1]?.messageId;e.useEffect(()=>{p.status==="ready"&&m.current?.scrollToEnd?.({animated:false})},[p.status,x]);let T=()=>{let e=h;e.trim().length===0||p.sending||p.send(e).then(e=>{e&&f("")})},k=h.trim().length>0&&!p.sending;/* @__PURE__ */
312
315
  return r.jsxs(t.View,{style:[c.screen,s],testID:"televet-vet-thread",children:[
313
316
  /* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:a,testID:"televet-vet-thread-back"}),
314
317
  /* @__PURE__ */r.jsxs(t.View,{style:d.head,children:[
315
- /* @__PURE__ */r.jsx(Text,{style:d.screenTitle,accessibilityRole:"header",children:Ua(Ka(n))}),b?/* @__PURE__ */r.jsx(Text,{style:d.meta,children:Wa($a.threadMetaTemplateNative,{vet:b})}):null]}),
316
- /* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:g?"padding":void 0,style:ks,...y.avoidingProps,children:[
317
- /* @__PURE__ */r.jsx(KeyboardOffsetProbe,{probeRef:y.probeRef}),p.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,testID:"televet-vet-thread-loading",accessibilityLabel:$a.loading,children:[
318
+ /* @__PURE__ */r.jsx(Text,{style:d.screenTitle,accessibilityRole:"header",children:ns(ls(n))}),y?/* @__PURE__ */r.jsx(Text,{style:d.meta,children:ts(es.threadMetaTemplateNative,{vet:y})}):null]}),
319
+ /* @__PURE__ */r.jsxs(t.KeyboardAvoidingView,{behavior:g?"padding":void 0,style:zs,...b.avoidingProps,children:[
320
+ /* @__PURE__ */r.jsx(KeyboardOffsetProbe,{probeRef:b.probeRef}),p.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,testID:"televet-vet-thread-loading",accessibilityLabel:es.loading,children:[
318
321
  /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:56}),
319
- /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:56})]}):p.status==="error"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.loadFailed,actionLabel:$a.retry,onAction:p.retry,testID:"televet-vet-thread-error"}):/* @__PURE__ */r.jsxs(t.ScrollView,{ref:m,accessibilityLabel:Wa($a.threadLogTemplate,{vet:v}),contentContainerStyle:d.log,scrollEventThrottle:64,keyboardShouldPersistTaps:"handled",keyboardDismissMode:g?"interactive":"on-drag",onScroll:e=>{e.nativeEvent.contentOffset.y<=Ts&&p.loadOlder()},testID:"televet-vet-thread-log",children:[p.messages.length===0?/* @__PURE__ */r.jsx(Text,{style:d.system,children:$a.empty}):null,p.messages.map((e,t)=>/* @__PURE__ */r.jsx(ThreadItem,{message:e,previous:p.messages[t-1],vet:v,styles:d},e.messageId))]}),p.status==="ready"&&p.canWrite?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,children:[
322
+ /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:56})]}):p.status==="error"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:es.loadFailed,actionLabel:es.retry,onAction:p.retry,testID:"televet-vet-thread-error"}):/* @__PURE__ */r.jsxs(t.ScrollView,{ref:m,accessibilityLabel:ts(es.threadLogTemplate,{vet:v}),contentContainerStyle:d.log,scrollEventThrottle:64,keyboardShouldPersistTaps:"handled",keyboardDismissMode:g?"interactive":"on-drag",onScroll:e=>{e.nativeEvent.contentOffset.y<=Rs&&p.loadOlder()},testID:"televet-vet-thread-log",children:[p.messages.length===0?/* @__PURE__ */r.jsx(Text,{style:d.system,children:es.empty}):null,p.messages.map((e,t)=>/* @__PURE__ */r.jsx(ThreadItem,{message:e,previous:p.messages[t-1],vet:v,styles:d},e.messageId))]}),p.status==="ready"&&p.canWrite?/* @__PURE__ */r.jsxs(t.View,{style:c.stack,children:[
320
323
  /* @__PURE__ */r.jsxs(t.View,{style:d.composer,children:[
321
- /* @__PURE__ */r.jsx(Cr,{value:h,onChangeText:f,multiline:true,accessibilityLabel:Ua(Wa($a.composerLabelTemplateNative,{vet:v})),placeholder:Wa($a.composerPlaceholderTemplate,{vet:v}),style:d.field,testID:"televet-vet-thread-field"}),
322
- /* @__PURE__ */r.jsx(t.Pressable,{onPress:T,disabled:!k,accessibilityRole:"button",accessibilityLabel:$a.send,accessibilityState:{disabled:!k,busy:p.sending},style:[d.send,k?null:d.sendDisabled],testID:"televet-vet-thread-send",children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:d.sendLabel,children:$a.send})})]}),p.sendFailure==="notSent"?/* @__PURE__ */r.jsx(Text,{style:d.failure,accessibilityLiveRegion:"assertive",testID:"televet-vet-thread-failure",children:$a.notSent}):p.sentCount>0?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-status",children:$a.sent}):null,
323
- /* @__PURE__ */r.jsx(Text,{style:d.note,children:Ua(Wa($a.composerNoteTemplate,{vet:v}))})]}):null,p.sendFailure==="vetWritesFirst"?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-vet-first",children:$a.vetWritesFirst}):null]})]})}function ThreadItem({message:e,previous:n,vet:l,styles:i}){let o=ii(e.createdAt),a=n===void 0||ii(n.createdAt)!==o,s=e.attachmentCount>0?Wa($a.attachmentsTemplate,{n:String(e.attachmentCount)}):null;/* @__PURE__ */
324
+ /* @__PURE__ */r.jsx(_r,{value:h,onChangeText:f,multiline:true,accessibilityLabel:ns(ts(es.composerLabelTemplateNative,{vet:v})),placeholder:ts(es.composerPlaceholderTemplate,{vet:v}),style:d.field,testID:"televet-vet-thread-field"}),
325
+ /* @__PURE__ */r.jsx(t.Pressable,{onPress:T,disabled:!k,accessibilityRole:"button",accessibilityLabel:es.send,accessibilityState:{disabled:!k,busy:p.sending},style:[d.send,k?null:d.sendDisabled],testID:"televet-vet-thread-send",children:/* @__PURE__ */r.jsx(Text,{tier:"control",style:d.sendLabel,children:es.send})})]}),p.sendFailure==="notSent"?/* @__PURE__ */r.jsx(Text,{style:d.failure,accessibilityLiveRegion:"assertive",testID:"televet-vet-thread-failure",children:es.notSent}):p.sentCount>0?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-status",children:es.sent}):null]}):null,p.sendFailure==="vetWritesFirst"?/* @__PURE__ */r.jsx(Text,{style:d.note,accessibilityLiveRegion:"polite",testID:"televet-vet-thread-vet-first",children:es.vetWritesFirst}):null]})]})}function ThreadItem({message:e,previous:n,vet:l,styles:i}){let o=oi(e.createdAt),a=n===void 0||oi(n.createdAt)!==o,s=e.attachmentCount>0?ts(es.attachmentsTemplate,{n:String(e.attachmentCount)}):null;/* @__PURE__ */
324
326
  return r.jsxs(r.Fragment,{children:[a?/* @__PURE__ */r.jsx(Text,{style:i.day,children:o}):null,e.role==="system"?/* @__PURE__ */r.jsx(Text,{style:i.system,children:e.content}):/* @__PURE__ */r.jsxs(t.View,{style:[i.item,e.role==="owner"?i.itemMine:null],testID:`televet-vet-thread-message-${e.messageId}`,children:[e.role==="vet"?/* @__PURE__ */r.jsxs(t.View,{style:i.whoRow,children:[
325
- /* @__PURE__ */r.jsx(Text,{style:i.who,children:e.senderName??Ua(l)}),
326
- /* @__PURE__ */r.jsx(Text,{style:i.time,children:ri(e.createdAt)})]}):null,e.content.length>0?/* @__PURE__ */r.jsx(Text,{style:e.role==="owner"?i.bubbleMine:i.bubbleVet,children:e.content}):null,s?/* @__PURE__ */r.jsx(Text,{style:i.attachments,children:s}):null]})]})}function ws(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.role==="vet"?e[t]?.senderName:null;if(n)return n}return null}function TelevetVisitSummaryScreen({consult:e,controller:n,onBack:l,onMessageVet:i,onBook:o,style:a}){let s=Qa(),c=es(),d=useTelevetBookingController(n),u=useVisitSummary(d,e.consultId),{pets:p}=useEverfurPets(),h=Ia(p,e.petId),f=u.summary,m=f?.approvedByName??e.clinicianName,g=qa(m),y=h&&e.clinicianName?Wa(Ga.visitTitleTemplate,{pet:h,vet:e.clinicianName}):Ua(Ka(h)),b=[li(e.scheduledAt),m].filter(Boolean).join(" · "),v=vetThreadPetRef(p,e.petId),x=i&&v!==null?()=>i({petRef:v,petName:h,vetName:m??null}):void 0;/* @__PURE__ */
327
+ /* @__PURE__ */r.jsx(Text,{style:i.who,children:e.senderName??ns(l)}),
328
+ /* @__PURE__ */r.jsx(Text,{style:i.time,children:li(e.createdAt)})]}):null,e.content.length>0?/* @__PURE__ */r.jsx(Text,{style:e.role==="owner"?i.bubbleMine:i.bubbleVet,children:e.content}):null,s?/* @__PURE__ */r.jsx(Text,{style:i.attachments,children:s}):null]})]})}function Fs(e){for(let t=e.length-1;t>=0;t-=1){let n=e[t]?.role==="vet"?e[t]?.senderName:null;if(n)return n}return null}function TelevetVisitSummaryScreen({consult:e,controller:n,onBack:l,onMessageVet:i,onBook:o,style:a}){let s=ss(),c=us(),d=useTelevetBookingController(n),u=useVisitSummary(d,e.consultId),{pets:p}=useEverfurPets(),h=Na(p,e.petId),f=u.summary,m=f?.approvedByName??e.clinicianName,g=rs(m),b=h&&e.clinicianName?ts(os.visitTitleTemplate,{pet:h,vet:e.clinicianName}):ns(ls(h)),y=[ii(e.scheduledAt),m].filter(Boolean).join(" · "),v=vetThreadPetRef(p,e.petId),x=i&&v!==null?()=>i({petRef:v,petName:h,vetName:m??null}):void 0;/* @__PURE__ */
327
329
  return r.jsxs(t.View,{style:[s.screen,a],testID:"televet-visit-summary",children:[
328
330
  /* @__PURE__ */r.jsx(TelevetVisitBackRow,{onBack:l,testID:"televet-visit-summary-back"}),
329
331
  /* @__PURE__ */r.jsxs(t.ScrollView,{contentContainerStyle:s.body,children:[
330
332
  /* @__PURE__ */r.jsxs(t.View,{style:c.head,children:[
331
- /* @__PURE__ */r.jsx(Text,{style:c.screenTitle,accessibilityRole:"header",children:y}),b?/* @__PURE__ */r.jsx(Text,{style:c.meta,children:b}):null]}),u.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:s.stack,testID:"televet-visit-summary-loading",accessibilityLabel:$a.loading,children:[
333
+ /* @__PURE__ */r.jsx(Text,{style:c.screenTitle,accessibilityRole:"header",children:b}),y?/* @__PURE__ */r.jsx(Text,{style:c.meta,children:y}):null]}),u.status==="loading"?/* @__PURE__ */r.jsxs(t.View,{style:s.stack,testID:"televet-visit-summary-loading",accessibilityLabel:es.loading,children:[
332
334
  /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:96}),
333
- /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:96})]}):u.status==="absent"?null:u.status==="pending"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.summaryPending,testID:"televet-visit-summary-pending"}):u.status==="error"||f===null?/* @__PURE__ */r.jsx(TelevetStateCard,{title:$a.loadFailed,actionLabel:$a.retry,onAction:u.retry,testID:"televet-visit-summary-error"}):/* @__PURE__ */r.jsxs(r.Fragment,{children:[f.findingsText.trim().length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,children:[
334
- /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:Ua(Wa($a.sawTitleTemplate,{vet:g}))}),
335
+ /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:96})]}):u.status==="absent"?null:u.status==="pending"?/* @__PURE__ */r.jsx(TelevetStateCard,{title:es.summaryPending,testID:"televet-visit-summary-pending"}):u.status==="error"||f===null?/* @__PURE__ */r.jsx(TelevetStateCard,{title:es.loadFailed,actionLabel:es.retry,onAction:u.retry,testID:"televet-visit-summary-error"}):/* @__PURE__ */r.jsxs(r.Fragment,{children:[f.findingsText.trim().length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,children:[
336
+ /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:ns(ts(es.sawTitleTemplate,{vet:g}))}),
335
337
  /* @__PURE__ */r.jsxs(t.View,{style:s.cardHead,children:[
336
- /* @__PURE__ */r.jsx(Text,{style:c.label,children:$a.summaryLabel}),
337
- /* @__PURE__ */r.jsx(t.View,{style:[s.pill,s.pillLine],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:[s.pillText,s.pillLineText],children:Ua(Wa($a.fromVetTemplate,{vet:g}))})})]}),
338
+ /* @__PURE__ */r.jsx(Text,{style:c.label,children:es.summaryLabel}),
339
+ /* @__PURE__ */r.jsx(t.View,{style:[s.pill,s.pillLine],children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:[s.pillText,s.pillLineText],children:ns(ts(es.fromVetTemplate,{vet:g}))})})]}),
338
340
  /* @__PURE__ */r.jsx(Text,{style:c.body,children:f.findingsText})]}):null,f.nextStepsText.trim().length>0||f.actionItems.length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-plan",children:[
339
341
  /* @__PURE__ */r.jsxs(t.View,{style:s.cardHead,children:[
340
- /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:Ua(Wa($a.planTitleTemplate,{pet:Ka(h)}))}),
341
- /* @__PURE__ */r.jsx(t.View,{style:s.pill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.pillText,children:$a.wordForWord})})]}),f.nextStepsText.trim().length>0?/* @__PURE__ */r.jsx(Text,{style:c.body,children:f.nextStepsText}):null,f.actionItems.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:c.planItem,children:[
342
+ /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:ns(ts(es.planTitleTemplate,{pet:ls(h)}))}),
343
+ /* @__PURE__ */r.jsx(t.View,{style:s.pill,children:/* @__PURE__ */r.jsx(Text,{tier:"badge",style:s.pillText,children:es.wordForWord})})]}),f.nextStepsText.trim().length>0?/* @__PURE__ */r.jsx(Text,{style:c.body,children:f.nextStepsText}):null,f.actionItems.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:c.planItem,children:[
342
344
  /* @__PURE__ */r.jsx(Text,{style:c.planNumber,children:String(n+1).padStart(2,"0")}),
343
345
  /* @__PURE__ */r.jsx(Text,{style:c.planText,children:`“${e}”`})]},`${String(n)}-${e}`))]}):null,f.medications.length>0?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-medications",children:[
344
- /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:$a.fromThisVisitTitle}),f.medications.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[s.row,n===0?s.rowFirst:null],children:[
345
- /* @__PURE__ */r.jsx(Text,{style:s.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:e.sig}):null]},`${String(n)}-${e.drug}`))]}):null,m||x?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-vet",children:[m?/* @__PURE__ */r.jsx(Text,{style:s.title,children:m}):null,f.credentialsText?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:f.credentialsText}):null,x?/* @__PURE__ */r.jsx(TelevetButton,{label:Ua(Wa($a.messageVetTemplate,{vet:g})),kind:"secondary",fullWidth:false,onPress:x,testID:"televet-visit-summary-message"}):null]}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:$a.bookFollowUp,onPress:o,testID:"televet-visit-summary-book"}):null,
346
- /* @__PURE__ */r.jsx(Text,{style:s.footnote,testID:"televet-visit-summary-footnote",children:Wa($a.summaryFootnoteTemplate,{vet:g})})]})]})]})}var Ss=/* @__PURE__ */Object.freeze({name:"home"}),js=/* @__PURE__ */Object.freeze({name:"visits"}),Cs=/* @__PURE__ */Object.freeze({name:"booking"});function televetScreenForRequest(e){let t=e.consultId?.trim()??"";if(t.length>0)/* @__PURE__ */return Object.freeze({name:"join",consultId:t});let n=e.visitRef?.trim()??"";return n.length>0?/* @__PURE__ */Object.freeze({name:"visit",visitRef:n,intent:e.intent??null}):Ss}function _s(e,t){switch(t.type){case"push":/* @__PURE__ */
347
- return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack,t.screen])});case"pop":return e.stack.length<=1?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))});case"land":return e.stack[0]?.name!=="home"?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}function EverfurTelevetFlow(e){let{style:t,renderPending:n,...l}=U(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);/* @__PURE__ */
348
- return r.jsx(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */r.jsx(TelevetFlowBody,{...l,style:t})})}function TelevetFlowBody({petRef:petRef,usState:n,controller:l,onBooked:i,onExit:o,onAddPet:a,onPickMedia:s,onAddToCalendar:c,onConfirmDiscard:d,onRequestLocation:u,locationStatus:p,primaryVet:h,onFindEmergencyVet:f,onTriageReason:m,canJoinInApp:g=false,renderUnavailable:y,initialScreen:b,bookingVariant:v,quickBooking:x,style:T}){let k=Bo(),[w,S]=e.useReducer(_s,b??Ss,e=>/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([e])})),[j,C]=e.useState(()=>b?.name==="join"?b.consultId:null),_=w.stack[w.stack.length-1]??Ss,I=w.stack.length,[E,D]=e.useState(0),P=e.useCallback(()=>D(e=>e+1),[]),R=e.useCallback(()=>I<=1||_.name==="call"||_.name==="booking"?false:(S({type:"pop"}),true),[I,_.name]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",R);return()=>{e.remove()}},[R]),G(R);let z=e.useCallback(()=>y?y():/* @__PURE__ */r.jsx(t.View,{style:k.list,testID:"televet-unavailable",children:isTelevetBookingCopyReady()?/* @__PURE__ */r.jsx(TelevetStateCard,{title:ee.bookingPausedTitle}):null}),[y,k.list]),F=e.useCallback(()=>{I>1?S({type:"pop"}):o?.()},[I,o]),L=e=>S({type:"push",screen:e}),A=e.useCallback(e=>S({type:"land",screen:e==="visits"?js:Cs}),[]),O=/* @__PURE__ */r.jsx(EverfurTelevetBooking,{...petRef!==void 0?{petRef:petRef}:{},...n!==void 0?{usState:n}:{},...l?{controller:l}:{},onBooked:e=>{P(),i?.(e)},onExit:F,...a?{onAddPet:a}:{},...s?{onPickMedia:s}:{},...c?{onAddToCalendar:c}:{},...d?{onConfirmDiscard:d}:{},...u?{onRequestLocation:u}:{},...p?{locationStatus:p}:{},...h?{primaryVet:h}:{},...f?{onFindEmergencyVet:f}:{},...m?{onTriageReason:m}:{},canJoinInApp:g,renderUnavailable:z,...v?{variant:v}:{},...x?{quick:x}:{},style:T}),V=/* @__PURE__ */r.jsx(TelevetVisitsScreen,{...l?{controller:l}:{},revision:E,onOpenVisit:e=>L({name:"consult",consult:e}),onBook:()=>L({name:"booking"}),onBack:F,onOpenThread:e=>L({name:"thread",target:e}),onOpenSummary:e=>L({name:"summary",consult:e}),...j!==null?{joinFirst:j,onJoinFirst:(e,t)=>{C(null),e!==null&&(televetJoinDecision(e,Date.now()).joinable?L({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}):L({name:"consult",consult:e}))}}:{},style:T});switch(_.name){case"home":/* @__PURE__ */
346
+ /* @__PURE__ */r.jsx(Text,{style:s.title,accessibilityRole:"header",children:es.fromThisVisitTitle}),f.medications.map((e,n)=>/* @__PURE__ */r.jsxs(t.View,{style:[s.row,n===0?s.rowFirst:null],children:[
347
+ /* @__PURE__ */r.jsx(Text,{style:s.when,children:[e.drug,e.strength].filter(Boolean).join(" ")}),e.sig?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:e.sig}):null]},`${String(n)}-${e.drug}`))]}):null,m||x?/* @__PURE__ */r.jsxs(t.View,{style:s.card,testID:"televet-visit-summary-vet",children:[m?/* @__PURE__ */r.jsx(Text,{style:s.title,children:m}):null,f.credentialsText?/* @__PURE__ */r.jsx(Text,{style:s.meta,children:f.credentialsText}):null,x?/* @__PURE__ */r.jsx(TelevetButton,{label:ns(ts(es.messageVetTemplate,{vet:g})),kind:"secondary",fullWidth:false,onPress:x,testID:"televet-visit-summary-message"}):null]}):null,o?/* @__PURE__ */r.jsx(TelevetButton,{label:es.bookFollowUp,onPress:o,testID:"televet-visit-summary-book"}):null,
348
+ /* @__PURE__ */r.jsx(Text,{style:s.footnote,testID:"televet-visit-summary-footnote",children:ts(es.summaryFootnoteTemplate,{vet:g})})]})]})]})}var Ls=/* @__PURE__ */Object.freeze({name:"home"}),As=/* @__PURE__ */Object.freeze({name:"visits"}),Os=/* @__PURE__ */Object.freeze({name:"booking"});function televetScreenForRequest(e){let t=e.consultId?.trim()??"";if(t.length>0)/* @__PURE__ */return Object.freeze({name:"join",consultId:t});let n=e.visitRef?.trim()??"";return n.length>0?/* @__PURE__ */Object.freeze({name:"visit",visitRef:n,intent:e.intent??null}):Ls}function Vs(e,t){switch(t.type){case"push":/* @__PURE__ */
349
+ return Object.freeze({stack:/* @__PURE__ */Object.freeze([...e.stack,t.screen])});case"pop":return e.stack.length<=1?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze(e.stack.slice(0,-1))});case"land":return e.stack[0]?.name!=="home"?e:/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([t.screen,...e.stack.slice(1)])});default:return e}}function EverfurTelevetFlow(e){let{style:t,renderPending:n,...l}=q(e,["onExit","onBooked","onAddPet","onRequestLocation","onFindEmergencyVet"]);/* @__PURE__ */
350
+ return r.jsx(CapabilityGate,{capability:"televet",style:t,...n?{renderPending:n}:{},children:/* @__PURE__ */r.jsx(TelevetFlowBody,{...l,style:t})})}function TelevetFlowBody({petRef:petRef,usState:n,controller:l,onBooked:i,onExit:o,onAddPet:a,onPickMedia:s,onAddToCalendar:c,onConfirmDiscard:d,onRequestLocation:u,locationStatus:p,primaryVet:h,onFindEmergencyVet:f,onTriageReason:m,canJoinInApp:g=false,renderUnavailable:b,initialScreen:y,bookingVariant:v,quickBooking:x,style:T}){let k=Mo(),[w,S]=e.useReducer(Vs,y??Ls,e=>/* @__PURE__ */Object.freeze({stack:/* @__PURE__ */Object.freeze([e])})),[j,C]=e.useState(()=>y?.name==="join"?y.consultId:null),_=w.stack[w.stack.length-1]??Ls,I=w.stack.length,[E,D]=e.useState(0),P=e.useCallback(()=>D(e=>e+1),[]),R=e.useCallback(()=>I<=1||_.name==="call"||_.name==="booking"?false:(S({type:"pop"}),true),[I,_.name]);e.useEffect(()=>{let e=t.BackHandler.addEventListener("hardwareBackPress",R);return()=>{e.remove()}},[R]),J(R);let z=e.useCallback(()=>b?b():/* @__PURE__ */r.jsx(t.View,{style:k.list,testID:"televet-unavailable",children:isTelevetBookingCopyReady()?/* @__PURE__ */r.jsx(TelevetStateCard,{title:te.bookingPausedTitle}):null}),[b,k.list]),F=e.useCallback(()=>{I>1?S({type:"pop"}):o?.()},[I,o]),L=e=>S({type:"push",screen:e}),A=e.useCallback(e=>S({type:"land",screen:e==="visits"?As:Os}),[]),O=/* @__PURE__ */r.jsx(EverfurTelevetBooking,{...petRef!==void 0?{petRef:petRef}:{},...n!==void 0?{usState:n}:{},...l?{controller:l}:{},onBooked:e=>{P(),i?.(e)},onExit:F,...a?{onAddPet:a}:{},...s?{onPickMedia:s}:{},...c?{onAddToCalendar:c}:{},...d?{onConfirmDiscard:d}:{},...u?{onRequestLocation:u}:{},...p?{locationStatus:p}:{},...h?{primaryVet:h}:{},...f?{onFindEmergencyVet:f}:{},...m?{onTriageReason:m}:{},canJoinInApp:g,renderUnavailable:z,...v?{variant:v}:{},...x?{quick:x}:{},style:T}),V=/* @__PURE__ */r.jsx(TelevetVisitsScreen,{...l?{controller:l}:{},revision:E,onOpenVisit:e=>L({name:"consult",consult:e}),onBook:()=>L({name:"booking"}),onBack:F,onOpenThread:e=>L({name:"thread",target:e}),onOpenSummary:e=>L({name:"summary",consult:e}),...j!==null?{joinFirst:j,onJoinFirst:(e,t)=>{C(null),e!==null&&(televetJoinDecision(e,Date.now()).joinable?L({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}):L({name:"consult",consult:e}))}}:{},style:T}),N=B();return _.name==="call"?N:/* @__PURE__ */r.jsx(SdkTabletColumn,{children:N});function B(){switch(_.name){case"home":/* @__PURE__ */
349
351
  return r.jsx(TelevetLandingScreen,{controller:l,onLand:A,style:T});case"booking":return O;case"visits":case"visit":case"join":return V;case"consult":/* @__PURE__ */
350
352
  return r.jsx(TelevetConsultScreen,{consult:_.consult,...l?{controller:l}:{},revision:E,onJoin:(e,t)=>L({name:"call",consultId:e.consultId,clinicianName:e.clinicianName,petName:t}),onReschedule:e=>L({name:"reschedule",consult:e}),onCancelled:P,onBack:F,onMessageVet:e=>L({name:"thread",target:e}),style:T});case"reschedule":/* @__PURE__ */
351
353
  return r.jsx(EverfurTelevetReschedule,{consult:_.consult,...l?{controller:l}:{},onRescheduled:()=>{P(),S({type:"pop"})},onCancel:()=>S({type:"pop"}),style:T});case"call":/* @__PURE__ */
352
354
  return r.jsx(TelevetJoinScreen,{consultId:_.consultId,...l?{controller:l}:{},..._.clinicianName!==void 0?{clinicianName:_.clinicianName}:{},..._.petName!==void 0?{petName:_.petName}:{},onLeave:()=>{P(),F()},style:T});case"thread":/* @__PURE__ */
353
355
  return r.jsx(TelevetVetThreadScreen,{petRef:_.target.petRef,petName:_.target.petName,vetName:_.target.vetName,..._.target.ownerCanStart!==void 0?{ownerCanStart:_.target.ownerCanStart}:{},...l?{controller:l}:{},onBack:()=>{P(),F()},style:T});case"summary":/* @__PURE__ */
354
- return r.jsx(TelevetVisitSummaryScreen,{consult:_.consult,...l?{controller:l}:{},onBack:F,onMessageVet:e=>L({name:"thread",target:e}),onBook:()=>L({name:"booking"}),style:T});default:return assertNever(_)}}function TelevetLandingScreen({controller:n,onLand:l,style:i}){let o=Bo(),a=useTelevetBookingController(n),s=Yn(a);return e.useEffect(()=>{s!=="pending"&&l(s)},[s,l]),/* @__PURE__ */r.jsxs(t.View,{style:[o.screen,o.list,i],testID:"televet-landing-loading",children:[
356
+ return r.jsx(TelevetVisitSummaryScreen,{consult:_.consult,...l?{controller:l}:{},onBack:F,onMessageVet:e=>L({name:"thread",target:e}),onBook:()=>L({name:"booking"}),style:T});default:return assertNever(_)}}}function TelevetLandingScreen({controller:n,onLand:l,style:i}){let o=Mo(),a=useTelevetBookingController(n),s=Gn(a);return e.useEffect(()=>{s!=="pending"&&l(s)},[s,l]),/* @__PURE__ */r.jsxs(t.View,{style:[o.screen,o.list,i],testID:"televet-landing-loading",children:[
355
357
  /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72}),
356
- /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72})]})}var Is=EverfurTelevetFlow;function EverfurTelevetModal({request:n,onClose:l,onAddToCalendar:o,onPickMedia:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=i.useSafeAreaInsets(),p=e.useMemo(()=>K(),[]),h=e.useCallback(()=>{p.dispatch()||l()},[p,l]),[f,m]=e.useState(false),g=e.useMemo(()=>({setFullBleed:m}),[]),y=e.useMemo(()=>televetScreenForRequest(n),[n]),b=f||So([d.color.surface])===ko;/* @__PURE__ */
358
+ /* @__PURE__ */r.jsx(TelevetSkeletonBlock,{height:72})]})}var Ns=EverfurTelevetFlow;function EverfurTelevetModal({request:n,onClose:l,onAddToCalendar:o,onPickMedia:a,primaryVet:s,onFindEmergencyVet:c}){let d=useEverfurTheme(),u=i.useSafeAreaInsets(),p=e.useMemo(()=>Y(),[]),h=e.useCallback(()=>{p.dispatch()||l()},[p,l]),[f,m]=e.useState(false),g=e.useMemo(()=>({setFullBleed:m}),[]),b=e.useMemo(()=>televetScreenForRequest(n),[n]),y=f||jo([d.color.surface])===wo;/* @__PURE__ */
357
359
  return r.jsxs(t.Modal,{visible:true,animationType:d.motion.reducedMotion?"none":"slide",presentationStyle:"fullScreen",onRequestClose:h,children:[
358
- /* @__PURE__ */r.jsx(t.StatusBar,{barStyle:b?"light-content":"dark-content",animated:true}),
359
- /* @__PURE__ */r.jsx(t.View,{testID:"everfur-televet-modal",style:[Es.root,{backgroundColor:d.color.surface},f?null:{paddingTop:u.top,paddingBottom:u.bottom}],children:/* @__PURE__ */r.jsx(Y.Provider,{value:p,children:/* @__PURE__ */r.jsx(fs.Provider,{value:g,children:/* @__PURE__ */r.jsx(Is,{...n.petRef!==void 0?{petRef:n.petRef}:{},...n.usState!==void 0?{usState:n.usState}:{},initialScreen:y,onExit:l,...o?{onAddToCalendar:o}:{},...a?{onPickMedia:a}:{},...s?{primaryVet:s}:{},...c?{onFindEmergencyVet:c}:{},canJoinInApp:as(),style:Es.root})})})})]})}var Es=t.StyleSheet.create({root:{flex:1}});function useUpcomingTelevetVisit(t){let n=useTelevetBookingController(),r=t?.enabled!==false&&n!==null,l=Wn(r?n:null);return e.useMemo(()=>r?{upcoming:l.data===null?null:splitTelevetVisits(l.data,Date.now()).upcoming[0]??null,isPending:l.isPending}:{upcoming:null,isPending:false},[r,l.data,l.isPending])}exports.BACK_LABEL=Xo;exports.CANCELLATION_POLICY_VERSION_MAX=m;exports.CANCEL_REASON_MAX=F;exports.CONSULT_KINDS=p;exports.CONSULT_MINUTES=oi;exports.CONSULT_STATUSES=s;exports.EverfurTelevet=Is;exports.EverfurTelevetBooking=EverfurTelevetBooking;exports.EverfurTelevetFlow=EverfurTelevetFlow;exports.EverfurTelevetModal=EverfurTelevetModal;exports.EverfurTelevetReschedule=EverfurTelevetReschedule;exports.MEDIA_REFS_MAX=y;exports.NO_MEDIA_SHORTFALL=Di;exports.REASON_TEXT_MAX=g;exports.TELEVET_BOOKING_BASE=Zt;exports.TELEVET_BOOKING_COPY=ee;exports.TELEVET_BOOKING_STEPS=ql;exports.TELEVET_CONSULT_PAGE_LIMIT=dn;exports.TELEVET_JOIN_CLOSES_MINUTES_AFTER=O;exports.TELEVET_JOIN_OPENS_MINUTES_BEFORE=A;exports.TELEVET_MESSAGE_THREADS_PATH=Dt;exports.TERMINAL_CONSULT_STATUSES=c;exports.TelevetBookedScreen=TelevetBookedScreen;exports.TelevetBookingChrome=TelevetBookingChrome;exports.TelevetClinicianEmptyState=TelevetClinicianEmptyState;exports.TelevetConsentCheckbox=TelevetConsentCheckbox;exports.TelevetConsultScreen=TelevetConsultScreen;exports.TelevetDayStrip=TelevetDayStrip;exports.TelevetEarlyEmergency=TelevetEarlyEmergency;exports.TelevetEmergencyExits=TelevetEmergencyExits;exports.TelevetEntitlementInterestState=TelevetEntitlementInterestState;exports.TelevetIntakeMedia=TelevetIntakeMedia;exports.TelevetJoinScreen=TelevetJoinScreen;exports.TelevetMediaDropNotice=TelevetMediaDropNotice;exports.TelevetSlotPicker=TelevetSlotPicker;exports.TelevetStateInterestAction=TelevetStateInterestAction;exports.TelevetSummaryCard=TelevetSummaryCard;exports.TelevetSummaryRow=TelevetSummaryRow;exports.TelevetVetThreadScreen=TelevetVetThreadScreen;exports.TelevetVisitSummaryScreen=TelevetVisitSummaryScreen;exports.TelevetVisitsScreen=TelevetVisitsScreen;exports.VET_MESSAGES_COPY=$a;exports.VET_MESSAGE_CONTENT_MAX=Pt;exports.VET_MESSAGE_PAGE_DEFAULT=Rt;exports.VET_MESSAGE_PAGE_MAX=zt;exports.attestation=attestation;exports.canConfirm=canConfirm;exports.canManageTelevetVisit=canManageTelevetVisit;exports.createTelevetBookingController=createTelevetBookingController;exports.currentStep=currentStep;exports.emptyTelevetDraft=Kl;exports.formatVisitRange=formatVisitRange;exports.formatWhen=formatWhen;exports.formatWhenWithDay=formatWhenWithDay;exports.hasPreviousStep=hasPreviousStep;exports.initialTelevetBookingState=initialTelevetBookingState;exports.isHoldExpired=isHoldExpired;exports.isMediaShortfallEmpty=isMediaShortfallEmpty;exports.isSkipped=isSkipped;exports.isTelevetBookingCopyReady=isTelevetBookingCopyReady;exports.isVetMessagesDark=isVetMessagesDark;exports.isVetThreadVetFirst=isVetThreadVetFirst;exports.isWellFormedStateCode=isWellFormedStateCode;exports.mediaShortfallFromUnsentPicks=mediaShortfallFromUnsentPicks;exports.parseVetCallCredential=parseVetCallCredential;exports.splitTelevetVisits=splitTelevetVisits;exports.televetBookingKey=televetBookingKey;exports.televetBookingReducer=televetBookingReducer;exports.televetBookingRefusal=televetBookingRefusal;exports.televetCancelCall=televetCancelCall;exports.televetConsultCalendarKey=televetConsultCalendarKey;exports.televetConsultCall=televetConsultCall;exports.televetDaysFromSlots=televetDaysFromSlots;exports.televetEmptyRosterCause=televetEmptyRosterCause;exports.televetEmptyRosterView=televetEmptyRosterView;exports.televetHoldCall=televetHoldCall;exports.televetJoinCall=televetJoinCall;exports.televetJoinOpensAtMs=televetJoinOpensAtMs;exports.televetJoinReadiness=televetJoinReadiness;exports.televetMediaShortfallLines=televetMediaShortfallLines;exports.televetRescheduleCall=televetRescheduleCall;exports.televetScreenForRequest=televetScreenForRequest;exports.televetThreadMessagesCall=televetThreadMessagesCall;exports.televetThreadReadCall=televetThreadReadCall;exports.televetVisitSummaryCall=televetVisitSummaryCall;exports.useEarlyTriage=useEarlyTriage;exports.useStateInterest=useStateInterest;exports.useTelevetBookConsult=useTelevetBookConsult;exports.useTelevetBookingAvailable=useTelevetBookingAvailable;exports.useTelevetBookingController=useTelevetBookingController;exports.useTelevetBookingEntitlement=useTelevetBookingEntitlement;exports.useTelevetCancellationPolicy=useTelevetCancellationPolicy;exports.useTelevetClinicians=useTelevetClinicians;exports.useTelevetHoldSlot=useTelevetHoldSlot;exports.useTelevetJoin=useTelevetJoin;exports.useTelevetNextSlot=useTelevetNextSlot;exports.useTelevetRescheduleConsult=useTelevetRescheduleConsult;exports.useTelevetSlots=useTelevetSlots;exports.useTelevetStatePolicy=useTelevetStatePolicy;exports.useUpcomingTelevetVisit=useUpcomingTelevetVisit;exports.useVetThread=useVetThread;exports.useVetThreads=useVetThreads;exports.useVisitSummary=useVisitSummary;exports.validateBookingBody=validateBookingBody;exports.vetCallJoinReason=vetCallJoinReason;exports.vetCallJoinRefusal=vetCallJoinRefusal;exports.vetThreadPetRef=vetThreadPetRef;exports.withUnsentPicks=withUnsentPicks;
360
+ /* @__PURE__ */r.jsx(t.StatusBar,{barStyle:y?"light-content":"dark-content",animated:true}),
361
+ /* @__PURE__ */r.jsx(t.View,{testID:"everfur-televet-modal",style:[Bs.root,{backgroundColor:d.color.surface},f?null:{paddingTop:u.top,paddingBottom:u.bottom}],children:/* @__PURE__ */r.jsx(SdkColumnReset,{children:/* @__PURE__ */r.jsx(G.Provider,{value:p,children:/* @__PURE__ */r.jsx(js.Provider,{value:g,children:/* @__PURE__ */r.jsx(Ns,{...n.petRef!==void 0?{petRef:n.petRef}:{},...n.usState!==void 0?{usState:n.usState}:{},initialScreen:b,onExit:l,...o?{onAddToCalendar:o}:{},...a?{onPickMedia:a}:{},...s?{primaryVet:s}:{},...c?{onFindEmergencyVet:c}:{},canJoinInApp:ys(),style:Bs.root})})})})})]})}var Bs=t.StyleSheet.create({root:{flex:1}});function useUpcomingTelevetVisit(t){let n=useTelevetBookingController(),r=t?.enabled!==false&&n!==null,l=Un(r?n:null);return e.useMemo(()=>r?{upcoming:l.data===null?null:splitTelevetVisits(l.data,Date.now()).upcoming[0]??null,isPending:l.isPending}:{upcoming:null,isPending:false},[r,l.data,l.isPending])}exports.BACK_LABEL=Zo;exports.CANCELLATION_POLICY_VERSION_MAX=g;exports.CANCEL_REASON_MAX=L;exports.CONSULT_KINDS=h;exports.CONSULT_MINUTES=ai;exports.CONSULT_STATUSES=c;exports.EverfurTelevet=Ns;exports.EverfurTelevetBooking=EverfurTelevetBooking;exports.EverfurTelevetFlow=EverfurTelevetFlow;exports.EverfurTelevetModal=EverfurTelevetModal;exports.EverfurTelevetReschedule=EverfurTelevetReschedule;exports.MEDIA_REFS_MAX=y;exports.NO_MEDIA_SHORTFALL=Pi;exports.REASON_TEXT_MAX=b;exports.TELEVET_BOOKING_BASE=en;exports.TELEVET_BOOKING_COPY=te;exports.TELEVET_BOOKING_STEPS=Kl;exports.TELEVET_CONSULT_PAGE_LIMIT=un;exports.TELEVET_JOIN_CLOSES_MINUTES_AFTER=V;exports.TELEVET_JOIN_OPENS_MINUTES_BEFORE=O;exports.TELEVET_MESSAGE_THREADS_PATH=Pt;exports.TERMINAL_CONSULT_STATUSES=d;exports.TelevetBookedScreen=TelevetBookedScreen;exports.TelevetBookingChrome=TelevetBookingChrome;exports.TelevetClinicianEmptyState=TelevetClinicianEmptyState;exports.TelevetConsentCheckbox=TelevetConsentCheckbox;exports.TelevetConsultScreen=TelevetConsultScreen;exports.TelevetDayStrip=TelevetDayStrip;exports.TelevetEarlyEmergency=TelevetEarlyEmergency;exports.TelevetEmergencyExits=TelevetEmergencyExits;exports.TelevetEntitlementInterestState=TelevetEntitlementInterestState;exports.TelevetIntakeMedia=TelevetIntakeMedia;exports.TelevetJoinScreen=TelevetJoinScreen;exports.TelevetMediaDropNotice=TelevetMediaDropNotice;exports.TelevetSlotPicker=TelevetSlotPicker;exports.TelevetStateInterestAction=TelevetStateInterestAction;exports.TelevetSummaryCard=TelevetSummaryCard;exports.TelevetSummaryRow=TelevetSummaryRow;exports.TelevetVetThreadScreen=TelevetVetThreadScreen;exports.TelevetVisitSummaryScreen=TelevetVisitSummaryScreen;exports.TelevetVisitsScreen=TelevetVisitsScreen;exports.VET_MESSAGES_COPY=es;exports.VET_MESSAGE_CONTENT_MAX=Rt;exports.VET_MESSAGE_PAGE_DEFAULT=zt;exports.VET_MESSAGE_PAGE_MAX=Ft;exports.attestation=attestation;exports.canConfirm=canConfirm;exports.canManageTelevetVisit=canManageTelevetVisit;exports.createTelevetBookingController=createTelevetBookingController;exports.currentStep=currentStep;exports.emptyTelevetDraft=Yl;exports.formatVisitRange=formatVisitRange;exports.formatWhen=formatWhen;exports.formatWhenWithDay=formatWhenWithDay;exports.hasPreviousStep=hasPreviousStep;exports.initialTelevetBookingState=initialTelevetBookingState;exports.isHoldExpired=isHoldExpired;exports.isMediaShortfallEmpty=isMediaShortfallEmpty;exports.isSkipped=isSkipped;exports.isTelevetBookingCopyReady=isTelevetBookingCopyReady;exports.isVetMessagesDark=isVetMessagesDark;exports.isVetThreadVetFirst=isVetThreadVetFirst;exports.isWellFormedStateCode=isWellFormedStateCode;exports.mediaShortfallFromUnsentPicks=mediaShortfallFromUnsentPicks;exports.parseVetCallCredential=parseVetCallCredential;exports.splitTelevetVisits=splitTelevetVisits;exports.televetBookingKey=televetBookingKey;exports.televetBookingReducer=televetBookingReducer;exports.televetBookingRefusal=televetBookingRefusal;exports.televetCancelCall=televetCancelCall;exports.televetConsultCalendarKey=televetConsultCalendarKey;exports.televetConsultCall=televetConsultCall;exports.televetDaysFromSlots=televetDaysFromSlots;exports.televetEmptyRosterCause=televetEmptyRosterCause;exports.televetEmptyRosterView=televetEmptyRosterView;exports.televetHoldCall=televetHoldCall;exports.televetJoinCall=televetJoinCall;exports.televetJoinOpensAtMs=televetJoinOpensAtMs;exports.televetJoinReadiness=televetJoinReadiness;exports.televetMediaShortfallLines=televetMediaShortfallLines;exports.televetRescheduleCall=televetRescheduleCall;exports.televetScreenForRequest=televetScreenForRequest;exports.televetThreadMessagesCall=televetThreadMessagesCall;exports.televetThreadReadCall=televetThreadReadCall;exports.televetVisitSummaryCall=televetVisitSummaryCall;exports.useEarlyTriage=useEarlyTriage;exports.useStateInterest=useStateInterest;exports.useTelevetBookConsult=useTelevetBookConsult;exports.useTelevetBookingAvailable=useTelevetBookingAvailable;exports.useTelevetBookingController=useTelevetBookingController;exports.useTelevetBookingEntitlement=useTelevetBookingEntitlement;exports.useTelevetCancellationPolicy=useTelevetCancellationPolicy;exports.useTelevetClinicians=useTelevetClinicians;exports.useTelevetHoldSlot=useTelevetHoldSlot;exports.useTelevetJoin=useTelevetJoin;exports.useTelevetNextSlot=useTelevetNextSlot;exports.useTelevetRescheduleConsult=useTelevetRescheduleConsult;exports.useTelevetSlots=useTelevetSlots;exports.useTelevetStatePolicy=useTelevetStatePolicy;exports.useUpcomingTelevetVisit=useUpcomingTelevetVisit;exports.useVetThread=useVetThread;exports.useVetThreads=useVetThreads;exports.useVisitSummary=useVisitSummary;exports.validateBookingBody=validateBookingBody;exports.vetCallJoinReason=vetCallJoinReason;exports.vetCallJoinRefusal=vetCallJoinRefusal;exports.vetThreadPetRef=vetThreadPetRef;exports.withUnsentPicks=withUnsentPicks;